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: ∀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
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 o1)\sub\c ∘ a\sub\c ∘ ⊩ = a\sub\c ∘ ⊩);
130 apply ((id_neutral_left1 ????)‡#);
132 change with (a\sub\c ∘ (id o2)\sub\c ∘ ⊩ = a\sub\c ∘ ⊩);
133 apply ((id_neutral_right1 ????)‡#);