Documentation

Complexity.Computability.GenericRAM.Native

Native certificates for RAM primitives #

A NativeCertificate records arbitrary input-dependent time and space bounds, including the encoded output size, for an actual finite native multi-tape machine. Model.NativePrimitives collects these certificates for the scalar obligations of a RAM model. Configuration and all operands are encoded runtime inputs; a single machine handles all of them for each fixed symbol. Constants may depend on the symbol, and hence on a fixed finite source program. Symbols themselves are not encoded inputs: this is not a uniform interpreter for arbitrary programs.

The semantic Model remains independent of finite encodings. In particular, this interface does not require an exact real RAM to admit a bit representation. It also supplies neither a memory representation nor a whole-machine simulation. Loads/stores still require charged lookup/update; control, initialization and output require their own certificates. Deriving an input-only bound from a configuration-and-input bound additionally requires charged, computable configuration selection and an input-fit guarantee, rather than instance-dependent width advice.

Main definitions #

Main results #

References #

Finite bit representations are separate from the semantic model. Configuration encoding is chosen explicitly; in particular, unary and binary widths have different resource costs.

Instances For

    A fixed literal's result, including the admissibility check performed by Data.put.

    Instances For

      A fixed operation's result, including the admissibility check performed by Data.put. A native implementation can reject overflow without materializing the unchecked result.

      Instances For
        theorem Cslib.GenericRAM.Model.eval_const_eq_map_checkedConstant {M : Model} {r : ℕ} (k : M.Config) (x : Data M r) (d : Fin r) (c : M.Const) :

        A constant instruction stores exactly the checked literal result, preserving faults.

        theorem Cslib.GenericRAM.Model.eval_alu_eq_map_checkedOp {M : Model} {r : ℕ} (k : M.Config) (x : Data M r) (op : M.operations.Op) (d : Fin r) (args : Fin (M.operations.Arity op) → Fin r) :
        Op.eval k (Op.alu op d args) x = Option.map (x.set d) (M.checkedOp op (k, x.regs ∘ args))

        An ALU instruction stores exactly the checked operation result, preserving faults.

        Scalar certificates needed by a fixed-program RAM simulation. Memory lookup/update and finite-program dispatch are additional obligations. There is no uniform symbol dispatcher here.

        Instances For

          All six primitive certificates in a bundle have polynomial time and space bounds.

          • constant (c : M.Const) : (N.constant c).IsPolynomial

            Every literal symbol's certificate has polynomial time and space bounds.

          • operation (op : M.operations.Op) : (N.operation op).IsPolynomial

            Every ALU operation symbol's certificate has polynomial time and space bounds.

          • test (t : M.tests.Op) : (N.test t).IsPolynomial

            Every test symbol's certificate has polynomial time and space bounds.

          • address : N.address.IsPolynomial

            The address extraction certificate has polynomial time and space bounds.

          • validMove : N.validMove.IsPolynomial

            The move validation certificate has polynomial time and space bounds.

          • validPC : N.validPC.IsPolynomial

            The control-label validation certificate has polynomial time and space bounds.

          Instances For