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

54 declarations. Mathlib docs · Source

ctor List.SublistForall₂.below.nil E0 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop}
  {motive : (a : List α) → (a_1 : List β) → List.SublistForall₂ R a a_1 → Prop} {l : List β},
  List.SublistForall₂.below ⋯

ctor List.SublistForall₂.below.cons E0 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop}
  {motive : (a : List α) → (a_1 : List β) → List.SublistForall₂ R a a_1 → Prop} {a₁ : α} {a₂ : β} {l₁ : List α}
  {l₂ : List β} (a : R a₁ a₂) (a_1 : List.SublistForall₂ R l₁ l₂),
  List.SublistForall₂.below a_1 → motive l₁ l₂ a_1 → List.SublistForall₂.below ⋯

ctor List.SublistForall₂.below.cons_right E0 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop}
  {motive : (a : List α) → (a_1 : List β) → List.SublistForall₂ R a a_1 → Prop} {a : β} {l₁ : List α} {l₂ : List β}
  (a_1 : List.SublistForall₂ R l₁ l₂), List.SublistForall₂.below a_1 → motive l₁ l₂ a_1 → List.SublistForall₂.below ⋯

theorem List.forall₂_iff E0 #

∀ {α : Type u_1} {β : Type u_2} (R : α → β → Prop) (a : List α) (a_1 : List β),
  List.Forall₂ R a a_1 ↔
    a = [] ∧ a_1 = [] ∨ ∃ a_2 b l₁ l₂, R a_2 b ∧ List.Forall₂ R l₁ l₂ ∧ a = a_2 :: l₁ ∧ a_1 = b :: l₂

theorem List.Forall₂.imp E1 #

∀ {α : Type u_1} {β : Type u_2} {R S : α → β → Prop},
  (∀ (a : α) (b : β), R a b → S a b) → ∀ {l₁ : List α} {l₂ : List β}, List.Forall₂ R l₁ l₂ → List.Forall₂ S l₁ l₂

theorem List.Forall₂.mp E1 #

∀ {α : Type u_1} {β : Type u_2} {R S Q : α → β → Prop},
  (∀ (a : α) (b : β), Q a b → R a b → S a b) →
    ∀ {l₁ : List α} {l₂ : List β}, List.Forall₂ Q l₁ l₂ → List.Forall₂ R l₁ l₂ → List.Forall₂ S l₁ l₂

theorem List.Forall₂.flip E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {a : List α} {b : List β},
  List.Forall₂ (flip R) b a → List.Forall₂ R a b

theorem List.forall₂_same E0 #

∀ {α : Type u_1} {Rₐ : α → α → Prop} {l : List α}, List.Forall₂ Rₐ l l ↔ ∀ x ∈ l, Rₐ x x

theorem List.forall₂_refl E1 #

∀ {α : Type u_1} {Rₐ : α → α → Prop} [Std.Refl Rₐ] (l : List α), List.Forall₂ Rₐ l l

theorem List.forall₂_eq_eq_eq E0 #

∀ {α : Type u_1}, (List.Forall₂ fun x1 x2 ↦ x1 = x2) = Eq

theorem List.forall₂_nil_left_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {l : List β}, List.Forall₂ R [] l ↔ l = []

theorem List.forall₂_nil_right_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {l : List α}, List.Forall₂ R l [] ↔ l = []

theorem List.forall₂_cons_left_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {a : α} {l : List α} {u : List β},
  List.Forall₂ R (a :: l) u ↔ ∃ b u', R a b ∧ List.Forall₂ R l u' ∧ u = b :: u'

theorem List.forall₂_cons_right_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {b : β} {l : List β} {u : List α},
  List.Forall₂ R u (b :: l) ↔ ∃ a u', R a b ∧ List.Forall₂ R u' l ∧ u = a :: u'

theorem List.forall₂_and_left E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {p : α → Prop} (l : List α) (u : List β),
  List.Forall₂ (fun a b ↦ p a ∧ R a b) l u ↔ (∀ a ∈ l, p a) ∧ List.Forall₂ R l u

theorem List.forall₂_map_left_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {R : α → β → Prop} {f : γ → α} {l : List γ} {u : List β},
  List.Forall₂ R (List.map f l) u ↔ List.Forall₂ (fun c b ↦ R (f c) b) l u

theorem List.forall₂_map_right_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {R : α → β → Prop} {f : γ → β} {l : List α} {u : List γ},
  List.Forall₂ R l (List.map f u) ↔ List.Forall₂ (fun a c ↦ R a (f c)) l u

theorem List.left_unique_forall₂' E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop},
  Relator.LeftUnique R → ∀ {a b : List α} {c : List β}, List.Forall₂ R a c → List.Forall₂ R b c → a = b

theorem Relator.LeftUnique.forall₂ E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop}, Relator.LeftUnique R → Relator.LeftUnique (List.Forall₂ R)

theorem List.right_unique_forall₂' E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop},
  Relator.RightUnique R → ∀ {a : List α} {b c : List β}, List.Forall₂ R a b → List.Forall₂ R a c → b = c

theorem Relator.RightUnique.forall₂ E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop}, Relator.RightUnique R → Relator.RightUnique (List.Forall₂ R)

theorem Relator.BiUnique.forall₂ E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop}, Relator.BiUnique R → Relator.BiUnique (List.Forall₂ R)

theorem List.Forall₂.length_eq E0 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {l₁ : List α} {l₂ : List β},
  List.Forall₂ R l₁ l₂ → l₁.length = l₂.length

theorem List.Forall₂.get E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {x : List α} {y : List β},
  List.Forall₂ R x y → ∀ ⦃i : ℕ⦄ (hx : i < x.length) (hy : i < y.length), R (x.get ⟨i, hx⟩) (y.get ⟨i, hy⟩)

theorem List.forall₂_of_length_eq_of_get E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {x : List α} {y : List β},
  x.length = y.length →
    (∀ (i : ℕ) (h₁ : i < x.length) (h₂ : i < y.length), R (x.get ⟨i, h₁⟩) (y.get ⟨i, h₂⟩)) → List.Forall₂ R x y

theorem List.forall₂_iff_get E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {l₁ : List α} {l₂ : List β},
  List.Forall₂ R l₁ l₂ ↔
    l₁.length = l₂.length ∧ ∀ (i : ℕ) (h₁ : i < l₁.length) (h₂ : i < l₂.length), R (l₁.get ⟨i, h₁⟩) (l₂.get ⟨i, h₂⟩)

theorem List.forall₂_zip E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {l₁ : List α} {l₂ : List β},
  List.Forall₂ R l₁ l₂ → ∀ {a : α} {b : β}, (a, b) ∈ l₁.zip l₂ → R a b

theorem List.forall₂_iff_zip E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {l₁ : List α} {l₂ : List β},
  List.Forall₂ R l₁ l₂ ↔ l₁.length = l₂.length ∧ ∀ {a : α} {b : β}, (a, b) ∈ l₁.zip l₂ → R a b

theorem List.forall₂_take E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} (n : ℕ) {l₁ : List α} {l₂ : List β},
  List.Forall₂ R l₁ l₂ → List.Forall₂ R (List.take n l₁) (List.take n l₂)

theorem List.forall₂_drop E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} (n : ℕ) {l₁ : List α} {l₂ : List β},
  List.Forall₂ R l₁ l₂ → List.Forall₂ R (List.drop n l₁) (List.drop n l₂)

theorem List.forall₂_take_append E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} (l : List α) (l₁ l₂ : List β),
  List.Forall₂ R l (l₁ ++ l₂) → List.Forall₂ R (List.take l₁.length l) l₁

theorem List.forall₂_drop_append E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} (l : List α) (l₁ l₂ : List β),
  List.Forall₂ R l (l₁ ++ l₂) → List.Forall₂ R (List.drop l₁.length l) l₂

theorem List.rel_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop},
  Relator.BiUnique R →
    Relator.LiftFun R (Relator.LiftFun (List.Forall₂ R) Iff) (fun x1 x2 ↦ x1 ∈ x2) fun x1 x2 ↦ x1 ∈ x2

theorem List.rel_map E1 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} {R : α → β → Prop} {P : γ → δ → Prop},
  Relator.LiftFun (Relator.LiftFun R P) (Relator.LiftFun (List.Forall₂ R) (List.Forall₂ P)) List.map List.map

theorem List.rel_append E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop},
  Relator.LiftFun (List.Forall₂ R) (Relator.LiftFun (List.Forall₂ R) (List.Forall₂ R)) (fun x1 x2 ↦ x1 ++ x2)
    fun x1 x2 ↦ x1 ++ x2

theorem List.rel_reverse E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop},
  Relator.LiftFun (List.Forall₂ R) (List.Forall₂ R) List.reverse List.reverse

theorem List.forall₂_reverse_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {l₁ : List α} {l₂ : List β},
  List.Forall₂ R l₁.reverse l₂.reverse ↔ List.Forall₂ R l₁ l₂

theorem List.rel_flatten E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop},
  Relator.LiftFun (List.Forall₂ (List.Forall₂ R)) (List.Forall₂ R) List.flatten List.flatten

theorem List.rel_flatMap E1 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} {R : α → β → Prop} {P : γ → δ → Prop},
  Relator.LiftFun (List.Forall₂ R) (Relator.LiftFun (Relator.LiftFun R (List.Forall₂ P)) (List.Forall₂ P))
    (Function.swap List.flatMap) (Function.swap List.flatMap)

theorem List.rel_foldl E1 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} {R : α → β → Prop} {P : γ → δ → Prop},
  Relator.LiftFun (Relator.LiftFun P (Relator.LiftFun R P)) (Relator.LiftFun P (Relator.LiftFun (List.Forall₂ R) P))
    List.foldl List.foldl

theorem List.rel_foldr E1 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} {R : α → β → Prop} {P : γ → δ → Prop},
  Relator.LiftFun (Relator.LiftFun R (Relator.LiftFun P P)) (Relator.LiftFun P (Relator.LiftFun (List.Forall₂ R) P))
    List.foldr List.foldr

theorem List.rel_filter E1 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {p : α → Bool} {q : β → Bool},
  (Relator.LiftFun R (fun x1 x2 ↦ x1 ↔ x2) (fun x ↦ p x = true) fun x ↦ q x = true) →
    Relator.LiftFun (List.Forall₂ R) (List.Forall₂ R) (List.filter p) (List.filter q)

theorem List.rel_filterMap E1 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} {R : α → β → Prop} {P : γ → δ → Prop},
  Relator.LiftFun (Relator.LiftFun R (Option.Rel P)) (Relator.LiftFun (List.Forall₂ R) (List.Forall₂ P)) List.filterMap
    List.filterMap

inductive List.SublistForall₂ E3 #

{α : Type u_1} → {β : Type u_2} → (α → β → Prop) → List α → List β → Prop

Given a relation R, sublist_forall₂ r l₁ l₂ indicates that there is a sublist of l₂ such that forall₂ r l₁ l₂.

ctor List.SublistForall₂.nil E0 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {l : List β}, List.SublistForall₂ R [] l

ctor List.SublistForall₂.cons E0 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {a₁ : α} {a₂ : β} {l₁ : List α} {l₂ : List β},
  R a₁ a₂ → List.SublistForall₂ R l₁ l₂ → List.SublistForall₂ R (a₁ :: l₁) (a₂ :: l₂)

ctor List.SublistForall₂.cons_right E0 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {a : β} {l₁ : List α} {l₂ : List β},
  List.SublistForall₂ R l₁ l₂ → List.SublistForall₂ R l₁ (a :: l₂)

theorem List.sublistForall₂_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {l₁ : List α} {l₂ : List β},
  List.SublistForall₂ R l₁ l₂ ↔ ∃ l, List.Forall₂ R l₁ l ∧ l.Sublist l₂

instance List.SublistForall₂.is_refl E0 #

∀ {α : Type u_1} {Rₐ : α → α → Prop} [Std.Refl Rₐ], Std.Refl (List.SublistForall₂ Rₐ)

instance List.SublistForall₂.is_trans E0 #

∀ {α : Type u_1} {Rₐ : α → α → Prop} [IsTrans α Rₐ], IsTrans (List α) (List.SublistForall₂ Rₐ)

theorem List.Sublist.sublistForall₂ E1 #

∀ {α : Type u_1} {Rₐ : α → α → Prop} {l₁ l₂ : List α}, l₁.Sublist l₂ → ∀ [Std.Refl Rₐ], List.SublistForall₂ Rₐ l₁ l₂

theorem List.tail_sublistForall₂_self E1 #

∀ {α : Type u_1} {Rₐ : α → α → Prop} [Std.Refl Rₐ] (l : List α), List.SublistForall₂ Rₐ l.tail l

theorem List.sublistForall₂_map_left_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {R : α → β → Prop} {f : γ → α} {l₁ : List γ} {l₂ : List β},
  List.SublistForall₂ R (List.map f l₁) l₂ ↔ List.SublistForall₂ (fun c b ↦ R (f c) b) l₁ l₂

theorem List.sublistForall₂_map_right_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {R : α → β → Prop} {f : γ → β} {l₁ : List α} {l₂ : List γ},
  List.SublistForall₂ R l₁ (List.map f l₂) ↔ List.SublistForall₂ (fun a c ↦ R a (f c)) l₁ l₂