This PR adds draft typeclasses for `grind` to process facts about ordered modules. These interfaces will evolve as the implementation develops.
27 lines
962 B
Text
27 lines
962 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) [RatModule 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
|