-
Notifications
You must be signed in to change notification settings - Fork 216
induction ... generalizing ...
and case
tactics
#1515
Conversation
induction ... generalizing ...
and case
tacticsinduction ... generalizing ...
and case
tactics
I really like the I feel that the left-to-right traversal of the proof will result in unintuitive behavior if you reorder the goals (for example using |
That should only happen if you're using |
I agree, it's unlikely to happen in practice.
Then we could no longer do double induction, right? induction n,
case zero {
induction m,
case zero { exact sorry },
case succ m {
-- now we should have two subgoals that for the nat.succ constructor
}
} |
I also like the Then
|
No, the outer |
Sure, it's not pretty, but it should be quite robust. Having to implement a metadata management system and teach it to all interested tactics sounds much more involved. And we could even incorporate all your examples into the current approach without having to touch those tactics at all - with the minor caveat that it would match an argument goal of the given name in any application created from any tactic :) . Still, it should do the right thing in realistic scenarios like directly after |
By the way, a colleague just reminded me that in Isabelle you can also select goals by type using |
This is useful. |
src/frontends/lean/token_table.cpp
Outdated
@@ -96,7 +96,7 @@ void init_token_table(token_table & t) { | |||
{"@@", g_max_prec}, {"@", g_max_prec}, | |||
{"sorry", g_max_prec}, {"+", g_plus_prec}, {"->", g_arrow_prec}, {"<-", 0}, | |||
{"match", 0}, {"^.", g_max_prec+1}, | |||
{"renaming", 0}, {"extends", 0}, {nullptr, 0}}; | |||
{"renaming", 0}, {"extends", 0}, {"generalizing", 0}, {nullptr, 0}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would probably be preferable if we could add new tactic "keyword arguments" without changing the global token table. For identifier-like keywords, we could do that with a scanner decorator (both before and after implementing lookahead).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try to use the lean command precedence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean I should do
precedence `generalizing` : 0
instead of changing token_table.cpp
? That's definitely better, right, but it would still be even better if it was a keyword just in that tactic instead of globally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean I should do precedence
generalizing
: 0 instead of changing token_table.cpp?
Yes.
it would still be even better if it was a keyword just in that tactic instead of globally.
I think this may produce ambiguity. Example: suppose the user has declarations named generalizing
… `generalizing` keyword in Lean
induction e generalizing ids
first revertsids
and then reintroduces them in each new subgoal.case n ids
focuses on theinduction/cases
subgoal corresponding to the constructorn
and optionally renames identifiers introduced by it usingids
. This is nice not just for documentation, but also for avoiding having to name parameters of eliminated cases, and for reordering cases so that simple ones can be solved with a single final tactic.See in action at Kha/semantics-lean@23965f9#diff-2372531b49c81b52df5a4e3090283065L118