Documentation

CslibFrontier.Algorithms.Reachability.MinIsolation.Generator.SeedDigits

Native read-only seed accumulation #

Read a seed word in index order. A code-bit function of the retained context and the index masks each bit before the shared base-six update. The first absent bit halts the scan. The resource certificate assumes a native linear-space code-bit function on the encoded context and binary index.

The code context and the registers for a single read-only seed scan.

  • context : κ

    Retained parameters of the code-bit calculation.

  • cursor : ℕ

    The index of the next seed bit.

  • accumulator : ℕ

    The base-six value of the masked prefix.

  • done : Bool

    Whether the input end was reached.

Framed context, binary index and binary accumulator, followed by the unframed end flag.

theorem Cslib.Reachability.Hoza.SeedDigits.encState_mk_inO (κ : Type) (encContext : κ ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → κ} {T0 S0 x1 T1 S1 x2 T2 S2 : γ → ℕ} {x3 : γ → Bool} {T3 S3 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn encContext T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encNat T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encNat T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn Turing.MultiTapeTM.encBool T3 S3) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { context := x0 x, cursor := x1 x, accumulator := x2 x, done := x3 x }) encIn (encState κ encContext) (fun (x : γ) => T0 x + (T1 x + (T2 x + T3 x))) fun (x : γ) => S0 x + (S1 x + (S2 x + S3 x))
theorem Cslib.Reachability.Hoza.SeedDigits.encState_done_inO (κ : Type) (encContext : κ ↪ List Bool) :
Turing.MultiTapeTM.ComputableInO State.done (encState κ encContext) Turing.MultiTapeTM.encBool (fun (a : State κ) => ((encState κ encContext) a).length) fun (a : State κ) => ((encState κ encContext) a).length
theorem Cslib.Reachability.Hoza.SeedDigits.encState_context_budget (κ : Type) (encContext : κ ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → State κ} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encState κ encContext) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).context) encIn✝ encContext S✝
theorem Cslib.Reachability.Hoza.SeedDigits.encState_context_length_le (κ : Type) (encContext : κ ↪ List Bool) (a : State κ) :
(encContext a.context).length ≤ ((encState κ encContext) a).length
theorem Cslib.Reachability.Hoza.SeedDigits.encState_done_budget (κ : Type) (encContext : κ ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → State κ} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encState κ encContext) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).done) encIn✝ Turing.MultiTapeTM.encBool S✝
theorem Cslib.Reachability.Hoza.SeedDigits.encState_done_polyTime (κ : Type) (encContext : κ ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → State κ} :
theorem Cslib.Reachability.Hoza.SeedDigits.encState_cursor_budget (κ : Type) (encContext : κ ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → State κ} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encState κ encContext) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).cursor) encIn✝ Turing.MultiTapeTM.encNat S✝
theorem Cslib.Reachability.Hoza.SeedDigits.encState_accumulator_polyTime (κ : Type) (encContext : κ ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → State κ} :
theorem Cslib.Reachability.Hoza.SeedDigits.encState_context_polyTime (κ : Type) (encContext : κ ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → State κ} :
Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encState κ encContext) → Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).context) encIn✝ encContext
theorem Cslib.Reachability.Hoza.SeedDigits.encState_accumulator_budget (κ : Type) (encContext : κ ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → State κ} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encState κ encContext) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).accumulator) encIn✝ Turing.MultiTapeTM.encNat S✝
@[reducible, inline]

The tuple of the fields of encState.

theorem Cslib.Reachability.Hoza.SeedDigits.encState_mk_budget (κ : Type) (encContext : κ ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → κ} {x1 x2 : γ → ℕ} {x3 : γ → Bool} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn encContext budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encNat budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encNat budget) (h3 : Turing.MultiTapeTM.ComputableInSpace x3 encIn Turing.MultiTapeTM.encBool budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { context := x0 x, cursor := x1 x, accumulator := x2 x, done := x3 x }) encIn (encState κ encContext) budget
theorem Cslib.Reachability.Hoza.SeedDigits.encState_mk_deg (κ : Type) (encContext : κ ↪ List Bool) :
Turing.MultiTapeTM.ComputableInDegree (fun (p : κ × ℕ × ℕ × Bool) => { context := p.1, cursor := p.2.1, accumulator := p.2.2.1, done := p.2.2.2 }) (encStateFields κ encContext) (encState κ encContext) 1 1
theorem Cslib.Reachability.Hoza.SeedDigits.encState_cursor_inO (κ : Type) (encContext : κ ↪ List Bool) :
Turing.MultiTapeTM.ComputableInO State.cursor (encState κ encContext) Turing.MultiTapeTM.encNat (fun (a : State κ) => ((encState κ encContext) a).length) fun (a : State κ) => ((encState κ encContext) a).length
theorem Cslib.Reachability.Hoza.SeedDigits.encState_cursor_polyTime (κ : Type) (encContext : κ ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → State κ} :
theorem Cslib.Reachability.Hoza.SeedDigits.encState_context_inO (κ : Type) (encContext : κ ↪ List Bool) :
Turing.MultiTapeTM.ComputableInO State.context (encState κ encContext) encContext (fun (a : State κ) => ((encState κ encContext) a).length) fun (a : State κ) => ((encState κ encContext) a).length
@[simp]
theorem Cslib.Reachability.Hoza.SeedDigits.encState_apply (κ : Type) (encContext : κ ↪ List Bool) (a : State κ) :
(encState κ encContext) a = (encStateFields κ encContext) (a.context, a.cursor, a.accumulator, a.done)
theorem Cslib.Reachability.Hoza.SeedDigits.encState_mk_polyTime (κ : Type) (encContext : κ ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → κ} {x1 x2 : γ → ℕ} {x3 : γ → Bool} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn encContext) (h1 : Turing.MultiTapeTM.ComputableInPolyTime x1 encIn Turing.MultiTapeTM.encNat) (h2 : Turing.MultiTapeTM.ComputableInPolyTime x2 encIn Turing.MultiTapeTM.encNat) (h3 : Turing.MultiTapeTM.ComputableInPolyTime x3 encIn Turing.MultiTapeTM.encBool) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { context := x0 x, cursor := x1 x, accumulator := x2 x, done := x3 x }) encIn (encState κ encContext)
theorem Cslib.Reachability.Hoza.SeedDigits.encState_accumulator_inO (κ : Type) (encContext : κ ↪ List Bool) :
Turing.MultiTapeTM.ComputableInO State.accumulator (encState κ encContext) Turing.MultiTapeTM.encNat (fun (a : State κ) => ((encState κ encContext) a).length) fun (a : State κ) => ((encState κ encContext) a).length
def Cslib.Reachability.Hoza.SeedDigits.machine {κ : Type} (code : κ → ℕ → Bool) (context : κ) :

Scan the seed from index zero and return the accumulated binary weight at the first absent input bit.

theorem Cslib.Reachability.Hoza.SeedDigits.run_prefix {κ : Type} (code : κ → ℕ → Bool) (context : κ) (seed : List Bool) (t : ℕ) (ht : t ≤ seed.length) :
(machine code context).run seed t = { context := context, cursor := t, accumulator := maskedPrefix (code context) seed t, done := false }

A prefix of present bits leaves the scan live and returns its exact base-six value.

theorem Cslib.Reachability.Hoza.SeedDigits.run_at_end {κ : Type} (code : κ → ℕ → Bool) (context : κ) (seed : List Bool) :
(machine code context).run seed (seed.length + 1) = { context := context, cursor := seed.length, accumulator := maskedPrefix (code context) seed seed.length, done := true }

Reading the first missing bit halts and retains the value of the complete seed.

theorem Cslib.Reachability.Hoza.SeedDigits.length_run_le {κ : Type} (encContext : κ ↪ List Bool) (code : κ → ℕ → Bool) (context : κ) (seed : List Bool) (t : ℕ) :
((encState κ encContext) ((machine code context).run seed t)).length ≤ 2 * (encContext context).length + 8 * seed.length + 4

The retained code context and both numeric registers fit the stated bound at every clock.

The five scan components have native linear-space certificates given a binary-indexed code-bit certificate on the retained context.

theorem Cslib.Reachability.Hoza.SeedDigits.run_withFinish {κ : Type} (code : κ → ℕ → Bool) (context : κ) (seed : List Bool) (finish : State κ → ℕ) :
have M := have __src := machine code context; { init := __src.init, query := __src.query, next := __src.next, emit := __src.emit, halted := __src.halted, finish := fun (s : State κ) => Turing.MultiTapeTM.encNat (finish s) }; (∀ t < seed.length + 1, M.halted (M.run seed t) = false) ∧ M.halted (M.run seed (seed.length + 1)) = true ∧ M.output seed (seed.length + 1) = Turing.MultiTapeTM.encNat (finish { context := context, cursor := seed.length, accumulator := maskedPrefix (code context) seed seed.length, done := true })

Replacing the finish handler preserves first halt at the first absent bit. The emitted word is the new handler applied to the final registers.

theorem Cslib.Reachability.Hoza.SeedDigits.scanWithFinish_inSpace {κ : Type} (encContext : κ ↪ List Bool) (code : κ → ℕ → Bool) (context : κ) (finish : State κ → ℕ) (hc : Turing.MultiTapeTM.ComputableInSpace (fun (p : κ × ℕ) => code p.1 p.2) (Turing.MultiTapeTM.encPair encContext Turing.MultiTapeTM.encNat) Turing.MultiTapeTM.encBool fun (p : κ × ℕ) => ((Turing.MultiTapeTM.encPair encContext Turing.MultiTapeTM.encNat) p).length) (hf : Turing.MultiTapeTM.ComputableInSpace finish (encState κ encContext) Turing.MultiTapeTM.encNat fun (s : State κ) => ((encState κ encContext) s).length) :
Turing.MultiTapeTM.ComputableInSpace (fun (seed : List Bool) => finish { context := context, cursor := seed.length, accumulator := maskedPrefix (code context) seed seed.length, done := true }) Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encNat List.length

For a fixed initial context, the native raw seed scan can return any certified binary function of the final registers. The output length is charged to the workspace bound.

For a fixed initial code context, accumulate a raw seed word in native linear space. The uniform code-bit certificate is used at every read.