| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Exponentiation over a semiring optimised for type-checking. |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Algebra.Bundles using (Semiring) |
| 10 |
|
| 11 |
module Algebra.Properties.Semiring.Exp.TCOptimised |
| 12 |
{a ℓ} (S : Semiring a ℓ) where |
| 13 |
|
| 14 |
open import Data.Nat.Base as ℕ using (zero; suc) |
| 15 |
import Data.Nat.Properties as ℕ using (+-suc; *-comm) |
| 16 |
open import Relation.Binary.Core using (_Preserves_⟶_; _Preserves₂_⟶_⟶_) |
| 17 |
open import Relation.Binary.PropositionalEquality.Core using (_≡_) |
| 18 |
open Semiring S renaming (zero to *-zero) |
| 19 |
open import Relation.Binary.Reasoning.Setoid setoid |
| 20 |
|
| 21 |
import Algebra.Properties.Monoid.Mult.TCOptimised *-monoid as Mult |
| 22 |
open import Algebra.Properties.Semiring.Exp S as U |
| 23 |
using () renaming (_^_ to _^ᵤ_) |
| 24 |
|
| 25 |
------------------------------------------------------------------------ |
| 26 |
-- Re-export definition from the monoid |
| 27 |
|
| 28 |
open import Algebra.Definitions.RawSemiring rawSemiring public |
| 29 |
using () renaming (_^′_ to _^_) |
| 30 |
|
| 31 |
------------------------------------------------------------------------ |
| 32 |
-- Properties of _^_ |
| 33 |
|
| 34 |
^-congˡ : ∀ n → (_^ n) Preserves _≈_ ⟶ _≈_ |
| 35 |
^-congˡ = Mult.×-congʳ |
| 36 |
|
| 37 |
^-cong : _^_ Preserves₂ _≈_ ⟶ _≡_ ⟶ _≈_ |
| 38 |
^-cong x≈y u≡v = Mult.×-cong u≡v x≈y |
| 39 |
|
| 40 |
-- xᵐ⁺ⁿ ≈ xᵐxⁿ |
| 41 |
^-homo-* : ∀ x m n → x ^ (m ℕ.+ n) ≈ (x ^ m) * (x ^ n) |
| 42 |
^-homo-* = Mult.×-homo-+ |
| 43 |
|
| 44 |
-- (xᵐ)ⁿ≈xᵐ*ⁿ |
| 45 |
^-assocʳ : ∀ x m n → (x ^ m) ^ n ≈ x ^ (m ℕ.* n) |
| 46 |
^-assocʳ x m n rewrite ℕ.*-comm m n = Mult.×-assocˡ x n m |