Documentation

DescriptiveComplexity.Problems.Wide.DrawAccCtl

The fold, in the control's slots #

DescriptiveComplexity.Problems.Wide.DrawAcc says what the machine must carry across the inner loop – one contribution per level plus the last leaf – and how a round rewrites it. This file puts that in the program's own slots, which is what the dstSt parameters of DescriptiveComplexity.Draw.Data.varRule are:

Every one of them is a function of the pointer alone, and each comes with the equation the run needs: what the next pointer's slots read back. The fold's own correctness is DrawAcc's; nothing here repeats it.

The accumulator vector #

def DescriptiveComplexity.Draw.Data.readVec {L : FirstOrder.Language} (dt : Data L) {A : Type} (one : A) {m : } (accs : Fin mdt.CtlIx) (f : dt.CtlIxA) (j : ) :

A vector of control slots, read: one bit per index. Past the family it is False; a fold never looks there.

Equations
Instances For
    Dependency graph
    noncomputable def DescriptiveComplexity.Draw.Data.putVec {L : FirstOrder.Language} (dt : Data L) {A : Type} (zero one : A) {m : } (accs : Fin mdt.CtlIx) (f : dt.CtlIxA) (b : Fin mProp) :
    dt.CtlIxA

    A vector of control slots, written.

    Equations
    Instances For
      Dependency graph
      theorem DescriptiveComplexity.Draw.Data.putVec_of_not_mem {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} {m : } {accs : Fin mdt.CtlIx} {f : dt.CtlIxA} {b : Fin mProp} {q : dt.CtlIx} (h : ∀ (j : Fin m), q accs j) :
      dt.putVec zero one accs f b q = f q
      Dependency graph
      theorem DescriptiveComplexity.Draw.Data.readVec_putVec {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} (hzo : zero one) {m : } {accs : Fin mdt.CtlIx} (hinj : Function.Injective accs) (f : dt.CtlIxA) (b : Fin mProp) {j : } (hj : j < m) :
      dt.readVec one accs (dt.putVec zero one accs f b) j b j, hj

      A vector reads back, index by index.

      Dependency graph
      def DescriptiveComplexity.Draw.Data.readAcc {L : FirstOrder.Language} (dt : Data L) {A : Type} (one : A) (f : dt.CtlIxA) (j : ) :

      The inner fold's accumulator vector, one bit per level.

      Equations
      Instances For
        Dependency graph
        noncomputable def DescriptiveComplexity.Draw.Data.putAcc {L : FirstOrder.Language} (dt : Data L) {A : Type} (zero one : A) (f : dt.CtlIxA) (b : Fin dt.naDimProp) :
        dt.CtlIxA

        The inner fold's accumulator vector, written.

        Equations
        Instances For
          Dependency graph
          def DescriptiveComplexity.Draw.Data.readSac {L : FirstOrder.Language} (dt : Data L) {A : Type} (one : A) (f : dt.CtlIxA) (j : ) :

          A sub-fold's accumulator vector: the element loops of the atom subroutines keep theirs in the sac slots, one per level of the defining sentence's own prefix.

          Equations
          Instances For
            Dependency graph
            noncomputable def DescriptiveComplexity.Draw.Data.putSac {L : FirstOrder.Language} (dt : Data L) {A : Type} (zero one : A) (f : dt.CtlIxA) (b : Fin dt.eDimProp) :
            dt.CtlIxA

            A sub-fold's accumulator vector, written.

            Equations
            Instances For
              Dependency graph
              Dependency graph
              theorem DescriptiveComplexity.Draw.Data.putAcc_of_not_acc {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} {f : dt.CtlIxA} {b : Fin dt.naDimProp} {q : dt.CtlIx} (h : ∀ (j : Fin dt.naDim), q dt.accC j) :
              dt.putAcc zero one f b q = f q
              Dependency graph
              theorem DescriptiveComplexity.Draw.Data.putSac_of_not_sac {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} {f : dt.CtlIxA} {b : Fin dt.eDimProp} {q : dt.CtlIx} (h : ∀ (j : Fin dt.eDim), q dt.sacC j) :
              dt.putSac zero one f b q = f q
              Dependency graph
              theorem DescriptiveComplexity.Draw.Data.readAcc_putAcc {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} (hzo : zero one) (f : dt.CtlIxA) (b : Fin dt.naDimProp) {j : } (hj : j < dt.naDim) :
              dt.readAcc one (dt.putAcc zero one f b) j b j, hj

              The inner fold's vector reads back, level by level.

              Dependency graph
              theorem DescriptiveComplexity.Draw.Data.readSac_putSac {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} (hzo : zero one) (f : dt.CtlIxA) (b : Fin dt.eDimProp) {j : } (hj : j < dt.eDim) :
              dt.readSac one (dt.putSac zero one f b) j b j, hj

              A sub-fold's vector reads back, level by level.

              Dependency graph

              The leaf flag #

              The leaf flag: the value of the matrix at the valuation the loop has just evaluated – the bit every carry absorbs.

              Equations
              Instances For
                Dependency graph
                noncomputable def DescriptiveComplexity.Draw.Data.postLeaf {L : FirstOrder.Language} (dt : Data L) {A : Type} (one : A) (v : dt.VarIx) (f : dt.CtlIxA) :

                The matrix's Boolean value at the atoms' verdicts: what the machine knows once every atom subroutine has filed its bit.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  Dependency graph
                  noncomputable def DescriptiveComplexity.Draw.Data.setLeaf {L : FirstOrder.Language} (dt : Data L) {A : Type} (zero one : A) (b : Prop) (f : dt.CtlIxA) :
                  dt.CtlIxA

                  Storing the leaf.

                  Equations
                  Instances For
                    Dependency graph
                    Dependency graph
                    Dependency graph
                    @[simp]
                    theorem DescriptiveComplexity.Draw.Data.ctlBit_setLeaf {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} (hzo : zero one) (b : Prop) (f : dt.CtlIxA) :
                    dt.ctlBit one (dt.setLeaf zero one b f) dt.leafC b
                    Dependency graph
                    theorem DescriptiveComplexity.Draw.Data.setLeaf_of_ne {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} {q : dt.CtlIx} (hne : q dt.leafC) (b : Prop) (f : dt.CtlIxA) :
                    dt.setLeaf zero one b f q = f q
                    Dependency graph
                    theorem DescriptiveComplexity.Draw.Data.readAcc_setLeaf {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} (b : Prop) (f : dt.CtlIxA) (j : ) :
                    dt.readAcc one (dt.setLeaf zero one b f) j dt.readAcc one f j

                    The accumulators ride along a write of the leaf flag.

                    Dependency graph

                    The three updates #

                    noncomputable def DescriptiveComplexity.Draw.Data.initAcc {L : FirstOrder.Language} (dt : Data L) {A : Type} (zero one : A) (pol : Bool) (f : dt.CtlIxA) :
                    dt.CtlIxA

                    The folds at the empty valuation: every accumulator the polarity's unit.

                    Equations
                    Instances For
                      Dependency graph
                      noncomputable def DescriptiveComplexity.Draw.Data.accVerdict {L : FirstOrder.Language} (dt : Data L) {A : Type} (one : A) (pol : Bool) (f : dt.CtlIxA) :

                      The verdict the accumulators spell: the chain from level 0, closed by the leaf flag – the value of the whole prefix once the register is exhausted.

                      Equations
                      Instances For
                        Dependency graph
                        noncomputable def DescriptiveComplexity.Draw.Data.carryAcc {L : FirstOrder.Language} (dt : Data L) {A : Type} (zero one : A) (pol : Bool) (c : ) (f : dt.CtlIxA) :
                        dt.CtlIxA

                        The folds at an increment's carry block: the levels before the carry keep their bit, the carry level absorbs the chain below it, the levels after it reset.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          Dependency graph
                          theorem DescriptiveComplexity.Draw.Data.readAcc_initAcc {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} (hzo : zero one) (pol : Bool) (f : dt.CtlIxA) {j : } (hj : j < dt.naDim) :
                          dt.readAcc one (dt.initAcc zero one pol f) j pol j = false

                          What the initialized vector reads: the polarity's unit at every level, which is DescriptiveComplexity.Draw.accCVal_bot's value.

                          Dependency graph
                          theorem DescriptiveComplexity.Draw.Data.readAcc_carryAcc {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} (hzo : zero one) (pol : Bool) (c : ) (f : dt.CtlIxA) {j : } (hj : j < dt.naDim) :
                          dt.readAcc one (dt.carryAcc zero one pol c f) j if j < c then dt.readAcc one f j else if j = c then if pol c = true then dt.readAcc one f c chainFrom pol (dt.readAcc one f) (dt.ctlBit one f dt.leafC) dt.ki (c + 1) else dt.readAcc one f c chainFrom pol (dt.readAcc one f) (dt.ctlBit one f dt.leafC) dt.ki (c + 1) else pol j = false

                          What the vector reads after a carry: exactly the shape DescriptiveComplexity.Draw.accCVal_step asks for.

                          Dependency graph

                          The same for a sub-fold #

                          An element loop of an atom subroutine folds its own prefix – the defining sentence's – over the sac slots, with its own leaf flag. The three updates are the same three; only the family and the width change.

                          The sub-fold's leaf flag: the value of a defining sentence's matrix at the tuple the element loop has just read.

                          Equations
                          Instances For
                            Dependency graph
                            noncomputable def DescriptiveComplexity.Draw.Data.setSubLeaf {L : FirstOrder.Language} (dt : Data L) {A : Type} (zero one : A) (b : Prop) (f : dt.CtlIxA) :
                            dt.CtlIxA

                            Storing a sub-fold's leaf.

                            Equations
                            Instances For
                              Dependency graph
                              noncomputable def DescriptiveComplexity.Draw.Data.initSac {L : FirstOrder.Language} (dt : Data L) {A : Type} (zero one : A) (pol : Bool) (f : dt.CtlIxA) :
                              dt.CtlIxA

                              A sub-fold at its first tuple.

                              Equations
                              Instances For
                                Dependency graph
                                noncomputable def DescriptiveComplexity.Draw.Data.sacVerdict {L : FirstOrder.Language} (dt : Data L) {A : Type} (one : A) (pol : Bool) (f : dt.CtlIxA) :

                                What a sub-fold concludes: the chain from level 0, closed by its leaf flag.

                                Equations
                                Instances For
                                  Dependency graph
                                  noncomputable def DescriptiveComplexity.Draw.Data.carrySac {L : FirstOrder.Language} (dt : Data L) {A : Type} (zero one : A) (pol : Bool) (c : ) (f : dt.CtlIxA) :
                                  dt.CtlIxA

                                  A sub-fold at a tuple successor, the carry coordinate given.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    Dependency graph
                                    Dependency graph
                                    Dependency graph
                                    @[simp]
                                    theorem DescriptiveComplexity.Draw.Data.ctlBit_setSubLeaf {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} (hzo : zero one) (b : Prop) (f : dt.CtlIxA) :
                                    dt.ctlBit one (dt.setSubLeaf zero one b f) dt.subLeafC b
                                    Dependency graph
                                    theorem DescriptiveComplexity.Draw.Data.readSac_setSubLeaf {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} (b : Prop) (f : dt.CtlIxA) (j : ) :
                                    dt.readSac one (dt.setSubLeaf zero one b f) j dt.readSac one f j

                                    A sub-fold's accumulators ride along a write of its leaf flag.

                                    Dependency graph
                                    theorem DescriptiveComplexity.Draw.Data.putSac_of_lvE {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} (f : dt.CtlIxA) (b : Fin dt.eDimProp) (j : Fin dt.eDim) :
                                    dt.putSac zero one f b (dt.lvE j) = f (dt.lvE j)

                                    The loop's wide tuple rides along a write of a sub-fold's accumulators.

                                    Dependency graph
                                    theorem DescriptiveComplexity.Draw.Data.readSac_carrySac {L : FirstOrder.Language} {dt : Data L} {A : Type} {zero one : A} (hzo : zero one) (pol : Bool) (c : ) (f : dt.CtlIxA) {j : } (hj : j < dt.eDim) :
                                    dt.readSac one (dt.carrySac zero one pol c f) j if j < c then dt.readSac one f j else if j = c then if pol c = true then dt.readSac one f c chainFrom pol (dt.readSac one f) (dt.ctlBit one f dt.subLeafC) dt.eDim (c + 1) else dt.readSac one f c chainFrom pol (dt.readSac one f) (dt.ctlBit one f dt.subLeafC) dt.eDim (c + 1) else pol j = false
                                    Dependency graph
                                    theorem DescriptiveComplexity.Draw.Data.sacVerdict_iff_foldFrom {L : FirstOrder.Language} {dt : Data L} {A : Type} {one : A} {α : Type} {le : ααProp} {P : (Fin dt.eDimα)Prop} {pol : Bool} {v : Fin dt.eDimα} {f : dt.CtlIxA} (hacc : j < dt.eDim, dt.readSac one f j accCVal pol P le j v) (hleaf : dt.ctlBit one f dt.subLeafC P v) :
                                    dt.sacVerdict one pol f foldFrom pol P le 0 v

                                    A sub-fold's verdict is its fold, by the same chain.

                                    Dependency graph

                                    What the two readings are worth #

                                    theorem DescriptiveComplexity.Draw.Data.accVerdict_iff_foldFrom {L : FirstOrder.Language} {dt : Data L} {A : Type} {one : A} {α : Type} {le : ααProp} {P : (Fin dt.kiα)Prop} {pol : Bool} {v : Fin dt.kiα} {f : dt.CtlIxA} (hacc : j < dt.ki, dt.readAcc one f j accCVal pol P le j v) (hleaf : dt.ctlBit one f dt.leafC P v) :
                                    dt.accVerdict one pol f foldFrom pol P le 0 v

                                    The verdict is the fold: if the accumulators hold the contributions and the leaf flag the matrix at the current valuation, the chain from level 0 is the fold's value there – so the exit checkpoint's guard reads the sweep's answer off the control.

                                    Dependency graph
                                    theorem DescriptiveComplexity.Draw.Data.postLeaf_iff_qfValue {L : FirstOrder.Language} {dt : Data L} {A : Type} {one : A} [L.Structure A] [LinearOrder A] [LinearOrder (dt.X.Map A)] {v : dt.VarIx} {f : dt.CtlIxA} {σ : dt.d.B.Assignment (dt.X.Map A)} {w : Fin (dt.nOf v)dt.X.Map A} (hav : ∀ (k : Fin (dt.natOf v)), dt.ctlBit one f (dt.avC (Fin.castLE k)) MatAtom.holds σ w (dt.kindOf v k)) :
                                    dt.postLeaf one v f qfValue (dt.matOf v) fun (a : ((dt.X.E.sum FirstOrder.Language.order).sum dt.d.B.lang).BoundedFormula Empty (dt.nOf v)) => (matAtom? a).elim False (MatAtom.holds σ w)

                                    The leaf flag's value is the matrix: once every atom subroutine has filed its verdict, the Boolean function the control computes is the matrix at the atoms' readings – DescriptiveComplexity.Draw.realize_iff_qfValue_holds's right-hand side, which is what the machine's leaf must be.

                                    Dependency graph