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

full_name: Lean.IR.ExplicitBoxing.mkBoxedName
code: def mkBoxedName (n : Name) : Name 
goal: Lean.Name

full_name: Lean.IR.ExplicitBoxing.isBoxedName
code: def isBoxedName (name : Name) : Bool 
goal: Bool

full_name: Lean.IR.ExplicitBoxing.N
code: abbrev N 
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Compiler.IR.Boxing.0.Lean.IR.ExplicitBoxing.N.mkFresh
code: private def N.mkFresh : N VarId 
goal: Lean.IR.ExplicitBoxing.N Lean.IR.VarId

full_name: Lean.IR.ExplicitBoxing.requiresBoxedVersion
code: def requiresBoxedVersion (env : Environment) (decl : Decl) : Bool 
goal: Bool

full_name: Lean.IR.ExplicitBoxing.mkBoxedVersionAux
code: def mkBoxedVersionAux (decl : Decl) : N Decl 
goal: Lean.IR.ExplicitBoxing.N Lean.IR.Decl

full_name: Lean.IR.ExplicitBoxing.mkBoxedVersion
code: def mkBoxedVersion (decl : Decl) : Decl 
goal: Lean.IR.Decl

full_name: Lean.IR.ExplicitBoxing.addBoxedVersions
code: def addBoxedVersions (env : Environment) (decls : Array Decl) : Array Decl 
goal: Array Lean.IR.Decl

full_name: Lean.IR.ExplicitBoxing.getScrutineeType
code: /-- Infer scrutinee type using `case` alternatives.
   This can be done whenever `alts` does not contain an `Alt.default _` value. -/
def getScrutineeType (alts : Array Alt) : IRType 
goal: Lean.IR.IRType

full_name: Lean.IR.ExplicitBoxing.eqvTypes
code: def eqvTypes (t₁ t₂ : IRType) : Bool 
goal: Bool

full_name: Lean.IR.ExplicitBoxing.BoxingContext.decls
code: structure BoxingContext where
  f : FunId := default
  localCtx : LocalContext := {}
  resultType : IRType := IRType.irrelevant
  decls : Array Decl
  env : Environment
goal: Array Lean.IR.Decl

full_name: Lean.IR.ExplicitBoxing.BoxingContext
code: structure BoxingContext where
  f : FunId := default
  localCtx : LocalContext := {}
  resultType : IRType := IRType.irrelevant
  decls : Array Decl
  env : Environment
goal: Type

full_name: Lean.IR.ExplicitBoxing.BoxingContext.localCtx
code: structure BoxingContext where
  f : FunId := default
  localCtx : LocalContext := {}
  resultType : IRType := IRType.irrelevant
  decls : Array Decl
  env : Environment
goal: Lean.IR.LocalContext

full_name: Lean.IR.ExplicitBoxing.BoxingContext.resultType
code: structure BoxingContext where
  f : FunId := default
  localCtx : LocalContext := {}
  resultType : IRType := IRType.irrelevant
  decls : Array Decl
  env : Environment
goal: Lean.IR.IRType

full_name: Lean.IR.ExplicitBoxing.BoxingContext.env
code: structure BoxingContext where
  f : FunId := default
  localCtx : LocalContext := {}
  resultType : IRType := IRType.irrelevant
  decls : Array Decl
  env : Environment
goal: Lean.Environment

full_name: Lean.IR.ExplicitBoxing.BoxingContext.f
code: structure BoxingContext where
  f : FunId := default
  localCtx : LocalContext := {}
  resultType : IRType := IRType.irrelevant
  decls : Array Decl
  env : Environment
goal: Lean.IR.FunId

full_name: Lean.IR.ExplicitBoxing.BoxingState
code: structure BoxingState where
  nextIdx : Index
  /-- We create auxiliary declarations when boxing constant and literals.
     The idea is to avoid code such as
     ```
     let x1 := Uint64.inhabited;
     let x2 := box x1;
     ...
     ```
     We currently do not cache these declarations in an environment extension, but
     we use auxDeclCache to avoid creating equivalent auxiliary declarations more than once when
     processing the same IR declaration.
  -/
  auxDecls : Array Decl := #[]
  auxDeclCache : AssocList FnBody Expr := AssocList.empty
  nextAuxId : Nat := 1
goal: Type

full_name: Lean.IR.ExplicitBoxing.BoxingState.nextIdx
code: structure BoxingState where
  nextIdx : Index
  /-- We create auxiliary declarations when boxing constant and literals.
     The idea is to avoid code such as
     ```
     let x1 := Uint64.inhabited;
     let x2 := box x1;
     ...
     ```
     We currently do not cache these declarations in an environment extension, but
     we use auxDeclCache to avoid creating equivalent auxiliary declarations more than once when
     processing the same IR declaration.
  -/
  auxDecls : Array Decl := #[]
  auxDeclCache : AssocList FnBody Expr := AssocList.empty
  nextAuxId : Nat := 1
goal: Lean.IR.Index

full_name: Lean.IR.ExplicitBoxing.BoxingState.auxDeclCache
code: structure BoxingState where
  nextIdx : Index
  /-- We create auxiliary declarations when boxing constant and literals.
     The idea is to avoid code such as
     ```
     let x1 := Uint64.inhabited;
     let x2 := box x1;
     ...
     ```
     We currently do not cache these declarations in an environment extension, but
     we use auxDeclCache to avoid creating equivalent auxiliary declarations more than once when
     processing the same IR declaration.
  -/
  auxDecls : Array Decl := #[]
  auxDeclCache : AssocList FnBody Expr := AssocList.empty
  nextAuxId : Nat := 1
goal: Lean.AssocList Lean.IR.FnBody Lean.IR.Expr

full_name: Lean.IR.ExplicitBoxing.BoxingState.nextAuxId
code: structure BoxingState where
  nextIdx : Index
  /-- We create auxiliary declarations when boxing constant and literals.
     The idea is to avoid code such as
     ```
     let x1 := Uint64.inhabited;
     let x2 := box x1;
     ...
     ```
     We currently do not cache these declarations in an environment extension, but
     we use auxDeclCache to avoid creating equivalent auxiliary declarations more than once when
     processing the same IR declaration.
  -/
  auxDecls : Array Decl := #[]
  auxDeclCache : AssocList FnBody Expr := AssocList.empty
  nextAuxId : Nat := 1
goal: Nat

full_name: Lean.IR.ExplicitBoxing.BoxingState.auxDecls
code: structure BoxingState where
  nextIdx : Index
  /-- We create auxiliary declarations when boxing constant and literals.
     The idea is to avoid code such as
     ```
     let x1 := Uint64.inhabited;
     let x2 := box x1;
     ...
     ```
     We currently do not cache these declarations in an environment extension, but
     we use auxDeclCache to avoid creating equivalent auxiliary declarations more than once when
     processing the same IR declaration.
  -/
  auxDecls : Array Decl := #[]
  auxDeclCache : AssocList FnBody Expr := AssocList.empty
  nextAuxId : Nat := 1
goal: Array Lean.IR.Decl

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

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Compiler.IR.Boxing.0.Lean.IR.ExplicitBoxing.M.mkFresh
code: private def M.mkFresh : M VarId 
goal: Lean.IR.ExplicitBoxing.M Lean.IR.VarId

full_name: Lean.IR.ExplicitBoxing.getEnv
code: def getEnv : M Environment 
goal: Lean.IR.ExplicitBoxing.M Lean.Environment

full_name: Lean.IR.ExplicitBoxing.getLocalContext
code: def getLocalContext : M LocalContext 
goal: Lean.IR.ExplicitBoxing.M Lean.IR.LocalContext

full_name: Lean.IR.ExplicitBoxing.getResultType
code: def getResultType : M IRType 
goal: Lean.IR.ExplicitBoxing.M Lean.IR.IRType

full_name: Lean.IR.ExplicitBoxing.getVarType
code: def getVarType (x : VarId) : M IRType 
goal: Lean.IR.ExplicitBoxing.M Lean.IR.IRType

full_name: Lean.IR.ExplicitBoxing.getJPParams
code: def getJPParams (j : JoinPointId) : M (Array Param) 
goal: Lean.IR.ExplicitBoxing.M (Array Lean.IR.Param)

full_name: Lean.IR.ExplicitBoxing.getDecl
code: def getDecl (fid : FunId) : M Decl 
goal: Lean.IR.ExplicitBoxing.M Lean.IR.Decl

full_name: Lean.IR.ExplicitBoxing.withParams
code: @[inline] def withParams {α : Type} (xs : Array Param) (k : M α) : M α 
goal: Lean.IR.ExplicitBoxing.M α

full_name: Lean.IR.ExplicitBoxing.withVDecl
code: @[inline] def withVDecl {α : Type} (x : VarId) (ty : IRType) (v : Expr) (k : M α) : M α 
goal: Lean.IR.ExplicitBoxing.M α

full_name: Lean.IR.ExplicitBoxing.withJDecl
code: @[inline] def withJDecl {α : Type} (j : JoinPointId) (xs : Array Param) (v : FnBody) (k : M α) : M α 
goal: Lean.IR.ExplicitBoxing.M α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Compiler.IR.Boxing.0.Lean.IR.ExplicitBoxing.isExpensiveConstantValueBoxing
code: /-- If `x` declaration is of the form `x := Expr.lit _` or `x := Expr.fap c #[]`,
   and `x`'s type is not cheap to box (e.g., it is `UInt64), then return its value. -/
private def isExpensiveConstantValueBoxing (x : VarId) (xType : IRType) : M (Option Expr) 
goal: Lean.IR.ExplicitBoxing.M (Option Lean.IR.Expr)

full_name: Lean.IR.ExplicitBoxing.mkCast
code: /-- Auxiliary function used by castVarIfNeeded.
   It is used when the expected type does not match `xType`.
   If `xType` is scalar, then we need to "box" it. Otherwise, we need to "unbox" it. -/
def mkCast (x : VarId) (xType : IRType) (expectedType : IRType) : M Expr 
goal: Lean.IR.ExplicitBoxing.M Lean.IR.Expr

full_name: Lean.IR.ExplicitBoxing.castVarIfNeeded
code: @[inline] def castVarIfNeeded (x : VarId) (expected : IRType) (k : VarId → M FnBody) : M FnBody 
goal: Lean.IR.ExplicitBoxing.M Lean.IR.FnBody

full_name: Lean.IR.ExplicitBoxing.castArgIfNeeded
code: @[inline] def castArgIfNeeded (x : Arg) (expected : IRType) (k : Arg → M FnBody) : M FnBody 
goal: Lean.IR.ExplicitBoxing.M Lean.IR.FnBody

full_name: Lean.IR.ExplicitBoxing.castArgsIfNeededAux
code: def castArgsIfNeededAux (xs : Array Arg) (typeFromIdx : Nat → IRType) : M (Array Arg × Array FnBody) 
goal: Lean.IR.ExplicitBoxing.M (Array Lean.IR.Arg × Array Lean.IR.FnBody)

full_name: Lean.IR.ExplicitBoxing.castArgsIfNeeded
code: @[inline] def castArgsIfNeeded (xs : Array Arg) (ps : Array Param) (k : Array Arg → M FnBody) : M FnBody 
goal: Lean.IR.ExplicitBoxing.M Lean.IR.FnBody

full_name: Lean.IR.ExplicitBoxing.boxArgsIfNeeded
code: @[inline] def boxArgsIfNeeded (xs : Array Arg) (k : Array Arg → M FnBody) : M FnBody 
goal: Lean.IR.ExplicitBoxing.M Lean.IR.FnBody

full_name: Lean.IR.ExplicitBoxing.unboxResultIfNeeded
code: def unboxResultIfNeeded (x : VarId) (ty : IRType) (e : Expr) (b : FnBody) : M FnBody 
goal: Lean.IR.ExplicitBoxing.M Lean.IR.FnBody

full_name: Lean.IR.ExplicitBoxing.castResultIfNeeded
code: def castResultIfNeeded (x : VarId) (ty : IRType) (e : Expr) (eType : IRType) (b : FnBody) : M FnBody 
goal: Lean.IR.ExplicitBoxing.M Lean.IR.FnBody

full_name: Lean.IR.ExplicitBoxing.visitVDeclExpr
code: def visitVDeclExpr (x : VarId) (ty : IRType) (e : Expr) (b : FnBody) : M FnBody 
goal: Lean.IR.ExplicitBoxing.M Lean.IR.FnBody

full_name: Lean.IR.ExplicitBoxing.visitFnBody
code: partial def visitFnBody : FnBody → M FnBody
  
goal: Lean.IR.FnBody → Lean.IR.ExplicitBoxing.M Lean.IR.FnBody

full_name: Lean.IR.ExplicitBoxing.run
code: def run (env : Environment) (decls : Array Decl) : Array Decl 
goal: Array Lean.IR.Decl

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