Skip to content

feat(RingTheory/HopfAlgebra): Hopf algebra structure on polynomials (𝔾ₐ)#39410

Open
RaggedR wants to merge 15 commits into
leanprover-community:masterfrom
RaggedR:feat/polynomial-hopf-algebra
Open

feat(RingTheory/HopfAlgebra): Hopf algebra structure on polynomials (𝔾ₐ)#39410
RaggedR wants to merge 15 commits into
leanprover-community:masterfrom
RaggedR:feat/polynomial-hopf-algebra

Conversation

@RaggedR

@RaggedR RaggedR commented May 15, 2026

Copy link
Copy Markdown

This is the beginning of a formalization of the first half of my masters thesis (https://arxiv.org/abs/0907.3950).

In particular we look at the ring of polynomials in a single variable with the usual multiplication and coproduct given by: Δ(X) = X ⊗ 1 + 1 ⊗ X. The counit is evaluation at zero, and the antipode is S(x) = -x.

The mathematics itself comes from my masters thesis (and is well known). This is a first step towards an implementation of the umbral calculus of Gian-Carlo Rota and then its generalization to Symmetric Functions (which I believe is original).


Open in Gitpod


LLM tools were used to assist with Lean formalization. The mathematical content is the author's own work.

@github-actions github-actions Bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label May 15, 2026
@github-actions

Copy link
Copy Markdown

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR.

Thank you again for joining our community.

@github-actions github-actions Bot added the t-ring-theory Ring theory label May 15, 2026
@github-actions

github-actions Bot commented May 15, 2026

Copy link
Copy Markdown

PR summary 02512ac5cb

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.RingTheory.HopfAlgebra.Polynomial (new file) 1224

Declarations diff (regex)

+ antipodeAlgHom
+ antipodeAlgHom_C
+ antipodeAlgHom_X
+ comul_apply
+ comul_def
+ counit_apply
+ counit_def
+ instBialgebra
+ instCoalgebra
+ instCoalgebraStruct
+ instHopfAlgebra
+ lTensor_toLinearMap_eq
+ rTensor_toLinearMap_eq

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit 02512ac).

  • +11 new declarations
  • −0 removed declarations
+Polynomial.antipodeAlgHom
+Polynomial.antipodeAlgHom_C
+Polynomial.antipodeAlgHom_X
+Polynomial.comul_apply
+Polynomial.comul_def
+Polynomial.counit_apply
+Polynomial.counit_def
+Polynomial.instBialgebra
+Polynomial.instCoalgebra
+Polynomial.instCoalgebraStruct
+Polynomial.instHopfAlgebra

No changes to strong technical debt.

No changes to weak technical debt.

Current commit 02512ac5cb
Reference commit 7ab1c47ce6

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@wwylele

wwylele commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Hello, could you disclose usage of AI, if any, according to the guideline?

In particular

Note that using an LLM when writing comments on github or Zulip is not allowed: use your own words.

Could you write the PR description yourself, following the existing template?

@RaggedR

RaggedR commented May 15, 2026 via email

Copy link
Copy Markdown
Author

@wwylele wwylele 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.

I know little in this field, so just based on my naive code search: is this the same construction as the existing AddMonoidAlgebra.instHopfAlgebra? And if so, given Polynomial is defined over AddMonoidAlgebra, can we transfer the result? (I have also heard of a plan to make Polynomial an abbrev of AddMonoidAlgebra, which means it will automatically get these instances.

instance instCoalgebra : Coalgebra R R[X] :=
{ instCoalgebraStruct R with
rTensor_counit_comp_comul := by
rw [counit_eq, comul_eq, rTensor_counit_eq, mk_one_eq_includeRight]

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.

I think Mathlib prefers the newer where style

Suggested change
rw [counit_eq, comul_eq, rTensor_counit_eq, mk_one_eq_includeRight]
instance instCoalgebra : Coalgebra R R[X] where
-- __ := instCoalgebraStruct R -- This line should be unnecessary as Lean should find the base struct, but in case it errors you can add it
rTensor_counit_comp_comul := by

@RaggedR

This comment was marked as low quality.

@RaggedR

RaggedR commented May 16, 2026

Copy link
Copy Markdown
Author

AI disclosure: this PR was developed with assistance from Claude Code. The
mathematical content and proof strategies are mine. Could a maintainer add the
LLM-generated label please?

@SnirBroshi SnirBroshi added the LLM-generated PRs with substantial input from LLMs - review accordingly label May 18, 2026
@RaggedR

RaggedR commented May 21, 2026

Copy link
Copy Markdown
Author

LLM-generated

@themathqueen

Copy link
Copy Markdown
Collaborator

DISCLOSURE: This email was written with the assistance of Claude Code

@RaggedR, note that, as per the contribution guidelines https://leanprover-community.github.io/contribute/index.html#use-of-ai, you need to use your own words in comments in GitHub and messages in Zulip; using an LLM for comments is not allowed.

The "where style" that you suggested has been fixed — good catch.

You haven't fixed this.

Comment on lines +100 to +101
comul := (comulAdditiveAlgHom R).toLinearMap
counit := (counitAdditiveAlgHom R).toLinearMap

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.

Instead of adding the comulAdditiveAlgHom and counitAdditiveAlgHom definitions above, can you just do the following instead?

Suggested change
comul := (comulAdditiveAlgHom R).toLinearMap
counit := (counitAdditiveAlgHom R).toLinearMap
comul := (Polynomial.aeval ((X : R[X]) ⊗ₜ 1 + 1 ⊗ₜ (X : R[X]))).toLinearMap
counit := (Polynomial.aeval (0 : R)).toLinearMap

And then use counit and comul for the above theorems (you'd obviously need to move the theorems after this instance).

Comment on lines +123 to +131
theorem mk_one_eq_includeRight :
TensorProduct.mk R R R[X] 1 =
(Algebra.TensorProduct.includeRight : R[X] →ₐ[R] R ⊗[R] R[X]).toLinearMap := by
ext y; simp [Algebra.TensorProduct.includeRight_apply]

theorem mk_flip_one_eq_includeLeft :
(TensorProduct.mk R R[X] R).flip 1 =
(Algebra.TensorProduct.includeLeft : R[X] →ₐ[R] R[X] ⊗[R] R).toLinearMap := by
ext y; simp [Algebra.TensorProduct.includeLeft_apply, LinearMap.flip_apply]

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.

These are in the wrong way around and should go in an earlier file.

theorem Algebra.TensorProduct.toLinearMap_includeRight {R A B} [CommSemiring R] [Semiring A]
    [Algebra R A] [Semiring B] [Algebra R B] :
    (Algebra.TensorProduct.includeRight : B →ₐ[R] A ⊗[R] B).toLinearMap =
      TensorProduct.mk R A B 1 := rfl

theorem Algebra.TensorProduct.toLinearMap_includeLeft
    {R A B} [CommSemiring R] [Semiring A]
    [Algebra R A] [Semiring B] [Algebra R B] [Algebra R A] :
    (Algebra.TensorProduct.includeLeft : A →ₐ[R] A ⊗[R] B).toLinearMap =
      (TensorProduct.mk R A B).flip 1 := rfl

@themathqueen themathqueen added the awaiting-author A reviewer has asked the author a question or requested changes. label May 21, 2026
@RaggedR
RaggedR force-pushed the feat/polynomial-hopf-algebra branch from 2371a6e to 41f1663 Compare May 21, 2026 23:49
@RaggedR

RaggedR commented May 22, 2026

Copy link
Copy Markdown
Author

Thankyou Monica for taking the time to review my PR. In summary:

Polynomial.lean — the big diff removes comulAdditiveAlgHom, counitAdditiveAlgHom, instCoalgebraStruct, comul_eq, counit_eq, mk_one_eq_includeRight, mk_flip_one_eq_includeLeft, and all the specific rTensor_counit_eq/lTensor_counit_eq/rTensor_comul_eq/lTensor_comul_eq lemmas.

Replaces them with two generic private glue lemmas (rTensor_toLinearMap_eq/lTensor_toLinearMap_eq) and a single where-style instCoalgebra with everything inlined. Simp lemmas now use Coalgebra.comul/Coalgebra.counit and change to unfold through the instance.

You can probably tell that much of this work was generated by Claude using my thesis as a "prompt" https://arxiv.org/abs/0907.3950

In some cases Claude has "brute forced" the proofs rather than using the theory to prove them. I didn't realize this at first but am working on fixing it now. (This applies to upstream PRs more so than this one, particularly the graph theory examples)

I am new to Lean so thankyou again for your patience.

@RaggedR
RaggedR force-pushed the feat/polynomial-hopf-algebra branch 2 times, most recently from 8286571 to c5c7470 Compare May 22, 2026 11:44
@github-actions github-actions Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 22, 2026
@RaggedR

RaggedR commented May 22, 2026

Copy link
Copy Markdown
Author

Please add the LLM-generated label to this PR.

@themathqueen

Copy link
Copy Markdown
Collaborator

@RaggedR, can you please fix the git history? I'm not sure what you did.

Please add the LLM-generated label to this PR.

This is already applied. And I have already explained how to add this yourself.

@mathlib-bors

mathlib-bors Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

This pull request is now in draft mode. No active bors state needed cleanup.

While this PR remains draft, bors will ignore commands on this PR. Mark it ready for review before using commands like bors r+ or bors try.

@RaggedR
RaggedR marked this pull request as ready for review May 23, 2026 11:02
@RaggedR
RaggedR force-pushed the feat/polynomial-hopf-algebra branch from c5c7470 to b02f79a Compare May 24, 2026 06:31
@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 24, 2026
themathqueen and others added 10 commits May 25, 2026 11:18
…G_a)

Add the Coalgebra, Bialgebra, and HopfAlgebra instances on `R[X]` with
additive comultiplication `Δ(X) = X ⊗ 1 + 1 ⊗ X`, counit `ε(p) = p(0)`,
and antipode `S(X) = -X`. This is the coordinate ring of the additive
group scheme 𝔾_a, dual to the multiplicative 𝔾_m already formalized via
Laurent polynomials.
Adds `module` keyword and changes `import` to `public import` to match
the module system introduced in Lean 4.30.0-rc2, which Mathlib master
now requires.
Add `public section` for Lean 4.30.0 module visibility and remove
deprecated/unused simp lemmas (`AlgEquiv.toAlgHom_eq_coe`,
`AlgHom.coe_coe`, `Algebra.TensorProduct.assoc_tmul`) flagged by linters.
…earMap lemmas

Address review feedback:
- Remove comulAdditiveAlgHom/counitAdditiveAlgHom as standalone defs,
  inline aeval expressions directly in the Coalgebra instance
- Use where style for instCoalgebra instead of { ... with }
- Add Algebra.TensorProduct.toLinearMap_includeRight/Left as rfl lemmas
  in TensorProduct/Basic.lean, replacing the reversed mk_one_eq lemmas
- State simp lemmas in terms of Coalgebra.comul/counit after the instance
Separate CoalgebraStruct from Coalgebra instance and add comul_def,
counit_def, comul_apply, counit_apply lemmas. This eliminates all
`change` tactics in favour of `rw`/`simp` with the new API lemmas.
The private rTensor_toLinearMap_eq and lTensor_toLinearMap_eq lemmas
need explicit {A : Type*} [CommSemiring A] [Algebra R A] parameters
since they are no longer under a variable block that provides these.
Separate CoalgebraStruct from Coalgebra, add comulAlgHom/counitAlgHom
as named definitions, and provide comul_def/counit_def/comul_apply/
counit_apply API lemmas. All proofs verified with lake build.
@RaggedR
RaggedR force-pushed the feat/polynomial-hopf-algebra branch from f69ca96 to 2572d75 Compare May 25, 2026 03:10
@github-actions github-actions Bot removed the large-import Automatically added label for PRs with a significant increase in transitive imports label May 25, 2026
Comment on lines +69 to +70
comul := (comulAlgHom R).toLinearMap
counit := (counitAlgHom R).toLinearMap

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.

Just please inline these instead of having them as separate definitions:

Suggested change
comul := (comulAlgHom R).toLinearMap
counit := (counitAlgHom R).toLinearMap
comul := (Polynomial.aeval ((X : R[X]) ⊗ₜ 1 + 1 ⊗ₜ (X : R[X]))).toLinearMap
counit := (Polynomial.aeval (0 : R)).toLinearMap

@themathqueen

Copy link
Copy Markdown
Collaborator

Please merge master

@RaggedR
RaggedR temporarily deployed to cache-upload-forks June 5, 2026 02:40 — with GitHub Actions Inactive
@RaggedR

RaggedR commented Jun 5, 2026

Copy link
Copy Markdown
Author

Done — merged master and inlined the comul/counit definitions in the CoalgebraStruct instance. The named comulAlgHom/counitAlgHom defs have been removed since the Lean 4.31 module system requires exported rfl theorems to resolve without unfolding intermediate definitions.

@themathqueen

Copy link
Copy Markdown
Collaborator

The named comulAlgHom/counitAlgHom defs have been removed since the Lean 4.31 module system requires exported rfl theorems to resolve without unfolding intermediate definitions.

I don't understand. I suggested you inline them because there was no point in having them as separate definitions.

@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 18, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@RaggedR

RaggedR commented Jun 18, 2026

Copy link
Copy Markdown
Author

You're right — I overcomplicated the explanation. They were unnecessary as separate definitions, as you said. I've merged master to resolve the conflicts.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 18, 2026
Comment on lines +71 to +76
theorem comul_apply (p : R[X]) :
Coalgebra.comul (R := R) p =
Polynomial.aeval ((X : R[X]) ⊗ₜ 1 + 1 ⊗ₜ (X : R[X])) p := rfl

theorem counit_apply (p : R[X]) :
Coalgebra.counit (R := R) p = Polynomial.aeval (0 : R) p := rfl

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 you make both these simp lemmas, then you wouldn't need comul_X, comul_C, counit_X, counit_C.

rw [rTensor_toLinearMap_eq, ← AlgHom.comp_toLinearMap,
← AlgebraTensorModule.mk_eq, ← Algebra.TensorProduct.toLinearMap_includeRight]
congr 1; apply Polynomial.algHom_ext
simp [Algebra.TensorProduct.map_tmul, Algebra.TensorProduct.includeRight_apply]

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.

these two are already simp lemmas, you don't need them here

Suggested change
simp [Algebra.TensorProduct.map_tmul, Algebra.TensorProduct.includeRight_apply]
simp

Comment on lines +126 to +127
dsimp only [Coalgebra.comul, CoalgebraStruct.comul]
rw [rTensor_toLinearMap_eq, lTensor_toLinearMap_eq]

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.

you already have comul_def so use it

Suggested change
dsimp only [Coalgebra.comul, CoalgebraStruct.comul]
rw [rTensor_toLinearMap_eq, lTensor_toLinearMap_eq]
rw [comul_def, rTensor_toLinearMap_eq, lTensor_toLinearMap_eq]

Comment on lines +133 to +144
simp only [← C_mul_X_pow_eq_monomial, map_mul, map_pow, aeval_X, aeval_C]
have hassoc : ∀ x, (TensorProduct.assoc R R[X] R[X] R[X]) x =
(Algebra.TensorProduct.assoc R R R[X] R[X] R[X] R[X]) x := fun _ => rfl
simp only [hassoc, map_mul, map_pow]
congr 1
· simp [Algebra.TensorProduct.one_def,
Algebra.algebraMap_eq_smul_one, TensorProduct.smul_tmul']
· congr 1
simp only [aeval_X, map_add, Algebra.TensorProduct.map_tmul, AlgHom.id_apply,
map_one, Algebra.TensorProduct.assoc_tmul,
Algebra.TensorProduct.one_def, TensorProduct.add_tmul, TensorProduct.tmul_add]
abel

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.

Suggested change
simp only [← C_mul_X_pow_eq_monomial, map_mul, map_pow, aeval_X, aeval_C]
have hassoc : ∀ x, (TensorProduct.assoc R R[X] R[X] R[X]) x =
(Algebra.TensorProduct.assoc R R R[X] R[X] R[X] R[X]) x := fun _ => rfl
simp only [hassoc, map_mul, map_pow]
congr 1
· simp [Algebra.TensorProduct.one_def,
Algebra.algebraMap_eq_smul_one, TensorProduct.smul_tmul']
· congr 1
simp only [aeval_X, map_add, Algebra.TensorProduct.map_tmul, AlgHom.id_apply,
map_one, Algebra.TensorProduct.assoc_tmul,
Algebra.TensorProduct.one_def, TensorProduct.add_tmul, TensorProduct.tmul_add]
abel
have hassoc : ∀ x, (TensorProduct.assoc R R[X] R[X] R[X]) x =
(Algebra.TensorProduct.assoc R R R[X] R[X] R[X] R[X]) x := fun _ => rfl
simp [← C_mul_X_pow_eq_monomial, hassoc, Algebra.TensorProduct.one_def, TensorProduct.add_tmul,
TensorProduct.tmul_add, add_assoc]

Make comul_apply and counit_apply @[simp], removing the now-redundant
comul_X, comul_C, counit_X, counit_C lemmas. Simplify coalgebra proofs
to use comul_def/counit_def and bare simp. Consolidate the coassoc
monomial case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author A reviewer has asked the author a question or requested changes. LLM-generated PRs with substantial input from LLMs - review accordingly new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-ring-theory Ring theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants