]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/library/didactic/exercises/duality.ma
apply and auto.equational_case call saturation.solve_narrowing
[helm.git] / helm / software / matita / library / didactic / exercises / duality.ma
index c04859bd142ea693521ba637ba6c017e979c5516..2862883c569e293ecd8b305600b654947686d893 100644 (file)
@@ -1,10 +1,16 @@
-(* Esercitazione di logica 29/10/2008. 
-
-   Note per gli esercizi: 
-   
-     http://www.cs.unibo.it/~tassi/exercise-duality.ma.html
-
-*)
+(**************************************************************************)
+(*       ___                                                             *)
+(*      ||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
    ===========
@@ -138,8 +144,10 @@ 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
 
@@ -156,6 +164,7 @@ sono necessari i seguenti lemmi:
 * 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*)
 
@@ -196,10 +205,12 @@ let rec negate (F: Formula) on F : Formula ≝
   
    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
    ==========
@@ -210,7 +221,8 @@ 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
    ===========
@@ -247,9 +259,11 @@ let rec dualize (F : Formula) on F : Formula ≝
    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
    ===========
@@ -613,7 +627,7 @@ theorem duality: ∀F1,F2:Formula.F1 ≡ F2 → dualize F1 ≡ dualize F2.
  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.