chore: adjust HashMap grind lemmas (#8587)

This PR adjusts the grind annotation on
`Std.HashMap.map_fst_toList_eq_keys` and variants, so `grind` can reason
bidirectionally between `m.keys` and `m.toList`.
This commit is contained in:
Kim Morrison 2025-06-02 22:50:21 +10:00 committed by GitHub
parent add3e1ae12
commit 47b353f155
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 12 additions and 12 deletions

View file

@ -1158,7 +1158,7 @@ theorem distinct_keys [EquivBEq α] [LawfulHashable α] :
m.keys.Pairwise (fun a b => (a == b) = false) :=
Raw₀.distinct_keys ⟨m.1, m.2.size_buckets_pos⟩ m.2
@[simp, grind =]
@[simp, grind _=_]
theorem map_fst_toList_eq_keys [EquivBEq α] [LawfulHashable α] :
m.toList.map Sigma.fst = m.keys :=
Raw₀.map_fst_toList_eq_keys ⟨m.1, m.2.size_buckets_pos⟩
@ -1209,7 +1209,7 @@ namespace Const
variable {β : Type v} {m : DHashMap α (fun _ => β)}
@[simp, grind =]
@[simp, grind _=_]
theorem map_fst_toList_eq_keys [EquivBEq α] [LawfulHashable α] :
(toList m).map Prod.fst = m.keys :=
Raw₀.Const.map_fst_toList_eq_keys ⟨m.1, m.2.size_buckets_pos⟩

View file

@ -1226,7 +1226,7 @@ theorem distinct_keys [EquivBEq α] [LawfulHashable α] (h : m.WF) :
m.keys.Pairwise (fun a b => (a == b) = false) := by
simp_to_raw using Raw₀.distinct_keys ⟨m, h.size_buckets_pos⟩ h
@[simp, grind =]
@[simp, grind _=_]
theorem map_fst_toList_eq_keys [EquivBEq α] [LawfulHashable α] (h : m.WF) :
m.toList.map Sigma.fst = m.keys := by
apply Raw₀.map_fst_toList_eq_keys ⟨m, h.size_buckets_pos⟩
@ -1277,7 +1277,7 @@ namespace Const
variable {β : Type v} {m : Raw α (fun _ => β)}
@[simp, grind =]
@[simp, grind _=_]
theorem map_fst_toList_eq_keys [EquivBEq α] [LawfulHashable α] (h : m.WF) :
(Raw.Const.toList m).map Prod.fst = m.keys := by
apply Raw₀.Const.map_fst_toList_eq_keys ⟨m, h.size_buckets_pos⟩

View file

@ -1053,7 +1053,7 @@ theorem ordered_keys [TransCmp cmp] :
t.keys.Pairwise (fun a b => cmp a b = .lt) :=
Impl.ordered_keys t.wf
@[simp, grind =]
@[simp, grind _=_]
theorem map_fst_toList_eq_keys :
t.toList.map Sigma.fst = t.keys :=
Impl.map_fst_toList_eq_keys
@ -1098,7 +1098,7 @@ namespace Const
variable {β : Type v} {t : DTreeMap α β cmp}
@[simp, grind =]
@[simp, grind _=_]
theorem map_fst_toList_eq_keys :
(toList t).map Prod.fst = t.keys :=
Impl.Const.map_fst_toList_eq_keys

View file

@ -1063,7 +1063,7 @@ theorem ordered_keys [TransCmp cmp] (h : t.WF) :
t.keys.Pairwise (fun a b => cmp a b = .lt) :=
Impl.ordered_keys h.out
@[simp, grind =]
@[simp, grind _=_]
theorem map_fst_toList_eq_keys :
t.toList.map Sigma.fst = t.keys :=
Impl.map_fst_toList_eq_keys
@ -1108,7 +1108,7 @@ namespace Const
variable {β : Type v} {t : Raw α β cmp}
@[simp, grind =]
@[simp, grind _=_]
theorem map_fst_toList_eq_keys :
(toList t).map Prod.fst = t.keys :=
Impl.Const.map_fst_toList_eq_keys

View file

@ -854,7 +854,7 @@ theorem distinct_keys [EquivBEq α] [LawfulHashable α] :
m.keys.Pairwise (fun a b => (a == b) = false) :=
DHashMap.distinct_keys
@[simp, grind =]
@[simp, grind _=_]
theorem map_fst_toList_eq_keys [EquivBEq α] [LawfulHashable α] :
m.toList.map Prod.fst = m.keys :=
DHashMap.Const.map_fst_toList_eq_keys

View file

@ -869,7 +869,7 @@ theorem distinct_keys [EquivBEq α] [LawfulHashable α] (h : m.WF) :
m.keys.Pairwise (fun a b => (a == b) = false) :=
DHashMap.Raw.distinct_keys h.out
@[simp, grind =]
@[simp, grind _=_]
theorem map_fst_toList_eq_keys [EquivBEq α] [LawfulHashable α] (h : m.WF) :
m.toList.map Prod.fst = m.keys :=
DHashMap.Raw.Const.map_fst_toList_eq_keys h.out

View file

@ -795,7 +795,7 @@ theorem ordered_keys [TransCmp cmp] :
t.keys.Pairwise (fun a b => cmp a b = .lt) :=
DTreeMap.ordered_keys
@[simp, grind =]
@[simp, grind _=_]
theorem map_fst_toList_eq_keys :
(toList t).map Prod.fst = t.keys :=
DTreeMap.Const.map_fst_toList_eq_keys

View file

@ -789,7 +789,7 @@ theorem ordered_keys [TransCmp cmp] (h : t.WF) :
t.keys.Pairwise (fun a b => cmp a b = .lt) :=
DTreeMap.Raw.ordered_keys h
@[simp, grind =]
@[simp, grind _=_]
theorem map_fst_toList_eq_keys :
(toList t).map Prod.fst = t.keys :=
DTreeMap.Raw.Const.map_fst_toList_eq_keys