Documentation

Lean.Elab.Tactic.Try

A very simple try? tactic implementation.

def Lean.Elab.Tactic.elabTryConfig (cfg : Syntax) (init : Try.Config := { }) (logExceptions : Bool := true) :
Equations
  • One or more equations did not get rendered due to their size.
Instances For

    evalSuggest is a evalTactic variant that returns suggestions after executing a tactic built using combinators such as first, attempt_all, <;>, ;, and try.

    def Lean.Elab.Tactic.Try.checkTactic (savedState : SavedState) (tac : TSyntax `tactic) :

    Executes tac in the saved state. This function is used to validate a tactic before suggesting it.

    Equations
    Instances For
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        Instances For
          @[instance_reducible]
          Equations
          • One or more equations did not get rendered due to their size.
          @[reducible, inline]
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            User-extensible try suggestion generators

            @[reducible, inline]

            A user-defined generator that proposes tactics for try? to attempt. Takes the goal MVarId and collected info, returns array of tactics to try.

            Equations
            Instances For

              Entry in the try suggestion registry

              Instances For

                Environment extension for user try suggestion generators (supports local scoping)

                Elaborate register_try?_tactic command

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  @[reducible, inline]
                  Equations
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      Executes a tactic with heartbeat management:

                      • Restores the original maxHeartbeats limit (recorded at try? start)
                      • Gives the tactic a fresh heartbeat budget via withCurrHeartbeats
                      • Catches heartbeat exceptions and converts them to regular errors
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        Executes code with unlimited heartbeats (maxHeartbeats set to 0). Used by try? infrastructure itself so it doesn't timeout while testing tactics.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          @[extern lean_eval_suggest_tactic]

                          @[builtin_try_tactic] registrations for the built-in combinators and trace wrappers.

                          evalSuggest dispatcher.

                          evalAndSuggest frontend

                          Like evalAndSuggest, but returns the suggestion array instead of emitting it.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            def Lean.Elab.Tactic.Try.evalAndSuggest (tk : Syntax) (tac : TSyntax `tactic) (originalMaxHeartbeats : Nat) (config : Try.Config := { }) :
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              Helper functions

                              grind tactic syntax generator based on collected information.

                              Other generators

                              Function induction generators

                              Vanilla induction generators

                              Main code

                              Core implementation of try?: focus, collect info, build tactic, evaluate and suggest. tk is the syntax token where "Try this:" appears. The optional footer is appended to the suggestions message (only when wrapWithBy := true).

                              Public so that the autoTry linter (Lean.Elab.Tactic.AutoTry) can drive try? from outside the normal try? syntax entry point.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For

                                Like elabTryCore, but returns the suggestion array (as raw tactic syntaxes) instead of emitting "Try this:" messages. Used by the autoTry linter, which formats and emits the suggestions itself so they can be rendered as append-to-tactic-sequence edits.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For