Compare commits

...

1 Commits

Author SHA1 Message Date
Kim Morrison
e9efd52f22 feat: add @[grind ext] attributes for extensional maps 2025-10-28 16:13:47 +11:00
7 changed files with 23 additions and 6 deletions

View File

@@ -2791,7 +2791,7 @@ section Ext
variable {m₁ m₂ : Std.ExtDHashMap α β}
@[ext]
@[ext, grind ext]
theorem ext_get? [LawfulBEq α] {m₁ m₂ : Std.ExtDHashMap α β} (h : k, m₁.get? k = m₂.get? k) : m₁ = m₂ :=
m₁.inductionOn₂ m₂ (fun _ _ h => sound (.of_forall_get?_eq h)) h

View File

@@ -4369,7 +4369,7 @@ section Ext
variable {t₁ t₂ : ExtDTreeMap α β cmp}
@[ext]
@[ext, grind ext]
theorem ext_get? [TransCmp cmp] [LawfulEqCmp cmp] {t₁ t₂ : ExtDTreeMap α β cmp}
(h : k, t₁.get? k = t₂.get? k) : t₁ = t₂ :=
t₁.inductionOn₂ t₂ (fun _ _ h => sound (.of_forall_get?_eq h)) h

View File

@@ -1698,7 +1698,7 @@ section Ext
variable {m₁ m₂ : ExtHashMap α β}
@[ext 900]
@[ext 900, grind ext]
theorem ext_getKey_getElem? [EquivBEq α] [LawfulHashable α]
{m₁ m₂ : ExtHashMap α β}
(hk : k hk hk', m₁.getKey k hk = m₂.getKey k hk')

View File

@@ -669,7 +669,7 @@ end
section Ext
@[ext 900]
@[ext 900, grind ext]
theorem ext_get? [EquivBEq α] [LawfulHashable α] {m₁ m₂ : ExtHashSet α}
(h : k, m₁.get? k = m₂.get? k) : m₁ = m₂ :=
ext (ExtHashMap.ext_getKey?_unit h)

View File

@@ -3015,7 +3015,7 @@ section Ext
variable {t₁ t₂ : ExtTreeMap α β cmp}
@[ext 900]
@[ext 900, grind ext]
theorem ext_getKey_getElem? [TransCmp cmp] {t₁ t₂ : ExtTreeMap α β cmp}
(hk : k hk hk', t₁.getKey k hk = t₂.getKey k hk')
(hv : k : α, t₁[k]? = t₂[k]?) : t₁ = t₂ :=

View File

@@ -1544,7 +1544,7 @@ section Ext
variable {t₁ t₂ : ExtTreeSet α cmp}
@[ext 900]
@[ext 900, grind ext]
theorem ext_get? [TransCmp cmp] {t₁ t₂ : ExtTreeSet α cmp}
(h : k, t₁.get? k = t₂.get? k) : t₁ = t₂ :=
ext (ExtTreeMap.ext_getKey?_unit h)

View File

@@ -0,0 +1,17 @@
import Std
open Std
example {cmp : α α Ordering} [TransCmp cmp] (m : ExtTreeSet α cmp) (x : α) :
(m.insert x).erase x = m.erase x := by
grind
example (m : ExtTreeSet Nat compare) (x : Nat) : (m.insert x).erase x = m.erase x := by
grind
example [BEq α] [EquivBEq α] [Hashable α] [LawfulHashable α] (m : ExtHashSet α) (x : α) :
(m.insert x).erase x = m.erase x := by
grind
example (m : ExtHashMap Int Int) (x y : Int) : (m.insert x y).erase x = m.erase x := by
grind