1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "formal_topology/relations.ma".
16 include "datatypes/categories.ma".
18 record basic_pair: Type ≝
21 rel: arrows1 ? concr form
24 notation "x ⊩ y" with precedence 45 for @{'Vdash2 $x $y}.
25 notation "⊩" with precedence 60 for @{'Vdash}.
27 interpretation "basic pair relation" 'Vdash2 x y = (rel _ x y).
28 interpretation "basic pair relation (non applied)" 'Vdash = (rel _).
30 record relation_pair (BP1,BP2: basic_pair): Type ≝
31 { concr_rel: arrows1 ? (concr BP1) (concr BP2);
32 form_rel: arrows1 ? (form BP1) (form BP2);
33 commute: concr_rel ∘ ⊩ = ⊩ ∘ form_rel
36 notation "hvbox (r \sub \c)" with precedence 90 for @{'concr_rel $r}.
37 notation "hvbox (r \sub \f)" with precedence 90 for @{'form_rel $r}.
39 interpretation "concrete relation" 'concr_rel r = (concr_rel __ r).
40 interpretation "formal relation" 'form_rel r = (form_rel __ r).
42 definition relation_pair_equality:
43 ∀o1,o2. equivalence_relation1 (relation_pair o1 o2).
46 [ apply (λr,r'. r \sub\c ∘ ⊩ = r' \sub\c ∘ ⊩);
59 definition relation_pair_setoid: basic_pair → basic_pair → setoid1.
62 [ apply (relation_pair b b1)
63 | apply relation_pair_equality
67 lemma eq_to_eq': ∀o1,o2.∀r,r': relation_pair_setoid o1 o2. r=r' → ⊩ \circ r \sub\f = ⊩ \circ r'\sub\f.
68 intros 7 (o1 o2 r r' H c1 f2);
70 [ lapply (fi ?? (commute ?? r c1 f2) H1) as H2;
71 lapply (if ?? (H c1 f2) H2) as H3;
72 apply (if ?? (commute ?? r' c1 f2) H3);
73 | lapply (fi ?? (commute ?? r' c1 f2) H1) as H2;
74 lapply (fi ?? (H c1 f2) H2) as H3;
75 apply (if ?? (commute ?? r c1 f2) H3);
79 definition id_relation_pair: ∀o:basic_pair. relation_pair o o.
83 | lapply (id_neutral_left1 ? (concr o) ? (⊩)) as H;
84 lapply (id_neutral_right1 ?? (form o) (⊩)) as H1;
89 definition relation_pair_composition:
90 ∀o1,o2,o3. binary_morphism1 (relation_pair_setoid o1 o2) (relation_pair_setoid o2 o3) (relation_pair_setoid o1 o3).
95 [ apply (r \sub\c ∘ r1 \sub\c)
96 | apply (r \sub\f ∘ r1 \sub\f)
97 | lapply (commute ?? r) as H;
98 lapply (commute ?? r1) as H1;
101 apply (.= ASSOC1\sup -1);
105 change with (a\sub\c ∘ b\sub\c ∘ ⊩ = a'\sub\c ∘ b'\sub\c ∘ ⊩);
106 change in H with (a \sub\c ∘ ⊩ = a' \sub\c ∘ ⊩);
107 change in H1 with (b \sub\c ∘ ⊩ = b' \sub\c ∘ ⊩);
110 apply (.= #‡(commute ?? b'));
111 apply (.= ASSOC1 \sup -1);
114 apply (.= #‡(commute ?? b')\sup -1);
115 apply (ASSOC1 \sup -1)]
118 definition BP: category1.
121 | apply relation_pair_setoid
122 | apply id_relation_pair
123 | apply relation_pair_composition
125 change with (a12\sub\c ∘ a23\sub\c ∘ a34\sub\c ∘ ⊩ =
126 (a12\sub\c ∘ (a23\sub\c ∘ a34\sub\c) ∘ ⊩));
129 change with ((id_relation_pair o1)\sub\c ∘ a\sub\c ∘ ⊩ = a\sub\c ∘ ⊩);
130 apply ((id_neutral_left1 ????)‡#);
132 change with (a\sub\c ∘ (id_relation_pair o2)\sub\c ∘ ⊩ = a\sub\c ∘ ⊩);
133 apply ((id_neutral_right1 ????)‡#);
137 definition BPext: ∀o: BP. form o ⇒ Ω \sup (concr o) ≝ λo.ext ? ? (rel o).
139 definition BPextS: ∀o: BP. Ω \sup (form o) ⇒ Ω \sup (concr o) ≝
142 definition fintersects: ∀o: BP. binary_morphism1 (form o) (form o) (Ω \sup (form o)).
143 intros (o); constructor 1;
144 [ apply (λa,b: form o.{c | BPext o c ⊆ BPext o a ∩ BPext o b });
145 intros; simplify; apply (.= (†H)‡#); apply refl1
146 | intros; split; simplify; intros;
147 [ apply (. #‡((†H)‡(†H1))); assumption
148 | apply (. #‡((†H\sup -1)‡(†H1\sup -1))); assumption]]
151 interpretation "fintersects" 'fintersects U V = (fun1 ___ (fintersects _) U V).
153 definition fintersectsS:
154 ∀o:BP. binary_morphism1 (Ω \sup (form o)) (Ω \sup (form o)) (Ω \sup (form o)).
155 intros (o); constructor 1;
156 [ apply (λo: basic_pair.λa,b: Ω \sup (form o).{c | BPext o c ⊆ BPextS o a ∩ BPextS o b });
157 intros; simplify; apply (.= (†H)‡#); apply refl1
158 | intros; split; simplify; intros;
159 [ apply (. #‡((†H)‡(†H1))); assumption
160 | apply (. #‡((†H\sup -1)‡(†H1\sup -1))); assumption]]
163 interpretation "fintersectsS" 'fintersects U V = (fun1 ___ (fintersectsS _) U V).
165 definition relS: ∀o: BP. binary_morphism1 (concr o) (Ω \sup (form o)) CPROP.
166 intros (o); constructor 1;
167 [ apply (λx:concr o.λS: Ω \sup (form o).∃y: form o.y ∈ S ∧ x ⊩ y);
168 | intros; split; intros; cases H2; exists [1,3: apply w]
169 [ apply (. (#‡H1)‡(H‡#)); assumption
170 | apply (. (#‡H1 \sup -1)‡(H \sup -1‡#)); assumption]]
173 interpretation "basic pair relation for subsets" 'Vdash2 x y = (fun1 (concr _) __ (relS _) x y).
174 interpretation "basic pair relation for subsets (non applied)" 'Vdash = (fun1 ___ (relS _)).