| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Properties of Coprimality and Irreducibility for Semiring. |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Algebra.Bundles using (Semiring) |
| 10 |
|
| 11 |
module Algebra.Properties.Semiring.Primality |
| 12 |
{a ℓ} (R : Semiring a ℓ) |
| 13 |
where |
| 14 |
|
| 15 |
open import Data.Sum.Base using (reduce) |
| 16 |
open import Function.Base using (flip) |
| 17 |
open import Relation.Binary.Definitions using (Symmetric) |
| 18 |
|
| 19 |
open Semiring R renaming (Carrier to A) |
| 20 |
open import Algebra.Properties.Semiring.Divisibility R |
| 21 |
using (_∣_; ∣-trans; 0∤1) |
| 22 |
|
| 23 |
private |
| 24 |
variable |
| 25 |
x : A |
| 26 |
|
| 27 |
------------------------------------------------------------------------ |
| 28 |
-- Re-export primality definitions |
| 29 |
|
| 30 |
open import Algebra.Definitions.RawSemiring rawSemiring public |
| 31 |
using (Coprime; Prime; mkPrime; Irreducible; mkIrred) |
| 32 |
|
| 33 |
------------------------------------------------------------------------ |
| 34 |
-- Properties of Coprime |
| 35 |
|
| 36 |
Coprime-sym : Symmetric Coprime |
| 37 |
Coprime-sym coprime = flip coprime |
| 38 |
|
| 39 |
∣1⇒Coprime : ∀ y → x ∣ 1# → Coprime x y |
| 40 |
∣1⇒Coprime _ x∣1 z∣x _ = ∣-trans z∣x x∣1 |
| 41 |
|
| 42 |
------------------------------------------------------------------------ |
| 43 |
-- Properties of Irreducible |
| 44 |
|
| 45 |
Irreducible⇒≉0 : 0# ≉ 1# → ∀ {p} → Irreducible p → p ≉ 0# |
| 46 |
Irreducible⇒≉0 0≉1 (mkIrred _ chooseInvertible) p≈0 = |
| 47 |
0∤1 0≉1 (reduce (chooseInvertible (trans p≈0 (sym (zeroˡ 0#))))) |