chore: weaken commutativity assumptions for AdjoinRoot.lift and AdjoinRoot.liftHom - #9564
AntoineChambert-Loir wants to merge 19 commits into
Conversation
| -- It is a bit annoying that one be obliged to fill in this implicit hypothesis | ||
| AdjoinRoot.lift_root (hc := fun _ ↦ Commute.all _ _) (aeval_gen_minpoly F α) |
There was a problem hiding this comment.
I wonder whether it can maybe be supplied by a default argument/tactic. So that users in the commutative world never need to think about it.
There was a problem hiding this comment.
@jcommelin I tried to think about this, but got confused by the syntax and could not make any progress (what I tried did not work at all). From the Zulip discussion, it seems that you had an idea of how that could be implemented… Could you please share some hint?
There was a problem hiding this comment.
I pushed to jmc-AdjoinRoot. I'll let you decide which option you prefer.
(Note that I renamed lift' to lift, and there is now only one version.)
There was a problem hiding this comment.
I just had a look! Wonderful!
|
The |
This allows us to restore quite a few uses of `lift` to the original. The only drawback in the commutative case is we have to write `(lift i a h) x` instead of `lift i a h x` (since the autoparam comes after the `h`). Also, `simp` doesn't discharge autoparams automatically, so I added an extra set of lemmas that use implicits instead of autoparams, to be filled by unification.
|
I pushed a commit which tags a few lemmas and replaces |
| apply Ideal.Quotient.lift _ (eval₂RingHom i x) | ||
| It is currently only used in `AdjoinRoot.lift`. -/ | ||
| macro "commutativity" : tactic => | ||
| `(tactic| first | aesop | |
There was a problem hiding this comment.
This should probably raise an error if there is no Commute in the goal
There was a problem hiding this comment.
@eric-wieser Do you know how to check this? I don't...
There was a problem hiding this comment.
Are Aesop rulesets a thing? If not, using guard_target would probably work.
There was a problem hiding this comment.
guard_target isn't quite what we want here: for example, lift wants to use commutativity to solve ∀ r, Commute (i r) x.
WRT rulesets: do you mean we should set the commutativity tactic to use a commutativity ruleset exclusively? I feel like that's premature optimization.
There was a problem hiding this comment.
Yes, I think we should do that because it matches the pattern set by measurability. I don't think that commutativity as a tactic should be solving everything that aesop can solve.
There was a problem hiding this comment.
@eric-wieser @Vierkantor do you want me to try copying the measurability tactic file and build a commutativity tactic along its line?
| /- | ||
| Copyright (c) 2024 Antoine Chambert-Loir. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Antoine Chambert-Lori (based on Measurability, by Miyahara Kō) |
There was a problem hiding this comment.
Typo? :)
| Authors: Antoine Chambert-Lori (based on Measurability, by Miyahara Kō) | |
| Authors: Antoine Chambert-Loir (based on Measurability, by Miyahara Kō) |
|
Mathlib has moved to PRs from forks. This PR is still from a branch of the main repository and will soon be closed! Please migrate the content to a fork and reopen a PR from there if you wish to do so. See Zulip topic for more instructions. Thank you for contributing to mathlib! |
|
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 |
|
This PR has been migrated to a fork-based workflow: #43971 |
I weaken a commutativity assumption for docs#AdjoinRoot.liftHom that the target algebra be commutative. It is only assumed to be a Semiring.
For that, I need to generalize docs#AdjoinRoot.lift which takes
i : R ->+* S,a : Swithf.eval₂ i a = 0and definesAdjoinRoot f ->+* Sthat extendsiand sendsAdjoinRoot.root ftoa.The initial version of the PR was to define
AdjoinRoot.lift'whereSis only a Semiring, with the additional assumptionhcomm : ∀ r, Commute (i r) athat the elementacommutes with the image ofi.@jcommelin suggested to provide this argument as an
autoParam, filled in by an ad hoccommutativitytactic. However, such an argument cannot be made implicit and a first version required to have this argument given each time, most of the time by_, even for all subsequent lemmas,AdjoinRoot.lift_mk, etc.To avoid this, I tried to make this assumption a
⦃hcomm : ∀ r, Commute (i r) a⦄. This appears to have some side effects that proofs using anexacttactic or in term mode do not work well, but one can resort onby simp […]. Maybe @eric-wieser or @Vierkantor will have opinions on that. In some cases one can still give the argument as(hcomm := by commutativity).(There are 3 options :
commutativitytactic, but with an argument_sometimes