Lean2Js.Fuel
Taking fuel out of the claims: more of it never changes an answer #
Fuel is what makes the reference semantics total; the language has none. Taking it out of the claims
starts here: an answer evalExpr gives at one fuel is the answer it gives at any larger one.
Every statement is in terms of Refines, which carves out the one thing more fuel can change. The
recursion is on the fuel rather than the expression, so the traversals get their own statements: inside
the induction they are proved from the step below, and once evalExpr_succ is out they follow from it
directly.
Lean2Js.Fuel.Refines
sourceTwo results that agree, unless the first is what running out of fuel looks like.
Equations
- Lean2Js.Fuel.Refines a b = (a ≠ Except.error Lean2Js.Err.outOfFuel → a = b)
Instances For
Used by
Lean2Js.Fuel.Refines.rfl'
sourceUsed by
Lean2Js.Fuel.Refines.trans
sourceUsed by
Lean2Js.Fuel.Refines.bind
source{α β : Type}
{a a' : Except Err α}
{k k' : α → Except Err β}
(ha : Refines a a')
(hk : ∀ (v : α), Refines (k v) (k' v))
:
Used by
Lean2Js.Fuel.evalExpr_succ
sourceUsed by
Lean2Js.Fuel.evalExpr_add
sourceUsed by
Lean2Js.Fuel.evalExpr_mono
sourceMore fuel does not change an answer the reference semantics already gave.
Used by
Lean2Js.Fuel.evalExpr_of_le
source{p : Core.Program}
{f g : Nat}
{env : Env}
{e : Core.Expr}
{r : Except Err Value}
(h : f ≤ g)
(hne : r ≠ Except.error Err.outOfFuel)
(heq : evalExpr p f env e = r)
:
Used by
Lean2Js.Fuel.evalArgs_succ
sourceUsed by
Lean2Js.Fuel.evalMapItems_succ
source(p : Core.Program)
(f : Nat)
(env : Env)
(b : String)
(body : Core.Expr)
(xs : List Value)
:
Refines (evalMapItems p f env b body xs) (evalMapItems p (f + 1) env b body xs)
Used by
Lean2Js.Fuel.evalFilterItems_succ
source(p : Core.Program)
(f : Nat)
(env : Env)
(b : String)
(body : Core.Expr)
(xs : List Value)
:
Refines (evalFilterItems p f env b body xs) (evalFilterItems p (f + 1) env b body xs)
Used by
Lean2Js.Fuel.evalFindItems_succ
source(p : Core.Program)
(f : Nat)
(env : Env)
(b : String)
(body : Core.Expr)
(xs : List Value)
:
Refines (evalFindItems p f env b body xs) (evalFindItems p (f + 1) env b body xs)
Used by
Lean2Js.Fuel.evalQuantItems_succ
source(p : Core.Program)
(f : Nat)
(env : Env)
(op : Core.QuantOp)
(b : String)
(body : Core.Expr)
(xs : List Value)
:
Refines (evalQuantItems p f env op b body xs) (evalQuantItems p (f + 1) env op b body xs)
Used by
Lean2Js.Fuel.evalReduceItems_succ
source(p : Core.Program)
(f : Nat)
(env : Env)
(a b : String)
(body : Core.Expr)
(xs : List Value)
(acc : Value)
:
Refines (evalReduceItems p f env a b body acc xs) (evalReduceItems p (f + 1) env a b body acc xs)