2 ||M|| This file is part of HELM, an Hypertextual, Electronic
3 ||A|| Library of Mathematics, developed at the Computer Science
4 ||T|| Department of the University of Bologna, Italy.
7 ||A|| This file is distributed under the terms of the
8 \ / GNU General Public License Version 2
10 V_______________________________________________________________ *)
12 include "basics/logic.ma".
13 include "basics/core_notation/singl_1.ma".
14 include "basics/core_notation/subseteq_2.ma".
16 (**** a subset of A is just an object of type A→Prop ****)
18 definition empty_set ≝ λA:Type[0].λa:A.False.
19 notation "\emptyv" non associative with precedence 90 for @{'empty_set}.
20 interpretation "empty set" 'empty_set = (empty_set ?).
22 definition singleton ≝ λA.λx,a:A.x=a.
23 (* notation "{x}" non associative with precedence 90 for @{'sing_lang $x}. *)
24 interpretation "singleton" 'singl x = (singleton ? x).
26 definition union : ∀A:Type[0].∀P,Q.A → Prop ≝ λA,P,Q,a.P a ∨ Q a.
27 interpretation "union" 'union a b = (union ? a b).
29 definition intersection : ∀A:Type[0].∀P,Q.A→Prop ≝ λA,P,Q,a.P a ∧ Q a.
30 interpretation "intersection" 'intersects a b = (intersection ? a b).
32 definition complement ≝ λU:Type[0].λA:U → Prop.λw.¬ A w.
33 interpretation "complement" 'not a = (complement ? a).
35 definition substraction := λU:Type[0].λA,B:U → Prop.λw.A w ∧ ¬ B w.
36 interpretation "substraction" 'minus a b = (substraction ? a b).
38 definition subset: ∀A:Type[0].∀P,Q:A→Prop.Prop ≝ λA,P,Q.∀a:A.(P a → Q a).
39 interpretation "subset" 'subseteq a b = (subset ? a b).
41 (* extensional equality *)
42 definition eqP ≝ λA:Type[0].λP,Q:A → Prop.∀a:A.P a ↔ Q a.
43 (* ≐ is typed as \doteq *)
44 notation "A ≐ B" non associative with precedence 45 for @{'eqP $A $B}.
45 interpretation "extensional equality" 'eqP a b = (eqP ? a b).
47 lemma eqP_sym: ∀U.∀A,B:U →Prop.
49 #U #A #B #eqAB #a @iff_sym @eqAB qed.
51 lemma eqP_trans: ∀U.∀A,B,C:U →Prop.
52 A ≐ B → B ≐ C → A ≐ C.
53 #U #A #B #C #eqAB #eqBC #a @iff_trans // qed.
55 lemma eqP_union_r: ∀U.∀A,B,C:U →Prop.
56 A ≐ C → A ∪ B ≐ C ∪ B.
57 #U #A #B #C #eqAB #a @iff_or_r @eqAB qed.
59 lemma eqP_union_l: ∀U.∀A,B,C:U →Prop.
60 B ≐ C → A ∪ B ≐ A ∪ C.
61 #U #A #B #C #eqBC #a @iff_or_l @eqBC qed.
63 lemma eqP_intersect_r: ∀U.∀A,B,C:U →Prop.
64 A ≐ C → A ∩ B ≐ C ∩ B.
65 #U #A #B #C #eqAB #a @iff_and_r @eqAB qed.
67 lemma eqP_intersect_l: ∀U.∀A,B,C:U →Prop.
68 B ≐ C → A ∩ B ≐ A ∩ C.
69 #U #A #B #C #eqBC #a @iff_and_l @eqBC qed.
71 lemma eqP_substract_r: ∀U.∀A,B,C:U →Prop.
72 A ≐ C → A - B ≐ C - B.
73 #U #A #B #C #eqAB #a @iff_and_r @eqAB qed.
75 lemma eqP_substract_l: ∀U.∀A,B,C:U →Prop.
76 B ≐ C → A - B ≐ A - C.
77 #U #A #B #C #eqBC #a @iff_and_l /2/ qed.
80 lemma union_empty_r: ∀U.∀A:U→Prop.
82 #U #A #w % [* // normalize #abs @False_ind /2/ | /2/]
85 lemma union_comm : ∀U.∀A,B:U →Prop.
87 #U #A #B #a % * /2/ qed.
89 lemma union_assoc: ∀U.∀A,B,C:U → Prop.
90 A ∪ B ∪ C ≐ A ∪ (B ∪ C).
91 #S #A #B #C #w % [* [* /3/ | /3/] | * [/3/ | * /3/]
94 lemma cap_comm : ∀U.∀A,B:U →Prop.
96 #U #A #B #a % * /2/ qed.
98 lemma union_idemp: ∀U.∀A:U →Prop.
100 #U #A #a % [* // | /2/] qed.
102 lemma cap_idemp: ∀U.∀A:U →Prop.
104 #U #A #a % [* // | /2/] qed.
106 (*distributivities *)
108 lemma distribute_intersect : ∀U.∀A,B,C:U→Prop.
109 (A ∪ B) ∩ C ≐ (A ∩ C) ∪ (B ∩ C).
110 #U #A #B #C #w % [* * /3/ | * * /3/]
113 lemma distribute_substract : ∀U.∀A,B,C:U→Prop.
114 (A ∪ B) - C ≐ (A - C) ∪ (B - C).
115 #U #A #B #C #w % [* * /3/ | * * /3/]
119 lemma substract_def:∀U.∀A,B:U→Prop. A-B ≐ A ∩ ¬B.
120 #U #A #B #w normalize /2/