Skip to content

[Add] Consequences of associativity for Semigroups #2688

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

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0fc076f
Adds reasonig combinator for semigroup
jmougeot Apr 1, 2025
3399c61
Adds reasonig combinator for semigroup
jmougeot Apr 1, 2025
90fe273
Adds reasonig combinator for semigroup
jmougeot Apr 1, 2025
ef3282f
Adds reasonig combinator for semigroup
jmougeot Apr 1, 2025
63e88cc
Add some more missing reasoning combinators
jmougeot Apr 1, 2025
bb7ce15
add module Extends
jmougeot Apr 1, 2025
885d7a0
rename SemiGroup to Semigroup
jmougeot Apr 1, 2025
ad54a5b
fix-whitespace
jmougeot Apr 1, 2025
2b511c2
Update CHANGELOG.md
jmougeot Apr 2, 2025
8151123
New names
jmougeot Apr 3, 2025
2361b40
improve syntx
jmougeot Apr 3, 2025
503c693
fix-whitespace
jmougeot Apr 3, 2025
0d5c9ed
Name changes
jmougeot Apr 7, 2025
1a67eb9
Names change
jmougeot Apr 7, 2025
002cfad
Space
jmougeot Apr 7, 2025
a47bcc5
Proof of assoc with PUshes and Pulles
jmougeot Apr 8, 2025
ca9f576
Proof of assoc with PUshes and Pulles
jmougeot Apr 8, 2025
e07f81b
white space
jmougeot Apr 9, 2025
86b06e0
Update src/Algebra/Properties/Semigroup/Reasoning.agda
jmougeot Apr 10, 2025
7b72ff2
Reasoning to Semigroup and explicit variables
jmougeot Apr 11, 2025
13b5f0e
fix bug
jmougeot Apr 11, 2025
f58aceb
space
jmougeot Apr 11, 2025
74607d5
Update src/Algebra/Properties/Semigroup.agda
jmougeot Apr 14, 2025
e3b2550
Update CHANGELOG.md
jmougeot Apr 14, 2025
e63afbd
Update src/Algebra/Properties/Semigroup.agda
jmougeot Apr 14, 2025
b2bfa03
Update src/Algebra/Properties/Semigroup.agda
jmougeot Apr 14, 2025
14224b9
Update src/Algebra/Properties/Semigroup.agda
jmougeot Apr 14, 2025
76b6637
Update src/Algebra/Properties/Semigroup.agda
jmougeot Apr 14, 2025
06af327
Update src/Algebra/Properties/Semigroup.agda
jmougeot Apr 14, 2025
a22f97d
variables
jmougeot Apr 14, 2025
1283b57
update CHANGELOG
jmougeot Apr 16, 2025
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ New modules
Additions to existing modules
-----------------------------

* In `Algebra.Properties.Semigroup` adding consequences for associativity for semigroups

* In `Algebra.Construct.Pointwise`:
```agda
isNearSemiring : IsNearSemiring _≈_ _+_ _*_ 0# →
Expand Down
96 changes: 95 additions & 1 deletion src/Algebra/Properties/Semigroup.agda
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ open import Algebra using (Semigroup)

module Algebra.Properties.Semigroup {a ℓ} (S : Semigroup a ℓ) where

open import Data.Product.Base using (_,_)

open Semigroup S
open import Algebra.Definitions _≈_
open import Data.Product.Base using (_,_)
open import Relation.Binary.Reasoning.Setoid setoid

private
variable
u v w x y z : Carrier

x∙yz≈xy∙z : ∀ x y z → x ∙ (y ∙ z) ≈ (x ∙ y) ∙ z
x∙yz≈xy∙z x y z = sym (assoc x y z)
Expand All @@ -28,3 +34,91 @@ alternative = alternativeˡ , alternativeʳ

flexible : Flexible _∙_
flexible x y = assoc x y x

module _ (uv≈w : u ∙ v ≈ w) where
uv≈w⇒xu∙v≈xw : ∀ x → (x ∙ u) ∙ v ≈ x ∙ w
uv≈w⇒xu∙v≈xw x = trans (assoc x u v) (∙-congˡ uv≈w)

uv≈w⇒u∙vx≈wx : ∀ x → u ∙ (v ∙ x) ≈ w ∙ x
uv≈w⇒u∙vx≈wx x = trans (sym (assoc u v x)) (∙-congʳ uv≈w)

uv≈w⇒u[vx∙y]≈w∙xy : ∀ x y → u ∙ ((v ∙ x) ∙ y) ≈ w ∙ (x ∙ y)
uv≈w⇒u[vx∙y]≈w∙xy x y = trans (∙-congˡ (assoc v x y)) (uv≈w⇒u∙vx≈wx (x ∙ y))

uv≈w⇒x[uv∙y]≈x∙wy : ∀ x y → x ∙ (u ∙ (v ∙ y)) ≈ x ∙ (w ∙ y)
uv≈w⇒x[uv∙y]≈x∙wy x y = ∙-congˡ (uv≈w⇒u∙vx≈wx y)

uv≈w⇒[x∙yu]v≈x∙yw : ∀ x y → (x ∙ (y ∙ u)) ∙ v ≈ x ∙ (y ∙ w)
uv≈w⇒[x∙yu]v≈x∙yw x y = trans (assoc x (y ∙ u) v) (∙-congˡ (uv≈w⇒xu∙v≈xw y))

uv≈w⇒[xu∙v]y≈x∙wy : ∀ x y → ((x ∙ u) ∙ v) ∙ y ≈ x ∙ (w ∙ y)
uv≈w⇒[xu∙v]y≈x∙wy x y = trans (∙-congʳ (uv≈w⇒xu∙v≈xw x)) (assoc x w y)

uv≈w⇒[xy∙u]v≈x∙yw : ∀ x y → ((x ∙ y) ∙ u) ∙ v ≈ x ∙ (y ∙ w)
uv≈w⇒[xy∙u]v≈x∙yw x y = trans (∙-congʳ (assoc x y u)) (uv≈w⇒[x∙yu]v≈x∙yw x y )

module _ (uv≈w : u ∙ v ≈ w) where
uv≈w⇒xw≈xu∙v : ∀ x → x ∙ w ≈ (x ∙ u) ∙ v
uv≈w⇒xw≈xu∙v x = sym (uv≈w⇒xu∙v≈xw uv≈w x)

uv≈w⇒wx≈u∙vx : ∀ x → w ∙ x ≈ u ∙ (v ∙ x)
uv≈w⇒wx≈u∙vx x = sym (uv≈w⇒u∙vx≈wx uv≈w x)

uv≈w⇒w∙xy≈u[vx∙y] : ∀ x y → w ∙ (x ∙ y) ≈ u ∙ ((v ∙ x) ∙ y)
uv≈w⇒w∙xy≈u[vx∙y] x y = sym (uv≈w⇒u[vx∙y]≈w∙xy uv≈w x y)

uv≈w⇒x∙wy≈x[u∙vy] : ∀ x y → x ∙ (w ∙ y) ≈ x ∙ (u ∙ (v ∙ y))
uv≈w⇒x∙wy≈x[u∙vy] x y = sym (uv≈w⇒x[uv∙y]≈x∙wy uv≈w x y)

uv≈w⇒x∙yw≈[x∙yu]v : ∀ x y → x ∙ (y ∙ w) ≈ (x ∙ (y ∙ u)) ∙ v
uv≈w⇒x∙yw≈[x∙yu]v x y = sym (uv≈w⇒[x∙yu]v≈x∙yw uv≈w x y)

uv≈w⇒xu∙vy≈x∙wy : ∀ x y → (x ∙ u) ∙ (v ∙ y) ≈ x ∙ (w ∙ y)
uv≈w⇒xu∙vy≈x∙wy x y = uv≈w⇒xu∙v≈xw (uv≈w⇒u∙vx≈wx uv≈w y) x

uv≈w⇒xy≈z⇒u[vx∙y]≈wz : ∀ z → x ∙ y ≈ z → u ∙ ((v ∙ x) ∙ y) ≈ w ∙ z
uv≈w⇒xy≈z⇒u[vx∙y]≈wz z xy≈z = trans (∙-congˡ (uv≈w⇒xu∙v≈xw xy≈z v)) (uv≈w⇒u∙vx≈wx uv≈w z)

uv≈w⇒x∙wy≈x∙[u∙vy] : x ∙ (w ∙ y) ≈ x ∙ (u ∙ (v ∙ y))
uv≈w⇒x∙wy≈x∙[u∙vy] = sym (uv≈w⇒x[uv∙y]≈x∙wy uv≈w _ _)

module _ {u v w x : Carrier} where
[uv∙w]x≈u[vw∙x] : ((u ∙ v) ∙ w) ∙ x ≈ u ∙ ((v ∙ w) ∙ x)
[uv∙w]x≈u[vw∙x] = uv≈w⇒[xu∙v]y≈x∙wy refl u x

[uv∙w]x≈u[v∙wx] : ((u ∙ v) ∙ w) ∙ x ≈ u ∙ (v ∙ (w ∙ x))
[uv∙w]x≈u[v∙wx] = uv≈w⇒[xy∙u]v≈x∙yw refl u v

[u∙vw]x≈uv∙wx : (u ∙ (v ∙ w)) ∙ x ≈ (u ∙ v) ∙ (w ∙ x)
[u∙vw]x≈uv∙wx = trans (sym (∙-congʳ (assoc u v w))) (assoc (u ∙ v) w x)

[u∙vw]x≈u[v∙wx] : (u ∙ (v ∙ w)) ∙ x ≈ u ∙ (v ∙ (w ∙ x))
[u∙vw]x≈u[v∙wx] = uv≈w⇒[x∙yu]v≈x∙yw refl u v

uv∙wx≈u[vw∙x] : (u ∙ v) ∙ (w ∙ x) ≈ u ∙ ((v ∙ w) ∙ x)
uv∙wx≈u[vw∙x] = uv≈w⇒xu∙vy≈x∙wy refl u x

uv∙wx≈[u∙vw]x : (u ∙ v) ∙ (w ∙ x) ≈ (u ∙ (v ∙ w)) ∙ x
uv∙wx≈[u∙vw]x = sym [u∙vw]x≈uv∙wx

u[vw∙x]≈[uv∙w]x : u ∙ ((v ∙ w) ∙ x) ≈ ((u ∙ v) ∙ w) ∙ x
u[vw∙x]≈[uv∙w]x = sym [uv∙w]x≈u[vw∙x]

u[vw∙x]≈uv∙wx : u ∙ ((v ∙ w) ∙ x) ≈ (u ∙ v) ∙ (w ∙ x)
u[vw∙x]≈uv∙wx = sym uv∙wx≈u[vw∙x]

u[v∙wx]≈[uv∙w]x : u ∙ (v ∙ (w ∙ x)) ≈ ((u ∙ v) ∙ w) ∙ x
u[v∙wx]≈[uv∙w]x = sym [uv∙w]x≈u[v∙wx]

u[v∙wx]≈[u∙vw]x : u ∙ (v ∙ (w ∙ x)) ≈ (u ∙ (v ∙ w)) ∙ x
u[v∙wx]≈[u∙vw]x = sym [u∙vw]x≈u[v∙wx]

module _ {u v w x : Carrier} (uv≈wx : u ∙ v ≈ w ∙ x) where
uv≈wx⇒yu∙v≈yw∙x : ∀ y → (y ∙ u) ∙ v ≈ (y ∙ w) ∙ x
uv≈wx⇒yu∙v≈yw∙x y = trans (uv≈w⇒xu∙v≈xw uv≈wx y) (sym (assoc y w x))

uv≈wx⇒u∙vy≈w∙xy : ∀ y → u ∙ (v ∙ y) ≈ w ∙ (x ∙ y)
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)))