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

full_name: Lean.Compiler.LCNF.Simp.instInhabitedFunDeclInfo
code: /--
Local function usage information used to decide whether it should be inlined or not.
The information is an approximation, but it is on the "safe" side. That is, if we tagged
a function with `.once`, then it is applied only once. A local function may be marked as
`.many`, but after simplifications the number of applications may reduce to 1. This is not
a big problem in practice because we run the simplifier multiple times, and this information
is recomputed from scratch at the beginning of each simplification step.
-/
inductive FunDeclInfo where
  /--
  Local function is applied once, and must be inlined.
  -/
  | once
  /--
  Local function is applied many times or occur as an argument of another function,
  and will only be inlined if it is small.
  -/
  | many
  /--
  Function must be inlined.
  -/
  | mustInline
  deriving Repr, Inhabited
goal: Inhabited Lean.Compiler.LCNF.Simp.FunDeclInfo

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfo.many
code: /--
Local function usage information used to decide whether it should be inlined or not.
The information is an approximation, but it is on the "safe" side. That is, if we tagged
a function with `.once`, then it is applied only once. A local function may be marked as
`.many`, but after simplifications the number of applications may reduce to 1. This is not
a big problem in practice because we run the simplifier multiple times, and this information
is recomputed from scratch at the beginning of each simplification step.
-/
inductive FunDeclInfo where
  /--
  Local function is applied once, and must be inlined.
  -/
  | once
  /--
  Local function is applied many times or occur as an argument of another function,
  and will only be inlined if it is small.
  -/
  | many
  /--
  Function must be inlined.
  -/
  | mustInline
  deriving Repr, Inhabited
goal: Lean.Compiler.LCNF.Simp.FunDeclInfo

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfo.once
code: /--
Local function usage information used to decide whether it should be inlined or not.
The information is an approximation, but it is on the "safe" side. That is, if we tagged
a function with `.once`, then it is applied only once. A local function may be marked as
`.many`, but after simplifications the number of applications may reduce to 1. This is not
a big problem in practice because we run the simplifier multiple times, and this information
is recomputed from scratch at the beginning of each simplification step.
-/
inductive FunDeclInfo where
  /--
  Local function is applied once, and must be inlined.
  -/
  | once
  /--
  Local function is applied many times or occur as an argument of another function,
  and will only be inlined if it is small.
  -/
  | many
  /--
  Function must be inlined.
  -/
  | mustInline
  deriving Repr, Inhabited
goal: Lean.Compiler.LCNF.Simp.FunDeclInfo

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfo.mustInline
code: /--
Local function usage information used to decide whether it should be inlined or not.
The information is an approximation, but it is on the "safe" side. That is, if we tagged
a function with `.once`, then it is applied only once. A local function may be marked as
`.many`, but after simplifications the number of applications may reduce to 1. This is not
a big problem in practice because we run the simplifier multiple times, and this information
is recomputed from scratch at the beginning of each simplification step.
-/
inductive FunDeclInfo where
  /--
  Local function is applied once, and must be inlined.
  -/
  | once
  /--
  Local function is applied many times or occur as an argument of another function,
  and will only be inlined if it is small.
  -/
  | many
  /--
  Function must be inlined.
  -/
  | mustInline
  deriving Repr, Inhabited
goal: Lean.Compiler.LCNF.Simp.FunDeclInfo

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfo
code: /--
Local function usage information used to decide whether it should be inlined or not.
The information is an approximation, but it is on the "safe" side. That is, if we tagged
a function with `.once`, then it is applied only once. A local function may be marked as
`.many`, but after simplifications the number of applications may reduce to 1. This is not
a big problem in practice because we run the simplifier multiple times, and this information
is recomputed from scratch at the beginning of each simplification step.
-/
inductive FunDeclInfo where
  /--
  Local function is applied once, and must be inlined.
  -/
  | once
  /--
  Local function is applied many times or occur as an argument of another function,
  and will only be inlined if it is small.
  -/
  | many
  /--
  Function must be inlined.
  -/
  | mustInline
  deriving Repr, Inhabited
goal: Type

full_name: Lean.Compiler.LCNF.Simp.instReprFunDeclInfo
code: /--
Local function usage information used to decide whether it should be inlined or not.
The information is an approximation, but it is on the "safe" side. That is, if we tagged
a function with `.once`, then it is applied only once. A local function may be marked as
`.many`, but after simplifications the number of applications may reduce to 1. This is not
a big problem in practice because we run the simplifier multiple times, and this information
is recomputed from scratch at the beginning of each simplification step.
-/
inductive FunDeclInfo where
  /--
  Local function is applied once, and must be inlined.
  -/
  | once
  /--
  Local function is applied many times or occur as an argument of another function,
  and will only be inlined if it is small.
  -/
  | many
  /--
  Function must be inlined.
  -/
  | mustInline
  deriving Repr, Inhabited
goal: Repr Lean.Compiler.LCNF.Simp.FunDeclInfo

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfoMap
code: /--
Local function declaration statistics.
-/
structure FunDeclInfoMap where
  /--
  Mapping from local function name to inlining information.
  -/
  map : HashMap FVarId FunDeclInfo := {}
  deriving Inhabited
goal: Type

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfoMap.map
code: /--
Local function declaration statistics.
-/
structure FunDeclInfoMap where
  /--
  Mapping from local function name to inlining information.
  -/
  map : HashMap FVarId FunDeclInfo := {}
  deriving Inhabited
goal: Lean.HashMap Lean.FVarId Lean.Compiler.LCNF.Simp.FunDeclInfo

full_name: Lean.Compiler.LCNF.Simp.instInhabitedFunDeclInfoMap
code: /--
Local function declaration statistics.
-/
structure FunDeclInfoMap where
  /--
  Mapping from local function name to inlining information.
  -/
  map : HashMap FVarId FunDeclInfo := {}
  deriving Inhabited
goal: Inhabited Lean.Compiler.LCNF.Simp.FunDeclInfoMap

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfoMap.format
code: def FunDeclInfoMap.format (s : FunDeclInfoMap) : CompilerM Format 
goal: Lean.Compiler.LCNF.CompilerM Lean.Format

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfoMap.add
code: /--
Add new occurrence for the local function with binder name `key`.
-/
def FunDeclInfoMap.add (s : FunDeclInfoMap) (fvarId : FVarId) : FunDeclInfoMap 
goal: Lean.Compiler.LCNF.Simp.FunDeclInfoMap

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfoMap.addHo
code: /--
Add new occurrence for the local function occurring as an argument for another function.
-/
def FunDeclInfoMap.addHo (s : FunDeclInfoMap) (fvarId : FVarId) : FunDeclInfoMap 
goal: Lean.Compiler.LCNF.Simp.FunDeclInfoMap

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfoMap.addMustInline
code: /--
Add new occurrence for the local function with binder name `key`.
-/
def FunDeclInfoMap.addMustInline (s : FunDeclInfoMap) (fvarId : FVarId) : FunDeclInfoMap 
goal: Lean.Compiler.LCNF.Simp.FunDeclInfoMap

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfoMap.restore
code: def FunDeclInfoMap.restore (s : FunDeclInfoMap) (fvarId : FVarId) (saved? : Option FunDeclInfo) : FunDeclInfoMap 
goal: Lean.Compiler.LCNF.Simp.FunDeclInfoMap

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfoMap.update.go
code: /--
Traverse `code` and update function occurrence map.
This map is used to decide whether we inline local functions or not.
If `mustInline := true`, then all local function declarations occurring in
`code` are tagged as `.mustInline`.
Recall that we use `.mustInline` for local function declarations occurring in type class instances.
-/
partial def FunDeclInfoMap.update (s : FunDeclInfoMap) (code : Code) (mustInline := false) : CompilerM FunDeclInfoMap 
goal: StateRefT' IO.RealWorld Lean.Compiler.LCNF.Simp.FunDeclInfoMap Lean.Compiler.LCNF.CompilerM Unit

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfoMap.update.addLetValueOccs
code: /--
Traverse `code` and update function occurrence map.
This map is used to decide whether we inline local functions or not.
If `mustInline := true`, then all local function declarations occurring in
`code` are tagged as `.mustInline`.
Recall that we use `.mustInline` for local function declarations occurring in type class instances.
-/
partial def FunDeclInfoMap.update (s : FunDeclInfoMap) (code : Code) (mustInline := false) : CompilerM FunDeclInfoMap 
goal: StateRefT' IO.RealWorld Lean.Compiler.LCNF.Simp.FunDeclInfoMap Lean.Compiler.LCNF.CompilerM Unit

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfoMap.update
code: /--
Traverse `code` and update function occurrence map.
This map is used to decide whether we inline local functions or not.
If `mustInline := true`, then all local function declarations occurring in
`code` are tagged as `.mustInline`.
Recall that we use `.mustInline` for local function declarations occurring in type class instances.
-/
partial def FunDeclInfoMap.update (s : FunDeclInfoMap) (code : Code) (mustInline := false) : CompilerM FunDeclInfoMap 
goal: Lean.Compiler.LCNF.CompilerM Lean.Compiler.LCNF.Simp.FunDeclInfoMap

full_name: Lean.Compiler.LCNF.Simp.FunDeclInfoMap.update.addArgOcc
code: /--
Traverse `code` and update function occurrence map.
This map is used to decide whether we inline local functions or not.
If `mustInline := true`, then all local function declarations occurring in
`code` are tagged as `.mustInline`.
Recall that we use `.mustInline` for local function declarations occurring in type class instances.
-/
partial def FunDeclInfoMap.update (s : FunDeclInfoMap) (code : Code) (mustInline := false) : CompilerM FunDeclInfoMap 
goal: StateRefT' IO.RealWorld Lean.Compiler.LCNF.Simp.FunDeclInfoMap Lean.Compiler.LCNF.CompilerM Unit