File: .lake/packages/lean4/src/lean/Lean/PrettyPrinter/Delaborator/Builtins.lean

full_name: Lean.PrettyPrinter.Delaborator.withTypeAscription
code: /--
If `cond` is true, wraps the syntax produced by `d` in a type ascription.
-/
def withTypeAscription (d : Delab) (cond : Bool := true) : DelabM Term 
goal: Lean.PrettyPrinter.Delaborator.DelabM Lean.Term

full_name: Lean.PrettyPrinter.Delaborator.maybeAddBlockImplicit
code: /--
Wraps the identifier (or identifier with explicit universe levels) with `@` if `pp.analysis.blockImplicit` is set to true.
-/
def maybeAddBlockImplicit (identLike : Syntax) : DelabM Syntax 
goal: Lean.PrettyPrinter.Delaborator.DelabM Lean.Syntax

full_name: Lean.PrettyPrinter.Delaborator.delabFVar
code: @[builtin_delab fvar]
def delabFVar : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabBVar
code: @[builtin_delab bvar]
def delabBVar : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabMVar
code: @[builtin_delab mvar]
def delabMVar : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabSort
code: @[builtin_delab sort]
def delabSort : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabConst
code: /--
Delaborator for `const` expressions.
This is not registered as a delaborator, as `const` is not an expression kind
(see [delab] description and `Lean.PrettyPrinter.Delaborator.getExprKind`).
Rather, it is called through the `app` delaborator.
-/
def delabConst : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.withMDataOptions
code: def withMDataOptions [Inhabited α] (x : DelabM α) : DelabM α 
goal: Lean.PrettyPrinter.Delaborator.DelabM α

full_name: Lean.PrettyPrinter.Delaborator.withMDatasOptions
code: partial def withMDatasOptions [Inhabited α] (x : DelabM α) : DelabM α 
goal: Lean.PrettyPrinter.Delaborator.DelabM α

full_name: Lean.PrettyPrinter.Delaborator.ParamKind.defVal
code: /--
A structure that records details of a function parameter.
-/
structure ParamKind where
  /-- Binder name for the parameter. -/
  name        : Name
  /-- Binder info for the parameter. -/
  bInfo       : BinderInfo
  /-- The default value for the parameter, if the parameter has a default value. -/
  defVal      : Option Expr := none
  /-- Whether the parameter is an autoparam (i.e., whether it uses a tactic for the default value). -/
  isAutoParam : Bool := false
  deriving Inhabited
goal: Option Lean.Expr

full_name: Lean.PrettyPrinter.Delaborator.ParamKind
code: /--
A structure that records details of a function parameter.
-/
structure ParamKind where
  /-- Binder name for the parameter. -/
  name        : Name
  /-- Binder info for the parameter. -/
  bInfo       : BinderInfo
  /-- The default value for the parameter, if the parameter has a default value. -/
  defVal      : Option Expr := none
  /-- Whether the parameter is an autoparam (i.e., whether it uses a tactic for the default value). -/
  isAutoParam : Bool := false
  deriving Inhabited
goal: Type

full_name: Lean.PrettyPrinter.Delaborator.ParamKind.name
code: /--
A structure that records details of a function parameter.
-/
structure ParamKind where
  /-- Binder name for the parameter. -/
  name        : Name
  /-- Binder info for the parameter. -/
  bInfo       : BinderInfo
  /-- The default value for the parameter, if the parameter has a default value. -/
  defVal      : Option Expr := none
  /-- Whether the parameter is an autoparam (i.e., whether it uses a tactic for the default value). -/
  isAutoParam : Bool := false
  deriving Inhabited
goal: Lean.Name

full_name: Lean.PrettyPrinter.Delaborator.instInhabitedParamKind
code: /--
A structure that records details of a function parameter.
-/
structure ParamKind where
  /-- Binder name for the parameter. -/
  name        : Name
  /-- Binder info for the parameter. -/
  bInfo       : BinderInfo
  /-- The default value for the parameter, if the parameter has a default value. -/
  defVal      : Option Expr := none
  /-- Whether the parameter is an autoparam (i.e., whether it uses a tactic for the default value). -/
  isAutoParam : Bool := false
  deriving Inhabited
goal: Inhabited Lean.PrettyPrinter.Delaborator.ParamKind

full_name: Lean.PrettyPrinter.Delaborator.ParamKind.isAutoParam
code: /--
A structure that records details of a function parameter.
-/
structure ParamKind where
  /-- Binder name for the parameter. -/
  name        : Name
  /-- Binder info for the parameter. -/
  bInfo       : BinderInfo
  /-- The default value for the parameter, if the parameter has a default value. -/
  defVal      : Option Expr := none
  /-- Whether the parameter is an autoparam (i.e., whether it uses a tactic for the default value). -/
  isAutoParam : Bool := false
  deriving Inhabited
goal: Bool

full_name: Lean.PrettyPrinter.Delaborator.ParamKind.bInfo
code: /--
A structure that records details of a function parameter.
-/
structure ParamKind where
  /-- Binder name for the parameter. -/
  name        : Name
  /-- Binder info for the parameter. -/
  bInfo       : BinderInfo
  /-- The default value for the parameter, if the parameter has a default value. -/
  defVal      : Option Expr := none
  /-- Whether the parameter is an autoparam (i.e., whether it uses a tactic for the default value). -/
  isAutoParam : Bool := false
  deriving Inhabited
goal: Lean.BinderInfo

full_name: Lean.PrettyPrinter.Delaborator.ParamKind.isRegularExplicit
code: /--
Returns true if the parameter is an explicit parameter that has neither a default value nor a tactic.
-/
def ParamKind.isRegularExplicit (param : ParamKind) : Bool 
goal: Bool

full_name: Lean.PrettyPrinter.Delaborator.getParamKinds
code: /--
Given a function `f` supplied with arguments `args`, returns an array whose n-th element
is set to the kind of the n-th argument's associated parameter.
We do not assume the expression `mkAppN f args` is sensical,
and this function captures errors (except for panics) and returns the empty array in that case.

The returned array might be longer than the number of arguments.
It gives parameter kinds for the fully-applied function.
Note: the `defVal` expressions are only guaranteed to be valid for parameters associated to the supplied arguments;
after this, they might refer to temporary fvars.

This function properly handles "overapplied" functions.
For example, while `id` takes one explicit argument, it can take more than one explicit
argument when its arguments are specialized to function types, like in `id id 2`.
-/
def getParamKinds (f : Expr) (args : Array Expr) : MetaM (Array ParamKind) 
goal: Lean.MetaM (Array Lean.PrettyPrinter.Delaborator.ParamKind)

full_name: Lean.PrettyPrinter.Delaborator.shouldShowMotive
code: def shouldShowMotive (motive : Expr) (opts : Options) : MetaM Bool 
goal: Lean.MetaM Bool

full_name: Lean.PrettyPrinter.Delaborator.unexpandStructureInstance
code: /--
Takes application syntax and converts it into structure instance notation, if possible.
Assumes that the application is pretty printed in implicit mode.
-/
def unexpandStructureInstance (stx : Syntax) : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.appFieldNotationCandidate?
code: /--
If `e` is an application that is a candidate for using field notation,
returns the parameter index and the field name to use.
Checks that there are enough arguments.
-/
def appFieldNotationCandidate? : DelabM (Option (Nat × Name)) 
goal: Lean.PrettyPrinter.Delaborator.DelabM (Option (Nat × Lean.Name))

full_name: _private.«.lake».packages.lean4.src.lean.Lean.PrettyPrinter.Delaborator.Builtins.0.Lean.PrettyPrinter.Delaborator.withoutParentProjections
code: /--
Consumes projections to parent structures, and runs `d` in the resulting context.
For example, if the current expression is `o.toB.toA`, runs `d` with `o` as the current expression.

If `explicit` is true, then does not consume parent projections for structures with parameters,
since these are implicit arguments.
-/
private partial def withoutParentProjections (explicit : Bool) (d : DelabM α) : DelabM α 
goal: Lean.PrettyPrinter.Delaborator.DelabM α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.PrettyPrinter.Delaborator.Builtins.0.Lean.PrettyPrinter.Delaborator.stripParentProjections
code: /-- Strips parent projections from `s`. Assumes that the current SubExpr is the same as the one used when delaborating `s`. -/
private partial def stripParentProjections (s : Term) : DelabM Term 
goal: Lean.PrettyPrinter.Delaborator.DelabM Lean.Term

full_name: Lean.PrettyPrinter.Delaborator.needsExplicit
code: /--
In explicit mode, decides whether or not the applied function needs `@`,
where `numArgs` is the number of arguments actually supplied to `f`.
-/
def needsExplicit (f : Expr) (numArgs : Nat) (paramKinds : Array ParamKind) : Bool 
goal: Bool

full_name: Lean.PrettyPrinter.Delaborator.delabAppExplicitCore
code: /--
Delaborates a function application in explicit mode.
* If `insertExplicit` is true, then ensures the head syntax is wrapped with `@`.
* If `fieldNotation` is true, then allows the application to be pretty printed using field notation.
  Field notation will not be used when `insertExplicit` is true.
-/
def delabAppExplicitCore (fieldNotation : Bool) (numArgs : Nat) (delabHead : (insertExplicit : Bool) → Delab) (paramKinds : Array ParamKind) : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.AppImplicitArg.named
code: /-- Records how a particular argument to a function is delaborated, in non-explicit mode. -/
inductive AppImplicitArg
  /-- An argument to skip, like an implicit argument. -/
  | skip
  /-- A regular argument. -/
  | regular (s : Term)
  /-- It's a named argument. Named arguments inhibit applying unexpanders. -/
  | named (s : TSyntax ``Parser.Term.namedArgument)
  deriving Inhabited
goal: Lean.PrettyPrinter.Delaborator.AppImplicitArg

full_name: Lean.PrettyPrinter.Delaborator.instInhabitedAppImplicitArg
code: /-- Records how a particular argument to a function is delaborated, in non-explicit mode. -/
inductive AppImplicitArg
  /-- An argument to skip, like an implicit argument. -/
  | skip
  /-- A regular argument. -/
  | regular (s : Term)
  /-- It's a named argument. Named arguments inhibit applying unexpanders. -/
  | named (s : TSyntax ``Parser.Term.namedArgument)
  deriving Inhabited
goal: Inhabited Lean.PrettyPrinter.Delaborator.AppImplicitArg

full_name: Lean.PrettyPrinter.Delaborator.AppImplicitArg
code: /-- Records how a particular argument to a function is delaborated, in non-explicit mode. -/
inductive AppImplicitArg
  /-- An argument to skip, like an implicit argument. -/
  | skip
  /-- A regular argument. -/
  | regular (s : Term)
  /-- It's a named argument. Named arguments inhibit applying unexpanders. -/
  | named (s : TSyntax ``Parser.Term.namedArgument)
  deriving Inhabited
goal: Type

full_name: Lean.PrettyPrinter.Delaborator.AppImplicitArg.skip
code: /-- Records how a particular argument to a function is delaborated, in non-explicit mode. -/
inductive AppImplicitArg
  /-- An argument to skip, like an implicit argument. -/
  | skip
  /-- A regular argument. -/
  | regular (s : Term)
  /-- It's a named argument. Named arguments inhibit applying unexpanders. -/
  | named (s : TSyntax ``Parser.Term.namedArgument)
  deriving Inhabited
goal: Lean.PrettyPrinter.Delaborator.AppImplicitArg

full_name: Lean.PrettyPrinter.Delaborator.AppImplicitArg.regular
code: /-- Records how a particular argument to a function is delaborated, in non-explicit mode. -/
inductive AppImplicitArg
  /-- An argument to skip, like an implicit argument. -/
  | skip
  /-- A regular argument. -/
  | regular (s : Term)
  /-- It's a named argument. Named arguments inhibit applying unexpanders. -/
  | named (s : TSyntax ``Parser.Term.namedArgument)
  deriving Inhabited
goal: Lean.PrettyPrinter.Delaborator.AppImplicitArg

full_name: Lean.PrettyPrinter.Delaborator.AppImplicitArg.canUnexpand
code: /-- Whether unexpanding is allowed with this argument. -/
def AppImplicitArg.canUnexpand : AppImplicitArg → Bool
  
goal: Lean.PrettyPrinter.Delaborator.AppImplicitArg → Bool

full_name: Lean.PrettyPrinter.Delaborator.AppImplicitArg.syntax?
code: /-- If the argument has associated syntax, returns it. -/
def AppImplicitArg.syntax? : AppImplicitArg → Option Syntax
  
goal: Lean.PrettyPrinter.Delaborator.AppImplicitArg → Option Lean.Syntax

full_name: Lean.PrettyPrinter.Delaborator.delabAppImplicitCore
code: /--
Delaborates a function application in the standard mode, where implicit arguments are generally not
included, unless `pp.analysis.namedArg` is set at that argument.

This delaborator is where `app_unexpander`s and the structure instance unexpander are applied, if `unexpand` is true.
When `unexpand` is true, also considers opportunities for field notation, which takes priority over other unexpanders.

Assumes `numArgs ≤ paramKinds.size`.
-/
def delabAppImplicitCore (unexpand : Bool) (numArgs : Nat) (delabHead : Delab) (paramKinds : Array ParamKind) : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabAppImplicitCore.tryAppUnexpanders
code: /--
Delaborates a function application in the standard mode, where implicit arguments are generally not
included, unless `pp.analysis.namedArg` is set at that argument.

This delaborator is where `app_unexpander`s and the structure instance unexpander are applied, if `unexpand` is true.
When `unexpand` is true, also considers opportunities for field notation, which takes priority over other unexpanders.

Assumes `numArgs ≤ paramKinds.size`.
-/
def delabAppImplicitCore (unexpand : Bool) (numArgs : Nat) (delabHead : Delab) (paramKinds : Array ParamKind) : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabAppImplicitCore.mkArg
code: /--
Delaborates a function application in the standard mode, where implicit arguments are generally not
included, unless `pp.analysis.namedArg` is set at that argument.

This delaborator is where `app_unexpander`s and the structure instance unexpander are applied, if `unexpand` is true.
When `unexpand` is true, also considers opportunities for field notation, which takes priority over other unexpanders.

Assumes `numArgs ≤ paramKinds.size`.
-/
def delabAppImplicitCore (unexpand : Bool) (numArgs : Nat) (delabHead : Delab) (paramKinds : Array ParamKind) : Delab 
goal: Lean.PrettyPrinter.Delaborator.DelabM Lean.PrettyPrinter.Delaborator.AppImplicitArg

full_name: Lean.PrettyPrinter.Delaborator.delabAppImplicitCore.tryAppUnexpanders.go
code: /--
Delaborates a function application in the standard mode, where implicit arguments are generally not
included, unless `pp.analysis.namedArg` is set at that argument.

This delaborator is where `app_unexpander`s and the structure instance unexpander are applied, if `unexpand` is true.
When `unexpand` is true, also considers opportunities for field notation, which takes priority over other unexpanders.

Assumes `numArgs ≤ paramKinds.size`.
-/
def delabAppImplicitCore (unexpand : Bool) (numArgs : Nat) (delabHead : Delab) (paramKinds : Array ParamKind) : Delab 
goal: Lean.PrettyPrinter.Delaborator.DelabM Lean.Term

full_name: Lean.PrettyPrinter.Delaborator.delabAppImplicitCore.tryUnexpand
code: /--
Delaborates a function application in the standard mode, where implicit arguments are generally not
included, unless `pp.analysis.namedArg` is set at that argument.

This delaborator is where `app_unexpander`s and the structure instance unexpander are applied, if `unexpand` is true.
When `unexpand` is true, also considers opportunities for field notation, which takes priority over other unexpanders.

Assumes `numArgs ≤ paramKinds.size`.
-/
def delabAppImplicitCore (unexpand : Bool) (numArgs : Nat) (delabHead : Delab) (paramKinds : Array ParamKind) : Delab 
goal: Lean.PrettyPrinter.Delaborator.DelabM Lean.Syntax

full_name: Lean.PrettyPrinter.Delaborator.delabAppImplicitCore.mkNamedArg
code: /--
Delaborates a function application in the standard mode, where implicit arguments are generally not
included, unless `pp.analysis.namedArg` is set at that argument.

This delaborator is where `app_unexpander`s and the structure instance unexpander are applied, if `unexpand` is true.
When `unexpand` is true, also considers opportunities for field notation, which takes priority over other unexpanders.

Assumes `numArgs ≤ paramKinds.size`.
-/
def delabAppImplicitCore (unexpand : Bool) (numArgs : Nat) (delabHead : Delab) (paramKinds : Array ParamKind) : Delab 
goal: Lean.PrettyPrinter.Delaborator.DelabM Lean.PrettyPrinter.Delaborator.AppImplicitArg

full_name: Lean.PrettyPrinter.Delaborator.useAppExplicit
code: /--
Returns true if an application should use explicit mode when delaborating.
Explicit mode turns off unexpanders
-/
def useAppExplicit (numArgs : Nat) (paramKinds : Array ParamKind) : DelabM Bool 
goal: Lean.PrettyPrinter.Delaborator.DelabM Bool

full_name: Lean.PrettyPrinter.Delaborator.delabAppCore
code: /--
Delaborates applications. Removes up to `maxArgs` arguments to form the "head" of the application.
* `delabHead` is a delaborator to use for the head of the expression.
  It is passed whether the result needs to have `@` inserted.
* If `unexpand` is true, then allow unexpanders and field notation.
  This should likely be set to `false` except in the main `delabApp` delaborator.

Propagates `pp.tagAppFns` into the head for `delabHead`.
-/
def delabAppCore (maxArgs : Nat) (delabHead : (insertExplicit : Bool) → Delab) (unexpand : Bool) : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabApp
code: /--
Default delaborator for applications.
-/
@[builtin_delab app]
def delabApp : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.withOverApp
code: /--
The `withOverApp` combinator allows delaborators to handle "over-application" by using the core
application delaborator to handle additional arguments.

For example, suppose `f : {A : Type} → Foo A → A` and we want to implement a delaborator for
applications `f x` to pretty print as `F[x]`. Because `A` is a type variable we might encounter
a term of the form `@f (A → B) x y`, which has an additional argument `y`.
With this combinator one can use an arity-2 delaborator to pretty print this as `F[x] y`.

* `arity`: the expected number of arguments to `f`.
  The combinator will fail if fewer than this number of arguments are passed,
  and if more than this number of arguments are passed the arguments are handled using
  the standard application delaborator.
* `x`: delaborates the head application of the expected arity (`f x` in the example).
  The value of `pp.tagAppFns` for the whole application is propagated to the expression that `x` sees.

In the event of overapplication, the delaborator `x` is wrapped in
`Lean.PrettyPrinter.Delaborator.withAnnotateTermInfo` to register `TermInfo` for the resulting term.
The effect of this is that the term is hoverable in the Infoview.

If the application would require inserting `@` around the result of `x`, the delaborator fails
since we cannot be sure that this insertion will be well-formed.
-/
def withOverApp (arity : Nat) (x : Delab) : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.AppMatchState.rhss
code: /-- State for `delabAppMatch` and helpers. -/
structure AppMatchState where
  info        : MatcherInfo
  /-- The `matcherTy` instantiated with universe levels and the matcher parameters, with a position at the type of
  this application prefix. -/
  matcherTy : SubExpr
  /-- The motive, with the pi type version delaborated and the original expression version.
  Once `AppMatchState` is complete, this is not `none`. -/
  motive      : Option (Term × Expr) := none
  /-- Whether `pp.analysis.namedArg` was set for the motive argument. -/
  motiveNamed : Bool := false
  /-- The delaborated discriminants, without `h :` annotations. -/
  discrs      : Array Term := #[]
  /-- The collection of names used for the `h :` discriminant annotations, in order.
  Uniquified names are constructed after the first phase. -/
  hNames?     : Array (Option Name) := #[]
  /-- Lambda subexpressions for each alternate. -/
  alts        : Array SubExpr := #[]
  /-- For each match alternative, the names to use for the pattern variables.
  Each ends with `hNames?.filterMap id` exactly. -/
  varNames    : Array (Array Name) := #[]
  /-- The delaborated right-hand sides for each match alternative. -/
  rhss        : Array Term := #[]
goal: Array Lean.Term

full_name: Lean.PrettyPrinter.Delaborator.AppMatchState.motive
code: /-- State for `delabAppMatch` and helpers. -/
structure AppMatchState where
  info        : MatcherInfo
  /-- The `matcherTy` instantiated with universe levels and the matcher parameters, with a position at the type of
  this application prefix. -/
  matcherTy : SubExpr
  /-- The motive, with the pi type version delaborated and the original expression version.
  Once `AppMatchState` is complete, this is not `none`. -/
  motive      : Option (Term × Expr) := none
  /-- Whether `pp.analysis.namedArg` was set for the motive argument. -/
  motiveNamed : Bool := false
  /-- The delaborated discriminants, without `h :` annotations. -/
  discrs      : Array Term := #[]
  /-- The collection of names used for the `h :` discriminant annotations, in order.
  Uniquified names are constructed after the first phase. -/
  hNames?     : Array (Option Name) := #[]
  /-- Lambda subexpressions for each alternate. -/
  alts        : Array SubExpr := #[]
  /-- For each match alternative, the names to use for the pattern variables.
  Each ends with `hNames?.filterMap id` exactly. -/
  varNames    : Array (Array Name) := #[]
  /-- The delaborated right-hand sides for each match alternative. -/
  rhss        : Array Term := #[]
goal: Option (Lean.Term × Lean.Expr)

full_name: Lean.PrettyPrinter.Delaborator.AppMatchState.alts
code: /-- State for `delabAppMatch` and helpers. -/
structure AppMatchState where
  info        : MatcherInfo
  /-- The `matcherTy` instantiated with universe levels and the matcher parameters, with a position at the type of
  this application prefix. -/
  matcherTy : SubExpr
  /-- The motive, with the pi type version delaborated and the original expression version.
  Once `AppMatchState` is complete, this is not `none`. -/
  motive      : Option (Term × Expr) := none
  /-- Whether `pp.analysis.namedArg` was set for the motive argument. -/
  motiveNamed : Bool := false
  /-- The delaborated discriminants, without `h :` annotations. -/
  discrs      : Array Term := #[]
  /-- The collection of names used for the `h :` discriminant annotations, in order.
  Uniquified names are constructed after the first phase. -/
  hNames?     : Array (Option Name) := #[]
  /-- Lambda subexpressions for each alternate. -/
  alts        : Array SubExpr := #[]
  /-- For each match alternative, the names to use for the pattern variables.
  Each ends with `hNames?.filterMap id` exactly. -/
  varNames    : Array (Array Name) := #[]
  /-- The delaborated right-hand sides for each match alternative. -/
  rhss        : Array Term := #[]
goal: Array Lean.SubExpr

full_name: Lean.PrettyPrinter.Delaborator.AppMatchState
code: /-- State for `delabAppMatch` and helpers. -/
structure AppMatchState where
  info        : MatcherInfo
  /-- The `matcherTy` instantiated with universe levels and the matcher parameters, with a position at the type of
  this application prefix. -/
  matcherTy : SubExpr
  /-- The motive, with the pi type version delaborated and the original expression version.
  Once `AppMatchState` is complete, this is not `none`. -/
  motive      : Option (Term × Expr) := none
  /-- Whether `pp.analysis.namedArg` was set for the motive argument. -/
  motiveNamed : Bool := false
  /-- The delaborated discriminants, without `h :` annotations. -/
  discrs      : Array Term := #[]
  /-- The collection of names used for the `h :` discriminant annotations, in order.
  Uniquified names are constructed after the first phase. -/
  hNames?     : Array (Option Name) := #[]
  /-- Lambda subexpressions for each alternate. -/
  alts        : Array SubExpr := #[]
  /-- For each match alternative, the names to use for the pattern variables.
  Each ends with `hNames?.filterMap id` exactly. -/
  varNames    : Array (Array Name) := #[]
  /-- The delaborated right-hand sides for each match alternative. -/
  rhss        : Array Term := #[]
goal: Type

full_name: Lean.PrettyPrinter.Delaborator.AppMatchState.motiveNamed
code: /-- State for `delabAppMatch` and helpers. -/
structure AppMatchState where
  info        : MatcherInfo
  /-- The `matcherTy` instantiated with universe levels and the matcher parameters, with a position at the type of
  this application prefix. -/
  matcherTy : SubExpr
  /-- The motive, with the pi type version delaborated and the original expression version.
  Once `AppMatchState` is complete, this is not `none`. -/
  motive      : Option (Term × Expr) := none
  /-- Whether `pp.analysis.namedArg` was set for the motive argument. -/
  motiveNamed : Bool := false
  /-- The delaborated discriminants, without `h :` annotations. -/
  discrs      : Array Term := #[]
  /-- The collection of names used for the `h :` discriminant annotations, in order.
  Uniquified names are constructed after the first phase. -/
  hNames?     : Array (Option Name) := #[]
  /-- Lambda subexpressions for each alternate. -/
  alts        : Array SubExpr := #[]
  /-- For each match alternative, the names to use for the pattern variables.
  Each ends with `hNames?.filterMap id` exactly. -/
  varNames    : Array (Array Name) := #[]
  /-- The delaborated right-hand sides for each match alternative. -/
  rhss        : Array Term := #[]
goal: Bool

full_name: Lean.PrettyPrinter.Delaborator.AppMatchState.discrs
code: /-- State for `delabAppMatch` and helpers. -/
structure AppMatchState where
  info        : MatcherInfo
  /-- The `matcherTy` instantiated with universe levels and the matcher parameters, with a position at the type of
  this application prefix. -/
  matcherTy : SubExpr
  /-- The motive, with the pi type version delaborated and the original expression version.
  Once `AppMatchState` is complete, this is not `none`. -/
  motive      : Option (Term × Expr) := none
  /-- Whether `pp.analysis.namedArg` was set for the motive argument. -/
  motiveNamed : Bool := false
  /-- The delaborated discriminants, without `h :` annotations. -/
  discrs      : Array Term := #[]
  /-- The collection of names used for the `h :` discriminant annotations, in order.
  Uniquified names are constructed after the first phase. -/
  hNames?     : Array (Option Name) := #[]
  /-- Lambda subexpressions for each alternate. -/
  alts        : Array SubExpr := #[]
  /-- For each match alternative, the names to use for the pattern variables.
  Each ends with `hNames?.filterMap id` exactly. -/
  varNames    : Array (Array Name) := #[]
  /-- The delaborated right-hand sides for each match alternative. -/
  rhss        : Array Term := #[]
goal: Array Lean.Term

full_name: Lean.PrettyPrinter.Delaborator.AppMatchState.info
code: /-- State for `delabAppMatch` and helpers. -/
structure AppMatchState where
  info        : MatcherInfo
  /-- The `matcherTy` instantiated with universe levels and the matcher parameters, with a position at the type of
  this application prefix. -/
  matcherTy : SubExpr
  /-- The motive, with the pi type version delaborated and the original expression version.
  Once `AppMatchState` is complete, this is not `none`. -/
  motive      : Option (Term × Expr) := none
  /-- Whether `pp.analysis.namedArg` was set for the motive argument. -/
  motiveNamed : Bool := false
  /-- The delaborated discriminants, without `h :` annotations. -/
  discrs      : Array Term := #[]
  /-- The collection of names used for the `h :` discriminant annotations, in order.
  Uniquified names are constructed after the first phase. -/
  hNames?     : Array (Option Name) := #[]
  /-- Lambda subexpressions for each alternate. -/
  alts        : Array SubExpr := #[]
  /-- For each match alternative, the names to use for the pattern variables.
  Each ends with `hNames?.filterMap id` exactly. -/
  varNames    : Array (Array Name) := #[]
  /-- The delaborated right-hand sides for each match alternative. -/
  rhss        : Array Term := #[]
goal: Lean.Meta.MatcherInfo

full_name: Lean.PrettyPrinter.Delaborator.AppMatchState.matcherTy
code: /-- State for `delabAppMatch` and helpers. -/
structure AppMatchState where
  info        : MatcherInfo
  /-- The `matcherTy` instantiated with universe levels and the matcher parameters, with a position at the type of
  this application prefix. -/
  matcherTy : SubExpr
  /-- The motive, with the pi type version delaborated and the original expression version.
  Once `AppMatchState` is complete, this is not `none`. -/
  motive      : Option (Term × Expr) := none
  /-- Whether `pp.analysis.namedArg` was set for the motive argument. -/
  motiveNamed : Bool := false
  /-- The delaborated discriminants, without `h :` annotations. -/
  discrs      : Array Term := #[]
  /-- The collection of names used for the `h :` discriminant annotations, in order.
  Uniquified names are constructed after the first phase. -/
  hNames?     : Array (Option Name) := #[]
  /-- Lambda subexpressions for each alternate. -/
  alts        : Array SubExpr := #[]
  /-- For each match alternative, the names to use for the pattern variables.
  Each ends with `hNames?.filterMap id` exactly. -/
  varNames    : Array (Array Name) := #[]
  /-- The delaborated right-hand sides for each match alternative. -/
  rhss        : Array Term := #[]
goal: Lean.SubExpr

full_name: Lean.PrettyPrinter.Delaborator.AppMatchState.varNames
code: /-- State for `delabAppMatch` and helpers. -/
structure AppMatchState where
  info        : MatcherInfo
  /-- The `matcherTy` instantiated with universe levels and the matcher parameters, with a position at the type of
  this application prefix. -/
  matcherTy : SubExpr
  /-- The motive, with the pi type version delaborated and the original expression version.
  Once `AppMatchState` is complete, this is not `none`. -/
  motive      : Option (Term × Expr) := none
  /-- Whether `pp.analysis.namedArg` was set for the motive argument. -/
  motiveNamed : Bool := false
  /-- The delaborated discriminants, without `h :` annotations. -/
  discrs      : Array Term := #[]
  /-- The collection of names used for the `h :` discriminant annotations, in order.
  Uniquified names are constructed after the first phase. -/
  hNames?     : Array (Option Name) := #[]
  /-- Lambda subexpressions for each alternate. -/
  alts        : Array SubExpr := #[]
  /-- For each match alternative, the names to use for the pattern variables.
  Each ends with `hNames?.filterMap id` exactly. -/
  varNames    : Array (Array Name) := #[]
  /-- The delaborated right-hand sides for each match alternative. -/
  rhss        : Array Term := #[]
goal: Array (Array Lean.Name)

full_name: Lean.PrettyPrinter.Delaborator.AppMatchState.hNames?
code: /-- State for `delabAppMatch` and helpers. -/
structure AppMatchState where
  info        : MatcherInfo
  /-- The `matcherTy` instantiated with universe levels and the matcher parameters, with a position at the type of
  this application prefix. -/
  matcherTy : SubExpr
  /-- The motive, with the pi type version delaborated and the original expression version.
  Once `AppMatchState` is complete, this is not `none`. -/
  motive      : Option (Term × Expr) := none
  /-- Whether `pp.analysis.namedArg` was set for the motive argument. -/
  motiveNamed : Bool := false
  /-- The delaborated discriminants, without `h :` annotations. -/
  discrs      : Array Term := #[]
  /-- The collection of names used for the `h :` discriminant annotations, in order.
  Uniquified names are constructed after the first phase. -/
  hNames?     : Array (Option Name) := #[]
  /-- Lambda subexpressions for each alternate. -/
  alts        : Array SubExpr := #[]
  /-- For each match alternative, the names to use for the pattern variables.
  Each ends with `hNames?.filterMap id` exactly. -/
  varNames    : Array (Array Name) := #[]
  /-- The delaborated right-hand sides for each match alternative. -/
  rhss        : Array Term := #[]
goal: Array (Option Lean.Name)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.PrettyPrinter.Delaborator.Builtins.0.Lean.PrettyPrinter.Delaborator.skippingBinders
code: /--
Skips `numParams` binders, and execute `x varNames` where `varNames` contains the new binder names.
The `hNames` array is used for the last params.
Helper for `delabAppMatch`.
-/
private partial def skippingBinders {α} (numParams : Nat) (hNames : Array Name) (x : Array Name → DelabM α) : DelabM α 
goal: Lean.PrettyPrinter.Delaborator.DelabM α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.PrettyPrinter.Delaborator.Builtins.0.Lean.PrettyPrinter.Delaborator.skippingBinders.loop.visitLambda
code: /--
Skips `numParams` binders, and execute `x varNames` where `varNames` contains the new binder names.
The `hNames` array is used for the last params.
Helper for `delabAppMatch`.
-/
private partial def skippingBinders {α} (numParams : Nat) (hNames : Array Name) (x : Array Name → DelabM α) : DelabM α 
goal: Lean.PrettyPrinter.Delaborator.DelabM α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.PrettyPrinter.Delaborator.Builtins.0.Lean.PrettyPrinter.Delaborator.skippingBinders.loop
code: /--
Skips `numParams` binders, and execute `x varNames` where `varNames` contains the new binder names.
The `hNames` array is used for the last params.
Helper for `delabAppMatch`.
-/
private partial def skippingBinders {α} (numParams : Nat) (hNames : Array Name) (x : Array Name → DelabM α) : DelabM α 
goal: Lean.PrettyPrinter.Delaborator.DelabM α

full_name: Lean.PrettyPrinter.Delaborator.delabAppMatch
code: /--
Delaborates applications of "matchers" such as
```
List.map.match_1 : {α : Type _} →
  (motive : List α → Sort _) →
    (x : List α) → (Unit → motive List.nil) → ((a : α) → (as : List α) → motive (a :: as)) → motive x
```
-/
@[builtin_delab app]
partial def delabAppMatch : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabAppMatch.usingNames
code: /--
Delaborates applications of "matchers" such as
```
List.map.match_1 : {α : Type _} →
  (motive : List α → Sort _) →
    (x : List α) → (Unit → motive List.nil) → ((a : α) → (as : List α) → motive (a :: as)) → motive x
```
-/
@[builtin_delab app]
partial def delabAppMatch : Delab 
goal: Lean.PrettyPrinter.Delaborator.DelabM α

full_name: Lean.PrettyPrinter.Delaborator.delabAppMatch.withDummyBinders
code: /--
Delaborates applications of "matchers" such as
```
List.map.match_1 : {α : Type _} →
  (motive : List α → Sort _) →
    (x : List α) → (Unit → motive List.nil) → ((a : α) → (as : List α) → motive (a :: as)) → motive x
```
-/
@[builtin_delab app]
partial def delabAppMatch : Delab 
goal: Lean.PrettyPrinter.Delaborator.DelabM α

full_name: Lean.PrettyPrinter.Delaborator.delabLetFun
code: /--
Delaborates applications of the form `letFun v (fun x => b)` as `let_fun x := v; b`.
-/
@[builtin_delab app.letFun]
def delabLetFun : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabMData
code: @[builtin_delab mdata]
def delabMData : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.hasIdent
code: /--
Check for a `Syntax.ident` of the given name anywhere in the tree.
This is usually a bad idea since it does not check for shadowing bindings,
but in the delaborator we assume that bindings are never shadowed.
-/
partial def hasIdent (id : Name) : Syntax → Bool
  
goal: Lean.Syntax → Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.PrettyPrinter.Delaborator.Builtins.0.Lean.PrettyPrinter.Delaborator.shouldGroupWithNext
code: /--
Return `true` iff current binder should be merged with the nested
binder, if any, into a single binder group:
* both binders must have same binder info and domain
* they cannot be inst-implicit (`[a b : A]` is not valid syntax)
* `pp.binderTypes` must be the same value for both terms
* prefer `fun a b` over `fun (a b)`
-/
private def shouldGroupWithNext : DelabM Bool 
goal: Lean.PrettyPrinter.Delaborator.DelabM Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.PrettyPrinter.Delaborator.Builtins.0.Lean.PrettyPrinter.Delaborator.shouldGroupWithNext.getPPBinderTypes
code: /--
Return `true` iff current binder should be merged with the nested
binder, if any, into a single binder group:
* both binders must have same binder info and domain
* they cannot be inst-implicit (`[a b : A]` is not valid syntax)
* `pp.binderTypes` must be the same value for both terms
* prefer `fun a b` over `fun (a b)`
-/
private def shouldGroupWithNext : DelabM Bool 
goal: Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.PrettyPrinter.Delaborator.Builtins.0.Lean.PrettyPrinter.Delaborator.delabBinders
code: private partial def delabBinders (delabGroup : Array Syntax → Syntax → Delab) : optParam (Array Syntax) #[] → Delab
  -- Accumulate names (`Syntax.ident`s with position information) of the current, unfinished
  -- binder group `(d e ...)` as determined by `shouldGroupWithNext`. We cannot do grouping
  -- inside-out, on the Syntax level, because it depends on comparing the Expr binder types.
  
goal: optParam (Array Lean.Syntax) #[] → Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabLam
code: @[builtin_delab lam]
def delabLam : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: _private.«.lake».packages.lean4.src.lean.Lean.PrettyPrinter.Delaborator.Builtins.0.Lean.PrettyPrinter.Delaborator.delabForallBinders
code: /--
Similar to `delabBinders`, but tracking whether `forallE` is dependent or not.

See issue #1571
-/
private partial def delabForallBinders (delabGroup : Array Syntax → Bool → Syntax → Delab) (curNames : Array Syntax := #[]) (curDep := false) : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabForall
code: @[builtin_delab forallE]
def delabForall : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabLetE
code: @[builtin_delab letE]
def delabLetE : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabChar
code: @[builtin_delab app.Char.ofNat]
def delabChar : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabLit
code: @[builtin_delab lit]
def delabLit : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabOfNatCore
code: /--
Core function that delaborates a natural number (an `OfNat.ofNat` literal).
-/
def delabOfNatCore (showType : Bool := false) : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabNegIntCore
code: /--
Core function that delaborates a negative integer literal (a `Neg.neg` applied to `OfNat.ofNat`).
-/
def delabNegIntCore (showType : Bool := false) : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabDivRatCore
code: /--
Core function that delaborates a rational literal that is the division of an integer literal
by a natural number literal.
The division must be homogeneous for it to count as a rational literal.
-/
def delabDivRatCore (showType : Bool := false) : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabOfNat
code: /--
Delaborates an `OfNat.ofNat` literal.
`@OfNat.ofNat _ n _` ~> `n`.
-/
@[builtin_delab app.OfNat.ofNat]
def delabOfNat : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabNeg
code: /--
Delaborates the negative of an `OfNat.ofNat` literal.
`-@OfNat.ofNat _ n _` ~> `-n`
-/
@[builtin_delab app.Neg.neg]
def delabNeg : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabHDiv
code: /--
Delaborates a rational number literal.
`@OfNat.ofNat _ n _ / @OfNat.ofNat _ m` ~> `n / m`
and `-@OfNat.ofNat _ n _ / @OfNat.ofNat _ m` ~> `-n / m`
-/
@[builtin_delab app.HDiv.hDiv]
def delabHDiv : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabOfScientific
code: @[builtin_delab app.OfScientific.ofScientific]
def delabOfScientific : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabProj
code: /--
Delaborate a projection primitive. These do not usually occur in
user code, but are pretty-printed when e.g. `#print`ing a projection
function.
-/
@[builtin_delab proj]
def delabProj : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.coeDelaborator
code: /--
This delaborator tries to elide functions which are known coercions.
For example, `Int.ofNat` is a coercion, so instead of printing `ofNat n` we just print `↑n`,
and when re-parsing this we can (usually) recover the specific coercion being used.
-/
@[builtin_delab app]
def coeDelaborator : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabDIte.delabBranch
code: @[builtin_delab app.dite]
def delabDIte : Delab 
goal: Lean.PrettyPrinter.Delaborator.DelabM (Lean.Syntax × Lean.Name)

full_name: Lean.PrettyPrinter.Delaborator.delabDIte
code: @[builtin_delab app.dite]
def delabDIte : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabCond
code: @[builtin_delab app.cond]
def delabCond : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabNamedPattern
code: @[builtin_delab app.namedPattern]
def delabNamedPattern : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabSigmaCore
code: def delabSigmaCore (sigma : Bool) : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabSigma
code: @[builtin_delab app.Sigma]
def delabSigma : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabPSigma
code: @[builtin_delab app.PSigma]
def delabPSigma : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabDoElems
code: partial def delabDoElems : DelabM (List Syntax) 
goal: Lean.PrettyPrinter.Delaborator.DelabM (List Lean.Syntax)

full_name: Lean.PrettyPrinter.Delaborator.delabDoElems.prependAndRec
code: partial def delabDoElems : DelabM (List Syntax) 
goal: Lean.PrettyPrinter.Delaborator.DelabM (List Lean.Syntax)

full_name: Lean.PrettyPrinter.Delaborator.delabDo
code: @[builtin_delab app.Bind.bind]
def delabDo : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.reifyName
code: def reifyName : Expr → DelabM Name
  
goal: Lean.Expr → Lean.PrettyPrinter.Delaborator.DelabM Lean.Name

full_name: Lean.PrettyPrinter.Delaborator.delabNameMkStr
code: @[builtin_delab app.Lean.Name.str]
def delabNameMkStr : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.delabNameMkNum
code: @[builtin_delab app.Lean.Name.num]
def delabNameMkNum : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Lean.PrettyPrinter.Delaborator.declSigWithId
code: @[run_builtin_parser_attribute_hooks]
-- use `termParser` instead of `declId` so we can reuse `delabConst`
def declSigWithId 
goal: Lean.Parser.Parser

full_name: _private.«.lake».packages.lean4.src.lean.Lean.PrettyPrinter.Delaborator.Builtins.0.Lean.PrettyPrinter.Delaborator.evalSyntaxConstantUnsafe
code: private unsafe def evalSyntaxConstantUnsafe (env : Environment) (opts : Options) (constName : Name) : ExceptT String Id Syntax 
goal: ExceptT String Id Lean.Syntax

full_name: _private.«.lake».packages.lean4.src.lean.Lean.PrettyPrinter.Delaborator.Builtins.0.Lean.PrettyPrinter.Delaborator.evalSyntaxConstant
code: @[implemented_by evalSyntaxConstantUnsafe]
private opaque evalSyntaxConstant (env : Environment) (opts : Options) (constName : Name) : ExceptT String Id Syntax 
goal: ExceptT String Id Lean.Syntax

full_name: Lean.PrettyPrinter.Delaborator.delabConstWithSignature.shouldGroupWithNext
code: /--
Pretty-prints a constant `c` as `c.{<levels>} <params> : <type>`.

If `universes` is `false`, then the universe level parameters are omitted.
-/
partial def delabConstWithSignature (universes : Bool := true) : Delab 
goal: Bool

full_name: Lean.PrettyPrinter.Delaborator.delabConstWithSignature.delabParams
code: /--
Pretty-prints a constant `c` as `c.{<levels>} <params> : <type>`.

If `universes` is `false`, then the universe level parameters are omitted.
-/
partial def delabConstWithSignature (universes : Bool := true) : Delab 
goal: Lean.PrettyPrinter.Delaborator.DelabM Lean.Term

full_name: Lean.PrettyPrinter.Delaborator.delabConstWithSignature.delabTy
code: /--
Pretty-prints a constant `c` as `c.{<levels>} <params> : <type>`.

If `universes` is `false`, then the universe level parameters are omitted.
-/
partial def delabConstWithSignature (universes : Bool := true) : Delab 
goal: Lean.PrettyPrinter.Delaborator.DelabM Lean.Term

full_name: Lean.PrettyPrinter.Delaborator.delabConstWithSignature.delabParamsAux
code: /--
Pretty-prints a constant `c` as `c.{<levels>} <params> : <type>`.

If `universes` is `false`, then the universe level parameters are omitted.
-/
partial def delabConstWithSignature (universes : Bool := true) : Delab 
goal: Lean.PrettyPrinter.Delaborator.DelabM Lean.Term

full_name: Lean.PrettyPrinter.Delaborator.delabConstWithSignature
code: /--
Pretty-prints a constant `c` as `c.{<levels>} <params> : <type>`.

If `universes` is `false`, then the universe level parameters are omitted.
-/
partial def delabConstWithSignature (universes : Bool := true) : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab