Skip to content

[fix] added raw bundles to Data.Nat.Base #1861

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

Merged
merged 5 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,13 @@ Other minor changes
_⊓′_ : ℕ → ℕ → ℕ
∣_-_∣′ : ℕ → ℕ → ℕ
_! : ℕ → ℕ

+-rawMagma : RawMagma 0ℓ 0ℓ
+-0-rawMonoid : RawMonoid 0ℓ 0ℓ
*-rawMagma : RawMagma 0ℓ 0ℓ
*-1-rawMonoid : RawMonoid 0ℓ 0ℓ
+-*-rawNearSemiring : RawNearSemiring 0ℓ 0ℓ
+-*-rawSemiring : RawSemiring 0ℓ 0ℓ
```


Expand Down
35 changes: 34 additions & 1 deletion src/Data/Nat/Base.agda
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

module Data.Nat.Base where

open import Algebra.Bundles.Raw using (RawMagma; RawMonoid)
open import Algebra.Bundles.Raw using (RawMagma; RawMonoid; RawNearSemiring; RawSemiring)
open import Data.Bool.Base using (Bool; true; false; T; not)
open import Level using (0ℓ)
open import Relation.Binary.Core using (Rel)
Expand Down Expand Up @@ -323,3 +323,36 @@ compare (suc m) (suc n) with compare m n
; _∙_ = _+_
; ε = 0
}

*-rawMagma : RawMagma 0ℓ 0ℓ
*-rawMagma = record
{ _≈_ = _≡_
; _∙_ = _*_
}

*-1-rawMonoid : RawMonoid 0ℓ 0ℓ
*-1-rawMonoid = record
{ _≈_ = _≡_
; _∙_ = _*_
; ε = 1
}

+-*-rawNearSemiring : RawNearSemiring 0ℓ 0ℓ
+-*-rawNearSemiring = record
{ Carrier = _
; _≈_ = _≡_
; _+_ = _+_
; _*_ = _*_
; 0# = 0
}

+-*-rawSemiring : RawSemiring 0ℓ 0ℓ
+-*-rawSemiring = record
{ Carrier = _
; _≈_ = _≡_
; _+_ = _+_
; _*_ = _*_
; 0# = 0
; 1# = 1
}

6 changes: 3 additions & 3 deletions src/Data/Nat/Binary/Properties.agda
Original file line number Diff line number Diff line change
Expand Up @@ -983,19 +983,19 @@ toℕ-homo-* x y = aux x y (size x ℕ.+ size y) ℕₚ.≤-refl
|y|+1+|x|≤cnt = subst (ℕ._≤ cnt) eq |x|+1+|y|≤cnt


toℕ-isMagmaHomomorphism-* : IsMagmaHomomorphism *-rawMagma ℕₚ.*-rawMagma toℕ
toℕ-isMagmaHomomorphism-* : IsMagmaHomomorphism *-rawMagma ℕᵇ.*-rawMagma toℕ
toℕ-isMagmaHomomorphism-* = record
{ isRelHomomorphism = toℕ-isRelHomomorphism
; homo = toℕ-homo-*
}

toℕ-isMonoidHomomorphism-* : IsMonoidHomomorphism *-1-rawMonoid ℕₚ.*-1-rawMonoid toℕ
toℕ-isMonoidHomomorphism-* : IsMonoidHomomorphism *-1-rawMonoid ℕᵇ.*-1-rawMonoid toℕ
toℕ-isMonoidHomomorphism-* = record
{ isMagmaHomomorphism = toℕ-isMagmaHomomorphism-*
; ε-homo = refl
}

toℕ-isMonoidMonomorphism-* : IsMonoidMonomorphism *-1-rawMonoid ℕₚ.*-1-rawMonoid toℕ
toℕ-isMonoidMonomorphism-* : IsMonoidMonomorphism *-1-rawMonoid ℕᵇ.*-1-rawMonoid toℕ
toℕ-isMonoidMonomorphism-* = record
{ isMonoidHomomorphism = toℕ-isMonoidHomomorphism-*
; injective = toℕ-injective
Expand Down
13 changes: 0 additions & 13 deletions src/Data/Nat/Properties.agda
Original file line number Diff line number Diff line change
Expand Up @@ -845,19 +845,6 @@ m+n≮m m n = subst (_≮ m) (+-comm n m) (m+n≮n n m)
------------------------------------------------------------------------
-- Bundles

*-rawMagma : RawMagma 0ℓ 0ℓ
*-rawMagma = record
{ _≈_ = _≡_
; _∙_ = _*_
}

*-1-rawMonoid : RawMonoid 0ℓ 0ℓ
*-1-rawMonoid = record
{ _≈_ = _≡_
; _∙_ = _*_
; ε = 1
}

*-magma : Magma 0ℓ 0ℓ
*-magma = record
{ isMagma = *-isMagma
Expand Down