]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/contribs/formal_topology/overlap/o-algebra.ma
Basic pairs went through with no problems.
[helm.git] / helm / software / matita / contribs / formal_topology / overlap / o-algebra.ma
index 5f99153ba85d6a477b05b7280a888d112678afcb..533bff3ddd2e191a8305fe229210261033d29fce 100644 (file)
@@ -49,18 +49,9 @@ interpretation "unary morphism comprehension with proof" 'comprehension_by s \et
 interpretation "unary morphism1 comprehension with proof" 'comprehension_by s \eta.f p = 
   (mk_unary_morphism1 s _ f p).
 
-definition hint: Type_OF_category2 SET1 → setoid2.
- intro; apply (setoid2_of_setoid1 t); qed.
-coercion hint.
-
-definition hint2: Type_OF_category1 SET → objs2 SET1.
- intro; apply (setoid1_of_setoid t); qed.
-coercion hint2.
-
 (* per il set-indexing vedere capitolo BPTools (foundational tools), Sect. 0.3.4 complete
    lattices, Definizione 0.9 *)
 (* USARE L'ESISTENZIALE DEBOLE *)
-(* Far salire SET usando setoidi1 *)
 (*alias symbol "comprehension_by" = "unary morphism comprehension with proof".*)
 record OAlgebra : Type2 := {
   oa_P :> SET1;
@@ -100,7 +91,7 @@ interpretation "o-algebra leq" 'leq a b = (fun21 ___ (oa_leq _) a b).
 
 notation "hovbox(a mpadded width -150% (>)< b)" non associative with precedence 45
 for @{ 'overlap $a $b}.
-interpretation "o-algebra overlap" 'overlap a b = (fun22 ___ (oa_overlap _) a b).
+interpretation "o-algebra overlap" 'overlap a b = (fun21 ___ (oa_overlap _) a b).
 
 notation < "hovbox(mstyle scriptlevel 1 scriptsizemultiplier 1.7 (∧) \below (\emsp) \nbsp term 90 p)" 
 non associative with precedence 50 for @{ 'oa_meet $p }.
@@ -118,26 +109,43 @@ 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 = 
-  (fun11 __ (oa_meet __) f).
+  (fun12 __ (oa_meet __) f).
 interpretation "o-algebra meet with explicit function" 'oa_meet_mk f = 
-  (fun11 __ (oa_meet __) (mk_unary_morphism _ _ f _)).
+  (fun12 __ (oa_meet __) (mk_unary_morphism _ _ f _)).
+
+definition hint3: OAlgebra → setoid1.
+ intro; apply (oa_P o);
+qed.
+coercion hint3.
+
+definition hint4: ∀A. setoid2_OF_OAlgebra A → hint3 A.
+ intros; apply t;
+qed.
+coercion hint4.
 
 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;]
+| intros; lapply (prop12 ? O (oa_meet O BOOL));
+   [2: apply ({ x ∈ BOOL | match x with [ true ⇒ a | false ⇒ b ] | IF_THEN_ELSE_p ? a b });
+   |3: apply ({ x ∈ BOOL | match x with [ true ⇒ a' | false ⇒ b' ] | IF_THEN_ELSE_p ? a' b' });
+   | apply Hletin;]
+  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).
+  (fun21 ___ (binary_meet _) a b).
+
+coercion Type1_OF_OAlgebra nocomposites.
 
 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) # ?);
+(* next change to avoid universe inconsistency *)
+change in ⊢ (?→%→%→?) with (Type1_OF_OAlgebra O);
+intros;  lapply (oa_overlap_preserves_meet_ O p q f);
+lapply (prop21 O O CPROP (oa_overlap O) p p ? (p ∧ q) # ?);
 [3: apply (if ?? (Hletin1)); apply Hletin;|skip] apply refl1;
 qed.
 
@@ -154,95 +162,101 @@ notation > "hovbox(a ∨ b)" left associative with precedence 49
 for @{ 'oa_join (mk_unary_morphism BOOL ? (λx__:bool.match x__ with [ true ⇒ $a | false ⇒ $b ]) (IF_THEN_ELSE_p ? $a $b)) }.
 
 interpretation "o-algebra join" 'oa_join f = 
-  (fun_1 __ (oa_join __) f).
+  (fun12 __ (oa_join __) f).
 interpretation "o-algebra join with explicit function" 'oa_join_mk f = 
-  (fun_1 __ (oa_join __) (mk_unary_morphism _ _ f _)).
+  (fun12 __ (oa_join __) (mk_unary_morphism _ _ f _)).
+
+definition hint5: OAlgebra → objs2 SET1.
+ intro; apply (oa_P o);
+qed.
+coercion hint5.
 
 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_f_ : P ⇒ Q;
+  or_f_minus_star_ : P ⇒ Q;
+  or_f_star_ : Q ⇒ P;
+  or_f_minus_ : 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)
 }.
 
-
-definition ORelation_setoid : OAlgebra → OAlgebra → setoid1.
+definition ORelation_setoid : OAlgebra → OAlgebra → setoid2.
 intros (P Q);
 constructor 1;
 [ apply (ORelation P Q);
 | constructor 1;
    (* tenere solo una uguaglianza e usare la proposizione 9.9 per
       le altre (unicita' degli aggiunti e del simmetrico) *)
-   [ 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;
+   [ apply (λp,q. And4 (eq2 ? (or_f_minus_star_ ?? p) (or_f_minus_star_ ?? q)) 
+             (eq2 ? (or_f_minus_ ?? p) (or_f_minus_ ?? q)) 
+             (eq2 ? (or_f_ ?? p) (or_f_ ?? q)) 
+             (eq2 ? (or_f_star_ ?? p) (or_f_star_ ?? q))); 
+   | whd; simplify; intros; repeat split; intros; apply refl2;
    | whd; simplify; intros; cases H; clear H; split; 
-     intro a; apply sym; generalize in match a;assumption;
+     intro a; apply sym1; generalize in match a;assumption;
    | whd; simplify; intros; cases H; cases H1; clear H H1; split; intro a;
-     [ apply (.= (H2 a)); apply H6;
-     | apply (.= (H3 a)); apply H7;
-     | apply (.= (H4 a)); apply H8;
-     | apply (.= (H5 a)); apply H9;]]]
-qed.  
+     [ apply (.= (e a)); apply e4;
+     | apply (.= (e1 a)); apply e5;
+     | apply (.= (e2 a)); apply e6;
+     | apply (.= (e3 a)); apply e7;]]]
+qed.
 
-definition or_f_minus_star: ∀P,Q:OAlgebra.ORelation_setoid P Q ⇒ arrows1 SET P Q.
+definition or_f_minus_star:
+ ∀P,Q:OAlgebra.unary_morphism2 (ORelation_setoid P Q) (P ⇒ Q).
  intros; constructor 1;
   [ apply or_f_minus_star_;
-  | intros; cases H; assumption]
+  | intros; cases e; assumption]
 qed.
 
-definition or_f: ∀P,Q:OAlgebra.ORelation_setoid P Q ⇒ arrows1 SET P Q.
+definition or_f: ∀P,Q:OAlgebra.unary_morphism2 (ORelation_setoid P Q) (P ⇒ Q).
  intros; constructor 1;
   [ apply or_f_;
-  | intros; cases H; assumption]
+  | intros; cases e; assumption]
 qed.
 
 coercion or_f.
 
-definition or_f_minus: ∀P,Q:OAlgebra.ORelation_setoid P Q ⇒ arrows1 SET Q P.
+definition or_f_minus: ∀P,Q:OAlgebra.unary_morphism2 (ORelation_setoid P Q) (Q ⇒ P).
  intros; constructor 1;
   [ apply or_f_minus_;
-  | intros; cases H; assumption]
+  | intros; cases e; assumption]
 qed.
 
-definition or_f_star: ∀P,Q:OAlgebra.ORelation_setoid P Q ⇒ arrows1 SET Q P.
+definition or_f_star: ∀P,Q:OAlgebra.unary_morphism2 (ORelation_setoid P Q) (Q ⇒ P).
  intros; constructor 1;
   [ apply or_f_star_;
-  | intros; cases H; assumption]
+  | intros; cases e; assumption]
 qed.
 
-lemma arrows1_OF_ORelation_setoid : ∀P,Q. ORelation_setoid P Q → arrows1 SET P Q.
-intros; apply (or_f ?? c);
+lemma arrows1_OF_ORelation_setoid : ∀P,Q. ORelation_setoid P Q → (P ⇒ Q).
+intros; apply (or_f ?? t);
 qed.
 
-coercion arrows1_OF_ORelation_setoid nocomposites.
+coercion arrows1_OF_ORelation_setoid.
 
-lemma umorphism_OF_ORelation_setoid : ∀P,Q. ORelation_setoid P Q → P ⇒ Q.
-intros; apply (or_f ?? c);
+lemma umorphism_OF_ORelation_setoid : ∀P,Q. ORelation_setoid P Q → unary_morphism1 P Q.
+intros; apply (or_f ?? t);
 qed.
 
 coercion umorphism_OF_ORelation_setoid.
 
-
-lemma uncurry_arrows : ∀B,C. arrows1 SET B C → B → C. 
-intros; apply ((fun_1 ?? c) t);
+lemma umorphism_setoid_OF_ORelation_setoid : ∀P,Q. ORelation_setoid P Q → unary_morphism1_setoid1 P Q.
+intros; apply (or_f ?? t);
 qed.
 
-coercion uncurry_arrows 1.
+coercion umorphism_setoid_OF_ORelation_setoid.
 
-lemma hint3 : ∀P,Q. arrows1 SET P Q → P ⇒ Q. intros; apply c;qed.
-coercion hint3 nocomposites.
+lemma uncurry_arrows : ∀B,C. ORelation_setoid B C → B → C. 
+intros; apply ((fun11 ?? t) t1);
+qed.
 
-(*
-lemma hint2: OAlgebra → setoid. intros; apply (oa_P o). qed.
-coercion hint2 nocomposites.
-*)
+coercion uncurry_arrows 1.
 
+lemma hint6: ∀P,Q. Type_OF_setoid2 (hint5 P ⇒ hint5 Q) → unary_morphism1 P Q.
+ intros; apply t;
+qed.
+coercion hint6.
 
 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}.
@@ -253,9 +267,9 @@ notation > "r⎻*" non associative with precedence 90 for @{'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_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).
+interpretation "o-relation f⎻*" 'OR_f_minus_star r = (fun12 __ (or_f_minus_star _ _) r).
+interpretation "o-relation f⎻" 'OR_f_minus r = (fun12 __ (or_f_minus _ _) r).
+interpretation "o-relation f*" 'OR_f_star r = (fun12 __ (or_f_star _ _) r).
 
 definition or_prop1 : ∀P,Q:OAlgebra.∀F:ORelation_setoid P Q.∀p,q.
    (F p ≤ q) = (p ≤ F* q).
@@ -273,13 +287,13 @@ 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).
+  binary_morphism2 (ORelation_setoid P Q) (ORelation_setoid Q R) (ORelation_setoid P R).
 intros;
 constructor 1;
 [ intros (F G);
   constructor 1;
   [ apply (G ∘ F);
-  | apply (G⎻* ∘ F⎻* );
+  | apply rule (G⎻* ∘ F⎻* );
   | apply (F* ∘ G* );
   | apply (F⎻ ∘ G⎻);
   | intros; 
@@ -295,24 +309,39 @@ constructor 1;
     apply or_prop3;
   ]
 | intros; split; simplify; 
-   [1,3: unfold arrows1_OF_ORelation_setoid; apply ((†H)‡(†H1));
-   |2,4: apply ((†H1)‡(†H));]]
+   [1,3: unfold umorphism_setoid_OF_ORelation_setoid; unfold arrows1_OF_ORelation_setoid; apply ((†e)‡(†e1));
+   |2,4: apply ((†e1)‡(†e));]]
 qed.
 
-definition OA : category1.
+definition OA : category2.
 split;
 [ apply (OAlgebra);
 | intros; apply (ORelation_setoid o o1);
 | intro O; split;
-  [1,2,3,4: apply id1;
+  [1,2,3,4: apply id2;
   |5,6,7:intros; apply refl1;] 
 | 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;]
+     apply (comp_assoc2 ????? (F⎻* ) (G⎻* ) (H⎻* ));
+   | apply ((comp_assoc2 ????? (H⎻) (G⎻) (F⎻))^-1);
+   | apply ((comp_assoc2 ????? F G H)^-1);
+   | apply ((comp_assoc2 ????? H* G* F* ));]
+| intros; split; unfold ORelation_composition; simplify; apply id_neutral_left2;
+| intros; split; unfold ORelation_composition; simplify; apply id_neutral_right2;]
+qed.
+
+lemma setoid1_of_OA: OA → setoid1.
+ intro; apply (oa_P t);
+qed.
+coercion setoid1_of_OA.
+
+lemma SET1_of_OA: OA → SET1.
+ intro; whd; apply (setoid1_of_OA t);
+qed.
+coercion SET1_of_OA.
+
+lemma objs2_SET1_OF_OA: OA → objs2 SET1.
+ intro; whd; apply (setoid1_of_OA t);
 qed.
+coercion objs2_SET1_OF_OA.