-
Notifications
You must be signed in to change notification settings - Fork 579
feat: allow a general evalTac
at evalSepTactics
#7702
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
base: master
Are you sure you want to change the base?
Conversation
Mathlib CI status (docs):
|
changelog-language |
-/ | ||
partial def evalSepTactics : Tactic := goEven | ||
|
||
The user can provide their own tactic evaluation function `evalTac`. |
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.
Could you please expand this comment with an example of why one might want to do this? Otherwise future maintainers will be absolutely puzzled.
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.
I would write something like this:
Assume a tactic developer writes a new general modified tactic execution,
for example calling automation each step, displaying the goal in a specific
way, modifying the behavior of some tactics...
def customEvalTactic : Tactic :=
Then it is possible to create a tactic scope in which this tactic is called
on each line of the scope, while preserving the incremental elaboration by
@[tactic my_scope, incremental]
def myScopeElab : Tactic := fun stx => do
withNarrowedArgTacticReuse 1 (
withNarrowedArgTacticReuse 0 (
withNarrowedArgTacticReuse 0 (
(evalSepTactics customEvalTactic)
)
)
) stx
@@ -120,7 +123,7 @@ where | |||
Term.withNarrowedTacticReuse (fun stx => (stx[0], mkNullNode stx.getArgs[1:])) goEven stx | |||
|
|||
@[builtin_tactic seq1] def evalSeq1 : Tactic := fun stx => | |||
evalSepTactics stx[0] | |||
(evalSepTactics) stx[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.
Please just pass the argument explicitly, in which case we may as well remove the default value
This PR generalizes
evalSepTactics
, so that users can use incremental elaboration in their own proof environment.#lean4 > custom incremental elaboration
This was suggested by @mirefek