Skip to content

Conversation

@guilhermehas
Copy link
Contributor

Added structures and bundles about functional vectors and modules.

Copy link
Member

@Taneb Taneb left a comment

Choose a reason for hiding this comment

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

I like this addition. There's a lot of algebraic structures that you could define but don't, especially:

  • IsCommutativeMagma
  • IsCommutativeSemigroup
  • IsGroup
  • IsAbelianGroup
  • IsPrerightSemimodule
  • IsRightSemimodule
  • IsBisemimodule
  • IsRightModule
  • IsBimodule
  • IsModule

And with element-wise multiplication:

  • IsNearSemiring
  • IsSemiringWithoutOne
  • IsCommutativeSemiringWithoutOne
  • IsSemiringWithoutAnnihilatingZero
  • IsSemiring
  • IsCommutativeSemiring
  • IsRingWithoutOne
  • IsRing
  • IsCommutativeRing

Plus the corresponding bundles.

@guilhermehas
Copy link
Contributor Author

I added all of them.

@guilhermehas guilhermehas requested a review from Taneb April 18, 2023 22:05
```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

import Algebra.Structures as AS

module Data.Vec.Functional.Algebra.Base
{c ℓ} (cring : CommutativeRing c ℓ) where
Copy link
Member

Choose a reason for hiding this comment

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

I'm not happy about this whole module being parameterized on CommutativeRing, as many of the definitions work with smaller algebraic structures, but I'm not sure what to do about it. Maybe other people have some ideas?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I haven't (yet) looked at this too closely, but it seems as though we might more generally want d isX implies (Vector n d) isX and then if d is suitable as X scalars for the right notion of IsYModule over X then (Vector n d) isYModule over d...?

@guilhermehas
Copy link
Contributor Author

I have changed most of my code and it is not done yet. It is still with a lot of comments.
However, I would like some feedback if I am going in the right direction.

I tried to make the code work with more cases, but I don't know if it is helpful in that way.

@guilhermehas guilhermehas marked this pull request as draft May 27, 2023 01:44
@guilhermehas guilhermehas requested a review from gallais May 27, 2023 01:45
@guilhermehas
Copy link
Contributor Author

I can remove the code that is commented on if they are not necessary.

I also would like some suggestions if something is not in the right way.

@jamesmckinna
Copy link
Collaborator

Sorry not to have had time for a thorough review of this draft PR yet!
It'll be at least the week after next before I can look at it properly.

Copy link
Collaborator

@JacquesCarette JacquesCarette left a comment

Choose a reason for hiding this comment

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

This seems like good additions to stdlib, if it were made to fit the style more. Can anyone jump in and do so? (i.e. I'm asking permission)

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.

_≈ᴹ_ = 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 _+ᴹ_ ?

_∙ᴹ_ : Op₂ $ Vector A n
_∙ᴹ_ = 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)

∙ᴹ-comm ∙-comm xs ys i = ∙-comm (xs i) (ys i)


-- isMagma : IsMagma _≈_ _∙_ IsMagma _≈ᴹ_ (_∙ᴹ_ {n})
Copy link
Collaborator

Choose a reason for hiding this comment

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

This commented out code is good code! It fits the rest of the stdlib style.

@guilhermehas
Copy link
Contributor Author

This seems like good additions to stdlib, if it were made to fit the style more. Can anyone jump in and do so? (i.e. I'm asking permission)

Yes, anyone can do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants