The areas / V33. Data structures and computation
Mathlib.Data.List.Lemmas
13 declarations and 1 deprecated aliases. Mathlib docs · Source
Some lemmas about lists involving sets
Split out from Data.List.Basic to reduce its dependencies.
MapAccumr and Foldr
Some lemmas relation mapAccumr and foldr
theorem List.mapAccumr.match_1.congr_eq_2 E1 #
∀ {α : Type u_1} {γ : Type u_3} (motive : List α → γ → Sort u_2) (x : List α) (x_1 : γ) (h_1 : (c : γ) → motive [] c)
(h_2 : (y : α) → (yr : List α) → (c : γ) → motive (y :: yr) c) (y : α) (yr : List α) (c : γ),
x = y :: yr →
x_1 = c →
(match x, x_1 with
| [], c => h_1 c
| y :: yr, c => h_2 y yr c) ≍
h_2 y yr c
theorem List.mapAccumr.match_1.congr_eq_1 E1 #
∀ {α : Type u_1} {γ : Type u_3} (motive : List α → γ → Sort u_2) (x : List α) (x_1 : γ) (h_1 : (c : γ) → motive [] c)
(h_2 : (y : α) → (yr : List α) → (c : γ) → motive (y :: yr) c) (c : γ),
x = [] →
x_1 = c →
(match x, x_1 with
| [], c => h_1 c
| y :: yr, c => h_2 y yr c) ≍
h_1 c
theorem List.mapAccumr₂.match_1.congr_eq_2 E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_4} (motive : List α → List β → γ → Sort u_3) (x : List α) (x_1 : List β)
(x_2 : γ) (h_1 : (x : List β) → (c : γ) → motive [] x c) (h_2 : (x : List α) → (c : γ) → motive x [] c)
(h_3 : (x : α) → (xr : List α) → (y : β) → (yr : List β) → (c : γ) → motive (x :: xr) (y :: yr) c) (x_3 : List α)
(c : γ),
x = x_3 →
x_1 = [] →
x_2 = c →
(x_3 = [] → False) →
(match x, x_1, x_2 with
| [], x, c => h_1 x c
| x, [], c => h_2 x c
| x :: xr, y :: yr, c => h_3 x xr y yr c) ≍
h_2 x_3 c
theorem List.mapAccumr₂.match_1.congr_eq_3 E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_4} (motive : List α → List β → γ → Sort u_3) (x : List α) (x_1 : List β)
(x_2 : γ) (h_1 : (x : List β) → (c : γ) → motive [] x c) (h_2 : (x : List α) → (c : γ) → motive x [] c)
(h_3 : (x : α) → (xr : List α) → (y : β) → (yr : List β) → (c : γ) → motive (x :: xr) (y :: yr) c) (x_3 : α)
(xr : List α) (y : β) (yr : List β) (c : γ),
x = x_3 :: xr →
x_1 = y :: yr →
x_2 = c →
(match x, x_1, x_2 with
| [], x, c => h_1 x c
| x, [], c => h_2 x c
| x :: xr, y :: yr, c => h_3 x xr y yr c) ≍
h_3 x_3 xr y yr c
theorem List.mapAccumr₂.match_1.congr_eq_1 E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_4} (motive : List α → List β → γ → Sort u_3) (x : List α) (x_1 : List β)
(x_2 : γ) (h_1 : (x : List β) → (c : γ) → motive [] x c) (h_2 : (x : List α) → (c : γ) → motive x [] c)
(h_3 : (x : α) → (xr : List α) → (y : β) → (yr : List β) → (c : γ) → motive (x :: xr) (y :: yr) c) (x_3 : List β)
(c : γ),
x = [] →
x_1 = x_3 →
x_2 = c →
(match x, x_1, x_2 with
| [], x, c => h_1 x c
| x, [], c => h_2 x c
| x :: xr, y :: yr, c => h_3 x xr y yr c) ≍
h_1 x_3 c
theorem List.setOfPred_mem_eq_empty_iff E0 #
∀ {α : Type u_1} {l : List α}, {x | x ∈ l} = ∅ ↔ l = []
theorem List.injOn_insertIdx_index_of_notMem E1 #
∀ {α : Type u_1} (l : List α), ∀ x ∉ l, Set.InjOn (fun k ↦ l.insertIdx k x) {n | n ≤ l.length}
theorem List.foldr_range_subset_of_range_subset E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f : β → α → α} {g : γ → α → α},
Set.range f ⊆ Set.range g → ∀ (a : α), Set.range (List.foldr f a) ⊆ Set.range (List.foldr g a)
theorem List.foldl_range_subset_of_range_subset E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f : α → β → α} {g : α → γ → α},
((Set.range fun a c ↦ f c a) ⊆ Set.range fun b c ↦ g c b) →
∀ (a : α), Set.range (List.foldl f a) ⊆ Set.range (List.foldl g a)
theorem List.foldr_range_eq_of_range_eq E0 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f : β → α → α} {g : γ → α → α},
Set.range f = Set.range g → ∀ (a : α), Set.range (List.foldr f a) = Set.range (List.foldr g a)
theorem List.foldl_range_eq_of_range_eq E0 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f : α → β → α} {g : α → γ → α},
((Set.range fun a c ↦ f c a) = Set.range fun b c ↦ g c b) →
∀ (a : α), Set.range (List.foldl f a) = Set.range (List.foldl g a)
theorem List.mapAccumr_eq_foldr E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_4} (f : α → σ → σ × β) (as : List α) (s : σ),
List.mapAccumr f as s =
List.foldr
(fun a s ↦
have r := f a s.1;
(r.1, r.2 :: s.2))
(s, []) as
theorem List.mapAccumr₂_eq_foldr E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_4} {φ : Type u_5} (f : α → β → σ → σ × φ) (as : List α) (bs : List β)
(s : σ),
List.mapAccumr₂ f as bs s =
List.foldr
(fun ab s ↦
have r := f ab.1 ab.2 s.1;
(r.1, r.2 :: s.2))
(s, []) (as.zip bs)
Deprecated aliases
| Name | New name | Since |
|---|---|---|
List.setOf_mem_eq_empty_iff | List.setOfPred_mem_eq_empty_iff | 2026-07-09 |