doc-next-gen

Mathlib.Data.Finset.Preimage

Module docstring

{"# Preimage of a Finset under an injective map. "}

Finset.preimage definition
(s : Finset β) (f : α → β) (hf : Set.InjOn f (f ⁻¹' ↑s)) : Finset α
Full source
/-- 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 α :=
  (s.finite_toSet.preimage hf).toFinset
Preimage of a finset under an injective map
Informal description
Given a finset $s$ of type $\beta$ and a function $f : \alpha \to \beta$ that is injective on the preimage $f^{-1}(s)$, the preimage of $s$ under $f$ is a finset of type $\alpha$ consisting of all elements $x$ such that $f(x) \in s$.
Finset.mem_preimage theorem
{f : α → β} {s : Finset β} {hf : Set.InjOn f (f ⁻¹' ↑s)} {x : α} : x ∈ preimage s f hf ↔ f x ∈ s
Full source
@[simp]
theorem mem_preimage {f : α → β} {s : Finset β} {hf : Set.InjOn f (f ⁻¹' ↑s)} {x : α} :
    x ∈ preimage s f hfx ∈ preimage s f hf ↔ f x ∈ s :=
  Set.Finite.mem_toFinset _
Membership in Preimage Finset under Injective Map: $x \in f^{-1}(s) \leftrightarrow f(x) \in s$
Informal description
For any function $f : \alpha \to \beta$, any finset $s$ of type $\beta$, and any element $x \in \alpha$, if $f$ is injective on the preimage $f^{-1}(s)$, then $x$ belongs to the preimage finset of $s$ under $f$ if and only if $f(x) \in s$.
Finset.coe_preimage theorem
{f : α → β} (s : Finset β) (hf : Set.InjOn f (f ⁻¹' ↑s)) : (↑(preimage s f hf) : Set α) = f ⁻¹' ↑s
Full source
@[simp, norm_cast]
theorem coe_preimage {f : α → β} (s : Finset β) (hf : Set.InjOn f (f ⁻¹' ↑s)) :
    (↑(preimage s f hf) : Set α) = f ⁻¹' ↑s :=
  Set.Finite.coe_toFinset _
Finset Preimage Equals Set Preimage under Injectivity
Informal description
For any function $f : \alpha \to \beta$ and finset $s \subseteq \beta$, if $f$ is injective on the preimage $f^{-1}(s)$, then the underlying set of the finset preimage of $s$ under $f$ is equal to the set preimage of $s$ under $f$. That is, $$ \text{preimage}(s, f, hf) = f^{-1}(s) $$ where $\text{preimage}(s, f, hf)$ denotes the finset preimage and $f^{-1}(s)$ denotes the set preimage.
Finset.preimage_empty theorem
{f : α → β} : preimage ∅ f (by simp [InjOn]) = ∅
Full source
@[simp]
theorem preimage_empty {f : α → β} : preimage  f (by simp [InjOn]) =  :=
  Finset.coe_injective (by simp)
Preimage of Empty Finset is Empty
Informal description
For any function $f : \alpha \to \beta$, the preimage of the empty finset under $f$ is the empty finset, i.e., $f^{-1}(\emptyset) = \emptyset$.
Finset.preimage_univ theorem
{f : α → β} [Fintype α] [Fintype β] (hf) : preimage univ f hf = univ
Full source
@[simp]
theorem preimage_univ {f : α → β} [Fintype α] [Fintype β] (hf) : preimage univ f hf = univ :=
  Finset.coe_injective (by simp)
Preimage of Universal Finset under Injective Map is Universal Finset
Informal description
Let $\alpha$ and $\beta$ be finite types, and let $f : \alpha \to \beta$ be a function that is injective on the preimage $f^{-1}(\text{univ})$, where $\text{univ}$ denotes the universal finset containing all elements of $\beta$. Then the preimage of $\text{univ}$ under $f$ is equal to the universal finset of $\alpha$, i.e., $$ f^{-1}(\text{univ}) = \text{univ}. $$
Finset.preimage_inter theorem
[DecidableEq α] [DecidableEq β] {f : α → β} {s t : Finset β} (hs : Set.InjOn f (f ⁻¹' ↑s)) (ht : Set.InjOn f (f ⁻¹' ↑t)) : (preimage (s ∩ t) f fun _ hx₁ _ hx₂ => hs (mem_of_mem_inter_left hx₁) (mem_of_mem_inter_left hx₂)) = preimage s f hs ∩ preimage t f ht
Full source
@[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 _ hx₁ _ hx₂ =>
        hs (mem_of_mem_inter_left hx₁) (mem_of_mem_inter_left hx₂)) =
      preimagepreimage s f hs ∩ preimage t f ht :=
  Finset.coe_injective (by simp)
Preimage of Finite Set Intersection under Injective Function
Informal description
Let $\alpha$ and $\beta$ be types with decidable equality, and let $f : \alpha \to \beta$ be a function. For any finite sets $s, t \subseteq \beta$, if $f$ is injective on the preimages $f^{-1}(s)$ and $f^{-1}(t)$, then the preimage of the intersection $s \cap t$ under $f$ is equal to the intersection of the preimages of $s$ and $t$ under $f$. That is, $$ f^{-1}(s \cap t) = f^{-1}(s) \cap f^{-1}(t). $$
Finset.preimage_union theorem
[DecidableEq α] [DecidableEq β] {f : α → β} {s t : Finset β} (hst) : preimage (s ∪ t) f hst = (preimage s f fun _ hx₁ _ hx₂ => hst (mem_union_left _ hx₁) (mem_union_left _ hx₂)) ∪ preimage t f fun _ hx₁ _ hx₂ => hst (mem_union_right _ hx₁) (mem_union_right _ hx₂)
Full source
@[simp]
theorem preimage_union [DecidableEq α] [DecidableEq β] {f : α → β} {s t : Finset β} (hst) :
    preimage (s ∪ t) f hst =
      (preimage s f fun _ hx₁ _ hx₂ => hst (mem_union_left _ hx₁) (mem_union_left _ hx₂)) ∪
        preimage t f fun _ hx₁ _ hx₂ => hst (mem_union_right _ hx₁) (mem_union_right _ hx₂) :=
  Finset.coe_injective (by simp)
Preimage of Union under Injective Function: $f^{-1}(s \cup t) = f^{-1}(s) \cup f^{-1}(t)$
Informal description
Let $\alpha$ and $\beta$ be types with decidable equality, and let $f : \alpha \to \beta$ be a function. For any finite sets $s, t \subseteq \beta$, if $f$ is injective on the preimage $f^{-1}(s \cup t)$, then the preimage of the union $s \cup t$ under $f$ is equal to the union of the preimages of $s$ and $t$ under $f$. That is, $$ f^{-1}(s \cup t) = f^{-1}(s) \cup f^{-1}(t) $$ where $f^{-1}$ denotes the finset preimage operation.
Finset.preimage_compl' theorem
[DecidableEq α] [DecidableEq β] [Fintype α] [Fintype β] {f : α → β} (s : Finset β) (hfc : InjOn f (f ⁻¹' ↑sᶜ)) (hf : InjOn f (f ⁻¹' ↑s)) : preimage sᶜ f hfc = (preimage s f hf)ᶜ
Full source
@[simp]
theorem preimage_compl' [DecidableEq α] [DecidableEq β] [Fintype α] [Fintype β] {f : α → β}
    (s : Finset β) (hfc : InjOn f (f ⁻¹' ↑sᶜ)) (hf : InjOn f (f ⁻¹' ↑s)) :
    preimage sᶜ f hfc = (preimage s f hf)ᶜ :=
  Finset.coe_injective (by simp)
Complement of Preimage Equals Preimage of Complement under Injectivity
Informal description
Let $\alpha$ and $\beta$ be finite types with decidable equality, and let $f : \alpha \to \beta$ be a function. For any finset $s \subseteq \beta$, if $f$ is injective on both the preimage $f^{-1}(s)$ and the preimage $f^{-1}(s^c)$, then the preimage of the complement $s^c$ under $f$ is equal to the complement of the preimage of $s$ under $f$. That is, $$ \text{preimage}(s^c, f, h_{fc}) = (\text{preimage}(s, f, h_f))^c. $$
Finset.preimage_compl theorem
[DecidableEq α] [DecidableEq β] [Fintype α] [Fintype β] {f : α → β} (s : Finset β) (hf : Function.Injective f) : preimage sᶜ f hf.injOn = (preimage s f hf.injOn)ᶜ
Full source
theorem preimage_compl [DecidableEq α] [DecidableEq β] [Fintype α] [Fintype β] {f : α → β}
    (s : Finset β) (hf : Function.Injective f) :
    preimage sᶜ f hf.injOn = (preimage s f hf.injOn)ᶜ :=
  preimage_compl' _ _ _
Preimage of Complement Equals Complement of Preimage for Injective Functions
Informal description
Let $\alpha$ and $\beta$ be finite types with decidable equality, and let $f : \alpha \to \beta$ be an injective function. For any finset $s \subseteq \beta$, the preimage of the complement $s^c$ under $f$ is equal to the complement of the preimage of $s$ under $f$. That is, $$ f^{-1}(s^c) = (f^{-1}(s))^c. $$
Finset.preimage_map theorem
(f : α ↪ β) (s : Finset α) : (s.map f).preimage f f.injective.injOn = s
Full source
@[simp]
lemma preimage_map (f : α ↪ β) (s : Finset α) : (s.map f).preimage f f.injective.injOn = s :=
  coe_injective <| by simp only [coe_preimage, coe_map, Set.preimage_image_eq _ f.injective]
Preimage-Image Equality for Injective Embeddings on Finsets: $f^{-1}(f[s]) = s$
Informal description
Let $f \colon \alpha \hookrightarrow \beta$ be an injective function embedding and let $s$ be a finset in $\alpha$. Then the preimage of the image of $s$ under $f$ is equal to $s$ itself, i.e., $$ f^{-1}(f[s]) = s. $$
Finset.monotone_preimage theorem
{f : α → β} (h : Injective f) : Monotone fun s => preimage s f h.injOn
Full source
theorem monotone_preimage {f : α → β} (h : Injective f) :
    Monotone fun s => preimage s f h.injOn := fun _ _ H _ hx =>
  mem_preimage.2 (H <| mem_preimage.1 hx)
Monotonicity of Preimage under Injective Function: $s_1 \subseteq s_2 \implies f^{-1}(s_1) \subseteq f^{-1}(s_2)$
Informal description
For any injective function $f : \alpha \to \beta$, the preimage operation $s \mapsto f^{-1}(s)$ is monotone with respect to the subset relation on finsets. That is, for any finsets $s_1, s_2 \subseteq \beta$, if $s_1 \subseteq s_2$, then $f^{-1}(s_1) \subseteq f^{-1}(s_2)$.
Finset.image_subset_iff_subset_preimage theorem
[DecidableEq β] {f : α → β} {s : Finset α} {t : Finset β} (hf : Set.InjOn f (f ⁻¹' ↑t)) : s.image f ⊆ t ↔ s ⊆ t.preimage f hf
Full source
theorem image_subset_iff_subset_preimage [DecidableEq β] {f : α → β} {s : Finset α} {t : Finset β}
    (hf : Set.InjOn f (f ⁻¹' ↑t)) : s.image f ⊆ ts.image f ⊆ t ↔ s ⊆ t.preimage f hf :=
  image_subset_iff.trans <| by simp only [subset_iff, mem_preimage]
Image-Preimage Subset Equivalence for Injective Functions on Finsets
Informal description
Let $f : \alpha \to \beta$ be a function that is injective on the preimage $f^{-1}(t)$, where $t$ is a finset of type $\beta$. For any finset $s$ of type $\alpha$, the image of $s$ under $f$ is a subset of $t$ if and only if $s$ is a subset of the preimage of $t$ under $f$. In symbols: \[ f[s] \subseteq t \leftrightarrow s \subseteq f^{-1}(t) \] where $f[s]$ denotes the image of $s$ under $f$ and $f^{-1}(t)$ is the preimage of $t$ under $f$.
Finset.map_subset_iff_subset_preimage theorem
{f : α ↪ β} {s : Finset α} {t : Finset β} : s.map f ⊆ t ↔ s ⊆ t.preimage f f.injective.injOn
Full source
theorem map_subset_iff_subset_preimage {f : α ↪ β} {s : Finset α} {t : Finset β} :
    s.map f ⊆ ts.map f ⊆ t ↔ s ⊆ t.preimage f f.injective.injOn := by
  classical rw [map_eq_image, image_subset_iff_subset_preimage]
Image-Preimage Subset Equivalence for Injective Embeddings on Finsets
Informal description
Let $f \colon \alpha \hookrightarrow \beta$ be an injective function embedding, and let $s$ and $t$ be finsets in $\alpha$ and $\beta$ respectively. The image of $s$ under $f$ is a subset of $t$ if and only if $s$ is a subset of the preimage of $t$ under $f$. In symbols: \[ f[s] \subseteq t \leftrightarrow s \subseteq f^{-1}(t) \] where $f[s]$ denotes the image of $s$ under $f$ and $f^{-1}(t)$ is the preimage of $t$ under $f$.
Finset.card_preimage theorem
(s : Finset β) (f : α → β) (hf) [DecidablePred (· ∈ Set.range f)] : (s.preimage f hf).card = {x ∈ s | x ∈ Set.range f}.card
Full source
lemma card_preimage (s : Finset β) (f : α → β) (hf) [DecidablePred (· ∈ Set.range f)] :
    (s.preimage f hf).card = {x ∈ s | x ∈ Set.range f}.card :=
  card_nbij f (by simp) (by simpa) (fun b hb ↦ by aesop)
Cardinality of Preimage Equals Cardinality of Range Intersection
Informal description
For any finset $s$ of type $\beta$ and function $f : \alpha \to \beta$ that is injective on the preimage $f^{-1}(s)$, the cardinality of the finset preimage of $s$ under $f$ is equal to the cardinality of the subset of $s$ consisting of elements in the range of $f$. In symbols: $$ |f^{-1}(s)| = |\{x \in s \mid x \in \text{range}(f)\}| $$ where $f^{-1}(s)$ denotes the finset preimage and $\text{range}(f)$ is the range of $f$.
Finset.image_preimage theorem
[DecidableEq β] (f : α → β) (s : Finset β) [∀ x, Decidable (x ∈ Set.range f)] (hf : Set.InjOn f (f ⁻¹' ↑s)) : image f (preimage s f hf) = {x ∈ s | x ∈ Set.range f}
Full source
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) = {x ∈ s | x ∈ Set.range f} :=
  Finset.coe_inj.1 <| by
    simp only [coe_image, coe_preimage, coe_filter, Set.image_preimage_eq_inter_range,
      ← Set.sep_mem_eq]; rfl
Image of Preimage Equals Range Intersection for Finsets under Injective Map
Informal description
Let $f : \alpha \to \beta$ be a function and $s$ be a finset in $\beta$. If $f$ is injective on the preimage $f^{-1}(s)$, then the image of the finset preimage of $s$ under $f$ equals the subset of $s$ consisting of elements in the range of $f$. In symbols: $$ f(f^{-1}(s)) = \{x \in s \mid x \in \text{range}(f)\} $$ where $f^{-1}(s)$ denotes the finset preimage and $\text{range}(f)$ is the range of $f$.
Finset.image_preimage_of_bij theorem
[DecidableEq β] (f : α → β) (s : Finset β) (hf : Set.BijOn f (f ⁻¹' ↑s) ↑s) : image f (preimage s f hf.injOn) = s
Full source
theorem image_preimage_of_bij [DecidableEq β] (f : α → β) (s : Finset β)
    (hf : Set.BijOn f (f ⁻¹' ↑s) ↑s) : image f (preimage s f hf.injOn) = s :=
  Finset.coe_inj.1 <| by simpa using hf.image_eq
Image of Preimage Equals Original Set under Bijective Map
Informal description
Let $f : \alpha \to \beta$ be a function and $s$ be a finite subset of $\beta$. If $f$ is bijective from the set preimage $f^{-1}(s)$ to $s$, then the image of the finset preimage of $s$ under $f$ equals $s$. In symbols: $$ f(f^{-1}(s)) = s $$ where $f^{-1}(s)$ denotes the finset preimage of $s$ under $f$.
Finset.preimage_subset_of_subset_image theorem
[DecidableEq β] {f : α → β} {s : Finset β} {t : Finset α} (hs : s ⊆ t.image f) {hf} : s.preimage f hf ⊆ t
Full source
lemma preimage_subset_of_subset_image [DecidableEq β] {f : α → β} {s : Finset β} {t : Finset α}
    (hs : s ⊆ t.image f) {hf} : s.preimage f hf ⊆ t := by
  rw [← coe_subset, coe_preimage]; exact Set.preimage_subset (mod_cast hs) hf
Preimage of Subset under Function is Contained in Original Set when Subset is in Image
Informal description
Let $f : \alpha \to \beta$ be a function, $s$ be a finite subset of $\beta$, and $t$ be a finite subset of $\alpha$. If $s$ is a subset of the image of $t$ under $f$ (i.e., $s \subseteq f(t)$), then the preimage of $s$ under $f$ is a subset of $t$ (i.e., $f^{-1}(s) \subseteq t$).
Finset.preimage_subset theorem
{f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s ⊆ t.map f) : s.preimage f f.injective.injOn ⊆ t
Full source
theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s ⊆ t.map f) :
    s.preimage f f.injective.injOn ⊆ t := fun _ h => (mem_map' f).1 (hs (mem_preimage.1 h))
Preimage of Subset under Injective Map is Contained in Original Set
Informal description
For any injective function embedding $f \colon \alpha \hookrightarrow \beta$, any finite subset $s \subseteq \beta$, and any finite subset $t \subseteq \alpha$, if $s$ is contained in the image of $t$ under $f$, then the preimage of $s$ under $f$ is contained in $t$. In other words: $$ s \subseteq f(t) \implies f^{-1}(s) \subseteq t. $$
Finset.subset_map_iff theorem
{f : α ↪ β} {s : Finset β} {t : Finset α} : s ⊆ t.map f ↔ ∃ u ⊆ t, s = u.map f
Full source
theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
    s ⊆ t.map fs ⊆ t.map f ↔ ∃ u ⊆ t, s = u.map f := by
  classical
  simp_rw [map_eq_image, subset_image_iff, eq_comm]
Characterization of Subset Inclusion under Injective Map via Preimage
Informal description
For any injective function embedding $f : \alpha \hookrightarrow \beta$, a finite set $s \subseteq \beta$ is contained in the image of a finite set $t \subseteq \alpha$ under $f$ if and only if there exists a finite subset $u \subseteq t$ such that $s$ is equal to the image of $u$ under $f$. In other words: $$ s \subseteq f(t) \leftrightarrow \exists u \subseteq t, s = f(u). $$
Finset.sigma_preimage_mk theorem
{β : α → Type*} [DecidableEq α] (s : Finset (Σ a, β a)) (t : Finset α) : t.sigma (fun a => s.preimage (Sigma.mk a) sigma_mk_injective.injOn) = {a ∈ s | a.1 ∈ t}
Full source
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) = {a ∈ s | a.1 ∈ t} := by
  ext x
  simp [and_comm]
Preimage Decomposition for Dependent Pairs over Finite Sets
Informal description
For any finite set $s$ of dependent pairs $(a, b)$ where $a \in \alpha$ and $b \in \beta(a)$, and any finite set $t \subseteq \alpha$, the dependent product of $t$ with the preimages of $s$ under the injection $\Sigma.\text{mk}_a$ (for each $a \in t$) is equal to the subset of $s$ consisting of pairs whose first component is in $t$. That is: $$ \Sigma_{a \in t} \left( s \cap \{(a, b) \mid b \in \beta(a)\} \right) = \{(a, b) \in s \mid a \in t\}. $$
Finset.sigma_preimage_mk_of_subset theorem
{β : α → 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
Full source
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 := by
  rw [sigma_preimage_mk, filter_true_of_mem <| image_subset_iff.1 ht]
Preimage Decomposition for Dependent Pairs under Subset Condition
Informal description
Let $\alpha$ be a type with decidable equality, $\beta : \alpha \to \text{Type}^*$, and $s$ be a finite set of dependent pairs $(a, b)$ where $a \in \alpha$ and $b \in \beta(a)$. For any finite subset $t \subseteq \alpha$ such that the projection of $s$ onto its first components is contained in $t$, the dependent product of $t$ with the preimages of $s$ under the injective maps $\Sigma.\text{mk}_a$ (for each $a \in t$) equals $s$. That is: $$ \Sigma_{a \in t} \left( f^{-1}(s) \cap \{(a, b) \mid b \in \beta(a)\} \right) = s $$ where $f = \Sigma.\text{mk}_a$ is injective for each fixed $a$.
Finset.sigma_image_fst_preimage_mk theorem
{β : α → Type*} [DecidableEq α] (s : Finset (Σ a, β a)) : ((s.image Sigma.fst).sigma fun a => s.preimage (Sigma.mk a) sigma_mk_injective.injOn) = s
Full source
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 :=
  s.sigma_preimage_mk_of_subset (Subset.refl _)
Decomposition of Finite Set of Dependent Pairs via Projection and Preimage
Informal description
Let $\alpha$ be a type with decidable equality and $\beta : \alpha \to \text{Type}^*$. For any finite set $s$ of dependent pairs $(a, b)$ where $a \in \alpha$ and $b \in \beta(a)$, the dependent product of the projection of $s$ onto its first components with the preimages of $s$ under the injective maps $\Sigma.\text{mk}_a$ (for each $a$ in the projection) equals $s$. That is: $$ \Sigma_{a \in \pi_1(s)} \left( (\Sigma.\text{mk}_a)^{-1}(s) \right) = s $$ where $\pi_1(s)$ denotes the finite set of first components of pairs in $s$, and $\Sigma.\text{mk}_a$ is injective for each fixed $a$.
Finset.preimage_inl theorem
(s : Finset (α ⊕ β)) : s.preimage Sum.inl Sum.inl_injective.injOn = s.toLeft
Full source
@[simp] lemma preimage_inl (s : Finset (α ⊕ β)) :
    s.preimage Sum.inl Sum.inl_injective.injOn = s.toLeft := by
  ext x; simp
Preimage of Left Injection Equals Left Projection
Informal description
For any finset $s$ of type $\alpha \oplus \beta$, the preimage of $s$ under the left injection function $\mathrm{inl} : \alpha \to \alpha \oplus \beta$ (which is injective) is equal to the left projection $s_{\mathrm{left}}$ of $s$.
Finset.preimage_inr theorem
(s : Finset (α ⊕ β)) : s.preimage Sum.inr Sum.inr_injective.injOn = s.toRight
Full source
@[simp] lemma preimage_inr (s : Finset (α ⊕ β)) :
    s.preimage Sum.inr Sum.inr_injective.injOn = s.toRight := by
  ext x; simp
Preimage of Finset under Right Inclusion Equals Right Projection
Informal description
For any finset $s$ of type $\alpha \oplus \beta$, the preimage of $s$ under the right inclusion map $\operatorname{inr} : \beta \to \alpha \oplus \beta$ (which is injective) is equal to the right projection of $s$, i.e., $\operatorname{inr}^{-1}(s) = s_{\mathrm{right}}$.
Equiv.restrictPreimageFinset definition
(e : α ≃ β) (s : Finset β) : (s.preimage e e.injective.injOn) ≃ s
Full source
/-- Given an equivalence `e : α ≃ β` and `s : Finset β`, restrict `e` to an equivalence
from `e ⁻¹' s` to `s`. -/
@[simps]
def restrictPreimageFinset (e : α ≃ β) (s : Finset β) : (s.preimage e e.injective.injOn) ≃ s where
  toFun a := ⟨e a, Finset.mem_preimage.1 a.2⟩
  invFun b := ⟨e.symm b, by simp⟩
  left_inv _ := by simp
  right_inv _ := by simp
Restriction of equivalence to preimage finset
Informal description
Given an equivalence $e : \alpha \simeq \beta$ and a finset $s$ of type $\beta$, the function restricts $e$ to an equivalence between the preimage $e^{-1}(s)$ (as a finset) and $s$. Specifically, it maps each element $a$ in the preimage finset to $\langle e(a), \text{proof that } e(a) \in s \rangle$, and its inverse maps each $b \in s$ to $\langle e^{-1}(b), \text{proof that } e^{-1}(b) \in e^{-1}(s) \rangle$.
Finset.restrict_comp_piCongrLeft theorem
{π : β → Type*} (s : Finset β) (e : α ≃ β) : s.restrict ∘ ⇑(e.piCongrLeft π) = ⇑((e.restrictPreimageFinset s).piCongrLeft (fun b : s ↦ (π b))) ∘ (s.preimage e e.injective.injOn).restrict
Full source
/-- Reindexing and then restricting to a `Finset` is the same as first restricting to the preimage
of this `Finset` and then reindexing. -/
lemma Finset.restrict_comp_piCongrLeft {π : β → Type*} (s : Finset β) (e : α ≃ β) :
    s.restrict ∘ ⇑(e.piCongrLeft π) =
    ⇑((e.restrictPreimageFinset s).piCongrLeft (fun b : s ↦ (π b))) ∘
    (s.preimage e e.injective.injOn).restrict := by
  ext x b
  simp only [comp_apply, restrict, Equiv.piCongrLeft_apply_eq_cast, cast_inj,
    Equiv.restrictPreimageFinset_symm_apply_coe]
Commutativity of Restriction and Equivalence-Transported Function Composition
Informal description
Let $\pi : \beta \to \text{Type}$ be a family of types, $s$ a finset of $\beta$, and $e : \alpha \simeq \beta$ an equivalence. Then the composition of the restriction map $s.\text{restrict}$ with the equivalence-transported function $e.\text{piCongrLeft}\, \pi$ is equal to the composition of the equivalence-transported function $(e.\text{restrictPreimageFinset}\, s).\text{piCongrLeft}\, (\lambda b : s, \pi b)$ with the restriction map $(s.\text{preimage}\, e\, e.\text{injective.injOn}).\text{restrict}$. In other words, the following diagram commutes: \[ \begin{CD} (\forall a, \pi(e\, a)) @>{e.\text{piCongrLeft}\, \pi}>> (\forall b, \pi b) \\ @V{(s.\text{preimage}\, e\, e.\text{injective.injOn}).\text{restrict}}VV @VV{s.\text{restrict}}V \\ (\forall a \in e^{-1}(s), \pi(e\, a)) @>{(e.\text{restrictPreimageFinset}\, s).\text{piCongrLeft}\, (\lambda b : s, \pi b)}>> (\forall b \in s, \pi b) \end{CD} \]