{-# OPTIONS --cubical-compatible --safe #-}
open import Algebra.Bundles using (RawSemiring)
open import Data.Sum.Base using (_⊎_)
open import Data.Nat using (ℕ; zero; suc)
open import Level using (_⊔_)
open import Relation.Binary.Core using (Rel)
module Algebra.Definitions.RawSemiring {a ℓ} (M : RawSemiring a ℓ) where
open RawSemiring M renaming (Carrier to A)
open import Algebra.Definitions.RawMonoid +-rawMonoid public
using
( _×_
; _×′_
; sum
)
open import Algebra.Definitions.RawMonoid *-rawMonoid as Mult public
using
( _∣_
; _∤_
)
renaming
( sum to product
)
infixr 8 _^_
_^_ : A → ℕ → A
x ^ n = n Mult.× x
infixr 8 _^′_
_^′_ : A → ℕ → A
x ^′ n = n Mult.×′ x
{-# INLINE _^′_ #-}
infixr 8 _^[_]*_ _^ᵗ_
_^[_]*_ : A → ℕ → A → A
x ^[ zero ]* y = y
x ^[ suc n ]* y = x ^[ n ]* (x * y)
_^ᵗ_ : A → ℕ → A
x ^ᵗ n = x ^[ n ]* 1#
Coprime : Rel A (a ⊔ ℓ)
Coprime x y = ∀ {z} → z ∣ x → z ∣ y → z ∣ 1#
record Irreducible (p : A) : Set (a ⊔ ℓ) where
constructor mkIrred
field
p∤1 : p ∤ 1#
split-∣1 : ∀ {x y} → p ≈ (x * y) → x ∣ 1# ⊎ y ∣ 1#
record Prime (p : A) : Set (a ⊔ ℓ) where
constructor mkPrime
field
p≉0 : p ≉ 0#
p∤1 : p ∤ 1#
split-∣ : ∀ {x y} → p ∣ x * y → p ∣ x ⊎ p ∣ y