Documentation

CslibFrontier.Computability.TreeEval.Ary.Packed.QueryGateSpace

Native components of the same-input packed interpolation loop #

All parameters, assignment and sum counters, the point and the supplier context are charged in the encoded caller state. Supplier initialization and extracting its answer have explicit native space premises. These local certificates feed the existing query-machine compiler; the supplier run-state bounds and the assignment limit are additional obligations of its consumer.

@[reducible, inline]

Binary parameters, retaining the explicitly encoded supplier context.

@[reducible, inline]

One caller state, with one assignment counter and one accumulator.

@[reducible, inline]

The active caller or one suspended caller with one callee state.

theorem Cslib.TreeEval.Ary.Packed.QueryGate.sumState_encoding_le {γ : Type} (encG : γ ↪ List Bool) (q : Params γ) (table : ℕ → ℕ) (j : ℕ) (hj : j ≤ q.limit) (hp : 0 < q.modulus) :
((encState encG) (sumState q table j)).length ≤ 8 * (((encParams encG) q).length + 1)

A completed-call prefix stores only its parameters and binary counters. In particular, the number of table assignments does not multiply the retained point or context.

theorem Cslib.TreeEval.Ary.Packed.QueryGate.runFrom_one_encoding_le {γ τ : Type} (encG : γ ↪ List Bool) (encT : τ ↪ List Bool) (q : Params γ) (N : Turing.QueryMachine τ) (start : State γ → τ) (answer : τ → ℕ) (w : List Bool) (table : ℕ → ℕ) (j T B : ℕ) (hj : j < q.limit) (hp : 0 < q.modulus) (hpre : ∀ i < T, N.halted (N.runFrom w (start (sumState q table j)) i) = false) (hhalt : N.halted (N.runFrom w (start (sumState q table j)) T) = true) (hanswer : answer (N.runFrom w (start (sumState q table j)) T) = table j) (hsize : ∀ i ≤ T, (encT (N.runFrom w (start (sumState q table j)) i)).length ≤ B) (i : ℕ) (hi : i ≤ T + 2) :
((encMachineState encG encT) ((machine q N start answer).runFrom w (Sum.inl (sumState q table j)) i)).length ≤ 16 * (((encParams encG) q).length + 1) + B + 2

Every physical prefix of one returned table call pays for one caller and the actual callee state. The retained point and context are not multiplied by the number of assignments.

theorem Cslib.TreeEval.Ary.Packed.QueryGate.exists_runFrom_sumState_encoding_le {γ τ : Type} (encG : γ ↪ List Bool) (encT : τ ↪ List Bool) (q : Params γ) (N : Turing.QueryMachine τ) (start : State γ → τ) (answer : τ → ℕ) (w : List Bool) (table : ℕ → ℕ) (B : ℕ) (hp : 0 < q.modulus) (hsupplier : ∀ j < q.limit, ∃ (T : ℕ), (∀ i < T, N.halted (N.runFrom w (start (sumState q table j)) i) = false) ∧ N.halted (N.runFrom w (start (sumState q table j)) T) = true ∧ answer (N.runFrom w (start (sumState q table j)) T) = table j ∧ ∀ i ≤ T, (encT (N.runFrom w (start (sumState q table j)) i)).length ≤ B) (j : ℕ) (hj : j ≤ q.limit) :
∃ (T : ℕ), (machine q N start answer).runFrom w (Sum.inl (initial q)) T = Sum.inl (sumState q table j) ∧ ∀ i ≤ T, ((encMachineState encG encT) ((machine q N start answer).runFrom w (Sum.inl (initial q)) i)).length ≤ 16 * (((encParams encG) q).length + 1) + B + 2

Concatenating table calls preserves one uniform physical-state bound for the whole assignment loop, including all callee steps rather than only completed-call boundaries.

theorem Cslib.TreeEval.Ary.Packed.QueryGate.request_inSpace {γ τ : Type} (encG : γ ↪ List Bool) (encT : τ ↪ List Bool) (start : State γ → τ) (hstart : Turing.MultiTapeTM.ComputableInSpace start (encState encG) encT fun (q : State γ) => ((encState encG) q).length) :

Supplier initialization is charged before making each request.

theorem Cslib.TreeEval.Ary.Packed.QueryGate.resume_inSpace {γ τ : Type} (encG : γ ↪ List Bool) (encT : τ ↪ List Bool) (answer : τ → ℕ) (hanswer : Turing.MultiTapeTM.ComputableInSpace answer encT Turing.MultiTapeTM.encNat fun (t : τ) => (encT t).length) :
Turing.MultiTapeTM.ComputableInSpace (fun (q : State γ × τ) => resume answer q.1 q.2) (Turing.MultiTapeTM.encPair (encState encG) encT) (encState encG) fun (q : State γ × τ) => ((Turing.MultiTapeTM.encPair (encState encG) encT) q).length

Resumption computes the complete existing coordinate weight and one modular sum update. The cost of extracting the returned table value is explicitly required.

Testing the limit uses only binary comparison of the counter and the supplied limit.

theorem Cslib.TreeEval.Ary.Packed.QueryGate.machine_query_inSpace {γ τ : Type} (encG : γ ↪ List Bool) (encT : τ ↪ List Bool) (q : Params γ) (N : Turing.QueryMachine τ) (start : State γ → τ) (answer : τ → ℕ) (hquery : Turing.MultiTapeTM.ComputableInSpace N.query encT Turing.MultiTapeTM.encNat fun (t : τ) => (encT t).length) (hstart : Turing.MultiTapeTM.ComputableInSpace start (encState encG) encT fun (st : State γ) => ((encState encG) st).length) :

The assignment caller's query component, including supplier initialization.

Both the table subroutine's output and the assignment caller's output are silent.

theorem Cslib.TreeEval.Ary.Packed.QueryGate.machine_halted_inSpace {γ τ : Type} (encG : γ ↪ List Bool) (encT : τ ↪ List Bool) (q : Params γ) (N : Turing.QueryMachine τ) (start : State γ → τ) (answer : τ → ℕ) :

The composite halts exactly when the assignment caller reaches its supplied limit.

theorem Cslib.TreeEval.Ary.Packed.QueryGate.machine_finish_inSpace {γ τ : Type} (encG : γ ↪ List Bool) (encT : τ ↪ List Bool) (q : Params γ) (N : Turing.QueryMachine τ) (start : State γ → τ) (answer : τ → ℕ) :

The result is retained in the state rather than emitted as an uncharged return word.