]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/nlibrary/sets/sets.ma
5ba0b08a6f856a40e3199c5cbda4fe439b53def0
[helm.git] / helm / software / matita / nlibrary / sets / sets.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "logic/connectives.ma".
16
17 nrecord powerset (A: Type) : Type[1] ≝ { mem: A → CProp }.
18 (* This is a projection! *)
19 ndefinition mem ≝ λA.λr:powerset A.match r with [mk_powerset f ⇒ f].
20
21 interpretation "powerset" 'powerset A = (powerset A).
22
23 interpretation "subset construction" 'subset \eta.x = (mk_powerset ? x).
24
25 interpretation "mem" 'mem a S = (mem ? S a).
26
27 ndefinition subseteq ≝ λA.λU,V.∀a:A. a ∈ U → a ∈ V.
28
29 interpretation "subseteq" 'subseteq U V = (subseteq ? U V).
30
31 ntheorem subseteq_refl: ∀A.∀S:Ω \sup A.S ⊆ S.
32  #A; #S; #x; #H; nassumption;
33 nqed.
34
35 ntheorem subseteq_trans: ∀A.∀S1,S2,S3: Ω \sup A. S1 ⊆ S2 → S2 ⊆ S3 → S1 ⊆ S3.
36  #A; #S1; #S2; #S3; #H12; #H23; #x; #H;
37  napply (H23 ??); napply (H12 ??); nassumption;
38 nqed.
39
40 ndefinition overlaps ≝ λA.λU,V:Ω \sup A.∃x:A.x ∈ U ∧ x ∈ V.
41
42 interpretation "overlaps" 'overlaps U V = (overlaps ? U V).
43
44 ndefinition intersects ≝ λA.λU,V:Ω \sup A. {x | x ∈ U ∧ x ∈ V }.
45
46 interpretation "intersects" 'intersects U V = (intersects ? U V).
47
48 ndefinition union ≝ λA.λU,V:Ω \sup A. {x | x ∈ U ∨ x ∈ V }.
49
50 interpretation "union" 'union U V = (union ? U V).
51
52 (*
53 ndefinition singleton ≝ λA.λa:A.{b | a=b}.
54
55 interpretation "singleton" 'singl a = (singleton ? a).
56 *)