Skip to content

feat(ComputablePolynomial): define MvDegrees, exponent vectors for multivariate polynomials - #41348

Open
mkaratarakis wants to merge 4 commits into
leanprover-community:masterfrom
mkaratarakis:mvpoly-1-degrees
Open

mkaratarakis wants to merge 4 commits into
leanprover-community:masterfrom
mkaratarakis:mvpoly-1-degrees

Conversation

@mkaratarakis

@mkaratarakis mkaratarakis commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

MvDegrees nvars is an exponent vector for a monomial in nvars variables: an array of per-variable exponents with its cached total degree, with pointwise addition (AddCommMonoid) and the List/Array folding lemmas the computable multivariate polynomial library (MvSparsePoly) is built on. The proofs were done with the help of Claude.

Based on the univariate SparsePoly (#41339); started by Mario Carneiro at the Hausdorff Institute (June 2024) with design notes and an original Lean prototype by James Davenport (https://github.com/JamesHDavenport/Dagstuhl23401, verify-irred/VerifyIrred).


@github-actions

github-actions Bot commented Jul 4, 2026 •

Copy link
Copy Markdown

✅ PR Title Formatted Correctly

The title of this PR has been updated to match our commit style conventions.
Thank you!

@github-actions

github-actions Bot commented Jul 4, 2026 •

Copy link
Copy Markdown

PR summary bfef9eaedb

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Tactic 1
Mathlib.Tactic.ComputablePolynomial.MvDegrees (new file) 666

Declarations diff (regex)

+ (pointwise
+ MvDegrees
+ MvDegrees.size_eq
+ array_eq_of_toList_eq
+ array_map_mul_foldl
+ array_map_zero
+ array_nsmul_succ
+ array_replicate_zero_foldl
+ array_zipWith_add_assoc
+ array_zipWith_add_comm
+ array_zipWith_add_zero
+ array_zipWith_foldl_add
+ array_zipWith_zero_add
+ instance : AddCommMonoid (MvDegrees nvars)
+ list_foldl_add_acc
+ list_map_mul_foldl
+ list_map_zero
+ list_nsmul_succ
+ list_replicate_zero_foldl
+ list_zipWith_add_assoc
+ list_zipWith_add_comm
+ list_zipWith_add_right_cancel
+ list_zipWith_add_zero
+ list_zipWith_foldl_add
+ list_zipWith_zero_add

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 bfef9ea).

  • +43 new declarations
  • −0 removed declarations
+List.getElem?_zipWith.match_1.congr_eq_1
+List.getElem?_zipWith.match_1.congr_eq_2
+MvDegrees
+MvDegrees.casesOn
+MvDegrees.correct
+MvDegrees.ctorIdx
+MvDegrees.degrees
+MvDegrees.ext
+MvDegrees.ext_iff
+MvDegrees.mk
+MvDegrees.mk.inj
+MvDegrees.mk.injEq
+MvDegrees.mk.noConfusion
+MvDegrees.mk.sizeOf_spec
+MvDegrees.noConfusion
+MvDegrees.noConfusionType
+MvDegrees.rec
+MvDegrees.recOn
+MvDegrees.size_eq
+MvDegrees.totalDegree
+MvDegrees.totalDegree_eq
+array_eq_of_toList_eq
+array_map_mul_foldl
+array_map_zero
+array_nsmul_succ
+array_replicate_zero_foldl
+array_zipWith_add_assoc
+array_zipWith_add_comm
+array_zipWith_add_zero
+array_zipWith_foldl_add
+array_zipWith_zero_add
+instAddCommMonoidMvDegrees
+list_foldl_add_acc
+list_map_mul_foldl
+list_map_zero
+list_nsmul_succ
+list_replicate_zero_foldl
+list_zipWith_add_assoc
+list_zipWith_add_comm
+list_zipWith_add_right_cancel
+list_zipWith_add_zero
+list_zipWith_foldl_add
+list_zipWith_zero_add

No changes to strong technical debt.

Increase in weak tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (weak)
5099 1 exposed public sections

Current commit bfef9eaedb
Reference commit 84ae864884

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.py 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).

… for multivariate polynomials

Co-Authored-By: Claude Fable 5 <[email protected]>
@mkaratarakis mkaratarakis changed the title feat(Tactic/ComputablePolynomial): MvDegrees, exponent vectors for computable multivariate polynomials feat(Tactic/ComputablePolynomial): define MvDegrees, exponent vectors for multivariate polynomials Jul 4, 2026
@JovanGerb JovanGerb removed their assignment Jul 16, 2026
@mkaratarakis mkaratarakis changed the title feat(Tactic/ComputablePolynomial): define MvDegrees, exponent vectors for multivariate polynomials feat(ComputablePolynomial): define MvDegrees, exponent vectors for multivariate polynomials Aug 4, 2026
@Vierkantor Vierkantor self-assigned this Oct 24, 2026
@Vierkantor

Copy link
Copy Markdown
Contributor

We should wait for discussion on the univariate case #41339 to settle, before we start on the multivariate case.

@Vierkantor Vierkantor added the awaiting-zulip There is a Zulip discussion; the author should await and report/implement the decision reached there label Oct 24, 2026

This branch has not been deployed

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

Labels

awaiting-zulip There is a Zulip discussion; the author should await and report/implement the decision reached there t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants