Documentation

CslibFrontier.Computability.Circuit.Arithmetic.Separation.Uni.PM

Pointer machines #

Every step loads one record from the heap and allocates one fresh record at the next address. Each step operates on nine integer variables: the five registers (0..4), the three loaded record fields (5..7), and the freshly allocated address (8).

The key lemma Mach.gv_iff shows that checking step-by-step causality (Mach.Seq) is equivalent to the global check Mach.GV (where loads may refer to the full final heap) whenever the initial heap is closed (Mach.Closed).

Relation to Cslib.PointerMachine #

This model is intentionally distinct from CslibFrontier/Computability/PointerMachine/Defs.lean (Cslib.PointerMachine, Tarjan's deterministic PC-indexed instruction model with arbitrary Layout and total operations). Here Uni.Mach A M K is a CommRing-weighted nondeterministic rule relation over modes M and record kinds K, with fixed 5-register / 3-field bit-sliced records, finite accepting-run weight sums (Mach.SumTo), and the global-heap relaxation Mach.GV needed by the universal weighted-automaton reduction in [AnthropicVPVNP2026].

From VP ≠ VNP over every field [Ant26], module Nc.Uni.PM.

Main definitions #

Main results #

structure Cslib.Circuits.Arithmetic.Separation.Uni.Mach (A : Type u_1) (M : Type u_2) (K : Type u_3) :
Type (max (max (max 1 u_1) u_2) u_3)

A pointer machine with modes M, record kinds K, and weights in A. The nine variables of a step are: the five registers (0..4), the three fields of the loaded record (5..7), and the new address (8).

  • Rl : Type

    transition rules

  • fR : Fintype self.Rl
  • dR : DecidableEq self.Rl
  • src : self.Rl → M

    mode before the step

  • dst : self.Rl → M

    mode after the step

  • rd : self.Rl → Option Bool

    optional bit read from the input

  • lk : self.Rl → K

    kind of the record loaded in this step

  • la : self.Rl → Fin 5

    register holding the address of the loaded record

  • ak : self.Rl → K

    kind of the record allocated in this step

  • af : self.Rl → Fin 3 → Fin 9

    three variable indices supplying the new record's fields

  • dr : self.Rl → Fin 5 → Fin 9

    variable indices supplying the five updated registers

  • wt : self.Rl → A

    transition weight

  • m0 : M

    initial mode

  • mh : M

    halting mode

  • kN : K

    kind of the initial record at address 0

Embed a register index (Fin 5) as a step variable index (Fin 9).

@[reducible, inline]

Heap records: record kind together with [address, field0, field1, field2].

@[reducible, inline]
abbrev Cslib.Circuits.Arithmetic.Separation.Uni.Mach.Step {A : Type u_1} {M : Type u_2} {K : Type u_3} (P : Mach A M K) :

A step: a transition rule together with an assignment to the nine variables.

def Cslib.Circuits.Arithmetic.Separation.Uni.Mach.ld {A : Type u_1} {M : Type u_2} {K : Type u_3} {P : Mach A M K} (st : P.Step) :
Rec K

The record loaded by step st.

def Cslib.Circuits.Arithmetic.Separation.Uni.Mach.al {A : Type u_1} {M : Type u_2} {K : Type u_3} {P : Mach A M K} (st : P.Step) :
Rec K

The record allocated by step st.

def Cslib.Circuits.Arithmetic.Separation.Uni.Mach.wts {A : Type u_1} {M : Type u_2} {K : Type u_3} [CommMonoid A] {P : Mach A M K} (tr : List P.Step) :
A

The product of rule weights along a trace of steps.

structure Cslib.Circuits.Arithmetic.Separation.Uni.Mach.State (M : Type u_4) (K : Type u_5) :
Type (max u_4 u_5)

A pointer-machine configuration.

  • mode : M

    current control mode

  • regs : Fin 5 → ℕ

    current values of the five registers

  • heap : List (Rec K)

    allocated records

  • n : ℕ

    last allocated address

  • inp : List Bool

    remaining input bits

structure Cslib.Circuits.Arithmetic.Separation.Uni.Mach.Fire {A : Type u_1} {M : Type u_2} {K : Type u_3} {P : Mach A M K} (σ : State M K) (st : P.Step) :

Local validity of firing step st from configuration σ.

  • src : P.src st.1 = σ.mode

    rule source matches current mode

  • regs (i : Fin 5) : st.2 (rv i) = σ.regs i

    first five variables match current registers

  • fresh : st.2 8 = σ.n + 1

    fresh address equals σ.n + 1

  • load : ld st ∈ σ.heap

    loaded record already exists in the heap

  • read : (P.rd st.1).toList <+: σ.inp

    rule consumes a prefix of the remaining input

def Cslib.Circuits.Arithmetic.Separation.Uni.Mach.nxt {A : Type u_1} {M : Type u_2} {K : Type u_3} {P : Mach A M K} (σ : State M K) (st : P.Step) :
State M K

The configuration resulting from executing step st in configuration σ.

def Cslib.Circuits.Arithmetic.Separation.Uni.Mach.Seq {A : Type u_1} {M : Type u_2} {K : Type u_3} (P : Mach A M K) :
State M K → List P.Step → Prop

Step-by-step accepting runs of P starting from σ.

structure Cslib.Circuits.Arithmetic.Separation.Uni.Mach.GV {A : Type u_1} {M : Type u_2} {K : Type u_3} {P : Mach A M K} (σ : State M K) (tr : List P.Step) :

Runs checked globally: loads may refer to any record in the final heap σ.heap ++ tr.map al.

structure Cslib.Circuits.Arithmetic.Separation.Uni.Mach.Closed {M : Type u_2} {K : Type u_3} (σ : State M K) :

A configuration whose heap and registers use only addresses ≤ σ.n and covers 0..σ.n.

  • le (c : Rec K) : c ∈ σ.heap → ∀ (i : Fin 4), c.2 i ≤ σ.n

    every record's entries are at most σ.n

  • ex (j : ℕ) : j ≤ σ.n → ∃ c ∈ σ.heap, c.2 0 = j

    every address ≤ σ.n occurs on some heap record

  • reg (i : Fin 5) : σ.regs i ≤ σ.n

    every register is at most σ.n

theorem Cslib.Circuits.Arithmetic.Separation.Uni.Mach.Closed.env {A : Type u_1} {M : Type u_2} {K : Type u_3} {P : Mach A M K} {σ : State M K} (hσ : Closed σ) {st : P.Step} (hf : Fire σ st) (i : Fin 9) :
st.2 i ≤ σ.n + 1
theorem Cslib.Circuits.Arithmetic.Separation.Uni.Mach.Closed.nxt {A : Type u_1} {M : Type u_2} {K : Type u_3} {P : Mach A M K} {σ : State M K} (hσ : Closed σ) {st : P.Step} (hf : Fire σ st) :
theorem Cslib.Circuits.Arithmetic.Separation.Uni.Mach.gv_iff {A : Type u_1} {M : Type u_2} {K : Type u_3} {P : Mach A M K} {σ : State M K} (hσ : Closed σ) (tr : List P.Step) :
GV σ tr ↔ P.Seq σ tr

For a closed initial configuration, global verification GV is equivalent to sequential acceptance Seq.

theorem Cslib.Circuits.Arithmetic.Separation.Uni.Mach.Seq.le {A : Type u_1} {M : Type u_2} {K : Type u_3} {P : Mach A M K} {σ : State M K} (hσ : Closed σ) {tr : List P.Step} (h : P.Seq σ tr) (st : P.Step) :
st ∈ tr → ∀ (i : Fin 9), st.2 i ≤ σ.n + tr.length

Every variable value occurring along a sequential accepting run is at most σ.n + tr.length.

def Cslib.Circuits.Arithmetic.Separation.Uni.Mach.SumTo {A : Type u_1} {M : Type u_2} {K : Type u_3} [CommRing A] (P : Mach A M K) (σ : State M K) (S : A) (B : ℤ) :

The accepting runs from σ form a finite set whose weights sum to S and whose lengths are all at most B.

theorem Cslib.Circuits.Arithmetic.Separation.Uni.Mach.SumTo.mono {A : Type u_1} {M : Type u_2} {K : Type u_3} [CommRing A] {P : Mach A M K} {σ : State M K} {S : A} {B B' : ℤ} (h : P.SumTo σ S B) (hB : B ≤ B') :
P.SumTo σ S B'
theorem Cslib.Circuits.Arithmetic.Separation.Uni.Mach.SumTo.halt {A : Type u_1} {M : Type u_2} {K : Type u_3} [CommRing A] {P : Mach A M K} {σ : State M K} (hm : σ.mode = P.mh) (hi : σ.inp = []) (hP : ∀ (r : P.Rl), P.src r ≠ P.mh) :
P.SumTo σ 1 0

Halting case: when no rule starts from P.mh, the unique accepting run is [].

theorem Cslib.Circuits.Arithmetic.Separation.Uni.Mach.SumTo.fin {A : Type u_1} {M : Type u_2} {K : Type u_3} [CommRing A] {P : Mach A M K} {σ : State M K} (hm : σ.mode ≠ P.mh) (F : Finset P.Step) (hF : ∀ (st : P.Step), st ∈ F ↔ Fire σ st) (S : P.Step → A) (B : ℤ) (h : ∀ st ∈ F, P.SumTo (nxt σ st) (S st) B) :
P.SumTo σ (∑ st ∈ F, P.wt st.1 * S st) (B + 1)

Branching step: finitely many fireable transitions with inductive SumTo bounds.

theorem Cslib.Circuits.Arithmetic.Separation.Uni.Mach.SumTo.none {A : Type u_1} {M : Type u_2} {K : Type u_3} [CommRing A] {P : Mach A M K} {σ : State M K} (hm : σ.mode ≠ P.mh) (h : ∀ (st : P.Step), ¬Fire σ st) (B : ℤ) :
P.SumTo σ 0 B

Stuck case: no transition can fire from a non-halting mode.

theorem Cslib.Circuits.Arithmetic.Separation.Uni.Mach.SumTo.one {A : Type u_1} {M : Type u_2} {K : Type u_3} [CommRing A] {P : Mach A M K} {σ : State M K} (hm : σ.mode ≠ P.mh) (st : P.Step) (hst : ∀ (st' : P.Step), Fire σ st' ↔ st' = st) {S : A} {B : ℤ} (h : P.SumTo (nxt σ st) S B) :
P.SumTo σ (P.wt st.1 * S) (B + 1)

Deterministic step: a unique transition fires from σ.

theorem Cslib.Circuits.Arithmetic.Separation.Uni.Mach.SumTo.two {A : Type u_1} {M : Type u_2} {K : Type u_3} [CommRing A] {P : Mach A M K} {σ : State M K} (hm : σ.mode ≠ P.mh) (st st₁ : P.Step) (hne : st ≠ st₁) (hst : ∀ (st' : P.Step), Fire σ st' ↔ st' = st ∨ st' = st₁) {S S₁ : A} {B : ℤ} (h : P.SumTo (nxt σ st) S B) (h₁ : P.SumTo (nxt σ st₁) S₁ B) :
P.SumTo σ (P.wt st.1 * S + P.wt st₁.1 * S₁) (B + 1)

Two-way branch: two distinct transitions fire from σ.