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".
16 include "o-algebra.ma".
18 definition SUBSETS: objs1 SET → OAlgebra.
19 intro A; constructor 1;
23 | apply big_intersects;
26 simplify; intros; apply (refl1 ? (eq1 CPROP));
27 | apply ({x | False});
28 simplify; intros; apply (refl1 ? (eq1 CPROP));
29 | intros; whd; intros; assumption
30 | intros; whd; split; assumption
31 | intros; apply transitive_subseteq_operator; [2: apply f; | skip | assumption]
32 | intros; cases f; exists [apply w] assumption
33 | intros; split; [ intros 4; apply (f ? f1 i); | intros 3; intro; apply (f i ? f1); ]
35 [ intros 4; apply f; exists; [apply i] assumption;
36 | intros 3; intros; cases f1; apply (f w a x); ]
38 | intros 3; constructor 1;
39 | intros; cases f; exists; [apply w]
41 | whd; intros; cases i; simplify; assumption]
42 | intros; split; intro;
43 [ cases f; cases x1; exists [apply w1] exists [apply w] assumption;
44 | cases e; cases x; exists; [apply w1] [ assumption | exists; [apply w] assumption]]
45 | intros; intros 2; cases (f (singleton ? a) ?);
46 [ exists; [apply a] [assumption | change with (a = a); apply refl1;]
47 | change in x1 with (a = w); change with (mem A a q); apply (. (x1‡#));
51 definition orelation_of_relation: ∀o1,o2:REL. arrows1 ? o1 o2 → arrows2 OA (SUBSETS o1) (SUBSETS o2).
55 [ apply (λU.image ?? t U);
56 | intros; apply (#‡e); ]
58 [ apply (λU.minus_star_image ?? t U);
59 | intros; apply (#‡e); ]
61 [ apply (λU.star_image ?? t U);
62 | intros; apply (#‡e); ]
64 [ apply (λU.minus_image ?? t U);
65 | intros; apply (#‡e); ]
66 | intros; split; intro;
67 [ change in f with (∀a. a ∈ image ?? t p → a ∈ q);
68 change with (∀a:o1. a ∈ p → a ∈ star_image ?? t q);
69 intros 4; apply f; exists; [apply a] split; assumption;
70 | change in f with (∀a:o1. a ∈ p → a ∈ star_image ?? t q);
71 change with (∀a. a ∈ image ?? t p → a ∈ q);
72 intros; cases f1; cases x; clear f1 x; apply (f ? f3); assumption; ]
73 | intros; split; intro;
74 [ change in f with (∀a. a ∈ minus_image ?? t p → a ∈ q);
75 change with (∀a:o2. a ∈ p → a ∈ minus_star_image ?? t q);
76 intros 4; apply f; exists; [apply a] split; assumption;
77 | change in f with (∀a:o2. a ∈ p → a ∈ minus_star_image ?? t q);
78 change with (∀a. a ∈ minus_image ?? t p → a ∈ q);
79 intros; cases f1; cases x; clear f1 x; apply (f ? f3); assumption; ]
80 | intros; split; intro; cases f; clear f;
81 [ cases x; cases x2; clear x x2; exists; [apply w1]
83 | exists; [apply w] split; assumption]
84 | cases x1; cases x2; clear x1 x2; exists; [apply w1]
85 [ exists; [apply w] split; assumption;
89 lemma orelation_of_relation_preserves_equality:
90 ∀o1,o2:REL.∀t,t': arrows1 ? o1 o2. eq1 ? t t' → orelation_of_relation ?? t = orelation_of_relation ?? t'.
91 intros; split; unfold orelation_of_relation; simplify; intro; split; intro;
92 simplify; whd in o1 o2;
93 [ change with (a1 ∈ minus_star_image ?? t a → a1 ∈ minus_star_image ?? t' a);
95 | change with (a1 ∈ minus_star_image ?? t' a → a1 ∈ minus_star_image ?? t a);
97 | change with (a1 ∈ minus_image ?? t a → a1 ∈ minus_image ?? t' a);
98 apply (. #‡(e ^ -1‡#));
99 | change with (a1 ∈ minus_image ?? t' a → a1 ∈ minus_image ?? t a);
101 | change with (a1 ∈ image ?? t a → a1 ∈ image ?? t' a);
102 apply (. #‡(e ^ -1‡#));
103 | change with (a1 ∈ image ?? t' a → a1 ∈ image ?? t a);
105 | change with (a1 ∈ star_image ?? t a → a1 ∈ star_image ?? t' a);
106 apply (. #‡(e ^ -1‡#));
107 | change with (a1 ∈ star_image ?? t' a → a1 ∈ star_image ?? t a);
111 lemma hint: ∀o1,o2:OA. Type_OF_setoid21 (arrows2 ? o1 o2) → carr2 (arrows2 OA o1 o2).
116 lemma orelation_of_relation_preserves_identity:
117 ∀o1:REL. orelation_of_relation ?? (id1 ? o1) = id2 OA (SUBSETS o1).
118 intros; split; intro; split; whd; intro;
119 [ change with ((∀x. x ♮(id1 REL o1) a1→x∈a) → a1 ∈ a); intros;
120 apply (f a1); change with (a1 = a1); apply refl1;
121 | change with (a1 ∈ a → ∀x. x ♮(id1 REL o1) a1→x∈a); intros;
122 change in f1 with (x = a1); apply (. f1‡#); apply f;
123 | alias symbol "and" = "and_morphism".
124 change with ((∃y:o1.a1 ♮(id1 REL o1) y ∧ y∈a) → a1 ∈ a);
125 intro; cases e; clear e; cases x; clear x; change in f with (a1=w);
126 apply (. f‡#); apply f1;
127 | change with (a1 ∈ a → ∃y:o1.a1 ♮(id1 REL o1) y ∧ y∈a);
128 intro; exists; [apply a1]; split; [ change with (a1=a1); apply refl1; | apply f]
129 | change with ((∃x:o1.x ♮(id1 REL o1) a1∧x∈a) → a1 ∈ a);
130 intro; cases e; clear e; cases x; clear x; change in f with (w=a1);
131 apply (. f^-1‡#); apply f1;
132 | change with (a1 ∈ a → ∃x:o1.x ♮(id1 REL o1) a1∧x∈a);
133 intro; exists; [apply a1]; split; [ change with (a1=a1); apply refl1; | apply f]
134 | change with ((∀y.a1 ♮(id1 REL o1) y→y∈a) → a1 ∈ a); intros;
135 apply (f a1); change with (a1 = a1); apply refl1;
136 | change with (a1 ∈ a → ∀y.a1 ♮(id1 REL o1) y→y∈a); intros;
137 change in f1 with (a1 = y); apply (. f1^-1‡#); apply f;]
140 lemma hint2: ∀S,T. carr2 (arrows2 OA S T) → Type_OF_setoid21 (arrows2 OA S T).
145 (* CSC: ???? forse un uncertain mancato *)
146 lemma orelation_of_relation_preserves_composition:
147 ∀o1,o2,o3:REL.∀F: arrows1 ? o1 o2.∀G: arrows1 ? o2 o3.
148 orelation_of_relation ?? (G ∘ F) =
149 comp2 OA (SUBSETS o1) (SUBSETS o2) (SUBSETS o3)
150 ?? (*(orelation_of_relation ?? F) (orelation_of_relation ?? G)*).
151 [ apply (orelation_of_relation ?? F); | apply (orelation_of_relation ?? G); ]
152 intros; split; intro; split; whd; intro; whd in ⊢ (% → %); intros;
153 [ whd; intros; apply f; exists; [ apply x] split; assumption;
154 | cases f1; clear f1; cases x1; clear x1; apply (f w); assumption;
155 | cases e; cases x; cases f; cases x1; clear e x f x1; exists; [ apply w1 ]
156 split; [ assumption | exists; [apply w] split; assumption ]
157 | cases e; cases x; cases f1; cases x1; clear e x f1 x1; exists; [apply w1 ]
158 split; [ exists; [apply w] split; assumption | assumption ]
159 | unfold arrows1_OF_ORelation_setoid;
160 cases e; cases x; cases f; cases x1; clear e x f x1; exists; [ apply w1 ]
161 split; [ assumption | exists; [apply w] split; assumption ]
162 | unfold arrows1_OF_ORelation_setoid in e;
163 cases e; cases x; cases f1; cases x1; clear e x f1 x1; exists; [apply w1 ]
164 split; [ exists; [apply w] split; assumption | assumption ]
165 | whd; intros; apply f; exists; [ apply y] split; assumption;
166 | cases f1; clear f1; cases x; clear x; apply (f w); assumption;]