Documentation

Mathlib.Tactic.ClickSuggestions.Util

Various utilities used in #click_suggestions #

Turn an Expr into an HTML with hover info.

Equations
Instances For

    Turn a constant into an HTML with hover info. This avoids the @ that may appear when using exprToHtml.

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

      Display fmt with a docstring as if it is the constant n.

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

        Pretty print a tactic with its docstring as hover info.

        I would love to print tac with another colour, e.g. the keyword highlighting used by the editor, but I have no idea how to do this.

        Equations
        Instances For

          Let #click_suggestions show the candidate lemmas that failed to apply.

          A global constant or a free variable. Library search can return either.

          Instances For

            The name length of a premise.

            Equations
            Instances For

              Fill the premise in with fresh universe and expression metavariables.

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

                The global state that is shared between all threads.

                • The ongoing computations.

                • progress : Bool

                  Whether any progress has been made at all. If all computations have been finished and no progress has been made, then inform the user.

                • solvedSuggestions : Array ProofWidgets.Html

                  The suggestions that close the goal.

                Instances For

                  The information required for pasting a suggestion into the editor.

                  • The current document

                  • cursorPos : Lean.Lsp.Position

                    The range that should be replaced. In tactic mode, this should be the range of the suggestion tactic. In infoview mode, the start and end of the range should both be the cursor position.

                  • onGoal : Option Nat

                    Whether to use the on_goal n => combinator.

                  • stx : Option (Lean.TSyntax `tactic)

                    The preceding piece of syntax, if available. It is not available if the cursor is at the start of the next tactic. This is used for merging consecutive rw tactics.

                  • The token for updating the main HTML body of suggestions. This is used for displaying a message that no progress has happened.

                  • The token for the ⏳️ HTML that represents the state of the ongoing computations.

                  • The token for the solved goals.

                  • The main goal.

                  • The selected hypothesis, if any.

                  • The position of the selected subexpression.

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

                    Signify that at least one suggestion has been made.

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

                      Get the syntax of the variable whose type the user selected.

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

                        Get the variable whose type the user selected.

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

                          Run a computation in such a way that we can keep track of it.

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

                            Determine whether the explicit parts of two expressions are equal, and the implicit parts are definitionally equal, up to reducible_and_instances transparency. This says whether two expressions are 'morally equal', and is used for deduplicating suggestions.

                            Information about the rewrite position. This is used to determine whether to suggest rw, rw!, nth_rw, or simp_rw.

                            • hasBVars : RwKind

                              rw cannot rewrite here, because the subexpression contains bound variables. So, we suggest simp_rw.

                            • valid (motiveTypeCorrect : Bool) (occ : Option Nat) : RwKind

                              If motiveTypeCorrect := true, we suggest rw! instead of rw. If occ := some n, we suggest nth_rw n instead of rw.

                            Instances For

                              Construct the syntax for a rewrite tactic.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                partial def Mathlib.Tactic.ClickSuggestions.mergeTactics? {m : TypeType} [Monad m] [Lean.MonadQuotation m] (stx₁ stx₂ : Lean.TSyntax `tactic) :
                                m (Option (Lean.TSyntax `tactic))

                                Try to combine the suggested tactic with the preceding tactic in the tactic sequence. In particular, we merge sequences of rw, simp_rw and grw.

                                Given tactic syntax tac that we want to paste into the editor, return it as a string. This function respects the 100 character limit for long lines.

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

                                  Given tactic syntax tac, compute the text edit that will paste it into the editor. We return the range that should be replaced, and the new text that will replace it.

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

                                    Generate a suggestion for inserting tac, with message html. The button is [apply] if the tactic does not close the goal, and [done] if it is closing.

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

                                      Add suggestion tac to the list of tactics that solve the goal.

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

                                        Return whether kabstract uniquely finds pattern p in e at position targetPos.

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