]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/contribs/formal_topology/overlap/o-algebra.ma
nasty change in the lexer/parser:
[helm.git] / helm / software / matita / contribs / formal_topology / overlap / o-algebra.ma
index b5410f7aff9876888d8d5b4b07c8d8311991adb6..806859a45dd0ae4e3d70d265843b9a54bdeaf0a4 100644 (file)
 (*                                                                        *)
 (**************************************************************************)
 
-include "datatypes/categories.ma".
-include "logic/cprop_connectives.ma". 
+include "categories.ma".
 
-inductive bool : Type := true : bool | false : bool.
+inductive bool : Type0 := true : bool | false : bool.
 
-lemma ums : setoid → setoid → setoid.
-intros (S T);
-constructor 1;
-[ apply (unary_morphism S T);
-| constructor 1;
-  [ intros (f1 f2); apply (∀a,b:S.eq1 ? a b → eq1 ? (f1 a) (f2 b));
-  | whd; simplify; intros; apply (.= (†H)); apply refl1;
-  | whd; simplify; intros; apply (.= (†H1)); apply sym1; apply H; apply refl1;
-  | whd; simplify; intros; apply (.= (†H2)); apply (.= (H ?? #)); apply (.= (H1 ?? #)); apply rule #;]] 
-qed.
-
-lemma BOOL : setoid.
+lemma BOOL : objs1 SET.
 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.
 
 lemma IF_THEN_ELSE_p :
-  ∀S:setoid.∀a,b:S.∀x,y:BOOL.x = y → 
-  let f ≝ λm.match m with [ true ⇒ a | false ⇒ b ] in f x = f y.
-intros; cases x in H; cases y; simplify; intros; try apply refl; whd in H; cases H;
-qed. 
-
-lemma if_then_else : ∀T:setoid. ∀a,b:T. ums BOOL T.
-intros; constructor 1; intros; 
-[ apply (match c2 with [ true ⇒ c | false ⇒ c1 ]);
-| apply (IF_THEN_ELSE_p T c c1 a a' H);]
+  ∀S:setoid1.∀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 e; cases y; simplify; intros; try apply refl1; whd in e; cases e;
 qed.
 
-record OAlgebra : Type := {
-  oa_P :> setoid;
-  oa_leq : binary_morphism1 oa_P oa_P CPROP; (* CPROP is setoid1 *)
+interpretation "unary morphism comprehension with no proof" 'comprehension T P = 
+  (mk_unary_morphism T ? P ?).
+interpretation "unary morphism1 comprehension with no proof" 'comprehension T P = 
+  (mk_unary_morphism1 T ? P ?).
+
+notation > "hvbox({ ident i ∈ s | term 19 p | by })" with precedence 90
+for @{ 'comprehension_by $s (λ${ident i}. $p) $by}.
+notation < "hvbox({ ident i ∈ s | term 19 p })" with precedence 90
+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).
+interpretation "unary morphism1 comprehension with proof" 'comprehension_by s \eta.f p = 
+  (mk_unary_morphism1 s ? f p).
+
+(* per il set-indexing vedere capitolo BPTools (foundational tools), Sect. 0.3.4 complete
+   lattices, Definizione 0.9 *)
+(* USARE L'ESISTENZIALE DEBOLE *)
+record OAlgebra : Type2 := {
+  oa_P :> SET1;
+  oa_leq : binary_morphism1 oa_P oa_P CPROP;
   oa_overlap: binary_morphism1 oa_P oa_P CPROP;
-  oa_meet: ∀I:setoid.unary_morphism (ums I oa_P) oa_P;
-  oa_join: ∀I:setoid.unary_morphism (ums I oa_P) oa_P;
+  oa_meet: ∀I:SET.unary_morphism2 (I ⇒ oa_P) oa_P;
+  oa_join: ∀I:SET.unary_morphism2 (I ⇒ oa_P) oa_P;
   oa_one: oa_P;
   oa_zero: oa_P;
   oa_leq_refl: ∀a:oa_P. oa_leq a a; 
   oa_leq_antisym: ∀a,b:oa_P.oa_leq a b → oa_leq b a → a = b;
   oa_leq_trans: ∀a,b,c:oa_P.oa_leq a b → oa_leq b c → oa_leq a c;
   oa_overlap_sym: ∀a,b:oa_P.oa_overlap a b → oa_overlap b a;
-  oa_meet_inf: ∀I.∀p_i.∀p:oa_P.oa_leq p (oa_meet I p_i) → ∀i:I.oa_leq p (p_i i);
-  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_meet_inf: 
+    ∀I:SET.∀p_i:I ⇒ oa_P.∀p:oa_P.
+      oa_leq p (oa_meet I p_i) = (∀i:I.oa_leq p (p_i i));
+  oa_join_sup: ∀I:SET.∀p_i:I ⇒ oa_P.∀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: 
-      ∀p,q.oa_overlap p q → oa_overlap p 
-     (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:setoid.∀p.∀q:ums I oa_P.oa_overlap p (oa_join I q) ⇔ ∃i:I.oa_overlap p (q i);
+  oa_overlap_preserves_meet_: 
+      ∀p,q:oa_P.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 });
+  oa_join_split:
+      ∀I:SET.∀p.∀q:I ⇒ oa_P.
+       oa_overlap p (oa_join I q) = (∃i:I.oa_overlap p (q i));
   (*oa_base : setoid;
+  1) enum non e' il nome giusto perche' non e' suriettiva
+  2) manca (vedere altro capitolo) la "suriettivita'" come immagine di insiemi di oa_base
   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*)
+  oa_density: ∀p,q.(∀i.oa_overlap p (oa_enum i) → oa_overlap q (oa_enum i)) → oa_leq p q
+  *)
   oa_density: 
       ∀p,q.(∀r.oa_overlap p r → oa_overlap q r) → oa_leq p q
 }.
 
-interpretation "o-algebra leq" 'leq a b = (fun1 ___ (oa_leq _) a b).
+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 = (fun1 ___ (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 }.
+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(∧ f)" non associative with precedence 60
 for @{ 'oa_meet $f }.
-notation < "hovbox(mstyle scriptlevel 1 scriptsizemultiplier 1.7 (∧) \below (ident i ∈  I) break term 90 p)" non associative with precedence 50
-for @{ 'oa_meet (λ${ident i}:$I.$p) }.
-notation < "hovbox(mstyle scriptlevel 1 scriptsizemultiplier 1.7 (∧) \below (\emsp) \nbsp term 90 p)" non associative with precedence 50
-for @{ 'oa_meet (λ${ident i}.($p $_)) }.
-notation < "hovbox(a ∧ b)" left associative with precedence 50
-for @{ 'oa_meet2 $a $b }.
+interpretation "o-algebra meet" 'oa_meet f = 
+  (fun12 ?? (oa_meet ??) f).
+interpretation "o-algebra meet with explicit function" 'oa_meet_mk f = 
+  (fun12 ?? (oa_meet ??) (mk_unary_morphism ?? f ?)).
 
-interpretation "o-algebra meet" 'oa_meet \eta.f = (fun_1 __ (oa_meet __) f).
-interpretation "o-algebra binary meet" 'and x y = (fun_1 __ (oa_meet _ BOOL) (if_then_else _ x y)).
+notation < "hovbox(mstyle scriptlevel 1 scriptsizemultiplier 1.7 (∨) \below (\emsp) \nbsp term 90 p)" 
+non associative with precedence 50 for @{ 'oa_join $p }.
+notation < "hovbox(mstyle scriptlevel 1 scriptsizemultiplier 1.7 (∨) \below (ident i ∈  I) break term 90 p)" 
+non associative with precedence 50 for @{ 'oa_join_mk (λ${ident i}:$I.$p) }.
 
-(*
-notation > "hovbox(a ∨ b)" left associative with precedence 49
-for @{ 'oa_join (λx__:bool.match x__ with [ true ⇒ $a | false ⇒ $b ]) }.
-notation > "hovbox(∨ f)" non associative with precedence 59
+notation > "hovbox(∨ f)" non associative with precedence 60
 for @{ 'oa_join $f }.
-notation < "hovbox(mstyle scriptlevel 1 scriptsizemultiplier 1.7 (∨) \below (ident i ∈  I) break term 90 p)" non associative with precedence 49
-for @{ 'oa_join (λ${ident i}:$I.$p) }.
-notation < "hovbox(mstyle scriptlevel 1 scriptsizemultiplier 1.7 (∨) \below (\emsp) \nbsp term 90 p)" non associative with precedence 49
-for @{ 'oa_join (λ${ident i}.($p $_)) }.
+interpretation "o-algebra join" 'oa_join f = 
+  (fun12 ?? (oa_join ??) f).
+interpretation "o-algebra join with explicit function" 'oa_join_mk f = 
+  (fun12 ?? (oa_join ??) (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; 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.
+
+interpretation "o-algebra binary meet" 'and a b = 
+  (fun21 ??? (binary_meet ?) a b).
+
+prefer coercion Type1_OF_OAlgebra.
+
+definition binary_join : ∀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; lapply (prop12 ? O (oa_join 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.
+
+interpretation "o-algebra binary join" 'or a b = 
+  (fun21 ??? (binary_join ?) a b).
+
+lemma oa_overlap_preservers_meet: ∀O:OAlgebra.∀p,q:O.p >< q → 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.
+
+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)" 
+non associative with precedence 49 for @{ 'oa_join_mk (λ${ident i}:$I.$p) }.
 notation < "hovbox(a ∨ b)" left associative with precedence 49
-for @{ 'oa_join (λ${ident i}:$_.match $i with [ true ⇒ $a | false ⇒ $b ]) }.
-
-interpretation "o-algebra join" 'oa_join \eta.f = (oa_join _ _ f).
-*)
-
-record ORelation (P,Q : OAlgebra) : Type ≝ {
-  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
+for @{ 'oa_join_mk (λ${ident i}:$_.match $i with [ true ⇒ $a | false ⇒ $b ]) }.
+
+notation > "hovbox(∨ f)" non associative with precedence 59
+for @{ 'oa_join $f }.
+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 = 
+  (fun12 ?? (oa_join ??) f).
+interpretation "o-algebra join with explicit function" 'oa_join_mk f = 
+  (fun12 ?? (oa_join ??) (mk_unary_morphism ?? f ?)).
+
+record ORelation (P,Q : OAlgebra) : Type2 ≝ {
+  or_f_ : carr2 (P ⇒ Q);
+  or_f_minus_star_ : carr2(P ⇒ Q);
+  or_f_star_ : carr2(Q ⇒ P);
+  or_f_minus_ : carr2(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 → 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. And42 
+             (or_f_minus_star_ ?? p = or_f_minus_star_ ?? q) 
+             (or_f_minus_ ?? p = or_f_minus_ ?? q) 
+             (or_f_ ?? p = or_f_ ?? q) 
+             (or_f_star_ ?? p = or_f_star_ ?? q)); 
+   | whd; simplify; intros; repeat split; intros; apply refl2;
+   | whd; simplify; intros; cases a; clear a; split; 
+     intro a; apply sym1; generalize in match a;assumption;
+   | whd; simplify; intros; cases a; cases a1; clear a a1; split; intro a;
+     [ apply (.= (e a)); apply e4;
+     | apply (.= (e1 a)); apply e5;
+     | apply (.= (e2 a)); apply e6;
+     | apply (.= (e3 a)); apply e7;]]]
+qed.
+
+definition ORelation_of_ORelation_setoid : 
+  ∀P,Q.ORelation_setoid P Q → ORelation P Q ≝ λP,Q,x.x.
+coercion ORelation_of_ORelation_setoid.
+
+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 e; assumption]
+qed.
+
+definition or_f: ∀P,Q:OAlgebra.unary_morphism2 (ORelation_setoid P Q) (P ⇒ Q).
+ intros; constructor 1;
+  [ apply or_f_;
+  | intros; cases e; assumption]
+qed.
+
+definition or_f_minus: ∀P,Q:OAlgebra.unary_morphism2 (ORelation_setoid P Q) (Q ⇒ P).
+ intros; constructor 1;
+  [ apply or_f_minus_;
+  | intros; cases e; assumption]
+qed.
+
+definition or_f_star: ∀P,Q:OAlgebra.unary_morphism2 (ORelation_setoid P Q) (Q ⇒ P).
+ intros; constructor 1;
+  [ apply or_f_star_;
+  | intros; cases e; assumption]
+qed.
+
+lemma arrows1_of_ORelation_setoid : ∀P,Q. ORelation_setoid P Q → (P ⇒ Q). 
+intros; apply (or_f ?? c);
+qed.
+coercion arrows1_of_ORelation_setoid.
+
 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.
+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 ORelation_setoid : OAlgebra → OAlgebra → setoid1.
-intros (P Q);
-constructor 1;
-[ apply (ORelation P Q);
-| constructor 1;
-   [ 
-     alias symbol "and" = "constructive and".
-     apply (λp,q.
-            (∀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;
-   | whd; simplify; intros; cases H; cases H1; cases H3; clear H H3 H1;
-     repeat split; intros; apply sym; generalize in match a;assumption;
-   | whd; simplify; intros; elim DAEMON;]]
-qed.  
-
-lemma hint : ∀P,Q. ORelation_setoid P Q → P ⇒ Q. intros; apply (or_f ?? c);qed.
-coercion hint.
-
-definition composition : ∀P,Q,R. 
-  binary_morphism1 (ORelation_setoid P Q) (ORelation_setoid Q R) (ORelation_setoid P 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_morphism2 (ORelation_setoid P Q) (ORelation_setoid Q R) (ORelation_setoid P R).
 intros;
 constructor 1;
 [ intros (F G);
   constructor 1;
-  [ constructor 1; [apply (λx. G (F x)); | intros; apply (†(†H));]
-  |2,3,4,5,6,7: cases DAEMON;]
-| intros; cases DAEMON;]
+  [ apply (G ∘ F);
+  | apply rule (G⎻* ∘ F⎻* );
+  | apply (F* ∘ G* );
+  | apply (F⎻ ∘ G⎻);
+  | 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 :?));
+    apply or_prop3;
+  ]
+| intros; split; simplify; 
+   [3: unfold arrows1_of_ORelation_setoid; apply ((†e)‡(†e1));
+   |1: apply ((†e)‡(†e1));
+   |2,4: apply ((†e1)‡(†e));]]
 qed.
 
-definition OA : category1. (* category2 *)
+definition OA : category2.
 split;
 [ apply (OAlgebra);
 | intros; apply (ORelation_setoid o o1);
 | intro O; split;
-  [1,2,3,4: constructor 1; [1,3,5,7:apply (λx.x);|*:intros;assumption]
-  |5,6,7:intros;split;intros; assumption; ] 
-|4: apply composition;
-|*: elim DAEMON;]
-qed. 
+  [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_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.
+
+definition OAlgebra_of_objs2_OA: objs2 OA → OAlgebra ≝ λx.x.
+coercion OAlgebra_of_objs2_OA.
+
+definition ORelation_setoid_of_arrows2_OA: 
+  ∀P,Q. arrows2 OA P Q → ORelation_setoid P Q ≝ λP,Q,c.c.
+coercion ORelation_setoid_of_arrows2_OA.
+
+prefer coercion Type_OF_objs2.
+
+(* alias symbol "eq" = "setoid1 eq". *)
+
+(* qui la notazione non va *)
+lemma leq_to_eq_join: ∀S:OA.∀p,q:S. p ≤ q → q = (binary_join ? p q).
+ intros;
+ apply oa_leq_antisym;
+  [ apply oa_density; intros;
+    apply oa_overlap_sym;
+    unfold binary_join; simplify;
+    apply (. (oa_join_split : ?));
+    exists; [ apply false ]
+    apply oa_overlap_sym;
+    assumption
+  | unfold binary_join; simplify;
+    apply (. (oa_join_sup : ?)); intro;
+    cases i; whd in ⊢ (? ? ? ? ? % ?);
+     [ assumption | apply oa_leq_refl ]]
+qed.
+
+lemma overlap_monotone_left: ∀S:OA.∀p,q,r:S. p ≤ q → p >< r → q >< r.
+ intros;
+ apply (. (leq_to_eq_join : ?)‡#);
+  [ apply f;
+  | skip
+  | apply oa_overlap_sym;
+    unfold binary_join; simplify;
+    apply (. (oa_join_split : ?));
+    exists [ apply true ]
+    apply oa_overlap_sym;
+    assumption; ]
+qed.
+
+(* Part of proposition 9.9 *)
+lemma f_minus_image_monotone: ∀S,T.∀R:arrows2 OA S T.∀p,q. p ≤ q → R⎻ p ≤ R⎻ q.
+ intros;
+ apply (. (or_prop2 : ?));
+ apply oa_leq_trans; [2: apply f; | skip | apply (. (or_prop2 : ?)^ -1); apply oa_leq_refl;]
+qed.
+(* Part of proposition 9.9 *)
+lemma f_minus_star_image_monotone: ∀S,T.∀R:arrows2 OA S T.∀p,q. p ≤ q → R⎻* p ≤ R⎻* q.
+ intros;
+ apply (. (or_prop2 : ?)^ -1);
+ apply oa_leq_trans; [3: apply f; | skip | apply (. (or_prop2 : ?)); apply oa_leq_refl;]
+qed.
 
+(* Part of proposition 9.9 *)
+lemma f_image_monotone: ∀S,T.∀R:arrows2 OA S T.∀p,q. p ≤ q → R p ≤ R q.
+ intros;
+ apply (. (or_prop1 : ?));
+ apply oa_leq_trans; [2: apply f; | skip | apply (. (or_prop1 : ?)^ -1); apply oa_leq_refl;]
+qed.
+
+(* Part of proposition 9.9 *)
+lemma f_star_image_monotone: ∀S,T.∀R:arrows2 OA S T.∀p,q. p ≤ q → R* p ≤ R* q.
+ intros;
+ apply (. (or_prop1 : ?)^ -1);
+ apply oa_leq_trans; [3: apply f; | skip | apply (. (or_prop1 : ?)); apply oa_leq_refl;]
+qed.
+
+lemma lemma_10_2_a: ∀S,T.∀R:arrows2 OA S T.∀p. p ≤ R⎻* (R⎻ p).
+ intros;
+ apply (. (or_prop2 : ?)^-1);
+ apply oa_leq_refl.
+qed.
+
+lemma lemma_10_2_b: ∀S,T.∀R:arrows2 OA S T.∀p. R⎻ (R⎻* p) ≤ p.
+ intros;
+ apply (. (or_prop2 : ?));
+ apply oa_leq_refl.
+qed.
+
+lemma lemma_10_2_c: ∀S,T.∀R:arrows2 OA S T.∀p. p ≤ R* (R p).
+ intros;
+ apply (. (or_prop1 : ?)^-1);
+ apply oa_leq_refl.
+qed.
+
+lemma lemma_10_2_d: ∀S,T.∀R:arrows2 OA S T.∀p. R (R* p) ≤ p.
+ intros;
+ apply (. (or_prop1 : ?));
+ apply oa_leq_refl.
+qed.
 
+lemma lemma_10_3_a: ∀S,T.∀R:arrows2 OA S T.∀p. R⎻ (R⎻* (R⎻ p)) = R⎻ p.
+ intros; apply oa_leq_antisym;
+  [ apply lemma_10_2_b;
+  | apply f_minus_image_monotone;
+    apply lemma_10_2_a; ]
+qed.
+
+lemma lemma_10_3_b: ∀S,T.∀R:arrows2 OA S T.∀p. R* (R (R* p)) = R* p.
+ intros; apply oa_leq_antisym;
+  [ apply f_star_image_monotone;
+    apply (lemma_10_2_d ?? R p);
+  | apply lemma_10_2_c; ]
+qed.
+
+lemma lemma_10_3_c: ∀S,T.∀R:arrows2 OA S T.∀p. R (R* (R p)) = R p.
+ intros; apply oa_leq_antisym;
+  [ apply lemma_10_2_d;
+  | apply f_image_monotone;
+    apply (lemma_10_2_c ?? R p); ]
+qed.
+
+lemma lemma_10_3_d: ∀S,T.∀R:arrows2 OA S T.∀p. R⎻* (R⎻ (R⎻* p)) = R⎻* p.
+ intros; apply oa_leq_antisym;
+  [ apply f_minus_star_image_monotone;
+    apply (lemma_10_2_b ?? R p);
+  | apply lemma_10_2_a; ]
+qed.
+
+lemma lemma_10_4_a: ∀S,T.∀R:arrows2 OA S T.∀p. R⎻* (R⎻ (R⎻* (R⎻ p))) = R⎻* (R⎻ p).
+ intros; apply (†(lemma_10_3_a ?? R p));
+qed.
+
+lemma lemma_10_4_b: ∀S,T.∀R:arrows2 OA S T.∀p. R (R* (R (R* p))) = R (R* p).
+intros; unfold in ⊢ (? ? ? % %); apply (†(lemma_10_3_b ?? R p));
+qed.
 
+lemma oa_overlap_sym': ∀o:OA.∀U,V:o. (U >< V) = (V >< U).
+ intros; split; intro; apply oa_overlap_sym; assumption.
+qed.
\ No newline at end of file