Skip to content

MvPolynomial: polynomial reduction as a relation - #41475

Open
Sanghyeok0 wants to merge 8 commits into
leanprover-community:masterfrom
Sanghyeok0:relation-groebner-criterion
Open

Sanghyeok0 wants to merge 8 commits into
leanprover-community:masterfrom
Sanghyeok0:relation-groebner-criterion

Conversation

@Sanghyeok0

@Sanghyeok0 Sanghyeok0 commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR defines polynomial reduction on multivariate polynomials as an ordinary
binary relation and develops its basic reduction-theoretic API.

The main results cover reducibility and normal forms over general commutative
coefficient rings, termination, degree bounds, linear-combination certificates,
ideal-membership bridges, and translation and confluence results under the
coefficient hypotheses required by each theorem.

The polynomial results follow the reduction theory in
Becker--Weispfenning--Kredel, Chapter 5.

Polynomial reduction as a relation

The central definition is one-step reduction modulo a set of polynomials:

def MonomialOrder.ReducesToSet
    (m : MonomialOrder σ)
    (P : Set (MvPolynomial σ R))
    (f g : MvPolynomial σ R) : Prop :=
  ∃ p ∈ P, m.ReducesToPoly p f g

A reduction step chooses one nonzero reducer and one term of the source
polynomial. Both monomial divisibility and coefficient divisibility are
required. The resulting polynomial is obtained by subtracting the witnessed
monomial multiple of that reducer.

For example, reducibility is characterized without assumptions on leading
coefficients by:

theorem MonomialOrder.ReducesToPoly.reducible_iff_exists_degree_le_and_leadingCoeff_dvd
    (p f : MvPolynomial σ R) :
    m.Reducible p f ↔
      p ≠ 0 ∧
        ∃ t ∈ f.support,
          m.degree p ≤ t ∧
            m.leadingCoeff p ∣ f.coeff t

Likewise, a polynomial is in normal form exactly when no support term satisfies
both divisibility conditions for a nonzero reducer. When every nonzero reducer
has unit leading coefficient, this specializes to the usual monomial
divisibility condition.

Termination and certificates

Every reduction step strictly decreases the colexicographic order on finite
supports. This proves that the reverse reduction relation is well-founded,
without imposing unit or regularity assumptions on leading coefficients.

Finite reduction also produces explicit quotient data with the expected degree
bound:

theorem MonomialOrder.exists_linearCombination_of_reflTransGen_with_degree_bound
    (B : Set (MvPolynomial σ R))
    {f r : MvPolynomial σ R}
    (h : f ⟶*[m, B] r) :
    ∃ q : B →₀ MvPolynomial σ R,
      f =
        Finsupp.linearCombination
          (MvPolynomial σ R)
          (fun b : B => (b : MvPolynomial σ R))
          q + r ∧
        ∀ b : B, m.degree ((b : MvPolynomial σ R) * q b) ≼[m] m.degree f

Thus a finite reduction sequence supplies the linear-combination certificate
expected from a division/remainder statement.

Coefficient assumptions

The API separates the assumptions needed by different results:

  • The reduction relation, its general reducibility and normal-form
    characterizations, termination, degree bounds, certificates, and the
    implication from reduction equivalence to ideal congruence require no unit
    assumptions.
  • Reduction of a multiple of a chosen reducer to zero only requires the leading
    coefficient of that reducer to be a non-zero-divisor when the reducer is
    nonzero.
  • The translation lemmas and the equivalence between reduction equivalence and
    congruence modulo Ideal.span P use the hypothesis that every reducer is
    either zero or has unit leading coefficient.
  • Local confluence for reduction modulo a singleton {p} requires only that
    p have unit leading coefficient. The corresponding result for a set
    generating the same principal ideal uses the zero-or-unit hypothesis on that
    set.

Relation-level API

This development is intended to depend on #40368 for Relation.Diamond,
Relation.Confluent, and Relation.ChurchRosser, together with their basic
conversion API.

The new file Mathlib.Logic.Relation.NormalForm adds the normal-form
vocabulary and Newman-style results used by polynomial reduction:

  • Relation.IsNormalForm
  • Relation.IsNormalFormOf
  • Relation.UniqueNormalForms
  • Relation.LocallyConfluent

Scope

The reduction relation in this PR is a termwise, single-reducer relation: each
step uses one polynomial from the reducer set to eliminate one term of the
source polynomial.

An earlier version also included a reduction-theoretic Gröbner basis criterion.
That layer is intentionally deferred. Over arbitrary coefficient rings,
relating single-reducer reduction to an ideal-based leading-term criterion
requires a careful distinction between single-reducer and weak reduction.
Keeping the criterion in a separate PR will also allow it to reuse the shared
Gröbner-basis API rather than introduce a competing definition.


Open in Gitpod

@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 Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

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 commented Jul 8, 2026 •

Copy link
Copy Markdown

PR summary c51af61474

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Logic.Relation.NormalForm (new file) 92
Mathlib.RingTheory.MvPolynomial.PolynomialReductions (new file) 1462

Declarations diff (regex)

+ ChurchRosser
+ ChurchRosser.confluent
+ ChurchRosser.locallyConfluent
+ Confluent
+ Confluent.churchRosser
+ Confluent.locallyConfluent
+ Confluent.uniqueNormalForms
+ Diamond
+ EqvGen
+ IsNormalForm
+ IsNormalFormOf
+ Join
+ LocallyConfluent
+ ReducesToBy
+ ReducesToPoly
+ ReducesToSet
+ Reducible
+ ReducibleSet
+ ReflTransGen
+ UniqueNormalForms
+ asymm
+ char
+ coeff_eq_of_reduced_term_lt
+ coeff_eq_zero_of_reducesToBy
+ confluent_of_wellFounded_flip_of_locallyConfluent
+ confluent_of_wellFounded_flip_of_uniqueNormalForms
+ degree_le_of_reducesToSet
+ degree_le_of_reflTransGen
+ eq_of_isNormalForm
+ eqvGen_add_mul_mem
+ eqvGen_iff_sub_mem_span
+ eqvGen_of_sub_reflTransGen_zero
+ exists_linearCombination_of_reducesToSet
+ exists_linearCombination_of_reducesToSet_with_degree_bound
+ exists_linearCombination_of_reflTransGen
+ exists_linearCombination_of_reflTransGen_with_degree_bound
+ exists_normalFormOf_of_wellFounded_flip
+ finsuppLex_of_toColex_lt_toColex
+ isUnit_leadingCoeff_of_mem_ne
+ join_of_sub_reflTransGen_zero
+ leadingCoeff_unit_or_zero_singleton
+ locallyConfluent
+ locallyConfluent_of_confluent
+ locallyConfluent_of_span_eq_singleton
+ locallyConfluent_singleton
+ mem_iff_of_not_mem_symmDiff
+ mem_span_of_reflTransGen_zero
+ monomial_mul_reducesToPoly
+ mul_mem_reducesTo_subLTerm_mul
+ mul_mem_reflTransGen_zero
+ normalForm_iff_forall_not_degree_le
+ normalForm_iff_forall_not_degree_le_and_dvd
+ reducible_iff_exists_degree_le_and_leadingCoeff_dvd
+ reducible_iff_exists_degree_le_of_isUnit
+ reflTransGen_mono
+ reflTransGen_reducesToPoly_to_singleton
+ reflTransGen_singleton_to_reducesToPoly
+ singleton_iff
+ subLTerm_eq_zero_of_degree_eq_zero
+ sub_mem_span_of_eqvGen
+ sub_mem_span_of_reducesToSet
+ sub_mem_span_of_reflTransGen
+ supportColexLt_wellFounded
+ translation_reflTransGen
+ translation_step
+ uniqueNormalForms_of_confluent
++ NormalForm
++ to_eqvGen
++ wellFounded
+++ supportColexLt

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

  • +74 new declarations
  • −0 removed declarations
+Finset.Colex.wellFounded
+MonomialOrder.ReducesToBy
+MonomialOrder.ReducesToPoly
+MonomialOrder.ReducesToPoly.NormalForm
+MonomialOrder.ReducesToPoly.coeff_eq_of_reduced_term_lt
+MonomialOrder.ReducesToPoly.coeff_eq_zero_of_reducesToBy
+MonomialOrder.ReducesToPoly.locallyConfluent
+MonomialOrder.ReducesToPoly.reducible_iff_exists_degree_le_and_leadingCoeff_dvd
+MonomialOrder.ReducesToPoly.reducible_iff_exists_degree_le_of_isUnit
+MonomialOrder.ReducesToPoly.supportColexLt
+MonomialOrder.ReducesToSet
+MonomialOrder.ReducesToSet.EqvGen
+MonomialOrder.ReducesToSet.Join
+MonomialOrder.ReducesToSet.NormalForm
+MonomialOrder.ReducesToSet.ReflTransGen
+MonomialOrder.ReducesToSet.asymm
+MonomialOrder.ReducesToSet.locallyConfluent_of_span_eq_singleton
+MonomialOrder.ReducesToSet.locallyConfluent_singleton
+MonomialOrder.ReducesToSet.normalForm_iff_forall_not_degree_le
+MonomialOrder.ReducesToSet.normalForm_iff_forall_not_degree_le_and_dvd
+MonomialOrder.ReducesToSet.reflTransGen_mono
+MonomialOrder.ReducesToSet.reflTransGen_reducesToPoly_to_singleton
+MonomialOrder.ReducesToSet.reflTransGen_singleton_to_reducesToPoly
+MonomialOrder.ReducesToSet.singleton_iff
+MonomialOrder.ReducesToSet.supportColexLt
+MonomialOrder.ReducesToSet.wellFounded
+MonomialOrder.Reducible
+MonomialOrder.ReducibleSet
+MonomialOrder.degree_le_of_reducesToSet
+MonomialOrder.degree_le_of_reflTransGen
+MonomialOrder.eqvGen_add_mul_mem
+MonomialOrder.eqvGen_iff_sub_mem_span
+MonomialOrder.eqvGen_of_sub_reflTransGen_zero
+MonomialOrder.exists_linearCombination_of_reducesToSet
+MonomialOrder.exists_linearCombination_of_reducesToSet_with_degree_bound
+MonomialOrder.exists_linearCombination_of_reflTransGen
+MonomialOrder.exists_linearCombination_of_reflTransGen_with_degree_bound
+MonomialOrder.join_of_sub_reflTransGen_zero
+MonomialOrder.mem_span_of_reflTransGen_zero
+MonomialOrder.monomial_mul_reducesToPoly
+MonomialOrder.mul_mem_reducesTo_subLTerm_mul
+MonomialOrder.mul_mem_reflTransGen_zero
+MonomialOrder.subLTerm_eq_zero_of_degree_eq_zero
+MonomialOrder.sub_mem_span_of_eqvGen
+MonomialOrder.sub_mem_span_of_reducesToSet
+MonomialOrder.sub_mem_span_of_reflTransGen
+MonomialOrder.supportColexLt
+MonomialOrder.supportColexLt_wellFounded
+MonomialOrder.translation_reflTransGen
+Reduction.«term_↓[_,_]_»
+Reduction.«term_⟶*[_,_]_»
+Reduction.«term_⟶[_,_]_»
+Reduction.«term_⟷*[_,_]_»
+Reduction.«term_⟷[_,_]_»
+Relation.ChurchRosser
+Relation.ChurchRosser.confluent
+Relation.ChurchRosser.locallyConfluent
+Relation.Confluent
+Relation.Confluent.churchRosser
+Relation.Confluent.locallyConfluent
+Relation.Confluent.uniqueNormalForms
+Relation.Diamond
+Relation.IsNormalForm
+Relation.IsNormalFormOf
+Relation.Join.to_eqvGen
+Relation.LocallyConfluent
+Relation.ReflTransGen.eq_of_isNormalForm
+Relation.ReflTransGen.to_eqvGen
+Relation.UniqueNormalForms
+Relation.confluent_of_wellFounded_flip_of_locallyConfluent
+Relation.confluent_of_wellFounded_flip_of_uniqueNormalForms
+Relation.exists_normalFormOf_of_wellFounded_flip
+Relation.locallyConfluent_of_confluent
+Relation.uniqueNormalForms_of_confluent

No changes to strong technical debt.

Increase in weak tech debt: (relative, absolute) = (2.00, 0.00)
Current number Change Type (weak)
exposed public sections 5049 2

Current commit c51af61474
Reference commit 69fe4f49ff

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

@Sanghyeok0
Sanghyeok0 marked this pull request as ready for review July 19, 2026 15:06
@mathlib-dependent-issues

Copy link
Copy Markdown

This PR/issue depends on:

@mathlib-dependent-issues mathlib-dependent-issues Bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Jul 19, 2026
@Sanghyeok0
Sanghyeok0 marked this pull request as draft July 19, 2026 15:18
@mathlib-bors

mathlib-bors Bot commented Jul 19, 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.

@Sanghyeok0 Sanghyeok0 changed the title MvPolynomial: polynomial reduction relations and Gröbner basis criterion MvPolynomial: polynomial reduction as a relation Jul 20, 2026
@Sanghyeok0
Sanghyeok0 marked this pull request as ready for review July 21, 2026 09:15

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

blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant