Skip to content

feat(PFunctor): Add API of basic constructions - #803

Open
dtumad wants to merge 5 commits into
leanprover:mainfrom
dtumad:dtumad/pfunctor-basic-api
Open

feat(PFunctor): Add API of basic constructions#803
dtumad wants to merge 5 commits into
leanprover:mainfrom
dtumad:dtumad/pfunctor-basic-api

Conversation

@dtumad

@dtumad dtumad commented Aug 15, 2026

Copy link
Copy Markdown

PR to add various basic PFunctor definitions from PolyFun , split off from #731 to better isolate changes for review.

Main definitions are PFunctor.monomial, PFunctor.add, and PFunctor.mul, with abbreviations for common special cases of PFunctor.monomial.

Discussion about the addition notation:
https://leanprover.zulipchat.com/#narrow/channel/270676-lean4/topic/Universe.20unification.20with.20.60HAdd.2EhAdd.60.20vs.2E.20.60.2B.60.20notation/with/617534952.01

@dtumad dtumad changed the title feat: Add API of basic constructions feat(PFunctor): Add API of basic constructions Aug 17, 2026
Comment thread Cslib/Foundations/Data/PFunctor/Basic.lean Outdated
Comment on lines +111 to +115
This is kept as a `def` alongside the `HAdd` instance below, even though that instance is
exactly as universe-general as `add` itself: the `binop%` elaborator behind `+` eagerly
unifies the types of both operands with the expected type, so when the expected type carries
universe metavariables (e.g. inside `PFunctor.W (P.add (.const α))` with `α : Type v`),
`P + Q` can fail to elaborate where `P.add Q` succeeds; see `CslibTests/PFunctor.lean`. -/

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.

It would be great to raise this issue on Zulip and link the post from the PR description.

Comment thread Cslib/Foundations/Data/PFunctor/Basic.lean

@eric-wieser eric-wieser 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.

It would be great to have another PFunctor expert review this for docstrings, but this all looks pretty reasonable to me.

@dtumad

dtumad commented Aug 17, 2026

Copy link
Copy Markdown
Author

Also cc @quangvdao would be good to get your review too.

Also more generally I'm unsure about adding X as notation in the first place, and also if we should add A X^ B notation for PFunctor.monomial A B from PolyFun, or just keep the explicit spelling in cslib? It does make the equations look more intuitive I think.

@dtumad

dtumad commented Aug 17, 2026

Copy link
Copy Markdown
Author

Also cc @quangvdao would be good to get your review too.

Also more generally I'm unsure about adding X as notation in the first place, and also if we should add A X^ B notation for PFunctor.monomial A B from PolyFun, or just keep the explicit spelling in cslib? It does make the equations look more intuitive I think.

To expand on this, I think PolyFun may want to just adopt the notation from https://arxiv.org/abs/2312.00990, in which case X should maybe just be defined here as y. I sort of like the Yoneda framing with y but maybe both should exist, or neither for now. With that switch it would be A y^ B then instead.

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.

2 participants