Skip to content

Commit

Permalink
Incorporate smaller remarks from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
monsterkrampe committed Dec 3, 2024
1 parent bddf6fb commit ae25818
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Std/Data/DHashMap/Internal/List/Associative.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2750,7 +2750,7 @@ theorem getValue_insertListConst_of_mem [BEq α] [PartialEquivBEq α]
. exact distinct

/-- Internal implementation detail of the hash map -/
def insertListIfNewUnit [BEq α] (l: List ((_ : α) × Unit))(toInsert: List α) :
def insertListIfNewUnit [BEq α] (l: List ((_ : α) × Unit)) (toInsert: List α) :
List ((_ : α) × Unit) :=
match toInsert with
| .nil => l
Expand Down
6 changes: 3 additions & 3 deletions src/Std/Data/DHashMap/Internal/RawLemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -984,14 +984,14 @@ theorem getKeyD_insertMany_list_of_mem [EquivBEq α] [LawfulHashable α] (h : m.
simp_to_model using getKeyD_insertList_of_mem

theorem size_insertMany_list [EquivBEq α] [LawfulHashable α] (h : m.1.WF)
{l : List ((a : α) × β a)} {distinct : List.Pairwise (fun a b => (a.1 == b.1) = false) l}:
{l : List ((a : α) × β a)} {distinct : l.Pairwise (fun a b => (a.1 == b.1) = false)} :
(∀ (a : α), ¬ (m.contains a ∧ (l.map Sigma.fst).contains a)) →
(m.insertMany l).1.1.size = m.1.size + l.length := by
simp_to_model using length_insertList

theorem isEmpty_insertMany_list_eq_false_of_isEmpty_eq_false [EquivBEq α] [LawfulHashable α]
(h : m.1.WF) {l : List ((a : α) × β a)}:
(m.1.isEmpty = false) → (m.insertMany l).1.1.isEmpty = false := by
(m.1.isEmpty = false) → (m.insertMany l).1.1.isEmpty = false := by
simp_to_model using isEmpty_insertList_eq_false_of_isEmpty_eq_false

theorem isEmpty_insertMany_list [EquivBEq α] [LawfulHashable α] (h : m.1.WF)
Expand All @@ -1000,7 +1000,7 @@ theorem isEmpty_insertMany_list [EquivBEq α] [LawfulHashable α] (h : m.1.WF)
simp_to_model using isEmpty_insertList

section
variable {β: Type v} (m: Raw₀ α (fun _ => β))
variable : Type v} (m : Raw₀ α (fun _ => β))

theorem get?_insertMany_list_of_contains_eq_false_const [EquivBEq α] [LawfulHashable α] (h : m.1.WF)
{l : List ((_ : α) × β)} {k : α} (h : (l.map Sigma.fst).contains k = false) :
Expand Down
11 changes: 0 additions & 11 deletions src/Std/Data/DHashMap/Internal/WF.lean
Original file line number Diff line number Diff line change
Expand Up @@ -708,17 +708,6 @@ theorem wfImp_filter [BEq α] [Hashable α] [EquivBEq α] [LawfulHashable α] {m

/-! # `insertListₘ` -/

theorem wfImp_insertListₘ [BEq α] [Hashable α] [EquivBEq α][LawfulHashable α] {m : Raw₀ α β}
{l : List ((a : α) × β a)} (h : Raw.WFImp m.1) : Raw.WFImp (m.insertListₘ l).1 := by
induction l generalizing m with
| nil =>
simp only [insertListₘ]
exact h
| cons hd tl ih =>
simp only [insertListₘ]
apply ih
apply wfImp_insert h

theorem toListModel_insertListₘ [BEq α] [Hashable α] [EquivBEq α][LawfulHashable α] {m : Raw₀ α β} {l : List ((a : α) × β a)} (h : Raw.WFImp m.1) :
Perm (toListModel (insertListₘ m l).1.buckets) (List.insertList (toListModel m.1.buckets) l) := by
induction l generalizing m with
Expand Down

0 comments on commit ae25818

Please sign in to comment.