Skip to content
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(tactic/field_simp): let field_simp use norm_num to prove numerals are nonzero #5418

Closed
wants to merge 8 commits into from

Conversation

sgouezel
Copy link
Collaborator

@sgouezel sgouezel commented Dec 18, 2020

As suggested by @robertylewis in https://leanprover.zulipchat.com/#narrow/stream/113489-new-members/topic/Solving.20simple.20%28in%29equalities.20gets.20frustrating/near/220278546, change the discharger in field_simp to try assumption on goals x ≠ 0 and norm_num1 on these goals when x is a numeral.


Since field_simp now depends on norm_num, I have moved it to its own file instead of tactic.interactive.

@sgouezel sgouezel added the WIP Work in progress label Dec 18, 2020
@sgouezel sgouezel added awaiting-review The author would like community review of the PR and removed WIP Work in progress labels Dec 18, 2020
(cfg : simp_config_ext := {discharger := field_simp.ne_zero}) : tactic unit :=
let attr_names := `field_simps :: attr_names,
hs := simp_arg_type.except `one_div :: simp_arg_type.except `mul_eq_zero :: hs in
propagate_tags (simp_core cfg.to_simp_config cfg.discharger no_dflt hs attr_names locat)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh. field_simp isn't simp only using field_simps, it uses the full simp set. I didn't realize this. So technically nonterminal field_simp is a bad idea, although I guess it's less likely to be abused than regular simp.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there are places in the library where it's used as: simp + the additional ability to simplify denominators. Just like simp, it shouldn't be used non-terminally, but in general it is just field_simp [...], ring.

Comment on lines +54 to +55
fact that a product is nonzero when all factors are, and that a power of a nonzero number is
nonzero, are included in the simpset, but more complicated assertions (especially dealing with sums)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you've changed the discharger from the default simp, this claim about products and powers is no longer true, right? The only preconditions you'll solve are those that are literally in the context and numeric ones.

Copy link
Collaborator Author

@sgouezel sgouezel Dec 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it. The default discharger for simp is failed, right? So it's only making things more powerful. Indeed, with the modification it solves everything it solved previously (at least all the mathlib examples and tests).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry, I take it back. Seems like the discharger option is used in addition to recursively calling simp. I thought it was replacing that.

@robertylewis robertylewis added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Dec 19, 2020
@sgouezel sgouezel added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Dec 19, 2020
@robertylewis
Copy link
Member

I don't see a commit for the change in nnreal @eric-wieser suggested. Otherwise looks good to me, thanks!

bors d+

@bors
Copy link

bors bot commented Dec 19, 2020

✌️ sgouezel can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@sgouezel
Copy link
Collaborator Author

bors r+

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Dec 20, 2020
bors bot pushed a commit that referenced this pull request Dec 20, 2020
…s are nonzero (#5418)

As suggested by @robertylewis in https://leanprover.zulipchat.com/#narrow/stream/113489-new-members/topic/Solving.20simple.20%28in%29equalities.20gets.20frustrating/near/220278546, change the discharger in `field_simp` to try `assumption` on  goals `x ≠ 0` and `norm_num1` on these goals when `x` is a numeral.
@bors
Copy link

bors bot commented Dec 20, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(tactic/field_simp): let field_simp use norm_num to prove numerals are nonzero [Merged by Bors] - feat(tactic/field_simp): let field_simp use norm_num to prove numerals are nonzero Dec 20, 2020
@bors bors bot closed this Dec 20, 2020
@bors bors bot deleted the field_simp branch December 20, 2020 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants