Compare commits

...

2 Commits

Author SHA1 Message Date
Kim Morrison
0ba9c88ccc fix 2025-07-25 18:34:19 +10:00
Kim Morrison
cb3a1316e2 chore: parameterize NoNatZeroDivisors by NatModule instead of HMul 2025-07-25 16:20:04 +10:00
3 changed files with 7 additions and 7 deletions

View File

@@ -255,7 +255,7 @@ For a module over the integers this is equivalent to
(See the alternative constructor `NoNatZeroDivisors.mk'`,
and the theorem `eq_zero_of_mul_eq_zero`.)
-/
class NoNatZeroDivisors (α : Type u) [HMul Nat α α] where
class NoNatZeroDivisors (α : Type u) [NatModule α] where
/-- If `k * a ≠ k * b` then `k ≠ 0` or `a ≠ b`.-/
no_nat_zero_divisors : (k : Nat) (a b : α), k 0 k * a = k * b a = b

View File

@@ -18,9 +18,9 @@ def getIsCharInst? (u : Level) (type : Expr) (semiringInst : Expr) : GoalM (Opti
return some (charInst, n)
def getNoZeroDivInst? (u : Level) (type : Expr) : GoalM (Option Expr) := do
let hmulType := mkApp3 (mkConst ``HMul [0, u, u]) (mkConst ``Nat []) type type
let some hmulInst synthInstance? hmulType | return none
let noZeroDivType := mkApp2 (mkConst ``Grind.NoNatZeroDivisors [u]) type hmulInst
let natModuleType := mkApp (mkConst ``Grind.NatModule [u]) type
let some natModuleInst synthInstance? natModuleType | return none
let noZeroDivType := mkApp2 (mkConst ``Grind.NoNatZeroDivisors [u]) type natModuleInst
synthInstance? noZeroDivType
end Lean.Meta.Grind.Arith

View File

@@ -103,9 +103,9 @@ private def mkOrderedRingInst? (u : Level) (type : Expr) (semiringInst? preorder
return some inst
private def mkNoNatZeroDivInst? (u : Level) (type : Expr) : GoalM (Option Expr) := do
let hmulNat := mkApp3 (mkConst ``HMul [0, u, u]) Nat.mkType type type
let some hmulInst synthInstance? hmulNat | return none
synthInstance? <| mkApp2 (mkConst ``Grind.NoNatZeroDivisors [u]) type hmulInst
let natModuleType := mkApp (mkConst ``Grind.NatModule [u]) type
let some natModuleInst synthInstance? natModuleType | return none
synthInstance? <| mkApp2 (mkConst ``Grind.NoNatZeroDivisors [u]) type natModuleInst
def getStructId? (type : Expr) : GoalM (Option Nat) := do
unless ( getConfig).linarith do return none