Skip to content

Conversation

@JovanGerb
Copy link
Contributor

@JovanGerb JovanGerb commented Mar 27, 2025

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

@JovanGerb JovanGerb requested a review from kim-em as a code owner March 27, 2025 18:39
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Mar 27, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Mar 27, 2025

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 7bd937580494311ecdb9502a7b5ab0ccf473bd44 --onto 1465c23e12f6f8b608ef944be4559b1b5e38f40a. You can force Mathlib CI using the force-mathlib-ci label. (2025-03-27 19:02:53)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 7bd937580494311ecdb9502a7b5ab0ccf473bd44 --onto 060b2fe46fe728934744ee52271b92ab74cbd5b4. You can force Mathlib CI using the force-mathlib-ci label. (2025-03-29 13:19:18)

@JovanGerb
Copy link
Contributor Author

changelog-language

@github-actions github-actions bot added the changelog-language Language features and metaprograms label Mar 28, 2025
@leanprover-bot leanprover-bot added the P-medium We may work on this issue if we find the time label Apr 1, 2025
-/
partial def evalSepTactics : Tactic := goEven
The user can provide their own tactic evaluation function `evalTac`.
Copy link
Member

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.

Copy link

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


@[builtin_tactic seq1] def evalSeq1 : Tactic := fun stx =>
evalSepTactics stx[0]
(evalSepTactics) stx[0]
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-language Language features and metaprograms P-medium We may work on this issue if we find the time toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants