feat(library/*): add various theorems

This commit is contained in:
Jeremy Avigad 2015-09-24 23:38:52 -04:00 committed by Leonardo de Moura
parent 135f5ff96b
commit 2c7526e1fc
3 changed files with 48 additions and 1 deletions

View file

@ -301,6 +301,9 @@ ext (take x, iff.intro
theorem mem_sep_iff {s : set X} {P : X → Prop} {x : X} : x ∈ {x ∈ s | P x} ↔ x ∈ s ∧ P x :=
!iff.refl
theorem sep_subset (s : set X) (P : X → Prop) : {x ∈ s | P x} ⊆ s :=
take x, assume H, and.left H
/- complement -/
definition complement (s : set X) : set X := {x | x ∉ s}
@ -310,7 +313,15 @@ theorem mem_comp {s : set X} {x : X} (H : x ∉ s) : x ∈ -s := H
theorem not_mem_of_mem_comp {s : set X} {x : X} (H : x ∈ -s) : x ∉ s := H
theorem mem_comp_iff {s : set X} {x : X} : x ∈ -s ↔ x ∉ s := !iff.refl
theorem mem_comp_iff (s : set X) (x : X) : x ∈ -s ↔ x ∉ s := !iff.refl
theorem inter_comp_self (s : set X) : s ∩ -s = ∅ :=
ext (take x, !and_not_self_iff)
theorem comp_inter_self (s : set X) : -s ∩ s = ∅ :=
ext (take x, !not_and_self_iff)
/- some classical identities -/
section
open classical
@ -320,6 +331,12 @@ section
theorem inter_eq_comp_comp_union_comp (s t : set X) : s ∩ t = -(-s -t) :=
ext (take x, !and_iff_not_or_not)
theorem union_comp_self (s : set X) : s -s = univ :=
ext (take x, !or_not_self_iff)
theorem comp_union_self (s : set X) : -s s = univ :=
ext (take x, !not_or_self_iff)
end
/- set difference -/
@ -350,6 +367,8 @@ ext (take x, iff.intro
(suppose x ∈ s, or.inl this)
(suppose x ∉ s, or.inr (and.intro H1 this))))
theorem diff_subset (s t : set X) : s \ t ⊆ s := inter_subset_left s _
/- powerset -/
definition powerset (s : set X) : set (set X) := {x : set X | x ⊆ s}
@ -377,6 +396,12 @@ section
definition sUnion : set X := {x : X | ∃₀ c ∈ C, x ∈ c}
-- TODO: need notation for these
theorem Union_subset {b : I → set X} {c : set X} (H : ∀ i, b i ⊆ c) : Union b ⊆ c :=
take x,
suppose x ∈ Union b,
obtain i (Hi : x ∈ b i), from this,
show x ∈ c, from H i Hi
end
end set

View file

@ -100,6 +100,16 @@ take x, assume H : x ∈ a, H1 (H2 H)
theorem maps_to_univ_univ (f : X → Y) : maps_to f univ univ :=
take x, assume H, trivial
theorem image_subset_of_maps_to {f : X → Y} {a : set X} {b : set Y} (mfab : maps_to f a b)
{c : set X} (csuba : c ⊆ a) :
f '[c] ⊆ b :=
take y,
suppose y ∈ f '[c],
obtain x [(xc : x ∈ c) (yeq : f x = y)], from this,
have x ∈ a, from csuba `x ∈ c`,
have f x ∈ b, from mfab this,
show y ∈ b, from yeq ▸ this
/- injectivity -/
definition inj_on [reducible] (f : X → Y) (a : set X) : Prop :=

View file

@ -27,6 +27,18 @@ calc
... ↔ a ∧ (c ∧ b) : {and.comm}
... ↔ (a ∧ c) ∧ b : iff.symm and.assoc
theorem or_not_self_iff {a : Prop} [D : decidable a] : a ¬ a ↔ true :=
iff.intro (assume H, trivial) (assume H, em a)
theorem not_or_self_iff {a : Prop} [D : decidable a] : ¬ a a ↔ true :=
!or.comm ▸ !or_not_self_iff
theorem and_not_self_iff {a : Prop} : a ∧ ¬ a ↔ false :=
iff.intro (assume H, (and.right H) (and.left H)) (assume H, false.elim H)
theorem not_and_self_iff {a : Prop} : ¬ a ∧ a ↔ false :=
!and.comm ▸ !and_not_self_iff
theorem and.left_comm [simp] (a b c : Prop) : a ∧ (b ∧ c) ↔ b ∧ (a ∧ c) :=
calc
a ∧ (b ∧ c) ↔ (a ∧ b) ∧ c : iff.symm and.assoc