Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

feat(tactic/compute_degree + test/compute_degree): a tactic for computing nat_degrees of polynomials #14040

Closed
wants to merge 425 commits into from

Conversation

adomani
Copy link
Collaborator

@adomani adomani commented May 9, 2022

compute_degree tries to solve a goal of the form f.nat_degree = d or f.degree = d, where d : ℕ and f
satisfies:

  • f is a sum of expression of the form
    C a * X ^ n, C a * X, C a, X ^ n, X, monomial n a, monomial n a * monomial m b,
  • all exponents and the n in monomial n a are closed terms of type ,
  • the term with largest exponent is X ^ n and is the unique term of its degree (repetitions are
    allowed in terms of smaller degree).
    If the given degree does not match what the tactic computes, the tactic suggests the degree it
    computed.
    The tactic also reports when it is used with non-closed natural numbers as exponents.

There is a further tactic compute_degree_le, closing goals of the form f.nat_degree ≤ d, with similar, but slightly less stringent restrictions in f. Currently, compute_degree_le does not support degree, only nat_degree.

Zulip


Open in Gitpod

@mathlib-dependent-issues-bot mathlib-dependent-issues-bot added the blocked-by-other-PR This PR depends on another PR which is still in the queue. A bot manages this label via PR comment. label May 9, 2022
@adomani adomani added the modifies-tactic-syntax This PR adds a new interactive tactic or modifies the syntax of an existing tactic. label May 9, 2022
@adomani adomani added t-meta Tactics, attributes or user commands awaiting-review The author would like community review of the PR labels May 9, 2022
@adomani
Copy link
Collaborator Author

adomani commented Jul 22, 2022

@eric-wieser
The issues are partially solved.

  • The recover was a consequence of using simp to prove a fact that simp was not actually able to prove. I fixed it by using simp + norm, even though norm_num alone would be sufficient, since this helps with speeding up the rest of the tactic.
  • The slowness is still a little bit of an issue, but at least the tests do not timeout!

Overall, the main issue left for me is that of the speed of the tactic: it seems quite slow, but I do not know how to speed it up.

joelriou pushed a commit that referenced this pull request Jul 23, 2022
… for proving `f.(nat_)degree ≤ d` (#14762)

This PR is a prequel to #14040.  It introduces a simpler step than the actual computation of the degree.  This step is used by the "main" tactic `compute_degree` defined in #14040.

To help the reviewing process, I split this PR from the other one.

For a very small sample of some golfing that could be done with this tactic, see [this diff](https://github.com/leanprover-community/mathlib/compare/adomani_compute_degree_le..adomani_compute_degree_le_golf), from #14776.
bors bot pushed a commit that referenced this pull request Nov 10, 2022
…ands (#13483)

This PR introduces a tactic for moving summands of an expression.  Individual terms can be named, also using pattern-matching, and moved to the beginning or to the end of the sum.

#14228 shows a sample of golfing and usage of `move_add`, and the [diff](aa_sort...adomani_move_add_random_golf) between them.

#14618 contains the doc-string update to `ac_change`: I moved it to a separate PR to save CI cycles.

See `compute_degree` in #14040 for a related tactic to compute `degree`s and `nat_degree`s of polynomials that uses `move_add`.

~~A future PR may add support for sorting also factors of a product, though this may happen after the switch to Lean4.~~



Co-authored-by: Arthur Paulino <arthurleonardo.ap@gmail.com>
@mathlib-dependent-issues-bot mathlib-dependent-issues-bot removed the blocked-by-other-PR This PR depends on another PR which is still in the queue. A bot manages this label via PR comment. label Nov 10, 2022
@adomani adomani requested a review from a team as a code owner November 16, 2022 06:54
@kim-em kim-em added the too-late This PR was ready too late for inclusion in mathlib3 label Jul 16, 2023
@kim-em kim-em removed the request for review from a team August 6, 2023 09:57
@adomani adomani closed this Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
modifies-tactic-syntax This PR adds a new interactive tactic or modifies the syntax of an existing tactic. t-meta Tactics, attributes or user commands too-late This PR was ready too late for inclusion in mathlib3 WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants