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 "Domain/defs.ma".
18 - We use predicative subsets encoded as propositional functions
19 according to Sambin/Valentini "Toolbox".
22 record Subset (D:Domain): Type ≝ {
24 ces_subset_fw: ∀d1,d2. subset d1 → ces ? d1 d2 → subset d2;
25 ces_subset_bw: ∀d1,d2. subset d1 → ces ? d2 d1 → subset d2
28 (* subset membership (epsilon) ********************************************)
30 definition sin: ∀D. Subset D → D → Prop ≝
31 λD. λU:Subset D. λd. cin D d ∧ U d.
33 theorem sin_i: ∀D. ∀U:Subset D. ∀d. cin D d → U d → sin ? U d.
34 unfold sin; intros; autobatch.
37 theorem sin_e1: ∀D. ∀U:Subset D. ∀d. sin ? U d → cin D d.
38 intros; decompose; autobatch.
41 theorem sin_e2: ∀D. ∀U:Subset D. ∀d. sin ? U d → U d.
42 intros; decompose; autobatch.
45 (* the domain built upon a subset *****************************************)
47 theorem ces_sin_fw: ∀D,U,d1,d2. sin D U d1 → ces ? d1 d2 → sin D U d2.
51 | apply (ces_subset_fw D U d1); [ apply sin_e2; autobatch | autobatch ] (**)
55 theorem ces_sin_bw: ∀D,U,d1,d2. sin D U d1 → ces ? d2 d1 → sin D U d2.
59 | apply (ces_subset_bw D U d1); [ apply sin_e2; autobatch | autobatch ] (**)
63 definition domain_of_subset: ∀D. Subset D → Domain ≝
65 mk_Domain (mk_Class D (sin D U) (ces D) (ces_sin_fw ? ?) (ces_sin_bw ? ?)).
67 coercion domain_of_subset.
69 (* subset top (full subset) ***********************************************)
71 definition stop: ∀D. Subset D ≝
72 λD. mk_Subset D (true_f ?) (true_fw ? ?) (true_bw ? ?).
74 coercion stop nocomposites.
76 (* subset bottom (empty subset) *******************************************)
78 definition sbot: ∀D. Subset D ≝
79 λD. mk_Subset D (false_f ?) (false_fw ? ?) (false_bw ? ?).
81 (* subset and (binary intersection) ***************************************)
84 ∀D. ∀U1,U2:Subset D. ∀d1,d2. U1 d1 ∧ U2 d1 → ces ? d1 d2 → U1 d2 ∧ U2 d2.
85 intros; decompose; apply conj;
86 [ apply (ces_subset_fw D U1 d1); autobatch (**)
87 | apply (ces_subset_fw D U2 d1); autobatch
92 ∀D. ∀U1,U2:Subset D. ∀d1,d2. U1 d1 ∧ U2 d1 → ces ? d2 d1 → U1 d2 ∧ U2 d2.
93 intros; decompose; apply conj;
94 [ apply (ces_subset_bw D U1 d1); autobatch (**)
95 | apply (ces_subset_bw D U2 d1); autobatch
99 definition sand: ∀D. Subset D → Subset D → Subset D ≝
101 mk_Subset D (λd. U1 d ∧ U2 d) (ces_sand_fw ? U1 U2) (ces_sand_bw ? U1 U2).
103 (* subset or (binary union) ***********************************************)
106 ∀D. ∀U1,U2:Subset D. ∀d1,d2. U1 d1 ∨ U2 d1 → ces ? d1 d2 → U1 d2 ∨ U2 d2.
108 [ apply or_introl; apply (ces_subset_fw D U1 d1); autobatch (**)
109 | apply or_intror; apply (ces_subset_fw D U2 d1); autobatch
114 ∀D. ∀U1,U2:Subset D. ∀d1,d2. U1 d1 ∨ U2 d1 → ces ? d2 d1 → U1 d2 ∨ U2 d2.
116 [ apply or_introl; apply (ces_subset_bw D U1 d1); autobatch (**)
117 | apply or_intror; apply (ces_subset_bw D U2 d1); autobatch
121 definition sor: ∀D. Subset D → Subset D → Subset D ≝
123 mk_Subset D (λd. U1 d ∨ U2 d) (ces_sor_fw ? U1 U2) (ces_sor_bw ? U1 U2).
125 (* subset less or equal (inclusion) ***************************************)
127 definition sle: ∀D. Subset D → Subset D → Prop ≝
128 λD. λU1,U2:Subset D. \iforall d. U1 d → U2 d.
130 (* subset overlap *********************************************************)
132 definition sover: ∀D. Subset D → Subset D → Prop ≝
133 λD. λU1,U2:Subset D. \iexists d. U1 d ∧ U2 d.
135 (* the class of the subsets of a domain ***********************************)
137 definition power: Domain → Class ≝
138 λD. mk_Class (Subset D) (true_f ?) (sle ?) (true_fw ? ?) (true_bw ? ?).