+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| A.Asperti, C.Sacerdoti Coen, *)
+(* ||A|| E.Tassi, S.Zacchiroli *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU Lesser General Public License Version 2.1 *)
+(* *)
+(**************************************************************************)
+
(* Esercizio 0
===========
definition if_then_else ≝ λT:Type.λe,t,f.match e return λ_.T with [ true ⇒ t | false ⇒ f].
notation > "'if' term 19 e 'then' term 19 t 'else' term 90 f" non associative with precedence 19 for @{ 'if_then_else $e $t $f }.
notation < "'if' \nbsp term 19 e \nbsp 'then' \nbsp term 19 t \nbsp 'else' \nbsp term 90 f \nbsp" non associative with precedence 19 for @{ 'if_then_else $e $t $f }.
-interpretation "Formula if_then_else" 'if_then_else e t f = (if_then_else _ e t f).
+interpretation "Formula if_then_else" 'if_then_else e t f = (if_then_else ? e t f).
definition max ≝ λn,m. if eqb (n - m) 0 then m else n.
definition min ≝ λn,m. if eqb (n - m) 0 then n else m.
*)
notation < "[[ \nbsp term 19 a \nbsp ]] \nbsp \sub term 90 v" non associative with precedence 90 for @{ 'semantics $v $a }.
notation > "[[ term 19 a ]] \sub term 90 v" non associative with precedence 90 for @{ 'semantics $v $a }.
-notation > "[[ term 19 a ]]_ term 90 v" non associative with precedence 90 for @{ sem $v $a }.
+notation > "[[ term 19 a ]] term 90 v" non associative with precedence 90 for @{ sem $v $a }.
interpretation "Semantic of Formula" 'semantics v a = (sem v a).
definition v20 ≝ λx.
La semantica della formula `(A ∨ C)` nel mondo `v20` in cui
`A` vale `2` e `C` vale `0` deve valere `1`.
+ Decommenta ed esegui.
*)
-eval normalize on [[FOr (FAtom 0) (FAtom 2)]]_v20.
+
+(* eval normalize on [[FOr (FAtom 0) (FAtom 2)]]v20. *)
(*DOCBEGIN
librerie di teoremi già dimostrati. Per portare a termine l'esercitazione
sono necessari i seguenti lemmi:
-* lemma `sem_le_1` : `∀F,v. [[ F ]]_v ≤ 1`
+* lemma `sem_le_1` : `∀F,v. [[ F ]]v ≤ 1`
* lemma `min_1_1` : `∀x. x ≤ 1 → 1 - (1 - x) = x`
* lemma `min_bool` : `∀n. min n 1 = 0 ∨ min n 1 = 1`
-* lemma `min_max` : `∀F,G,v.min (1 - [[F]]_v) (1 - [[G]]_v) = 1 - max [[F]]_v [[G]]_v`
-* lemma `max_min` : `∀F,G,v.max (1 - [[F]]_v) (1 - [[G]]_v) = 1 - min [[F]]_v [[G]]_v`
+* lemma `min_max` : `∀F,G,v.min (1 - [[F]]v) (1 - [[G]]v) = 1 - max [[F]]v [[G]]v`
+* lemma `max_min` : `∀F,G,v.max (1 - [[F]]v) (1 - [[G]]v) = 1 - min [[F]]v [[G]]v`
* lemma `equiv_rewrite` : `∀F1,F2,F3. F1 ≡ F2 → F1 ≡ F3 → F2 ≡ F3`
+* lemma `equiv_sym` : `∀F1,F2. F1 ≡ F2 → F2 ≡ F1`
DOCEND*)
Non modificare quanto segue.
*)
-lemma sem_bool : ∀F,v. [[ F ]]_v = 0 ∨ [[ F ]]_v = 1. intros; elim F; simplify; [left;reflexivity; |right;reflexivity; |cases (v n);[left;|cases n1;right;]reflexivity; |4,5,6: cases H; cases H1; rewrite > H2; rewrite > H3; simplify; first [ left;reflexivity | right; reflexivity ]. |cases H; rewrite > H1; simplify;[right|left]reflexivity;] qed.
+lemma sem_bool : ∀F,v. [[ F ]]v = 0 ∨ [[ F ]]v = 1. intros; elim F; simplify; [left;reflexivity; |right;reflexivity; |cases (v n);[left;|cases n1;right;]reflexivity; |4,5,6: cases H; cases H1; rewrite > H2; rewrite > H3; simplify; first [ left;reflexivity | right; reflexivity ]. |cases H; rewrite > H1; simplify;[right|left]reflexivity;] qed.
lemma min_bool : ∀n. min n 1 = 0 ∨ min n 1 = 1. intros; cases n; [left;reflexivity] cases n1; right; reflexivity; qed.
-lemma min_max : ∀F,G,v. min (1 - [[F]]_v) (1 - [[G]]_v) = 1 - max [[F]]_v [[G]]_v. intros; cases (sem_bool F v);cases (sem_bool G v); rewrite > H; rewrite >H1; simplify; reflexivity; qed.
-lemma max_min : ∀F,G,v. max (1 - [[F]]_v) (1 - [[G]]_v) = 1 - min [[F]]_v [[G]]_v. intros; cases (sem_bool F v);cases (sem_bool G v); rewrite > H; rewrite >H1; simplify; reflexivity; qed.
+lemma min_max : ∀F,G,v. min (1 - [[F]]v) (1 - [[G]]v) = 1 - max [[F]]v [[G]]v. intros; cases (sem_bool F v);cases (sem_bool G v); rewrite > H; rewrite >H1; simplify; reflexivity; qed.
+lemma max_min : ∀F,G,v. max (1 - [[F]]v) (1 - [[G]]v) = 1 - min [[F]]v [[G]]v. intros; cases (sem_bool F v);cases (sem_bool G v); rewrite > H; rewrite >H1; simplify; reflexivity; qed.
lemma min_1_1 : ∀x.x ≤ 1 → 1 - (1 - x) = x. intros; inversion H; intros; destruct; [reflexivity;] rewrite < (le_n_O_to_eq ? H1); reflexivity;qed.
-lemma sem_le_1 : ∀F,v.[[F]]_v ≤ 1. intros; cases (sem_bool F v); rewrite > H; [apply le_O_n|apply le_n]qed.
+lemma sem_le_1 : ∀F,v.[[F]]v ≤ 1. intros; cases (sem_bool F v); rewrite > H; [apply le_O_n|apply le_n]qed.
(* Esercizio 2
===========
Testare la funzione `negate`. Il risultato atteso è:
- FOr (FNot (FAtom O)) (FImpl FTop (FNot (FAtom 1)))
+ FOr (FNot (FAtom O)) (FImpl FTop (FNot (FAtom 1)))
+
+ Decommenta ed esegui
*)
-eval normalize on (negate (FOr (FAtom 0) (FImpl FTop (FAtom 1)))).
+(* eval normalize on (negate (FOr (FAtom 0) (FImpl FTop (FAtom 1)))). *)
(* ATTENZIONE
==========
Non modificare quanto segue
*)
-definition equiv ≝ λF1,F2. ∀v.[[ F1 ]]_v = [[ F2 ]]_v.
+definition equiv ≝ λF1,F2. ∀v.[[ F1 ]]v = [[ F2 ]]v.
notation "hvbox(a \nbsp break mstyle color #0000ff (≡) \nbsp b)" non associative with precedence 45 for @{ 'equivF $a $b }.
notation > "a ≡ b" non associative with precedence 50 for @{ equiv $a $b }.
interpretation "equivalence for Formulas" 'equivF a b = (equiv a b).
-lemma equiv_rewrite : ∀F1,F2,F3. F1 ≡ F2 → F1 ≡ F3 → F2 ≡ F3. intros; intro; autobatch. qed.
+lemma equiv_rewrite : ∀F1,F2,F3. F1 ≡ F2 → F1 ≡ F3 → F2 ≡ F3. intros; intro; rewrite < H; rewrite < H1; reflexivity. qed.
+lemma equiv_sym : ∀a,b.a ≡ b → b ≡ a. intros 4;symmetry;apply H;qed.
(* Esercizio 3
===========
Testare la funzione `dualize`. Il risultato atteso è:
FAnd (FNot (FAtom O)) (FOr (FAtom 1) FTop)
+
+ Decommenta ed esegui.
*)
-eval normalize on (dualize (FImpl (FAtom 0) (FAnd (FAtom 1) FBot))).
+(* eval normalize on (dualize (FImpl (FAtom 0) (FAnd (FAtom 1) FBot))). *)
(* Spiegazione
===========
a `F` in un mondo invertito.
*)
lemma negate_invert:
- ∀F:Formula.∀v:ℕ→ℕ.[[ negate F ]]_v=[[ F ]]_(invert v).
+ ∀F:Formula.∀v:ℕ→ℕ.[[ negate F ]]v=[[ F ]](invert v).
assume F:Formula.
assume v:(ℕ→ℕ).
-we proceed by induction on F to prove ([[ negate F ]]_v=[[ F ]]_(invert v)).
+we proceed by induction on F to prove ([[ negate F ]]v=[[ F ]](invert v)).
case FBot.
(*BEGIN*)
- the thesis becomes ([[ negate FBot ]]_v=[[ FBot ]]_(invert v)).
+ the thesis becomes ([[ negate FBot ]]v=[[ FBot ]](invert v)).
(*END*)
done.
case FTop.
(*BEGIN*)
- the thesis becomes ([[ negate FTop ]]_v=[[ FTop ]]_(invert v)).
+ the thesis becomes ([[ negate FTop ]]v=[[ FTop ]](invert v)).
(*END*)
done.
case FAtom.
assume n : ℕ.
- the thesis becomes ((*BEGIN*)[[ negate (FAtom n) ]]_v=[[ FAtom n ]]_(invert v)(*END*)).
+ the thesis becomes ((*BEGIN*)[[ negate (FAtom n) ]]v=[[ FAtom n ]](invert v)(*END*)).
the thesis becomes ((*BEGIN*)1 - (min (v n) 1)= min (invert v n) 1(*END*)).
the thesis becomes (1 - (min (v n) 1)= min (if eqb (min (v n) 1) 0 then 1 else 0) 1).
by min_bool we proved (min (v n) 1 = 0 ∨ min (v n) 1 = 1) (H1);
case FAnd.
assume f : Formula.
by induction hypothesis we know
- ((*BEGIN*)[[ negate f ]]_v=[[ f ]]_(invert v)(*END*)) (H).
+ ((*BEGIN*)[[ negate f ]]v=[[ f ]](invert v)(*END*)) (H).
assume f1 : Formula.
by induction hypothesis we know
- ((*BEGIN*)[[ negate f1 ]]_v=[[ f1 ]]_(invert v)(*END*)) (H1).
+ ((*BEGIN*)[[ negate f1 ]]v=[[ f1 ]](invert v)(*END*)) (H1).
the thesis becomes
- ([[ negate (FAnd f f1) ]]_v=[[ FAnd f f1 ]]_(invert v)).
+ ([[ negate (FAnd f f1) ]]v=[[ FAnd f f1 ]](invert v)).
the thesis becomes
- (min [[ negate f ]]_v [[ negate f1]]_v = [[ FAnd f f1 ]]_(invert v)).
+ (min [[ negate f ]]v [[ negate f1]]v = [[ FAnd f f1 ]](invert v)).
conclude
- (min [[ negate f ]]_v [[ negate f1]]_v)
- = (min [[ f ]]_(invert v) [[ negate f1]]_v) by (*BEGIN*)H(*END*).
- = (min [[ f ]]_(invert v) [[ f1]]_(invert v)) by (*BEGIN*)H1(*END*).
+ (min [[ negate f ]]v [[ negate f1]]v)
+ = (min [[ f ]](invert v) [[ negate f1]]v) by (*BEGIN*)H(*END*).
+ = (min [[ f ]](invert v) [[ f1]](invert v)) by (*BEGIN*)H1(*END*).
done.
case FOr.
(*BEGIN*)
assume f : Formula.
by induction hypothesis we know
- ([[ negate f ]]_v=[[ f ]]_(invert v)) (H).
+ ([[ negate f ]]v=[[ f ]](invert v)) (H).
assume f1 : Formula.
by induction hypothesis we know
- ([[ negate f1 ]]_v=[[ f1 ]]_(invert v)) (H1).
+ ([[ negate f1 ]]v=[[ f1 ]](invert v)) (H1).
the thesis becomes
- ([[ negate (FOr f f1) ]]_v=[[ FOr f f1 ]]_(invert v)).
+ ([[ negate (FOr f f1) ]]v=[[ FOr f f1 ]](invert v)).
the thesis becomes
- (max [[ negate f ]]_v [[ negate f1]]_v = [[ FOr f f1 ]]_(invert v)).
+ (max [[ negate f ]]v [[ negate f1]]v = [[ FOr f f1 ]](invert v)).
conclude
- (max [[ negate f ]]_v [[ negate f1]]_v)
- = (max [[ f ]]_(invert v) [[ negate f1]]_v) by H.
- = (max [[ f ]]_(invert v) [[ f1]]_(invert v)) by H1.
+ (max [[ negate f ]]v [[ negate f1]]v)
+ = (max [[ f ]](invert v) [[ negate f1]]v) by H.
+ = (max [[ f ]](invert v) [[ f1]](invert v)) by H1.
(*END*)
done.
case FImpl.
(*BEGIN*)
assume f : Formula.
by induction hypothesis we know
- ([[ negate f ]]_v=[[ f ]]_(invert v)) (H).
+ ([[ negate f ]]v=[[ f ]](invert v)) (H).
assume f1 : Formula.
by induction hypothesis we know
- ([[ negate f1 ]]_v=[[ f1 ]]_(invert v)) (H1).
+ ([[ negate f1 ]]v=[[ f1 ]](invert v)) (H1).
the thesis becomes
- ([[ negate (FImpl f f1) ]]_v=[[ FImpl f f1 ]]_(invert v)).
+ ([[ negate (FImpl f f1) ]]v=[[ FImpl f f1 ]](invert v)).
the thesis becomes
- (max (1 - [[ negate f ]]_v) [[ negate f1]]_v = [[ FImpl f f1 ]]_(invert v)).
+ (max (1 - [[ negate f ]]v) [[ negate f1]]v = [[ FImpl f f1 ]](invert v)).
conclude
- (max (1 - [[ negate f ]]_v) [[ negate f1]]_v)
- = (max (1 - [[ f ]]_(invert v)) [[ negate f1]]_v) by H.
- = (max (1 - [[ f ]]_(invert v)) [[ f1]]_(invert v)) by H1.
+ (max (1 - [[ negate f ]]v) [[ negate f1]]v)
+ = (max (1 - [[ f ]](invert v)) [[ negate f1]]v) by H.
+ = (max (1 - [[ f ]](invert v)) [[ f1]](invert v)) by H1.
(*END*)
done.
case FNot.
(*BEGIN*)
assume f : Formula.
by induction hypothesis we know
- ([[ negate f ]]_v=[[ f ]]_(invert v)) (H).
+ ([[ negate f ]]v=[[ f ]](invert v)) (H).
the thesis becomes
- ([[ negate (FNot f) ]]_v=[[ FNot f ]]_(invert v)).
+ ([[ negate (FNot f) ]]v=[[ FNot f ]](invert v)).
the thesis becomes
- (1 - [[ negate f ]]_v=[[ FNot f ]]_(invert v)).
- conclude (1 - [[ negate f ]]_v) = (1 - [[f]]_(invert v)) by H.
+ (1 - [[ negate f ]]v=[[ FNot f ]](invert v)).
+ conclude (1 - [[ negate f ]]v) = (1 - [[f]](invert v)) by H.
(*END*)
done.
qed.
assume (*BEGIN*)G:Formula(*END*).
suppose (*BEGIN*)(F ≡ G) (H)(*END*).
the thesis becomes (*BEGIN*)(negate F ≡ negate G)(*END*).
- the thesis becomes (*BEGIN*)(∀v:ℕ→ℕ.[[ negate F ]]_v=[[ negate G ]]_v)(*END*).
+ the thesis becomes (*BEGIN*)(∀v:ℕ→ℕ.[[ negate F ]]v=[[ negate G ]]v)(*END*).
assume v:(ℕ→ℕ).
conclude
- [[ negate F ]]_v
- = [[ F ]]_(invert v) by (*BEGIN*)negate_invert(*END*).
- = [[ G ]]_((*BEGIN*)invert v(*BEGIN*)) by (*BEGIN*)H(*BEGIN*).
- = [[ negate G ]]_(*BEGIN*)v(*BEGIN*) by (*BEGIN*)negate_invert(*END*).
+ [[ negate F ]]v
+ = [[ F ]](invert v) by (*BEGIN*)negate_invert(*END*).
+ = [[ G ]]((*BEGIN*)invert v(*BEGIN*)) by (*BEGIN*)H(*BEGIN*).
+ = [[ negate G ]](*BEGIN*)v(*BEGIN*) by (*BEGIN*)negate_invert(*END*).
done.
qed.
∀F:Formula.negate F ≡ FNot (dualize F).
(*BEGIN*)
assume F:Formula.
- the thesis becomes (∀v:ℕ→ℕ.[[negate F]]_v=[[FNot (dualize F)]]_v).
+ the thesis becomes (∀v:ℕ→ℕ.[[negate F]]v=[[FNot (dualize F)]]v).
(*END*)
assume v:(ℕ→ℕ).
- we proceed by induction on F to prove ([[negate F]]_v=[[FNot (dualize F)]]_v).
+ we proceed by induction on F to prove ([[negate F]]v=[[FNot (dualize F)]]v).
case FBot.
(*BEGIN*)
- the thesis becomes ([[ negate FBot ]]_v=[[ FNot (dualize FBot) ]]_v).
+ the thesis becomes ([[ negate FBot ]]v=[[ FNot (dualize FBot) ]]v).
(*END*)
done.
case FTop.
(*BEGIN*)
- the thesis becomes ([[ negate FTop ]]_v=[[ FNot (dualize FTop) ]]_v).
+ the thesis becomes ([[ negate FTop ]]v=[[ FNot (dualize FTop) ]]v).
(*END*)
done.
case FAtom.
(*BEGIN*)
assume n : ℕ.
- the thesis becomes ([[ negate (FAtom n) ]]_v=[[ FNot (dualize (FAtom n)) ]]_v).
+ the thesis becomes ([[ negate (FAtom n) ]]v=[[ FNot (dualize (FAtom n)) ]]v).
(*END*)
done.
case FAnd.
assume f : Formula.
by induction hypothesis we know
- ([[ negate f ]]_v=[[ FNot (dualize f) ]]_v) (H).
+ ([[ negate f ]]v=[[ FNot (dualize f) ]]v) (H).
assume f1 : Formula.
by induction hypothesis we know
- ([[ negate f1 ]]_v=[[ FNot (dualize f1) ]]_v) (H1).
+ ([[ negate f1 ]]v=[[ FNot (dualize f1) ]]v) (H1).
the thesis becomes
- ([[ negate (FAnd f f1) ]]_v=[[ FNot (dualize (FAnd f f1)) ]]_v).
+ ([[ negate (FAnd f f1) ]]v=[[ FNot (dualize (FAnd f f1)) ]]v).
the thesis becomes
- (min [[ negate f ]]_v [[ negate f1 ]]_v=[[ FNot (dualize (FAnd f f1)) ]]_v).
+ (min [[ negate f ]]v [[ negate f1 ]]v=[[ FNot (dualize (FAnd f f1)) ]]v).
conclude
- (min (*BEGIN*)[[ negate f ]]_v(*END*) (*BEGIN*)[[ negate f1 ]]_v(*END*))
- = (min (*BEGIN*)[[ FNot (dualize f) ]]_v(*END*) (*BEGIN*)[[ negate f1 ]]_v(*END*)) by H.
- = (min (*BEGIN*)[[ FNot (dualize f) ]]_v(*END*) (*BEGIN*)[[ FNot (dualize f1) ]]_v(*END*)) by H1.
- = (min (1 - [[ dualize f ]]_v) (1 - [[ dualize f1 ]]_v)).
- = (1 - (max [[ dualize f ]]_v [[ dualize f1 ]]_v)) by min_max.
+ (min (*BEGIN*)[[ negate f ]]v(*END*) (*BEGIN*)[[ negate f1 ]]v(*END*))
+ = (min (*BEGIN*)[[ FNot (dualize f) ]]v(*END*) (*BEGIN*)[[ negate f1 ]]v(*END*)) by H.
+ = (min (*BEGIN*)[[ FNot (dualize f) ]]v(*END*) (*BEGIN*)[[ FNot (dualize f1) ]]v(*END*)) by H1.
+ = (min (1 - [[ dualize f ]]v) (1 - [[ dualize f1 ]]v)).
+ = (1 - (max [[ dualize f ]]v [[ dualize f1 ]]v)) by min_max.
done.
case FOr.
(*BEGIN*)
assume f : Formula.
by induction hypothesis we know
- ([[ negate f ]]_v=[[ FNot (dualize f) ]]_v) (H).
+ ([[ negate f ]]v=[[ FNot (dualize f) ]]v) (H).
assume f1 : Formula.
by induction hypothesis we know
- ([[ negate f1 ]]_v=[[ FNot (dualize f1) ]]_v) (H1).
+ ([[ negate f1 ]]v=[[ FNot (dualize f1) ]]v) (H1).
the thesis becomes
- ([[ negate (FOr f f1) ]]_v=[[ FNot (dualize (FOr f f1)) ]]_v).
+ ([[ negate (FOr f f1) ]]v=[[ FNot (dualize (FOr f f1)) ]]v).
the thesis becomes
- (max [[ negate f ]]_v [[ negate f1 ]]_v=[[ FNot (dualize (FOr f f1)) ]]_v).
+ (max [[ negate f ]]v [[ negate f1 ]]v=[[ FNot (dualize (FOr f f1)) ]]v).
conclude
- (max [[ negate f ]]_v [[ negate f1 ]]_v)
- = (max [[ FNot (dualize f) ]]_v [[ negate f1 ]]_v) by H.
- = (max [[ FNot (dualize f) ]]_v [[ FNot (dualize f1) ]]_v) by H1.
- = (max (1 - [[ dualize f ]]_v) (1 - [[ dualize f1 ]]_v)).
- = (1 - (min [[ dualize f ]]_v [[ dualize f1 ]]_v)) by max_min.
+ (max [[ negate f ]]v [[ negate f1 ]]v)
+ = (max [[ FNot (dualize f) ]]v [[ negate f1 ]]v) by H.
+ = (max [[ FNot (dualize f) ]]v [[ FNot (dualize f1) ]]v) by H1.
+ = (max (1 - [[ dualize f ]]v) (1 - [[ dualize f1 ]]v)).
+ = (1 - (min [[ dualize f ]]v [[ dualize f1 ]]v)) by max_min.
(*END*)
done.
case FImpl.
(*BEGIN*)
assume f : Formula.
by induction hypothesis we know
- ([[ negate f ]]_v=[[ FNot (dualize f) ]]_v) (H).
+ ([[ negate f ]]v=[[ FNot (dualize f) ]]v) (H).
assume f1 : Formula.
by induction hypothesis we know
- ([[ negate f1 ]]_v=[[ FNot (dualize f1) ]]_v) (H1).
+ ([[ negate f1 ]]v=[[ FNot (dualize f1) ]]v) (H1).
the thesis becomes
- ([[ negate (FImpl f f1) ]]_v=[[ FNot (dualize (FImpl f f1)) ]]_v).
+ ([[ negate (FImpl f f1) ]]v=[[ FNot (dualize (FImpl f f1)) ]]v).
the thesis becomes
- (max (1 - [[ negate f ]]_v) [[ negate f1 ]]_v=[[ FNot (dualize (FImpl f f1)) ]]_v).
+ (max (1 - [[ negate f ]]v) [[ negate f1 ]]v=[[ FNot (dualize (FImpl f f1)) ]]v).
conclude
- (max (1-[[ negate f ]]_v) [[ negate f1 ]]_v)
- = (max (1-[[ FNot (dualize f) ]]_v) [[ negate f1 ]]_v) by H.
- = (max (1-[[ FNot (dualize f) ]]_v) [[ FNot (dualize f1) ]]_v) by H1.
- = (max (1 - [[ FNot (dualize f) ]]_v) (1 - [[ dualize f1 ]]_v)).
- = (1 - (min [[ FNot (dualize f) ]]_v [[ dualize f1 ]]_v)) by max_min.
+ (max (1-[[ negate f ]]v) [[ negate f1 ]]v)
+ = (max (1-[[ FNot (dualize f) ]]v) [[ negate f1 ]]v) by H.
+ = (max (1-[[ FNot (dualize f) ]]v) [[ FNot (dualize f1) ]]v) by H1.
+ = (max (1 - [[ FNot (dualize f) ]]v) (1 - [[ dualize f1 ]]v)).
+ = (1 - (min [[ FNot (dualize f) ]]v [[ dualize f1 ]]v)) by max_min.
(*END*)
done.
case FNot.
(*BEGIN*)
assume f : Formula.
by induction hypothesis we know
- ([[ negate f ]]_v=[[ FNot (dualize f) ]]_v) (H).
+ ([[ negate f ]]v=[[ FNot (dualize f) ]]v) (H).
the thesis becomes
- ([[ negate (FNot f) ]]_v=[[ FNot (dualize (FNot f)) ]]_v).
+ ([[ negate (FNot f) ]]v=[[ FNot (dualize (FNot f)) ]]v).
the thesis becomes
- (1 - [[ negate f ]]_v=[[ FNot (dualize (FNot f)) ]]_v).
- conclude (1 - [[ negate f ]]_v) = (1 - [[ FNot (dualize f) ]]_v) by H.
+ (1 - [[ negate f ]]v=[[ FNot (dualize (FNot f)) ]]v).
+ conclude (1 - [[ negate f ]]v) = (1 - [[ FNot (dualize f) ]]v) by H.
(*END*)
done.
qed.
assume G:Formula.
suppose (FNot F ≡ FNot G) (H).
the thesis becomes (F ≡ G).
- the thesis becomes (∀v:ℕ→ℕ.[[ F ]]_v=[[ G ]]_v).
+ the thesis becomes (∀v:ℕ→ℕ.[[ F ]]v=[[ G ]]v).
(*END*)
assume v:(ℕ→ℕ).
- by sem_le_1 we proved ([[F]]_v ≤ 1) (H1).
- by (*BEGIN*)sem_le_1(*END*) we proved ([[G]]_v ≤ 1) (H2).
- by min_1_1, H1 we proved (1 - (1 - [[F]]_v) = [[F]]_v) (H3).
- by (*BEGIN*)min_1_1, H2(*END*) we proved ((*BEGIN*)1 - (1 - [[G]]_v)(*END*) = [[G]]_v) (H4).
+ by sem_le_1 we proved ([[F]]v ≤ 1) (H1).
+ by (*BEGIN*)sem_le_1(*END*) we proved ([[G]]v ≤ 1) (H2).
+ by min_1_1, H1 we proved (1 - (1 - [[F]]v) = [[F]]v) (H3).
+ by (*BEGIN*)min_1_1, H2(*END*) we proved ((*BEGIN*)1 - (1 - [[G]]v)(*END*) = [[G]]v) (H4).
conclude
- ([[F]]_v)
- = (1 - (1 - [[F]]_v)) by (*BEGIN*)H3(*END*).
- = (1 - [[(*BEGIN*)FNot F(*END*)]]_v).
- = (1 - [[ FNot G]]_v) by H.
- = (1 - (*BEGIN*)(1 - [[G]]_v)(*END*)).
- = [[G]]_v by (*BEGIN*)H4(*END*).
+ ([[F]]v)
+ = (1 - (1 - [[F]]v)) by (*BEGIN*)H3(*END*).
+ = (1 - [[(*BEGIN*)FNot F(*END*)]]v).
+ = (1 - [[ FNot G]]v) by H.
+ = (1 - (*BEGIN*)(1 - [[G]]v)(*END*)).
+ = [[G]]v by (*BEGIN*)H4(*END*).
done.
qed.
1. lemma `negate_invert`, dimostrato per induzione su F, utilizzando
`min_bool`
- ∀F:Formula.∀v:ℕ→ℕ.[[ negate F ]]_v=[[ F ]]_(invert v).
+ ∀F:Formula.∀v:ℕ→ℕ.[[ negate F ]]v=[[ F ]]_(invert v).
2. lemma `negate_fun`, conseguenza di `negate_invert`
the thesis becomes (dualize F1 ≡ dualize F2).
by (*BEGIN*)negate_fun(*END*), H we proved (negate F1 ≡ negate F2) (H1).
by (*BEGIN*)not_dualize_eq_negate(*END*), (*BEGIN*)equiv_rewrite(*END*), H1 we proved (FNot (dualize F1) ≡ negate F2) (H2).
- by (*BEGIN*)not_dualize_eq_negate(*END*), (*BEGIN*)equiv_rewrite(*END*), H2 we proved (FNot (dualize F1) ≡ FNot (dualize F2)) (H3).
+ by (*BEGIN*)not_dualize_eq_negate(*END*), (*BEGIN*)equiv_rewrite(*END*), H2, equiv_sym we proved (FNot (dualize F1) ≡ FNot (dualize F2)) (H3).
by (*BEGIN*)not_inj(*END*), H3 we proved (dualize F1 ≡ dualize F2) (H4).
by H4 done.
qed.