Value used in the abstract interpreter
- bot: Lean.IR.UnreachableBranches.Value
- top: Lean.IR.UnreachableBranches.Value
- ctor: Lean.IR.CtorInfo → Array Lean.IR.UnreachableBranches.Value → Lean.IR.UnreachableBranches.Value
- choice: List Lean.IR.UnreachableBranches.Value → Lean.IR.UnreachableBranches.Value
Instances For
Equations
- Lean.IR.UnreachableBranches.instToStringValue = { toString := fun (v : Lean.IR.UnreachableBranches.Value) => toString (Std.format v) }
Equations
- Lean.IR.UnreachableBranches.Value.instToString = { toString := (fun (f : Lean.Format) => f.pretty) ∘ Lean.IR.UnreachableBranches.Value.format }
In truncate
, we approximate a value as top
if depth > truncateMaxDepth
.
TODO: add option to control this parameter.
Instances For
def
Lean.IR.UnreachableBranches.Value.truncate
(env : Lean.Environment)
(v : Lean.IR.UnreachableBranches.Value)
(s : Lean.NameSet)
:
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.
Equations
Instances For
partial def
Lean.IR.UnreachableBranches.Value.truncate.go
(env : Lean.Environment)
(v : Lean.IR.UnreachableBranches.Value)
(s : Lean.NameSet)
(depth : Nat)
:
def
Lean.IR.UnreachableBranches.Value.widening
(env : Lean.Environment)
(v₁ : Lean.IR.UnreachableBranches.Value)
(v₂ : Lean.IR.UnreachableBranches.Value)
:
Widening operator that guarantees termination in our abstract interpreter.
Equations
- Lean.IR.UnreachableBranches.Value.widening env v₁ v₂ = Lean.IR.UnreachableBranches.Value.truncate env (v₁.merge v₂) ∅
Instances For
@[reducible, inline]
Equations
Instances For
def
Lean.IR.UnreachableBranches.addFunctionSummary
(env : Lean.Environment)
(fid : Lean.IR.FunId)
(v : Lean.IR.UnreachableBranches.Value)
:
Equations
- Lean.IR.UnreachableBranches.addFunctionSummary env fid v = Lean.PersistentEnvExtension.addEntry Lean.IR.UnreachableBranches.functionSummariesExt (env.addExtraName fid) (fid, v)
Instances For
def
Lean.IR.UnreachableBranches.getFunctionSummary?
(env : Lean.Environment)
(fid : Lean.IR.FunId)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[reducible, inline]
Equations
Instances For
- currFnIdx : Nat
- decls : Array Lean.IR.Decl
- env : Lean.Environment
- lctx : Lean.IR.LocalContext
Instances For
- assignments : Array Lean.IR.UnreachableBranches.Assignment
- funVals : Lean.PArray Lean.IR.UnreachableBranches.Value
Instances For
@[reducible, inline]
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.IR.UnreachableBranches.findArgValue arg = match arg with | Lean.IR.Arg.var x => Lean.IR.UnreachableBranches.findVarValue x | x => pure Lean.IR.UnreachableBranches.Value.top
Instances For
def
Lean.IR.UnreachableBranches.updateVarAssignment
(x : Lean.IR.VarId)
(v : Lean.IR.UnreachableBranches.Value)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lean.IR.UnreachableBranches.updateJPParamsAssignment
(ys : Array Lean.IR.Param)
(xs : Array Lean.IR.Arg)
:
Return true if the assignment of at least one parameter has been updated.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
partial def
Lean.IR.UnreachableBranches.elimDeadAux
(assignment : Lean.IR.UnreachableBranches.Assignment)
:
def
Lean.IR.UnreachableBranches.elimDead
(assignment : Lean.IR.UnreachableBranches.Assignment)
(d : Lean.IR.Decl)
:
Equations
- Lean.IR.UnreachableBranches.elimDead assignment d = match d with | Lean.IR.Decl.fdecl f xs type b info => d.updateBody! (Lean.IR.UnreachableBranches.elimDeadAux assignment b) | other => other
Instances For
Equations
- One or more equations did not get rendered due to their size.