Documentation

Examples.Ram.FunctionRun

Running an intermediate function #

The factorial implementation is reused without its optional input/output main. The runtime adapter takes an ordinary argument value, launches a checked fixed call trampoline, and returns the machine's result, exact count and stopping reason. runFactorialUntil runs without an operational limit; runFactorial retains a limit for exploration. Both execute the same code, and the result theorem derives termination and the exact count from that implementation.

The ordinary factorial function uses the generated apply entry after proving normal termination. It computes by executing that same compiled call, not by evaluating mathlib's specification. Its stack-capacity proof is erased at runtime; no time estimate is needed to define or call it. The separate full-run count is still obtained from the implementation's body-time theorem. ram_run_apply handles static compilation and lookup premises for these bridges; stack capacity and the function's correctness and time proofs remain explicit.

Execute the existing factorial function on 32-bit words. Argument preparation is explicit preloading; the reported count includes call setup, return and halt.

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

    The same compiled factorial application, with no supplied time budget. The function is still word-valued: this observation decodes its returned word.

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

      Correctness of the executable application, with its full call and halt count. The premise is address-space capacity for the real stack, not a time budget. Overflow of the mathematical factorial retains the established modular result.

      Normal termination follows from the function's budget-free correctness proof and the compiled code's representability, before any cost formula is used.

      An ordinary executable function returning a decoded word. Its only runtime argument is n; the erased proof ensures sufficient stack capacity. The value comes from the actual recursive program, retaining word overflow semantics.

      Equations
      Instances For

        Correctness is an ordinary value equation about the executable function.

        When the mathematical result fits, the ordinary executable value is exactly mathlib's factorial, not just its residue modulo the word range.

        Ordinary mathematical properties reuse mathlib without a Part membership premise, a machine state, or a proposed execution budget in the statement.

        The same total call reports its actual full count. The cost equation is proved separately and is not an argument to the executable function.