Documentation

CslibFrontier.Computability.TreeEval.Reader.Encode

Encodings of the states of the Tree Evaluation read machine #

The states of Cslib.TreeEval.Reader.machine are encoded as records preserving their grouped tuple wire layout: the value length, the height and the prime in binary, the registers as lists of binary naturals, the stack as a list of frames, each a binary round with finitely many other fields, the mode as a finite tag, and the control state as CtlTuple (a tag with two binary naturals and a list of them).

Main definitions #

Unpacked control state of Cslib.TreeEval.Reader.machine: a constructor tag, two natural counters, and a residue accumulator list.

  • tag : Fin 7

    Constructor tag (0..6 for hdrLength, hdrHeight, prime, run, leaf, scan, done).

  • n₁ : ℕ

    First counter (n, q, i, or k; 0 in other phases).

  • n₂ : ℕ

    Second counter (d in prime; 0 in other phases).

  • acc : List ℕ

    Sum accumulator (acc in scan; [] in other phases).

theorem Cslib.TreeEval.Reader.CtlTuple.ext {x y : CtlTuple} (tag : x.tag = y.tag) (n₁ : x.n₁ = y.n₁) (n₂ : x.n₂ = y.n₂) (acc : x.acc = y.acc) :
x = y

The control state unpacked into a CtlTuple.

theorem Cslib.TreeEval.Reader.encCtlTuple_n₁_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → CtlTuple} :
theorem Cslib.TreeEval.Reader.encCtlTuple_n₂_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → CtlTuple} :
@[reducible, inline]

The tuple of the fields of encCtlTuple.

theorem Cslib.TreeEval.Reader.encCtlTuple_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Fin 7} {T0 S0 x1 T1 S1 x2 T2 S2 : γ → ℕ} {x3 : γ → List ℕ} {T3 S3 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn (Turing.MultiTapeTM.encFinEnum (Fin 7)) 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.encList Turing.MultiTapeTM.encNat) T3 S3) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { tag := x0 x, n₁ := x1 x, n₂ := x2 x, acc := x3 x }) encIn encCtlTuple (fun (x : γ) => T0 x + (T1 x + (T2 x + T3 x))) fun (x : γ) => S0 x + (S1 x + (S2 x + S3 x))
theorem Cslib.TreeEval.Reader.encCtlTuple_mk_deg :
Turing.MultiTapeTM.ComputableInDegree (fun (p : Fin 7 × ℕ × ℕ × List ℕ) => { tag := p.1, n₁ := p.2.1, n₂ := p.2.2.1, acc := p.2.2.2 }) encCtlTupleFields encCtlTuple 1 1
theorem Cslib.TreeEval.Reader.encCtlTuple_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → Fin 7} {x1 x2 : γ → ℕ} {x3 : γ → List ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn (Turing.MultiTapeTM.encFinEnum (Fin 7)) 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.encList Turing.MultiTapeTM.encNat) budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { tag := x0 x, n₁ := x1 x, n₂ := x2 x, acc := x3 x }) encIn encCtlTuple budget
theorem Cslib.TreeEval.Reader.encCtlTuple_acc_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → CtlTuple} :

The encoding of unpacked control states as (tag, n₁, n₂, acc), framing every field before acc.

theorem Cslib.TreeEval.Reader.encCtlTuple_tag_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → CtlTuple} :

The encoding of control states.

@[reducible, inline]

The encoding of registers.

Flat record representation of a State, with ctl unpacked as a CtlTuple.

  • ell : ℕ

    The value length ℓ.

  • height : ℕ

    The height.

  • p : ℕ

    The prime.

  • regs : Regs

    The registers.

  • The stack of frames, innermost first.

  • mode : Iter.Mode

    The mode of the iterative procedure.

  • ctl : CtlTuple

    The unpacked control state.

theorem Cslib.TreeEval.Reader.Tuple.ext {x y : Tuple} (ell : x.ell = y.ell) (height : x.height = y.height) (p : x.p = y.p) (regs : x.regs = y.regs) (stack : x.stack = y.stack) (mode : x.mode = y.mode) (ctl : x.ctl = y.ctl) :
x = y

Unpack the control state of s to obtain its Tuple representation.

Equivalence between Tuple and its grouped product wire layout (((ell, height, p), regs), (stack, mode), ctl).

@[reducible, inline]

The grouped product encoding underlying encTuple: (((ell, height, p), regs), (stack, mode), ctl) with each pair's first component framed.

The encoding of unpacked states, preserving the grouped product layout encTupleFields.

theorem Cslib.TreeEval.Reader.encTuple_p_budget {γ : Type} {encIn : γ ↪ List Bool} {Bs : γ → ℕ} {g : γ → Tuple} (h : Turing.MultiTapeTM.ComputableInSpace g encIn encTuple Bs) :
theorem Cslib.TreeEval.Reader.encTuple_regs_budget {γ : Type} {encIn : γ ↪ List Bool} {Bs : γ → ℕ} {g : γ → Tuple} (h : Turing.MultiTapeTM.ComputableInSpace g encIn encTuple Bs) :
Turing.MultiTapeTM.ComputableInSpace (fun (c : γ) => (g c).regs) encIn encRegs Bs
theorem Cslib.TreeEval.Reader.encTuple_mode_budget {γ : Type} {encIn : γ ↪ List Bool} {Bs : γ → ℕ} {g : γ → Tuple} (h : Turing.MultiTapeTM.ComputableInSpace g encIn encTuple Bs) :
Turing.MultiTapeTM.ComputableInSpace (fun (c : γ) => (g c).mode) encIn encMode Bs
theorem Cslib.TreeEval.Reader.encTuple_ctl_budget {γ : Type} {encIn : γ ↪ List Bool} {Bs : γ → ℕ} {g : γ → Tuple} (h : Turing.MultiTapeTM.ComputableInSpace g encIn encTuple Bs) :
Turing.MultiTapeTM.ComputableInSpace (fun (c : γ) => (g c).ctl) encIn encCtlTuple Bs
theorem Cslib.TreeEval.Reader.encTuple_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {Bs e h p : γ → ℕ} {R : γ → Regs} {st : γ → List Iter.Frame} {m : γ → Iter.Mode} {ctl : γ → CtlTuple} (he : Turing.MultiTapeTM.ComputableInSpace e encIn Turing.MultiTapeTM.encNat Bs) (hh : Turing.MultiTapeTM.ComputableInSpace h encIn Turing.MultiTapeTM.encNat Bs) (hp : Turing.MultiTapeTM.ComputableInSpace p encIn Turing.MultiTapeTM.encNat Bs) (hR : Turing.MultiTapeTM.ComputableInSpace R encIn encRegs Bs) (hst : Turing.MultiTapeTM.ComputableInSpace st encIn (Turing.MultiTapeTM.encList encFrame) Bs) (hm : Turing.MultiTapeTM.ComputableInSpace m encIn encMode Bs) (hctl : Turing.MultiTapeTM.ComputableInSpace ctl encIn encCtlTuple Bs) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { ell := e x, height := h x, p := p x, regs := R x, stack := st x, mode := m x, ctl := ctl x }) encIn encTuple Bs