Quantification and first-event tests on binary intervals #
An interval endpoint can have exponential value but polynomial binary length. Existential and universal quantification cost one function level; testing a property of the first event costs two. These rules use one evaluator for all indices, including nested indices.
theorem Cslib.Complexity.CountingFunction.exists_range {α : Type} {enc : α ↪ List Bool} {a : ℕ} (D : Turing.MultiTapeTM.Decoder enc) {V : α × ℕ → Bool} {r : α → ℕ} (hV : V ∈ CountingFunction a (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encNat) Turing.MultiTapeTM.encBool) (hr : Turing.MultiTapeTM.ComputableInPolyTime r enc Turing.MultiTapeTM.encNat) :
(fun (x : α) => decide (∃ i < r x, V (x, i) = true)) ∈ CountingFunction (a + 1) enc Turing.MultiTapeTM.encBool
Existential quantification over a short binary interval costs one function level.
theorem Cslib.Complexity.CountingFunction.forall_range {α : Type} {enc : α ↪ List Bool} {a : ℕ} (D : Turing.MultiTapeTM.Decoder enc) {V : α × ℕ → Bool} {r : α → ℕ} (hV : V ∈ CountingFunction a (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encNat) Turing.MultiTapeTM.encBool) (hr : Turing.MultiTapeTM.ComputableInPolyTime r enc Turing.MultiTapeTM.encNat) :
(fun (x : α) => decide (∀ i < r x, V (x, i) = true)) ∈ CountingFunction (a + 1) enc Turing.MultiTapeTM.encBool
Universal quantification over a short binary interval also costs one function level.
theorem Cslib.Complexity.firstEventTest_mem_CountingFunction {α : Type} {enc : α ↪ List Bool} {a : ℕ} (D : Turing.MultiTapeTM.Decoder enc) {event test : α × ℕ → Bool} {r : α → ℕ} (hevent :
event ∈ CountingFunction a (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encNat) Turing.MultiTapeTM.encBool) (htest :
test ∈ CountingFunction a (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encNat) Turing.MultiTapeTM.encBool) (hr : Turing.MultiTapeTM.ComputableInPolyTime r enc Turing.MultiTapeTM.encNat) :
A test at the first event on a short binary interval uses two function levels. The inner universal test and outer existential test have fixed uniform evaluators.