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 #
Uni.RecKind,Uni.Mode,Uni.prefixes,Uni.Name,Uni.BaseRule,Uni.Rule,Uni.Rule.equivSum(the rules as a sum, for theirFintypeinstance),Uni.consOrNil.Uni.RuleData,Uni.RuleData.basic,Uni.baseRule,Uni.rule,Uni.universalMachine.Uni.loadReg: the register that holds the address of the loaded record, by mode.
Main results #
References #
- Anthropic, VP ≠ VNP over every field, paper and Lean formalization,
module
Nc.Uni.Rules
The kinds of records: trees (nil, cons), unused records, and the frames of an
evaluation.
- nil : RecKind
the empty tree
- cons : RecKind
a tree with two subtrees
- garbage : RecKind
a record that is never loaded
- halt : RecKind
the frame of the final result
- parseEnd : RecKind
the end of the parsed input
- parseA : RecKind
a parse frame, first part
- parseB : RecKind
a parse frame, second part
- head : RecKind
the frame of
hd - tail : RecKind
the frame of
tl - cons₁ : RecKind
the first frame of
cons - cons₂ : RecKind
the second frame of
cons - ite : RecKind
the frame of
ite - run₁ : RecKind
the first frame of
run - run₂ : RecKind
the second frame of
run - theta : RecKind
the frame of
θ
Instances For
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,
jsteps in - frameCons {N : Type} : Mode N
- 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
pofθ - thetaBit {N : Type} (p : N) : Mode N
- halt {N : Type} : Mode N
the end
Instances For
The rules that read no name.
- start₀ : BaseRule
- start₁ : BaseRule
- readEnd : BaseRule
- readBit : BaseRule
- parseA : BaseRule
- parseB : BaseRule
- parseEnd : BaseRule
- start₂ (b : Bool) : BaseRule
- evalNil : BaseRule
- evalCons : BaseRule
- decodeStep (j : Fin 10) : BaseRule
- decode₀ : BaseRule
- decode₁ : BaseRule
- decode₂ : BaseRule
- decode₃ : BaseRule
- decode₄ : BaseRule
- decode₅ : BaseRule
- decode₆ : BaseRule
- decodeGuess (b : Bool) : BaseRule
- decodeTheta : BaseRule
- frameCons (b : Bool) : BaseRule
- frameIte (b : Bool) : BaseRule
- frameRun (b : Bool) : BaseRule
- retHead : BaseRule
- retTail : BaseRule
- head (b : Bool) : BaseRule
- tail (b : Bool) : BaseRule
- retCons₁ : BaseRule
- retCons₂ : BaseRule
- retIte : BaseRule
- iteCons : BaseRule
- iteNil : BaseRule
- ite₁ (b : Bool) : BaseRule
- ite₂ (b : Bool) : BaseRule
- retRun₁ : BaseRule
- retRun₂ : BaseRule
- retHalt : BaseRule
Instances For
All rules: those without names, and those that read a name of θ from the heap.
- base {supp : Finset (List Bool)} (r : BaseRule) : Rule supp
a rule that reads no name
- thetaStart {supp : Finset (List Bool)} (h : [] ∈ prefixes supp) : Rule supp
start reading a name, if the empty word is a prefix
- thetaRead {supp : Finset (List Bool)} (p : Name supp) : Rule supp
the name
pis read: applyθ - thetaNext {supp : Finset (List Bool)} (p : Name supp) : Rule supp
one more bit of the name follows
- thetaBit {supp : Finset (List Bool)} (p p' : Name supp) (b : Bool) (h : ↑p' = ↑p ++ [b]) : Rule supp
the bit
bextendsptop'
Instances For
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
the variables that fill the allocated record
the variables that become the registers
- wt : A
the weight
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 register that holds the address of the loaded record depends on the mode only.