The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V03. Sets, finite structures and big operators

Mathlib.Data.Finset.Image

166 declarations and 7 deprecated aliases. Mathlib docs · Source

Image and map operations on finite sets

This file provides the finite analog of Set.image, along with some other similar functions.

Note there are two ways to take the image over a finset; via Finset.image which applies the function then removes duplicates (requiring DecidableEq), or via Finset.map which exploits injectivity of the function to avoid needing to deduplicate. Choosing between these is similar to choosing between insert and Finset.cons, or between Finset.union and Finset.disjUnion.

Main definitions

  • Finset.image: Given a function f : α → β, s.image f is the image finset in β.
  • Finset.map: Given an embedding f : α ↪ β, s.map f is the image finset in β.
  • Finset.filterMap Given a function f : α → Option β, s.filterMap f is the image finset in β, filtering out nones.
  • Finset.subtype: s.subtype p is the finset of Subtype p whose elements belong to s.
  • Finset.fin:s.fin n is the finset of all elements of s less than n.

map

image

filterMap

Subtype

theorem Finset.filterMap.congr_simp E1 #

∀ {α : Type u_1} {β : Type u_2} (f f_1 : α → Option β) (e_f : f = f_1) (s s_1 : Finset α),
  s = s_1 →
    ∀ (f_inj : ∀ (a a' : α), ∀ b ∈ f a, b ∈ f a' → a = a'), Finset.filterMap f s f_inj = Finset.filterMap f_1 s_1 ⋯

def Finset.map E3 #

{α : Type u_1} → {β : Type u_2} → (α ↪ β) → Finset α → Finset β

When f is an embedding of α in β and s is a finset in α, then s.map f is the image finset in β. The embedding condition guarantees that there are no duplicates in the image.

theorem Finset.map_val E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α ↪ β) (s : Finset α), (Finset.map f s).val = Multiset.map (⇑f) s.val

theorem Finset.map_empty E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α ↪ β), Finset.map f ∅ = ∅

theorem Finset.mem_map E0 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} {s : Finset α} {b : β}, b ∈ Finset.map f s ↔ ∃ a ∈ s, f a = b

theorem Finset.mem_map_equiv E0 #

∀ {α : Type u_1} {β : Type u_2} {s : Finset α} {f : α ≃ β} {b : β}, b ∈ Finset.map f.toEmbedding s ↔ f.symm b ∈ s

theorem Finset.mem_map' E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α ↪ β) {a : α} {s : Finset α}, f a ∈ Finset.map f s ↔ a ∈ s

theorem Finset.mem_map_mk E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α → β) {a : α} {s : Finset α} (hf : Function.Injective f),
  f a ∈ Finset.map { toFun := f, inj' := hf } s ↔ a ∈ s

theorem Finset.mem_map_of_mem E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α ↪ β) {a : α} {s : Finset α}, a ∈ s → f a ∈ Finset.map f s

theorem Finset.forall_mem_map E1 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} {s : Finset α} {p : (a : β) → a ∈ Finset.map f s → Prop},
  (∀ (y : β) (H : y ∈ Finset.map f s), p y H) ↔ ∀ (x : α) (H : x ∈ s), p (f x) ⋯

theorem Finset.apply_coe_mem_map E1 #

∀ {α : Type u_1} {β : Type u_2} (f : α ↪ β) (s : Finset α) (x : ↥s), f ↑x ∈ Finset.map f s

theorem Finset.coe_map E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α ↪ β) (s : Finset α), ↑(Finset.map f s) = ⇑f '' ↑s

theorem Finset.coe_map_subset_range E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α ↪ β) (s : Finset α), ↑(Finset.map f s) ⊆ Set.range ⇑f

theorem Finset.map_perm E0 #

∀ {α : Type u_1} {s : Finset α} {σ : Equiv.Perm α}, {a | σ a ≠ a} ⊆ ↑s → Finset.map (Equiv.toEmbedding σ) s = s

If the only elements outside s are those left fixed by σ, then mapping by σ has no effect.

theorem Finset.map_toFinset E0 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} [inst : DecidableEq α] [inst_1 : DecidableEq β] {s : Multiset α},
  Finset.map f s.toFinset = (Multiset.map (⇑f) s).toFinset

theorem Finset.map_refl E0 #

∀ {α : Type u_1} {s : Finset α}, Finset.map (Function.Embedding.refl α) s = s

theorem Finset.map_cast_heq E0 #

∀ {α β : Type u_4} (h : α = β) (s : Finset α), Finset.map (Equiv.cast h).toEmbedding s ≍ s

theorem Finset.map_map E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (f : α ↪ β) (g : β ↪ γ) (s : Finset α),
  Finset.map g (Finset.map f s) = Finset.map (f.trans g) s

theorem Finset.map_comm E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {s : Finset α} {β' : Type u_4} {f : β ↪ γ} {g : α ↪ β} {f' : α ↪ β'}
  {g' : β' ↪ γ}, (∀ (a : α), f (g a) = g' (f' a)) → Finset.map f (Finset.map g s) = Finset.map g' (Finset.map f' s)

theorem Function.Semiconj.finset_map E1 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} {ga : α ↪ α} {gb : β ↪ β},
  Function.Semiconj ⇑f ⇑ga ⇑gb → Function.Semiconj (Finset.map f) (Finset.map ga) (Finset.map gb)

theorem Function.Commute.finset_map E1 #

∀ {α : Type u_1} {f g : α ↪ α}, Function.Commute ⇑f ⇑g → Function.Commute (Finset.map f) (Finset.map g)

theorem Finset.map_subset_map E0 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} {s₁ s₂ : Finset α}, Finset.map f s₁ ⊆ Finset.map f s₂ ↔ s₁ ⊆ s₂

theorem Finset.subset_map_symm E1 #

∀ {α : Type u_1} {β : Type u_2} {s : Finset α} {t : Finset β} {f : α ≃ β},
  s ⊆ Finset.map f.symm.toEmbedding t ↔ Finset.map f.toEmbedding s ⊆ t

The Finset version of Equiv.subset_symm_image.

theorem Finset.map_symm_subset E0 #

∀ {α : Type u_1} {β : Type u_2} {s : Finset α} {t : Finset β} {f : α ≃ β},
  Finset.map f.symm.toEmbedding t ⊆ s ↔ t ⊆ Finset.map f.toEmbedding s

The Finset version of Equiv.symm_image_subset.

def Finset.mapEmbedding E1 #

{α : Type u_1} → {β : Type u_2} → (α ↪ β) → Finset α ↪o Finset β

Associate to an embedding f from α to β the order embedding that maps a finset to its image under f.

theorem Finset.map_inj E0 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} {s₁ s₂ : Finset α}, Finset.map f s₁ = Finset.map f s₂ ↔ s₁ = s₂

theorem Finset.map_injective E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α ↪ β), Function.Injective (Finset.map f)

theorem Finset.map_ssubset_map E0 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} {s t : Finset α}, Finset.map f s ⊂ Finset.map f t ↔ s ⊂ t

theorem Finset.mapEmbedding_apply E0 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} {s : Finset α}, (Finset.mapEmbedding f) s = Finset.map f s

theorem Finset.filter_map E1 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} {s : Finset α} {p : β → Prop} [inst : DecidablePred p],
  Finset.filter p (Finset.map f s) = Finset.map f (Finset.filter (p ∘ ⇑f) s)

theorem Finset.map_filter' E0 #

∀ {α : Type u_1} {β : Type u_2} (p : α → Prop) [inst : DecidablePred p] (f : α ↪ β) (s : Finset α)
  [inst_1 : DecidablePred fun x ↦ ∃ a, p a ∧ f a = x],
  Finset.map f (Finset.filter p s) = {b ∈ Finset.map f s | ∃ a, p a ∧ f a = b}

theorem Finset.filter_attach' E1 #

∀ {α : Type u_1} [inst : DecidableEq α] (s : Finset α) (p : ↥s → Prop) [inst_1 : DecidablePred p],
  Finset.filter p s.attach =
    Finset.map { toFun := Subtype.map id ⋯, inj' := ⋯ } {x ∈ s | ∃ (h : x ∈ s), p ⟨x, h⟩}.attach

theorem Finset.filter_attach E1 #

∀ {α : Type u_1} (p : α → Prop) [inst : DecidablePred p] (s : Finset α),
  {a ∈ s.attach | p ↑a} = Finset.map ((Function.Embedding.refl α).subtypeMap ⋯) (Finset.filter p s).attach

theorem Finset.map_filter E0 #

∀ {α : Type u_1} {β : Type u_2} {s : Finset α} {f : α ≃ β} {p : α → Prop} [inst : DecidablePred p],
  Finset.map f.toEmbedding (Finset.filter p s) = Finset.filter (p ∘ ⇑f.symm) (Finset.map f.toEmbedding s)

theorem Finset.disjoint_map E0 #

∀ {α : Type u_1} {β : Type u_2} {s t : Finset α} (f : α ↪ β), Disjoint (Finset.map f s) (Finset.map f t) ↔ Disjoint s t

theorem Finset.map_disjUnion E0 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} (s₁ s₂ : Finset α) (h : Disjoint s₁ s₂)
  (h' : optParam (Disjoint (Finset.map f s₁) (Finset.map f s₂)) ⋯),
  Finset.map f (s₁.disjUnion s₂ h) = (Finset.map f s₁).disjUnion (Finset.map f s₂) h'

theorem Finset.map_disjUnion' E0 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} (s₁ s₂ : Finset α) (h' : Disjoint (Finset.map f s₁) (Finset.map f s₂))
  (h : optParam (Disjoint s₁ s₂) ⋯), Finset.map f (s₁.disjUnion s₂ h) = (Finset.map f s₁).disjUnion (Finset.map f s₂) h'

A version of Finset.map_disjUnion for writing in the other direction.

theorem Finset.map_union E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq β] {f : α ↪ β} (s₁ s₂ : Finset α),
  Finset.map f (s₁ ∪ s₂) = Finset.map f s₁ ∪ Finset.map f s₂

theorem Finset.map_inter E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq β] {f : α ↪ β} (s₁ s₂ : Finset α),
  Finset.map f (s₁ ∩ s₂) = Finset.map f s₁ ∩ Finset.map f s₂

theorem Finset.map_sdiff E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq β] {f : α ↪ β} (s₁ s₂ : Finset α),
  Finset.map f (s₁ \ s₂) = Finset.map f s₁ \ Finset.map f s₂

theorem Finset.map_singleton E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α ↪ β) (a : α), Finset.map f {a} = {f a}

theorem Finset.map_insert E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq β] (f : α ↪ β) (a : α) (s : Finset α),
  Finset.map f (insert a s) = insert (f a) (Finset.map f s)

theorem Finset.map_cons E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α ↪ β) (a : α) (s : Finset α) (ha : a ∉ s),
  Finset.map f (Finset.cons a s ha) = Finset.cons (f a) (Finset.map f s) ⋯

theorem Finset.map_eq_empty E0 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} {s : Finset α}, Finset.map f s = ∅ ↔ s = ∅

theorem Finset.empty_eq_map E0 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} {s : Finset α}, ∅ = Finset.map f s ↔ s = ∅

theorem Finset.map_nonempty E0 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} {s : Finset α}, (Finset.map f s).Nonempty ↔ s.Nonempty

theorem Finset.Nonempty.map E1 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} {s : Finset α}, s.Nonempty → (Finset.map f s).Nonempty

Alias of the reverse direction of Finset.map_nonempty.

theorem Finset.map_nontrivial E0 #

∀ {α : Type u_1} {β : Type u_2} {f : α ↪ β} {s : Finset α}, (Finset.map f s).Nontrivial ↔ s.Nontrivial

theorem Finset.attach_map_val E0 #

∀ {α : Type u_1} {s : Finset α}, Finset.map (Function.Embedding.subtype fun x ↦ x ∈ s) s.attach = s

def Finset.equivMap E1 #

{α : Type u_1} → {β : Type u_2} → (f : α ↪ β) → (s : Finset α) → ↥s ≃ ↥(Finset.map f s)

A Finset is in bijection with its image under an Embedding.

theorem Finset.equivMap_symm_apply E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α ↪ β) (s : Finset α) (b : ↥(Finset.map f s)),
  (Finset.equivMap f s).symm b = Function.surjInv ⋯ b

theorem Finset.equivMap_apply_coe E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α ↪ β) (s : Finset α) (x : ↥s), ↑((Finset.equivMap f s) x) = f ↑x

theorem Finset.range_add_one' E1 #

∀ (n : ℕ), Finset.range (n + 1) = insert 0 (Finset.map { toFun := fun i ↦ i + 1, inj' := ⋯ } (Finset.range n))

def Finset.image E3 #

{α : Type u_1} → {β : Type u_2} → [DecidableEq β] → (α → β) → Finset α → Finset β

image f s is the forward image of s under f.

theorem Finset.image_val E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] (f : α → β) (s : Finset α),
  (Finset.image f s).val = (Multiset.map f s.val).dedup

theorem Finset.image_empty E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] (f : α → β), Finset.image f ∅ = ∅

theorem Finset.mem_image E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} {b : β},
  b ∈ Finset.image f s ↔ ∃ a ∈ s, f a = b

theorem Finset.mem_image_of_mem E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {s : Finset α} (f : α → β) {a : α},
  a ∈ s → f a ∈ Finset.image f s

theorem Finset.forall_mem_image E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} {p : β → Prop},
  (∀ y ∈ Finset.image f s, p y) ↔ ∀ ⦃x : α⦄, x ∈ s → p (f x)

theorem Finset.exists_mem_image E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} {p : β → Prop},
  (∃ y ∈ Finset.image f s, p y) ↔ ∃ x ∈ s, p (f x)

theorem Finset.map_eq_image E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] (f : α ↪ β) (s : Finset α), Finset.map f s = Finset.image (⇑f) s

theorem Finset.mem_image_const E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {s : Finset α} {b c : β},
  c ∈ Finset.image (Function.const α b) s ↔ s.Nonempty ∧ b = c

theorem Finset.mem_image_const_self E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {s : Finset α} {b : β},
  b ∈ Finset.image (Function.const α b) s ↔ s.Nonempty

instance Finset.canLift E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] (c : α → β) (p : β → Prop) [CanLift β α c p],
  CanLift (Finset β) (Finset α) (Finset.image c) fun s ↦ ∀ x ∈ s, p x

theorem Finset.image_congr E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f g : α → β} {s : Finset α},
  Set.EqOn f g ↑s → Finset.image f s = Finset.image g s

theorem Function.Injective.mem_finset_image E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} {a : α},
  Function.Injective f → (f a ∈ Finset.image f s ↔ a ∈ s)

theorem Finset.coe_image E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α}, ↑(Finset.image f s) = f '' ↑s

theorem Finset.image_nonempty E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α},
  (Finset.image f s).Nonempty ↔ s.Nonempty

theorem Finset.Nonempty.image E2 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {s : Finset α},
  s.Nonempty → ∀ (f : α → β), (Finset.image f s).Nonempty

theorem Finset.Nonempty.of_image E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α},
  (Finset.image f s).Nonempty → s.Nonempty

Alias of the forward direction of Finset.image_nonempty.

theorem Finset.nontrivial_of_image E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α},
  (Finset.image f s).Nontrivial → s.Nontrivial

If the image of a finset is nontrivial, the finset is nontrivial. For the converse direction under an injectivity hypothesis see Finset.Nontrivial.image_of_injOn, and for the combined iff see Finset.image_nontrivial_iff_of_injOn.

theorem Finset.Nontrivial.image_of_injOn E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α},
  s.Nontrivial → Set.InjOn f ↑s → (Finset.image f s).Nontrivial

The image of a nontrivial finset under a function injective on the finset is nontrivial. For the version assuming Function.Injective see Finset.map_nontrivial, and for the combined iff see Finset.image_nontrivial_iff_of_injOn.

theorem Finset.image_nontrivial_iff_of_injOn E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α},
  Set.InjOn f ↑s → ((Finset.image f s).Nontrivial ↔ s.Nontrivial)

A finset is nontrivial iff its image under a function injective on the finset is.

theorem Finset.image_toFinset E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} [inst_1 : DecidableEq α] {s : Multiset α},
  Finset.image f s.toFinset = (Multiset.map f s).toFinset

theorem Finset.image_val_of_injOn E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α},
  Set.InjOn f ↑s → (Finset.image f s).val = Multiset.map f s.val

theorem Finset.image_id E0 #

∀ {α : Type u_1} {s : Finset α} [inst : DecidableEq α], Finset.image id s = s

theorem Finset.image_id' E0 #

∀ {α : Type u_1} {s : Finset α} [inst : DecidableEq α], Finset.image (fun x ↦ x) s = s

theorem Finset.image_image E1 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} [inst : DecidableEq β] {f : α → β} {s : Finset α}
  [inst_1 : DecidableEq γ] {g : β → γ}, Finset.image g (Finset.image f s) = Finset.image (g ∘ f) s

theorem Finset.image_comp E1 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} [inst : DecidableEq β] {f : α → β} {s : Finset α}
  [inst_1 : DecidableEq γ] {g : β → γ}, Finset.image (g ∘ f) s = Finset.image g (Finset.image f s)

Reverse of Finset.image_image. The Finset analogue of Set.image_comp.

theorem Finset.image_comp_image E1 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} [inst : DecidableEq β] {f : α → β} [inst_1 : DecidableEq γ] {g : β → γ},
  Finset.image g ∘ Finset.image f = Finset.image (g ∘ f)

Point-free form of Finset.image_image: image distributes over Function.comp.

theorem Finset.image_comp_eq E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} [inst : DecidableEq β] {f : α → β} [inst_1 : DecidableEq γ] {g : β → γ},
  Finset.image (g ∘ f) = Finset.image g ∘ Finset.image f

theorem Finset.image_comm E1 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} [inst : DecidableEq β] {s : Finset α} {β' : Type u_4}
  [inst_1 : DecidableEq β'] [inst_2 : DecidableEq γ] {f : β → γ} {g : α → β} {f' : α → β'} {g' : β' → γ},
  (∀ (a : α), f (g a) = g' (f' a)) → Finset.image f (Finset.image g s) = Finset.image g' (Finset.image f' s)

theorem Function.Semiconj.finset_image E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] [inst_1 : DecidableEq α] {f : α → β} {ga : α → α} {gb : β → β},
  Function.Semiconj f ga gb → Function.Semiconj (Finset.image f) (Finset.image ga) (Finset.image gb)

theorem Function.Commute.finset_image E1 #

∀ {α : Type u_1} [inst : DecidableEq α] {f g : α → α},
  Function.Commute f g → Function.Commute (Finset.image f) (Finset.image g)

theorem Finset.image_subset_image E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s₁ s₂ : Finset α},
  s₁ ⊆ s₂ → Finset.image f s₁ ⊆ Finset.image f s₂

theorem Finset.image_subset_iff E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} {t : Finset β},
  Finset.image f s ⊆ t ↔ ∀ x ∈ s, f x ∈ t

theorem Finset.mapsTo_iff_image_subset E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} {t : Finset β},
  Set.MapsTo f ↑s ↑t ↔ Finset.image f s ⊆ t

theorem Set.MapsTo.finsetImage_subset E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} {t : Finset β},
  Set.MapsTo f ↑s ↑t → Finset.image f s ⊆ t

Alias of the forward direction of Finset.mapsTo_iff_image_subset.

theorem Finset.surjOn_iff_subset_image E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} {t : Finset β},
  Set.SurjOn f ↑s ↑t ↔ t ⊆ Finset.image f s

theorem Set.SurjOn.subset_finsetImage E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} {t : Finset β},
  Set.SurjOn f ↑s ↑t → t ⊆ Finset.image f s

Alias of the forward direction of Finset.surjOn_iff_subset_image.

theorem Finset.image_eq_iff_surjOn_mapsTo E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} {t : Finset β},
  Finset.image f s = t ↔ Set.SurjOn f ↑s ↑t ∧ Set.MapsTo f ↑s ↑t

theorem Set.SurjOn.finsetImage_eq_of_mapsTo E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} {t : Finset β},
  Finset.image f s = t → Set.SurjOn f ↑s ↑t ∧ Set.MapsTo f ↑s ↑t

Alias of the forward direction of Finset.image_eq_iff_surjOn_mapsTo.

theorem Finset.image_mono E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] (f : α → β), Monotone (Finset.image f)

theorem Finset.image_injective E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β},
  Function.Injective f → Function.Injective (Finset.image f)

theorem Finset.image_inj E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s t : Finset α},
  Function.Injective f → (Finset.image f s = Finset.image f t ↔ s = t)

theorem Finset.image_subset_image_iff E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s t : Finset α},
  Function.Injective f → (Finset.image f s ⊆ Finset.image f t ↔ s ⊆ t)

theorem Finset.image_subset_image_iff_of_injOn E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s s₁ s₂ : Finset α},
  Set.InjOn f ↑s → s₁ ⊆ s → s₂ ⊆ s → (Finset.image f s₁ ⊆ Finset.image f s₂ ↔ s₁ ⊆ s₂)

Variant of Finset.image_subset_image_iff under an InjOn rather than Injective hypothesis.

theorem Finset.image_eq_image_iff_of_injOn E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s s₁ s₂ : Finset α},
  Set.InjOn f ↑s → s₁ ⊆ s → s₂ ⊆ s → (Finset.image f s₁ = Finset.image f s₂ ↔ s₁ = s₂)

Variant of Finset.image_inj under an InjOn rather than Injective hypothesis.

theorem Finset.image_ssubset_image E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s t : Finset α},
  Function.Injective f → (Finset.image f s ⊂ Finset.image f t ↔ s ⊂ t)

theorem Finset.coe_image_subset_range E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α}, ↑(Finset.image f s) ⊆ Set.range f

theorem Finset.filter_image E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} {p : β → Prop}
  [inst_1 : DecidablePred p], Finset.filter p (Finset.image f s) = Finset.image f ({a ∈ s | p (f a)})

theorem Finset.fiber_nonempty_iff_mem_image E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} {y : β},
  {x ∈ s | f x = y}.Nonempty ↔ y ∈ Finset.image f s

theorem Finset.image_union E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] [inst_1 : DecidableEq α] {f : α → β} (s₁ s₂ : Finset α),
  Finset.image f (s₁ ∪ s₂) = Finset.image f s₁ ∪ Finset.image f s₂

theorem Finset.image_inter_subset E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] [inst_1 : DecidableEq α] (f : α → β) (s t : Finset α),
  Finset.image f (s ∩ t) ⊆ Finset.image f s ∩ Finset.image f t

theorem Finset.image_inter_of_injOn E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] [inst_1 : DecidableEq α] {f : α → β} (s t : Finset α),
  Set.InjOn f (↑s ∪ ↑t) → Finset.image f (s ∩ t) = Finset.image f s ∩ Finset.image f t

theorem Finset.image_inter E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} [inst_1 : DecidableEq α] (s₁ s₂ : Finset α),
  Function.Injective f → Finset.image f (s₁ ∩ s₂) = Finset.image f s₁ ∩ Finset.image f s₂

theorem Finset.image_singleton E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] (f : α → β) (a : α), Finset.image f {a} = {f a}

theorem Finset.image_insert E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] [inst_1 : DecidableEq α] (f : α → β) (a : α) (s : Finset α),
  Finset.image f (insert a s) = insert (f a) (Finset.image f s)

theorem Finset.erase_image_subset_image_erase E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] [inst_1 : DecidableEq α] (f : α → β) (s : Finset α) (a : α),
  (Finset.image f s).erase (f a) ⊆ Finset.image f (s.erase a)

theorem Finset.image_erase E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] [inst_1 : DecidableEq α] {f : α → β},
  Function.Injective f → ∀ (s : Finset α) (a : α), Finset.image f (s.erase a) = (Finset.image f s).erase (f a)

theorem Finset.image_eq_empty E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α}, Finset.image f s = ∅ ↔ s = ∅

theorem Finset.empty_eq_image E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α}, ∅ = Finset.image f s ↔ s = ∅

theorem Finset.image_sdiff E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] [inst_1 : DecidableEq α] {f : α → β} (s t : Finset α),
  Function.Injective f → Finset.image f (s \ t) = Finset.image f s \ Finset.image f t

theorem Finset.image_sdiff_of_injOn E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {f : α → β} {s : Finset α} [inst_1 : DecidableEq α]
  {t : Finset α}, Set.InjOn f ↑s → t ⊆ s → Finset.image f (s \ t) = Finset.image f s \ Finset.image f t

theorem Disjoint.of_image_finset E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {s t : Finset α} {f : α → β},
  Disjoint (Finset.image f s) (Finset.image f t) → Disjoint s t

theorem Finset.mem_range_iff_mem_finset_range_of_mod_eq' E0 #

∀ {α : Type u_1} [inst : DecidableEq α] {f : ℕ → α} {a : α} {n : ℕ},
  0 < n → (∀ (i : ℕ), f (i % n) = f i) → (a ∈ Set.range f ↔ a ∈ Finset.image (fun i ↦ f i) (Finset.range n))

theorem Finset.mem_range_iff_mem_finset_range_of_mod_eq E0 #

∀ {α : Type u_1} [inst : DecidableEq α] {f : ℤ → α} {a : α} {n : ℕ},
  0 < n → (∀ (i : ℤ), f (i % ↑n) = f i) → (a ∈ Set.range f ↔ a ∈ Finset.image (fun i ↦ f ↑i) (Finset.range n))

theorem Finset.attach_image_val E0 #

∀ {α : Type u_1} [inst : DecidableEq α] {s : Finset α}, Finset.image Subtype.val s.attach = s

theorem Finset.attach_cons E0 #

∀ {α : Type u_1} (a : α) (s : Finset α) (ha : a ∉ s),
  (Finset.cons a s ha).attach = Finset.cons ⟨a, ⋯⟩ (Finset.map { toFun := fun x ↦ ⟨↑x, ⋯⟩, inj' := ⋯ } s.attach) ⋯

theorem Finset.attach_insert E0 #

∀ {α : Type u_1} [inst : DecidableEq α] (s : Finset α) (a : α),
  (insert a s).attach = insert ⟨a, ⋯⟩ (Finset.image (fun x ↦ ⟨↑x, ⋯⟩) s.attach)

theorem Finset.disjoint_image E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {s t : Finset α} {f : α → β},
  Function.Injective f → (Disjoint (Finset.image f s) (Finset.image f t) ↔ Disjoint s t)

theorem Finset.image_const E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {s : Finset α},
  s.Nonempty → ∀ (b : β), Finset.image (fun x ↦ b) s = {b}

theorem Finset.map_erase E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] [inst_1 : DecidableEq α] (f : α ↪ β) (s : Finset α) (a : α),
  Finset.map f (s.erase a) = (Finset.map f s).erase (f a)

theorem Finset.iterate_image E1 #

∀ {α : Type u_1} {s : Finset α} [inst : DecidableEq α] (f : α → α) (n : ℕ),
  (Finset.image f)^[n] s = Finset.image f^[n] s

def Finset.filterMap E3 #

{α : Type u_1} →
  {β : Type u_2} → (f : α → Option β) → Finset α → (∀ (a a' : α), ∀ b ∈ f a, b ∈ f a' → a = a') → Finset β

filterMap f s is a combination filter/map operation on s. The function f : α → Option β is applied to each element of s; if f a is some b then b is included in the result, otherwise a is excluded from the resulting finset.

In notation, filterMap f s is the finset {b : β | ∃ a ∈ s, f a = some b}.

theorem Finset.filterMap_val E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α → Option β) (s' : Finset α) {f_inj : ∀ (a a' : α), ∀ b ∈ f a, b ∈ f a' → a = a'},
  (Finset.filterMap f s' f_inj).val = Multiset.filterMap f s'.val

theorem Finset.filterMap_empty E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α → Option β) {f_inj : ∀ (a a' : α), ∀ b ∈ f a, b ∈ f a' → a = a'},
  Finset.filterMap f ∅ f_inj = ∅

theorem Finset.mem_filterMap E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α → Option β) {s : Finset α} {f_inj : ∀ (a a' : α), ∀ b ∈ f a, b ∈ f a' → a = a'}
  {b : β}, b ∈ Finset.filterMap f s f_inj ↔ ∃ a ∈ s, f a = some b

theorem Finset.coe_filterMap E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α → Option β) {s : Finset α} {f_inj : ∀ (a a' : α), ∀ b ∈ f a, b ∈ f a' → a = a'},
  ↑(Finset.filterMap f s f_inj) = {b | ∃ a ∈ s, f a = some b}

theorem Finset.filterMap_some E0 #

∀ {α : Type u_1} {s : Finset α}, Finset.filterMap some s ⋯ = s

theorem Finset.filterMap_mono E1 #

∀ {α : Type u_1} {β : Type u_2} (f : α → Option β) {s t : Finset α}
  {f_inj : ∀ (a a' : α), ∀ b ∈ f a, b ∈ f a' → a = a'}, s ⊆ t → Finset.filterMap f s f_inj ⊆ Finset.filterMap f t f_inj

theorem List.toFinset_filterMap E1 #

∀ {α : Type u_1} {β : Type u_2} (f : α → Option β) [inst : DecidableEq α] [inst_1 : DecidableEq β]
  (f_inj : ∀ (a a' : α) (b : β), f a = some b → f a' = some b → a = a') (s : List α),
  (List.filterMap f s).toFinset = Finset.filterMap f s.toFinset f_inj

def Finset.subtype E3 #

{α : Type u_4} → (p : α → Prop) → [DecidablePred p] → Finset α → Finset (Subtype p)

Given a finset s and a predicate p, s.subtype p is the finset of Subtype p whose elements belong to s.

theorem Finset.mem_subtype E0 #

∀ {α : Type u_1} {p : α → Prop} [inst : DecidablePred p] {s : Finset α} {a : Subtype p}, a ∈ Finset.subtype p s ↔ ↑a ∈ s

theorem Finset.subtype_eq_empty E1 #

∀ {α : Type u_1} {p : α → Prop} [inst : DecidablePred p] {s : Finset α}, Finset.subtype p s = ∅ ↔ ∀ (x : α), p x → x ∉ s

theorem Finset.subtype_mono E1 #

∀ {α : Type u_1} {p : α → Prop} [inst : DecidablePred p], Monotone (Finset.subtype p)

theorem Finset.subtype_map E0 #

∀ {α : Type u_1} (p : α → Prop) [inst : DecidablePred p] {s : Finset α},
  Finset.map (Function.Embedding.subtype p) (Finset.subtype p s) = Finset.filter p s

s.subtype p converts back to s.filter p with Embedding.subtype.

theorem Finset.subtype_map_of_mem E1 #

∀ {α : Type u_1} {p : α → Prop} [inst : DecidablePred p] {s : Finset α},
  (∀ x ∈ s, p x) → Finset.map (Function.Embedding.subtype p) (Finset.subtype p s) = s

If all elements of a Finset satisfy the predicate p, s.subtype p converts back to s with Embedding.subtype.

theorem Finset.subtype_mem_eq_attach E0 #

∀ {α : Type u_1} (s : Finset α) [inst : DecidablePred fun x ↦ x ∈ s], Finset.subtype (fun x ↦ x ∈ s) s = s.attach

theorem Finset.property_of_mem_map_subtype E1 #

∀ {α : Type u_1} {p : α → Prop} (s : Finset { x // p x }) {a : α},
  a ∈ Finset.map (Function.Embedding.subtype fun x ↦ p x) s → p a

If a Finset of a subtype is converted to the main type with Embedding.subtype, all elements of the result have the property of the subtype.

theorem Finset.notMem_map_subtype_of_not_property E1 #

∀ {α : Type u_1} {p : α → Prop} (s : Finset { x // p x }) {a : α},
  ¬p a → a ∉ Finset.map (Function.Embedding.subtype fun x ↦ p x) s

If a Finset of a subtype is converted to the main type with Embedding.subtype, the result does not contain any value that does not satisfy the property of the subtype.

theorem Finset.map_subtype_subset E0 #

∀ {α : Type u_1} {t : Set α} (s : Finset ↑t), ↑(Finset.map (Function.Embedding.subtype fun x ↦ x ∈ t) s) ⊆ t

If a Finset of a subtype is converted to the main type with Embedding.subtype, the result is a subset of the set giving the subtype.

theorem Finset.subset_set_image_iff E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {s : Set α} {t : Finset β} {f : α → β},
  ↑t ⊆ f '' s ↔ ∃ s', ↑s' ⊆ s ∧ Finset.image f s' = t

If a Finset is a subset of the image of a Set under f, then it is equal to the Finset.image of a Finset subset of that Set.

theorem Finset.subset_image_iff E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] {s : Finset α} {t : Finset β} {f : α → β},
  t ⊆ Finset.image f s ↔ ∃ s' ⊆ s, Finset.image f s' = t

If a finset t is a subset of the image of another finset s under f, then it is equal to the image of a subset of s.

For the version where s is a set, see subset_set_image_iff.

theorem Finset.subset_univ_image_iff E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : Fintype α] [inst_1 : DecidableEq β] {t : Finset β} {f : α → β},
  t ⊆ Finset.image f Finset.univ ↔ ∃ s', Finset.image f s' = t

A special case of subset_image_iff, which corresponds to Set.subset_range_iff_exists_image_eq for Set.

theorem Finset.range_sdiff_zero E1 #

∀ {n : ℕ}, Finset.range (n + 1) \ {0} = Finset.image Nat.succ (Finset.range n)

theorem Multiset.toFinset_map E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq β] (f : α → β) (m : Multiset α),
  (Multiset.map f m).toFinset = Finset.image f m.toFinset

theorem List.toFinset_map E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq β] (f : α → β) (l : List α),
  (List.map f l).toFinset = Finset.image f l.toFinset

def Equiv.imageFinset E1 #

{α : Type u_1} → {β : Type u_2} → [inst : DecidableEq β] → (e : α ≃ β) → (s : Finset α) → ↥s ≃ ↥(Finset.image (⇑e) s)

A Finset is bijective to its image under an equivalence.

See Equiv.image for the Set version.

theorem Equiv.imageFinset_symm_apply_coe E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] (e : α ≃ β) (s : Finset α) (b : ↥(Finset.image (⇑e) s)),
  ↑((e.imageFinset s).symm b) = e.symm ↑b

theorem Equiv.imageFinset_apply_coe E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] (e : α ≃ β) (s : Finset α) (a : ↥s),
  ↑((e.imageFinset s) a) = e ↑a

def Equiv.finsetCongr E1 #

{α : Type u_1} → {β : Type u_2} → α ≃ β → Finset α ≃ Finset β

If α is equivalent to β, then Finset α is equivalent to Finset β.

See also Equiv.setCongr.

theorem Equiv.finsetCongr_apply E0 #

∀ {α : Type u_1} {β : Type u_2} (e : α ≃ β) (s : Finset α), e.finsetCongr s = Finset.map e.toEmbedding s

theorem Equiv.finsetCongr_refl E0 #

∀ {α : Type u_1}, (Equiv.refl α).finsetCongr = Equiv.refl (Finset α)

theorem Equiv.finsetCongr_symm E1 #

∀ {α : Type u_1} {β : Type u_2} (e : α ≃ β), e.finsetCongr.symm = e.symm.finsetCongr

theorem Equiv.finsetCongr_trans E1 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (e : α ≃ β) (e' : β ≃ γ),
  e.finsetCongr.trans e'.finsetCongr = (e.trans e').finsetCongr

theorem Equiv.finsetCongr_toEmbedding E1 #

∀ {α : Type u_1} {β : Type u_2} (e : α ≃ β), e.finsetCongr.toEmbedding = (Finset.mapEmbedding e.toEmbedding).toEmbedding

def Equiv.finsetSubtypeComm E1 #

{α : Type u_1} → (p : α → Prop) → Finset { a // p a } ≃ { s // ∀ a ∈ s, p a }

Given a predicate p : α → Prop, produces an equivalence between Finset {a : α // p a} and {s : Finset α // ∀ a ∈ s, p a}.

theorem Equiv.finsetSubtypeComm_symm_apply E0 #

∀ {α : Type u_1} (p : α → Prop) (s : { s // ∀ a ∈ s, p a }),
  (Equiv.finsetSubtypeComm p).symm s = Finset.map (Subtype.impEmbedding (Membership.mem ↑s) p ⋯) (↑s).attach

theorem Equiv.finsetSubtypeComm_apply_coe E0 #

∀ {α : Type u_1} (p : α → Prop) (s : Finset { a // p a }),
  ↑((Equiv.finsetSubtypeComm p) s) = Finset.map { toFun := fun a ↦ ↑a, inj' := ⋯ } s

def Finset.equivOfEq E1 #

{α : Type u_1} → {s t : Finset α} → s = t → ↥s ≃ ↥t

The subtypes corresponding to equal finsets are equivalent.

See also Set.equivOfEq.

theorem Finset.equivOfEq_apply_coe E0 #

∀ {α : Type u_1} {s t : Finset α} (h : s = t) (a : { a // (fun x ↦ x ∈ s) a }), ↑((Finset.equivOfEq h) a) = ↑a

theorem Finset.equivOfEq_symm_apply_coe E0 #

∀ {α : Type u_1} {s t : Finset α} (h : s = t) (b : { b // (fun x ↦ x ∈ t) b }), ↑((Finset.equivOfEq h).symm b) = ↑b

theorem Finset.equivOfEq_refl E0 #

∀ {α : Type u_1} {s : Finset α}, Finset.equivOfEq ⋯ = Equiv.refl ↥s

theorem Finset.equivOfEq_symm E1 #

∀ {α : Type u_1} {s t : Finset α} (h : s = t), Finset.equivOfEq ⋯ = (Finset.equivOfEq h).symm

theorem Finset.equivOfEq_trans E1 #

∀ {α : Type u_1} {s t u : Finset α} (h : s = t) (h' : t = u),
  Finset.equivOfEq ⋯ = (Finset.equivOfEq h).trans (Finset.equivOfEq h')

Deprecated aliases

NameNew nameSince
Equiv.Finset.congrFinset.equivOfEq2026-08-29
Equiv.Finset.congr_apply_coeFinset.equivOfEq_apply_coe2026-08-29
Equiv.Finset.congr_reflFinset.equivOfEq_refl2026-08-29
Equiv.Finset.congr_symmFinset.equivOfEq_symm2026-08-29
Equiv.Finset.congr_symm_apply_coeFinset.equivOfEq_symm_apply_coe2026-08-29
Equiv.Finset.congr_toEmbeddingEquiv.finsetCongr_toEmbedding2026-08-21
Equiv.Finset.congr_transFinset.equivOfEq_trans2026-08-29