-
Notifications
You must be signed in to change notification settings - Fork 298
feat(tactic/polyrith): solve more problems by testing for membership in the radical #15425
Conversation
I might not know what I am talking about, but it might be possible to perform some kind of binary search on the exponent in the range of say 1~64 if you have 7 queries available and testing for large polynomials isn't that much more costly than small ones? |
Interesting thought! This assumes that 64 (or whatever we choose) is high enough for most of the problems we see and that the exponents are approximately uniformly distributed in that range. I'd guess (without any evidence) that in typical problems, very low exponents will be more common. But this is really just a gut feeling and I have no test suite of typical problems to check. I'd also have to think about how the ideal membership test scales with the exponent. There is a cost there but I don't know how severe. |
If you're going to binary search, would it make more sense to just repeatedly double the exponent? |
It turns out there's a "standard trick" for doing this without search: see e.g. section 2.2 of https://arxiv.org/pdf/1007.3615.pdf . I'll investigate whether Sage/Singular supports this trick out of the box or if we need to implement it ourselves. Marking this PR as WIP for now. |
Ooh, that's clever! |
Note to self, the json changes here will need to be adapted when #15429 lands. |
… a boolean algebra (#15606) Abstract the construction of `boolean_algebra (finset α)`.
This change means that `option (rbmap string α)` can now serialize
* Use `namespace isometry`. * Add lemmas like `isometry.preimage_ball`.
…nstances (#15602) We move the trivial `pi.has_sdiff`, `pi.has_compl`, and `Prop.has_compl` instances to `order/basic.lean`. The main effect of this is that `rᶜ` for the complement of a relation is now available basically anywhere.
…Neumann bounded = metric bounded (#15124)
…` as `p.support.max` (#15199) This PR redefines `polynomial.degree p`: * old: `p.support.sup coe` * new: `p.support.max`. The two definitions are defeq and relatively few changes are required. Weirdness: `open finset` seems to no longer work consistently. This is the largest source of differences. In particular, the file `ring_theory/polynomial/cyclotomic/basic` only changed because I added `finset.` in several places.
Define the upper/lower set generated by a set. Co-authored-by: Peter Nelson
Since we're interfacing with ordinals and since `pgame` holds no data, we simplify `nim` and allow it to be noncomputable. We need to give `nim` the `noncomputable!` attribute to avoid a VM compilation bug.
…ween edge densities (#15353) Auxiliary lemma for Szemerédi Regularity Lemma. Co-authored-by: Bhavik Mehta <bhavik@[email protected]>
…ion.atomise` (#15350) Auxiliary lemmas for Szemerédi Regularity Lemma. Co-authored-by: Bhavik Mehta <[email protected]>
f6893ac
to
cd8620d
Compare
I've implemented the "standard trick" (see also 4.2 Prop 8 of Cox, Little, O'Shea). This is still pending docs, test updates, and #15428 (which I think is ready to go). While this approach is clearly better overall than the old "search up" approach, there's one downside, namely, it doesn't fall back to the old behavior in the common case where the exponent is 1. Instead we solve a more general problem and deduce from that that |
It looks like you've accidentally rebased master on top of your branch, as there are 170 commits now! |
And I've marked this awaiting-review mostly for comments on:
|
One possible way is to use the |
Also, you could include a proof of this result:
and ask sage for a lift to the ideal generated by the hypothesis plus c*X - 1 (being X an extra variable). Then you can use sage's answer to create a proof of the needed hypothesis, and apply it. |
I have done some simple benchmarking with five variables, and it doesn't seem to be a problem. When the previous method was fast (say, in the order of few seconds or less), the new method was also fast. In fact, in many instances it even happens that the new method is (way) faster! So it is perfectly possible that the new behaviour would be preferable for the speed boost alone. |
…onent := n }` (#15428) #15425 will solve problems where the goal is not a linear combination of hypotheses, but a *power* of the goal is. This PR provides a more natural certificate for these proofs. Writing `linear_combination ... with { exponent := 2 }` will square the goal before subtracting the linear combination. In principle this could be useful even outside of `polyrith`. Co-authored-by: Rob Lewis <[email protected]> Co-authored-by: Yaël Dillies <[email protected]>
This PR/issue depends on: |
[mathlib3#15428](leanprover-community/mathlib3#15428) added an exponent option to `linear_combination`. The idea is that `linear_combination (exp := 2) ...` will take a linear combination of hypotheses adding up to the *square* of the goal. This is only mildly useful on its own, but it's a very useful certificate syntax for [mathlib3#15425](leanprover-community/mathlib3#15425). Co-authored-by: Rob Lewis <[email protected]>
Closing, since this was implemented in leanprover-community/mathlib4#7790 |
In @hrmacbeth 's tutorial, there were examples of problems that
polyrith
could almost solve, but failed. The goal was not expressible as a linear combination of the hypotheses but a power of the goal was.Mathematically,
x+y*z
is in the radical of the ideal generated byx-y, x*y
. Sage can compute the radical and test for membership. Once it's confirmed that some power of the goal is in the ideal, we can count up until we find which power it is. The certificate returned is an application ofpow_eq_zero
with this power, then a call tolinear_combination
like normal.There's an open question here: instead of a boolean test for membership in the radical, then naively testing every power for membership in the original ideal, is there a way to extract the power more efficiently during the computation of the radical? This is both a mathematical question and a Sage/Singular API question.
But in any case, the naive approach works on small enough problems (the degree 6 example from Heather's tutorial spends 400ms calling Sage including the communcation overhead), and should have no effect on performance in the cases
polyrith
already solves.linear_combination with { exponent := n }
#15428Tests do not build yet. #15292 also affects the tests output. I'll update this one when that one is merged, or stack them if/when I have the energy.