File: .lake/packages/lean4/src/lean/Lean/Compiler/IR/ElimDeadBranches.lean

full_name: Lean.IR.UnreachableBranches.Value
code: /-- Value used in the abstract interpreter -/
inductive Value where
  | bot -- undefined
  | top -- any value
  | ctor (i : CtorInfo) (vs : Array Value)
  | choice (vs : List Value)
  deriving Inhabited, Repr
goal: Type

full_name: Lean.IR.UnreachableBranches.instReprValue
code: /-- Value used in the abstract interpreter -/
inductive Value where
  | bot -- undefined
  | top -- any value
  | ctor (i : CtorInfo) (vs : Array Value)
  | choice (vs : List Value)
  deriving Inhabited, Repr
goal: Repr Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Value.bot
code: /-- Value used in the abstract interpreter -/
inductive Value where
  | bot -- undefined
  | top -- any value
  | ctor (i : CtorInfo) (vs : Array Value)
  | choice (vs : List Value)
  deriving Inhabited, Repr
goal: Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Value.top
code: /-- Value used in the abstract interpreter -/
inductive Value where
  | bot -- undefined
  | top -- any value
  | ctor (i : CtorInfo) (vs : Array Value)
  | choice (vs : List Value)
  deriving Inhabited, Repr
goal: Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Value.choice
code: /-- Value used in the abstract interpreter -/
inductive Value where
  | bot -- undefined
  | top -- any value
  | ctor (i : CtorInfo) (vs : Array Value)
  | choice (vs : List Value)
  deriving Inhabited, Repr
goal: Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.instInhabitedValue
code: /-- Value used in the abstract interpreter -/
inductive Value where
  | bot -- undefined
  | top -- any value
  | ctor (i : CtorInfo) (vs : Array Value)
  | choice (vs : List Value)
  deriving Inhabited, Repr
goal: Inhabited Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Value.ctor
code: /-- Value used in the abstract interpreter -/
inductive Value where
  | bot -- undefined
  | top -- any value
  | ctor (i : CtorInfo) (vs : Array Value)
  | choice (vs : List Value)
  deriving Inhabited, Repr
goal: Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Value.toFormat
code: protected partial def Value.toFormat : Value → Format
  
goal: Lean.IR.UnreachableBranches.Value → Lean.Format

full_name: Lean.IR.UnreachableBranches.instToFormatValue
code: instance : ToFormat Value 
goal: Lean.ToFormat Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.instToStringValue
code: instance : ToString Value 
goal: ToString Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Value.beq
code: protected partial def beq : Value → Value → Bool
  
goal: Lean.IR.UnreachableBranches.Value → Lean.IR.UnreachableBranches.Value → Bool

full_name: Lean.IR.UnreachableBranches.Value.instBEq
code: instance : BEq Value 
goal: BEq Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Value.addChoice
code: partial def addChoice (merge : Value → Value → Value) : List Value → Value → List Value
  
goal: List Lean.IR.UnreachableBranches.Value → Lean.IR.UnreachableBranches.Value → List Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Value.merge
code: partial def merge (v₁ v₂ : Value) : Value 
goal: Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Value.format
code: protected partial def format : Value → Format
  
goal: Lean.IR.UnreachableBranches.Value → Lean.Format

full_name: Lean.IR.UnreachableBranches.Value.instToFormat
code: instance : ToFormat Value 
goal: Lean.ToFormat Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Value.instToString
code: instance : ToString Value 
goal: ToString Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Value.truncateMaxDepth
code: /--
  In `truncate`, we approximate a value as `top` if depth > `truncateMaxDepth`.
  TODO: add option to control this parameter.
-/
def truncateMaxDepth 
goal: Nat

full_name: Lean.IR.UnreachableBranches.Value.truncate.go
code: /--
  Make sure constructors of recursive inductive datatypes can only occur once in each path.
  Values at depth > truncateMaxDepth are also approximated at `top`.
  We use this function this function to implement a simple widening operation for our abstract
  interpreter.
  Recall the widening functions is used to ensure termination in abstract interpreters.
-/
partial def truncate (env : Environment) (v : Value) (s : NameSet) : Value 
goal: Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Value.truncate
code: /--
  Make sure constructors of recursive inductive datatypes can only occur once in each path.
  Values at depth > truncateMaxDepth are also approximated at `top`.
  We use this function this function to implement a simple widening operation for our abstract
  interpreter.
  Recall the widening functions is used to ensure termination in abstract interpreters.
-/
partial def truncate (env : Environment) (v : Value) (s : NameSet) : Value 
goal: Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Value.widening
code: /-- Widening operator that guarantees termination in our abstract interpreter. -/
def widening (env : Environment) (v₁ v₂ : Value) : Value 
goal: Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.FunctionSummaries
code: abbrev FunctionSummaries 
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Compiler.IR.ElimDeadBranches.0.Lean.IR.UnreachableBranches.declLt
code: private abbrev declLt (a b : FunId × Value) 
goal: Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Compiler.IR.ElimDeadBranches.0.Lean.IR.UnreachableBranches.sortEntries
code: private abbrev sortEntries (entries : Array (FunId × Value)) : Array (FunId × Value) 
goal: Array (Lean.IR.FunId × Lean.IR.UnreachableBranches.Value)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Compiler.IR.ElimDeadBranches.0.Lean.IR.UnreachableBranches.findAtSorted?
code: private abbrev findAtSorted? (entries : Array (FunId × Value)) (fid : FunId) : Option Value 
goal: Option Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.initFn._@..lake.packages.lean4.src.lean.Lean.Compiler.IR.ElimDeadBranches._hyg.1159
code: builtin_initialize functionSummariesExt : SimplePersistentEnvExtension (FunId × Value) FunctionSummaries ←
  registerSimplePersistentEnvExtension {
    addImportedFn := fun _ => {}
    addEntryFn := fun s ⟨e, n⟩ => s.insert e n
    toArrayFn := fun s => sortEntries s.toArray
  }
goal: IO
  (Lean.SimplePersistentEnvExtension (Lean.IR.FunId × Lean.IR.UnreachableBranches.Value)
    Lean.IR.UnreachableBranches.FunctionSummaries)

full_name: Lean.IR.UnreachableBranches.functionSummariesExt
code: builtin_initialize functionSummariesExt : SimplePersistentEnvExtension (FunId × Value) FunctionSummaries ←
  registerSimplePersistentEnvExtension {
    addImportedFn := fun _ => {}
    addEntryFn := fun s ⟨e, n⟩ => s.insert e n
    toArrayFn := fun s => sortEntries s.toArray
  }
goal: Lean.SimplePersistentEnvExtension (Lean.IR.FunId × Lean.IR.UnreachableBranches.Value)
  Lean.IR.UnreachableBranches.FunctionSummaries

full_name: Lean.IR.UnreachableBranches.addFunctionSummary
code: def addFunctionSummary (env : Environment) (fid : FunId) (v : Value) : Environment 
goal: Lean.Environment

full_name: Lean.IR.UnreachableBranches.getFunctionSummary?
code: def getFunctionSummary? (env : Environment) (fid : FunId) : Option Value 
goal: Option Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.Assignment
code: abbrev Assignment 
goal: Type

full_name: Lean.IR.UnreachableBranches.InterpContext
code: structure InterpContext where
  currFnIdx : Nat := 0
  decls     : Array Decl
  env       : Environment
  lctx      : LocalContext := {}
goal: Type

full_name: Lean.IR.UnreachableBranches.InterpContext.lctx
code: structure InterpContext where
  currFnIdx : Nat := 0
  decls     : Array Decl
  env       : Environment
  lctx      : LocalContext := {}
goal: Lean.IR.LocalContext

full_name: Lean.IR.UnreachableBranches.InterpContext.env
code: structure InterpContext where
  currFnIdx : Nat := 0
  decls     : Array Decl
  env       : Environment
  lctx      : LocalContext := {}
goal: Lean.Environment

full_name: Lean.IR.UnreachableBranches.InterpContext.currFnIdx
code: structure InterpContext where
  currFnIdx : Nat := 0
  decls     : Array Decl
  env       : Environment
  lctx      : LocalContext := {}
goal: Nat

full_name: Lean.IR.UnreachableBranches.InterpContext.decls
code: structure InterpContext where
  currFnIdx : Nat := 0
  decls     : Array Decl
  env       : Environment
  lctx      : LocalContext := {}
goal: Array Lean.IR.Decl

full_name: Lean.IR.UnreachableBranches.InterpState.funVals
code: structure InterpState where
  assignments : Array Assignment
  funVals     : PArray Value
goal: Lean.PArray Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.InterpState
code: structure InterpState where
  assignments : Array Assignment
  funVals     : PArray Value
goal: Type

full_name: Lean.IR.UnreachableBranches.InterpState.assignments
code: structure InterpState where
  assignments : Array Assignment
  funVals     : PArray Value
goal: Array Lean.IR.UnreachableBranches.Assignment

full_name: Lean.IR.UnreachableBranches.M
code: abbrev M 
goal: Type

full_name: Lean.IR.UnreachableBranches.findVarValue
code: def findVarValue (x : VarId) : M Value 
goal: Lean.IR.UnreachableBranches.M Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.findArgValue
code: def findArgValue (arg : Arg) : M Value 
goal: Lean.IR.UnreachableBranches.M Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.updateVarAssignment
code: def updateVarAssignment (x : VarId) (v : Value) : M Unit 
goal: Lean.IR.UnreachableBranches.M Unit

full_name: Lean.IR.UnreachableBranches.resetVarAssignment
code: def resetVarAssignment (x : VarId) : M Unit 
goal: Lean.IR.UnreachableBranches.M Unit

full_name: Lean.IR.UnreachableBranches.resetParamAssignment
code: def resetParamAssignment (y : Param) : M Unit 
goal: Lean.IR.UnreachableBranches.M Unit

full_name: Lean.IR.UnreachableBranches.projValue
code: partial def projValue : Value → Nat → Value
  
goal: Lean.IR.UnreachableBranches.Value → Nat → Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.interpExpr
code: def interpExpr : Expr → M Value
  
goal: Lean.IR.Expr → Lean.IR.UnreachableBranches.M Lean.IR.UnreachableBranches.Value

full_name: Lean.IR.UnreachableBranches.containsCtor
code: partial def containsCtor : Value → CtorInfo → Bool
  
goal: Lean.IR.UnreachableBranches.Value → Lean.IR.CtorInfo → Bool

full_name: Lean.IR.UnreachableBranches.updateCurrFnSummary
code: def updateCurrFnSummary (v : Value) : M Unit 
goal: Lean.IR.UnreachableBranches.M Unit

full_name: Lean.IR.UnreachableBranches.updateJPParamsAssignment
code: /-- Return true if the assignment of at least one parameter has been updated. -/
def updateJPParamsAssignment (ys : Array Param) (xs : Array Arg) : M Bool 
goal: Lean.IR.UnreachableBranches.M Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Compiler.IR.ElimDeadBranches.0.Lean.IR.UnreachableBranches.resetNestedJPParams
code: private partial def resetNestedJPParams : FnBody → M Unit
  
goal: Lean.IR.FnBody → Lean.IR.UnreachableBranches.M Unit

full_name: Lean.IR.UnreachableBranches.interpFnBody
code: partial def interpFnBody : FnBody → M Unit
  
goal: Lean.IR.FnBody → Lean.IR.UnreachableBranches.M Unit

full_name: Lean.IR.UnreachableBranches.inferStep
code: def inferStep : M Bool 
goal: Lean.IR.UnreachableBranches.M Bool

full_name: Lean.IR.UnreachableBranches.inferMain
code: partial def inferMain : M Unit 
goal: Lean.IR.UnreachableBranches.M Unit

full_name: Lean.IR.UnreachableBranches.elimDeadAux
code: partial def elimDeadAux (assignment : Assignment) : FnBody → FnBody
  
goal: Lean.IR.FnBody → Lean.IR.FnBody

full_name: Lean.IR.UnreachableBranches.elimDead
code: partial def elimDead (assignment : Assignment) (d : Decl) : Decl 
goal: Lean.IR.Decl

full_name: Lean.IR.elimDeadBranches
code: def elimDeadBranches (decls : Array Decl) : CompilerM (Array Decl) 
goal: Lean.IR.CompilerM (Array Lean.IR.Decl)