Lemmas about List.Subset
, List.Sublist
, List.IsPrefix
, List.IsSuffix
, and List.IsInfix
. #
isPrefixOf #
isSuffixOf #
Subset #
List subset #
Equations
- List.instTransSubset = { trans := ⋯ }
theorem
List.filter_subset
{α : Type u_1}
{l₁ : List α}
{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₁ : List α}
{l₂ : List α}
(f : α → Option β)
(H : l₁ ⊆ l₂)
:
List.filterMap f l₁ ⊆ List.filterMap f l₂
Sublist and isSublist #
Equations
- List.instTransSublist = { trans := ⋯ }
Equations
- List.instTransSublistSubset = { trans := ⋯ }
Equations
- List.instTransSubsetSublist = { trans := ⋯ }
theorem
List.Sublist.tail
{α : Type u_1}
{l₁ : List α}
{l₂ : List α}
:
l₁.Sublist l₂ → l₁.tail.Sublist l₂.tail
theorem
List.Sublist.filterMap
{α : Type u_1}
{β : Type u_2}
{l₁ : List α}
{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₁ : List α}
{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₂ : List α}
{l₁ : List α}
{p : α → Bool}
:
l₁.Sublist (List.filter p l₂) ↔ ∃ (l' : List α), l'.Sublist l₂ ∧ l₁ = List.filter p l'
@[simp]
@[simp]
@[simp]
@[simp]
theorem
List.replicate_sublist_replicate
{α : Type u_1}
{m : Nat}
{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₁ : List α)
(l₂ : List α)
:
Decidable (l₁.Sublist l₂)
Equations
- l₁.instDecidableSublistOfDecidableEq l₂ = decidable_of_iff (l₁.isSublist l₂ = true) ⋯
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₁ : List α}
{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₁ : List α}
{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₁ : List α}
{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₁ : List α⦄
⦃l₂ : List α⦄
(h : l₁ <+: l₂)
:
List.filter p l₁ <+: List.filter p l₂
theorem
List.IsSuffix.filter
{α : Type u_1}
(p : α → Bool)
⦃l₁ : List α⦄
⦃l₂ : List α⦄
(h : l₁ <:+ l₂)
:
List.filter p l₁ <:+ List.filter p l₂
theorem
List.IsInfix.filter
{α : Type u_1}
(p : α → Bool)
⦃l₁ : List α⦄
⦃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₁ : List α⦄
⦃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₁ : List α⦄
⦃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₁ : List α⦄
⦃l₂ : List α⦄
(h : l₁ <:+: l₂)
:
List.filterMap f l₁ <:+: List.filterMap f l₂
instance
List.instDecidableIsPrefixOfDecidableEq
{α : Type u_1}
[DecidableEq α]
(l₁ : List α)
(l₂ : List α)
:
Equations
- l₁.instDecidableIsPrefixOfDecidableEq l₂ = decidable_of_iff (l₁.isPrefixOf l₂ = true) ⋯
instance
List.instDecidableIsSuffixOfDecidableEq
{α : Type u_1}
[DecidableEq α]
(l₁ : List α)
(l₂ : List α)
:
Equations
- l₁.instDecidableIsSuffixOfDecidableEq l₂ = decidable_of_iff (l₁.isSuffixOf l₂ = true) ⋯