| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Properties of divisibility over commutative semigroups |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Algebra using (CommutativeSemigroup) |
| 10 |
open import Data.Product.Base using (_,_) |
| 11 |
import Relation.Binary.Reasoning.Setoid as ≈-Reasoning |
| 12 |
|
| 13 |
module Algebra.Properties.CommutativeSemigroup.Divisibility |
| 14 |
{a ℓ} (CS : CommutativeSemigroup a ℓ) |
| 15 |
where |
| 16 |
|
| 17 |
open CommutativeSemigroup CS |
| 18 |
open import Algebra.Properties.CommutativeSemigroup CS |
| 19 |
using (interchange; x∙yz≈xz∙y; x∙yz≈y∙xz) |
| 20 |
open ≈-Reasoning setoid |
| 21 |
|
| 22 |
------------------------------------------------------------------------ |
| 23 |
-- Re-export the contents of divisibility over semigroups |
| 24 |
|
| 25 |
open import Algebra.Properties.Semigroup.Divisibility semigroup public |
| 26 |
|
| 27 |
------------------------------------------------------------------------ |
| 28 |
-- Re-export the contents of divisibility over commutative magmas |
| 29 |
|
| 30 |
open import Algebra.Properties.CommutativeMagma.Divisibility commutativeMagma public |
| 31 |
using (x∣xy; xy≈z⇒x∣z; ∣-factors; ∣-factors-≈) |
| 32 |
|
| 33 |
------------------------------------------------------------------------ |
| 34 |
-- New properties |
| 35 |
|
| 36 |
x∣y∧z∣x/y⇒xz∣y : ∀ {x y z} → ((x/y , _) : x ∣ y) → z ∣ x/y → x ∙ z ∣ y |
| 37 |
x∣y∧z∣x/y⇒xz∣y {x} {y} {z} (x/y , x/y∙x≈y) (p , pz≈x/y) = p , (begin |
| 38 |
p ∙ (x ∙ z) ≈⟨ x∙yz≈xz∙y p x z ⟩ |
| 39 |
(p ∙ z) ∙ x ≈⟨ ∙-congʳ pz≈x/y ⟩ |
| 40 |
x/y ∙ x ≈⟨ x/y∙x≈y ⟩ |
| 41 |
y ∎) |
| 42 |
|
| 43 |
∙-cong-∣ : ∀ {x y a b} → x ∣ y → a ∣ b → x ∙ a ∣ y ∙ b |
| 44 |
∙-cong-∣ {x} {y} {a} {b} (p , px≈y) (q , qa≈b) = p ∙ q , (begin |
| 45 |
(p ∙ q) ∙ (x ∙ a) ≈⟨ interchange p q x a ⟩ |
| 46 |
(p ∙ x) ∙ (q ∙ a) ≈⟨ ∙-cong px≈y qa≈b ⟩ |
| 47 |
y ∙ b ∎) |
| 48 |
|
| 49 |
x∣y⇒zx∣zy : ∀ {x y} z → x ∣ y → z ∙ x ∣ z ∙ y |
| 50 |
x∣y⇒zx∣zy {x} {y} z (q , qx≈y) = q , (begin |
| 51 |
q ∙ (z ∙ x) ≈⟨ x∙yz≈y∙xz q z x ⟩ |
| 52 |
z ∙ (q ∙ x) ≈⟨ ∙-congˡ qx≈y ⟩ |
| 53 |
z ∙ y ∎) |