lean2js

Lean2Js.Emit

source

Writing a manifest out as an npm package #

Writes a manifest out as an npm package.

Everything here reads an Artifact: the manifest a user wrote, and the program and theorems lean2js read out of its namespace. Nothing here knows about this repository's example.

def

Lean2Js.Core.Program.checked

source

Everything emit refuses by reading the program alone, and the module it compiles to when it refuses nothing. The fuel check is not per vector but per program: Cost.cost is decided from the syntax alone, so one comparison covers every call any caller can make. Bound.programBounded is the same shape for the one result that grows with a value instead of with the syntax.

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

      Lean2Js.Core.Program.check

      source
      (p : Program) :

      #eval program.check puts the same wall in a user's lake build, where it costs a compile rather than the differential run emit does. Without it a program that no fuel bound covers, or that the compiler rejects, builds clean and is refused only once lean2js runs.

      Equations
      Instances For
        Used by
          def

          Lean2Js.emit

          source
          (outDir : System.FilePath) (a : Artifact) :

          Checks before it writes. Every vector has to agree between eval and the model of the generated JS, the text of the module has to read back as the module it was compiled from, and the package, assembled in a scratch directory, has to agree with eval on every vector when Node runs it. A disagreement fails the build rather than reaching the package, and so does a node that never got as far as disagreeing — the two are refused under different names, because only one of them is the compiler's to fix.

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