@@ -73,6 +73,42 @@ theorem powerset_empty : (∅ : Finset α).powerset = {∅} :=
7373theorem powerset_eq_singleton_empty : s.powerset = {∅} ↔ s = ∅ := by
7474 rw [← powerset_empty, powerset_inj]
7575
76+ theorem image_injOn_powerset_of_injOn {β : Type *} [DecidableEq β] {f : α → β} (H : Set.InjOn f s) :
77+ Set.InjOn (fun (x : Finset α) => x.image f) s.powerset := by
78+ intro x hx y hy h
79+ rw [mem_coe, mem_powerset] at hx hy
80+ dsimp at h
81+ ext a
82+ by_cases a ∈ s
83+ case pos ha =>
84+ have {z : Finset α} (hz : z ⊆ s) : a ∈ z ↔ f a ∈ z.image f := by
85+ refine ⟨fun b => mem_image_of_mem f b, fun h => ?_⟩
86+ obtain ⟨b, hb₁, hb₂⟩ := mem_image.mp h
87+ suffices b = a by rwa [this] at hb₁
88+ exact (H.eq_iff (hz hb₁) ha).mp hb₂
89+ rw [this hx, this hy, h]
90+ case neg ha => tauto
91+
92+ theorem image_surjOn_powerset {β : Type *} [DecidableEq β] {f : α → β} :
93+ Set.SurjOn (fun (x : Finset α) => x.image f) s.powerset (s.image f).powerset := by
94+ intro t ht
95+ rw [mem_coe, mem_powerset] at ht
96+ simp_rw [Set.mem_image, mem_coe, mem_powerset]
97+ use { x ∈ s | f x ∈ t}
98+ grind
99+
100+ theorem powerset_image {β : Type *} [DecidableEq β] {f : α → β} :
101+ (s.image f).powerset = s.powerset.image (fun x => x.image f) := by
102+ ext a
103+ rw [mem_powerset, mem_image]
104+ refine ⟨fun ha => ?_, fun ha => ?_⟩
105+ · use { x ∈ s | f x ∈ a }
106+ grind
107+ · obtain ⟨b, hb₁, hb₂⟩ := ha
108+ rw [mem_powerset] at hb₁
109+ rw [← hb₂]
110+ exact image_subset_image hb₁
111+
76112/-- **Number of Subsets of a Set** -/
77113@[simp]
78114theorem card_powerset (s : Finset α) : card (powerset s) = 2 ^ card s :=
0 commit comments