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/dec_trivial): make dec_trivial easier to use #3875

Closed
wants to merge 4 commits into from

Conversation

jcommelin
Copy link
Member


This PR is motivated by the fin 3 "issues" in #3872

@jcommelin jcommelin added the awaiting-review The author would like community review of the PR label Aug 20, 2020
Co-authored-by: Patrick Massot <patrickmassot@free.fr>
Authors: Johan Commelin
-/
import tactic.interactive

Copy link
Member

Choose a reason for hiding this comment

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

Module doc please! Alternatively, I know we're generally moving away from the monolithic tactic.interactive, but since the copyright and module doc boilerplate will be longer than the content of this file, you could just stick the important bit in there.

@robertylewis
Copy link
Member

robertylewis commented Aug 20, 2020

Unfortunately this kind of reversion can also change a trivial goal into a non-trivial goal, e.g.:

import tactic.dec_trivial

example (n : ℕ) : (0 : fin (n+1)) + 0 = 0 :=
dec_trivial -- good 
-- by dec_trivial -- bad

So by dec_trivial isn't a drop-in replacement for dec_trivial. Maybe the behavior should be

  • by dec_trivial is the same as term mode, e.g. tactic.exact_dec_trivial
  • by dec_trivial! is what you've implemented
    ?

@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 Aug 20, 2020
@robertylewis robertylewis added awaiting-review The author would like community review of the PR RFC Request for comment and removed awaiting-author A reviewer has asked the author a question or requested changes labels Aug 20, 2020
@robertylewis
Copy link
Member

I'm happy, but let's see if anyone else has opinions about the ! syntax.

@jcommelin jcommelin requested a review from digama0 August 20, 2020 14:10
@fpvandoorn
Copy link
Member

It's a bit weird that dec_trivial! is not strictly stronger than dec_trivial, but I think it's fine like this.
LGTM.

@robertylewis
Copy link
Member

The alternative, which Johan suggested, is implementing tactic.interactive.dec_trivial := exact_dec_trivial <|> revert_dec_trivial. But this has bad behavior when the proposition is decidable, expensive to decide, false, and irrelevantly depends on a variable, e.g. something like

example (b : bool) : function.const _ 10000 b = 10001

@jcommelin
Copy link
Member Author

@digama0 🏓

@digama0
Copy link
Member

digama0 commented Aug 22, 2020

Works for me. I like the currently implemented behavior, where ! makes it revert first (and is not the default), and don't mind that it doesn't subsume the other version, after all the user can pick whichever one works and I like it when lean doesn't have to guess when the wrong guess is possibly costly.

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 Aug 22, 2020
@bors
Copy link

bors bot commented Aug 22, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(tactic/dec_trivial): make dec_trivial easier to use [Merged by Bors] - feat(tactic/dec_trivial): make dec_trivial easier to use Aug 22, 2020
@bors bors bot closed this Aug 22, 2020
@bors bors bot deleted the dec_trivial branch August 22, 2020 08:00
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+`.) RFC Request for comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants