]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/contribs/formal_topology/overlap/o-algebra.ma
one line
[helm.git] / helm / software / matita / contribs / formal_topology / overlap / o-algebra.ma
index 9e8b473b6e8ff85d753ed67da84af87aefa9b208..4c61f0fb47753fc191b383a9f74bff27c0d718de 100644 (file)
@@ -17,42 +17,29 @@ include "logic/cprop_connectives.ma".
 
 inductive bool : Type := true : bool | false : bool.
 
-<<<<<<< .mine
-lemma BOOL : setoid.
-=======
 lemma BOOL : objs1 SET.
->>>>>>> .r9407
 constructor 1; [apply bool] constructor 1;
 [ intros (x y); apply (match x with [ true ⇒ match y with [ true ⇒ True | _ ⇒ False] | false ⇒ match y with [ true ⇒ False | false ⇒ True ]]);
 | whd; simplify; intros; cases x; apply I;
 | whd; simplify; intros 2; cases x; cases y; simplify; intros; assumption;
-| whd; simplify; intros 3; cases x; cases y; cases z; simplify; intros; try assumption; apply I]
+| whd; simplify; intros 3; cases x; cases y; cases z; simplify; intros; 
+  try assumption; apply I]
 qed.
 
-definition hint: objs1 SET → setoid.
- intros; apply o;
-qed.
+definition setoid_OF_SET: objs1 SET → setoid.
+ intros; apply o; qed.
 
-coercion hint.
+coercion setoid_OF_SET.
 
 lemma IF_THEN_ELSE_p :
   ∀S:setoid.∀a,b:S.∀x,y:BOOL.x = y → 
     (λm.match m with [ true ⇒ a | false ⇒ b ]) x =
     (λm.match m with [ true ⇒ a | false ⇒ b ]) y.
+whd in ⊢ (?→?→?→%→?);
 intros; cases x in H; cases y; simplify; intros; try apply refl; whd in H; cases H;
 qed. 
 
-<<<<<<< .mine
 interpretation "unary morphism comprehension with no proof" 'comprehension T P = 
-=======
-lemma if_then_else : ∀T:SET. ∀a,b:T. arrows1 SET BOOL T.
-intros; constructor 1; intros; 
-[ apply (match c with [ true ⇒ t | false ⇒ t1 ]);
-| apply (IF_THEN_ELSE_p T t t1 a a' H);]
-qed.
-
-interpretation "mk " 'comprehension T P = 
->>>>>>> .r9407
   (mk_unary_morphism T _ P _).
 
 notation > "hvbox({ ident i ∈ s | term 19 p | by })" with precedence 90
@@ -63,24 +50,12 @@ for @{ 'comprehension_by $s (λ${ident i}:$_. $p) $by}.
 interpretation "unary morphism comprehension with proof" 'comprehension_by s \eta.f p = 
   (mk_unary_morphism s _ f p).
 
-<<<<<<< .mine
-=======
-definition A : ∀S:SET.∀a,b:S.arrows1 SET BOOL S.
-apply (λS,a,b.{ x ∈ BOOL | match x with [ true ⇒ a | false ⇒ b] | IF_THEN_ELSE_p S a b}).
-qed.
-
->>>>>>> .r9407
 record OAlgebra : Type := {
   oa_P :> SET;
   oa_leq : binary_morphism1 oa_P oa_P CPROP; (* CPROP is setoid1 *)
   oa_overlap: binary_morphism1 oa_P oa_P CPROP;
-<<<<<<< .mine
-  oa_meet: ∀I:setoid.unary_morphism (unary_morphism_setoid I oa_P) oa_P;
-  oa_join: ∀I:setoid.unary_morphism (unary_morphism_setoid I oa_P) oa_P;
-=======
   oa_meet: ∀I:SET.unary_morphism (arrows1 SET I oa_P) oa_P;
   oa_join: ∀I:SET.unary_morphism (arrows1 SET I oa_P) oa_P;
->>>>>>> .r9407
   oa_one: oa_P;
   oa_zero: oa_P;
   oa_leq_refl: ∀a:oa_P. oa_leq a a; 
@@ -91,20 +66,12 @@ record OAlgebra : Type := {
   oa_join_sup: ∀I.∀p_i.∀p:oa_P.oa_leq (oa_join I p_i) p → ∀i:I.oa_leq (p_i i) p;
   oa_zero_bot: ∀p:oa_P.oa_leq oa_zero p;
   oa_one_top: ∀p:oa_P.oa_leq p oa_one;
-  oa_overlap_preservers_meet: 
+  oa_overlap_preservers_meet_
       ∀p,q.oa_overlap p q → oa_overlap p 
        (oa_meet ? { x ∈ BOOL | match x with [ true ⇒ p | false ⇒ q ] | IF_THEN_ELSE_p oa_P p q });
-<<<<<<< .mine
   oa_join_split:
-      ∀I:setoid.∀p.∀q:I ⇒  oa_P.oa_overlap p (oa_join I q) ⇔ ∃i:I.oa_overlap p (q i);
-  (*
-  oa_base : setoid;
-=======
-     (*(oa_meet BOOL (if_then_else oa_P p q));*)
-  oa_join_split: (* ha I → oa_P da castare a funX (ums A oa_P) *)
       ∀I:SET.∀p.∀q:arrows1 SET I oa_P.oa_overlap p (oa_join I q) ⇔ ∃i:I.oa_overlap p (q i);
   (*oa_base : setoid;
->>>>>>> .r9407
   oa_enum : ums oa_base oa_P;
   oa_density: ∀p,q.(∀i.oa_overlap p (oa_enum i) → oa_overlap q (oa_enum i)) → oa_leq p q
   *)
@@ -122,19 +89,41 @@ notation < "hovbox(mstyle scriptlevel 1 scriptsizemultiplier 1.7 (∧) \below (\
 non associative with precedence 50 for @{ 'oa_meet $p }.
 notation < "hovbox(mstyle scriptlevel 1 scriptsizemultiplier 1.7 (∧) \below (ident i ∈  I) break term 90 p)" 
 non associative with precedence 50 for @{ 'oa_meet_mk (λ${ident i}:$I.$p) }.
+
+(*
 notation < "hovbox(a ∧ b)" left associative with precedence 35
 for @{ 'oa_meet_mk (λ${ident i}:$_.match $i with [ true ⇒ $a | false ⇒ $b ]) }.
-
+*)
 notation > "hovbox(∧ f)" non associative with precedence 60
 for @{ 'oa_meet $f }.
+(*
 notation > "hovbox(a ∧ b)" left associative with precedence 50
 for @{ 'oa_meet (mk_unary_morphism BOOL ? (λx__:bool.match x__ with [ true ⇒ $a | false ⇒ $b ]) (IF_THEN_ELSE_p ? $a $b)) }.
-
+*)
 interpretation "o-algebra meet" 'oa_meet f = 
   (fun_1 __ (oa_meet __) f).
 interpretation "o-algebra meet with explicit function" 'oa_meet_mk f = 
   (fun_1 __ (oa_meet __) (mk_unary_morphism _ _ f _)).
 
+definition binary_meet : ∀O:OAlgebra. binary_morphism1 O O O.
+intros; split;
+[ intros (p q); 
+  apply (∧ { x ∈ BOOL | match x with [ true ⇒ p | false ⇒ q ] | IF_THEN_ELSE_p ? p q });
+| intros; apply (prop_1 ?? (oa_meet O BOOL)); intro x; simplify;
+  cases x; simplify; assumption;]
+qed.
+
+notation "hovbox(a ∧ b)" left associative with precedence 35
+for @{ 'oa_meet_bin $a $b }.
+interpretation "o-algebra binary meet" 'oa_meet_bin a b = 
+  (fun1 ___ (binary_meet _) a b).
+
+lemma oa_overlap_preservers_meet: ∀O:OAlgebra.∀p,q:O.p >< q → p >< (p ∧ q).
+intros;  lapply (oa_overlap_preservers_meet_ O p q f);
+lapply (prop1 O O CPROP (oa_overlap O) p p ? (p ∧ q) # ?);
+[3: apply (if ?? (Hletin1)); apply Hletin;|skip] apply refl1;
+qed.
+
 notation < "hovbox(mstyle scriptlevel 1 scriptsizemultiplier 1.7 (∨) \below (\emsp) \nbsp term 90 p)" 
 non associative with precedence 49 for @{ 'oa_join $p }.
 notation < "hovbox(mstyle scriptlevel 1 scriptsizemultiplier 1.7 (∨) \below (ident i ∈  I) break term 90 p)" 
@@ -153,44 +142,26 @@ interpretation "o-algebra join with explicit function" 'oa_join_mk f =
   (fun_1 __ (oa_join __) (mk_unary_morphism _ _ f _)).
 
 record ORelation (P,Q : OAlgebra) : Type ≝ {
-  or_f :> arrows1 SET P Q;
-  or_f_minus_star : arrows1 SET P Q;
-  or_f_star : arrows1 SET Q P;
-  or_f_minus : arrows1 SET Q P;
-  or_prop1 : ∀p,q. (or_f p ≤ q) = (p ≤ or_f_star q);
-  or_prop2 : ∀p,q. (or_f_minus p ≤ q) = (p ≤ or_f_minus_star q);
-  or_prop3 : ∀p,q. (or_f p >< q) = (p >< or_f_minus q)
+  or_f_ : arrows1 SET P Q;
+  or_f_minus_star_ : arrows1 SET P Q;
+  or_f_star_ : arrows1 SET Q P;
+  or_f_minus_ : arrows1 SET Q P;
+  or_prop1_ : ∀p,q. (or_f_ p ≤ q) = (p ≤ or_f_star_ q);
+  or_prop2_ : ∀p,q. (or_f_minus_ p ≤ q) = (p ≤ or_f_minus_star_ q);
+  or_prop3_ : ∀p,q. (or_f_ p >< q) = (p >< or_f_minus_ q)
 }.
 
-notation "r \sup *" non associative with precedence 90 for @{'OR_f_star $r}.
-notation > "r *" non associative with precedence 90 for @{'OR_f_star $r}.
-interpretation "o-relation f*" 'OR_f_star r = (or_f_star _ _ r).
-
-notation "r \sup (⎻* )" non associative with precedence 90 for @{'OR_f_minus_star $r}.
-notation > "r⎻*" non associative with precedence 90 for @{'OR_f_minus_star $r}.
-interpretation "o-relation f⎻*" 'OR_f_minus_star r = (or_f_minus_star _ _ r).
-
-notation "r \sup ⎻" non associative with precedence 90 for @{'OR_f_minus $r}.
-notation > "r⎻" non associative with precedence 90 for @{'OR_f_minus $r}.
-interpretation "o-relation f⎻" 'OR_f_minus r = (or_f_minus _ _ r).
-
-axiom DAEMON: False.
 
 definition ORelation_setoid : OAlgebra → OAlgebra → setoid1.
 intros (P Q);
 constructor 1;
 [ apply (ORelation P Q);
 | constructor 1;
-<<<<<<< .mine
-   [ alias symbol "and" = "constructive and".
-     apply (λp,q. And4 (∀a.p⎻* a = q⎻* a) (∀a.p⎻ a  = q⎻ a)
-                       (∀a.p a   = q a)   (∀a.p* a  = q* a)); 
-   | whd; simplify; intros; repeat split; intros; apply refl;
-=======
-   [ apply (λp,q. eq1 ? p⎻* q⎻* ∧ eq1 ? p⎻ q⎻ ∧ eq1 ? p q ∧ eq1 ? p* q* ); 
+   [ apply (λp,q. And4 (eq1 ? (or_f_minus_star_ ?? p) (or_f_minus_star_ ?? q)) 
+             (eq1 ? (or_f_minus_ ?? p) (or_f_minus_ ?? q)) 
+             (eq1 ? (or_f_ ?? p) (or_f_ ?? q)) 
+             (eq1 ? (or_f_star_ ?? p) (or_f_star_ ?? q))); 
    | whd; simplify; intros; repeat split; intros; apply refl1;
->>>>>>> .r9407
-<<<<<<< .mine
    | whd; simplify; intros; cases H; clear H; split; 
      intro a; apply sym; generalize in match a;assumption;
    | whd; simplify; intros; cases H; cases H1; clear H H1; split; intro a;
@@ -199,87 +170,115 @@ constructor 1;
      | apply (.= (H4 a)); apply H8;
      | apply (.= (H5 a)); apply H9;]]]
 qed.  
-=======
-   | whd; simplify; intros; cases H; cases H1; cases H3; clear H H3 H1;
-     repeat split; intros; apply sym1; assumption;
-   | whd; simplify; intros; cases H; cases H1; cases H2; cases H4; cases H6; cases H8;
-     repeat split; intros; clear H H1 H2 H4 H6 H8; apply trans1;
-      [2: apply H10;
-      |5: apply H11;
-      |8: apply H7;
-      |11: apply H3;
-      |1,4,7,10: skip
-      |*: assumption
-      ]]]
+
+definition or_f_minus_star: ∀P,Q:OAlgebra.ORelation_setoid P Q ⇒ arrows1 SET P Q.
+ intros; constructor 1;
+  [ apply or_f_minus_star_;
+  | intros; cases H; assumption]
 qed.
->>>>>>> .r9407
 
-<<<<<<< .mine
-definition ORelation_composition : ∀P,Q,R. 
-=======
-lemma hint1 : ∀P,Q. ORelation_setoid P Q → arrows1 SET P Q. intros; apply (or_f ?? c);qed.
-coercion hint1.
+definition or_f: ∀P,Q:OAlgebra.ORelation_setoid P Q ⇒ arrows1 SET P Q.
+ intros; constructor 1;
+  [ apply or_f_;
+  | intros; cases H; assumption]
+qed.
+
+coercion or_f.
+
+definition or_f_minus: ∀P,Q:OAlgebra.ORelation_setoid P Q ⇒ arrows1 SET Q P.
+ intros; constructor 1;
+  [ apply or_f_minus_;
+  | intros; cases H; assumption]
+qed.
+
+definition or_f_star: ∀P,Q:OAlgebra.ORelation_setoid P Q ⇒ arrows1 SET Q P.
+ intros; constructor 1;
+  [ apply or_f_star_;
+  | intros; cases H; assumption]
+qed.
+
+lemma arrows1_OF_ORelation_setoid : ∀P,Q. ORelation_setoid P Q → arrows1 SET P Q.
+intros; apply (or_f ?? c);
+qed.
+
+coercion arrows1_OF_ORelation_setoid nocomposites.
+
+lemma umorphism_OF_ORelation_setoid : ∀P,Q. ORelation_setoid P Q → P ⇒ Q.
+intros; apply (or_f ?? c);
+qed.
+
+coercion umorphism_OF_ORelation_setoid.
+
+
+lemma uncurry_arrows : ∀B,C. arrows1 SET B C → B → C. 
+intros; apply ((fun_1 ?? c) t);
+qed.
+
+coercion uncurry_arrows 1.
 
 lemma hint3 : ∀P,Q. arrows1 SET P Q → P ⇒ Q. intros; apply c;qed.
-coercion hint3.
+coercion hint3 nocomposites.
 
+(*
 lemma hint2: OAlgebra → setoid. intros; apply (oa_P o). qed.
-coercion hint2.
+coercion hint2 nocomposites.
+*)
+
+
+notation "r \sup *" non associative with precedence 90 for @{'OR_f_star $r}.
+notation > "r *" non associative with precedence 90 for @{'OR_f_star $r}.
+
+notation "r \sup (⎻* )" non associative with precedence 90 for @{'OR_f_minus_star $r}.
+notation > "r⎻*" non associative with precedence 90 for @{'OR_f_minus_star $r}.
 
-definition composition : ∀P,Q,R. 
->>>>>>> .r9407
+notation "r \sup ⎻" non associative with precedence 90 for @{'OR_f_minus $r}.
+notation > "r⎻" non associative with precedence 90 for @{'OR_f_minus $r}.
+
+interpretation "o-relation f⎻*" 'OR_f_minus_star r = (fun_1 __ (or_f_minus_star _ _) r).
+interpretation "o-relation f⎻" 'OR_f_minus r = (fun_1 __ (or_f_minus _ _) r).
+interpretation "o-relation f*" 'OR_f_star r = (fun_1 __ (or_f_star _ _) r).
+
+definition or_prop1 : ∀P,Q:OAlgebra.∀F:ORelation_setoid P Q.∀p,q.
+   (F p ≤ q) = (p ≤ F* q).
+intros; apply (or_prop1_ ?? F p q);
+qed.
+
+definition or_prop2 : ∀P,Q:OAlgebra.∀F:ORelation_setoid P Q.∀p,q.
+   (F⎻ p ≤ q) = (p ≤ F⎻* q).
+intros; apply (or_prop2_ ?? F p q);
+qed.
+
+definition or_prop3 : ∀P,Q:OAlgebra.∀F:ORelation_setoid P Q.∀p,q.
+   (F p >< q) = (p >< F⎻ q).
+intros; apply (or_prop3_ ?? F p q);
+qed.
+
+definition ORelation_composition : ∀P,Q,R. 
   binary_morphism1 (ORelation_setoid P Q) (ORelation_setoid Q R) (ORelation_setoid P R).
 intros;
 constructor 1;
 [ intros (F G);
   constructor 1;
-<<<<<<< .mine
-    [ apply {x ∈ P | G (F x)}; intros; simplify; apply (†(†H));
-    | apply {x ∈ P | G⎻* (F⎻* x)}; intros; simplify; apply (†(†H));
-    | apply {x ∈ R | F* (G* x)}; intros; simplify; apply (†(†H));
-    | apply {x ∈ R | F⎻ (G⎻ x)}; intros; simplify; apply (†(†H));
-    | intros; simplify; 
-      lapply (or_prop1 ?? G (F p) q) as H1; lapply (or_prop1 ?? F p (G* q)) as H2;
-      split; intro H; 
-        [ apply (if1 ?? H2); apply (if1 ?? H1); apply H;
-        | apply (fi1 ?? H1); apply (fi1 ?? H2); apply H;] 
-    | intros; simplify;
-      lapply (or_prop2 ?? G p (F⎻* q)) as H1; lapply (or_prop2 ?? F (G⎻ p) q) as H2;
-      split; intro H;
-        [ apply (if1 ?? H1); apply (if1 ?? H2); apply H;   
-        | apply (fi1 ?? H2); apply (fi1 ?? H1); apply H;]
-    | intros; simplify;
-      lapply (or_prop3 ?? F p (G⎻ q)) as H1; lapply (or_prop3 ?? G (F p) q) as H2;
-      split; intro H;
-        [ apply (if1 ?? H1); apply (if1 ?? H2); apply H;   
-        | apply (fi1 ?? H2); apply (fi1 ?? H1); apply H;]]
-| intros; simplify; split; simplify; intros; elim DAEMON;]
-=======
-  [ apply (G ∘ F);
+  [ lapply (G ∘ F);
+    apply (G ∘ F);
   | apply (G⎻* ∘ F⎻* );
   | apply (F* ∘ G* );
   | apply (F⎻ ∘ G⎻);
-  | intros; change with ((G (F p) ≤ q) = (p ≤ (F* (G* q))));
-    apply (.= or_prop1 ??? (F p) ?);
-    apply (.= or_prop1 ??? p ?);
-    apply refl1
-  | intros; change with ((F⎻ (G⎻ p) ≤ q) = (p ≤ (G⎻* (F⎻* q))));
-    apply (.= or_prop2 ??? (G⎻ p) ?);
-    apply (.= or_prop2 ??? p ?);
-    apply refl1;
+  | intros; 
+    change with ((G (F p) ≤ q) = (p ≤ (F* (G* q))));
+    apply (.= (or_prop1 :?));
+    apply (or_prop1 :?);
+  | intros;
+    change with ((F⎻ (G⎻ p) ≤ q) = (p ≤ (G⎻* (F⎻* q))));
+    apply (.= (or_prop2 :?));
+    apply or_prop2 ; 
   | intros; change with ((G (F (p)) >< q) = (p >< (F⎻ (G⎻ q))));
-    apply (.= or_prop3 ??? (F p) ?);
-    apply (.= or_prop3 ??? p ?);
-    apply refl1
+    apply (.= (or_prop3 :?));
+    apply or_prop3;
   ]
-| intros; repeat split; simplify; cases DAEMON (*
-   [ apply trans1; [2: apply prop1; [3: apply rule #; | skip | 4:
-     apply rule (†?);
-   
-     lapply (.= ((†H1)‡#)); [8: apply Hletin;
-   [ apply trans1; [2: lapply (prop1); [apply Hletin;
-*)]
->>>>>>> .r9407
+| intros; split; simplify; 
+   [1,3: unfold arrows1_OF_ORelation_setoid; apply ((†H)‡(†H1));
+   |2,4: apply ((†H1)‡(†H));]]
 qed.
 
 definition OA : category1.
@@ -287,21 +286,15 @@ split;
 [ apply (OAlgebra);
 | intros; apply (ORelation_setoid o o1);
 | intro O; split;
-<<<<<<< .mine
-  [1,2,3,4: constructor 1; [1,3,5,7:apply (λx.x);|*:intros;assumption]
-  |5,6,7:intros;split;intros; assumption;] 
-|4: apply ORelation_composition;
-|*: elim DAEMON;]
-qed. 
-
-
-
-=======
   [1,2,3,4: apply id1;
   |5,6,7:intros; apply refl1;] 
-| apply composition;
-| intros; repeat split; unfold composition; simplify;
-  [1,3: apply (comp_assoc1); | 2,4: apply ((comp_assoc1 ????????) \sup -1);]
-| intros; repeat split; unfold composition; simplify; apply id_neutral_left1;
-| intros; repeat split; unfold composition; simplify; apply id_neutral_right1;]
-qed.>>>>>>> .r9407
+| apply ORelation_composition;
+| intros (P Q R S F G H); split;
+   [ change with (H⎻* ∘ G⎻* ∘ F⎻* = H⎻* ∘ (G⎻* ∘ F⎻* ));
+     apply (comp_assoc1 ????? (F⎻* ) (G⎻* ) (H⎻* ));
+   | apply ((comp_assoc1 ????? (H⎻) (G⎻) (F⎻))^-1);
+   | apply ((comp_assoc1 ????? F G H)^-1);
+   | apply ((comp_assoc1 ????? H* G* F* ));]
+| intros; split; unfold ORelation_composition; simplify; apply id_neutral_left1;
+| intros; split; unfold ORelation_composition; simplify; apply id_neutral_right1;]
+qed.
\ No newline at end of file