Skip to content

Module morphisms polymorphic in the underlying ring structure#2810

Closed
Taneb wants to merge 3 commits intoagda:masterfrom
Taneb:polymorphic-module-morphisms
Closed

Module morphisms polymorphic in the underlying ring structure#2810
Taneb wants to merge 3 commits intoagda:masterfrom
Taneb:polymorphic-module-morphisms

Conversation

@Taneb
Copy link
Member

@Taneb Taneb commented Aug 15, 2025

This was a side-experiment in #2729 that I separated out so it could get feedback without hindering that PR. It is neither blocking nor blocked by that PR.

  • Adds a subtraction operator for modules
  • Adds a notion of "polymorphic" module morphisms, which can change the underlying ring
  • Redefines "monomorphic" module morphisms in terms of these
  • Properties of polymorphic monomorphisms

I'm frustrated that defining monomorphic module morphisms in terms of polymorphic ones messes with the (Agda) module parameters needed downstream. I'm not sure why they need to be made explicit

@jamesmckinna
Copy link
Collaborator

jamesmckinna commented Aug 16, 2025

Maybe I'm missing something, but I'm not clear about the (eventual) pragmatics/uses of this design, compared with factorising any X-module morphism between M and N over two distinct X-rings of coefficients R and S, related by a X-ring homomorphism h

  • a morphism relative to S between h*N and N
  • a morphism between M and h*N relative to R
  • .. for a suitable definition of ... ah, now I perhaps see.

But still, documenting the rationale for the design as part of the PR documentation, if not as commentary in the files themselves, would be useful, I think. As to unsolved metas/need for explicit arguments, that seems to be a recurring problem with Agda's (weakened) mechanisms for inferring such things in the setting of the more complicate flags/modality/erasure/polarity analyses now being instrumented?

UPDATED:

  • suggest that the addition of a binary subtraction operator (inherited from the underlying +-abelianGroup of a module?) be lifted out as a separate PR, if it's useful...
  • revisiting my earlier comment, maybe it is simpler to reconsider this PR in terms of a Construct on XModules of 'change-of-base along a homomorphism of coefficients' h* M, and then your new composite 'polymorphic' notion of homomorphism as being given definitionally as a 'monomorphic' homomorphism between M and h * N? And certainly, that wouldn't require the new explicit parametrisation?

@JacquesCarette
Copy link
Collaborator

I agree that more documentation would have been helpful.

From what I can see from the code:

  1. I really want this capability,
  2. but not as a modification of the current code,
  3. rather as a different kind of module morphism.

@jamesmckinna
Copy link
Collaborator

@JacquesCarette does the change-of-base construction give you what you want, as suggested above?

@JacquesCarette
Copy link
Collaborator

does the change-of-base construction give you what you want?

Quite likely. But the devil's in the details for such things, thus my hedging.

LeftModule R (m ⊔ m′) (ℓm ⊔ ℓm′)
leftModule M N = record
{ -ᴹ_ = map M.-ᴹ_ N.-ᴹ_
{ -ᴹ_ = map (M.-ᴹ_) (N.-ᴹ_)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do the parentheses help here? I'm not convinced...

Copy link
Member Author

Choose a reason for hiding this comment

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

It's been a while, but I think without them Agda doesn't know if I mean that or a use of the _-ᴹ_ operator

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah... I see, but still worth thinking about the earlier comment about having a small PR adding that subtraction operator in its own right?

{ +ᴹ-isMonoidHomomorphism = isMonoidHomomorphism ≈ᴹ₃-trans F.+ᴹ-isMonoidHomomorphism G.+ᴹ-isMonoidHomomorphism
; *ₗ-homo = λ r x → ≈ᴹ₃-trans (G.⟦⟧-cong (F.*ₗ-homo r x)) (G.*ₗ-homo r (f x))
} where module F = IsLeftSemimoduleHomomorphism f-homo; module G = IsLeftSemimoduleHomomorphism g-homo
} where module F = IsLeftSemimoduleHomomorphism M₁ M₂ f-homo; module G = IsLeftSemimoduleHomomorphism M₂ M₃ g-homo
Copy link
Collaborator

Choose a reason for hiding this comment

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

So I agree with you that it's annoying to have to be explicit with these arguments... I suppose that's one way of nudging the typechecker to know which scalars are involved at a given call-/use- site in this new setup, but perhaps simply supplying the R/S arguments would be the other way to do it?

{r} (R : Set r) -- The underlying ring
{r} (R : Set r) -- The underlying ring of the domain
{s} (S : Set s) -- The underlying ring of the codomain
([_] : R → S) -- The homomorphism between the underlying rings
Copy link
Collaborator

Choose a reason for hiding this comment

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

As I've indicated before, i think this design is trying to do too many things at once which could be usefully factored into smaller pieces, such as #2913 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I've come to agree with you on this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, let's see what comes out in the wash!

@Taneb
Copy link
Member Author

Taneb commented Feb 9, 2026

Closing in favour of the approach described in #2913

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.

3 participants