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 ##| napply (λ_,_.True);
31 #x; #y; napply True; (* DIVERGE *)
45 definition reflexive1 ≝ λA:Type.λR:A→A→CProp.∀x:A.R x x.
46 definition symmetric1 ≝ λC:Type.λlt:C→C→CProp. ∀x,y:C.lt x y → lt y x.
47 definition transitive1 ≝ λA:Type.λR:A→A→CProp.∀x,y,z:A.R x y → R y z → R x z.
49 record setoid1 : Type ≝
51 eq1: carr1 → carr1 → CProp;
52 refl1: reflexive1 ? eq1;
53 sym1: symmetric1 ? eq1;
54 trans1: transitive1 ? eq1
57 definition proofs1: CProp → setoid1.
71 definition CCProp: setoid1.
84 cases H; cases H1; clear H H1;
91 record function_space (A,B: setoid): Type ≝
93 f_ok: ∀a,a':A. proofs (eq ? a a') → proofs (eq ? (f a) (f a'))
96 notation "hbox(a break ⇒ b)" right associative with precedence 20 for @{ 'Imply $a $b }.
98 record function_space1 (A: setoid1) (B: setoid1): Type ≝
100 f1_ok: ∀a,a':A. proofs1 (eq1 ? a a') → proofs1 (eq1 ? (f1 a) (f1 a'))
103 definition function_space_setoid: setoid → setoid → setoid.
106 [ apply (function_space A B);
108 apply (∀a:A. proofs (eq ? (f a) (f1 a)));
112 unfold carr; unfold proofs; simplify;
116 unfold carr; unfold proofs; simplify;
121 unfold carr; unfold proofs; simplify;
122 apply (trans B ? (y a));
127 definition function_space_setoid1: setoid1 → setoid1 → setoid1.
130 [ apply (function_space1 A B);
132 apply (∀a:A. proofs1 (eq1 ? (f a) (f1 a)));
133 |*: cases daemon] (* simplify;
136 unfold proofs; simplify;
140 unfold proofs; simplify;
145 unfold carr; unfold proofs; simplify;
146 apply (trans1 B ? (y a));
151 interpretation "function_space_setoid1" 'Imply a b = (function_space_setoid1 a b).
153 record isomorphism (A,B: setoid): Type ≝
154 { map1:> function_space_setoid A B;
155 map2:> function_space_setoid B A;
156 inv1: ∀a:A. proofs (eq ? (map2 (map1 a)) a);
157 inv2: ∀b:B. proofs (eq ? (map1 (map2 b)) b)
160 interpretation "isomorphism" 'iff x y = (isomorphism x y).
162 definition setoids: setoid1.
169 [1,3: intro; assumption;
170 |*: intros; assumption]
174 unfold proofs; simplify;
179 definition setoid1_of_setoid: setoid → setoid1.
189 coercion setoid1_of_setoid.
192 record dependent_product (A:setoid) (B: A ⇒ setoids): Type ≝
193 { dp:> ∀a:A.carr (B a);
194 dp_ok: ∀a,a':A. ∀p:proofs1 (eq1 ? a a'). proofs1 (eq1 ? (dp a) (map2 ?? (f1_ok ?? B ?? p) (dp a')))
197 record forall (A:setoid) (B: A ⇒ CCProp): CProp ≝
198 { fo:> ∀a:A.proofs (B a) }.
200 record subset (A: setoid) : CProp ≝
203 definition ssubset: setoid → setoid1.
207 | apply (λU,V:subset s. ∀a. mem ? U a \liff mem ? V a)
218 definition mmem: ∀A:setoid. (ssubset A) ⇒ A ⇒ CCProp.
222 | unfold function_space_setoid1; simplify;
224 change in ⊢ (? (? (?→? (? %)))) with (mem ? b a \liff mem ? b' a);
225 unfold proofs1; simplify; intros;
226 unfold proofs1 in c; simplify in c;
227 unfold ssubset in c; simplify in c;
228 cases (c a); clear c;
234 definition sand: CCProp ⇒ CCProp.
236 definition intersection: ∀A. ssubset A ⇒ ssubset A ⇒ ssubset A.
245 apply (mem ? c c2 ∧ mem ? c1 c2);