-
Notifications
You must be signed in to change notification settings - Fork 247
[Add] Consequences of identity for monoids
#2692
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: jamesmckinna <[email protected]>
Probably the 'best' thing to do is to mark this as blocked (on #2688 ), otherwise you'll end up with merge conflicts when that PR gets merged, and indeed to start afresh with this PR being on a branch based on |
|
||
module Algebra.Properties.Monoid.Reasoning {o ℓ} (M : Monoid o ℓ) where | ||
|
||
open import Algebra.Structures using (IsMagma) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As with #2688 there's no need to make this explicit, it's even an abstraction failure/violation to do so
Suggest corresponding title change for the PR in the spirit of that for #2688 ... |
monoids
Co-authored-by: jamesmckinna <[email protected]>
uv≈wx⇒u∙vy≈w∙xy y = trans (uv≈w⇒u∙vx≈wx uv≈wx y) (assoc w x y) | ||
|
||
uv≈wx⇒yu∙vz≈yw∙xz : ∀ y z → (y ∙ u) ∙ (v ∙ z) ≈ (y ∙ w) ∙ (x ∙ z) | ||
uv≈wx⇒yu∙vz≈yw∙xz y z = trans (uv≈w⇒xu∙v≈xw (uv≈wx⇒u∙vy≈w∙xy z) y)(sym (assoc y w (x ∙ z))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space
uv≈wx⇒yu∙vz≈yw∙xz y z = trans (uv≈w⇒xu∙v≈xw (uv≈wx⇒u∙vy≈w∙xy z) y)(sym (assoc y w (x ∙ z))) | |
uv≈wx⇒yu∙vz≈yw∙xz y z = trans (uv≈w⇒xu∙v≈xw (uv≈wx⇒u∙vy≈w∙xy z) y) (sym (assoc y w (x ∙ z))) |
Co-authored-by: jamesmckinna <[email protected]>
Co-authored-by: jamesmckinna <[email protected]>
Co-authored-by: jamesmckinna <[email protected]>
Co-authored-by: jamesmckinna <[email protected]>
Co-authored-by: jamesmckinna <[email protected]>
Co-authored-by: jamesmckinna <[email protected]>
Co-authored-by: jamesmckinna <[email protected]>
id-comm-sym : ∀ a → ε ∙ a ≈ a ∙ ε | ||
id-comm-sym a = sym (id-comm a) | ||
|
||
module _ {a b : Carrier} (a≈ε : a ≈ ε) where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the variable
block above means you don't need {a b : Carrier}
anymore
elimˡ b = trans (∙-congʳ a≈ε) (identityˡ b) | ||
|
||
introʳ : ∀ b → b ≈ b ∙ a | ||
introʳ b = sym (elimʳ b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eta-reduce, here and next
introˡ b = sym (elimˡ b) | ||
|
||
introcenter : ∀ c → b ∙ c ≈ b ∙ (a ∙ c) | ||
introcenter c = trans (∙-congˡ (sym (identityˡ c))) (∙-congˡ (∙-congʳ (sym a≈ε))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should use a superscript m
(for 'middle') or c
(for, indeed, 'center') instead of spelling it out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meta: a good general point that, besides 'left' and 'right' (modulo collective mutual misunderstanding/inconsistency about what such conventions might even mean #2654 ), we don't have good heuristics about super-/sub-scripts and their intended semantics. I think I'd be happy with ᶜ
or ᵐ
... but nervous about establishing a precedent without further thought/discussion?
CHANGELOG.md
Outdated
@@ -123,7 +123,7 @@ New modules | |||
|
|||
* `Data.Sign.Show` to show a sign | |||
|
|||
Additions to existing modules | |||
* `Algebra.Properties.Semigroup` adding consequences for associatvity for semigroups |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you need to revert this change.
The lemmas added to Algebra.Properties.Semigroup
should each be added in an Agda code block under this line moved to be a sub-heading underneath this section heading...
|
||
open import Algebra.Bundles using (Monoid) | ||
|
||
module Algebra.Properties.Monoid.Reasoning {o ℓ} (M : Monoid o ℓ) where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As usual: these lemmas belong in Algebra.Properties.Monoid
, not in a separate module as you have it.
By all means do initial development in that style before raising a PR, or else mark it as DRAFT
(and hence not ready-for-review) but once you do raise the PR/ask for review, we do need it to be compatible both with the existing stdlib
hierarchy/structure, but also with the style-guide
, or else we will expend a lot of extra reviewing energy on things which should have been fixed ahead of time.
Co-authored-by: jamesmckinna <[email protected]>
Co-authored-by: jamesmckinna <[email protected]>
module _ (inv : a ∙ c ≈ ε) where | ||
|
||
cancelʳ : ∀ b → (b ∙ a) ∙ c ≈ b | ||
cancelʳ b = trans (assoc b a c) (trans (∙-congˡ inv) (identityʳ b)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm quite sure this can be done in 2 steps via one of the Semigroup combinators. Same for on the left.
Introduce reasoning combinators for monoids.
This PR is intended to focus on the
Monoid.Reasoning
filr as the discussion regarding theSemigroup.reasonig
file is in the PR : #2688I went with the names from agda-categories since they seemed to make sense.