Hash map lemmas #
This module contains lemmas about Std.Data.HashMap.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.HashMap.Raw.size_empty
{α : Type u}
{β : Type v}
{c : Nat}
:
(Std.HashMap.Raw.empty c).size = 0
theorem
Std.HashMap.Raw.isEmpty_eq_size_eq_zero
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
:
@[simp]
theorem
Std.HashMap.Raw.isEmpty_empty
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
{c : Nat}
:
(Std.HashMap.Raw.empty c).isEmpty = true
@[simp]
theorem
Std.HashMap.Raw.isEmpty_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
theorem
Std.HashMap.Raw.contains_congr
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a b : α}
(hab : (a == b) = true)
:
m.contains a = m.contains b
theorem
Std.HashMap.Raw.mem_congr
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a b : α}
(hab : (a == b) = true)
:
@[simp]
theorem
Std.HashMap.Raw.contains_empty
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
{a : α}
{c : Nat}
:
(Std.HashMap.Raw.empty c).contains a = false
@[simp]
theorem
Std.HashMap.Raw.get_eq_getElem
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
{a : α}
{h : a ∈ m}
:
m.get a h = m[a]
@[simp]
theorem
Std.HashMap.Raw.get?_eq_getElem?
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
{a : α}
:
m.get? a = m[a]?
@[simp]
theorem
Std.HashMap.Raw.get!_eq_getElem!
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[Inhabited β]
{a : α}
:
m.get! a = m[a]!
theorem
Std.HashMap.Raw.contains_of_isEmpty
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.not_mem_of_isEmpty
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.isEmpty_eq_false_iff_exists_contains_eq_true
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
:
theorem
Std.HashMap.Raw.isEmpty_eq_false_iff_exists_mem
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
:
theorem
Std.HashMap.Raw.isEmpty_iff_forall_contains
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
:
theorem
Std.HashMap.Raw.isEmpty_iff_forall_not_mem
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
:
@[simp]
theorem
Std.HashMap.Raw.insert_eq_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
{p : α × β}
:
@[simp]
theorem
Std.HashMap.Raw.contains_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{v : β}
:
theorem
Std.HashMap.Raw.mem_of_mem_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{v : β}
:
@[simp]
theorem
Std.HashMap.Raw.contains_insert_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
@[simp]
theorem
Std.HashMap.Raw.mem_insert_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
k ∈ m.insert k v
theorem
Std.HashMap.Raw.size_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
theorem
Std.HashMap.Raw.size_le_size_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
m.size ≤ (m.insert k v).size
theorem
Std.HashMap.Raw.size_insert_le
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
@[simp]
theorem
Std.HashMap.Raw.erase_empty
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
{k : α}
{c : Nat}
:
(Std.HashMap.Raw.empty c).erase k = Std.HashMap.Raw.empty c
@[simp]
theorem
Std.HashMap.Raw.isEmpty_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
@[simp]
theorem
Std.HashMap.Raw.contains_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
:
theorem
Std.HashMap.Raw.contains_of_contains_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
:
theorem
Std.HashMap.Raw.mem_of_mem_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
:
theorem
Std.HashMap.Raw.size_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
theorem
Std.HashMap.Raw.size_erase_le
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
(m.erase k).size ≤ m.size
theorem
Std.HashMap.Raw.size_le_size_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
@[simp]
theorem
Std.HashMap.Raw.containsThenInsert_fst
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
(h : m.WF)
{k : α}
{v : β}
:
(m.containsThenInsert k v).fst = m.contains k
@[simp]
theorem
Std.HashMap.Raw.containsThenInsert_snd
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
(h : m.WF)
{k : α}
{v : β}
:
(m.containsThenInsert k v).snd = m.insert k v
@[simp]
theorem
Std.HashMap.Raw.containsThenInsertIfNew_fst
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
(h : m.WF)
{k : α}
{v : β}
:
(m.containsThenInsertIfNew k v).fst = m.contains k
@[simp]
theorem
Std.HashMap.Raw.containsThenInsertIfNew_snd
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
(h : m.WF)
{k : α}
{v : β}
:
(m.containsThenInsertIfNew k v).snd = m.insertIfNew k v
@[simp]
theorem
Std.HashMap.Raw.getElem?_empty
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
{a : α}
{c : Nat}
:
(Std.HashMap.Raw.empty c)[a]? = none
theorem
Std.HashMap.Raw.getElem?_of_isEmpty
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getElem?_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{v : β}
:
@[simp]
theorem
Std.HashMap.Raw.getElem?_insert_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
theorem
Std.HashMap.Raw.contains_eq_isSome_getElem?
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
:
m.contains a = m[a]?.isSome
theorem
Std.HashMap.Raw.getElem?_eq_none_of_contains_eq_false
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getElem?_eq_none
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getElem?_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
:
@[simp]
theorem
Std.HashMap.Raw.getElem?_erase_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
(m.erase k)[k]? = none
theorem
Std.HashMap.Raw.getElem?_congr
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a b : α}
(hab : (a == b) = true)
:
m[a]? = m[b]?
theorem
Std.HashMap.Raw.getElem_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{v : β}
{h₁ : a ∈ m.insert k v}
:
@[simp]
theorem
Std.HashMap.Raw.getElem_insert_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
(m.insert k v)[k] = v
@[simp]
theorem
Std.HashMap.Raw.getElem_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{h' : a ∈ m.erase k}
:
(m.erase k)[a] = m[a]
theorem
Std.HashMap.Raw.getElem?_eq_some_getElem
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
{h' : a ∈ m}
:
@[simp]
theorem
Std.HashMap.Raw.getElem!_empty
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
[Inhabited β]
{a : α}
{c : Nat}
:
(Std.HashMap.Raw.empty c)[a]! = default
theorem
Std.HashMap.Raw.getElem!_of_isEmpty
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited β]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getElem!_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited β]
(h : m.WF)
{k a : α}
{v : β}
:
@[simp]
theorem
Std.HashMap.Raw.getElem!_insert_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited β]
(h : m.WF)
{k : α}
{v : β}
:
(m.insert k v)[k]! = v
theorem
Std.HashMap.Raw.getElem!_eq_default_of_contains_eq_false
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited β]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getElem!_eq_default
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited β]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getElem!_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited β]
(h : m.WF)
{k a : α}
:
@[simp]
theorem
Std.HashMap.Raw.getElem!_erase_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited β]
(h : m.WF)
{k : α}
:
(m.erase k)[k]! = default
theorem
Std.HashMap.Raw.getElem?_eq_some_getElem!_of_contains
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited β]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getElem?_eq_some_getElem!
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited β]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getElem!_eq_get!_getElem?
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited β]
(h : m.WF)
{a : α}
:
m[a]! = m[a]?.get!
theorem
Std.HashMap.Raw.getElem_eq_getElem!
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited β]
(h : m.WF)
{a : α}
{h' : a ∈ m}
:
m[a] = m[a]!
theorem
Std.HashMap.Raw.getElem!_congr
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited β]
(h : m.WF)
{a b : α}
(hab : (a == b) = true)
:
m[a]! = m[b]!
@[simp]
theorem
Std.HashMap.Raw.getD_empty
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
{a : α}
{fallback : β}
{c : Nat}
:
(Std.HashMap.Raw.empty c).getD a fallback = fallback
theorem
Std.HashMap.Raw.getD_of_isEmpty
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
{fallback : β}
:
theorem
Std.HashMap.Raw.getD_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{fallback v : β}
:
@[simp]
theorem
Std.HashMap.Raw.getD_insert_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{fallback v : β}
:
(m.insert k v).getD k fallback = v
theorem
Std.HashMap.Raw.getD_eq_fallback_of_contains_eq_false
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
{fallback : β}
:
theorem
Std.HashMap.Raw.getD_eq_fallback
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
{fallback : β}
:
theorem
Std.HashMap.Raw.getD_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{fallback : β}
:
@[simp]
theorem
Std.HashMap.Raw.getD_erase_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{fallback : β}
:
(m.erase k).getD k fallback = fallback
theorem
Std.HashMap.Raw.getElem?_eq_some_getD_of_contains
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
{fallback : β}
:
theorem
Std.HashMap.Raw.getElem?_eq_some_getD
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
{fallback : β}
:
theorem
Std.HashMap.Raw.getD_eq_getD_getElem?
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
{fallback : β}
:
m.getD a fallback = m[a]?.getD fallback
theorem
Std.HashMap.Raw.getElem_eq_getD
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
{fallback : β}
{h' : a ∈ m}
:
m[a] = m.getD a fallback
theorem
Std.HashMap.Raw.getElem!_eq_getD_default
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited β]
(h : m.WF)
{a : α}
:
m[a]! = m.getD a default
theorem
Std.HashMap.Raw.getD_congr
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a b : α}
{fallback : β}
(hab : (a == b) = true)
:
m.getD a fallback = m.getD b fallback
@[simp]
theorem
Std.HashMap.Raw.getKey?_empty
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
{a : α}
{c : Nat}
:
(Std.HashMap.Raw.empty c).getKey? a = none
theorem
Std.HashMap.Raw.getKey?_of_isEmpty
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getKey?_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{v : β}
:
@[simp]
theorem
Std.HashMap.Raw.getKey?_insert_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
theorem
Std.HashMap.Raw.contains_eq_isSome_getKey?
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
:
m.contains a = (m.getKey? a).isSome
theorem
Std.HashMap.Raw.getKey?_eq_none_of_contains_eq_false
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getKey?_eq_none
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getKey?_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
:
@[simp]
theorem
Std.HashMap.Raw.getKey?_erase_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
(m.erase k).getKey? k = none
theorem
Std.HashMap.Raw.getKey_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{v : β}
{h₁ : a ∈ m.insert k v}
:
@[simp]
theorem
Std.HashMap.Raw.getKey_insert_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
(m.insert k v).getKey k ⋯ = k
@[simp]
theorem
Std.HashMap.Raw.getKey_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{h' : a ∈ m.erase k}
:
(m.erase k).getKey a h' = m.getKey a ⋯
theorem
Std.HashMap.Raw.getKey?_eq_some_getKey
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
{h' : a ∈ m}
:
@[simp]
theorem
Std.HashMap.Raw.getKey!_empty
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
[Inhabited α]
{a : α}
{c : Nat}
:
(Std.HashMap.Raw.empty c).getKey! a = default
theorem
Std.HashMap.Raw.getKey!_of_isEmpty
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited α]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getKey!_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited α]
(h : m.WF)
{k a : α}
{v : β}
:
@[simp]
theorem
Std.HashMap.Raw.getKey!_insert_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited α]
(h : m.WF)
{k : α}
{v : β}
:
(m.insert k v).getKey! k = k
theorem
Std.HashMap.Raw.getKey!_eq_default_of_contains_eq_false
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited α]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getKey!_eq_default
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited α]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getKey!_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited α]
(h : m.WF)
{k a : α}
:
@[simp]
theorem
Std.HashMap.Raw.getKey!_erase_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited α]
(h : m.WF)
{k : α}
:
(m.erase k).getKey! k = default
theorem
Std.HashMap.Raw.getKey?_eq_some_getKey!_of_contains
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited α]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getKey?_eq_some_getKey!
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited α]
(h : m.WF)
{a : α}
:
theorem
Std.HashMap.Raw.getKey!_eq_get!_getKey?
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited α]
(h : m.WF)
{a : α}
:
m.getKey! a = (m.getKey? a).get!
theorem
Std.HashMap.Raw.getKey_eq_getKey!
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited α]
(h : m.WF)
{a : α}
{h' : a ∈ m}
:
m.getKey a h' = m.getKey! a
@[simp]
theorem
Std.HashMap.Raw.getKeyD_empty
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
{a fallback : α}
{c : Nat}
:
(Std.HashMap.Raw.empty c).getKeyD a fallback = fallback
theorem
Std.HashMap.Raw.getKeyD_of_isEmpty
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a fallback : α}
:
theorem
Std.HashMap.Raw.getKeyD_insert
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a fallback : α}
{v : β}
:
@[simp]
theorem
Std.HashMap.Raw.getKeyD_insert_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k fallback : α}
{v : β}
:
(m.insert k v).getKeyD k fallback = k
theorem
Std.HashMap.Raw.getKeyD_eq_fallback_of_contains_eq_false
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a fallback : α}
:
theorem
Std.HashMap.Raw.getKeyD_eq_fallback
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a fallback : α}
:
theorem
Std.HashMap.Raw.getKeyD_erase
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a fallback : α}
:
@[simp]
theorem
Std.HashMap.Raw.getKeyD_erase_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k fallback : α}
:
(m.erase k).getKeyD k fallback = fallback
theorem
Std.HashMap.Raw.getKey?_eq_some_getKeyD_of_contains
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a fallback : α}
:
theorem
Std.HashMap.Raw.getKey?_eq_some_getKeyD
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a fallback : α}
:
theorem
Std.HashMap.Raw.getKeyD_eq_getD_getKey?
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a fallback : α}
:
m.getKeyD a fallback = (m.getKey? a).getD fallback
theorem
Std.HashMap.Raw.getKey_eq_getKeyD
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a fallback : α}
{h' : a ∈ m}
:
m.getKey a h' = m.getKeyD a fallback
theorem
Std.HashMap.Raw.getKey!_eq_getKeyD_default
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
[Inhabited α]
(h : m.WF)
{a : α}
:
m.getKey! a = m.getKeyD a default
@[simp]
theorem
Std.HashMap.Raw.isEmpty_insertIfNew
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
@[simp]
theorem
Std.HashMap.Raw.contains_insertIfNew
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{v : β}
:
theorem
Std.HashMap.Raw.contains_insertIfNew_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
theorem
Std.HashMap.Raw.mem_insertIfNew_self
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
k ∈ m.insertIfNew k v
theorem
Std.HashMap.Raw.mem_of_mem_insertIfNew
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{v : β}
:
theorem
Std.HashMap.Raw.contains_of_contains_insertIfNew'
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{v : β}
:
This is a restatement of contains_insertIfNew
that is written to exactly match the proof
obligation in the statement of getElem_insertIfNew
.
theorem
Std.HashMap.Raw.mem_of_mem_insertIfNew'
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{v : β}
:
This is a restatement of mem_insertIfNew
that is written to exactly match the proof obligation
in the statement of getElem_insertIfNew
.
theorem
Std.HashMap.Raw.size_insertIfNew
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
theorem
Std.HashMap.Raw.size_le_size_insertIfNew
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
m.size ≤ (m.insertIfNew k v).size
theorem
Std.HashMap.Raw.size_insertIfNew_le
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β}
:
@[simp]
theorem
Std.HashMap.Raw.getThenInsertIfNew?_fst
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
(h : m.WF)
{k : α}
{v : β}
:
(m.getThenInsertIfNew? k v).fst = m.get? k
@[simp]
theorem
Std.HashMap.Raw.getThenInsertIfNew?_snd
{α : Type u}
{β : Type v}
{m : Std.HashMap.Raw α β}
[BEq α]
[Hashable α]
(h : m.WF)
{k : α}
{v : β}
:
(m.getThenInsertIfNew? k v).snd = m.insertIfNew k v