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

full_name: Lean.Compiler.LCNF.FixedParams.AbsValue.val
code: /-- Abstract value for the "fixed parameter" analysis. -/
inductive AbsValue where
  | top
  | erased
  | val (i : Nat)
  deriving Inhabited, BEq, Hashable
goal: Lean.Compiler.LCNF.FixedParams.AbsValue

full_name: Lean.Compiler.LCNF.FixedParams.instBEqAbsValue
code: /-- Abstract value for the "fixed parameter" analysis. -/
inductive AbsValue where
  | top
  | erased
  | val (i : Nat)
  deriving Inhabited, BEq, Hashable
goal: BEq Lean.Compiler.LCNF.FixedParams.AbsValue

full_name: Lean.Compiler.LCNF.FixedParams.AbsValue.top
code: /-- Abstract value for the "fixed parameter" analysis. -/
inductive AbsValue where
  | top
  | erased
  | val (i : Nat)
  deriving Inhabited, BEq, Hashable
goal: Lean.Compiler.LCNF.FixedParams.AbsValue

full_name: Lean.Compiler.LCNF.FixedParams.AbsValue.erased
code: /-- Abstract value for the "fixed parameter" analysis. -/
inductive AbsValue where
  | top
  | erased
  | val (i : Nat)
  deriving Inhabited, BEq, Hashable
goal: Lean.Compiler.LCNF.FixedParams.AbsValue

full_name: Lean.Compiler.LCNF.FixedParams.AbsValue
code: /-- Abstract value for the "fixed parameter" analysis. -/
inductive AbsValue where
  | top
  | erased
  | val (i : Nat)
  deriving Inhabited, BEq, Hashable
goal: Type

full_name: Lean.Compiler.LCNF.FixedParams.instInhabitedAbsValue
code: /-- Abstract value for the "fixed parameter" analysis. -/
inductive AbsValue where
  | top
  | erased
  | val (i : Nat)
  deriving Inhabited, BEq, Hashable
goal: Inhabited Lean.Compiler.LCNF.FixedParams.AbsValue

full_name: Lean.Compiler.LCNF.FixedParams.instHashableAbsValue
code: /-- Abstract value for the "fixed parameter" analysis. -/
inductive AbsValue where
  | top
  | erased
  | val (i : Nat)
  deriving Inhabited, BEq, Hashable
goal: Hashable Lean.Compiler.LCNF.FixedParams.AbsValue

full_name: Lean.Compiler.LCNF.FixedParams.Context.assignment
code: structure Context where
  /-- Declaration in the same mutual block. -/
  decls : Array Decl
  /--
  Function being analyzed. We check every recursive call to this function.
  Remark: `main` is in `decls`.
  -/
  main : Decl
  /--
  The assignment maps free variable ids in the current code being analyzed to abstract values.
  We only track the abstract value assigned to parameters.
  -/
  assignment : FVarIdMap AbsValue
goal: Lean.FVarIdMap Lean.Compiler.LCNF.FixedParams.AbsValue

full_name: Lean.Compiler.LCNF.FixedParams.Context.decls
code: structure Context where
  /-- Declaration in the same mutual block. -/
  decls : Array Decl
  /--
  Function being analyzed. We check every recursive call to this function.
  Remark: `main` is in `decls`.
  -/
  main : Decl
  /--
  The assignment maps free variable ids in the current code being analyzed to abstract values.
  We only track the abstract value assigned to parameters.
  -/
  assignment : FVarIdMap AbsValue
goal: Array Lean.Compiler.LCNF.Decl

full_name: Lean.Compiler.LCNF.FixedParams.Context
code: structure Context where
  /-- Declaration in the same mutual block. -/
  decls : Array Decl
  /--
  Function being analyzed. We check every recursive call to this function.
  Remark: `main` is in `decls`.
  -/
  main : Decl
  /--
  The assignment maps free variable ids in the current code being analyzed to abstract values.
  We only track the abstract value assigned to parameters.
  -/
  assignment : FVarIdMap AbsValue
goal: Type

full_name: Lean.Compiler.LCNF.FixedParams.Context.main
code: structure Context where
  /-- Declaration in the same mutual block. -/
  decls : Array Decl
  /--
  Function being analyzed. We check every recursive call to this function.
  Remark: `main` is in `decls`.
  -/
  main : Decl
  /--
  The assignment maps free variable ids in the current code being analyzed to abstract values.
  We only track the abstract value assigned to parameters.
  -/
  assignment : FVarIdMap AbsValue
goal: Lean.Compiler.LCNF.Decl

full_name: Lean.Compiler.LCNF.FixedParams.State.fixed
code: structure State where
  /--
  Set of calls that have been already analyzed.
  Recall that we assume that only functions in `decls` may have recursive calls to the function being analyzed (i.e., `main`).
  Whenever there is function application `f a₁ ... aₙ`, where `f` is in `decls`, `f` is not `main`, and
  we visit with the abstract values assigned to `aᵢ`, but first we record the visit here.
  -/
  visited : HashSet (Name × Array AbsValue) := {}
  /--
  Bitmask containing the result, i.e., which parameters of `main` are fixed.
  We initialize it with `true` everywhere.
  -/
  fixed : Array Bool
goal: Array Bool

full_name: Lean.Compiler.LCNF.FixedParams.State.visited
code: structure State where
  /--
  Set of calls that have been already analyzed.
  Recall that we assume that only functions in `decls` may have recursive calls to the function being analyzed (i.e., `main`).
  Whenever there is function application `f a₁ ... aₙ`, where `f` is in `decls`, `f` is not `main`, and
  we visit with the abstract values assigned to `aᵢ`, but first we record the visit here.
  -/
  visited : HashSet (Name × Array AbsValue) := {}
  /--
  Bitmask containing the result, i.e., which parameters of `main` are fixed.
  We initialize it with `true` everywhere.
  -/
  fixed : Array Bool
goal: Lean.HashSet (Lean.Name × Array Lean.Compiler.LCNF.FixedParams.AbsValue)

full_name: Lean.Compiler.LCNF.FixedParams.State
code: structure State where
  /--
  Set of calls that have been already analyzed.
  Recall that we assume that only functions in `decls` may have recursive calls to the function being analyzed (i.e., `main`).
  Whenever there is function application `f a₁ ... aₙ`, where `f` is in `decls`, `f` is not `main`, and
  we visit with the abstract values assigned to `aᵢ`, but first we record the visit here.
  -/
  visited : HashSet (Name × Array AbsValue) := {}
  /--
  Bitmask containing the result, i.e., which parameters of `main` are fixed.
  We initialize it with `true` everywhere.
  -/
  fixed : Array Bool
goal: Type

full_name: Lean.Compiler.LCNF.FixedParams.FixParamM
code: /-- Monad for the fixed parameter static analyzer. We use the unit-exception to interrupt the analysis. -/
abbrev FixParamM 
goal: Type

full_name: Lean.Compiler.LCNF.FixedParams.abort
code: /-- Stop the analysis and mark all parameters as non-fixed. -/
abbrev abort : FixParamM α 
goal: Lean.Compiler.LCNF.FixedParams.FixParamM α

full_name: Lean.Compiler.LCNF.FixedParams.evalFVar
code: def evalFVar (fvarId : FVarId) : FixParamM AbsValue 
goal: Lean.Compiler.LCNF.FixedParams.FixParamM Lean.Compiler.LCNF.FixedParams.AbsValue

full_name: Lean.Compiler.LCNF.FixedParams.evalArg
code: def evalArg (arg : Arg) : FixParamM AbsValue 
goal: Lean.Compiler.LCNF.FixedParams.FixParamM Lean.Compiler.LCNF.FixedParams.AbsValue

full_name: Lean.Compiler.LCNF.FixedParams.inMutualBlock
code: def inMutualBlock (declName : Name) : FixParamM Bool 
goal: Lean.Compiler.LCNF.FixedParams.FixParamM Bool

full_name: Lean.Compiler.LCNF.FixedParams.mkAssignment
code: def mkAssignment (decl : Decl) (values : Array AbsValue) : FVarIdMap AbsValue 
goal: Lean.FVarIdMap Lean.Compiler.LCNF.FixedParams.AbsValue

full_name: Lean.Compiler.LCNF.FixedParams.mkInitialValues
code: def mkInitialValues (numParams : Nat) : Array AbsValue 
goal: Array Lean.Compiler.LCNF.FixedParams.AbsValue

full_name: Lean.Compiler.LCNF.mkFixedParamsMap
code: /--
Given the (potentially mutually) recursive declarations `decls`,
return a map from declaration name `decl.name` to a bit-mask `m` where `m[i]` is true
iff the `decl.params[i]` is a fixed argument. That is, it does not change in recursive
applications.
The function assumes that if a function `f` was declared in a mutual block, then `decls`
contains all (computationally relevant) functions in the mutual block.
-/
def mkFixedParamsMap (decls : Array Decl) : NameMap (Array Bool) 
goal: Lean.NameMap (Array Bool)