Proof for divX_mul_X_add#87
Merged
dhsorens merged 2 commits intodhsorens/unipoly-apifrom Feb 13, 2026
Merged
Conversation
Automated commit at 20260213_151653
🤖 Gemini PR SummaryThis Pull Request completes the formal proof of the polynomial identity Features
Refactoring
Technical NotesThe proof handles the edge case of index Analysis of Changes
✅ **Removed:** 1 `sorry`(s)
🎨 **Style Guide Adherence**Based on the provided style guide, here are the violations found in the code changes:
📄 **Per-File Summaries**
Last updated: 2026-02-13 15:29 UTC. |
dhsorens
approved these changes
Feb 13, 2026
dhsorens
added a commit
that referenced
this pull request
Feb 13, 2026
* feat: first commit introducing full API for canonical polynomials, with sorrys * feat: progress on proofs * feat: progress on proofs * Proof for degree_eq_support_max (#80) * Proof for degree_eq_support_max Automated commit at 20260211_230303 * fix: linting errors and warnings * fix: reintroduce docstring * fix: annotate lemmas --------- Co-authored-by: aleph-prover[bot] <247409690+aleph-prover[bot]@users.noreply.github.com> Co-authored-by: Derek Sorensen <d@dhsorens.com> * Proof for induction_on (#81) * Proof for induction_on Automated commit at 20260211_232242 * fix: linting errors, warnings, docstrings, annotation --------- Co-authored-by: aleph-prover[bot] <247409690+aleph-prover[bot]@users.noreply.github.com> Co-authored-by: Derek Sorensen <d@dhsorens.com> * feat: add proofs for remaining sorrys * fix: stylistic fixes * feat: remove unnecessary, commented TODO * fix: improve proof quality * fix: remove applications of the classical tactic * feat: improve proofs, change tail to (correct) divX * feat: add division to (canonical) polynomials * feat: improve API with further lemmas from Raw polynomials * feat: stylistic improvements, consistent assumptions, etc * feat: rename lemmas to be more in line with mathlib naming conventions * fix: typo * feat: README, small formatting refactor, some TODOs * feat: proof of coeff_toPoly * Proof for divX_toPoly (#85) * Proof for divX_toPoly Automated commit at 20260213_143852 * fix: incorporate existing proof * fix docstring --------- Co-authored-by: aleph-prover[bot] <247409690+aleph-prover[bot]@users.noreply.github.com> Co-authored-by: Derek Sorensen <d@dhsorens.com> * add divX_mul_X_add statement * Proof for eval₂_toPoly (#86) * Proof for eval₂_toPoly Automated commit at 20260213_145823 * fix: docstrings, formatting, warnings --------- Co-authored-by: aleph-prover[bot] <247409690+aleph-prover[bot]@users.noreply.github.com> Co-authored-by: Derek Sorensen <d@dhsorens.com> * Proof for divX_mul_X_add (#87) * Proof for divX_mul_X_add Automated commit at 20260213_151653 * fix: formatting errors and warnings --------- Co-authored-by: aleph-prover[bot] <247409690+aleph-prover[bot]@users.noreply.github.com> Co-authored-by: Derek Sorensen <d@dhsorens.com> --------- Co-authored-by: aleph-prover[bot] <247409690+aleph-prover[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proven lemmas: 3/3
The goal is to prove the polynomial identity divX p * X + C (p.coeff 0) = p for any CPolynomial p over a nontrivial ring/semiring R: informally, dividing by X and then multiplying back by X recovers all higher-degree terms, and the missing constant term is restored by adding C(p₀). The proof was decomposed into two coefficient “shift” lemmas about multiplication by X, and then a final step that compares coefficients on both sides. First, coeff_mul_X_zero shows that the constant coefficient of p * X is 0. Second, coeff_mul_X_succ shows that for every n, the (n+1)-st coefficient of p * X equals the n-th coefficient of p (multiplication by X shifts coefficients up by one). With these in hand, the main theorem divX_mul_X_add is proved by coefficient extensionality: check k = 0 separately (the X-multiple contributes 0 and C(p₀) contributes p₀), and check k = n+1 using the shift lemma plus the defining coefficient rule for divX.
Progress: all 3 sub-problems out of 3 are solved (both shift lemmas and the final coefficient-extensionality argument). There is no remaining mathematical gap; what’s left is only to integrate/clean up the proven Lean code so the file compiles smoothly with the intended imports and instances. One interesting technical challenge handled along the way is that only one term in the convolution sum for coeff(p * X) can survive (because coeff X j is 0 unless j = 1), so the proof collapses a finite sum to a single index using a “sum equals single term” argument, together with small arithmetic facts about n+1−i. Another minor gotcha is disambiguating similarly named lemmas for coeff_X coming from different namespaces, which the proof resolves by using the appropriate qualified lemma when rewriting.