Uncompiled conditional query trees for signed-digit streams #
This module provides uncompiled deterministic conditional query-tree semantics and active-query tracing as an intermediate helper after, and not a formalization of, [OpenAI2026LogSpace, Section 10.1, Lemma 10.2]. Native Turing-machine or counter-program space realization of regenerated gate evaluation remains open and is tracked in #9181.
A QueryProg Op Struct α represents a deterministic finite query tree that:
- queries operand stream digits
(op, j)(queryDigit), - queries structural predicates
sOp(queryStruct), and - returns a value of type
α(ret).
Continuations in QueryProg (queryDigit, queryStruct), post-processing maps
(QueryProg.map), and leaf predicates (CondBoolTree.digitBit) are arbitrary host Lean
functions. Accordingly, this module certifies only exact evaluation semantics (eval),
executed-query tracing (activeQueries) with unselected-branch exclusion, query substitution
(substDigits), and a query-count bound for CondBoolTree.toQueryProg. It makes no claim about
uniformity, computability, or Turing-machine workspace.
Main definitions #
Cslib.StreamArithmetic.QueryEvent: a single executed operand-digit or structural query.Cslib.StreamArithmetic.QueryProg: uncompiled deterministic finite conditional query tree.Cslib.StreamArithmetic.QueryProg.bind: sequential composition of conditional query trees.Cslib.StreamArithmetic.QueryProg.substDigits: substitution of subprograms for operand digit queries.Cslib.StreamArithmetic.CondBoolTree: uncompiled conditional binary Boolean tree after [OpenAI2026LogSpace, Lemma 10.2].
Main results #
Cslib.StreamArithmetic.QueryProg.eval_bind,activeQueries_bind: evaluation semantics and executed-query trace of sequential composition.Cslib.StreamArithmetic.QueryProg.eval_substDigits,mem_activeQueries_substDigits: evaluation semantics and executed-query characterization under digit substitution.Cslib.StreamArithmetic.CondBoolTree.toQueryProg_eval,CondBoolTree.length_activeQueries_toQueryProg_le: evaluation equivalence and short-circuiting query-count bound (≤ 2 ^ depth) for uncompiledCondBoolTreetrees.
References #
- OpenAI, Exact Derandomization of Logarithmic Space: L = RL = BPL,
Section 10.1 (after Lemma 10.2; 23 September 2026, revision
7ef5c0cc, not peer reviewed).
An oracle query event executed along the active branch of a QueryProg, recording the
requested operand/place or structural predicate.
- digit {Op : Type u} {Struct : Type v} (op : Op) (place : ℕ) : QueryEvent Op Struct
- struct {Op : Type u} {Struct : Type v} (sOp : Struct) : QueryEvent Op Struct
Uncompiled deterministic finite conditional query tree over operand streams Op and
structural predicates Struct, returning α. Continuations are arbitrary host Lean functions;
this type carries no machine-space or uniformity semantics (see #9181).
- ret {Op : Type u} {Struct : Type v} {α : Type w} (val : α) : QueryProg Op Struct α
- queryDigit {Op : Type u} {Struct : Type v} {α : Type w} (op : Op) (place : ℕ) (next : ℤ → QueryProg Op Struct α) : QueryProg Op Struct α
- queryStruct {Op : Type u} {Struct : Type v} {α : Type w} (sOp : Struct) (next : Bool → QueryProg Op Struct α) : QueryProg Op Struct α
Ordered trace of all oracle queries actually executed along (env, sEnv). Unselected branches
are not traversed and do not appear in the trace.
Host-level post-processing of the return value; preserves activeQueries.
Substitute child query trees child op u for every operand digit query (op, u) in prog.
Structural queries on Struct pass through unchanged.
Semantic soundness of substDigits: evaluating the composed query tree equals evaluating
prog against the stream environment produced by child.
Characterization of every oracle query emitted by prog.substDigits child: it is either a
pass-through structural query of prog, or a query emitted by child op u for some active digit
query (op, u) of prog.
Uncompiled bounded-fan-in conditional Boolean tree after, and not a machine-space formalization of, [OpenAI2026LogSpace, Lemma 10.2] (native space realization is tracked in #9181):
- constants
const b, - unary negation
notGate c, - binary
andGate c₁ c₂andorGate c₁ c₂, - conditional selector
condGate sel onTrue onFalse(evaluatesselfirst, then only the selected branch), - digit-bit leaf
digitBit op j bitPredtesting a host Lean predicate of digit(op, j), - structural leaf
structLeaf sOp.
- const {Op : Type u} {Struct : Type v} (b : Bool) : CondBoolTree Op Struct
- notGate {Op : Type u} {Struct : Type v} (child : CondBoolTree Op Struct) : CondBoolTree Op Struct
- andGate {Op : Type u} {Struct : Type v} (left right : CondBoolTree Op Struct) : CondBoolTree Op Struct
- orGate {Op : Type u} {Struct : Type v} (left right : CondBoolTree Op Struct) : CondBoolTree Op Struct
- condGate {Op : Type u} {Struct : Type v} (sel onTrue onFalse : CondBoolTree Op Struct) : CondBoolTree Op Struct
- digitBit {Op : Type u} {Struct : Type v} (op : Op) (place : ℕ) (bitPred : ℤ → Bool) : CondBoolTree Op Struct
- structLeaf {Op : Type u} {Struct : Type v} (sOp : Struct) : CondBoolTree Op Struct
Direct mathematical Boolean evaluation of a CondBoolTree.
Longest root-to-leaf syntactic depth of a CondBoolTree.
Uncompiled depth-first query-tree translation of a CondBoolTree (helper after, and not a
formalization of, [OpenAI2026LogSpace, Lemma 10.2]; native gate regeneration and stack-space
realization are tracked in #9181). Evaluating condGate sel t f queries sel first and then only
the selected branch.
Evaluation-equivalence helper for uncompiled CondBoolTree.toQueryProg (not a machine-space
formalization of [OpenAI2026LogSpace, Lemma 10.2]; see #9181).
Uncompiled query-count helper for CondBoolTree.toQueryProg (not a machine-space
formalization of [OpenAI2026LogSpace, Lemma 10.2]; see #9181): because condGate evaluates only
its selected branch, the number of executed leaf queries is at most 2 ^ tree.depth.