lean2js

Lean2Js.Compile

source

Core to JS, type checking and code generation in one pass #

The translation from Core to JS. This function is what the correctness proofs are about.

Type checking and code generation are a single pass because emitting even one + needs the type of its operands. Keeping them apart would put the same typing rules on the compiler's trusted base twice.

abbrev

Lean2Js.Compile.Ctx

source
@[reducible, inline]
Equations
Instances For
    Used by
      def

      Lean2Js.Compile.scrutName

      source

      The scrutinee that match binds. It starts with __, so it never collides with a user's name.

      Equations
      Instances For
        Used by
          def

          Lean2Js.Compile.wfTy

          source
          @[irreducible]

          Whether a type is one this program can talk about: every name is declared, applied to as many arguments as it takes, and every type variable is bound by the declaration the type is written in.

          Equations
          Instances For
            Used by
              def

              Lean2Js.Compile.wfTyArgs

              source
              @[irreducible]
              Equations
              Instances For
                Used by
                  def

                  Lean2Js.Compile.wfParamTy

                  source

                  A parameter is the one place a function type may sit. Its own parameters and result go through wfTy, which rejects a function type, so the types stay first order and the entry check never has to look inside one.

                  Equations
                  Instances For
                    Used by
                      def

                      Lean2Js.Compile.numericHelper

                      source
                      (ty : Core.Ty) (op : Core.BinOp) (a b : Js.Expr) :
                      Equations
                      Instances For
                        Used by
                          def

                          Lean2Js.Compile.strUnHelper

                          source
                          Equations
                          Instances For
                            Used by
                              def

                              Lean2Js.Compile.strUnResult

                              source
                              Equations
                              Instances For
                                Used by
                                  def

                                  Lean2Js.Compile.strBinHelper

                                  source
                                  Equations
                                  Instances For
                                    Used by
                                      def

                                      Lean2Js.Compile.strBinResult

                                      source
                                      Equations
                                      Instances For
                                        Used by
                                          def

                                          Lean2Js.Compile.strBinArgTys

                                          source

                                          What each operation takes, rather than two Strings for all of them: an operation whose operands are not both Strings is then an arm here, not a new form of Core.Expr.

                                          Equations
                                          Instances For
                                            Used by
                                              def

                                              Lean2Js.Compile.orderSymbol

                                              source
                                              Equations
                                              Instances For
                                                Used by
                                                  def

                                                  Lean2Js.Compile.isOrdered

                                                  source
                                                  Equations
                                                  Instances For
                                                    Used by
                                                      def

                                                      Lean2Js.Compile.isScalar

                                                      source

                                                      Scalars can be compared with ===, but constructor values and arrays would end up compared by reference.

                                                      Equations
                                                      Instances For
                                                        Used by
                                                          def

                                                          Lean2Js.Compile.dictValueTy

                                                          source

                                                          The value type of a dictionary receiver, at whichever of the two spellings it was declared. A dictionary operation reads this rather than matching on .dict, because the two spellings differ only in the shape the boundary writes: inside the module both run on the same Map, so both take the same generated call.

                                                          Equations
                                                          Instances For
                                                            Used by
                                                              inductive

                                                              Lean2Js.Compile.Head

                                                              source

                                                              What a value's shape can be tested against at one position: a constructor's tag, or a literal it may equal.

                                                              Instances For
                                                                Used by
                                                                  instance

                                                                  Lean2Js.Compile.instBEqHead

                                                                  source
                                                                  @[instance_reducible]
                                                                  Equations
                                                                  Used by
                                                                    def

                                                                    Lean2Js.Compile.instBEqHead.beq

                                                                    source
                                                                    :
                                                                    Head → Head → Bool
                                                                    Equations
                                                                    Instances For
                                                                      Used by
                                                                        def

                                                                        Lean2Js.Compile.signature

                                                                        source

                                                                        Every head a value of this type can take, each with the fields it carries. none where the values cannot be enumerated, so nothing short of a wildcard covers them.

                                                                        Takes the type declarations rather than the program: a declaration is compiled against the prefix before it, and reading only the types is what lets the proof see that the prefix decides a match the same way the whole program does.

                                                                        Equations
                                                                        Instances For
                                                                          Used by
                                                                            def

                                                                            Lean2Js.Compile.foldFieldTys

                                                                            source
                                                                            (typeName : String) (tyArgs : List Core.Ty) (result : Core.Ty) :

                                                                            A constructor's fields as a fold's alternative sees them: a field that came round is bound to the answer for it and not to the field, so it is typed at the fold's result.

                                                                            Equations
                                                                            Instances For
                                                                              Used by
                                                                                theorem

                                                                                Lean2Js.Compile.foldFieldTys_map_fst

                                                                                source
                                                                                (typeName : String) (tyArgs : List Core.Ty) (result : Core.Ty) (fs : List Core.Field) :
                                                                                List.map (fun (x : String × Core.Ty) => x.fst) (foldFieldTys typeName tyArgs result fs) = List.map (fun (x : Core.Field) => x.name) fs

                                                                                Retyping a constructor's fields for a fold's alternative leaves their names alone, so the paths the alternative reads are the declared field names — the same ones patParts reads.

                                                                                Used by
                                                                                  def

                                                                                  Lean2Js.Compile.jsFoldKind

                                                                                  source
                                                                                  Equations
                                                                                  Instances For
                                                                                    Used by
                                                                                      def

                                                                                      Lean2Js.Compile.foldSpecOf

                                                                                      source
                                                                                      (types : List Core.TypeDef) (typeName : String) (tyArgs : List Core.Ty) :

                                                                                      What __fold is told about the declared type: its constructors by name, each with which of its fields come round. Read off the same foldKindOf the evaluator walks by.

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

                                                                                          Lean2Js.Compile.fieldTysOf

                                                                                          source
                                                                                          Equations
                                                                                          Instances For
                                                                                            Used by
                                                                                              def

                                                                                              Lean2Js.Compile.headOf

                                                                                              source
                                                                                              Equations
                                                                                              Instances For
                                                                                                Used by
                                                                                                  def

                                                                                                  Lean2Js.Compile.specialize

                                                                                                  source
                                                                                                  (h : Head) (arity : Nat) :

                                                                                                  The rows left once the first column is known to have head h, with that head's own fields spliced in front of the rest. A constructor pattern of the wrong width is dropped rather than spliced: the compiler type checks the patterns before asking about usefulness, so this drops nothing a program can write, and dropping a row only ever makes the answer "useful" — the answer that reports a match as not exhaustive.

                                                                                                  Equations
                                                                                                  Instances For
                                                                                                    Used by
                                                                                                      def

                                                                                                      Lean2Js.Compile.defaultRows

                                                                                                      source

                                                                                                      The rows left once the first column is known to have none of the heads already listed.

                                                                                                      Equations
                                                                                                      Instances For
                                                                                                        Used by
                                                                                                          def

                                                                                                          Lean2Js.Compile.useful

                                                                                                          source

                                                                                                          Maranget's usefulness test: is there a value vector that q matches and no row of rows does? Exhaustiveness is this asked of an all-wildcard q, and an unreachable arm is this asked of that arm against the arms before it, so one function answers both.

                                                                                                          Patterns are type-checked before this runs, so a head that does not belong to its column's type cannot reach here.

                                                                                                          budget is what makes this a total function, and a total function is what lets a proof unfold it. Each step either drops a column or expands a type into one constructor's fields; running out answers true, which fails an exhaustiveness check rather than passing one.

                                                                                                          Equations
                                                                                                          Instances For
                                                                                                            Used by
                                                                                                              def

                                                                                                              Lean2Js.Compile.usefulBudget

                                                                                                              source
                                                                                                              (types : List Core.TypeDef) (tys : List Core.Ty) :

                                                                                                              How far useful may descend on the columns it starts with. Each expansion either descends one edge of the declaration graph, which validateType keeps acyclic, or lands in a type argument the column carries; tyDescBudget counts the same thing for the entry check.

                                                                                                              Equations
                                                                                                              Instances For
                                                                                                                Used by
                                                                                                                  def

                                                                                                                  Lean2Js.Compile.foldHeads

                                                                                                                  source
                                                                                                                  (typeName : String) (tyArgs : List Core.Ty) (result : Core.Ty) (t : Core.TypeDef) :

                                                                                                                  The constructors of the type a fold walks, each carrying its fields at the types a fold's alternative reads them: a field that came round is bound to the answer for it. This is the signature the alternatives are type-checked against, and signature cannot give it — the rebuilt node is the declared type with every folded field replaced by the answer for it, which is not a type this language writes.

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

                                                                                                                      Lean2Js.Compile.usefulFold

                                                                                                                      source
                                                                                                                      (types : List Core.TypeDef) (heads : List (Head × List (String × Core.Ty))) (rows : List (List Core.Pat)) :

                                                                                                                      useful of one column whose signature is handed over rather than read off its type.

                                                                                                                      A fold's alternatives are matched against the rebuilt node, so the column they sit at has foldHeads and not signature. Reading it at the declared type instead is not conservative: two types may declare constructors of the same name, so a nested pattern typed at the fold's result can name every constructor the declared type has and still leave a rebuilt node uncovered. Below the one column the types are ordinary and useful takes over.

                                                                                                                      Each branch is useful's own step at one column with signature types ty replaced by some heads, so what it settles is the same thing: a head no row names sends the rows through defaultRows, where only a row that is wild at the column survives. Where that step leaves no column, it is written as the .isEmpty useful answers there rather than as a call at a budget that would have to be unfolded.

                                                                                                                      Equations
                                                                                                                      Instances For
                                                                                                                        Used by
                                                                                                                          structure

                                                                                                                          Lean2Js.Compile.Arm

                                                                                                                          source

                                                                                                                          One lowered match arm: what the generated code tests before taking it, the names it binds and where it reads each from, and the body under those bindings.

                                                                                                                          Instances For
                                                                                                                            Used by
                                                                                                                              def

                                                                                                                              Lean2Js.Compile.objOf

                                                                                                                              source

                                                                                                                              A constructor value, under the key its name is carried under. Agree.encodeValue reads the key the same way, from the constructor's name alone, so the object the compiler writes and the object the reference semantics is encoded to are the same one.

                                                                                                                              Equations
                                                                                                                              Instances For
                                                                                                                                Used by
                                                                                                                                  def

                                                                                                                                  Lean2Js.Compile.litJs

                                                                                                                                  source

                                                                                                                                  A literal pattern is held to the same rules as a literal expression: an Int53 outside the safe range is no more matchable than it is writable.

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

                                                                                                                                      Lean2Js.Compile.patParts

                                                                                                                                      source
                                                                                                                                      @[irreducible]

                                                                                                                                      Type-checks one pattern against the type at its position and lowers it to the tests the generated code runs and the names it binds, each paired with the path it is read from.

                                                                                                                                      The tests are conjoined left to right by the caller, so an inner test is only reached once the tag it sits under has been confirmed and the path it reads is known to exist.

                                                                                                                                      Equations
                                                                                                                                      Instances For
                                                                                                                                        Used by
                                                                                                                                          def

                                                                                                                                          Lean2Js.Compile.patPartsList

                                                                                                                                          source
                                                                                                                                          @[irreducible]
                                                                                                                                          Equations
                                                                                                                                          Instances For
                                                                                                                                            Used by
                                                                                                                                              def

                                                                                                                                              Lean2Js.Compile.foldPatParts

                                                                                                                                              source

                                                                                                                                              The top of a fold's alternative. Only the fields are typed differently from a match's, and only at this one level — what a folded field binds is an ordinary type, so anything nested inside reads through patPartsList unchanged.

                                                                                                                                              Naming the node itself is refused rather than typed: the rebuilt node is the declared type with every field that came round replaced by the answer for it, and that is not a type this language can write.

                                                                                                                                              Equations
                                                                                                                                              Instances For
                                                                                                                                                Used by
                                                                                                                                                  partial def

                                                                                                                                                  Lean2Js.Compile.mentions

                                                                                                                                                  source
                                                                                                                                                  (p : Core.Program) (target : String) (seen : List String) :

                                                                                                                                                  Whether a type's fields can reach target through the declarations they name. Type arguments are searched too, so Tree (Tree Int53) is caught the same way a field of type Tree is.

                                                                                                                                                  Used by
                                                                                                                                                    def

                                                                                                                                                    Lean2Js.Compile.recursiveType

                                                                                                                                                    source
                                                                                                                                                    (p : Core.Program) (n : String) :

                                                                                                                                                    Whether a declared type can reach itself through the types its fields name. Only such a type binds where it is expanded; one that cannot is written out where it is used, exactly as every declared type was before a type could name itself.

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

                                                                                                                                                        Lean2Js.Compile.Stack

                                                                                                                                                        source
                                                                                                                                                        @[reducible, inline]

                                                                                                                                                        The declared types whose expansion the walk is inside, nearest first, at the arguments they were applied to. A name met again at the same arguments is the knot: it becomes a ref back to the binder rather than an expansion that would not end.

                                                                                                                                                        Equations
                                                                                                                                                        Instances For
                                                                                                                                                          Used by
                                                                                                                                                            def

                                                                                                                                                            Lean2Js.Compile.tyDescIn

                                                                                                                                                            source
                                                                                                                                                            @[irreducible]

                                                                                                                                                            Expands a declared type into the shape the generated code checks an argument against. Recursion is what would make this diverge, and validateType has already rejected it, so no occurs check is needed here — one by name would reject Paginated (Paginated Int53), which is not recursive.

                                                                                                                                                            budget counts the name expansions still allowed. A name expansion substitutes the type arguments into the field types, so the result can be larger than what was expanded and the structure alone does not measure the recursion; tyDescBudget is what bounds it from above. Exhausting it is a compile error, so a budget that turns out to be too small loses the artifact rather than weakening the check it emits.

                                                                                                                                                            The constructor and field lists recurse through helpers rather than mapM so that a proof about the entry check can unfold them.

                                                                                                                                                            Equations
                                                                                                                                                            Instances For
                                                                                                                                                              Used by
                                                                                                                                                                def

                                                                                                                                                                Lean2Js.Compile.tyDescAlts

                                                                                                                                                                source
                                                                                                                                                                @[irreducible]
                                                                                                                                                                Equations
                                                                                                                                                                Instances For
                                                                                                                                                                  Used by
                                                                                                                                                                    def

                                                                                                                                                                    Lean2Js.Compile.tyDescFields

                                                                                                                                                                    source
                                                                                                                                                                    @[irreducible]
                                                                                                                                                                    Equations
                                                                                                                                                                    Instances For
                                                                                                                                                                      Used by
                                                                                                                                                                        def

                                                                                                                                                                        Lean2Js.Compile.tyDesc

                                                                                                                                                                        source
                                                                                                                                                                        (p : Core.Program) (budget : Nat) (ty : Core.Ty) :

                                                                                                                                                                        The descriptor a type crosses the boundary as: expanded from nothing, so the only binders in it are the ones the types themselves put there.

                                                                                                                                                                        Equations
                                                                                                                                                                        Instances For
                                                                                                                                                                          Used by
                                                                                                                                                                            def

                                                                                                                                                                            Lean2Js.Compile.tyDescBudget

                                                                                                                                                                            source
                                                                                                                                                                            (p : Core.Program) (ty : Core.Ty) :

                                                                                                                                                                            Every name expansion either descends one edge of the declaration graph, which validateType keeps acyclic and so is at most p.types.length long, or lands in a type argument, of which the type carries at most sizeOf ty.

                                                                                                                                                                            Equations
                                                                                                                                                                            Instances For
                                                                                                                                                                              Used by
                                                                                                                                                                                def

                                                                                                                                                                                Lean2Js.Compile.compileExpr

                                                                                                                                                                                source
                                                                                                                                                                                @[irreducible]
                                                                                                                                                                                Equations
                                                                                                                                                                                Instances For
                                                                                                                                                                                  Used by
                                                                                                                                                                                    def

                                                                                                                                                                                    Lean2Js.Compile.compileExpr.chain

                                                                                                                                                                                    source
                                                                                                                                                                                    Equations
                                                                                                                                                                                    Instances For
                                                                                                                                                                                      Used by
                                                                                                                                                                                        def

                                                                                                                                                                                        Lean2Js.Compile.compileExpr.apply

                                                                                                                                                                                        source
                                                                                                                                                                                        (a : Arm) :
                                                                                                                                                                                        Equations
                                                                                                                                                                                        Instances For
                                                                                                                                                                                          Used by
                                                                                                                                                                                            def

                                                                                                                                                                                            Lean2Js.Compile.compileArgs

                                                                                                                                                                                            source
                                                                                                                                                                                            @[irreducible]
                                                                                                                                                                                            Equations
                                                                                                                                                                                            Instances For
                                                                                                                                                                                              Used by
                                                                                                                                                                                                def

                                                                                                                                                                                                Lean2Js.Compile.compileValues

                                                                                                                                                                                                source
                                                                                                                                                                                                @[irreducible]
                                                                                                                                                                                                Equations
                                                                                                                                                                                                Instances For
                                                                                                                                                                                                  Used by
                                                                                                                                                                                                    def

                                                                                                                                                                                                    Lean2Js.Compile.compileAlts

                                                                                                                                                                                                    source
                                                                                                                                                                                                    @[irreducible]
                                                                                                                                                                                                    Equations
                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                      Used by
                                                                                                                                                                                                        def

                                                                                                                                                                                                        Lean2Js.Compile.compileFoldAlts

                                                                                                                                                                                                        source
                                                                                                                                                                                                        @[irreducible]
                                                                                                                                                                                                        [Core.Discriminators] (p : Core.Program) (ctx : Ctx) (typeName : String) (tyArgs : List Core.Ty) (result : Core.Ty) (alts : List Core.Alt) :
                                                                                                                                                                                                        Equations
                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                          Used by
                                                                                                                                                                                                            def

                                                                                                                                                                                                            Lean2Js.Compile.compileFinish

                                                                                                                                                                                                            source

                                                                                                                                                                                                            Unfolds a tail let into a const statement. A let appearing mid-expression has to be wrapped in an immediately invoked arrow to preserve evaluation order, but wrapping the lets lined up at the head of a function as well would make the output unreadable.

                                                                                                                                                                                                            Equations
                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                def

                                                                                                                                                                                                                Lean2Js.Compile.compileBody

                                                                                                                                                                                                                source
                                                                                                                                                                                                                @[irreducible]
                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                    def

                                                                                                                                                                                                                    Lean2Js.Compile.rawParam

                                                                                                                                                                                                                    source
                                                                                                                                                                                                                    (i : Nat) :

                                                                                                                                                                                                                    The name an exported function takes its argument under, before the entry check hands it to the body under the declared name. The reserved prefix is what keeps it out of reach of a declared name.

                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                        def

                                                                                                                                                                                                                        Lean2Js.Compile.rawParams

                                                                                                                                                                                                                        source
                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                            def

                                                                                                                                                                                                                            Lean2Js.Compile.paramChecks

                                                                                                                                                                                                                            source

                                                                                                                                                                                                                            The const per parameter that an exported function opens with: the declared name bound to the raw argument, checked against the declared type unless the type is a function, which has no shape to check.

                                                                                                                                                                                                                            Recursing rather than zipIdx.mapM for the reason tyDesc does: a proof about the entry has to unfold this to see what the body runs under.

                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                def

                                                                                                                                                                                                                                Lean2Js.Compile.declSigRest

                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                    def

                                                                                                                                                                                                                                    Lean2Js.Compile.declSig

                                                                                                                                                                                                                                    source

                                                                                                                                                                                                                                    The parameter list as it appears in the doc comment. String.intercalate walks an accumulator, which a proof about the characters the doc contains cannot unfold.

                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                        def

                                                                                                                                                                                                                                        Lean2Js.Compile.paramIdents

                                                                                                                                                                                                                                        source

                                                                                                                                                                                                                                        The arguments the entry hands the body: every parameter under its declared name, which is what the checks above it have just bound.

                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                            def

                                                                                                                                                                                                                                            Lean2Js.Compile.retWalk

                                                                                                                                                                                                                                            source

                                                                                                                                                                                                                                            The result, read back out through the type the declaration was declared to return. A dictionary declared to cross as a plain object is the only node the walk moves, so where the expanded descriptor reaches none nothing is emitted and the entry is byte-for-byte what it is without a walk.

                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                def

                                                                                                                                                                                                                                                Lean2Js.Compile.compileDecl

                                                                                                                                                                                                                                                source

                                                                                                                                                                                                                                                A declaration becomes two functions: the body, which is where the compiled expression goes and which every call from inside the package lands on, and the entry, which checks its arguments and hands them to the body under their declared names. The entry is what a consumer imports and what decl_correct, decl_traps and decl_refuses are statements about; the split is what keeps a call from inside the package from walking an argument that is already good.

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

                                                                                                                                                                                                                                                    Lean2Js.Compile.keyDeclared

                                                                                                                                                                                                                                                    source

                                                                                                                                                                                                                                                    A constructor is carried under the key its own type declares. Written as its own step rather than as an if in the walk below so that the reading can be taken back out of a validated program.

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

                                                                                                                                                                                                                                                        Lean2Js.Compile.validateType

                                                                                                                                                                                                                                                        source

                                                                                                                                                                                                                                                        The key a type's constructors are told apart by has to stay free as a field name, and it has to be the key the constructor's name is carried under: a value carries that name and not the type it came from, so two types declaring a constructor of the same name cannot key it differently.

                                                                                                                                                                                                                                                        A type naming itself is not refused here. tyDescIn ties the knot where the name comes round again at the same arguments; a type whose expansion has no such fixed point — one applied to a bigger argument each time round — runs out of budget instead, and is refused by name.

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

                                                                                                                                                                                                                                                            Lean2Js.Compile.compileDecls

                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                def

                                                                                                                                                                                                                                                                Lean2Js.Compile.compileProgram

                                                                                                                                                                                                                                                                source

                                                                                                                                                                                                                                                                A declaration is compiled against the whole program and callsPrecede is what keeps a function from calling itself or a later one. That is what keeps nontermination out of the subset: eval's fuel bounds the proof, not the language. Traversal is map / filter / reduce, which are syntax and cannot recur.

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

                                                                                                                                                                                                                                                                    Lean2Js.Compile.compileDeclared

                                                                                                                                                                                                                                                                    source

                                                                                                                                                                                                                                                                    The module a program compiles to under the reading its own types declare. compileProgram takes a reading as given, because what is proved about it holds for any; this is where a program's own one is installed, and where a program whose keys are no reading at all is refused.

                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                      Used by