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

opposite of a Ring #1900

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,14 @@ Other minor changes
moufangLoop : MoufangLoop a ℓ₁ → MoufangLoop b ℓ₂ → MoufangLoop (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
```

* Added new functions and proofs to `Algebra.Construct.Flip.Op`:
```agda
zero : Zero ≈ ε ∙ → Zero ≈ ε (flip ∙)
distributes : (≈ DistributesOver ∙) + → (≈ DistributesOver (flip ∙)) +
isRing : IsRing ≈ + * - 0# 1# → IsRing ≈ + (flip *) - 0# 1#
ring : Ring a ℓ → Ring a ℓ
```

* Added new definition to `Algebra.Definitions`:
```agda
LeftDividesˡ : Op₂ A → Op₂ A → Set _
Expand Down
29 changes: 29 additions & 0 deletions src/Algebra/Construct/Flip/Op.agda
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ module _ (≈ : Rel A ℓ) (∙ : Op₂ A) where
inverse : Inverse ≈ ε ⁻¹ ∙ → Inverse ≈ ε ⁻¹ (flip ∙)
inverse inv = Prod.swap inv

zero : Zero ≈ ε ∙ → Zero ≈ ε (flip ∙)
zero zer = Prod.swap zer

module _ (+ : Op₂ A) where

distributes : (≈ DistributesOver ∙) + → (≈ DistributesOver (flip ∙)) +
Copy link
Contributor

Choose a reason for hiding this comment

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

The other thing we could do to make this is a little nicer is to import Algebra.Definitions and Algebra.Structures locally in each anonymous module parameterised by the equality. Which would then allow us to avoid messing up the infix notation here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah... will now turn to this.

And it seems that this applies throughout, even to the original module contents: so I've now named each previously anonymous module, and opened it locally in place with the appropriate arguments. is this better now? See most recent commit.

distributes distrib = Prod.swap distrib

------------------------------------------------------------------------
-- Structures

Expand Down Expand Up @@ -163,6 +171,23 @@ module _ {≈ : Rel A ℓ} {∙ : Op₂ A} where
}
where module g = IsAbelianGroup g

module _ {≈ : Rel A ℓ} {+ * : Op₂ A} { - : Op₁ A} {0# 1# : A} where

isRing : IsRing ≈ + * - 0# 1# → IsRing ≈ + (flip *) - 0# 1#
isRing r = record
{ +-isAbelianGroup = r-isAbelianGroup
; *-cong = preserves₂ ≈ ≈ ≈ r.*-cong
; *-assoc = associative ≈ * sym r.*-assoc
; *-identity = identity ≈ * r.*-identity
; distrib = distributes ≈ * + r.distrib
; zero = zero ≈ * r.zero
}
where
module r = IsRing r
r-isAbelianGroup = r.+-isAbelianGroup
open IsAbelianGroup r-isAbelianGroup using (sym)


------------------------------------------------------------------------
-- Bundles

Expand Down Expand Up @@ -239,3 +264,7 @@ group g = record { isGroup = isGroup g.isGroup }
abelianGroup : AbelianGroup a ℓ → AbelianGroup a ℓ
abelianGroup g = record { isAbelianGroup = isAbelianGroup g.isAbelianGroup }
where module g = AbelianGroup g

ring : Ring a ℓ → Ring a ℓ
ring r = record { isRing = isRing r.isRing }
where module r = Ring r