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".
16 include "categories.ma".
18 record powerset_carrier (A: objs1 SET) : Type1 ≝ { mem_operator: unary_morphism1 A CPROP }.
20 definition subseteq_operator: ∀A: SET. powerset_carrier A → powerset_carrier A → CProp1 ≝
21 λA:objs1 SET.λU,V.∀a:A. mem_operator ? U a → mem_operator ? V a.
23 theorem transitive_subseteq_operator: ∀A. transitive2 ? (subseteq_operator A).
29 definition powerset_setoid1: SET → SET1.
32 [ apply (powerset_carrier T)
34 [ apply (λU,V. subseteq_operator ? U V ∧ subseteq_operator ? V U)
35 | simplify; intros; split; intros 2; assumption
36 | simplify; intros (x y H); cases H; split; assumption
37 | simplify; intros (x y z H H1); cases H; cases H1; split;
38 apply transitive_subseteq_operator; [1,4: apply y ]
42 interpretation "powerset" 'powerset A = (powerset_setoid1 A).
44 interpretation "subset construction" 'subset \eta.x =
45 (mk_powerset_carrier _ (mk_unary_morphism1 _ CPROP x _)).
47 definition mem: ∀A. binary_morphism1 A (Ω \sup A) CPROP.
50 [ apply (λx,S. mem_operator ? S x)
52 cases b; clear b; cases b'; clear b'; simplify; intros;
53 apply (trans1 ????? (prop11 ?? u ?? e));
54 cases e1; whd in s s1;
57 | apply s1; assumption]]
60 interpretation "mem" 'mem a S = (fun21 ___ (mem _) a S).
62 definition subseteq: ∀A. binary_morphism1 (Ω \sup A) (Ω \sup A) CPROP.
65 [ apply (λU,V. subseteq_operator ? U V)
69 [ apply (transitive_subseteq_operator ????? s2);
70 apply (transitive_subseteq_operator ???? s1 s4)
71 | apply (transitive_subseteq_operator ????? s3);
72 apply (transitive_subseteq_operator ???? s s4) ]]
75 interpretation "subseteq" 'subseteq U V = (fun21 ___ (subseteq _) U V).
79 theorem subseteq_refl: ∀A.∀S:Ω \sup A.S ⊆ S.
83 theorem subseteq_trans: ∀A.∀S1,S2,S3: Ω \sup A. S1 ⊆ S2 → S2 ⊆ S3 → S1 ⊆ S3.
84 intros; apply transitive_subseteq_operator; [apply S2] assumption.
87 definition overlaps: ∀A. binary_morphism1 (Ω \sup A) (Ω \sup A) CPROP.
90 (* Se metto x al posto di ? ottengo una universe inconsistency *)
91 [ apply (λA:objs1 SET.λU,V:Ω \sup A.(exT2 ? (λx:A.?(*x*) ∈ U) (λx:A.?(*x*) ∈ V) : CProp0))
93 constructor 1; intro; cases e2; exists; [1,4: apply w]
94 [ apply (. #‡e); assumption
95 | apply (. #‡e1); assumption
96 | apply (. #‡(e \sup -1)); assumption;
97 | apply (. #‡(e1 \sup -1)); assumption]]
100 interpretation "overlaps" 'overlaps U V = (fun21 ___ (overlaps _) U V).
102 definition intersects:
103 ∀A. binary_morphism1 (Ω \sup A) (Ω \sup A) (Ω \sup A).
106 [ apply rule (λU,V. {x | x ∈ U ∧ x ∈ V });
107 intros; simplify; apply (.= (e‡#)‡(e‡#)); apply refl1;
109 split; intros 2; simplify in f ⊢ %;
110 [ apply (. (#‡e)‡(#‡e1)); assumption
111 | apply (. (#‡(e \sup -1))‡(#‡(e1 \sup -1))); assumption]]
114 interpretation "intersects" 'intersects U V = (fun21 ___ (intersects _) U V).
117 ∀A. binary_morphism1 (Ω \sup A) (Ω \sup A) (Ω \sup A).
120 [ apply (λU,V. {x | x ∈ U ∨ x ∈ V });
121 intros; simplify; apply (.= (e‡#)‡(e‡#)); apply refl1
123 split; intros 2; simplify in f ⊢ %;
124 [ apply (. (#‡e)‡(#‡e1)); assumption
125 | apply (. (#‡(e \sup -1))‡(#‡(e1 \sup -1))); assumption]]
128 interpretation "union" 'union U V = (fun21 ___ (union _) U V).
130 (* qua non riesco a mettere set *)
131 definition singleton: ∀A:setoid. unary_morphism1 A (Ω \sup A).
132 intros; constructor 1;
133 [ apply (λa:A.{b | eq ? a b}); unfold setoid1_of_setoid; simplify;
137 [ apply e | apply (e \sup -1) ]
138 | unfold setoid1_of_setoid; simplify;
139 intros; split; intros 2; simplify in f ⊢ %; apply trans;
140 [ apply a |4: apply a'] try assumption; apply sym; assumption]
143 interpretation "singleton" 'singl a = (fun11 __ (singleton _) a).