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 / V33. Data structures and computation

Mathlib.Data.List.ProdSigma

10 declarations. Mathlib docs · Source

Lists in product and sigma types

This file proves basic properties of List.product and List.sigma, which are list constructions living in Prod and Sigma types respectively. Their definitions can be found in Data.List.Defs. Beware, this is not about List.prod, the multiplicative product.

product

sigma

Miscellaneous lemmas

theorem List.nil_product E0 #

∀ {α : Type u_1} {β : Type u_2} (l : List β), [] ×ˢ l = []

theorem List.product_cons E0 #

∀ {α : Type u_1} {β : Type u_2} (a : α) (l₁ : List α) (l₂ : List β),
  (a :: l₁) ×ˢ l₂ = List.map (fun b ↦ (a, b)) l₂ ++ l₁ ×ˢ l₂

theorem List.product_nil E0 #

∀ {α : Type u_1} {β : Type u_2} (l : List α), l ×ˢ [] = []

theorem List.mem_product E0 #

∀ {α : Type u_1} {β : Type u_2} {l₁ : List α} {l₂ : List β} {a : α} {b : β}, (a, b) ∈ l₁ ×ˢ l₂ ↔ a ∈ l₁ ∧ b ∈ l₂

theorem List.length_product E1 #

∀ {α : Type u_1} {β : Type u_2} (l₁ : List α) (l₂ : List β), (l₁ ×ˢ l₂).length = l₁.length * l₂.length

theorem List.nil_sigma E0 #

∀ {α : Type u_1} {σ : α → Type u_3} (l : (a : α) → List (σ a)), [].sigma l = []

theorem List.sigma_cons E0 #

∀ {α : Type u_1} {σ : α → Type u_3} (a : α) (l₁ : List α) (l₂ : (a : α) → List (σ a)),
  (a :: l₁).sigma l₂ = List.map (Sigma.mk a) (l₂ a) ++ l₁.sigma l₂

theorem List.sigma_nil E0 #

∀ {α : Type u_1} {σ : α → Type u_3} (l : List α), (l.sigma fun a ↦ []) = []

theorem List.mem_sigma E0 #

∀ {α : Type u_1} {σ : α → Type u_3} {l₁ : List α} {l₂ : (a : α) → List (σ a)} {a : α} {b : σ a},
  ⟨a, b⟩ ∈ l₁.sigma l₂ ↔ a ∈ l₁ ∧ b ∈ l₂ a

theorem List.mem_map_swap E0 #

∀ {α : Type u_1} {β : Type u_2} (x : α) (y : β) (xs : List (α × β)), (y, x) ∈ List.map Prod.swap xs ↔ (x, y) ∈ xs