Various utilities used in #click_suggestions #
Turn an Expr into an HTML with hover info.
Instances For
Turn a constant into an HTML with hover info.
This avoids the @ that may appear when using exprToHtml.
Instances For
Display fmt with a docstring as if it is the constant n.
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.
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.
- const
(declName : Lean.Name)
: Premise
A global constant.
- fvar
(fvarId : Lean.FVarId)
: Premise
A free variable.
Instances For
Print a premise as a string.
Instances For
The name length of a premise.
Instances For
Get the type of a premise.
Instances For
Fill the premise in with fresh universe and expression metavariables.
Instances For
Return the user-facing name of the premise, relative to the current namespace.
Instances For
Print a premise using message data.
Instances For
Print a premise using HTML.
Instances For
The global state that is shared between all threads.
- status : Std.HashMap String Nat
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.
- meta : Lean.Server.DocumentMeta
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.
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
rwtactics. - masterToken : ProofWidgets.RefreshToken
The token for updating the main HTML body of suggestions. This is used for displaying a message that no progress has happened.
- statusToken : ProofWidgets.RefreshToken
The token for the
⏳️HTML that represents the state of the ongoing computations. - solvedToken : ProofWidgets.RefreshToken
The token for the solved goals.
- goal : Lean.MVarId
The main goal.
- hyp? : Option Lean.FVarId
The selected hypothesis, if any.
- pos : Lean.SubExpr.Pos
The position of the selected subexpression.
Instances For
The monad used in #click_suggestions.
Instances For
Signify that at least one suggestion has been made.
Instances For
Get the syntax of the variable whose type the user selected.
Instances For
Get the variable whose type the user selected.
Instances For
Run a computation in such a way that we can keep track of it.
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
rwcannot rewrite here, because the subexpression contains bound variables. So, we suggestsimp_rw. - valid
(motiveTypeCorrect : Bool)
(occ : Option Nat)
: RwKind
If
motiveTypeCorrect := true, we suggestrw!instead ofrw. Ifocc := some n, we suggestnth_rw ninstead ofrw.
Instances For
Construct the syntax for a rewrite tactic.
Instances For
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.
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.
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.
Instances For
Add suggestion tac to the list of tactics that solve the goal.
Instances For
Return whether kabstract uniquely finds pattern p in e at position targetPos.
Instances For
Determine which metavariables count as "unhelpful", given the old and new metavariables.
This is used in suggestions of e.g. apply, to filter out suggestions with unhelpful metavariables.
A metavariable is unhelpful if it was freshly introduced, and is not used in the assignment of a previously appearing metavariable.