Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Complexity.LogSpace.Subdivision

Native subdivision adjacency from a weight function and a read-only edge callee #

The request carries binary vertex labels and chain offsets, together with caller context such as dimensions and a seed. A fixed caller invokes the original graph's same-input edge callee, then combines its returned bit with the source vertex's weight. The adapter adds no copy of the original input; retained query/context storage is charged explicitly. Native certificates are relative to the supplied weight routine and original-edge callee; constructing Hoza's weight routine remains in #6747.

Applying the interface #

Import this module and use Turing.QueryMachine.Subdivision. Supply a fixed original-edge QueryMachine, a compact-query-to-callee-state request function, a source-weight routine, and a decoder for the callee's returned state. callback_runFrom composes the actual same-input execution. edgeQuery_agrees supplies graph agreement from the original-edge answer and source weight. The request/context carries only what the caller chooses to retain; query_length_le_log charges that context explicitly and bounds polynomial coordinates by logarithmic storage.

callback_parts_inSpace consumes native linear-workspace certificates for the weight, request and answer functions and the base callee's query/next/halted components. Callee emissions and final words are discarded. callback_states_le separately bounds every persistent encoded state through return by 2*C+D+6 when the pending query has at most C bits and each base-callee state has at most D. It includes the suspended caller and framing. Native component workspace is charged by the component certificates, not by this state bound.

The checked client combines Hoza's generated weights with the unweighted transcript contract, exercises auxiliary and unused slots and a tied diamond, and composes an actual input-reading callee with graph agreement and the native certificate. Run scripts/build.sh CslibFrontierTests.WeightedSubdivision --wfail --iofail.

Main results #

Coordinates of a subdivision edge, together with its dimensions/seed context.

  • context : Context

    Compact parameters retained by the calling scan.

  • fromLabel : ℕ

    Original source vertex label in binary.

  • toLabel : ℕ

    Original target vertex label in binary.

  • fromOffset : ℕ

    Source chain offset in binary.

  • toOffset : ℕ

    Target chain offset in binary.

theorem Turing.QueryMachine.Subdivision.encQuery_context_budget {Context : Type} (encContext : Context ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Query Context} :
MultiTapeTM.ComputableInSpace g✝ encIn✝ (encQuery encContext) S✝ → MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).context) encIn✝ encContext S✝
theorem Turing.QueryMachine.Subdivision.encQuery_mk_polyTime {Context : Type} (encContext : Context ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Context} {x1 x2 x3 x4 : γ → ℕ} (h0 : MultiTapeTM.ComputableInPolyTime x0 encIn encContext) (h1 : MultiTapeTM.ComputableInPolyTime x1 encIn MultiTapeTM.encNat) (h2 : MultiTapeTM.ComputableInPolyTime x2 encIn MultiTapeTM.encNat) (h3 : MultiTapeTM.ComputableInPolyTime x3 encIn MultiTapeTM.encNat) (h4 : MultiTapeTM.ComputableInPolyTime x4 encIn MultiTapeTM.encNat) :
MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { context := x0 x, fromLabel := x1 x, toLabel := x2 x, fromOffset := x3 x, toOffset := x4 x }) encIn (encQuery encContext)
def Turing.QueryMachine.Subdivision.encQuery {Context : Type} (encContext : Context ↪ List Bool) :
Query Context ↪ List Bool

Context and the first three binary coordinates are framed; target offset is last.

@[simp]
theorem Turing.QueryMachine.Subdivision.encQuery_apply {Context : Type} (encContext : Context ↪ List Bool) (a : Query Context) :
theorem Turing.QueryMachine.Subdivision.encQuery_context_inO {Context : Type} (encContext : Context ↪ List Bool) :
MultiTapeTM.ComputableInO Query.context (encQuery encContext) encContext (fun (a : Query Context) => ((encQuery encContext) a).length) fun (a : Query Context) => ((encQuery encContext) a).length
theorem Turing.QueryMachine.Subdivision.encQuery_mk_budget {Context : Type} (encContext : Context ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → Context} {x1 x2 x3 x4 : γ → ℕ} (h0 : MultiTapeTM.ComputableInSpace x0 encIn encContext budget) (h1 : MultiTapeTM.ComputableInSpace x1 encIn MultiTapeTM.encNat budget) (h2 : MultiTapeTM.ComputableInSpace x2 encIn MultiTapeTM.encNat budget) (h3 : MultiTapeTM.ComputableInSpace x3 encIn MultiTapeTM.encNat budget) (h4 : MultiTapeTM.ComputableInSpace x4 encIn MultiTapeTM.encNat budget) :
MultiTapeTM.ComputableInSpace (fun (x : γ) => { context := x0 x, fromLabel := x1 x, toLabel := x2 x, fromOffset := x3 x, toOffset := x4 x }) encIn (encQuery encContext) budget
theorem Turing.QueryMachine.Subdivision.encQuery_toLabel_budget {Context : Type} (encContext : Context ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Query Context} :
MultiTapeTM.ComputableInSpace g✝ encIn✝ (encQuery encContext) S✝ → MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).toLabel) encIn✝ MultiTapeTM.encNat S✝
theorem Turing.QueryMachine.Subdivision.encQuery_toOffset_polyTime {Context : Type} (encContext : Context ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → Query Context} :
MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encQuery encContext) → MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).toOffset) encIn✝ MultiTapeTM.encNat
theorem Turing.QueryMachine.Subdivision.encQuery_mk_inO {Context : Type} (encContext : Context ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Context} {T0 S0 x1 T1 S1 x2 T2 S2 x3 T3 S3 x4 T4 S4 : γ → ℕ} (h0 : MultiTapeTM.ComputableInO x0 encIn encContext T0 S0) (h1 : MultiTapeTM.ComputableInO x1 encIn MultiTapeTM.encNat T1 S1) (h2 : MultiTapeTM.ComputableInO x2 encIn MultiTapeTM.encNat T2 S2) (h3 : MultiTapeTM.ComputableInO x3 encIn MultiTapeTM.encNat T3 S3) (h4 : MultiTapeTM.ComputableInO x4 encIn MultiTapeTM.encNat T4 S4) :
MultiTapeTM.ComputableInO (fun (x : γ) => { context := x0 x, fromLabel := x1 x, toLabel := x2 x, fromOffset := x3 x, toOffset := x4 x }) encIn (encQuery encContext) (fun (x : γ) => T0 x + (T1 x + (T2 x + (T3 x + T4 x)))) fun (x : γ) => S0 x + (S1 x + (S2 x + (S3 x + S4 x)))
theorem Turing.QueryMachine.Subdivision.encQuery_fromOffset_budget {Context : Type} (encContext : Context ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Query Context} :
MultiTapeTM.ComputableInSpace g✝ encIn✝ (encQuery encContext) S✝ → MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).fromOffset) encIn✝ MultiTapeTM.encNat S✝
theorem Turing.QueryMachine.Subdivision.encQuery_fields_deg {Context : Type} (encContext : Context ↪ List Bool) :
MultiTapeTM.ComputableInDegree (fun (a : Query Context) => (a.context, a.fromLabel, a.toLabel, a.fromOffset, a.toOffset)) (encQuery encContext) (encQueryFields encContext) 1 1
theorem Turing.QueryMachine.Subdivision.encQuery_toOffset_inO {Context : Type} (encContext : Context ↪ List Bool) :
MultiTapeTM.ComputableInO Query.toOffset (encQuery encContext) MultiTapeTM.encNat (fun (a : Query Context) => ((encQuery encContext) a).length) fun (a : Query Context) => ((encQuery encContext) a).length
theorem Turing.QueryMachine.Subdivision.encQuery_fromLabel_polyTime {Context : Type} (encContext : Context ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → Query Context} :
MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encQuery encContext) → MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).fromLabel) encIn✝ MultiTapeTM.encNat
theorem Turing.QueryMachine.Subdivision.encQuery_toOffset_budget {Context : Type} (encContext : Context ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Query Context} :
MultiTapeTM.ComputableInSpace g✝ encIn✝ (encQuery encContext) S✝ → MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).toOffset) encIn✝ MultiTapeTM.encNat S✝
theorem Turing.QueryMachine.Subdivision.encQuery_context_polyTime {Context : Type} (encContext : Context ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → Query Context} :
MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encQuery encContext) → MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).context) encIn✝ encContext
theorem Turing.QueryMachine.Subdivision.encQuery_toOffset_length_le {Context : Type} (encContext : Context ↪ List Bool) (a : Query Context) :
@[reducible, inline]
abbrev Turing.QueryMachine.Subdivision.encQueryFields {Context : Type} (encContext : Context ↪ List Bool) :

The tuple of the fields of encQuery.

theorem Turing.QueryMachine.Subdivision.encQuery_toLabel_polyTime {Context : Type} (encContext : Context ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → Query Context} :
MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encQuery encContext) → MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).toLabel) encIn✝ MultiTapeTM.encNat
theorem Turing.QueryMachine.Subdivision.encQuery_context_length_le {Context : Type} (encContext : Context ↪ List Bool) (a : Query Context) :
(encContext a.context).length ≤ ((encQuery encContext) a).length
theorem Turing.QueryMachine.Subdivision.encQuery_mk_deg {Context : Type} (encContext : Context ↪ List Bool) :
MultiTapeTM.ComputableInDegree (fun (p : Context × ℕ × ℕ × ℕ × ℕ) => { context := p.1, fromLabel := p.2.1, toLabel := p.2.2.1, fromOffset := p.2.2.2.1, toOffset := p.2.2.2.2 }) (encQueryFields encContext) (encQuery encContext) 1 1
theorem Turing.QueryMachine.Subdivision.encQuery_fromOffset_polyTime {Context : Type} (encContext : Context ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → Query Context} :
MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encQuery encContext) → MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).fromOffset) encIn✝ MultiTapeTM.encNat
theorem Turing.QueryMachine.Subdivision.encQuery_fromLabel_budget {Context : Type} (encContext : Context ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Query Context} :
MultiTapeTM.ComputableInSpace g✝ encIn✝ (encQuery encContext) S✝ → MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).fromLabel) encIn✝ MultiTapeTM.encNat S✝
theorem Turing.QueryMachine.Subdivision.encQuery_fromLabel_inO {Context : Type} (encContext : Context ↪ List Bool) :
MultiTapeTM.ComputableInO Query.fromLabel (encQuery encContext) MultiTapeTM.encNat (fun (a : Query Context) => ((encQuery encContext) a).length) fun (a : Query Context) => ((encQuery encContext) a).length
theorem Turing.QueryMachine.Subdivision.encQuery_fromOffset_inO {Context : Type} (encContext : Context ↪ List Bool) :
MultiTapeTM.ComputableInO Query.fromOffset (encQuery encContext) MultiTapeTM.encNat (fun (a : Query Context) => ((encQuery encContext) a).length) fun (a : Query Context) => ((encQuery encContext) a).length
theorem Turing.QueryMachine.Subdivision.encQuery_toLabel_length_le {Context : Type} (encContext : Context ↪ List Bool) (a : Query Context) :
theorem Turing.QueryMachine.Subdivision.encQuery_toLabel_inO {Context : Type} (encContext : Context ↪ List Bool) :
MultiTapeTM.ComputableInO Query.toLabel (encQuery encContext) MultiTapeTM.encNat (fun (a : Query Context) => ((encQuery encContext) a).length) fun (a : Query Context) => ((encQuery encContext) a).length
def Turing.QueryMachine.Subdivision.edgeQuery {Context : Type} (q : Query Context) (sourceWeight : ℕ) (baseEdge : Bool) :

Decide a subdivision edge using the source weight and the original-edge answer.

theorem Turing.QueryMachine.Subdivision.edgeQuery_agrees {Context : Type} {V : Type u_1} (G : Cslib.LayeredDigraph V) (label : V ↪ ℕ) (weight : V → ℕ) (bound : ℕ) (ctx : Context) (a b : Cslib.LayeredDigraph.Subdivision.Vertex V bound) (baseEdge : Bool) (hbase : baseEdge = true ↔ G.Adj a.vertex b.vertex) :
edgeQuery { context := ctx, fromLabel := label a.vertex, toLabel := label b.vertex, fromOffset := ↑a.offset, toOffset := ↑b.offset } (weight a.vertex) baseEdge = true ↔ (Cslib.LayeredDigraph.Subdivision.graph G weight bound).Adj a b

The Boolean kernel agrees with the mathematical subdivision, including unused offsets.

@[reducible, inline]
abbrev Turing.QueryMachine.Subdivision.encCaller {Context : Type} (encContext : Context ↪ List Bool) :

Pending compact query or returned Boolean, preceded by one sum tag.

def Turing.QueryMachine.Subdivision.callback {Context τ : Type} (N : QueryMachine τ) (baseRequest : Query Context → τ) (weight : Query Context → ℕ) (answer : τ → Bool) :
QueryMachine ((Query Context ⊕ Bool) ⊕ (Query Context ⊕ Bool) × τ)

The native adjacency callback, with actual original-input reads delegated to N.

@[reducible, inline]
abbrev Turing.QueryMachine.Subdivision.encCallback {Context τ : Type} (encContext : Context ↪ List Bool) (encT : τ ↪ List Bool) :
(Query Context ⊕ Bool) ⊕ (Query Context ⊕ Bool) × τ ↪ List Bool

Caller and suspended-callee states, with the caller framed while a call is active.

def Turing.QueryMachine.Subdivision.callbackVerdict {Context τ : Type} :
(Query Context ⊕ Bool) ⊕ (Query Context ⊕ Bool) × τ → Bool

Read the returned subdivision answer. States that have yet to return give false.

theorem Turing.QueryMachine.Subdivision.callbackVerdict_inSpace {Context τ : Type} (encContext : Context ↪ List Bool) (encT : τ ↪ List Bool) :
MultiTapeTM.ComputableInSpace callbackVerdict (encCallback encContext encT) MultiTapeTM.encBool fun (s : (Query Context ⊕ Bool) ⊕ (Query Context ⊕ Bool) × τ) => ((encCallback encContext encT) s).length

Decoding the returned Boolean uses linear native workspace in the callback state.

theorem Turing.QueryMachine.Subdivision.callback_runFrom {Context τ : Type} (N : QueryMachine τ) (baseRequest : Query Context → τ) (weight : Query Context → ℕ) (answer : τ → Bool) (w : List Bool) (q : Query Context) (T : ℕ) (hpre : ∀ i < T, N.halted (N.runFrom w (baseRequest q) i) = false) (hhalt : N.halted (N.runFrom w (baseRequest q) T) = true) :
(callback N baseRequest weight answer).runFrom w (Sum.inl (Sum.inl q)) (T + 2) = Sum.inl (Sum.inr (edgeQuery q (weight q) (answer (N.runFrom w (baseRequest q) T))))

Running the supplied read-only callee returns the subdivision answer after its own first-halting time plus call entry and return. No answer bit is assumed in the initial query.

theorem Turing.QueryMachine.Subdivision.callback_first_halt {Context τ : Type} (N : QueryMachine τ) (baseRequest : Query Context → τ) (weight : Query Context → ℕ) (answer : τ → Bool) (w : List Bool) (q : Query Context) (T : ℕ) (hpre : ∀ i < T, N.halted (N.runFrom w (baseRequest q) i) = false) (hhalt : N.halted (N.runFrom w (baseRequest q) T) = true) :
(∀ t < T + 2, (callback N baseRequest weight answer).halted ((callback N baseRequest weight answer).runFrom w (Sum.inl (Sum.inl q)) t) = false) ∧ (callback N baseRequest weight answer).halted ((callback N baseRequest weight answer).runFrom w (Sum.inl (Sum.inl q)) (T + 2)) = true

The pending subdivision caller first halts two steps after its callee's first halt.

theorem Turing.QueryMachine.Subdivision.callback_parts_inSpace {Context τ : Type} (encContext : Context ↪ List Bool) (encT : τ ↪ List Bool) (N : QueryMachine τ) (baseRequest : Query Context → τ) (weight : Query Context → ℕ) (answer : τ → Bool) (hr : MultiTapeTM.ComputableInSpace baseRequest (encQuery encContext) encT fun (q : Query Context) => ((encQuery encContext) q).length) (hw : MultiTapeTM.ComputableInSpace weight (encQuery encContext) MultiTapeTM.encNat fun (q : Query Context) => ((encQuery encContext) q).length) (ha : MultiTapeTM.ComputableInSpace answer encT MultiTapeTM.encBool fun (t : τ) => (encT t).length) (hnq : MultiTapeTM.ComputableInSpace N.query encT MultiTapeTM.encNat fun (t : τ) => (encT t).length) (hnn : MultiTapeTM.ComputableInSpace N.next (encStateRead encT) encT fun (p : τ × Option Bool) => ((encStateRead encT) p).length) (hnh : MultiTapeTM.ComputableInSpace N.halted encT MultiTapeTM.encBool fun (t : τ) => (encT t).length) :
(MultiTapeTM.ComputableInSpace (callback N baseRequest weight answer).query (encCallback encContext encT) MultiTapeTM.encNat fun (s : (Query Context ⊕ Bool) ⊕ (Query Context ⊕ Bool) × τ) => ((encCallback encContext encT) s).length) ∧ (MultiTapeTM.ComputableInSpace (callback N baseRequest weight answer).next (encStateRead (encCallback encContext encT)) (encCallback encContext encT) fun (p : ((Query Context ⊕ Bool) ⊕ (Query Context ⊕ Bool) × τ) × Option Bool) => ((encStateRead (encCallback encContext encT)) p).length) ∧ (MultiTapeTM.ComputableInSpace (callback N baseRequest weight answer).halted (encCallback encContext encT) MultiTapeTM.encBool fun (s : (Query Context ⊕ Bool) ⊕ (Query Context ⊕ Bool) × τ) => ((encCallback encContext encT) s).length) ∧ (MultiTapeTM.ComputableInSpace (callback N baseRequest weight answer).emit (encStateRead (encCallback encContext encT)) MultiTapeTM.encBits fun (p : ((Query Context ⊕ Bool) ⊕ (Query Context ⊕ Bool) × τ) × Option Bool) => ((encStateRead (encCallback encContext encT)) p).length) ∧ MultiTapeTM.ComputableInSpace (callback N baseRequest weight answer).finish (encCallback encContext encT) MultiTapeTM.encBits fun (s : (Query Context ⊕ Bool) ⊕ (Query Context ⊕ Bool) × τ) => ((encCallback encContext encT) s).length

All five components of the same-input subdivision callback use linear compact-state workspace, relative to the native weight routine and original-edge callee. The callee's emissions and finish routine are discarded by the state-returning call and need no bounds.

theorem Turing.QueryMachine.Subdivision.callback_states_le {Context τ : Type} (encContext : Context ↪ List Bool) (encT : τ ↪ List Bool) (N : QueryMachine τ) (baseRequest : Query Context → τ) (weight : Query Context → ℕ) (answer : τ → Bool) (w : List Bool) (q : Query Context) (T C D : ℕ) (hpre : ∀ i < T, N.halted (N.runFrom w (baseRequest q) i) = false) (hhalt : N.halted (N.runFrom w (baseRequest q) T) = true) (hq : ((encQuery encContext) q).length ≤ C) (hcallee : ∀ i ≤ T, (encT (N.runFrom w (baseRequest q) i)).length ≤ D) (t : ℕ) (ht : t ≤ T + 2) :
((encCallback encContext encT) ((callback N baseRequest weight answer).runFrom w (Sum.inl (Sum.inl q)) t)).length ≤ 2 * C + D + 6

If the request has at most C bits and the base edge callee has at most D bits through its first halt, the whole call has at most 2*C+D+6 bits through its return. Thus logarithmic query and callee-state bounds compose, with retained context included in C.

theorem Turing.QueryMachine.Subdivision.query_length_le_log {Context : Type} (encContext : Context ↪ List Bool) (q : Query Context) (n d : ℕ) (hf : q.fromLabel ≤ (n + 2) ^ d) (ht : q.toLabel ≤ (n + 2) ^ d) (hi : q.fromOffset ≤ (n + 2) ^ d) (hj : q.toOffset ≤ (n + 2) ^ d) :
((encQuery encContext) q).length ≤ 2 * (encContext q.context).length + 8 * ((d + 1) * ((n + 1).log2 + 1)) + 8

Polynomially bounded labels and offsets add only logarithmic storage to the explicitly charged context. In particular, a logarithmic seed/dimensions context stays logarithmic.