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.
60 record setoid1 : Type ≝
62 eq1: carr1 → carr1 → CProp;
63 refl1: reflexive1 ? eq1;
64 sym1: symmetric1 ? eq1;
65 trans1: transitive1 ? eq1
68 definition proofs1: CProp → setoid1.
82 definition CCProp: setoid1.
95 cases H; cases H1; clear H H1;
102 record function_space (A,B: setoid): Type ≝
104 f_ok: ∀a,a':A. proofs (eq ? a a') → proofs (eq ? (f a) (f a'))
107 notation "hbox(a break ⇒ b)" right associative with precedence 20 for @{ 'Imply $a $b }.
109 record function_space1 (A: setoid1) (B: setoid1): Type ≝
111 f1_ok: ∀a,a':A. proofs1 (eq1 ? a a') → proofs1 (eq1 ? (f1 a) (f1 a'))
114 definition function_space_setoid: setoid → setoid → setoid.
117 [ apply (function_space A B);
119 apply (∀a:A. proofs (eq ? (f a) (f1 a)));
123 unfold carr; unfold proofs; simplify;
127 unfold carr; unfold proofs; simplify;
132 unfold carr; unfold proofs; simplify;
133 apply (trans B ? (y a));
138 definition function_space_setoid1: setoid1 → setoid1 → setoid1.
141 [ apply (function_space1 A B);
143 apply (∀a:A. proofs1 (eq1 ? (f a) (f1 a)));
144 |*: cases daemon] (* simplify;
147 unfold proofs; simplify;
151 unfold proofs; simplify;
156 unfold carr; unfold proofs; simplify;
157 apply (trans1 B ? (y a));
162 interpretation "function_space_setoid1" 'Imply a b = (function_space_setoid1 a b).
164 record isomorphism (A,B: setoid): Type ≝
165 { map1:> function_space_setoid A B;
166 map2:> function_space_setoid B A;
167 inv1: ∀a:A. proofs (eq ? (map2 (map1 a)) a);
168 inv2: ∀b:B. proofs (eq ? (map1 (map2 b)) b)
171 interpretation "isomorphism" 'iff x y = (isomorphism x y).
173 definition setoids: setoid1.
180 [1,3: intro; assumption;
181 |*: intros; assumption]
185 unfold proofs; simplify;
190 definition setoid1_of_setoid: setoid → setoid1.
200 coercion setoid1_of_setoid.
203 record dependent_product (A:setoid) (B: A ⇒ setoids): Type ≝
204 { dp:> ∀a:A.carr (B a);
205 dp_ok: ∀a,a':A. ∀p:proofs1 (eq1 ? a a'). proofs1 (eq1 ? (dp a) (map2 ?? (f1_ok ?? B ?? p) (dp a')))
208 record forall (A:setoid) (B: A ⇒ CCProp): CProp ≝
209 { fo:> ∀a:A.proofs (B a) }.
211 record subset (A: setoid) : CProp ≝
214 definition ssubset: setoid → setoid1.
218 | apply (λU,V:subset s. ∀a. mem ? U a \liff mem ? V a)
229 definition mmem: ∀A:setoid. (ssubset A) ⇒ A ⇒ CCProp.
233 | unfold function_space_setoid1; simplify;
235 change in ⊢ (? (? (?→? (? %)))) with (mem ? b a \liff mem ? b' a);
236 unfold proofs1; simplify; intros;
237 unfold proofs1 in c; simplify in c;
238 unfold ssubset in c; simplify in c;
239 cases (c a); clear c;
245 definition sand: CCProp ⇒ CCProp.
247 definition intersection: ∀A. ssubset A ⇒ ssubset A ⇒ ssubset A.
256 apply (mem ? c c2 ∧ mem ? c1 c2);