File: Mathlib/Tactic/Widget/InteractiveUnfold.lean

full_name: Mathlib.Tactic.InteractiveUnfold.unfoldProjDefaultInst?
code: /-- Unfold a class projection if the instance is tagged with `@[default_instance]`.
This is used in the `unfold?` tactic in order to not show these unfolds to the user.
Similar to `Lean.Meta.unfoldProjInst?`. -/
def unfoldProjDefaultInst? (e : Expr) : MetaM (Option Expr) 
goal: Lean.MetaM (Option Lean.Expr)

full_name: Mathlib.Tactic.InteractiveUnfold.unfolds
code: /-- Return the consecutive unfoldings of `e`. -/
partial def unfolds (e : Expr) : MetaM (Array Expr) 
goal: Lean.MetaM (Array Lean.Expr)

full_name: Mathlib.Tactic.InteractiveUnfold.unfolds.go
code: /-- Return the consecutive unfoldings of `e`. -/
partial def unfolds (e : Expr) : MetaM (Array Expr) 
goal: Lean.MetaM (Array Lean.Expr)

full_name: Mathlib.Tactic.InteractiveUnfold.isUserFriendly
code: /-- Determine whether `e` contains no internal names. -/
def isUserFriendly (e : Expr) : Bool 
goal: Bool

full_name: Mathlib.Tactic.InteractiveUnfold.filteredUnfolds
code: /-- Return the consecutive unfoldings of `e` that are user friendly. -/
def filteredUnfolds (e : Expr) : MetaM (Array Expr) 
goal: Lean.MetaM (Array Lean.Expr)

full_name: Mathlib.Tactic.mkRewrite
code: /-- Return the rewrite tactic string `rw (config := ..) [← ..] at ..` -/
def mkRewrite (occ : Option Nat) (symm : Bool) (rewrite : String) (loc : Option Name) : String 
goal: String

full_name: Mathlib.Tactic.pasteString
code: /--
Return a string of the expression suitable for pasting into the editor.

We ignore any options set by the user.

We set `pp.universes` to false because new universe level metavariables are not understood
by the elaborator.

We set `pp.unicode.fun` to true as per Mathlib convention.
-/
def pasteString (e : Expr) : MetaM String 
goal: Lean.MetaM String

full_name: Mathlib.Tactic.InteractiveUnfold.tacticString
code: /-- Return the tactic string that does the unfolding. -/
def tacticString (e unfold : Expr) (occ : Option Nat) (loc : Option Name) : MetaM String 
goal: Lean.MetaM String

full_name: Mathlib.Tactic.InteractiveUnfold.renderUnfolds
code: /-- Render the unfolds of `e` as given by `filteredUnfolds`, with buttons at each suggestion
for pasting the rewrite tactic. Return `none` when there are no unfolds. -/
def renderUnfolds (e : Expr) (occ : Option Nat) (loc : Option Name) (range : Lsp.Range)
    (doc : FileWorker.EditableDocument) : MetaM (Option Html) 
goal: Lean.MetaM (Option ProofWidgets.Html)

full_name: _private.Mathlib.Tactic.Widget.InteractiveUnfold.0.Mathlib.Tactic.InteractiveUnfold.rpc
code: @[server_rpc_method_cancellable]
private def rpc (props : SelectInsertParams) : RequestM (RequestTask Html) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask ProofWidgets.Html)

full_name: Mathlib.Tactic.InteractiveUnfold.UnfoldComponent
code: /-- The component called by the `unfold?` tactic -/
@[widget_module]
def UnfoldComponent : Component SelectInsertParams 
goal: ProofWidgets.Component SelectInsertParams

full_name: Mathlib.Tactic.InteractiveUnfold.tacticUnfold?
code: /-- Replace the selected expression with a definitional unfolding.
- After each unfolding, we apply `whnfCore` to simplify the expression.
- Explicit natural number expressions are evaluated.
- Unfolds of class projections of instances marked with `@[default_instance]` are not shown.
  This is relevant for notational type classes like `+`: we don't want to suggest `Add.add a b`
  as an unfolding of `a + b`. Similarly for `OfNat n : Nat` which unfolds into `n : Nat`.

To use `unfold?`, shift-click an expression in the tactic state.
This gives a list of rewrite suggestions for the selected expression.
Click on a suggestion to replace `unfold?` by a tactic that performs this rewrite.
-/
elab stx:"unfold?" : tactic => do
  let some range := (← getFileMap).rangeOfStx? stx | return
  Widget.savePanelWidgetInfo (hash UnfoldComponent.javascript)
    (pure $ json% { replaceRange : $range }) stx
goal: Lean.ParserDescr

full_name: Mathlib.Tactic.InteractiveUnfold._aux_Mathlib_Tactic_Widget_InteractiveUnfold___elabRules_Mathlib_Tactic_InteractiveUnfold_tacticUnfold?_1
code: /-- Replace the selected expression with a definitional unfolding.
- After each unfolding, we apply `whnfCore` to simplify the expression.
- Explicit natural number expressions are evaluated.
- Unfolds of class projections of instances marked with `@[default_instance]` are not shown.
  This is relevant for notational type classes like `+`: we don't want to suggest `Add.add a b`
  as an unfolding of `a + b`. Similarly for `OfNat n : Nat` which unfolds into `n : Nat`.

To use `unfold?`, shift-click an expression in the tactic state.
This gives a list of rewrite suggestions for the selected expression.
Click on a suggestion to replace `unfold?` by a tactic that performs this rewrite.
-/
elab stx:"unfold?" : tactic => do
  let some range := (← getFileMap).rangeOfStx? stx | return
  Widget.savePanelWidgetInfo (hash UnfoldComponent.javascript)
    (pure $ json% { replaceRange : $range }) stx
goal: Lean.Elab.Tactic.Tactic

full_name: Mathlib.Tactic.InteractiveUnfold.unfoldCommand
code: /-- `#unfold? e` gives all unfolds of `e`.
In tactic mode, use `unfold?` instead. -/
syntax (name := unfoldCommand) "#unfold?" term : command
goal: Lean.ParserDescr

full_name: Mathlib.Tactic.InteractiveUnfold.elabUnfoldCommand
code: /-- Elaborate a `#unfold?` command. -/
@[command_elab unfoldCommand]
def elabUnfoldCommand : Command.CommandElab 
goal: Lean.Elab.Command.CommandElab