lean2js

Lean2Js.Cost

source

Imports 2

How much fuel a program can possibly need #

How much fuel a program can possibly need. Fuel counts the nesting of the expression being evaluated and the depth of the call stack, and nothing else: the traversals (evalArgs, evalMapItems and the four beside it) hand the rest of the list the same fuel they were given, so a longer array costs nothing.

That leaves the call stack, and the subset is built so that it cannot grow without end. A call from the declaration at index i lands on a declaration at an index below i -- directly, because callsPrecede refuses a call that does not go backwards, and through a function-typed parameter, because a function argument has to be a declared function named before the callee. So the depth is at most the number of declarations, and each level costs at most the deepest body in the program.

The conditions are collected in progOk, a Bool the emitter checks once per program rather than a hypothesis a caller has to discharge.

Depth #

The fuel one expression needs before any call is followed. evalExpr spends one on every node and hands f to each of the parts, so this is the height of the tree.

def

Lean2Js.Cost.exprDepth

source
Equations
Instances For
    Used by
      def

      Lean2Js.Cost.exprDepthList

      source
      Equations
      Instances For
        Used by
          def

          Lean2Js.Cost.exprDepthAlts

          source
          Equations
          Instances For
            Used by
              def

              Lean2Js.Cost.exprDepthEntries

              source
              Equations
              Instances For
                Used by
                  def

                  Lean2Js.Cost.maxBodyDepth

                  source
                  Equations
                  Instances For
                    Used by
                      def

                      Lean2Js.Cost.callStep

                      source

                      What one level of the call stack costs: the deepest body, plus the node the call itself spends.

                      Equations
                      Instances For
                        Used by
                          def

                          Lean2Js.Cost.cost

                          source

                          The fuel no evaluation of this program can outrun: the deepest body, plus one level per declaration.

                          Equations
                          Instances For
                            Used by

                              Where a name is declared #

                              Program.find? answers with the declaration; the proof needs its position too, since that is what decreases at every call.

                              def

                              Lean2Js.Cost.declAtFrom

                              source
                              Equations
                              Instances For
                                Used by
                                  def

                                  Lean2Js.Cost.declAt?

                                  source
                                  Equations
                                  Instances For
                                    Used by
                                      def

                                      Lean2Js.Cost.fnBefore

                                      source
                                      (p : Core.Program) (j : Nat) (g : String) :
                                      Equations
                                      Instances For
                                        Used by

                                          The conditions #

                                          bodyOk is Compile.callsPrecede -- every call and function reference goes backwards -- together with the two restrictions that keep a function value from reaching a call site the check has not seen: a fnRef may only stand as an argument, and a function-typed parameter may only be called, never read.

                                          The parameter it stands in for has to be function-typed, which is what makes the callee's environment say which of its names can hold a function at all.

                                          def

                                          Lean2Js.Cost.notFnRef

                                          source

                                          Whether an argument is anything but a function reference. A function reference is the only shape a function-typed parameter may be given, and the only expression that answers with a function.

                                          Equations
                                          Instances For
                                            Used by
                                              def

                                              Lean2Js.Cost.argFnOk

                                              source
                                              (p : Core.Program) (j : Nat) (pm : Core.Param) :

                                              The condition on one argument of a call to the declaration at index j: a function reference has to stand at a function-typed parameter and name a declaration before j.

                                              Equations
                                              Instances For
                                                Used by
                                                  def

                                                  Lean2Js.Cost.fnRefArgsOk

                                                  source
                                                  Equations
                                                  Instances For
                                                    Used by
                                                      def

                                                      Lean2Js.Cost.bodyOk

                                                      source
                                                      (p : Core.Program) (i : Nat) (fns : List String) :

                                                      fns are the names that may hold a function value: the function-typed parameters of the declaration whose body this is. A shadowed one stays in the list, so a body that rebinds such a name and reads the rebinding is refused; erasing it on the way in would take a binders walk over patterns to buy a program nobody writes.

                                                      Equations
                                                      Instances For
                                                        Used by
                                                          def

                                                          Lean2Js.Cost.bodyOkList

                                                          source
                                                          (p : Core.Program) (i : Nat) (fns : List String) :
                                                          Equations
                                                          Instances For
                                                            Used by
                                                              def

                                                              Lean2Js.Cost.bodyOkArgs

                                                              source
                                                              (p : Core.Program) (i : Nat) (fns : List String) :
                                                              Equations
                                                              Instances For
                                                                Used by
                                                                  def

                                                                  Lean2Js.Cost.bodyOkAlts

                                                                  source
                                                                  (p : Core.Program) (i : Nat) (fns : List String) :
                                                                  Equations
                                                                  Instances For
                                                                    Used by
                                                                      def

                                                                      Lean2Js.Cost.bodyOkEntries

                                                                      source
                                                                      (p : Core.Program) (i : Nat) (fns : List String) :
                                                                      Equations
                                                                      Instances For
                                                                        Used by
                                                                          def

                                                                          Lean2Js.Cost.declFns

                                                                          source
                                                                          Equations
                                                                          Instances For
                                                                            Used by
                                                                              def

                                                                              Lean2Js.Cost.declsOk

                                                                              source
                                                                              Equations
                                                                              Instances For
                                                                                Used by
                                                                                  def

                                                                                  Lean2Js.Cost.tyFirstOrder

                                                                                  source

                                                                                  A type with no function in it. The entry check is what fixes the shape of the arguments a public function starts with, and it can only rule out a function value where the type cannot hide one.

                                                                                  Equations
                                                                                  Instances For
                                                                                    Used by
                                                                                      def

                                                                                      Lean2Js.Cost.tyFirstOrderList

                                                                                      source
                                                                                      Equations
                                                                                      Instances For
                                                                                        Used by
                                                                                          def

                                                                                          Lean2Js.Cost.typesFirstOrder

                                                                                          source

                                                                                          The declared field types the entry check walks into. A function value can only be turned away where the type it is checked against cannot hide one.

                                                                                          Equations
                                                                                          • One or more equations did not get rendered due to their size.
                                                                                          Instances For
                                                                                            Used by
                                                                                              def

                                                                                              Lean2Js.Cost.paramTyOk

                                                                                              source
                                                                                              (ty : Core.Ty) :

                                                                                              A function type is allowed on a parameter and nowhere inside one, which is Compile.wfParamTy.

                                                                                              Equations
                                                                                              Instances For
                                                                                                Used by
                                                                                                  def

                                                                                                  Lean2Js.Cost.declParamsOk

                                                                                                  source
                                                                                                  Equations
                                                                                                  Instances For
                                                                                                    Used by
                                                                                                      def

                                                                                                      Lean2Js.Cost.progOk

                                                                                                      source

                                                                                                      Everything the fuel bound rests on, as one Bool the emitter runs once per program.

                                                                                                      Equations
                                                                                                      Instances For
                                                                                                        Used by

                                                                                                          Function values #

                                                                                                          The invariant the proof carries: a function value is only ever bound to a function-typed parameter, and the declaration it names comes before the one whose body is running. Nothing else in a value is a function, which is what keeps a function from being smuggled into a call through an array.

                                                                                                          def

                                                                                                          Lean2Js.Cost.noFn

                                                                                                          source
                                                                                                          :
                                                                                                          Equations
                                                                                                          Instances For
                                                                                                            Used by
                                                                                                              def

                                                                                                              Lean2Js.Cost.noFnList

                                                                                                              source
                                                                                                              Equations
                                                                                                              Instances For
                                                                                                                Used by
                                                                                                                  def

                                                                                                                  Lean2Js.Cost.noFnFields

                                                                                                                  source
                                                                                                                  Equations
                                                                                                                  Instances For
                                                                                                                    Used by
                                                                                                                      def

                                                                                                                      Lean2Js.Cost.EnvOk

                                                                                                                      source
                                                                                                                      (p : Core.Program) (i : Nat) (fns : List String) (env : Env) :
                                                                                                                      Equations
                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                      Instances For
                                                                                                                        Used by

                                                                                                                          Reading a declaration's position back #

                                                                                                                          theorem

                                                                                                                          Lean2Js.Cost.declAtFrom_find

                                                                                                                          source
                                                                                                                          (name : String) (ds : List Core.Decl) (k j : Nat) (d : Core.Decl) :
                                                                                                                          declAtFrom k ds name = some (j, d) → List.find? (fun (x : Core.Decl) => x.name == name) ds = some d
                                                                                                                          Used by
                                                                                                                            theorem

                                                                                                                            Lean2Js.Cost.declAt?_find

                                                                                                                            source
                                                                                                                            {p : Core.Program} {g : String} {k : Nat} {d : Core.Decl} (h : declAt? p g = some (k, d)) :
                                                                                                                            p.find? g = some d
                                                                                                                            Used by
                                                                                                                              theorem

                                                                                                                              Lean2Js.Cost.declAtFrom_depth

                                                                                                                              source
                                                                                                                              (name : String) (ds : List Core.Decl) (k j : Nat) (d : Core.Decl) :
                                                                                                                              Used by
                                                                                                                                theorem

                                                                                                                                Lean2Js.Cost.declAt?_depth

                                                                                                                                source
                                                                                                                                {p : Core.Program} {g : String} {k : Nat} {d : Core.Decl} (h : declAt? p g = some (k, d)) :
                                                                                                                                Used by
                                                                                                                                  theorem

                                                                                                                                  Lean2Js.Cost.declAtFrom_lt

                                                                                                                                  source
                                                                                                                                  (name : String) (ds : List Core.Decl) (k j : Nat) (d : Core.Decl) :
                                                                                                                                  declAtFrom k ds name = some (j, d) → j < k + ds.length
                                                                                                                                  Used by
                                                                                                                                    theorem

                                                                                                                                    Lean2Js.Cost.declAt?_lt

                                                                                                                                    source
                                                                                                                                    {p : Core.Program} {g : String} {k : Nat} {d : Core.Decl} (h : declAt? p g = some (k, d)) :
                                                                                                                                    Used by
                                                                                                                                      theorem

                                                                                                                                      Lean2Js.Cost.declsOkFrom_bodyOk

                                                                                                                                      source
                                                                                                                                      (p : Core.Program) (name : String) (ds : List Core.Decl) (base k : Nat) (d : Core.Decl) :
                                                                                                                                      declsOk p base ds = true → declAtFrom base ds name = some (k, d) → bodyOk p k (declFns d) d.body = true
                                                                                                                                      Used by
                                                                                                                                        theorem

                                                                                                                                        Lean2Js.Cost.declAt?_bodyOk

                                                                                                                                        source
                                                                                                                                        {p : Core.Program} {g : String} {k : Nat} {d : Core.Decl} (hp : declsOk p 0 p.decls = true) (h : declAt? p g = some (k, d)) :
                                                                                                                                        Used by

                                                                                                                                          Values that hold no function #

                                                                                                                                          theorem

                                                                                                                                          Lean2Js.Cost.except_bind_ok

                                                                                                                                          source
                                                                                                                                          {α β : Type} {m : Except Err α} {k : α → Except Err β} {v : β} (h : m >>= k = Except.ok v) :
                                                                                                                                          ∃ (c : α), m = Except.ok c ∧ k c = Except.ok v
                                                                                                                                          Used by
                                                                                                                                            theorem

                                                                                                                                            Lean2Js.Cost.except_bind_ne

                                                                                                                                            source
                                                                                                                                            {α β : Type} {m : Except Err α} {k : α → Except Err β} {e : Err} (hm : m ≠ Except.error e) (hk : ∀ (c : α), k c ≠ Except.error e) :
                                                                                                                                            Used by
                                                                                                                                              theorem

                                                                                                                                              Lean2Js.Cost.noFnList_iff

                                                                                                                                              source
                                                                                                                                              (xs : List Value) :
                                                                                                                                              noFnList xs = true ↔ ∀ (v : Value), v ∈ xs → noFn v = true
                                                                                                                                              Used by
                                                                                                                                                theorem

                                                                                                                                                Lean2Js.Cost.noFnFields_iff

                                                                                                                                                source
                                                                                                                                                (es : List (String × Value)) :
                                                                                                                                                noFnFields es = true ↔ ∀ (e : String × Value), e ∈ es → noFn e.snd = true
                                                                                                                                                Used by
                                                                                                                                                  theorem

                                                                                                                                                  Lean2Js.Cost.noFn_arr

                                                                                                                                                  source
                                                                                                                                                  {xs : List Value} (h : ∀ (v : Value), v ∈ xs → noFn v = true) :
                                                                                                                                                  Used by
                                                                                                                                                    theorem

                                                                                                                                                    Lean2Js.Cost.noFn_lookupFieldV

                                                                                                                                                    source
                                                                                                                                                    {fields : List (String × Value)} {k : String} {v : Value} (h : ∀ (e : String × Value), e ∈ fields → noFn e.snd = true) (hl : lookupFieldV fields k = some v) :
                                                                                                                                                    Used by
                                                                                                                                                      theorem

                                                                                                                                                      Lean2Js.Cost.noFn_obj

                                                                                                                                                      source
                                                                                                                                                      {c : String} {fs : List (String × Value)} (h : ∀ (e : String × Value), e ∈ fs → noFn e.snd = true) :
                                                                                                                                                      Used by
                                                                                                                                                        theorem

                                                                                                                                                        Lean2Js.Cost.noFn_dict

                                                                                                                                                        source
                                                                                                                                                        {es : List (String × Value)} (h : ∀ (e : String × Value), e ∈ es → noFn e.snd = true) :
                                                                                                                                                        Used by
                                                                                                                                                          theorem

                                                                                                                                                          Lean2Js.Cost.arr_noFn

                                                                                                                                                          source
                                                                                                                                                          {xs : List Value} (h : noFn (Value.arr xs) = true) (v : Value) :
                                                                                                                                                          v ∈ xs → noFn v = true
                                                                                                                                                          Used by
                                                                                                                                                            theorem

                                                                                                                                                            Lean2Js.Cost.obj_noFn

                                                                                                                                                            source
                                                                                                                                                            {c : String} {fs : List (String × Value)} (h : noFn (Value.obj c fs) = true) (e : String × Value) :
                                                                                                                                                            e ∈ fs → noFn e.snd = true
                                                                                                                                                            Used by
                                                                                                                                                              theorem

                                                                                                                                                              Lean2Js.Cost.dict_noFn

                                                                                                                                                              source
                                                                                                                                                              {es : List (String × Value)} (h : noFn (Value.dict es) = true) (e : String × Value) :
                                                                                                                                                              e ∈ es → noFn e.snd = true
                                                                                                                                                              Used by
                                                                                                                                                                theorem

                                                                                                                                                                Lean2Js.Cost.noFn_litValue

                                                                                                                                                                source
                                                                                                                                                                Used by
                                                                                                                                                                  theorem

                                                                                                                                                                  Lean2Js.Cost.noFn_mkInt53

                                                                                                                                                                  source
                                                                                                                                                                  {i : Int} {v : Value} (h : mkInt53 i = Except.ok v) :
                                                                                                                                                                  Used by
                                                                                                                                                                    theorem

                                                                                                                                                                    Lean2Js.Cost.noFn_applyUn

                                                                                                                                                                    source
                                                                                                                                                                    {op : Core.UnOp} {x v : Value} (h : applyUn op x = Except.ok v) :
                                                                                                                                                                    Used by
                                                                                                                                                                      theorem

                                                                                                                                                                      Lean2Js.Cost.noFn_applyArith

                                                                                                                                                                      source
                                                                                                                                                                      {op : Core.BinOp} {a b v : Value} (h : applyArith op a b = Except.ok v) :
                                                                                                                                                                      Used by
                                                                                                                                                                        theorem

                                                                                                                                                                        Lean2Js.Cost.noFn_compareValues

                                                                                                                                                                        source
                                                                                                                                                                        {op : Core.BinOp} {a b v : Value} (h : compareValues op a b = Except.ok v) :
                                                                                                                                                                        Used by
                                                                                                                                                                          theorem

                                                                                                                                                                          Lean2Js.Cost.noFn_applyMinMax

                                                                                                                                                                          source
                                                                                                                                                                          {op : Core.BinOp} {a b v : Value} (hn : noFn a = true) (hm : noFn b = true) (h : applyMinMax op a b = Except.ok v) :
                                                                                                                                                                          Used by
                                                                                                                                                                            theorem

                                                                                                                                                                            Lean2Js.Cost.noFn_applyBin

                                                                                                                                                                            source
                                                                                                                                                                            {op : Core.BinOp} {a b v : Value} (hn : noFn a = true) (hm : noFn b = true) (h : applyBin op a b = Except.ok v) :
                                                                                                                                                                            Used by
                                                                                                                                                                              theorem

                                                                                                                                                                              Lean2Js.Cost.noFn_applyStrUn

                                                                                                                                                                              source
                                                                                                                                                                              {op : Core.StrUnOp} {x v : Value} (h : applyStrUn op x = Except.ok v) :
                                                                                                                                                                              Used by
                                                                                                                                                                                theorem

                                                                                                                                                                                Lean2Js.Cost.noFn_applyStrBin

                                                                                                                                                                                source
                                                                                                                                                                                {op : Core.StrBinOp} {a b v : Value} (h : applyStrBin op a b = Except.ok v) :
                                                                                                                                                                                Used by
                                                                                                                                                                                  theorem

                                                                                                                                                                                  Lean2Js.Cost.noFn_sliceStr

                                                                                                                                                                                  source
                                                                                                                                                                                  {s lo hi v : Value} (h : sliceStr s lo hi = Except.ok v) :
                                                                                                                                                                                  Used by
                                                                                                                                                                                    theorem

                                                                                                                                                                                    Lean2Js.Cost.noFn_sliceArr

                                                                                                                                                                                    source
                                                                                                                                                                                    {a lo hi v : Value} (hn : noFn a = true) (h : sliceArr a lo hi = Except.ok v) :
                                                                                                                                                                                    Used by
                                                                                                                                                                                      theorem

                                                                                                                                                                                      Lean2Js.Cost.noFn_asBool

                                                                                                                                                                                      source
                                                                                                                                                                                      {x v : Value} (h : asBool x = Except.ok v) :
                                                                                                                                                                                      Used by
                                                                                                                                                                                        theorem

                                                                                                                                                                                        Lean2Js.Cost.noFn_dictLookup

                                                                                                                                                                                        source
                                                                                                                                                                                        {entries : List (String × Value)} {k : String} (h : ∀ (e : String × Value), e ∈ entries → noFn e.snd = true) :
                                                                                                                                                                                        noFn (dictLookup entries k) = true
                                                                                                                                                                                        Used by
                                                                                                                                                                                          theorem

                                                                                                                                                                                          Lean2Js.Cost.noFn_dictWith

                                                                                                                                                                                          source
                                                                                                                                                                                          {entries : List (String × Value)} {k : String} {v : Value} (h : ∀ (e : String × Value), e ∈ entries → noFn e.snd = true) (hv : noFn v = true) (e : String × Value) :
                                                                                                                                                                                          e ∈ dictWith entries k v → noFn e.snd = true
                                                                                                                                                                                          Used by

                                                                                                                                                                                            Running without running out #

                                                                                                                                                                                            Safe r P is the pair of facts the induction carries: r is not what running out of fuel looks like, and if it answered, the answer holds no function. Both travel through do the same way, so every case is one Safe.bind' per part.

                                                                                                                                                                                            def

                                                                                                                                                                                            Lean2Js.Cost.Safe

                                                                                                                                                                                            source
                                                                                                                                                                                            {α : Type} (r : Except Err α) (P : α → Prop) :
                                                                                                                                                                                            Equations
                                                                                                                                                                                            Instances For
                                                                                                                                                                                              Used by
                                                                                                                                                                                                theorem

                                                                                                                                                                                                Lean2Js.Cost.Safe.ok'

                                                                                                                                                                                                source
                                                                                                                                                                                                {α : Type} {v : α} {P : α → Prop} (h : P v) :
                                                                                                                                                                                                Used by
                                                                                                                                                                                                  theorem

                                                                                                                                                                                                  Lean2Js.Cost.Safe.err

                                                                                                                                                                                                  source
                                                                                                                                                                                                  {α : Type} {e : Err} {P : α → Prop} (h : e ≠ Err.outOfFuel) :
                                                                                                                                                                                                  Used by
                                                                                                                                                                                                    theorem

                                                                                                                                                                                                    Lean2Js.Cost.Safe.bind'

                                                                                                                                                                                                    source
                                                                                                                                                                                                    {α β : Type} {m : Except Err α} {k : α → Except Err β} {P : α → Prop} {Q : β → Prop} (hm : Safe m P) (hk : ∀ (c : α), P c → Safe (k c) Q) :
                                                                                                                                                                                                    Safe (m >>= k) Q
                                                                                                                                                                                                    Used by
                                                                                                                                                                                                      theorem

                                                                                                                                                                                                      Lean2Js.Cost.Safe.weaken

                                                                                                                                                                                                      source
                                                                                                                                                                                                      {α : Type} {r : Except Err α} {P Q : α → Prop} (h : Safe r P) (hpq : ∀ (v : α), P v → Q v) :
                                                                                                                                                                                                      Safe r Q
                                                                                                                                                                                                      Used by
                                                                                                                                                                                                        theorem

                                                                                                                                                                                                        Lean2Js.Cost.safe_mkInt53

                                                                                                                                                                                                        source
                                                                                                                                                                                                        (x : Int) :
                                                                                                                                                                                                        Safe (mkInt53 x) fun (v : Value) => noFn v = true
                                                                                                                                                                                                        Used by
                                                                                                                                                                                                          theorem

                                                                                                                                                                                                          Lean2Js.Cost.safe_applyUn

                                                                                                                                                                                                          source
                                                                                                                                                                                                          (op : Core.UnOp) (x : Value) :
                                                                                                                                                                                                          Safe (applyUn op x) fun (v : Value) => noFn v = true
                                                                                                                                                                                                          Used by
                                                                                                                                                                                                            theorem

                                                                                                                                                                                                            Lean2Js.Cost.safe_applyArith

                                                                                                                                                                                                            source
                                                                                                                                                                                                            (op : Core.BinOp) (a b : Value) :
                                                                                                                                                                                                            Safe (applyArith op a b) fun (v : Value) => noFn v = true
                                                                                                                                                                                                            Used by
                                                                                                                                                                                                              theorem

                                                                                                                                                                                                              Lean2Js.Cost.safe_compareValues

                                                                                                                                                                                                              source
                                                                                                                                                                                                              (op : Core.BinOp) (a b : Value) :
                                                                                                                                                                                                              Safe (compareValues op a b) fun (v : Value) => noFn v = true
                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                theorem

                                                                                                                                                                                                                Lean2Js.Cost.safe_applyMinMax

                                                                                                                                                                                                                source
                                                                                                                                                                                                                (op : Core.BinOp) (a b : Value) (hn : noFn a = true) (hm : noFn b = true) :
                                                                                                                                                                                                                Safe (applyMinMax op a b) fun (v : Value) => noFn v = true
                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                  theorem

                                                                                                                                                                                                                  Lean2Js.Cost.safe_applyBin

                                                                                                                                                                                                                  source
                                                                                                                                                                                                                  (op : Core.BinOp) (a b : Value) (hn : noFn a = true) (hm : noFn b = true) :
                                                                                                                                                                                                                  Safe (applyBin op a b) fun (v : Value) => noFn v = true
                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                    theorem

                                                                                                                                                                                                                    Lean2Js.Cost.safe_applyStrUn

                                                                                                                                                                                                                    source
                                                                                                                                                                                                                    (op : Core.StrUnOp) (x : Value) :
                                                                                                                                                                                                                    Safe (applyStrUn op x) fun (v : Value) => noFn v = true
                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                      theorem

                                                                                                                                                                                                                      Lean2Js.Cost.safe_applyStrBin

                                                                                                                                                                                                                      source
                                                                                                                                                                                                                      (op : Core.StrBinOp) (a b : Value) :
                                                                                                                                                                                                                      Safe (applyStrBin op a b) fun (v : Value) => noFn v = true
                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                        theorem

                                                                                                                                                                                                                        Lean2Js.Cost.safe_sliceStr

                                                                                                                                                                                                                        source
                                                                                                                                                                                                                        (s lo hi : Value) :
                                                                                                                                                                                                                        Safe (sliceStr s lo hi) fun (v : Value) => noFn v = true
                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                          theorem

                                                                                                                                                                                                                          Lean2Js.Cost.safe_sliceArr

                                                                                                                                                                                                                          source
                                                                                                                                                                                                                          (a lo hi : Value) (hn : noFn a = true) :
                                                                                                                                                                                                                          Safe (sliceArr a lo hi) fun (v : Value) => noFn v = true
                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                            Lean2Js.Cost.safe_asBool

                                                                                                                                                                                                                            source
                                                                                                                                                                                                                            (x : Value) :
                                                                                                                                                                                                                            Safe (asBool x) fun (v : Value) => noFn v = true
                                                                                                                                                                                                                            Used by

                                                                                                                                                                                                                              Environments #

                                                                                                                                                                                                                              theorem

                                                                                                                                                                                                                              Lean2Js.Cost.lookup_cons

                                                                                                                                                                                                                              source
                                                                                                                                                                                                                              (x : String) (w : Value) (env : Env) (y : String) :
                                                                                                                                                                                                                              Env.lookup? ((x, w) :: env) y = if (x == y) = true then some w else env.lookup? y
                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                theorem

                                                                                                                                                                                                                                Lean2Js.Cost.lookup_append_cases

                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                (b env : Env) (y : String) (u : Value) :
                                                                                                                                                                                                                                (b ++ env).lookup? y = some u → b.lookup? y = some u ∨ env.lookup? y = some u
                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                  theorem

                                                                                                                                                                                                                                  Lean2Js.Cost.lookup_noFn

                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                  {env : Env} (h : ∀ (e : String × Value), e ∈ env → noFn e.snd = true) {x : String} {w : Value} (hx : env.lookup? x = some w) :
                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                    theorem

                                                                                                                                                                                                                                    Lean2Js.Cost.envOk_cons

                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                    {p : Core.Program} {i : Nat} {fns : List String} {x : String} {w : Value} {env : Env} (hw : noFn w = true) (he : EnvOk p i fns env) :
                                                                                                                                                                                                                                    EnvOk p i fns ((x, w) :: env)
                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                      theorem

                                                                                                                                                                                                                                      Lean2Js.Cost.envOk_append

                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                      {p : Core.Program} {i : Nat} {fns : List String} {b env : Env} (hb : ∀ (e : String × Value), e ∈ b → noFn e.snd = true) (he : EnvOk p i fns env) :
                                                                                                                                                                                                                                      EnvOk p i fns (b ++ env)
                                                                                                                                                                                                                                      Used by

                                                                                                                                                                                                                                        What a pattern binds #

                                                                                                                                                                                                                                        theorem

                                                                                                                                                                                                                                        Lean2Js.Cost.matchPat_noFn

                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                        {pat : Core.Pat} {v : Value} {binds : Env} :
                                                                                                                                                                                                                                        noFn v = true → matchPat pat v = some binds → ∀ (e : String × Value), e ∈ binds → noFn e.snd = true
                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                          theorem

                                                                                                                                                                                                                                          Lean2Js.Cost.matchPats_noFn

                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                          {pats : List Core.Pat} {vs : List Value} {binds : Env} :
                                                                                                                                                                                                                                          (∀ (v : Value), v ∈ vs → noFn v = true) → matchPats pats vs = some binds → ∀ (e : String × Value), e ∈ binds → noFn e.snd = true
                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                                            Lean2Js.Cost.firstMatch_noFn

                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                            {alts : List Core.Alt} {sv : Value} {binds : Env} {body : Core.Expr} (hv : noFn sv = true) (h : firstMatch alts sv = some (binds, body)) (e : String × Value) :
                                                                                                                                                                                                                                            e ∈ binds → noFn e.snd = true
                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                              theorem

                                                                                                                                                                                                                                              Lean2Js.Cost.firstMatch_body

                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                              {alts : List Core.Alt} {sv : Value} {binds : Env} {body : Core.Expr} (h : firstMatch alts sv = some (binds, body)) :
                                                                                                                                                                                                                                              ∃ (alt : Core.Alt), alt ∈ alts ∧ body = alt.snd
                                                                                                                                                                                                                                              Used by

                                                                                                                                                                                                                                                Reading the checks back #

                                                                                                                                                                                                                                                theorem

                                                                                                                                                                                                                                                Lean2Js.Cost.exprDepth_pos

                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                  theorem

                                                                                                                                                                                                                                                  Lean2Js.Cost.exprDepthList_mem

                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                  {es : List Core.Expr} {e : Core.Expr} :
                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                    theorem

                                                                                                                                                                                                                                                    Lean2Js.Cost.exprDepthAlts_mem

                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                    {as : List Core.Alt} {a : Core.Alt} :
                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                      theorem

                                                                                                                                                                                                                                                      Lean2Js.Cost.exprDepthEntries_mem

                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                        theorem

                                                                                                                                                                                                                                                        Lean2Js.Cost.bodyOkAlts_mem

                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                        {p : Core.Program} {i : Nat} {fns : List String} {as : List Core.Alt} {a : Core.Alt} :
                                                                                                                                                                                                                                                        bodyOkAlts p i fns as = true → a ∈ as → bodyOk p i fns a.snd = true
                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                          theorem

                                                                                                                                                                                                                                                          Lean2Js.Cost.declAtFrom_none

                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                          (name : String) (ds : List Core.Decl) (k : Nat) :
                                                                                                                                                                                                                                                          declAtFrom k ds name = none → List.find? (fun (x : Core.Decl) => x.name == name) ds = none
                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                                                            Lean2Js.Cost.declAt?_none

                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                            {p : Core.Program} {g : String} (h : declAt? p g = none) :
                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                              theorem

                                                                                                                                                                                                                                                              Lean2Js.Cost.fnBefore_inv

                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                              {p : Core.Program} {j : Nat} {g : String} (h : fnBefore p j g = true) :
                                                                                                                                                                                                                                                              Used by

                                                                                                                                                                                                                                                                The value a call binds to a parameter #

                                                                                                                                                                                                                                                                def

                                                                                                                                                                                                                                                                Lean2Js.Cost.ArgVal

                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                (p : Core.Program) (j : Nat) (isFnP : Bool) (v : Value) :
                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                    def

                                                                                                                                                                                                                                                                    Lean2Js.Cost.ArgsVals

                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                        theorem

                                                                                                                                                                                                                                                                        Lean2Js.Cost.bindParams_nil_left

                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                        (vs : List Value) :
                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                          theorem

                                                                                                                                                                                                                                                                          Lean2Js.Cost.bindParams_nil_right

                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                                                                            Lean2Js.Cost.fnRefArgsOk_nil_cons

                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                            (p : Core.Program) (j : Nat) (a : Core.Expr) (rest : List Core.Expr) :
                                                                                                                                                                                                                                                                            fnRefArgsOk p j [] (a :: rest) = false
                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                              theorem

                                                                                                                                                                                                                                                                              Lean2Js.Cost.fnRefArgsOk_cons

                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                              (p : Core.Program) (j : Nat) (pm : Core.Param) (ps : List Core.Param) (a : Core.Expr) (rest : List Core.Expr) :
                                                                                                                                                                                                                                                                              fnRefArgsOk p j (pm :: ps) (a :: rest) = (argFnOk p j pm a && fnRefArgsOk p j ps rest)
                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                theorem

                                                                                                                                                                                                                                                                                Lean2Js.Cost.bodyOkArgs_cons

                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                (p : Core.Program) (i : Nat) (fns : List String) (a : Core.Expr) (rest : List Core.Expr) :
                                                                                                                                                                                                                                                                                bodyOkArgs p i fns (a :: rest) = ((!notFnRef a || bodyOk p i fns a) && bodyOkArgs p i fns rest)
                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                  theorem

                                                                                                                                                                                                                                                                                  Lean2Js.Cost.argsVals_nil_right

                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                  (p : Core.Program) (j : Nat) (ps : List Core.Param) :
                                                                                                                                                                                                                                                                                  ArgsVals p j ps []
                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                    theorem

                                                                                                                                                                                                                                                                                    Lean2Js.Cost.envOk_bindParams

                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                    (p : Core.Program) (j : Nat) (fns : List String) (ps : List Core.Param) (vs : List Value) :
                                                                                                                                                                                                                                                                                    ArgsVals p j ps vs → (∀ (pm : Core.Param), pm ∈ ps → pm.ty.isFn = true → fns.contains pm.name = true) → EnvOk p j fns (bindParams ps vs)
                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                      theorem

                                                                                                                                                                                                                                                                                      Lean2Js.Cost.declFns_mem

                                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                                      {d : Core.Decl} (pm : Core.Param) :
                                                                                                                                                                                                                                                                                      pm ∈ d.params → pm.ty.isFn = true → (declFns d).contains pm.name = true
                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                        theorem

                                                                                                                                                                                                                                                                                        Lean2Js.Cost.bindParams_mem

                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                        (ps : List Core.Param) (vs : List Value) (e : String × Value) :
                                                                                                                                                                                                                                                                                        e ∈ bindParams ps vs → e.snd ∈ vs
                                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                                          theorem

                                                                                                                                                                                                                                                                                          Lean2Js.Cost.envOk_of_noFn

                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                          {p : Core.Program} {i : Nat} {fns : List String} {env : Env} (h : ∀ (e : String × Value), e ∈ env → noFn e.snd = true) :
                                                                                                                                                                                                                                                                                          EnvOk p i fns env
                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                                                                                            Lean2Js.Cost.calleeOf_cases

                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                            (env : Env) (fn : String) :
                                                                                                                                                                                                                                                                                            (∃ (g : String), env.lookup? fn = some (Value.fn g) ∧ calleeOf env fn = g) ∨ calleeOf env fn = fn
                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                              theorem

                                                                                                                                                                                                                                                                                              Lean2Js.Cost.safe_typeError

                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                              {α : Type} {P : α → Prop} (msg : String) :
                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                theorem

                                                                                                                                                                                                                                                                                                Lean2Js.Cost.safe_unknownVar

                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                {α : Type} {P : α → Prop} (name : String) :
                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                  theorem

                                                                                                                                                                                                                                                                                                  Lean2Js.Cost.safe_unknownFn

                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                  {α : Type} {P : α → Prop} (name : String) :
                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                    theorem

                                                                                                                                                                                                                                                                                                    Lean2Js.Cost.safe_arity

                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                    {α : Type} {P : α → Prop} (name : String) :
                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                      theorem

                                                                                                                                                                                                                                                                                                      Lean2Js.Cost.safe_indexOutOfBounds

                                                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                        theorem

                                                                                                                                                                                                                                                                                                        Lean2Js.Cost.safe_noMatch

                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                                                          theorem

                                                                                                                                                                                                                                                                                                          Lean2Js.Cost.noFn_wrap

                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                          {c k : String} {v : Value} (h : noFn v = true) :
                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                                                                                                            Lean2Js.Cost.zip_snd_mem

                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                            {α β : Type} (as : List α) (bs : List β) (e : α × β) :
                                                                                                                                                                                                                                                                                                            e ∈ as.zip bs → e.snd ∈ bs
                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                              theorem

                                                                                                                                                                                                                                                                                                              Lean2Js.Cost.getElem?_mem

                                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                                              {α : Type} (l : List α) (k : Nat) (a : α) :
                                                                                                                                                                                                                                                                                                              l[k]? = some a → a ∈ l
                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                theorem

                                                                                                                                                                                                                                                                                                                Lean2Js.Cost.bodyOkEntries_map

                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                {p : Core.Program} {i : Nat} {fns : List String} {es : List (String × Core.Expr)} :
                                                                                                                                                                                                                                                                                                                bodyOkEntries p i fns es = true → bodyOkList p i fns (List.map (fun (x : String × Core.Expr) => x.snd) es) = true
                                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                                  theorem

                                                                                                                                                                                                                                                                                                                  Lean2Js.Cost.exprDepthEntries_map

                                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                    theorem

                                                                                                                                                                                                                                                                                                                    Lean2Js.Cost.bodyOkArg_not_fnRef

                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                    {p : Core.Program} {i : Nat} {fns : List String} {a : Core.Expr} (h : (!notFnRef a || bodyOk p i fns a) = true) (hnf : notFnRef a = true) :
                                                                                                                                                                                                                                                                                                                    bodyOk p i fns a = true
                                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                                      theorem

                                                                                                                                                                                                                                                                                                                      Lean2Js.Cost.safe_arg

                                                                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                                                                      {p : Core.Program} {j n : Nat} {env : Env} {pm : Core.Param} {a : Core.Expr} (hok : argFnOk p j pm a = true) (hsafe : notFnRef a = true → Safe (evalExpr p n env a) fun (v : Value) => noFn v = true) (hn : 0 < n) :
                                                                                                                                                                                                                                                                                                                      Safe (evalExpr p n env a) fun (v : Value) => ArgVal p j pm.ty.isFn v
                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                        theorem

                                                                                                                                                                                                                                                                                                                        Lean2Js.Cost.eval_safe

                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                        (p : Core.Program) (hp : declsOk p 0 p.decls = true) (f i : Nat) (fns : List String) (env : Env) (e : Core.Expr) :
                                                                                                                                                                                                                                                                                                                        bodyOk p i fns e = true → EnvOk p i fns env → exprDepth e + i * callStep p ≤ f → Safe (evalExpr p f env e) fun (v : Value) => noFn v = true

                                                                                                                                                                                                                                                                                                                        Enough fuel and the reference semantics never runs out of it, and the answer it gives holds no function value. The induction is on the fuel, so a call is reached at a strictly smaller one; what makes that terminate is the index of the declaration being entered, which bodyOk keeps going down.

                                                                                                                                                                                                                                                                                                                        Used by

                                                                                                                                                                                                                                                                                                                          The arguments a public function starts with #

                                                                                                                                                                                                                                                                                                                          evalCall lets a value into the body only if it has the declared type. That is what rules a function value out at the entry -- but only where the type cannot hide one, which is why progOk asks the declared field types to be first order too.

                                                                                                                                                                                                                                                                                                                          theorem

                                                                                                                                                                                                                                                                                                                          Lean2Js.Cost.tyFirstOrder_subst

                                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                                          (sigma : List (String × Core.Ty)) (hs : ∀ (e : String × Core.Ty), e ∈ sigma → tyFirstOrder e.snd = true) (t : Core.Ty) :
                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                                                                                                                            Lean2Js.Cost.tyFirstOrderList_subst

                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                            (sigma : List (String × Core.Ty)) (hs : ∀ (e : String × Core.Ty), e ∈ sigma → tyFirstOrder e.snd = true) (ts : List Core.Ty) :
                                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                                              theorem

                                                                                                                                                                                                                                                                                                                              Lean2Js.Cost.tyFirstOrderList_mem

                                                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                                                              {ts : List Core.Ty} {t : Core.Ty} :
                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                theorem

                                                                                                                                                                                                                                                                                                                                Lean2Js.Cost.ctorAt_field_firstOrder

                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                {n : String} {p : Core.Program} {t : Core.TypeDef} {args : List Core.Ty} {ctor : String} {c : Core.CtorDef} {f : Core.Field} (ht : typesFirstOrder p = true) (hty : p.findType? n = some t) (hargs : tyFirstOrderList args = true) (hc : t.findAt? args ctor = some c) (hf : f ∈ c.fields) :
                                                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                                                  theorem

                                                                                                                                                                                                                                                                                                                                  Lean2Js.Cost.hasTy_noFn

                                                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                                                  {p : Core.Program} (ht : typesFirstOrder p = true) (v : Value) (ty : Core.Ty) :
                                                                                                                                                                                                                                                                                                                                  tyFirstOrder ty = true → Value.hasTy p v ty = true → noFn v = true
                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                    theorem

                                                                                                                                                                                                                                                                                                                                    Lean2Js.Cost.hasFieldTys_noFn

                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                    {p : Core.Program} (ht : typesFirstOrder p = true) (fields : List (String × Value)) (tys : List (String × Core.Ty)) :
                                                                                                                                                                                                                                                                                                                                    (∀ (e : String × Core.Ty), e ∈ tys → tyFirstOrder e.snd = true) → Value.hasFieldTys p fields tys = true → ∀ (e : String × Value), e ∈ fields → noFn e.snd = true
                                                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                                                      theorem

                                                                                                                                                                                                                                                                                                                                      Lean2Js.Cost.hasElemTy_noFn

                                                                                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                                                                                      {p : Core.Program} (ht : typesFirstOrder p = true) (xs : List Value) (elem : Core.Ty) :
                                                                                                                                                                                                                                                                                                                                      tyFirstOrder elem = true → Value.hasElemTy p xs elem = true → ∀ (w : Value), w ∈ xs → noFn w = true
                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                        theorem

                                                                                                                                                                                                                                                                                                                                        Lean2Js.Cost.hasEntryTys_noFn

                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                        {p : Core.Program} (ht : typesFirstOrder p = true) (es : List (String × Value)) (elem : Core.Ty) :
                                                                                                                                                                                                                                                                                                                                        tyFirstOrder elem = true → Value.hasEntryTys p es elem = true → ∀ (e : String × Value), e ∈ es → noFn e.snd = true
                                                                                                                                                                                                                                                                                                                                        Used by

                                                                                                                                                                                                                                                                                                                                          What the shipped fuel buys #

                                                                                                                                                                                                                                                                                                                                          theorem

                                                                                                                                                                                                                                                                                                                                          Lean2Js.Cost.declAtFrom_of_find

                                                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                                                          (name : String) (ds : List Core.Decl) (k : Nat) (d : Core.Decl) :
                                                                                                                                                                                                                                                                                                                                          List.find? (fun (x : Core.Decl) => x.name == name) ds = some d → ∃ (j : Nat), declAtFrom k ds name = some (j, d)
                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                                                                                                                                            Lean2Js.Cost.declAt?_of_find

                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                            {p : Core.Program} {name : String} {d : Core.Decl} (h : p.find? name = some d) :
                                                                                                                                                                                                                                                                                                                                            ∃ (j : Nat), declAt? p name = some (j, d)
                                                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                                                              theorem

                                                                                                                                                                                                                                                                                                                                              Lean2Js.Cost.paramTyOk_firstOrder

                                                                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                                                                              {ty : Core.Ty} (h : paramTyOk ty = true) (hn : ty.isFn = false) :
                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                theorem

                                                                                                                                                                                                                                                                                                                                                Lean2Js.Cost.bindParams_noFn

                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                {p : Core.Program} (ht : typesFirstOrder p = true) (ps : List Core.Param) (vs : List Value) :
                                                                                                                                                                                                                                                                                                                                                (∀ (pm : Core.Param), pm ∈ ps → tyFirstOrder pm.ty = true) → ((ps.zip vs).all fun (x : Core.Param × Value) => match x with | (param, v) => Value.hasTy p v param.ty) = true → ∀ (e : String × Value), e ∈ bindParams ps vs → noFn e.snd = true
                                                                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                                                                  theorem

                                                                                                                                                                                                                                                                                                                                                  Lean2Js.Cost.evalCall_ne_outOfFuel

                                                                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                                                                  {p : Core.Program} {fn : String} {d : Core.Decl} {args : List Value} (hp : progOk p = true) (hfuel : cost p ≤ defaultFuel) (hd : p.find? fn = some d) (hpub : d.paramsCheckable = true) :

                                                                                                                                                                                                                                                                                                                                                  The fuel the artifact runs at is enough for every call the program can make: a program that passes progOk and whose cost fits in defaultFuel never answers outOfFuel to a call whose arguments the entry check can read.

                                                                                                                                                                                                                                                                                                                                                  Used by