| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- An explanation about how to use the solver in Tactic.MonoidSolver. |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
open import Algebra |
| 8 |
|
| 9 |
module README.Tactic.MonoidSolver {a ℓ} (M : Monoid a ℓ) where |
| 10 |
|
| 11 |
open Monoid M |
| 12 |
|
| 13 |
open import Relation.Binary.Reasoning.Setoid setoid |
| 14 |
|
| 15 |
open import Tactic.MonoidSolver using (solve) |
| 16 |
|
| 17 |
-- The monoid solver is capable to of solving equations without having |
| 18 |
-- to specify the equation itself in the proof. |
| 19 |
|
| 20 |
example₁ : ∀ x y z → (x ∙ y) ∙ z ≈ x ∙ (y ∙ z) ∙ ε |
| 21 |
example₁ x y z = solve M |
| 22 |
|
| 23 |
-- The solver can also be used in equational reasoning. |
| 24 |
|
| 25 |
example₂ : ∀ w x y z → w ≈ x → (w ∙ y) ∙ z ≈ x ∙ (y ∙ z) ∙ ε |
| 26 |
example₂ w x y z w≈x = begin |
| 27 |
(w ∙ y) ∙ z ≈⟨ ∙-congʳ (∙-congʳ w≈x) ⟩ |
| 28 |
(x ∙ y) ∙ z ≈⟨ solve M ⟩ |
| 29 |
x ∙ (y ∙ z) ∙ ε ∎ |