Hash set lemmas #
This module contains lemmas about Std.Data.HashSet. Most of the lemmas require
EquivBEq α and LawfulHashable α for the key type α. The easiest way to obtain these instances
is to provide an instance of LawfulBEq α.
@[simp]
theorem Std.HashSet.isEmpty_emptyWithCapacity {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {c : Nat} :
@[simp]
theorem Std.HashSet.contains_emptyWithCapacity {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {a : α} {c : Nat} :
@[simp]
theorem Std.HashSet.not_mem_emptyWithCapacity {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {a : α} {c : Nat} :
@[simp]
theorem Std.HashSet.insert_eq_insert {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} {a : α} :
theorem Std.HashSet.contains_of_contains_insert' {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {k a : α} :
This is a restatement of contains_insert that is written to exactly match the proof
obligation in the statement of get_insert.
theorem Std.HashSet.mem_of_mem_insert' {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {k a : α} :
This is a restatement of mem_insert that is written to exactly match the proof obligation
in the statement of get_insert.
theorem Std.HashSet.mem_insert_self {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {k : α} :
@[simp]
@[simp]
theorem Std.HashSet.erase_emptyWithCapacity {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {a : α} {c : Nat} :
@[simp]
theorem Std.HashSet.get?_emptyWithCapacity {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {a : α} {c : Nat} :
theorem Std.HashSet.get?_beq {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {k : α} :
@[simp]
theorem Std.HashSet.getD_emptyWithCapacity {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {a fallback : α} {c : Nat} :
@[simp]
theorem Std.HashSet.containsThenInsert_fst {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} {k : α} :
@[simp]
theorem Std.HashSet.containsThenInsert_snd {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} {k : α} :
theorem Std.HashSet.distinct_toList {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] :
List.Pairwise (fun (a b : α) => (a == b) = false) m.toList
theorem Std.HashSet.foldM_eq_foldlM_toList {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} {δ : Type v} {m' : Type v → Type w} [Monad m'] [LawfulMonad m'] {f : δ → α → m' δ} {init : δ} :
@[simp]
instance Std.HashSet.instPureForInOfLawfulMonad {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m' : Type v → Type w} [Monad m'] [LawfulMonad m'] :
Internal.PureForIn m' (HashSet α) α
theorem Std.HashSet.foldM_eq_foldlM_toArray {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} {δ : Type v} {m' : Type v → Type w} [Monad m'] [LawfulMonad m'] {f : δ → α → m' δ} {init : δ} :
theorem Std.HashSet.forM_eq_forM_toArray {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} {m' : Type v → Type w} [Monad m'] [LawfulMonad m'] {f : α → m' PUnit} :
@[simp]
@[simp]
theorem Std.HashSet.contains_insertMany_list {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {l : List α} {k : α} :
theorem Std.HashSet.mem_of_mem_insertMany_list {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {l : List α} {k : α} (contains_eq_false : l.contains k = false) :
k ∈ m.insertMany l → k ∈ m
theorem Std.HashSet.mem_insertMany_of_mem {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} {ρ : Type v} [ForIn Id ρ α] [EquivBEq α] [LawfulHashable α] {l : ρ} {k : α} :
k ∈ m → k ∈ m.insertMany l
theorem Std.HashSet.get?_insertMany_list_of_not_mem_of_mem {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {l : List α} {k k' : α} (k_beq : (k == k') = true) (not_mem : ¬k ∈ m) (distinct : List.Pairwise (fun (a b : α) => (a == b) = false) l) (mem : k ∈ l) :
theorem Std.HashSet.get?_insertMany_list_of_mem {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {l : List α} {k : α} (mem : k ∈ m) :
theorem Std.HashSet.get_insertMany_list_of_not_mem_of_mem {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {l : List α} {k k' : α} (k_beq : (k == k') = true) (not_mem : ¬k ∈ m) (distinct : List.Pairwise (fun (a b : α) => (a == b) = false) l) (mem : k ∈ l) {h : k' ∈ m.insertMany l} :
theorem Std.HashSet.get_insertMany_list_of_mem {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {l : List α} {k : α} (mem : k ∈ m) {h : k ∈ m.insertMany l} :
theorem Std.HashSet.get!_insertMany_list_of_not_mem_of_mem {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] [Inhabited α] {l : List α} {k k' : α} (k_beq : (k == k') = true) (not_mem : ¬k ∈ m) (distinct : List.Pairwise (fun (a b : α) => (a == b) = false) l) (mem : k ∈ l) :
theorem Std.HashSet.get!_insertMany_list_of_mem {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] [Inhabited α] {l : List α} {k : α} (mem : k ∈ m) :
theorem Std.HashSet.getD_insertMany_list_of_not_mem_of_mem {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {l : List α} {k k' fallback : α} (k_beq : (k == k') = true) (not_mem : ¬k ∈ m) (distinct : List.Pairwise (fun (a b : α) => (a == b) = false) l) (mem : k ∈ l) :
theorem Std.HashSet.getD_insertMany_list_of_mem {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {l : List α} {k fallback : α} (mem : k ∈ m) :
theorem Std.HashSet.size_le_size_insertMany_list {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {l : List α} :
theorem Std.HashSet.size_le_size_insertMany {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} {ρ : Type v} [ForIn Id ρ α] [EquivBEq α] [LawfulHashable α] {l : ρ} :
theorem Std.HashSet.size_insertMany_list_le {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {l : List α} :
@[simp]
theorem Std.HashSet.isEmpty_insertMany_list {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {l : List α} :
theorem Std.HashSet.ofList_eq_insertMany_empty {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {l : List α} :
theorem Std.HashSet.Equiv.insertMany_list {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m₁ m₂ : HashSet α} [EquivBEq α] [LawfulHashable α] (l : List α) (h : m₁.Equiv m₂) :
(m₁.insertMany l).Equiv (m₂.insertMany l)
theorem Std.HashSet.Equiv.filter {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m₁ m₂ : HashSet α} (f : α → Bool) (h : m₁.Equiv m₂) :
(HashSet.filter f m₁).Equiv (HashSet.filter f m₂)
@[simp]
theorem Std.HashSet.equiv_emptyWithCapacity_iff_isEmpty {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {c : Nat} :
@[simp]
theorem Std.HashSet.emptyWithCapacity_equiv_iff_isEmpty {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {c : Nat} :
theorem Std.HashSet.insertMany_list_equiv_foldl {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} {l : List α} :
(m.insertMany l).Equiv (List.foldl (fun (acc : HashSet α) (a : α) => acc.insert a) m l)
@[simp]
theorem Std.HashSet.get?_filter {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {f : α → Bool} {k : α} :
theorem Std.HashSet.getD_filter {α : Type u} {x✝ : BEq α} {x✝¹ : Hashable α} {m : HashSet α} [EquivBEq α] [LawfulHashable α] {f : α → Bool} {k fallback : α} :