Hash set lemmas #
This module contains lemmas about Std.Data.HashSet.Raw
. 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.Raw.isEmpty_insert
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
:
@[simp]
theorem
Std.HashSet.Raw.insert_eq_insert
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
{a : α}
:
Insert.insert a m = m.insert a
theorem
Std.HashSet.Raw.contains_of_contains_insert'
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{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.Raw.mem_of_mem_insert'
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
:
This is a restatement of mem_insert
that is written to exactly match the proof obligation
in the statement of get_insertIfNew
.
@[simp]
theorem
Std.HashSet.Raw.contains_insert_self
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
@[simp]
theorem
Std.HashSet.Raw.mem_insert_self
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
k ∈ m.insert k
theorem
Std.HashSet.Raw.size_le_size_insert
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
m.size ≤ (m.insert k).size
theorem
Std.HashSet.Raw.size_insert_le
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
theorem
Std.HashSet.Raw.mem_of_mem_erase
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
:
theorem
Std.HashSet.Raw.size_erase_le
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
(m.erase k).size ≤ m.size
theorem
Std.HashSet.Raw.size_le_size_erase
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
theorem
Std.HashSet.Raw.contains_eq_isSome_get?
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
:
m.contains a = (m.get? a).isSome
@[simp]
theorem
Std.HashSet.Raw.get_erase
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{h' : a ∈ m.erase k}
:
(m.erase k).get a h' = m.get a ⋯
@[simp]
theorem
Std.HashSet.Raw.get?_erase_self
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
theorem
Std.HashSet.Raw.get!_eq_get!_get?
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited α]
(h : m.WF)
{a : α}
:
m.get! a = (m.get? a).get!
@[simp]
theorem
Std.HashSet.Raw.getD_erase_self
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k fallback : α}
:
(m.erase k).getD k fallback = fallback
theorem
Std.HashSet.Raw.getD_eq_getD_get?
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a fallback : α}
:
m.getD a fallback = (m.get? a).getD fallback
theorem
Std.HashSet.Raw.get_eq_getD
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a fallback : α}
{h' : a ∈ m}
:
m.get a h' = m.getD a fallback
@[simp]
theorem
Std.HashSet.Raw.length_toList
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
:
m.toList.length = m.size
@[simp]
theorem
Std.HashSet.Raw.isEmpty_toList
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
:
m.toList.isEmpty = m.isEmpty
@[simp]
theorem
Std.HashSet.Raw.contains_toList
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
{k : α}
(h : m.WF)
:
m.toList.contains k = m.contains k
theorem
Std.HashSet.Raw.distinct_toList
{α : Type u}
{m : Raw α}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
:
List.Pairwise (fun (a b : α) => (a == b) = false) m.toList