| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Polynomial reasoning |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Tactic.RingSolver.Core.AlmostCommutativeRing |
| 10 |
|
| 11 |
-- Some specialised tools for equational reasoning. |
| 12 |
module Tactic.RingSolver.Core.Polynomial.Reasoning |
| 13 |
{a ℓ} (ring : AlmostCommutativeRing a ℓ) |
| 14 |
where |
| 15 |
|
| 16 |
open AlmostCommutativeRing ring |
| 17 |
open import Relation.Binary.Reasoning.Setoid setoid public |
| 18 |
|
| 19 |
infixr 1 ≪+_ +≫_ ≪*_ *≫_ |
| 20 |
infixr 0 _⊙_ |
| 21 |
|
| 22 |
≪+_ : ∀ {x₁ x₂ y} → x₁ ≈ x₂ → x₁ + y ≈ x₂ + y |
| 23 |
≪+ prf = +-cong prf refl |
| 24 |
{-# INLINE ≪+_ #-} |
| 25 |
|
| 26 |
+≫_ : ∀ {x y₁ y₂} → y₁ ≈ y₂ → x + y₁ ≈ x + y₂ |
| 27 |
+≫_ = +-cong refl |
| 28 |
{-# INLINE +≫_ #-} |
| 29 |
|
| 30 |
≪*_ : ∀ {x₁ x₂ y} → x₁ ≈ x₂ → x₁ * y ≈ x₂ * y |
| 31 |
≪* prf = *-cong prf refl |
| 32 |
{-# INLINE ≪*_ #-} |
| 33 |
|
| 34 |
*≫_ : ∀ {x y₁ y₂} → y₁ ≈ y₂ → x * y₁ ≈ x * y₂ |
| 35 |
*≫_ = *-cong refl |
| 36 |
{-# INLINE *≫_ #-} |
| 37 |
|
| 38 |
-- transitivity as an operator |
| 39 |
_⊙_ : ∀ {x y z} → x ≈ y → y ≈ z → x ≈ z |
| 40 |
_⊙_ = trans |
| 41 |
{-# INLINE _⊙_ #-} |