Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a295308
added Functional Algebra Properties
guilhermehas Apr 17, 2023
3037439
put some things in Base
guilhermehas Apr 17, 2023
468bb69
added changelog
guilhermehas Apr 17, 2023
700b114
added the names
guilhermehas Apr 17, 2023
623d474
changed VC to Vector Carrier
guilhermehas Apr 17, 2023
a5f6a10
changed semiGroup to semigroup
guilhermehas Apr 17, 2023
514ef92
modified the CHANGELOG
guilhermehas Apr 17, 2023
ce75303
added all the definitions
guilhermehas Apr 17, 2023
7d62c1c
changed to commutative ring to add module
guilhermehas Apr 17, 2023
3ed6e0b
fixed isModule
guilhermehas Apr 17, 2023
81548b0
added ring * and 1m
guilhermehas Apr 18, 2023
1b684fc
add all operators of functional vec
guilhermehas Apr 18, 2023
6604b6e
changed the code to be more general
guilhermehas May 18, 2023
bc7d02d
using rawStructures instead
guilhermehas May 19, 2023
51a8adc
fixed base exportation
guilhermehas May 25, 2023
841be8c
proved more definitions
guilhermehas May 26, 2023
62b0af2
added monoid properties
guilhermehas May 26, 2023
651c316
added isGroup and isAbGroup
guilhermehas May 26, 2023
1c520d1
added semiring properties
guilhermehas May 26, 2023
2f9e635
added Ring Properties
guilhermehas May 26, 2023
9fc2632
changed back to espilon and dot definition
guilhermehas May 26, 2023
e39e20e
added magma definitions
guilhermehas May 26, 2023
59e693e
added some more groups
guilhermehas May 26, 2023
967be03
added structures inside
guilhermehas May 27, 2023
4dccb0e
added the bundles
guilhermehas May 27, 2023
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
110 changes: 110 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3027,3 +3027,113 @@ This is a full list of proofs that have changed form to use irrelevant instance
```agda
<-weakInduction-startingFrom : P i → (∀ j → P (inject₁ j) → P (suc j)) → ∀ {j} → j ≥ i → P j
```

Copy link
Member

Choose a reason for hiding this comment

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

In these cases we typically only mention we have added entirely new modules rather than listing their content.
Cf. https://github.com/agda/agda-stdlib/blob/master/CHANGELOG.md#new-modules

* In `Data.Vec.Functional.Algebra.Base`
```agda
_≈ᴹ_ : Rel (Vector Carrier n) ℓ
_+ᴹ_ : Op₂ $ Vector Carrier n
0ᴹ : Vector Carrier n
-ᴹ_ : Op₁ $ Vector Carrier n
_*ₗ_ : Opₗ Carrier (Vector Carrier n)
```

* Added algebraic properties in `Data.Vec.Functional.Algebra.Properties`
```agda
+ᴹ-cong : Congruent₂ (_+ᴹ_ {n})
*ᴹ-cong : Congruent₂ (_*ᴹ_ {n})
+ᴹ-assoc : Associative (_+ᴹ_ {n})
*ᴹ-assoc : Associative (_*ᴹ_ {n})
+ᴹ-comm : Commutative (_+ᴹ_ {n})
*ᴹ-comm : Commutative (_*ᴹ_ {n})
+ᴹ-identityˡ : LeftIdentity (0ᴹ {n}) _+ᴹ_
*ᴹ-identityˡ : LeftIdentity (1ᴹ {n}) _*ᴹ_
+ᴹ-identityʳ : RightIdentity (0ᴹ {n}) _+ᴹ_
*ᴹ-identityʳ : RightIdentity (1ᴹ {n}) _*ᴹ_
+ᴹ-identity : Identity (0ᴹ {n}) _+ᴹ_
*ᴹ-identity : Identity (1ᴹ {n}) _*ᴹ_
-ᴹ‿cong : Congruent₁ (-ᴹ_ {n})
-ᴹ‿inverseˡ : AD'.LeftInverse (0ᴹ {n}) -ᴹ_ _+ᴹ_
-ᴹ‿inverseʳ : AD'.RightInverse (0ᴹ {n}) -ᴹ_ _+ᴹ_
-ᴹ‿inverse : AD'.Inverse (0ᴹ {n}) -ᴹ_ _+ᴹ_
*ₗ-cong : LD.Congruent SR._≈_ (_*ₗ_ {n})
*ₗ-zeroˡ : LD.LeftZero SR.0# (0ᴹ {n}) _*ₗ_
*ₗ-distribʳ : _*ₗ_ LD.DistributesOverʳ SR._+_ ⟶ (_+ᴹ_ {n})
*ₗ-identityˡ : LD.LeftIdentity SR.1# (_*ₗ_ {n})
*ₗ-assoc : LD.Associative SR._*_ (_*ₗ_ {n})
*ₗ-zeroʳ : LD.RightZero (0ᴹ {n}) _*ₗ_
*ₗ-distribˡ : _*ₗ_ LD.DistributesOverˡ (_+ᴹ_ {n})
*ᵣ-cong : RD.Congruent SR._≈_ (_*ᵣ_ {n})
*ᵣ-distribˡ : _*ᵣ_ RD.DistributesOverˡ SR._+_ ⟶ (_+ᴹ_ {n})
*ᵣ-zeroˡ : RD.LeftZero (0ᴹ {n}) _*ᵣ_
*ᵣ-identityʳ : RD.RightIdentity SR.1# (_*ᵣ_ {n})
*ᵣ-assoc : RD.Associative SR._*_ (_*ᵣ_ {n})
*ᵣ-zeroʳ : RD.RightZero SR.0# (0ᴹ {n}) _*ᵣ_
*ᵣ-distribʳ : _*ᵣ_ RD.DistributesOverʳ (_+ᴹ_ {n})
*ₗ-*ᵣ-assoc : BD.Associative (_*ₗ_ {n}) _*ᵣ_
*ᴹ-zeroˡ : AD'.LeftZero (0ᴹ {n}) _*ᴹ_
*ᴹ-zeroʳ : AD'.RightZero (0ᴹ {n}) _*ᴹ_
*ᴹ-zero : AD'.Zero (0ᴹ {n}) _*ᴹ_
*ᴹ-+ᴹ-distribˡ : (_*ᴹ_ {n}) AD'.DistributesOverˡ _+ᴹ_
*ᴹ-+ᴹ-distribʳ : (_*ᴹ_ {n}) AD'.DistributesOverʳ _+ᴹ_
*ᴹ-+ᴹ-distrib : (_*ᴹ_ {n}) AD'.DistributesOver _+ᴹ_
```

* Added structures in `Data.Vec.Functional.Algebra.Properties`
```agda
isMagma : IsMagma (_+ᴹ_ {n})
*ᴹ-isMagma : IsMagma (_*ᴹ_ {n})
isCommutativeMagma : IsCommutativeMagma (_+ᴹ_ {n})
isSemigroup : IsSemigroup (_+ᴹ_ {n})
*ᴹ-isSemigroup : IsSemigroup (_*ᴹ_ {n})
isCommutativeSemigroup : IsCommutativeSemigroup (_+ᴹ_ {n})
isMonoid : IsMonoid (_+ᴹ_ {n}) 0ᴹ
*ᴹ-isMonoid : IsMonoid (_*ᴹ_ {n}) 1ᴹ
isCommutativeMonoid : IsCommutativeMonoid (_+ᴹ_ {n}) 0ᴹ
isGroup : IsGroup (_+ᴹ_ {n}) 0ᴹ -ᴹ_
isAbelianGroup : IsAbelianGroup (_+ᴹ_ {n}) 0ᴹ -ᴹ_
isPreleftSemimodule : IsPreleftSemimodule semiring (_≈ᴹ_ {n}) _+ᴹ_ 0ᴹ _*ₗ_
isPrerightSemimodule : IsPrerightSemimodule semiring (_≈ᴹ_ {n}) _+ᴹ_ 0ᴹ _*ᵣ_
isRightSemimodule : IsRightSemimodule semiring (_≈ᴹ_ {n}) _+ᴹ_ 0ᴹ _*ᵣ_
isBisemimodule : IsBisemimodule semiring semiring (_≈ᴹ_ {n}) _+ᴹ_ 0ᴹ _*ₗ_ _*ᵣ_
isRightModule : IsRightModule ring (_≈ᴹ_ {n}) _+ᴹ_ 0ᴹ -ᴹ_ _*ᵣ_
isBimodule : IsBimodule ring ring (_≈ᴹ_ {n}) _+ᴹ_ 0ᴹ -ᴹ_ _*ₗ_ _*ᵣ_
isLeftSemimodule : IsLeftSemimodule semiring (_≈ᴹ_ {n}) _+ᴹ_ 0ᴹ _*ₗ_
isLeftModule : IsLeftModule ring (_≈ᴹ_ {n}) _+ᴹ_ 0ᴹ -ᴹ_ _*ₗ_
isModule : IsModule cring (_≈ᴹ_ {n}) _+ᴹ_ 0ᴹ -ᴹ_ _*ₗ_ _*ᵣ_
+ᴹ-*-isNearSemiring : IsNearSemiring (_+ᴹ_ {n}) _*ᴹ_ 0ᴹ
+ᴹ-*-isSemiringWithoutOne : IsSemiringWithoutOne (_+ᴹ_ {n}) _*ᴹ_ 0ᴹ
+ᴹ-*-isCommutativeSemiringWithoutOne : IsCommutativeSemiringWithoutOne (_+ᴹ_ {n}) _*ᴹ_ 0ᴹ
+ᴹ-*-isSemiringWithoutAnnihilatingZero : IsSemiringWithoutAnnihilatingZero (_+ᴹ_ {n}) _*ᴹ_ 0ᴹ 1ᴹ
+ᴹ-*-isSemiring : IsSemiring (_+ᴹ_ {n}) _*ᴹ_ 0ᴹ 1ᴹ
+ᴹ-*-isCommutativeSemiring : IsCommutativeSemiring (_+ᴹ_ {n}) _*ᴹ_ 0ᴹ 1ᴹ
+ᴹ-*-isRingWithoutOne : IsRingWithoutOne (_+ᴹ_ {n}) _*ᴹ_ -ᴹ_ 0ᴹ
+ᴹ-*-isRing : IsRing (_+ᴹ_ {n}) _*ᴹ_ -ᴹ_ 0ᴹ 1ᴹ
+ᴹ-*-isCommutativeRing : IsCommutativeRing (_+ᴹ_ {n}) _*ᴹ_ -ᴹ_ 0ᴹ 1ᴹ
```

* Added bundles in `Data.Vec.Functional.Algebra.Properties`
```agda
magma : ℕ → Magma _ _
*ᴹ-magma : ℕ → Magma _ _
commutativeMagma : ℕ → CommutativeMagma _ _
semigroup : ℕ → Semigroup _ _
*ᴹ-semigroup : ℕ → Semigroup _ _
commutativeSemigroup : ℕ → CommutativeSemigroup _ _
monoid : ℕ → Monoid _ _
*ᴹ-monoid : ℕ → Monoid _ _
commutativeMonoid : ℕ → CommutativeMonoid _ _
group : ℕ → Group _ _
leftSemimodule : ℕ → LeftSemimodule _ _ _
leftModule : ℕ → LeftModule _ _ _
bisemimodule : ℕ → Bisemimodule _ _ _ _
rightModule : ℕ → RightModule _ _ _
bimodule : ℕ → Bimodule _ _ _ _
module' : ℕ → Module _ _ _
+ᴹ-*-nearSemiring : ℕ → NearSemiring _ _
+ᴹ-*-semiringWithoutOne : ℕ → SemiringWithoutOne _ _
+ᴹ-*-commutativeSemiringWithoutOne : ℕ → CommutativeSemiringWithoutOne _ _
+ᴹ-*-semiringWithoutAnnihilatingZero : ℕ → SemiringWithoutAnnihilatingZero _ _
+ᴹ-*-semiring : ℕ → Semiring _ _
+ᴹ-*-commutativeSemiring : ℕ → CommutativeSemiring _ _
+ᴹ-*-ringWithoutOne : ℕ → RingWithoutOne _ _
```
73 changes: 73 additions & 0 deletions src/Data/Vec/Functional/Algebra/Base.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
------------------------------------------------------------------------
-- The Agda standard library
--
-- Some Vector-related module Definitions
------------------------------------------------------------------------

{-# OPTIONS --cubical-compatible --safe #-}

module Data.Vec.Functional.Algebra.Base where

open import Level using (Level)
open import Function using (_$_)
open import Data.Nat using (ℕ)
open import Data.Fin using (Fin)
open import Data.Vec.Functional
open import Algebra.Core
open import Algebra.Bundles
open import Algebra.Module
open import Relation.Binary using (Rel)
open import Data.Vec.Functional.Relation.Binary.Pointwise using (Pointwise)

private variable
a ℓ : Level
A : Set
n :

module EqualityVecFunc (_≈_ : Rel A ℓ) where
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason everything in here is in sub-modules? That is not a common stdlib pattern.

_≈ᴹ_ : Rel (Vector A n) ℓ
_≈ᴹ_ = Pointwise _≈_

module VecAddition (_∙_ : Op₂ A) where
_∙ᴹ_ : Op₂ $ Vector A n
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not call this _+ᴹ_ ?

_∙ᴹ_ = zipWith _∙_

module VecMagma (rawMagma : RawMagma a ℓ) where
Copy link
Collaborator

Choose a reason for hiding this comment

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

I expected the 'result' here to define an instance the structure Magma instead of all the exploded pieces of one.
(Same for Monoid, Group, etc)

open RawMagma rawMagma public
open VecAddition _∙_ public
open EqualityVecFunc _≈_ public

module VecMonoid (rawMonoid : RawMonoid a ℓ) where
open RawMonoid rawMonoid using (rawMagma; ε) public
open VecMagma rawMagma public

εᴹ : Vector Carrier n
εᴹ = replicate ε

module VecGroup (rawGroup : RawGroup a ℓ) where
open RawGroup rawGroup using (rawMonoid; _⁻¹) public
open VecMonoid rawMonoid public

-ᴹ_ : Op₁ $ Vector Carrier n
-ᴹ_ = map $ _⁻¹

module VecNearSemiring (rawNearSemiring : RawNearSemiring a ℓ) where
open RawNearSemiring rawNearSemiring using (+-rawMonoid; *-rawMagma) public
open VecMonoid +-rawMonoid renaming (ε to 0#; εᴹ to 0ᴹ; _∙ᴹ_ to _+ᴹ_; _∙_ to _+_) public
open VecMagma *-rawMagma public renaming (_∙ᴹ_ to _*ᴹ_; _∙_ to _*_) using ()

_*ₗ_ : Opₗ Carrier (Vector Carrier n)
_*ₗ_ r = map (r *_)

_*ᵣ_ : Opᵣ Carrier (Vector Carrier n)
_*ᵣ_ xs r = map (_* r) xs

module VecSemiring (rawSemiring : RawSemiring a ℓ) where
open RawSemiring rawSemiring using (rawNearSemiring; 1#; *-rawMonoid) public
open VecNearSemiring rawNearSemiring public
open VecMonoid *-rawMonoid public renaming (εᴹ to 1ᴹ) using ()

module VecRing (rawRing : RawRing a ℓ) where
open RawRing rawRing using (+-rawGroup; rawSemiring) public
open VecGroup +-rawGroup public using (-ᴹ_)
open VecSemiring rawSemiring public
Loading