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".
17 record iff (A,B: CProp) : CProp ≝
22 notation > "hvbox(a break \liff b)"
23 left associative with precedence 25
26 notation "hvbox(a break \leftrightarrow b)"
27 left associative with precedence 25
30 interpretation "logical iff" 'iff x y = (iff x y).
32 record setoid : Type ≝
34 eq: carr → carr → CProp;
37 trans: transitive ? eq
40 definition proofs: CProp → setoid.
45 alias id "True" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1)".
55 record setoid1 : Type ≝
57 eq1: carr1 → carr1 → CProp;
58 refl1: reflexive ? eq1;
59 sym1: symmetric ? eq1;
60 trans1: transitive ? eq1
63 definition CCProp: setoid1.
76 cases H; cases H1; clear H H1;
83 record function_space (A,B: setoid): Type ≝
85 f_ok: ∀a,a':A. proofs (eq ? a a') → proofs (eq ? (f a) (f a'))
88 notation "hbox(a break ⇒ b)" right associative with precedence 20 for @{ 'Imply $a $b }.
89 interpretation "function_space" 'Imply a b = (function_space a b).
91 record function_space1 (A: setoid1) (B: setoid1): Type ≝
93 f1_ok: ∀a,a':A. proofs (eq1 ? a a') → proofs (eq1 ? (f1 a) (f1 a'))
96 definition function_space_setoid: setoid → setoid → setoid.
101 apply (∀a:A. proofs (eq ? (f a) (f1 a)));
105 unfold carr; unfold proofs; simplify;
109 unfold carr; unfold proofs; simplify;
114 unfold carr; unfold proofs; simplify;
115 apply (trans B ? (y a));
120 interpretation "function_space_setoid" 'Imply a b = (function_space_setoid a b).
122 definition function_space_setoid1: setoid1 → setoid1 → setoid.
125 [ apply (function_space1 A B);
127 apply (∀a:A. proofs (eq1 ? (f a) (f1 a)));
131 unfold proofs; simplify;
135 unfold proofs; simplify;
140 unfold carr; unfold proofs; simplify;
141 apply (trans1 B ? (y a));
146 record isomorphism (A,B: setoid): Type ≝
149 inv1: ∀a:A. proofs (eq ? (map2 (map1 a)) a);
150 inv2: ∀b:B. proofs (eq ? (map1 (map2 b)) b)
153 interpretation "isomorphism" 'iff x y = (isomorphism x y).
157 definition setoids: setoid1.
164 [1,3: intro; assumption;
165 |*: intros; assumption]
169 unfold carr; unfold proofs; simplify;
174 definition setoid1_of_setoid: setoid → setoid1.
185 coercion setoid1_of_setoid.
188 record dependent_product (A:setoid1) (B: function_space1 A setoids): Type ≝
189 { dp:> ∀a:A.carr (B a);
190 dp_ok: ∀a,a':A. ∀p:proofs (eq1 ? a a'). proofs (eq1 ? (dp a) (map2 ?? (f1_ok A ? B ?? p) (dp a')))
194 record forall (A:setoid) (B: function_space1 A CCProp): CProp ≝
195 { fo:> ∀a:A.proofs (B a)
198 record subset (A: setoid) : CProp ≝
199 { mem: function_space1 A CCProp
202 definition ssubset: setoid → setoid1.
206 | apply (λU,V:subset s. ∀a. mem ? U a \liff mem ? V a)
217 definition mmem: ∀A:setoid. function_space_setoid1 (ssubset A) (function_space_setoid1 A CCProp).
221 | unfold function_space_setoid1; simplify;
223 change in ⊢ (? (? (?→? (? %)))) with (mem ? b a \liff mem ? b' a);
224 unfold proofs; simplify; intros;
225 unfold proofs in c; simplify in c;
226 unfold ssubset in c; simplify in c;
227 cases (c a); clear c;