Lemmas about List.Subset
, List.Sublist
, List.IsPrefix
, List.IsSuffix
, and List.IsInfix
. #
isPrefixOf #
isSuffixOf #
Subset #
List subset #
theorem
List.filter_subset
{α : Type u_1}
{l₁ l₂ : List α}
(p : α → Bool)
(H : l₁ ⊆ l₂)
:
List.filter p l₁ ⊆ List.filter p l₂
theorem
List.filterMap_subset
{α : Type u_1}
{β : Type u_2}
{l₁ l₂ : List α}
(f : α → Option β)
(H : l₁ ⊆ l₂)
:
List.filterMap f l₁ ⊆ List.filterMap f l₂
Sublist and isSublist #
theorem
List.Sublist.trans
{α : Type u_1}
{l₁ l₂ l₃ : List α}
(h₁ : l₁.Sublist l₂)
(h₂ : l₂.Sublist l₃)
:
l₁.Sublist l₃
Equations
- List.instTransSublist = { trans := ⋯ }
theorem
List.sublist_of_cons_sublist
{α✝ : Type u_1}
{a : α✝}
{l₁ l₂ : List α✝}
:
(a :: l₁).Sublist l₂ → l₁.Sublist l₂
Equations
- List.instTransSublistSubset = { trans := ⋯ }
theorem
List.Sublist.length_le
{α✝ : Type u_1}
{l₁ l₂ : List α✝}
:
l₁.Sublist l₂ → l₁.length ≤ l₂.length
theorem
List.Sublist.filterMap
{α : Type u_1}
{β : Type u_2}
{l₁ l₂ : List α}
(f : α → Option β)
(s : l₁.Sublist l₂)
:
(List.filterMap f l₁).Sublist (List.filterMap f l₂)
theorem
List.Sublist.filter
{α : Type u_1}
(p : α → Bool)
{l₁ l₂ : List α}
(s : l₁.Sublist l₂)
:
(List.filter p l₁).Sublist (List.filter p l₂)
theorem
List.head_filter_mem
{α : Type u_1}
(xs : List α)
(p : α → Bool)
(h : List.filter p xs ≠ [])
:
(List.filter p xs).head h ∈ xs
theorem
List.getLast_filter_mem
{α : Type u_1}
(xs : List α)
(p : α → Bool)
(h : List.filter p xs ≠ [])
:
(List.filter p xs).getLast h ∈ xs
theorem
List.sublist_filterMap_iff
{β : Type u_1}
{α : Type u_2}
{l₂ : List α}
{l₁ : List β}
{f : α → Option β}
:
l₁.Sublist (List.filterMap f l₂) ↔ ∃ (l' : List α), l'.Sublist l₂ ∧ l₁ = List.filterMap f l'
theorem
List.sublist_filter_iff
{α : Type u_1}
{l₂ l₁ : List α}
{p : α → Bool}
:
l₁.Sublist (List.filter p l₂) ↔ ∃ (l' : List α), l'.Sublist l₂ ∧ l₁ = List.filter p l'
@[simp]
theorem
List.sublist_append_of_sublist_left
{α✝ : Type u_1}
{l l₁ l₂ : List α✝}
(s : l.Sublist l₁)
:
l.Sublist (l₁ ++ l₂)
@[simp]
theorem
List.sublist_append_of_sublist_right
{α✝ : Type u_1}
{l l₂ l₁ : List α✝}
(s : l.Sublist l₂)
:
l.Sublist (l₁ ++ l₂)
theorem
List.Sublist.reverse
{α✝ : Type u_1}
{l₁ l₂ : List α✝}
:
l₁.Sublist l₂ → l₁.reverse.Sublist l₂.reverse
@[simp]
theorem
List.reverse_sublist
{α✝ : Type u_1}
{l₁ l₂ : List α✝}
:
l₁.reverse.Sublist l₂.reverse ↔ l₁.Sublist l₂
theorem
List.sublist_reverse_iff
{α✝ : Type u_1}
{l₁ l₂ : List α✝}
:
l₁.Sublist l₂.reverse ↔ l₁.reverse.Sublist l₂
@[simp]
theorem
List.replicate_sublist_replicate
{α : Type u_1}
{m n : Nat}
(a : α)
:
(List.replicate m a).Sublist (List.replicate n a) ↔ m ≤ n
theorem
List.sublist_replicate_iff
{α✝ : Type u_1}
{l : List α✝}
{m : Nat}
{a : α✝}
:
l.Sublist (List.replicate m a) ↔ ∃ (n : Nat), n ≤ m ∧ l = List.replicate n a
instance
List.instDecidableSublistOfDecidableEq
{α : Type u_1}
[DecidableEq α]
(l₁ l₂ : List α)
:
Decidable (l₁.Sublist l₂)
IsPrefix / IsSuffix / IsInfix #
theorem
List.isPrefix_filterMap_iff
{α : Type u_1}
{β : Type u_2}
{f : α → Option β}
{l₁ : List α}
{l₂ : List β}
:
l₂ <+: List.filterMap f l₁ ↔ ∃ (l : List α), l <+: l₁ ∧ l₂ = List.filterMap f l
theorem
List.isSuffix_filterMap_iff
{α : Type u_1}
{β : Type u_2}
{f : α → Option β}
{l₁ : List α}
{l₂ : List β}
:
l₂ <:+ List.filterMap f l₁ ↔ ∃ (l : List α), l <:+ l₁ ∧ l₂ = List.filterMap f l
theorem
List.isInfix_filterMap_iff
{α : Type u_1}
{β : Type u_2}
{f : α → Option β}
{l₁ : List α}
{l₂ : List β}
:
l₂ <:+: List.filterMap f l₁ ↔ ∃ (l : List α), l <:+: l₁ ∧ l₂ = List.filterMap f l
theorem
List.isPrefix_filter_iff
{α : Type u_1}
{p : α → Bool}
{l₁ l₂ : List α}
:
l₂ <+: List.filter p l₁ ↔ ∃ (l : List α), l <+: l₁ ∧ l₂ = List.filter p l
theorem
List.isSuffix_filter_iff
{α : Type u_1}
{p : α → Bool}
{l₁ l₂ : List α}
:
l₂ <:+ List.filter p l₁ ↔ ∃ (l : List α), l <:+ l₁ ∧ l₂ = List.filter p l
theorem
List.isInfix_filter_iff
{α : Type u_1}
{p : α → Bool}
{l₁ l₂ : List α}
:
l₂ <:+: List.filter p l₁ ↔ ∃ (l : List α), l <:+: l₁ ∧ l₂ = List.filter p l
theorem
List.isPrefix_replicate_iff
{α : Type u_1}
{n : Nat}
{a : α}
{l : List α}
:
l <+: List.replicate n a ↔ l.length ≤ n ∧ l = List.replicate l.length a
theorem
List.isSuffix_replicate_iff
{α : Type u_1}
{n : Nat}
{a : α}
{l : List α}
:
l <:+ List.replicate n a ↔ l.length ≤ n ∧ l = List.replicate l.length a
theorem
List.isInfix_replicate_iff
{α : Type u_1}
{n : Nat}
{a : α}
{l : List α}
:
l <:+: List.replicate n a ↔ l.length ≤ n ∧ l = List.replicate l.length a
theorem
List.takeWhile_sublist
{α : Type u_1}
{l : List α}
(p : α → Bool)
:
(List.takeWhile p l).Sublist l
theorem
List.dropWhile_sublist
{α : Type u_1}
{l : List α}
(p : α → Bool)
:
(List.dropWhile p l).Sublist l
theorem
List.IsPrefix.filter
{α : Type u_1}
(p : α → Bool)
⦃l₁ l₂ : List α⦄
(h : l₁ <+: l₂)
:
List.filter p l₁ <+: List.filter p l₂
theorem
List.IsSuffix.filter
{α : Type u_1}
(p : α → Bool)
⦃l₁ l₂ : List α⦄
(h : l₁ <:+ l₂)
:
List.filter p l₁ <:+ List.filter p l₂
theorem
List.IsInfix.filter
{α : Type u_1}
(p : α → Bool)
⦃l₁ l₂ : List α⦄
(h : l₁ <:+: l₂)
:
List.filter p l₁ <:+: List.filter p l₂
theorem
List.IsPrefix.filterMap
{α : Type u_1}
{β : Type u_2}
(f : α → Option β)
⦃l₁ l₂ : List α⦄
(h : l₁ <+: l₂)
:
List.filterMap f l₁ <+: List.filterMap f l₂
theorem
List.IsSuffix.filterMap
{α : Type u_1}
{β : Type u_2}
(f : α → Option β)
⦃l₁ l₂ : List α⦄
(h : l₁ <:+ l₂)
:
List.filterMap f l₁ <:+ List.filterMap f l₂
theorem
List.IsInfix.filterMap
{α : Type u_1}
{β : Type u_2}
(f : α → Option β)
⦃l₁ l₂ : List α⦄
(h : l₁ <:+: l₂)
:
List.filterMap f l₁ <:+: List.filterMap f l₂
Equations
- l₁.instDecidableIsPrefixOfDecidableEq l₂ = decidable_of_iff (l₁.isPrefixOf l₂ = true) ⋯
Deprecations #
@[reducible, inline, deprecated List.sublist_flatten_iff]
Instances For
@[reducible, inline, deprecated List.flatten_sublist_iff]
Instances For
@[reducible, inline, deprecated List.infix_of_mem_flatten]