lean4-htt/tests/lean/grind/module_relations.lean
Kim Morrison 3790f8c78e
chore: deduplicate Grind.RatModule and Grind.NoNatZeroDivisors (#8416)
Also adds instances from e.g. `Semiring` to `NatModule` and `Ring` to
`IntModule`.
2025-05-20 07:49:42 +00:00

27 lines
940 B
Text

-- Tests for `grind` as solver for linear equations in an `IntModule` or `RatModule`.
open Lean.Grind
section IntModule
variable (R : Type u) [IntModule R]
-- In an `IntModule`, we should be able to handle relations
-- this is harder, and less important, than being able to do this in `RatModule`.
example (a b : R) (h : a + b = 0) : 3 * a - 7 * b = 9 * a + a := by grind
example (a b c : R) (h : 2 * a + 2 * b = 4 * c) : 3 * a + c = 5 * c - b + (-b) + a := by grind
end IntModule
section RatModule
variable (R : Type u) [IntModule R] [NoNatZeroDivisors R]
example (a b : R) (h : a + b = 0) : 3 * a - 7 * b = 9 * a + a := by grind
example (a b c : R) (h : 2 * a + 2 * b = 4 * c) : 3 * a + c = 5 * c - b + (-b) + a := by grind
-- In a `RatModule` we can clear common divisors.
example (a : R) (h : a + a = 0) : a = 0 := by grind
example (a b c : R) (h : 2 * a + 2 * b = 4 * c) : 3 * a + c = 5 * c - 3 * b := by grind
end RatModule