Examples.Classical.CommutativeSemigroup¶
Worked example: (ℕ, +) as a commutative semigroup¶
This is the Examples.Classical.CommutativeSemigroup module of the Agda Universal Algebra Library.
The natural numbers under addition, one theory up from
Examples.Classical.Semigroup: the same carrier and
operation, now additionally witnessing commutativity via stdlib's +-comm.
ℕ-commutativeSemigroup hands eqsToCommutativeSemigroup the carrier, the
operation, and the two laws +-assoc and +-comm. The acceptance check
∙-is-+-cs records that the accessor's curried _∙_ interprets to _+_ on the
nose, discharged by refl.
ℕ-commutativeSemigroup : CommutativeSemigroup ℕ-commutativeSemigroup = eqsToCommutativeSemigroup ℕ _+_ +-assoc +-comm open Polymorphic.CommutativeSemigroup-Op ℕ-commutativeSemigroup using ( _∙_ ) ∙-is-+-cs : ∀ (a b : ℕ) → a ∙ b ≡ a + b ∙-is-+-cs a b = refl