Various utilities used in #click_suggestions #
Turn an Expr into an HTML with hover info.
Equations
- Mathlib.Tactic.ClickSuggestions.exprToHtml e = do let __do_lift ← Lean.Widget.ppExprTagged e pure (<ProofWidgets.InteractiveCode fmt={__do_lift}/>)
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
- Mathlib.Tactic.ClickSuggestions.tacticToHtml tac = do let __do_lift ← liftM (Lean.PrettyPrinter.ppTactic tac) Mathlib.Tactic.ClickSuggestions.formatToHtmlWithDoc __do_lift tac.raw.getKind
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.
Equations
- (Mathlib.Tactic.ClickSuggestions.Premise.const name).toString = name.toString
- (Mathlib.Tactic.ClickSuggestions.Premise.fvar { name := name }).toString = name.toString
Instances For
Get the type of a premise.
Equations
- (Mathlib.Tactic.ClickSuggestions.Premise.const name).getType = (fun (x : Lean.ConstantInfo) => x.type) <$> Lean.getConstInfo name
- (Mathlib.Tactic.ClickSuggestions.Premise.fvar fvarId).getType = fvarId.getType
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
Return the user-facing name of the premise, relative to the current namespace.
Equations
- (Mathlib.Tactic.ClickSuggestions.Premise.const name).unresolveName = do let __do_lift ← Lean.getOptions Lean.unresolveNameGlobalAvoidingLocals name (Lean.getPPFullNames __do_lift)
- (Mathlib.Tactic.ClickSuggestions.Premise.fvar fvarId).unresolveName = fvarId.getUserName
Instances For
Print a premise using message data.
Equations
Instances For
Print a premise using HTML.
Equations
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.
Equations
Instances For
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
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.
Equations
- One or more equations did not get rendered due to their size.
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.
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.