Documentation

DescriptiveComplexity.Problems.Wide.DrawLeaf

What the inner loop computes #

The VAL register of the EXPSPACE program enumerates addresses supported on the inner argument blocks, from the empty one to the full one, and the control folds one leaf per address. This file says what that fold is worth: at the inner top it is one step of the iteration at the points the working address holds.

The dictionary, fixed here once and for all:

DescriptiveComplexity.Draw.Data.altQuantFrom_leafP is the join: the prefix of the leaf predicate over all ki blocks, from level 0, is DescriptiveComplexity.StepDef.next at the encoded arguments. The two ends of the mismatch are paid for by DescriptiveComplexity.Problems.Wide.DrawPad – the free levels and the levels past the pack are skipped, the starting valuation is never read at level 0 – and the middle by DescriptiveComplexity.Draw.StepDef.next_iff_gateMat. foldFrom_leafP_top then reads it off the accumulators, at the address the loop stops at.

The leaf predicate #

noncomputable def DescriptiveComplexity.Draw.Data.levelVal {L : FirstOrder.Language} (dt : Data L) {A : Type} (v : dt.VarIx) (mb : Fin dt.ko(Fin dt.ddA)Prop) (w : Fin dt.ki(Fin dt.ddA)Prop) :
Fin (dt.nOf v)(Fin dt.ddA)Prop

The valuation the levels of a pack read: the working address's outer blocks below the variable's arity – those are the arguments the stage is being computed at – and the register's inner blocks above it.

Equations
Instances For
    Dependency graph
    noncomputable def DescriptiveComplexity.Draw.Data.freeVal {L : FirstOrder.Language} (dt : Data L) {A : Type} (v : dt.VarIx) (mb : Fin dt.ko(Fin dt.ddA)Prop) (u : Fin (dt.nOf v)(Fin dt.ddA)Prop) :
    Fin (dt.nOf v)(Fin dt.ddA)Prop

    The same valuation over the pack's own levels: the free ones off the working address, the quantified ones as given.

    Equations
    Instances For
      Dependency graph
      noncomputable def DescriptiveComplexity.Draw.Data.matHolds {L : FirstOrder.Language} (dt : Data L) {A : Type} [L.Structure A] [LinearOrder A] [LinearOrder (dt.X.Map A)] (v : dt.VarIx) (σ : dt.d.B.Assignment (dt.X.Map A)) :
      (Fin (dt.nOf v)dt.X.Map A)Prop

      The matrix of a variable's pack, read over points at a stage.

      Equations
      Instances For
        Dependency graph
        noncomputable def DescriptiveComplexity.Draw.Data.gateHolds {L : FirstOrder.Language} (dt : Data L) {A : Type} [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A] [LinearOrder (dt.X.Map A)] (zero one : A) (v : dt.VarIx) (σ : dt.d.B.Assignment (dt.X.Map A)) :
        (Fin (dt.nOf v)(Fin dt.ddA)Prop)Prop

        The gated matrix over block values: the encodings' gates, then the matrix at the decoded points – the leaf of the relativized prefix.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          Dependency graph
          noncomputable def DescriptiveComplexity.Draw.Data.leafP {L : FirstOrder.Language} (dt : Data L) {A : Type} [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A] [LinearOrder (dt.X.Map A)] (zero one : A) (v : dt.VarIx) (σ : dt.d.B.Assignment (dt.X.Map A)) (mb : Fin dt.ko(Fin dt.ddA)Prop) :
          (Fin dt.ki(Fin dt.ddA)Prop)Prop

          The leaf the machine folds, one per address of the VAL register: the gated matrix at the levels' values.

          Equations
          Instances For
            Dependency graph
            theorem DescriptiveComplexity.Draw.Data.leafP_eq_pad {L : FirstOrder.Language} {dt : Data L} {A : Type} [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A] [LinearOrder (dt.X.Map A)] {zero one : A} (v : dt.VarIx) (σ : dt.d.B.Assignment (dt.X.Map A)) (mb : Fin dt.ko(Fin dt.ddA)Prop) (w : Fin dt.ki(Fin dt.ddA)Prop) :
            dt.leafP zero one v σ mb w = (fun (u : Fin (dt.nOf v)(Fin dt.ddA)Prop) => dt.gateHolds zero one v σ (dt.freeVal v mb u)) fun (j : Fin (dt.nOf v)) => w (Fin.castLE j)

            The leaf is the pack-level predicate padded to the register's blocks.

            Dependency graph
            theorem DescriptiveComplexity.Draw.Data.leafP_irrel {L : FirstOrder.Language} {dt : Data L} {A : Type} [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A] [LinearOrder (dt.X.Map A)] {zero one : A} (v : dt.VarIx) (σ : dt.d.B.Assignment (dt.X.Map A)) (mb : Fin dt.ko(Fin dt.ddA)Prop) { : Fin dt.ki} (hℓ : < dt.arOf v dt.nOf v ) (w : Fin dt.ki(Fin dt.ddA)Prop) (a : (Fin dt.ddA)Prop) :
            dt.leafP zero one v σ mb (Function.update w a) dt.leafP zero one v σ mb w

            The leaf ignores the register blocks the pack does not quantify: those below the variable's arity, whose values it reads off the working address, and those past its prefix, which nothing reads.

            Dependency graph
            theorem DescriptiveComplexity.Draw.Data.leafP_iff_split {L : FirstOrder.Language} {dt : Data L} {A : Type} [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A] [LinearOrder (dt.X.Map A)] {zero one : A} (v : dt.VarIx) (σ : dt.d.B.Assignment (dt.X.Map A)) (mb : Fin dt.ko(Fin dt.ddA)Prop) (w : Fin dt.ki(Fin dt.ddA)Prop) (houter : ∀ (k : Fin dt.ko), k < dt.arOf vIsEnc dt.ly zero one (mb k)) :
            dt.leafP zero one v σ mb w (∀ (j : Fin (dt.nOf v)), dt.arOf v jdt.polOf v j = trueIsEnc dt.ly zero one (w j, )) ((∀ (j : Fin (dt.nOf v)), dt.arOf v jdt.polOf v j = falseIsEnc dt.ly zero one (w j, ))dt.matHolds v σ fun (j : Fin (dt.nOf v)) => Function.invFun (encMap dt.ly zero one) (dt.levelVal v mb w j))

            The leaf, machine-shaped: at an address whose outer blocks encode points, the leaf splits into the two flags the machinery conjoins – every ∃-level of the register an encoding, and if every ∀-level is one, the matrix at the decoded valuation. The free levels' gates are absorbed by the address's.

            Dependency graph

            The join #

            theorem DescriptiveComplexity.Draw.Data.altQuantFrom_leafP {L : FirstOrder.Language} {dt : Data L} {A : Type} [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A] [LinearOrder (dt.X.Map A)] {zero one : A} (hzo : zero one) (i : dt.d.B.ι) (σ : dt.d.B.Assignment (dt.X.Map A)) (mb : Fin dt.ko(Fin dt.ddA)Prop) (x : Fin (dt.d.B.arity i)dt.X.Map A) (hx : ∀ ( : Fin (dt.d.B.arity i)), mb (Fin.castLE ) = encMap dt.ly zero one (x )) (w : Fin dt.ki(Fin dt.ddA)Prop) :
            altQuantFrom (dt.polOf (some i)) (dt.leafP zero one (some i) σ mb) 0 w dt.d.next σ i x

            The inner loop computes the step formula. The prefix of the leaf predicate over every block of the register, played from level 0, is one step of the iteration at the points the working address's outer blocks encode – whatever the register held when the loop began, since level 0 reads nothing.

            The three mismatches between what the machine plays and what the pack asks for are exactly the three lemmas of DescriptiveComplexity.Problems.Wide.DrawPad: the free levels are skipped, the levels past the prefix are padding, and below the prefix's start the machine's leaf reads the working address where the pack reads its valuation.

            Dependency graph
            theorem DescriptiveComplexity.Draw.Data.altQuantFrom_leafP_out {L : FirstOrder.Language} {dt : Data L} {A : Type} [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A] [LinearOrder (dt.X.Map A)] {zero one : A} (hzo : zero one) (σ : dt.d.B.Assignment (dt.X.Map A)) (mb : Fin dt.ko(Fin dt.ddA)Prop) (w : Fin dt.ki(Fin dt.ddA)Prop) :
            altQuantFrom (dt.polOf none) (dt.leafP zero one none σ mb) 0 w dt.X.Map A dt.d.out

            The inner loop at the output variable computes the output sentence. The same three mismatches as altQuantFrom_leafP, minus the free levels: a sentence has none, so the prefix starts where the machine starts it and only the padding past the pack has to be skipped.

            Dependency graph

            Read off the accumulators #

            theorem DescriptiveComplexity.Draw.Data.foldFrom_leafP_top {L : FirstOrder.Language} {dt : Data L} {A : Type} [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A] [LinearOrder (dt.X.Map A)] {zero one : A} {R' P' : Type} (hzo : zero one) {LeV : (Fin dt.ddA)(Fin dt.ddA)Prop} (hLeV : IsLinOrd LeV) (i : dt.d.B.ι) (σ : dt.d.B.Assignment (dt.X.Map A)) (mb : Fin dt.ko(Fin dt.ddA)Prop) (x : Fin (dt.d.B.arity i)dt.X.Map A) (hx : ∀ ( : Fin (dt.d.B.arity i)), mb (Fin.castLE ) = encMap dt.ly zero one (x )) {s : Univ A R' P' dt.KIx dt.ddProp} (hfull : ∀ (j : Fin dt.ki) (v : Fin dt.ddA), wmBlk s (argIn dt.ko j) v) :
            foldFrom (dt.polOf (some i)) (dt.leafP zero one (some i) σ mb) (WMSetLe LeV) 0 (ixBlk (argIn dt.ko) s) dt.d.next σ i x

            At the inner top the fold holds the step's value. The loop stops when every inner block of the register is full; there the accumulator at level 0 is the whole prefix (DescriptiveComplexity.Draw.foldFrom_top_of_ix), hence one step of the iteration at the working address's points.

            Dependency graph