| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Multiplication over a semiring optimised for type-checking. |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Algebra |
| 10 |
open import Data.Nat.Base as ℕ using (zero; suc) |
| 11 |
|
| 12 |
module Algebra.Properties.Semiring.Mult.TCOptimised |
| 13 |
{a ℓ} (S : Semiring a ℓ) where |
| 14 |
|
| 15 |
open Semiring S renaming (zero to *-zero) |
| 16 |
open import Relation.Binary.Reasoning.Setoid setoid |
| 17 |
|
| 18 |
open import Algebra.Properties.Semiring.Mult S as U |
| 19 |
using () renaming (_×_ to _×ᵤ_) |
| 20 |
|
| 21 |
------------------------------------------------------------------------ |
| 22 |
-- Re-export definition from the monoid |
| 23 |
|
| 24 |
open import Algebra.Properties.Monoid.Mult.TCOptimised +-monoid public |
| 25 |
|
| 26 |
------------------------------------------------------------------------ |
| 27 |
-- Properties of _×_ |
| 28 |
|
| 29 |
-- (_×′ 1#) is homomorphic with respect to _ℕ.*_/_*_. |
| 30 |
|
| 31 |
×1-homo-* : ∀ m n → (m ℕ.* n) × 1# ≈ (m × 1#) * (n × 1#) |
| 32 |
×1-homo-* m n = begin |
| 33 |
(m ℕ.* n) × 1# ≈⟨ ×ᵤ≈× (m ℕ.* n) 1# ⟨ |
| 34 |
(m ℕ.* n) ×ᵤ 1# ≈⟨ U.×1-homo-* m n ⟩ |
| 35 |
(m ×ᵤ 1#) * (n ×ᵤ 1#) ≈⟨ *-cong (×ᵤ≈× m 1#) (×ᵤ≈× n 1#) ⟩ |
| 36 |
(m × 1#) * (n × 1#) ∎ |