UniPoly equivalence relation and quotient operations - #106
Conversation
…ize_eq_iff_forall_eq which is analogous to the yet unproved analogous lemma for lists matchSize_eq_iff_forall_eq
…rations on the quotient polynomial type descended from the univariant polynomial type. left some TODOs
…relies on small lemma left as TODO
…d operations on UniPoly
|
I think it would be good to redefine |
|
@mitschabaude That is sensible, I had wondered why there was a separate definition. I made the change, which essentially eliminated the need for unproved lemmas. FIX: everything included in this PR is now proved |
|
Is any reason to keep the old definition around, possibly proving equivalence? |
|
Awesome! What is the old definition you're referring to? |
| def equiv (p q : UniPoly R) : Prop := | ||
| match p.matchSize q 0 with | ||
| | (p', q') => p' = q' |
There was a problem hiding this comment.
@quangvdao the old definition is this one here -- two polynomials are equivalent if, when zero-padded into arrays of the same size, they are equal
There was a problem hiding this comment.
Ah yeah. sounds good to me
Also we should think about which of QuotientUniPoly or UniPolyC should be "the" way to get equivalence with polynomial. The non-quotient version might be preferable?
There was a problem hiding this comment.
From what I can tell, that probably depends on what the vision of this repo is (I'm familiar with it, but still new here!). Aesthetically, I quite like QuotientUniPoly -- but UniPolyC is likely more computation-friendly? Considering this is a repo directly aimed at snarkification/formal verification we might favor the computation (non-quotient) in the long run
|
LGTM? |
|
/review External: Internal: Comments: |
🤖 AI Review (with external context)\n\nGenerating AI review...Hello! As an expert code reviewer, I've analyzed the pull request. Here is my review: High-Level SummaryThis pull request significantly improves the formalization of univariate polynomials ( Building on this solid foundation, the PR then begins to construct the quotient type The changes are well-motivated and represent a clear architectural improvement. I have one major concern regarding a pre-existing Critical Issue: Dependency on
|
…add_descends and neg_descends
|
gh actions made a good point on the proofs of |
|
next steps include the TODOs and |
|
Okay, this looks good to me. will merge. |
…M#106) * feat: prove equiv_trans for arrays; uses unproved helper lemma matchSize_eq_iff_forall_eq which is analogous to the yet unproved analogous lemma for lists matchSize_eq_iff_forall_eq * feat: initial organization of definitions and lemmas for defining operations on the quotient polynomial type descended from the univariant polynomial type. left some TODOs * feat: defined functions for add, sub, and neg that will be lifted * feat: first proofs that add, sub, and neg descend thru the quotient. relies on small lemma left as TODO * fix: improve lemmas * feat: refine the lemmas about the relationship between equivalence and operations on UniPoly * feat: redefine equiv to be Trim.equiv bc of existing theory * fix: prove lemma that neg and coeff commute * fix: accidentally deleted popWhile_nil_or_last_false * fix: in response to gh feedback, simplify the logic of the proofs of add_descends and neg_descends * cleanup: remove superfluous open list
Summary
This PR:
UniPolyis transitive, using an (assumed) lemma analogous to the (also unproved) lemma used in the List caseadd,neg, andsubon the resulting quotient and proves that the equivalent operations onUniPolydescendFrom here, the main TODO would be to show that the remaining operations on
UniPolydescend to the quotient.Related Issue
Related to #7