Skip to content

[ add ] Pointwise lifting of algebra to Data.Vec.Functional - #3077

Open
JacquesCarette wants to merge 3 commits into
masterfrom
PointwiseLifting
Open

[ add ] Pointwise lifting of algebra to Data.Vec.Functional#3077
JacquesCarette wants to merge 3 commits into
masterfrom
PointwiseLifting

Conversation

@JacquesCarette

Copy link
Copy Markdown
Collaborator

This is a partial redo of #2817 for all the Algebra parts. If this seems good, then we can do the Module parts as well.

@jamesmckinna

Copy link
Copy Markdown
Collaborator

Is Base all that there is going to be for this PR? (ie is this ready for review? I guess it must be... you did ask...)

@jamesmckinna jamesmckinna left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

DRY!!!

The substance of this PR lies in answering the following question: what cannot be achieved by re-export from Algebra.Construct.Pointwise?

Monoid; CommutativeMonoid; Group; AbelianGroup; NearSemiring; SemiringWithoutOne;
CommutativeSemiringWithoutOne; Semiring; CommutativeSemiring; IdempotentSemiring;
KleeneAlgebra; Quasiring; Ring; CommutativeRing)
import Algebra.Construct.Pointwise as Lift

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Notwithstanding my use of lift for helper functions in Algebra.Construct.Pointwise, I personally hate the use of Lift as a module name for qualified import. I would much prefer

Suggested change
import Algebra.Construct.Pointwise as Lift
import Algebra.Construct.Pointwise as Pointwise

cf. #2280


{-# OPTIONS --without-K --safe #-}

module Data.Vec.Functional.Algebra.Base where

@jamesmckinna jamesmckinna Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If the sole contents of this module are to be the re-exports of the Bundles, then this could be almost entirely shortcircuited (Fairbairn?) as:

Suggested change
module Data.Vec.Functional.Algebra.Base where
open import Data.Nat.Base using (ℕ)
module Data.Vec.Functional.Algebra.Base (n : ℕ) where
open import Data.Fin.Base using (Fin)
-- Re-export existing constructions
open import Algebra.Construct.Pointwise (Fin n) public

And indeed, if there is to be more here, then why not refactor in this style anyway? (in the anonymous module you define below).

I think this was the substance of my critique of #2817 , and my suggestions that the corresponding Module additions be moved to Algebra.Module.Construct.Pointwise #2915 , and, if necessary, be re-exported here on the same basis as above?

@JacquesCarette

Copy link
Copy Markdown
Collaborator Author

Thanks for pointing out that this should morally be a 1-liner! And in that guise, if additions are made to the Construct module, they would "appear" here automatically as well: win-win.

The question as to whether this is going to be all there is: it depends on whether the Module-related additions should also go in this PR, both infrastructure and deployment. And where the resulting bundles should be deployed from (i.e. this module or another).

I don't think we should ever instantiate a "construction" module inside of itself. So if this module ends up a 1-liner in the end, I'm fine with that.

@jamesmckinna

Copy link
Copy Markdown
Collaborator

Thanks for pointing out that this should morally be a 1-liner! And in that guise, if additions are made to the Construct module, they would "appear" here automatically as well: win-win.

@JacquesCarette

I await developments!

As for

The question as to whether this is going to be all there is: it depends on whether the Module-related additions should also go in this PR, both infrastructure and deployment. And where the resulting bundles should be deployed from (i.e. this module or another).

I could imagine a similar 'staging': Pointwise constructions on modules, re-exported here for the A = Fin n case, together with... other machinery developed here?

I don't think we should ever instantiate a "construction" module inside of itself. So if this module ends up a 1-liner in the end, I'm fine with that.

Sounds principled!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants