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 "logic/cprop_connectives.ma".
19 record iff (A,B: CProp) : CProp ≝
24 notation > "hvbox(a break \liff b)"
25 left associative with precedence 25
28 notation "hvbox(a break \leftrightarrow b)"
29 left associative with precedence 25
32 interpretation "logical iff" 'iff x y = (iff x y).
34 definition reflexive1 ≝ λA:Type.λR:A→A→CProp.∀x:A.R x x.
35 definition symmetric1 ≝ λC:Type.λlt:C→C→CProp. ∀x,y:C.lt x y → lt y x.
36 definition transitive1 ≝ λA:Type.λR:A→A→CProp.∀x,y,z:A.R x y → R y z → R x z.
38 record setoid : Type ≝
40 eq: carr → carr → CProp;
43 trans: transitive ? eq
46 definition proofs: CProp → setoid.
51 alias id "True" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1)".
61 record setoid1 : Type ≝
63 eq1: carr1 → carr1 → CProp;
64 refl1: reflexive1 ? eq1;
65 sym1: symmetric1 ? eq1;
66 trans1: transitive1 ? eq1
69 definition proofs1: CProp → setoid1.
74 alias id "True" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1)".
84 definition CCProp: setoid1.
97 cases H; cases H1; clear H H1;
101 | apply (H3 (H5 H))]]
104 record function_space (A,B: setoid): Type ≝
106 f_ok: ∀a,a':A. proofs (eq ? a a') → proofs (eq ? (f a) (f a'))
109 notation "hbox(a break ⇒ b)" right associative with precedence 20 for @{ 'Imply $a $b }.
111 record function_space1 (A: setoid1) (B: setoid1): Type ≝
113 f1_ok: ∀a,a':A. proofs1 (eq1 ? a a') → proofs1 (eq1 ? (f1 a) (f1 a'))
116 definition function_space_setoid: setoid → setoid → setoid.
119 [ apply (function_space A B);
121 apply (∀a:A. proofs (eq ? (f a) (f1 a)));
125 unfold carr; unfold proofs; simplify;
129 unfold carr; unfold proofs; simplify;
134 unfold carr; unfold proofs; simplify;
135 apply (trans B ? (y a));
140 definition function_space_setoid1: setoid1 → setoid1 → setoid1.
143 [ apply (function_space1 A B);
145 apply (∀a:A. proofs1 (eq1 ? (f a) (f1 a)));
146 |*: cases daemon] (* simplify;
149 unfold proofs; simplify;
153 unfold proofs; simplify;
158 unfold carr; unfold proofs; simplify;
159 apply (trans1 B ? (y a));
164 interpretation "function_space_setoid1" 'Imply a b = (function_space_setoid1 a b).
166 record isomorphism (A,B: setoid): Type ≝
167 { map1:> function_space_setoid A B;
168 map2:> function_space_setoid B A;
169 inv1: ∀a:A. proofs (eq ? (map2 (map1 a)) a);
170 inv2: ∀b:B. proofs (eq ? (map1 (map2 b)) b)
173 interpretation "isomorphism" 'iff x y = (isomorphism x y).
175 definition setoids: setoid1.
182 [1,3: intro; assumption;
183 |*: intros; assumption]
187 unfold proofs; simplify;
192 definition setoid1_of_setoid: setoid → setoid1.
202 coercion setoid1_of_setoid.
205 record dependent_product (A:setoid) (B: A ⇒ setoids): Type ≝
206 { dp:> ∀a:A.carr (B a);
207 dp_ok: ∀a,a':A. ∀p:proofs1 (eq1 ? a a'). proofs1 (eq1 ? (dp a) (map2 ?? (f1_ok ?? B ?? p) (dp a')))
210 record forall (A:setoid) (B: A ⇒ CCProp): CProp ≝
211 { fo:> ∀a:A.proofs (B a) }.
213 record subset (A: setoid) : CProp ≝
216 definition ssubset: setoid → setoid1.
220 | apply (λU,V:subset s. ∀a. mem ? U a \liff mem ? V a)
231 definition mmem: ∀A:setoid. (ssubset A) ⇒ A ⇒ CCProp.
235 | unfold function_space_setoid1; simplify;
237 change in ⊢ (? (? (?→? (? %)))) with (mem ? b a \liff mem ? b' a);
238 unfold proofs1; simplify; intros;
239 unfold proofs1 in c; simplify in c;
240 unfold ssubset in c; simplify in c;
241 cases (c a); clear c;
247 definition sand: CCProp ⇒ CCProp.
249 definition intersection: ∀A. ssubset A ⇒ ssubset A ⇒ ssubset A.
258 apply (mem ? c c2 ∧ mem ? c1 c2);