-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merged by Bors] - feat: port Data.MvPolynomial.Funext #3225
Conversation
Parcly-Taxel
commented
Apr 2, 2023
Mathbin -> Mathlib fix certain import statements move "by" to end of line add import to Mathlib.lean
|
||
variable {R : Type _} [CommRing R] [IsDomain R] [Infinite R] | ||
|
||
set_option maxHeartbeats 1000000 in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this line is absent, there are timeouts. Should I leave it this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At minimum, needs to have a -- Porting note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to look at this now, but waiting on oleans / cache get!
problems.
Two possibilities that I'd be okay with:
- Leave it in, with a porting note
- Split out two separate lemmas
funext_fin_zero
andfunext_fin_succ
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, the answer here is that this proof should never have been in mathlib3 in the first place. There is a lemma that should have been factored out:
theorem eval_eval_finSuccEquiv (f : MvPolynomial (Fin (n + 1)) R) :
(eval x) (Polynomial.eval q (finSuccEquiv R n f)) = eval (Fin.cons (eval x q) x) f := sorry
private theorem funext_fin {n : ℕ} {p : MvPolynomial (Fin n) R}
(h : ∀ x : Fin n → R, eval x p = 0) : p = 0 := by
induction' n with n ih
· apply (MvPolynomial.isEmptyRingEquiv R (Fin 0)).injective
rw [RingEquiv.map_zero]
convert h finZeroElim
· apply (finSuccEquiv R n).injective
simp only [AlgEquiv.map_zero]
refine Polynomial.funext fun q => ?_
rw [Polynomial.eval_zero]
apply ih fun x => ?_
calc _ = _ := eval_eval_finSuccEquiv p
_ = 0 := h _
eval_eval_finSuccEquiv
needs to be proved, and moved to Mathlib.Data.MvPolynomial.Equiv
, after eval_eq_eval_mv_eval'
.
In @jcommelin's defence, when he wrote this proof in leanprover-community/mathlib#4196 the API in Mathlib.Data.MvPolynomial.Equiv
wasn't as developed.
@Parcly-Taxel, do you want to tackle this? (Up to you of course.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Parcly-Taxel, I went down the rabbit hole and proved the theorem. There are some TODO
s about things that need to be moved, still.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@semorrison Should we make a mathlib3 PR that moves the theorems to their proper files and rewrites funext_fin
accordingly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that would be a great idea, if you're up for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done this now.
As I've now written most of this, can someone else please review and merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 🎉
bors merge
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Johan Commelin <johan@commelin.net>
Pull request successfully merged into master. Build succeeded: |
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Johan Commelin <johan@commelin.net>
This proof was timing out in leanprover-community/mathlib4#3225, so I completely rewrote it using smaller lemmas. This is the backport. Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Johan Commelin <johan@commelin.net>