File: .lake/packages/lean4/src/lean/Lean/Elab/DeclNameGen.lean

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.getParentProjArg
code: /--
If `e` is an application of a projection to a parent structure, returns the term being projected.
-/
private def getParentProjArg (e : Expr) : MetaM (Option Expr) 
goal: Lean.MetaM (Option Lean.Expr)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.winnowExpr.visit
code: /--
Strips out universes and arguments we decide are unnecessary for naming.
The resulting expression can have loose fvars and be mangled in other ways.
Expressions can also be replaced by `.bvar 0` if they shouldn't be mentioned.
-/
private partial def winnowExpr (e : Expr) : MetaM Expr 
goal: Lean.MonadCacheT Lean.Expr Lean.Expr Lean.MetaM Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.winnowExpr
code: /--
Strips out universes and arguments we decide are unnecessary for naming.
The resulting expression can have loose fvars and be mangled in other ways.
Expressions can also be replaced by `.bvar 0` if they shouldn't be mentioned.
-/
private partial def winnowExpr (e : Expr) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.MkNameState
code: /--
State for name generation.
-/
private structure MkNameState where
  /-- Keeps track of expressions already visited so that we do not include them again. -/
  seen : ExprSet := {}
  /-- Keeps track of constants that appear in the generated name. -/
  consts : NameSet := {}
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.MkNameState.seen
code: /--
State for name generation.
-/
private structure MkNameState where
  /-- Keeps track of expressions already visited so that we do not include them again. -/
  seen : ExprSet := {}
  /-- Keeps track of constants that appear in the generated name. -/
  consts : NameSet := {}
goal: Lean.ExprSet

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.MkNameState.consts
code: /--
State for name generation.
-/
private structure MkNameState where
  /-- Keeps track of expressions already visited so that we do not include them again. -/
  seen : ExprSet := {}
  /-- Keeps track of constants that appear in the generated name. -/
  consts : NameSet := {}
goal: Lean.NameSet

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.MkNameM
code: /--
Monad for name generation.
-/
private abbrev MkNameM 
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.mkBaseNameCore.visit'
code: /--
Core algorithm for generating a name. The provided expression should be a winnowed expression.

- `omitTopForall` if true causes "Forall" to not be included if the binding type results in an empty string.
-/
private def mkBaseNameCore (e : Expr) (omitTopForall : Bool := false) : MkNameM String 
goal: Lean.Elab.Command.NameGen.MkNameM String

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.mkBaseNameCore
code: /--
Core algorithm for generating a name. The provided expression should be a winnowed expression.

- `omitTopForall` if true causes "Forall" to not be included if the binding type results in an empty string.
-/
private def mkBaseNameCore (e : Expr) (omitTopForall : Bool := false) : MkNameM String 
goal: Lean.Elab.Command.NameGen.MkNameM String

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.mkBaseNameCore.visit
code: /--
Core algorithm for generating a name. The provided expression should be a winnowed expression.

- `omitTopForall` if true causes "Forall" to not be included if the binding type results in an empty string.
-/
private def mkBaseNameCore (e : Expr) (omitTopForall : Bool := false) : MkNameM String 
goal: Lean.Elab.Command.NameGen.MkNameM String

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.mkBaseNameAux.visit
code: /--
Generate a name, while naming the top-level foralls using "Of".
The provided expression should be a winnowed expression.
-/
private partial def mkBaseNameAux (e : Expr) : MkNameM String 
goal: Lean.Elab.Command.NameGen.MkNameM (List String × String)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.mkBaseNameAux
code: /--
Generate a name, while naming the top-level foralls using "Of".
The provided expression should be a winnowed expression.
-/
private partial def mkBaseNameAux (e : Expr) : MkNameM String 
goal: Lean.Elab.Command.NameGen.MkNameM String

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.visitNamespace
code: /--
Adds all prefixes of `ns` as seen constants.
-/
private def visitNamespace (ns : Name) : MkNameM Unit 
goal: Lean.Elab.Command.NameGen.MkNameM Unit

full_name: Lean.Elab.Command.NameGen.mkBaseName
code: /--
Given an expression, generates a "base name" for a declaration.
The top-level foralls in `e` are treated as being binders, so use the `...Of...` naming convention.
The current namespace is used to seed the seen expressions with each prefix of the namespace that's a global constant.

Collects all constants that contribute to the name in the `MkInstM` state.
This can be used to decide whether to further transform the generated name;
in particular, this enables checking whether the generated name mentions declarations
from the current module or project.
-/
def mkBaseName (e : Expr) : MkNameM String 
goal: Lean.Elab.Command.NameGen.MkNameM String

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.DeclNameGen.0.Lean.Elab.Command.NameGen.moduleToSuffix
code: /--
Converts a module name into a suffix. Includes a leading `_`,
so for example `Lean.Elab.DefView` becomes `_lean_elab_defView`.
-/
private def moduleToSuffix : Name → String
  
goal: Lean.Name → String

full_name: Lean.Elab.Command.NameGen.mkBaseNameWithSuffix
code: /--
Uses heuristics to generate an informative but terse base name for a term of the given type, using `mkBaseName`.
Makes use of the current namespace.
It tries to make these names relatively unique ecosystem-wide,
and it adds suffixes using the current module if the resulting name doesn't refer to anything defined in this module.
-/
def mkBaseNameWithSuffix (pre : String) (type : Expr) : MetaM String 
goal: Lean.MetaM String

full_name: Lean.Elab.Command.NameGen.mkBaseNameWithSuffix'
code: /--
Elaborates the binders and type and then uses `mkBaseNameWithSuffix` to generate a name.
Furthermore, uses `mkUnusedBaseName` on the result.
-/
def mkBaseNameWithSuffix' (pre : String) (binders : Array Syntax) (type : Syntax) : TermElabM Name 
goal: Lean.Elab.TermElabM Lean.Name

full_name: Lean.Elab.Command.mkInstanceName
code: /--
Generates an instance name for a declaration that has the given binders and type.
It tries to make these names relatively unique ecosystem-wide.

Note that this elaborates the binders and the type.
This means that when elaborating an instance declaration, we elaborate these twice.
-/
def mkInstanceName (binders : Array Syntax) (type : Syntax) : CommandElabM Name 
goal: Lean.Elab.Command.CommandElabM Lean.Name