feat,refactor(library/data/{finset,set}/*,src/emacs/lean-input.el): add powerset and notation, and some tidying

This commit is contained in:
Jeremy Avigad 2015-08-04 22:36:10 -04:00 committed by Leonardo de Moura
parent 7b4ebb9866
commit d6bde18b46
4 changed files with 19 additions and 8 deletions

View file

@ -393,6 +393,8 @@ quot.lift_on s
(λ l, list_powerset (elt_of l))
(λ l₁ l₂ p, list_powerset_eq_list_powerset_of_perm p)
notation [priority finset.prio] `𝒫` s := powerset s
theorem powerset_empty : powerset (∅ : finset A) = '{∅} := rfl
theorem powerset_insert {a : A} {s : finset A} : a ∉ s →

View file

@ -18,7 +18,7 @@ abbreviation ts := @to_set A
variables (s t : finset A) (x y : A)
theorem mem_eq_mem_to_set : (x ∈ s) = (x ∈ ts s) := rfl
theorem mem_eq_mem_to_set : x ∈ s = (x ∈ ts s) := rfl
definition to_set.inj {s₁ s₂ : finset A} : to_set s₁ = to_set s₂ → s₁ = s₂ :=
λ h, ext (λ a, iff.of_eq (calc
@ -35,27 +35,30 @@ theorem mem_to_set_univ [h : fintype A] : (x ∈ ts univ) = (x ∈ set.univ) :=
propext (iff.intro (assume H, trivial) (assume H, !mem_univ))
theorem to_set_univ [h : fintype A] : ts univ = (set.univ : set A) := funext (λ x, !mem_to_set_univ)
theorem mem_to_set_upto (x n : ) : x ∈ ts (upto n) = (x ∈ {a | a < n}) := !mem_upto_eq
theorem to_set_upto (n : ) : ts (upto n) = {a | a < n} := funext (λ x, !mem_to_set_upto)
include deceq
theorem mem_to_set_insert : x ∈ insert y s = (x ∈ set.insert y s) := !finset.mem_insert_eq
theorem mem_to_set_insert : x ∈ insert y s = (x ∈ set.insert y s) := !mem_insert_eq
theorem to_set_insert : insert y s = set.insert y s := funext (λ x, !mem_to_set_insert)
theorem mem_to_set_union : x ∈ s t = (x ∈ ts s ts t) := !finset.mem_union_eq
theorem mem_to_set_union : x ∈ s t = (x ∈ ts s ts t) := !mem_union_eq
theorem to_set_union : ts (s t) = ts s ts t := funext (λ x, !mem_to_set_union)
theorem mem_to_set_inter : x ∈ s ∩ t = (x ∈ ts s ∩ ts t) := !finset.mem_inter_eq
theorem mem_to_set_inter : x ∈ s ∩ t = (x ∈ ts s ∩ ts t) := !mem_inter_eq
theorem to_set_inter : ts (s ∩ t) = ts s ∩ ts t := funext (λ x, !mem_to_set_inter)
theorem mem_to_set_diff : x ∈ s \ t = (x ∈ ts s \ ts t) := !finset.mem_diff_eq
theorem mem_to_set_diff : x ∈ s \ t = (x ∈ ts s \ ts t) := !mem_diff_eq
theorem to_set_diff : ts (s \ t) = ts s \ ts t := funext (λ x, !mem_to_set_diff)
theorem mem_to_set_filter (p : A → Prop) [h : decidable_pred p] : x ∈ filter p s = (x ∈ set.filter p s) :=
theorem mem_to_set_filter (p : A → Prop) [h : decidable_pred p] : x ∈ filter p s = (x ∈ set.filter p s) :=
!finset.mem_filter_eq
theorem to_set_filter (p : A → Prop) [h : decidable_pred p] : filter p s = set.filter p s :=
theorem to_set_filter (p : A → Prop) [h : decidable_pred p] : filter p s = set.filter p s :=
funext (λ x, !mem_to_set_filter)
theorem mem_to_set_image {B : Type} [h : decidable_eq B] (f : A → B) {s : finset A} {y : B} :
y ∈ image f s = (y ∈ set.image f s) := !finset.mem_image_eq
y ∈ image f s = (y ∈ set.image f s) := !mem_image_eq
theorem to_set_image {B : Type} [h : decidable_eq B] (f : A → B) (s : finset A) :
image f s = set.image f s := funext (λ x, !mem_to_set_image)

View file

@ -209,6 +209,11 @@ theorem mem_diff_iff (s t : set X) (x : X) : x ∈ s \ t ↔ x ∈ s ∧ x ∉ t
theorem mem_diff_eq (s t : set X) (x : X) : x ∈ s \ t = (x ∈ s ∧ x ∉ t) := rfl
/- powerset -/
definition powerset (s : set X) : set (set X) := {x : set X | x ⊆ s}
notation `𝒫` s := powerset s
/- large unions -/
section

View file

@ -314,6 +314,7 @@ order for the change to take effect."
("0" . (""))
("empty" . (""))
("C" . (""))
("powerset" . ("𝒫"))
;; Corners, ceilings and floors.