Debian Codegraph @

src/Data/Integer/Tactic/RingSolver.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Automatic solvers for equations over integers
5 ------------------------------------------------------------------------
6
7 -- See README.Tactic.RingSolver for examples of how to use this solver
8
9 {-# OPTIONS --cubical-compatible --safe #-}
10
11 module Data.Integer.Tactic.RingSolver where
12
13 open import Agda.Builtin.Reflection
14
15 open import Data.Maybe.Base using (just; nothing)
16 open import Data.Integer.Base using (+0)
17 open import Data.Integer.Properties using (+-*-commutativeRing)
18 open import Level using (0ℓ)
19 open import Data.Unit.Base using (⊤)
20 open import Relation.Binary.PropositionalEquality.Core using (refl)
21 import Tactic.RingSolver as Solver using (solve-∀-macro; solve-macro)
22 import Tactic.RingSolver.Core.AlmostCommutativeRing as ACR
23 using (AlmostCommutativeRing; fromCommutativeRing)
24
25 ------------------------------------------------------------------------
26 -- A module for automatically solving propositional equivalences
27 -- containing _+_ and _*_
28
29 ring : ACR.AlmostCommutativeRing 0ℓ 0ℓ
30 ring = ACR.fromCommutativeRing +-*-commutativeRing
31 λ { +0 → just refl; _ → nothing }
32
33 macro
34 solve-∀ : Term → TC ⊤
35 solve-∀ = Solver.solve-∀-macro (quote ring)
36
37 macro
38 solve : Term → Term → TC ⊤
39 solve n = Solver.solve-macro n (quote ring)