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.Pi

33 declarations and 2 deprecated aliases. Mathlib docs · Source

The Cartesian product of finsets

Main definitions

  • Finset.pi: Cartesian product of finsets indexed by a finset.

pi

Diagonal

Restriction

theorem Finset.restrict₂.congr_simp E1 #

∀ {ι : Type u_2} {π : ι → Type u_3} {s t : Finset ι} (hst : s ⊆ t) (f f_1 : (i : ↥t) → π ↑i),
  f = f_1 → ∀ (i : ↥s), Finset.restrict₂ hst f i = Finset.restrict₂ hst f_1 i

def Finset.Pi.empty E1 #

{α : Type u_1} → (β : α → Sort u_2) → (a : α) → a ∈ ∅ → β a

The empty dependent product function, defined on the empty set. The assumption a ∈ ∅ is never satisfied.

def Finset.pi E3 #

{α : Type u_1} →
  {β : α → Type u} → [DecidableEq α] → (s : Finset α) → ((a : α) → Finset (β a)) → Finset ((a : α) → a ∈ s → β a)

Given a finset s of α and for all a : α a finset t a of β a, then one can define the finset s.pi t of all functions defined on elements of s taking values in t a for a ∈ s. Note that the elements of s.pi t are only partially defined, on s.

theorem Finset.pi_val E0 #

∀ {α : Type u_1} {β : α → Type u} [inst : DecidableEq α] (s : Finset α) (t : (a : α) → Finset (β a)),
  (s.pi t).val = s.val.pi fun a ↦ (t a).val

theorem Finset.mem_pi E0 #

∀ {α : Type u_1} {β : α → Type u} [inst : DecidableEq α] {s : Finset α} {t : (a : α) → Finset (β a)}
  {f : (a : α) → a ∈ s → β a}, f ∈ s.pi t ↔ ∀ (a : α) (h : a ∈ s), f a h ∈ t a

def Finset.Pi.cons E1 #

{α : Type u_1} →
  {δ : α → Sort v} →
    [inst : DecidableEq α] →
      (s : Finset α) → (a : α) → δ a → ((a : α) → a ∈ s → δ a) → (a' : α) → a' ∈ insert a s → δ a'

Given a function f defined on a finset s, define a new function on the finset s ∪ {a}, equal to f on s and sending a to a given value b. This function is denoted s.Pi.cons a b f. If a already belongs to s, the new function takes the value b at a anyway.

theorem Finset.Pi.cons_same E0 #

∀ {α : Type u_1} {δ : α → Sort v} [inst : DecidableEq α] (s : Finset α) (a : α) (b : δ a) (f : (a : α) → a ∈ s → δ a)
  (h : a ∈ insert a s), Finset.Pi.cons s a b f a h = b

theorem Finset.Pi.cons_ne E1 #

∀ {α : Type u_1} {δ : α → Sort v} [inst : DecidableEq α] {s : Finset α} {a a' : α} {b : δ a} {f : (a : α) → a ∈ s → δ a}
  {h : a' ∈ insert a s} (ha : a ≠ a'), Finset.Pi.cons s a b f a' h = f a' ⋯

theorem Finset.Pi.cons_injective E1 #

∀ {α : Type u_1} {δ : α → Sort v} [inst : DecidableEq α] {a : α} {b : δ a} {s : Finset α},
  a ∉ s → Function.Injective (Finset.Pi.cons s a b)

theorem Finset.pi_empty E0 #

∀ {α : Type u_1} {β : α → Type u} [inst : DecidableEq α] {t : (a : α) → Finset (β a)}, ∅.pi t = {Finset.Pi.empty β}

theorem Finset.pi_nonempty E0 #

∀ {α : Type u_1} {β : α → Type u} {s : Finset α} {t : (a : α) → Finset (β a)} [inst : DecidableEq α],
  (s.pi t).Nonempty ↔ ∀ a ∈ s, (t a).Nonempty

theorem Finset.pi_nonempty_of_forall_nonempty E1 #

∀ {α : Type u_1} {β : α → Type u} {s : Finset α} {t : (a : α) → Finset (β a)} [inst : DecidableEq α],
  (∀ a ∈ s, (t a).Nonempty) → (s.pi t).Nonempty

Alias of the reverse direction of Finset.pi_nonempty.

theorem Finset.pi_eq_empty E0 #

∀ {α : Type u_1} {β : α → Type u} {s : Finset α} {t : (a : α) → Finset (β a)} [inst : DecidableEq α],
  s.pi t = ∅ ↔ ∃ a ∈ s, t a = ∅

theorem Finset.pi_insert E0 #

∀ {α : Type u_1} {β : α → Type u} [inst : DecidableEq α] [inst_1 : (a : α) → DecidableEq (β a)] {s : Finset α}
  {t : (a : α) → Finset (β a)} {a : α},
  a ∉ s → (insert a s).pi t = (t a).biUnion fun b ↦ Finset.image (Finset.Pi.cons s a b) (s.pi t)

theorem Finset.pi_singletons E1 #

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

theorem Finset.pi_const_singleton E1 #

∀ {α : Type u_1} [inst : DecidableEq α] {β : Type u_2} (s : Finset α) (i : β), (s.pi fun x ↦ {i}) = {fun x x_1 ↦ i}

theorem Finset.pi_subset E1 #

∀ {α : Type u_1} {β : α → Type u} [inst : DecidableEq α] {s : Finset α} (t₁ t₂ : (a : α) → Finset (β a)),
  (∀ a ∈ s, t₁ a ⊆ t₂ a) → s.pi t₁ ⊆ s.pi t₂

theorem Finset.pi_disjoint_of_disjoint E1 #

∀ {α : Type u_1} [inst : DecidableEq α] {δ : α → Type u_2} {s : Finset α} (t₁ t₂ : (a : α) → Finset (δ a)) {a : α},
  a ∈ s → Disjoint (t₁ a) (t₂ a) → Disjoint (s.pi t₁) (s.pi t₂)

def Finset.piDiag E1 #

{α : Type u_1} → Finset α → (ι : Type u_3) → [DecidableEq (ι → α)] → Finset (ι → α)

The diagonal of a finset s : Finset α as a finset of functions ι → α, namely the set of constant functions valued in s.

theorem Finset.mem_piDiag E0 #

∀ {α : Type u_1} {ι : Type u_2} [inst : DecidableEq (ι → α)] {s : Finset α} {f : ι → α},
  f ∈ s.piDiag ι ↔ ∃ a ∈ s, Function.const ι a = f

theorem Finset.card_piDiag E0 #

∀ {α : Type u_1} (s : Finset α) (ι : Type u_3) [inst : DecidableEq (ι → α)] [Nonempty ι], (s.piDiag ι).card = s.card

def Finset.restrict E1 #

{ι : Type u_2} → {π : ι → Type u_3} → (s : Finset ι) → ((i : ι) → π i) → (i : ↥s) → π ↑i

Restrict domain of a function f to a finite set s.

theorem Finset.restrict_def E0 #

∀ {ι : Type u_2} {π : ι → Type u_3} (s : Finset ι), s.restrict = fun f x ↦ f ↑x

theorem Set.piCongrLeft_comp_domRestrict E1 #

∀ {ι : Type u_2} {π : ι → Type u_3} {s : Finset ι},
  ⇑(Equiv.piCongrLeft (fun i ↦ π ↑i) s.equivToSet.symm) ∘ (↑s).domRestrict = s.restrict

theorem Finset.piCongrLeft_comp_restrict E1 #

∀ {ι : Type u_2} {π : ι → Type u_3} {s : Finset ι},
  ⇑(Equiv.piCongrLeft (fun i ↦ π ↑i) s.equivToSet) ∘ s.restrict = (↑s).domRestrict

def Finset.restrict₂ E1 #

{ι : Type u_2} → {π : ι → Type u_3} → {s t : Finset ι} → s ⊆ t → ((i : ↥t) → π ↑i) → (i : ↥s) → π ↑i

If a function f is restricted to a finite set t, and s ⊆ t, this is the restriction to s.

theorem Finset.restrict₂_def E0 #

∀ {ι : Type u_2} {π : ι → Type u_3} {s t : Finset ι} (hst : s ⊆ t), Finset.restrict₂ hst = fun f x ↦ f ⟨↑x, ⋯⟩

theorem Finset.restrict₂_comp_restrict E1 #

∀ {ι : Type u_2} {π : ι → Type u_3} {s t : Finset ι} (hst : s ⊆ t), Finset.restrict₂ hst ∘ t.restrict = s.restrict

theorem Finset.restrict₂_comp_restrict₂ E1 #

∀ {ι : Type u_2} {π : ι → Type u_3} {s t u : Finset ι} (hst : s ⊆ t) (htu : t ⊆ u),
  Finset.restrict₂ hst ∘ Finset.restrict₂ htu = Finset.restrict₂ ⋯

theorem Finset.dependsOn_restrict E1 #

∀ {ι : Type u_2} {π : ι → Type u_3} (s : Finset ι), DependsOn s.restrict ↑s

theorem Finset.restrict_preimage_univ E1 #

∀ {ι : Type u_2} {π : ι → Type u_3} {s : Finset ι} [inst : DecidablePred fun x ↦ x ∈ s] (t : (i : ↥s) → Set (π ↑i)),
  s.restrict ⁻¹' Set.univ.pi t = (↑s).pi fun i ↦ if h : i ∈ s then t ⟨i, h⟩ else Set.univ

theorem Finset.domRestrict_preimage E1 #

∀ {ι : Type u_2} {π : ι → Type u_3} [inst : DecidableEq ι] {I : Set ι} [inst_1 : DecidablePred fun x ↦ x ∈ I]
  (s : Finset ↑I) (u : (i : ↑I) → Set (π ↑i)),
  I.domRestrict ⁻¹' (↑s).pi u = (↑(Finset.image Subtype.val s)).pi fun i ↦ if h : i ∈ I then u ⟨i, h⟩ else Set.univ

theorem Finset.restrict₂_preimage E1 #

∀ {ι : Type u_2} {π : ι → Type u_3} {s t : Finset ι} [inst : DecidablePred fun x ↦ x ∈ s] (hst : s ⊆ t)
  (u : (i : ↥s) → Set (π ↑i)),
  Finset.restrict₂ hst ⁻¹' Set.univ.pi u = Set.univ.pi fun j ↦ if h : ↑j ∈ s then u ⟨↑j, h⟩ else Set.univ

Deprecated aliases

NameNew nameSince
Finset.restrict_preimageFinset.domRestrict_preimage2026-07-19
Set.piCongrLeft_comp_restrictSet.piCongrLeft_comp_domRestrict2026-07-19