1 include "logic/connectives.ma".
2 include "properties/relations.ma".
4 nrecord iff (A,B: CProp) : CProp ≝
9 notation > "hvbox(a break \liff b)"
10 left associative with precedence 25
13 notation "hvbox(a break \leftrightarrow b)"
14 left associative with precedence 25
17 interpretation "logical iff" 'iff x y = (iff x y).
19 nrecord setoid : Type[1] ≝
21 eq: carr → carr → CProp;
24 trans: transitive ? eq
27 ndefinition proofs: CProp → setoid.
28 #P; napply (mk_setoid ?????);
30 ##| #x; #y; napply True;
31 ##|##*: nwhd; nrepeat (#_); napply I;
36 definition reflexive1 ≝ λA:Type.λR:A→A→CProp.∀x:A.R x x.
37 definition symmetric1 ≝ λC:Type.λlt:C→C→CProp. ∀x,y:C.lt x y → lt y x.
38 definition transitive1 ≝ λA:Type.λR:A→A→CProp.∀x,y,z:A.R x y → R y z → R x z.
40 record setoid1 : Type ≝
42 eq1: carr1 → carr1 → CProp;
43 refl1: reflexive1 ? eq1;
44 sym1: symmetric1 ? eq1;
45 trans1: transitive1 ? eq1
48 definition proofs1: CProp → setoid1.
64 ndefinition CCProp: setoid1.
77 cases H; cases H1; clear H H1;
86 (************************CSC
87 nrecord function_space (A,B: setoid): Type[1] ≝
88 { f:1> carr A → carr B}.;
89 f_ok: ∀a,a':A. proofs (eq ? a a') → proofs (eq ? (f a) (f a'))
93 notation "hbox(a break ⇒ b)" right associative with precedence 20 for @{ 'Imply $a $b }.
96 record function_space1 (A: setoid1) (B: setoid1): Type ≝
98 f1_ok: ∀a,a':A. proofs1 (eq1 ? a a') → proofs1 (eq1 ? (f1 a) (f1 a'))
102 definition function_space_setoid: setoid → setoid → setoid.
105 [ apply (function_space A B);
107 apply (∀a:A. proofs (eq ? (f a) (f1 a)));
111 unfold carr; unfold proofs; simplify;
115 unfold carr; unfold proofs; simplify;
120 unfold carr; unfold proofs; simplify;
121 apply (trans B ? (y a));
126 definition function_space_setoid1: setoid1 → setoid1 → setoid1.
129 [ apply (function_space1 A B);
131 apply (∀a:A. proofs1 (eq1 ? (f a) (f1 a)));
132 |*: cases daemon] (* simplify;
135 unfold proofs; simplify;
139 unfold proofs; simplify;
144 unfold carr; unfold proofs; simplify;
145 apply (trans1 B ? (y a));
150 interpretation "function_space_setoid1" 'Imply a b = (function_space_setoid1 a b).
152 record isomorphism (A,B: setoid): Type ≝
153 { map1:> function_space_setoid A B;
154 map2:> function_space_setoid B A;
155 inv1: ∀a:A. proofs (eq ? (map2 (map1 a)) a);
156 inv2: ∀b:B. proofs (eq ? (map1 (map2 b)) b)
159 interpretation "isomorphism" 'iff x y = (isomorphism x y).
161 definition setoids: setoid1.
168 [1,3: intro; assumption;
169 |*: intros; assumption]
173 unfold proofs; simplify;
178 definition setoid1_of_setoid: setoid → setoid1.
188 coercion setoid1_of_setoid.
191 record dependent_product (A:setoid) (B: A ⇒ setoids): Type ≝
192 { dp:> ∀a:A.carr (B a);
193 dp_ok: ∀a,a':A. ∀p:proofs1 (eq1 ? a a'). proofs1 (eq1 ? (dp a) (map2 ?? (f1_ok ?? B ?? p) (dp a')))
196 record forall (A:setoid) (B: A ⇒ CCProp): CProp ≝
197 { fo:> ∀a:A.proofs (B a) }.
199 record subset (A: setoid) : CProp ≝
202 definition ssubset: setoid → setoid1.
206 | apply (λU,V:subset s. ∀a. mem ? U a \liff mem ? V a)
217 definition mmem: ∀A:setoid. (ssubset A) ⇒ A ⇒ CCProp.
221 | unfold function_space_setoid1; simplify;
223 change in ⊢ (? (? (?→? (? %)))) with (mem ? b a \liff mem ? b' a);
224 unfold proofs1; simplify; intros;
225 unfold proofs1 in c; simplify in c;
226 unfold ssubset in c; simplify in c;
227 cases (c a); clear c;
233 definition sand: CCProp ⇒ CCProp.
235 definition intersection: ∀A. ssubset A ⇒ ssubset A ⇒ ssubset A.
244 apply (mem ? c c2 ∧ mem ? c1 c2);