Dependent hash map lemmas #
This file contains lemmas about Std.Data.DHashMap.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 α
.
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem
Std.DHashMap.Raw.insert_eq_insert
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
{p : (a : α) × β a}
:
Insert.insert p m = m.insert p.fst p.snd
@[simp]
theorem
Std.DHashMap.Raw.mem_insert_self
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β k}
:
k ∈ m.insert k v
theorem
Std.DHashMap.Raw.size_le_size_insert
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β k}
:
m.size ≤ (m.insert k v).size
theorem
Std.DHashMap.Raw.size_erase_le
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
(m.erase k).size ≤ m.size
theorem
Std.DHashMap.Raw.contains_eq_isSome_getKey?
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a : α}
:
m.contains a = (m.getKey? a).isSome
@[simp]
theorem
Std.DHashMap.Raw.getKey_insert_self
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β k}
:
(m.insert k v).getKey k ⋯ = k
@[simp]
theorem
Std.DHashMap.Raw.getKeyD_insert_self
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a fallback : α}
{b : β a}
:
(m.insert a b).getKeyD a fallback = a
@[simp]
theorem
Std.DHashMap.Raw.getKeyD_erase_self
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k fallback : α}
:
(m.erase k).getKeyD k fallback = fallback
theorem
Std.DHashMap.Raw.getKeyD_eq_getD_getKey?
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{a fallback : α}
:
m.getKeyD a fallback = (m.getKey? a).getD fallback
theorem
Std.DHashMap.Raw.mem_insertIfNew_self
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β k}
:
k ∈ m.insertIfNew k v
theorem
Std.DHashMap.Raw.contains_of_contains_insertIfNew'
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{v : β k}
:
This is a restatement of contains_insertIfNew
that is written to exactly match the proof
obligation in the statement of get_insertIfNew
.
theorem
Std.DHashMap.Raw.mem_of_mem_insertIfNew'
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k a : α}
{v : β k}
:
This is a restatement of mem_insertIfNew
that is written to exactly match the proof obligation
in the statement of get_insertIfNew
.
theorem
Std.DHashMap.Raw.size_le_size_insertIfNew
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
{v : β k}
:
m.size ≤ (m.insertIfNew k v).size
@[simp]
theorem
Std.DHashMap.Raw.Const.getThenInsertIfNew?_fst
{α : Type u}
[BEq α]
[Hashable α]
{β : Type v}
{m : Raw α fun (x : α) => β}
(h : m.WF)
{k : α}
{v : β}
:
(getThenInsertIfNew? m k v).fst = get? m k
@[simp]
theorem
Std.DHashMap.Raw.Const.getThenInsertIfNew?_snd
{α : Type u}
[BEq α]
[Hashable α]
{β : Type v}
{m : Raw α fun (x : α) => β}
(h : m.WF)
{k : α}
{v : β}
:
(getThenInsertIfNew? m k v).snd = m.insertIfNew k v
@[simp]
theorem
Std.DHashMap.Raw.length_keys
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
:
m.keys.length = m.size
@[simp]
theorem
Std.DHashMap.Raw.isEmpty_keys
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
:
m.keys.isEmpty = m.isEmpty
@[simp]
theorem
Std.DHashMap.Raw.contains_keys
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
{k : α}
:
m.keys.contains k = m.contains k
theorem
Std.DHashMap.Raw.distinct_keys
{α : Type u}
{β : α → Type v}
{m : Raw α β}
[BEq α]
[Hashable α]
[EquivBEq α]
[LawfulHashable α]
(h : m.WF)
:
List.Pairwise (fun (a b : α) => (a == b) = false) m.keys