File: .lake/packages/lean4/src/lean/Lean/Compiler/LCNF/SpecInfo.lean

full_name: Lean.Compiler.LCNF.SpecParamInfo.fixedNeutral
code: /--
Each parameter is associated with a `SpecParamInfo`. This information is used by `LCNF/Specialize.lean`.
-/
inductive SpecParamInfo where
  /--
  A parameter that is an type class instance (or an arrow that produces a type class instance),
  and is fixed in recursive declarations. By default, Lean always specializes this kind of argument.
  -/
  | fixedInst
  /--
  A parameter that is a function and is fixed in recursive declarations. If the user tags a declaration
  with `@[specialize]` without specifying which arguments should be specialized, Lean will specialize
  `.fixedHO` arguments in addition to `.fixedInst`.
  -/
  | fixedHO
  /--
  Computationally irrelevant parameters that are fixed in recursive declarations,
  *and* there is a `fixedInst`, `fixedHO`, or `user` param that depends on it.
  -/
  | fixedNeutral
  /--
  An argument that has been specified in the `@[specialize]` attribute. Lean specializes it even if it is
  not fixed in recursive declarations. Non-termination can happen, and Lean interrupts it with an error message
  based on the stack depth.
  -/
  | user
  /--
  Parameter is not going to be specialized.
  -/
  | other
  deriving Inhabited, Repr
goal: Lean.Compiler.LCNF.SpecParamInfo

full_name: Lean.Compiler.LCNF.SpecParamInfo.other
code: /--
Each parameter is associated with a `SpecParamInfo`. This information is used by `LCNF/Specialize.lean`.
-/
inductive SpecParamInfo where
  /--
  A parameter that is an type class instance (or an arrow that produces a type class instance),
  and is fixed in recursive declarations. By default, Lean always specializes this kind of argument.
  -/
  | fixedInst
  /--
  A parameter that is a function and is fixed in recursive declarations. If the user tags a declaration
  with `@[specialize]` without specifying which arguments should be specialized, Lean will specialize
  `.fixedHO` arguments in addition to `.fixedInst`.
  -/
  | fixedHO
  /--
  Computationally irrelevant parameters that are fixed in recursive declarations,
  *and* there is a `fixedInst`, `fixedHO`, or `user` param that depends on it.
  -/
  | fixedNeutral
  /--
  An argument that has been specified in the `@[specialize]` attribute. Lean specializes it even if it is
  not fixed in recursive declarations. Non-termination can happen, and Lean interrupts it with an error message
  based on the stack depth.
  -/
  | user
  /--
  Parameter is not going to be specialized.
  -/
  | other
  deriving Inhabited, Repr
goal: Lean.Compiler.LCNF.SpecParamInfo

full_name: Lean.Compiler.LCNF.SpecParamInfo.fixedInst
code: /--
Each parameter is associated with a `SpecParamInfo`. This information is used by `LCNF/Specialize.lean`.
-/
inductive SpecParamInfo where
  /--
  A parameter that is an type class instance (or an arrow that produces a type class instance),
  and is fixed in recursive declarations. By default, Lean always specializes this kind of argument.
  -/
  | fixedInst
  /--
  A parameter that is a function and is fixed in recursive declarations. If the user tags a declaration
  with `@[specialize]` without specifying which arguments should be specialized, Lean will specialize
  `.fixedHO` arguments in addition to `.fixedInst`.
  -/
  | fixedHO
  /--
  Computationally irrelevant parameters that are fixed in recursive declarations,
  *and* there is a `fixedInst`, `fixedHO`, or `user` param that depends on it.
  -/
  | fixedNeutral
  /--
  An argument that has been specified in the `@[specialize]` attribute. Lean specializes it even if it is
  not fixed in recursive declarations. Non-termination can happen, and Lean interrupts it with an error message
  based on the stack depth.
  -/
  | user
  /--
  Parameter is not going to be specialized.
  -/
  | other
  deriving Inhabited, Repr
goal: Lean.Compiler.LCNF.SpecParamInfo

full_name: Lean.Compiler.LCNF.instReprSpecParamInfo
code: /--
Each parameter is associated with a `SpecParamInfo`. This information is used by `LCNF/Specialize.lean`.
-/
inductive SpecParamInfo where
  /--
  A parameter that is an type class instance (or an arrow that produces a type class instance),
  and is fixed in recursive declarations. By default, Lean always specializes this kind of argument.
  -/
  | fixedInst
  /--
  A parameter that is a function and is fixed in recursive declarations. If the user tags a declaration
  with `@[specialize]` without specifying which arguments should be specialized, Lean will specialize
  `.fixedHO` arguments in addition to `.fixedInst`.
  -/
  | fixedHO
  /--
  Computationally irrelevant parameters that are fixed in recursive declarations,
  *and* there is a `fixedInst`, `fixedHO`, or `user` param that depends on it.
  -/
  | fixedNeutral
  /--
  An argument that has been specified in the `@[specialize]` attribute. Lean specializes it even if it is
  not fixed in recursive declarations. Non-termination can happen, and Lean interrupts it with an error message
  based on the stack depth.
  -/
  | user
  /--
  Parameter is not going to be specialized.
  -/
  | other
  deriving Inhabited, Repr
goal: Repr Lean.Compiler.LCNF.SpecParamInfo

full_name: Lean.Compiler.LCNF.SpecParamInfo.fixedHO
code: /--
Each parameter is associated with a `SpecParamInfo`. This information is used by `LCNF/Specialize.lean`.
-/
inductive SpecParamInfo where
  /--
  A parameter that is an type class instance (or an arrow that produces a type class instance),
  and is fixed in recursive declarations. By default, Lean always specializes this kind of argument.
  -/
  | fixedInst
  /--
  A parameter that is a function and is fixed in recursive declarations. If the user tags a declaration
  with `@[specialize]` without specifying which arguments should be specialized, Lean will specialize
  `.fixedHO` arguments in addition to `.fixedInst`.
  -/
  | fixedHO
  /--
  Computationally irrelevant parameters that are fixed in recursive declarations,
  *and* there is a `fixedInst`, `fixedHO`, or `user` param that depends on it.
  -/
  | fixedNeutral
  /--
  An argument that has been specified in the `@[specialize]` attribute. Lean specializes it even if it is
  not fixed in recursive declarations. Non-termination can happen, and Lean interrupts it with an error message
  based on the stack depth.
  -/
  | user
  /--
  Parameter is not going to be specialized.
  -/
  | other
  deriving Inhabited, Repr
goal: Lean.Compiler.LCNF.SpecParamInfo

full_name: Lean.Compiler.LCNF.instInhabitedSpecParamInfo
code: /--
Each parameter is associated with a `SpecParamInfo`. This information is used by `LCNF/Specialize.lean`.
-/
inductive SpecParamInfo where
  /--
  A parameter that is an type class instance (or an arrow that produces a type class instance),
  and is fixed in recursive declarations. By default, Lean always specializes this kind of argument.
  -/
  | fixedInst
  /--
  A parameter that is a function and is fixed in recursive declarations. If the user tags a declaration
  with `@[specialize]` without specifying which arguments should be specialized, Lean will specialize
  `.fixedHO` arguments in addition to `.fixedInst`.
  -/
  | fixedHO
  /--
  Computationally irrelevant parameters that are fixed in recursive declarations,
  *and* there is a `fixedInst`, `fixedHO`, or `user` param that depends on it.
  -/
  | fixedNeutral
  /--
  An argument that has been specified in the `@[specialize]` attribute. Lean specializes it even if it is
  not fixed in recursive declarations. Non-termination can happen, and Lean interrupts it with an error message
  based on the stack depth.
  -/
  | user
  /--
  Parameter is not going to be specialized.
  -/
  | other
  deriving Inhabited, Repr
goal: Inhabited Lean.Compiler.LCNF.SpecParamInfo

full_name: Lean.Compiler.LCNF.SpecParamInfo
code: /--
Each parameter is associated with a `SpecParamInfo`. This information is used by `LCNF/Specialize.lean`.
-/
inductive SpecParamInfo where
  /--
  A parameter that is an type class instance (or an arrow that produces a type class instance),
  and is fixed in recursive declarations. By default, Lean always specializes this kind of argument.
  -/
  | fixedInst
  /--
  A parameter that is a function and is fixed in recursive declarations. If the user tags a declaration
  with `@[specialize]` without specifying which arguments should be specialized, Lean will specialize
  `.fixedHO` arguments in addition to `.fixedInst`.
  -/
  | fixedHO
  /--
  Computationally irrelevant parameters that are fixed in recursive declarations,
  *and* there is a `fixedInst`, `fixedHO`, or `user` param that depends on it.
  -/
  | fixedNeutral
  /--
  An argument that has been specified in the `@[specialize]` attribute. Lean specializes it even if it is
  not fixed in recursive declarations. Non-termination can happen, and Lean interrupts it with an error message
  based on the stack depth.
  -/
  | user
  /--
  Parameter is not going to be specialized.
  -/
  | other
  deriving Inhabited, Repr
goal: Type

full_name: Lean.Compiler.LCNF.SpecParamInfo.user
code: /--
Each parameter is associated with a `SpecParamInfo`. This information is used by `LCNF/Specialize.lean`.
-/
inductive SpecParamInfo where
  /--
  A parameter that is an type class instance (or an arrow that produces a type class instance),
  and is fixed in recursive declarations. By default, Lean always specializes this kind of argument.
  -/
  | fixedInst
  /--
  A parameter that is a function and is fixed in recursive declarations. If the user tags a declaration
  with `@[specialize]` without specifying which arguments should be specialized, Lean will specialize
  `.fixedHO` arguments in addition to `.fixedInst`.
  -/
  | fixedHO
  /--
  Computationally irrelevant parameters that are fixed in recursive declarations,
  *and* there is a `fixedInst`, `fixedHO`, or `user` param that depends on it.
  -/
  | fixedNeutral
  /--
  An argument that has been specified in the `@[specialize]` attribute. Lean specializes it even if it is
  not fixed in recursive declarations. Non-termination can happen, and Lean interrupts it with an error message
  based on the stack depth.
  -/
  | user
  /--
  Parameter is not going to be specialized.
  -/
  | other
  deriving Inhabited, Repr
goal: Lean.Compiler.LCNF.SpecParamInfo

full_name: Lean.Compiler.LCNF.instToMessageDataSpecParamInfo
code: instance : ToMessageData SpecParamInfo 
goal: Lean.ToMessageData Lean.Compiler.LCNF.SpecParamInfo

full_name: Lean.Compiler.LCNF.SpecState.specInfo
code: structure SpecState where
  specInfo : PHashMap Name (Array SpecParamInfo) := {}
  deriving Inhabited
goal: Lean.PHashMap Lean.Name (Array Lean.Compiler.LCNF.SpecParamInfo)

full_name: Lean.Compiler.LCNF.SpecState
code: structure SpecState where
  specInfo : PHashMap Name (Array SpecParamInfo) := {}
  deriving Inhabited
goal: Type

full_name: Lean.Compiler.LCNF.instInhabitedSpecState
code: structure SpecState where
  specInfo : PHashMap Name (Array SpecParamInfo) := {}
  deriving Inhabited
goal: Inhabited Lean.Compiler.LCNF.SpecState

full_name: Lean.Compiler.LCNF.SpecEntry
code: structure SpecEntry where
  declName   : Name
  paramsInfo : Array SpecParamInfo
  deriving Inhabited
goal: Type

full_name: Lean.Compiler.LCNF.SpecEntry.declName
code: structure SpecEntry where
  declName   : Name
  paramsInfo : Array SpecParamInfo
  deriving Inhabited
goal: Lean.Name

full_name: Lean.Compiler.LCNF.instInhabitedSpecEntry
code: structure SpecEntry where
  declName   : Name
  paramsInfo : Array SpecParamInfo
  deriving Inhabited
goal: Inhabited Lean.Compiler.LCNF.SpecEntry

full_name: Lean.Compiler.LCNF.SpecEntry.paramsInfo
code: structure SpecEntry where
  declName   : Name
  paramsInfo : Array SpecParamInfo
  deriving Inhabited
goal: Array Lean.Compiler.LCNF.SpecParamInfo

full_name: Lean.Compiler.LCNF.SpecState.addEntry
code: def addEntry (s : SpecState) (e : SpecEntry) : SpecState 
goal: Lean.Compiler.LCNF.SpecState

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Compiler.LCNF.SpecInfo.0.Lean.Compiler.LCNF.declLt
code: private abbrev declLt (a b : SpecEntry) 
goal: Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Compiler.LCNF.SpecInfo.0.Lean.Compiler.LCNF.sortEntries
code: private abbrev sortEntries (entries : Array SpecEntry) : Array SpecEntry 
goal: Array Lean.Compiler.LCNF.SpecEntry

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Compiler.LCNF.SpecInfo.0.Lean.Compiler.LCNF.findAtSorted?
code: private abbrev findAtSorted? (entries : Array SpecEntry) (declName : Name) : Option SpecEntry 
goal: Option Lean.Compiler.LCNF.SpecEntry

full_name: Lean.Compiler.LCNF.initFn._@..lake.packages.lean4.src.lean.Lean.Compiler.LCNF.SpecInfo._hyg.368
code: /--
Extension for storing `SpecParamInfo` for declarations being compiled.
Remark: we only store information for declarations that will be specialized.
-/
builtin_initialize specExtension : SimplePersistentEnvExtension SpecEntry SpecState ←
  registerSimplePersistentEnvExtension {
    addEntryFn    := SpecState.addEntry
    addImportedFn := fun _ => {}
    toArrayFn     := fun s => sortEntries s.toArray
  }
goal: IO (Lean.SimplePersistentEnvExtension Lean.Compiler.LCNF.SpecEntry Lean.Compiler.LCNF.SpecState)

full_name: Lean.Compiler.LCNF.specExtension
code: /--
Extension for storing `SpecParamInfo` for declarations being compiled.
Remark: we only store information for declarations that will be specialized.
-/
builtin_initialize specExtension : SimplePersistentEnvExtension SpecEntry SpecState ←
  registerSimplePersistentEnvExtension {
    addEntryFn    := SpecState.addEntry
    addImportedFn := fun _ => {}
    toArrayFn     := fun s => sortEntries s.toArray
  }
goal: Lean.SimplePersistentEnvExtension Lean.Compiler.LCNF.SpecEntry Lean.Compiler.LCNF.SpecState

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Compiler.LCNF.SpecInfo.0.Lean.Compiler.LCNF.isNoSpecType
code: /--
Return `true` if `type` is a type tagged with `@[nospecialize]` or an arrow that produces this kind of type.
For example, this function returns true for `Inhabited Nat`, and `Nat → Inhabited Nat`.
-/
private def isNoSpecType (env : Environment) (type : Expr) : Bool 
goal: Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Compiler.LCNF.SpecInfo.0.Lean.Compiler.LCNF.hasFwdDeps
code: /--
Return `true` if parameter `j` of the given declaration has a forward dependency at parameter `k`,
and `k` is tagged as `.user`, `.fixedHO`, or `.fixedInst`.

See comment at `.fixedNeutral`.
-/
private def hasFwdDeps (decl : Decl) (paramsInfo : Array SpecParamInfo) (j : Nat) : Bool 
goal: Bool

full_name: Lean.Compiler.LCNF.saveSpecParamInfo
code: /--
Save parameter information for `decls`.

Remark: this function, similarly to `mkFixedArgMap`,
assumes that if a function `f` was declared in a mutual block, then `decls`
contains all (computationally relevant) functions in the mutual block.
-/
def saveSpecParamInfo (decls : Array Decl) : CompilerM Unit 
goal: Lean.Compiler.LCNF.CompilerM Unit

full_name: Lean.Compiler.LCNF.getSpecParamInfoCore?
code: def getSpecParamInfoCore? (env : Environment) (declName : Name) : Option (Array SpecParamInfo) 
goal: Option (Array Lean.Compiler.LCNF.SpecParamInfo)

full_name: Lean.Compiler.LCNF.getSpecParamInfo?
code: def getSpecParamInfo? [Monad m] [MonadEnv m] (declName : Name) : m (Option (Array SpecParamInfo)) 
goal: m (Option (Array Lean.Compiler.LCNF.SpecParamInfo))

full_name: Lean.Compiler.LCNF.isSpecCandidate
code: def isSpecCandidate [Monad m] [MonadEnv m] (declName : Name) : m Bool 
goal: m Bool

full_name: Lean.Compiler.LCNF.initFn._@..lake.packages.lean4.src.lean.Lean.Compiler.LCNF.SpecInfo._hyg.2195
code: builtin_initialize
  registerTraceClass `Compiler.specialize.info
goal: IO Unit