Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ add ] Algebra.Definitions.Integral and its consequences #2563

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Next Next commit
add: definitions and one consequence
  • Loading branch information
jamesmckinna committed Jan 24, 2025
commit 74f82751113455ec48bf699ab95fc738dd46a08b
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,10 @@ Additions to existing modules
quasiring : Quasiring c ℓ → Quasiring (a ⊔ c) (a ⊔ ℓ)
commutativeRing : CommutativeRing c ℓ → CommutativeRing (a ⊔ c) (a ⊔ ℓ)
```

* In `Algebra.Definitions`:
```agda
NoZeroDivisors : A → Op₂ A → Set _
Integral : A → A → Op₂ A → Set _
```
(see [discussion on issue #2554](https://github.com/agda/agda-stdlib/issues/2554))
9 changes: 9 additions & 0 deletions src/Algebra/Consequences/Base.agda
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ open import Algebra.Definitions
open import Data.Sum.Base
open import Relation.Binary.Core
open import Relation.Binary.Definitions using (Reflexive)
open import Relation.Nullary.Negation.Core using (¬_; contradiction)

module _ {ℓ} {_•_ : Op₂ A} (_≈_ : Rel A ℓ) where

Expand All @@ -28,6 +29,14 @@ module _ {ℓ} {f : Op₁ A} (_≈_ : Rel A ℓ) where
Involutive _≈_ f
reflexive∧selfInverse⇒involutive refl inv _ = inv refl

module _ {ℓ} {_•_ : Op₂ A} {0# 1# : A} (_≈_ : Rel A ℓ) where

integral⇒noZeroDivisors : Integral _≈_ 1# 0# _•_ → ¬ (1# ≈ 0#) →
NoZeroDivisors _≈_ 0# _•_
integral⇒noZeroDivisors (inj₁ 1#≈0#) = contradiction 1#≈0#
integral⇒noZeroDivisors (inj₂ noZeroDivisors) = λ _ → noZeroDivisors


------------------------------------------------------------------------
-- DEPRECATED NAMES
------------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions src/Algebra/Definitions.agda
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ RightZero z _∙_ = ∀ x → (x ∙ z) ≈ z
Zero : A → Op₂ A → Set _
Zero z ∙ = (LeftZero z ∙) × (RightZero z ∙)

NoZeroDivisors : A → Op₂ A → Set _
NoZeroDivisors z _∙_ = ∀ {x y} → (x ∙ y) ≈ z → x ≈ z ⊎ y ≈ z

Integral : A → A → Op₂ A → Set _
Integral 1# 0# _∙_ = 1# ≈ 0# ⊎ NoZeroDivisors 0# _∙_
Copy link
Member

@Taneb Taneb Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming that 0# and 1# have their normal properties wrt multiplication, 1# ≈ 0# implies all other equalities:
x = 1*x = 0*x = 0 = 0*y = 1*y = y

In particular, this means that it satisfies NoZeroDivisors 0# anyway. So we don't need to special-case 1# ≈ 0#


LeftInverse : A → Op₁ A → Op₂ A → Set _
LeftInverse e _⁻¹ _∙_ = ∀ x → ((x ⁻¹) ∙ x) ≈ e

Expand Down