File: Mathlib/Data/Finset/Preimage.lean

full_name: Finset.preimage
code: /-- Preimage of `s : Finset β` under a map `f` injective on `f ⁻¹' s` as a `Finset`.  -/
noncomputable def preimage (s : Finset β) (f : α → β) (hf : Set.InjOn f (f ⁻¹' ↑s)) : Finset α 
goal: Finset α

full_name: Finset.mem_preimage
code: @[simp]
theorem mem_preimage {f : α → β} {s : Finset β} {hf : Set.InjOn f (f ⁻¹' ↑s)} {x : α} :
    x ∈ preimage s f hf ↔ f x ∈ s 
goal: x ∈ s.preimage f hf ↔ f x ∈ s

full_name: Finset.coe_preimage
code: @[simp, norm_cast]
theorem coe_preimage {f : α → β} (s : Finset β) (hf : Set.InjOn f (f ⁻¹' ↑s)) :
    (↑(preimage s f hf) : Set α) = f ⁻¹' ↑s 
goal: ↑(s.preimage f hf) = f ⁻¹' ↑s

full_name: Finset.preimage_empty
code: @[simp]
theorem preimage_empty {f : α → β} : preimage ∅ f (by simp [InjOn]) = ∅ 
goal: ∅.preimage f ⋯ = ∅

full_name: Finset.preimage_univ
code: @[simp]
theorem preimage_univ {f : α → β} [Fintype α] [Fintype β] (hf) : preimage univ f hf = univ 
goal: Finset.univ.preimage f hf = Finset.univ

full_name: Finset.preimage_inter
code: @[simp]
theorem preimage_inter [DecidableEq α] [DecidableEq β] {f : α → β} {s t : Finset β}
    (hs : Set.InjOn f (f ⁻¹' ↑s)) (ht : Set.InjOn f (f ⁻¹' ↑t)) :
    (preimage (s ∩ t) f fun x₁ hx₁ x₂ hx₂ =>
        hs (mem_of_mem_inter_left hx₁) (mem_of_mem_inter_left hx₂)) =
      preimage s f hs ∩ preimage t f ht 
goal: (s ∩ t).preimage f ⋯ = s.preimage f hs ∩ t.preimage f ht

full_name: Finset.preimage_union
code: @[simp]
theorem preimage_union [DecidableEq α] [DecidableEq β] {f : α → β} {s t : Finset β} (hst) :
    preimage (s ∪ t) f hst =
      (preimage s f fun x₁ hx₁ x₂ hx₂ => hst (mem_union_left _ hx₁) (mem_union_left _ hx₂)) ∪
        preimage t f fun x₁ hx₁ x₂ hx₂ => hst (mem_union_right _ hx₁) (mem_union_right _ hx₂) 
goal: (s ∪ t).preimage f hst = s.preimage f ⋯ ∪ t.preimage f ⋯

full_name: Finset.preimage_compl
code: @[simp, nolint simpNF] -- Porting note: linter complains that LHS doesn't simplify
theorem preimage_compl [DecidableEq α] [DecidableEq β] [Fintype α] [Fintype β] {f : α → β}
    (s : Finset β) (hf : Function.Injective f) :
    preimage sᶜ f hf.injOn = (preimage s f hf.injOn)ᶜ 
goal: sᶜ.preimage f ⋯ = (s.preimage f ⋯)ᶜ

full_name: Finset.preimage_map
code: @[simp]
lemma preimage_map (f : α ↪ β) (s : Finset α) : (s.map f).preimage f f.injective.injOn = s 
goal: (Finset.map f s).preimage ⇑f ⋯ = s

full_name: Finset.monotone_preimage
code: theorem monotone_preimage {f : α → β} (h : Injective f) :
    Monotone fun s => preimage s f h.injOn 
goal: Monotone fun s => s.preimage f ⋯

full_name: Finset.image_subset_iff_subset_preimage
code: theorem image_subset_iff_subset_preimage [DecidableEq β] {f : α → β} {s : Finset α} {t : Finset β}
    (hf : Set.InjOn f (f ⁻¹' ↑t)) : s.image f ⊆ t ↔ s ⊆ t.preimage f hf 
goal: Finset.image f s ⊆ t ↔ s ⊆ t.preimage f hf

full_name: Finset.map_subset_iff_subset_preimage
code: theorem map_subset_iff_subset_preimage {f : α ↪ β} {s : Finset α} {t : Finset β} :
    s.map f ⊆ t ↔ s ⊆ t.preimage f f.injective.injOn 
goal: Finset.map f s ⊆ t ↔ s ⊆ t.preimage ⇑f ⋯

full_name: Finset.image_preimage
code: theorem image_preimage [DecidableEq β] (f : α → β) (s : Finset β) [∀ x, Decidable (x ∈ Set.range f)]
    (hf : Set.InjOn f (f ⁻¹' ↑s)) : image f (preimage s f hf) = s.filter fun x => x ∈ Set.range f 
goal: Finset.image f (s.preimage f hf) = Finset.filter (fun x => x ∈ Set.range f) s

full_name: Finset.image_preimage_of_bij
code: theorem image_preimage_of_bij [DecidableEq β] (f : α → β) (s : Finset β)
    (hf : Set.BijOn f (f ⁻¹' ↑s) ↑s) : image f (preimage s f hf.injOn) = s 
goal: Finset.image f (s.preimage f ⋯) = s

full_name: Finset.preimage_subset
code: theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s ⊆ t.map f) :
    s.preimage f f.injective.injOn ⊆ t 
goal: s.preimage ⇑f ⋯ ⊆ t

full_name: Finset.subset_map_iff
code: theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
    s ⊆ t.map f ↔ ∃ u ⊆ t, s = u.map f 
goal: s ⊆ Finset.map f t ↔ ∃ u ⊆ t, s = Finset.map f u

full_name: Finset.sigma_preimage_mk
code: theorem sigma_preimage_mk {β : α → Type*} [DecidableEq α] (s : Finset (Σa, β a)) (t : Finset α) :
    (t.sigma fun a => s.preimage (Sigma.mk a) sigma_mk_injective.injOn) =
      s.filter fun a => a.1 ∈ t 
goal: (t.sigma fun a => s.preimage (Sigma.mk a) ⋯) = Finset.filter (fun a => a.fst ∈ t) s

full_name: Finset.sigma_preimage_mk_of_subset
code: theorem sigma_preimage_mk_of_subset {β : α → Type*} [DecidableEq α] (s : Finset (Σa, β a))
    {t : Finset α} (ht : s.image Sigma.fst ⊆ t) :
    (t.sigma fun a => s.preimage (Sigma.mk a) sigma_mk_injective.injOn) = s 
goal: (t.sigma fun a => s.preimage (Sigma.mk a) ⋯) = s

full_name: Finset.sigma_image_fst_preimage_mk
code: theorem sigma_image_fst_preimage_mk {β : α → Type*} [DecidableEq α] (s : Finset (Σa, β a)) :
    ((s.image Sigma.fst).sigma fun a => s.preimage (Sigma.mk a) sigma_mk_injective.injOn) =
      s 
goal: ((Finset.image Sigma.fst s).sigma fun a => s.preimage (Sigma.mk a) ⋯) = s