Documentation

CslibFrontier.Computability.Circuit.Arithmetic.Separation.Uni.Rules

The rules of the universal machine #

The universal machine (Uni.universalMachine θ supp) is a weighted pointer machine (M1's Uni.Mach) that evaluates the interpreter's formulas on trees stored in its heap. Its records have the kinds Uni.RecKind (trees, and the frames of an evaluation), its control modes are Uni.Mode, and its rules Uni.Rule supp are the 38 rules of Uni.BaseRule, which need no names, and four families of rules that read a name of θ from the heap bit by bit: names are the prefixes of the support supp of θ (Uni.Name).

Main definitions #

Main results #

References #

The kinds of records: trees (nil, cons), unused records, and the frames of an evaluation.

Instances For

    The prefixes of the words in supp.

    @[reducible, inline]

    The names that the machine reads: prefixes of the words in supp.

    The control modes.

    • start₀ {N : Type} : Mode N

      the first two setup steps

    • start₁ {N : Type} : Mode N
    • start₂ {N : Type} : Mode N

      the step after parsing

    • parse {N : Type} : Mode N

      reading the input

    • parseRec {N : Type} : Mode N

      building the parsed tree

    • eval {N : Type} : Mode N

      evaluating a formula

    • decode {N : Type} (j : Fin 11) : Mode N

      reading the opcode, j steps in

    • frameCons {N : Type} : Mode N

      pushing the frame of cons, ite or run

    • frameIte {N : Type} : Mode N
    • frameRun {N : Type} : Mode N
    • ret {N : Type} : Mode N

      returning a value to the frame on top

    • head {N : Type} : Mode N

      taking the head or the tail of a value

    • tail {N : Type} : Mode N
    • ite {N : Type} : Mode N

      choosing a branch of ite

    • ite₁ {N : Type} : Mode N
    • ite₂ {N : Type} : Mode N
    • thetaHead {N : Type} (p : N) : Mode N

      reading the name p of θ

    • thetaBit {N : Type} (p : N) : Mode N
    • halt {N : Type} : Mode N

      the end

    Instances For
      @[instance_reducible]

      The rules that read no name.

      Instances For

        All rules: those without names, and those that read a name of θ from the heap.

        Instances For
          def Cslib.Circuits.Arithmetic.Separation.Uni.Rule.equivSum (supp : Finset (List Bool)) :
          Rule supp ≃ BaseRule ⊕ { _u : Unit // [] ∈ prefixes supp } ⊕ Name supp ⊕ Name supp ⊕ { x : Name supp × Name supp × Bool // match x with | (p, p', b) => ↑p' = ↑p ++ [b] }

          Rule as a sum.

          The data of a rule, with the fields of M1's Uni.Mach.

          • src : Mode N

            the mode before the step

          • dst : Mode N

            the mode after the step

          • the input bit read, if any

          • lk : RecKind

            the kind of the loaded record

          • la : Fin 5

            the register with the address of the loaded record

          • ak : RecKind

            the kind of the allocated record

          • af : Fin 3 → Fin 9

            the variables that fill the allocated record

          • dr : Fin 5 → Fin 9

            the variables that become the registers

          • wt : A

            the weight

          def Cslib.Circuits.Arithmetic.Separation.Uni.RuleData.basic {A : Type} [CommRing A] {N : Type} (src dst : Mode N) (lk : RecKind) (la : Fin 5) (ak : RecKind) (f₀ f₁ f₂ d₁ d₂ d₃ d₄ : Fin 9) :

          A rule that reads no input and has weight 1: from mode src to dst, loading a record of kind lk through register la, allocating a record of kind ak with fields f₀ f₁ f₂, and setting registers 1 to 4 to d₁ d₂ d₃ d₄ (register 0 stays 0).

          The rules that read no name.

          def Cslib.Circuits.Arithmetic.Separation.Uni.rule {A : Type} [CommRing A] (θ : List Bool → A) (supp : Finset (List Bool)) :
          Rule supp → RuleData A (Name supp)

          The rules.

          noncomputable def Cslib.Circuits.Arithmetic.Separation.Uni.universalMachine {A : Type} [CommRing A] (θ : List Bool → A) (supp : Finset (List Bool)) :
          Mach A (Mode (Name supp)) RecKind

          The universal machine.

          The register that holds the address of the loaded record depends on the mode only.

          theorem Cslib.Circuits.Arithmetic.Separation.Uni.la_eq {A : Type} [CommRing A] (θ : List Bool → A) (supp : Finset (List Bool)) (r : Rule supp) :
          (rule θ supp r).la = loadReg (rule θ supp r).src