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 "relations.ma".
17 record basic_pair: Type1 ≝
20 rel: arrows1 ? concr form
23 notation "x ⊩ y" with precedence 45 for @{'Vdash2 $x $y}.
24 notation "⊩" with precedence 60 for @{'Vdash}.
26 interpretation "basic pair relation" 'Vdash2 x y = (rel _ x y).
27 interpretation "basic pair relation (non applied)" 'Vdash = (rel _).
29 alias symbol "eq" = "setoid1 eq".
30 alias symbol "compose" = "category1 composition".
31 record relation_pair (BP1,BP2: basic_pair): Type1 ≝
32 { concr_rel: arrows1 ? (concr BP1) (concr BP2);
33 form_rel: arrows1 ? (form BP1) (form BP2);
34 commute: ⊩ ∘ concr_rel = form_rel ∘ ⊩
37 notation "hvbox (r \sub \c)" with precedence 90 for @{'concr_rel $r}.
38 notation "hvbox (r \sub \f)" with precedence 90 for @{'form_rel $r}.
40 interpretation "concrete relation" 'concr_rel r = (concr_rel __ r).
41 interpretation "formal relation" 'form_rel r = (form_rel __ r).
43 include "o-basic_pairs.ma".
45 definition o_basic_pair_of_basic_pair: cic:/matita/formal_topology/basic_pairs/basic_pair.ind#xpointer(1/1) → basic_pair.
48 [ apply (SUBSETS (concr b));
49 | apply (SUBSETS (form b));
55 definition relation_pair_equality:
56 ∀o1,o2. equivalence_relation1 (relation_pair o1 o2).
59 [ apply (λr,r'. ⊩ ∘ r \sub\c = ⊩ ∘ r' \sub\c);
72 definition relation_pair_setoid: basic_pair → basic_pair → setoid1.
75 [ apply (relation_pair b b1)
76 | apply relation_pair_equality
80 lemma eq_to_eq': ∀o1,o2.∀r,r': relation_pair_setoid o1 o2. r=r' → r \sub\f ∘ ⊩ = r'\sub\f ∘ ⊩.
81 intros 7 (o1 o2 r r' H c1 f2);
83 [ lapply (fi ?? (commute ?? r c1 f2) H1) as H2;
84 lapply (if ?? (H c1 f2) H2) as H3;
85 apply (if ?? (commute ?? r' c1 f2) H3);
86 | lapply (fi ?? (commute ?? r' c1 f2) H1) as H2;
87 lapply (fi ?? (H c1 f2) H2) as H3;
88 apply (if ?? (commute ?? r c1 f2) H3);
92 definition id_relation_pair: ∀o:basic_pair. relation_pair o o.
96 | lapply (id_neutral_right1 ? (concr o) ? (⊩)) as H;
97 lapply (id_neutral_left1 ?? (form o) (⊩)) as H1;
102 definition relation_pair_composition:
103 ∀o1,o2,o3. binary_morphism1 (relation_pair_setoid o1 o2) (relation_pair_setoid o2 o3) (relation_pair_setoid o1 o3).
108 [ apply (r1 \sub\c ∘ r \sub\c)
109 | apply (r1 \sub\f ∘ r \sub\f)
110 | lapply (commute ?? r) as H;
111 lapply (commute ?? r1) as H1;
114 apply (.= ASSOC1\sup -1);
118 change with (⊩ ∘ (b\sub\c ∘ a\sub\c) = ⊩ ∘ (b'\sub\c ∘ a'\sub\c));
119 change in H with (⊩ ∘ a \sub\c = ⊩ ∘ a' \sub\c);
120 change in H1 with (⊩ ∘ b \sub\c = ⊩ ∘ b' \sub\c);
123 apply (.= #‡(commute ?? b'));
124 apply (.= ASSOC1 \sup -1);
127 apply (.= #‡(commute ?? b')\sup -1);
128 apply (ASSOC1 \sup -1)]
131 definition BP: category1.
134 | apply relation_pair_setoid
135 | apply id_relation_pair
136 | apply relation_pair_composition
138 change with (⊩ ∘ (a34\sub\c ∘ (a23\sub\c ∘ a12\sub\c)) =
139 ⊩ ∘ ((a34\sub\c ∘ a23\sub\c) ∘ a12\sub\c));
142 change with (⊩ ∘ (a\sub\c ∘ (id_relation_pair o1)\sub\c) = ⊩ ∘ a\sub\c);
143 apply ((id_neutral_right1 ????)‡#);
145 change with (⊩ ∘ ((id_relation_pair o2)\sub\c ∘ a\sub\c) = ⊩ ∘ a\sub\c);
146 apply ((id_neutral_left1 ????)‡#);]
149 definition BPext: ∀o: BP. form o ⇒ Ω \sup (concr o).
150 intros; constructor 1;
151 [ apply (ext ? ? (rel o));
157 definition BPextS: ∀o: BP. Ω \sup (form o) ⇒ Ω \sup (concr o) ≝
160 definition fintersects: ∀o: BP. binary_morphism1 (form o) (form o) (Ω \sup (form o)).
161 intros (o); constructor 1;
162 [ apply (λa,b: form o.{c | BPext o c ⊆ BPext o a ∩ BPext o b });
163 intros; simplify; apply (.= (†H)‡#); apply refl1
164 | intros; split; simplify; intros;
165 [ apply (. #‡((†H)‡(†H1))); assumption
166 | apply (. #‡((†H\sup -1)‡(†H1\sup -1))); assumption]]
169 interpretation "fintersects" 'fintersects U V = (fun1 ___ (fintersects _) U V).
171 definition fintersectsS:
172 ∀o:BP. binary_morphism1 (Ω \sup (form o)) (Ω \sup (form o)) (Ω \sup (form o)).
173 intros (o); constructor 1;
174 [ apply (λo: basic_pair.λa,b: Ω \sup (form o).{c | BPext o c ⊆ BPextS o a ∩ BPextS o b });
175 intros; simplify; apply (.= (†H)‡#); apply refl1
176 | intros; split; simplify; intros;
177 [ apply (. #‡((†H)‡(†H1))); assumption
178 | apply (. #‡((†H\sup -1)‡(†H1\sup -1))); assumption]]
181 interpretation "fintersectsS" 'fintersects U V = (fun1 ___ (fintersectsS _) U V).
183 definition relS: ∀o: BP. binary_morphism1 (concr o) (Ω \sup (form o)) CPROP.
184 intros (o); constructor 1;
185 [ apply (λx:concr o.λS: Ω \sup (form o).∃y: form o.y ∈ S ∧ x ⊩ y);
186 | intros; split; intros; cases H2; exists [1,3: apply w]
187 [ apply (. (#‡H1)‡(H‡#)); assumption
188 | apply (. (#‡H1 \sup -1)‡(H \sup -1‡#)); assumption]]
191 interpretation "basic pair relation for subsets" 'Vdash2 x y = (fun1 (concr _) __ (relS _) x y).
192 interpretation "basic pair relation for subsets (non applied)" 'Vdash = (fun1 ___ (relS _)).