Documentation

DescriptiveComplexity.Problems.Machine.AltSweep

The intended run: the guessing sweeps #

The k sweeps of the machine, run against a tuple of block assignments. The whole point is DescriptiveComplexity.AltQbf.valAfter: the truth value the cell of a variable holds once the sweeps below i have run is the disjunction, over the blocks below i marking it, of what they assigned it. At i = k that is DescriptiveComplexity.qbfVal exactly (DescriptiveComplexity.AltQbf.valAfter_top), which is why one bit per cell suffices even though a variable may carry several block marks.

A sweep runs rightwards writing, turns at , runs back leftwards unchanged, and hands over at . The tape during the rightward pass is DescriptiveComplexity.AltQbf.sweepTape: cells strictly below the head already hold the new value, cells at or above still hold the old one. Junk cells – a cell's tag on a tuple that is not a position – are frozen at false, which is what DescriptiveComplexity.AltQbf.AltInp gives them and what the frame condition of every step then preserves.

The value a cell holds between sweeps #

noncomputable def DescriptiveComplexity.AltQbf.valAfter {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] (νs : Fin kAProp) (i : ) (x : A) :

The truth value the cell of x holds once the sweeps below i have run.

Equations
Instances For
    Dependency graph
    theorem DescriptiveComplexity.AltQbf.valAfter_eq_true {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] {νs : Fin kAProp} {x : A} {i : } :
    valAfter νs i x = true ∃ (j : Fin k), j < i QbfBlk j x νs j x

    Reading DescriptiveComplexity.AltQbf.valAfter back.

    Dependency graph
    theorem DescriptiveComplexity.AltQbf.valAfter_zero {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] {νs : Fin kAProp} {x : A} :
    valAfter νs 0 x = false
    Dependency graph
    theorem DescriptiveComplexity.AltQbf.valAfter_top {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] {νs : Fin kAProp} {x : A} :
    valAfter νs k x = true qbfVal νs x

    After the last sweep a cell holds the truth value of its variable.

    Dependency graph
    theorem DescriptiveComplexity.AltQbf.valAfter_succ_of_keep {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] {νs : Fin kAProp} {x : A} {i : } (h : ¬∃ (j : Fin k), j = i QbfBlk j x νs j x) :
    valAfter νs (i + 1) x = valAfter νs i x

    A sweep leaves a cell alone when its block does not set it.

    Dependency graph
    theorem DescriptiveComplexity.AltQbf.valAfter_succ_of_set {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] {νs : Fin kAProp} {x : A} {i : } (h : ∃ (j : Fin k), j = i QbfBlk j x νs j x) :
    valAfter νs (i + 1) x = true

    A sweep sets a cell when its block marks the variable and assigns it true.

    Dependency graph

    Changing one block's assignment #

    The read-off of a round replaces the assignment of the block that has just played, and leaves the others alone. These are the two facts that makes such a replacement invisible to the sweeps below it and exactly visible to its own.

    theorem DescriptiveComplexity.AltQbf.valAfter_congr {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] {x : A} {ρ σ : Fin kAProp} {m : } (h : ∀ (j : Fin k), j < m → (ρ j x σ j x)) :
    valAfter ρ m x = valAfter σ m x

    Only the blocks below m matter to what a cell holds after m sweeps.

    Dependency graph
    theorem DescriptiveComplexity.AltQbf.valAfter_update_le {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] {νs : Fin kAProp} {x : A} {i : Fin k} {ν' : AProp} {m : } (hm : m i) :
    valAfter (Function.update νs i ν') m x = valAfter νs m x

    Replacing block i's assignment does not change what the sweeps below it wrote.

    Dependency graph
    theorem DescriptiveComplexity.AltQbf.valAfter_update_succ {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] {νs : Fin kAProp} {x : A} {i : Fin k} {ν' : AProp} :
    valAfter (Function.update νs i ν') (i + 1) x = true valAfter νs (↑i) x = true QbfBlk i x ν' x

    Replacing block i's assignment changes exactly what its own sweep writes.

    Dependency graph

    The tape between and during the sweeps #

    Whether a tuple carrying a cell's tag is a real cell of the tape.

    Equations
    Instances For
      Dependency graph
      noncomputable def DescriptiveComplexity.AltQbf.tapeAfter {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] (νs : Fin kAProp) (i : ) (q : AltV k A) :
      AltV k A

      The tape once the sweeps below i have run: every real cell holds the value its variable has accumulated, the markers hold their own symbols, junk cells are frozen at false, and everything else reads blank.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        Dependency graph
        noncomputable def DescriptiveComplexity.AltQbf.sweepTape {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] (νs : Fin kAProp) (i : ) (p q : AltV k A) :
        AltV k A

        The tape during the rightward pass of the sweep of index i, with the head at p: a real cell strictly below the head already holds the new value.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          Dependency graph

          At the left marker nothing has been written yet.

          Dependency graph
          theorem DescriptiveComplexity.AltQbf.sweepTape_posEnd {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] (νs : Fin kAProp) (i : ) :
          sweepTape νs i posEnd = tapeAfter νs (i + 1)

          At the right marker the sweep is over.

          Dependency graph
          theorem DescriptiveComplexity.AltQbf.sweepTape_frame {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] (νs : Fin kAProp) (i : ) {p q r : AltV k A} (hsucc : SuccPos tagTupleLe AltPosn p q) (hr : r p) :
          sweepTape νs i q r = sweepTape νs i p r

          The rightward pass only ever changes the cell under the head. Every other element reads the same before and after: markers and non-cells do not depend on the head at all, junk cells are frozen, and a real cell is below the new head exactly when it was below the old one.

          Dependency graph

          The rightward pass #

          noncomputable def DescriptiveComplexity.AltQbf.confSweep {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] (νs : Fin kAProp) (i : Fin (k + 1)) (p : AltV k A) :
          Config (AltV k A)

          The configuration during the rightward pass of the sweep of index i.

          Equations
          Instances For
            Dependency graph

            At the first cell nothing has been written yet either: no cell is strictly below the cell of the least element.

            Dependency graph
            theorem DescriptiveComplexity.AltQbf.tape_confSweep_bot {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] (νs : Fin kAProp) (i : Fin (k + 1)) :
            (confSweep νs i (posCell qbotA)).tape = tapeAfter νs i

            A sweep starts from the tape the sweeps below it left.

            Dependency graph

            The run starts at the first sweep.

            Dependency graph
            theorem DescriptiveComplexity.AltQbf.sweepTape_at_head {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] {νs : Fin kAProp} {i : } {p : AltV k A} (hp : AltPosn p) (hb : p.1.1 = AltBase.pCell) :
            sweepTape νs i p p = symV (valAfter νs i (p.2 0)) (p.2 0)

            The value under the head is the old one.

            Dependency graph
            theorem DescriptiveComplexity.AltQbf.sweepTape_written {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] {νs : Fin kAProp} {i : } {p q : AltV k A} (hp : AltPosn p) (hb : p.1.1 = AltBase.pCell) (hsucc : SuccPos tagTupleLe AltPosn p q) :
            sweepTape νs i q p = symV (valAfter νs (i + 1) (p.2 0)) (p.2 0)

            The value written under the head is the new one.

            Dependency graph
            theorem DescriptiveComplexity.AltQbf.step_sweep {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] {νs : Fin kAProp} {cnf : Bool} {i : Fin (k + 1)} (hi : i < k) {p q : AltV k A} (hsucc : SuccPos tagTupleLe AltPosn p q) (hb : tagTupleLe q posEnd) (hstart : p.1.1 = AltBase.pStarti = 0) :
            (altMachine k A cnf).Step (confSweep νs i p) (confSweep νs i q)

            One step of a rightward pass. At a cell the machine writes the value its block gives the variable – keeping the old one, or setting it – and moves on; at the left marker it steps over it.

            Dependency graph

            The whole rightward pass: from the first cell to the right marker, the sweep of index i writes its block's value in every cell.

            Dependency graph
            theorem DescriptiveComplexity.AltQbf.step_sweepStart {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] {νs : Fin kAProp} {cnf : Bool} (hk : 0 < k) :

            The first sweep steps over the left marker. Later sweeps do not: they enter at the first cell, the handover at having already moved the head.

            Dependency graph

            The turn, the leftward pass and the handover #

            noncomputable def DescriptiveComplexity.AltQbf.confBack {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] (νs : Fin kAProp) (i : Fin (k + 1)) (p : AltV k A) :
            Config (AltV k A)

            The configuration during the leftward pass of the sweep of index i: the tape is the one the sweep has just finished writing, and does not change again.

            Equations
            Instances For
              Dependency graph
              theorem DescriptiveComplexity.AltQbf.tapeAfter_at_cell {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] {νs : Fin kAProp} {m : } {p : AltV k A} (hp : AltPosn p) (hb : p.1.1 = AltBase.pCell) :
              tapeAfter νs m p = symV (valAfter νs m (p.2 0)) (p.2 0)

              The tape reads a real cell as the value its variable has accumulated.

              Dependency graph
              theorem DescriptiveComplexity.AltQbf.tapeAfter_posCell {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] {νs : Fin kAProp} (i : ) (x : A) :
              tapeAfter νs i (posCell x) = symV (valAfter νs i x) x
              Dependency graph
              theorem DescriptiveComplexity.AltQbf.step_turnBack {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] {νs : Fin kAProp} {cnf : Bool} {i : Fin (k + 1)} (hi : i < k) :
              (altMachine k A cnf).Step (confSweep νs i posEnd) (confBack νs i (posCell qtopA))

              The turn at the right marker: the sweep has written every cell and turns round.

              Dependency graph
              theorem DescriptiveComplexity.AltQbf.step_back {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] {νs : Fin kAProp} {cnf : Bool} {i : Fin (k + 1)} (hi : i < k) {p q : AltV k A} (hsucc : SuccPos tagTupleLe AltPosn p q) (hlb : tagTupleLe posStart p) (hub : tagTupleLe q (posCell qtopA)) :
              (altMachine k A cnf).Step (confBack νs i q) (confBack νs i p)

              One step of the leftward pass: the head steps back over a cell, changing nothing.

              Dependency graph

              The whole leftward pass: from the last cell back to the left marker.

              Dependency graph
              theorem DescriptiveComplexity.AltQbf.step_next {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] {νs : Fin kAProp} {cnf : Bool} {i : Fin (k + 1)} (hi : i + 1 < k) :
              (altMachine k A cnf).Step (confBack νs i posStart) (confSweep νs (i + 1) (posCell qbotA))

              The handover to the next sweep: at the left marker the machine steps right into the first cell and the next block takes over.

              Dependency graph
              theorem DescriptiveComplexity.AltQbf.step_toChk {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] {νs : Fin kAProp} {cnf : Bool} {i : Fin (k + 1)} (hlast : i + 1 = k) {c₀ : A} (hc₀ : QbfMinCl k c₀) :
              (altMachine k A cnf).Step (confBack νs i posStart) { state := stChk false true c₀, head := posCell qbotA, tape := tapeAfter νs k }

              The handover to the check phase: after the last sweep the machine takes the lowest clause with an empty flag and sweeps rightwards.

              Dependency graph
              theorem DescriptiveComplexity.AltQbf.step_toAcc {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] {νs : Fin kAProp} {cnf : Bool} {i : Fin (k + 1)} (hlast : i + 1 = k) (hcnf : cnf = true) (hno : ∀ (e : A), ¬QbfCl k e) :
              (altMachine k A cnf).Step (confBack νs i posStart) { state := stAcc, head := posCell qbotA, tape := tapeAfter νs k }

              The handover to acceptance: an instance with no clause at all is vacuously satisfied by a conjunctive matrix, and the machine accepts.

              Dependency graph

              One sweep, end to end #

              theorem DescriptiveComplexity.AltQbf.stepsIn_add {k : } {A : Type} {M : TMData (AltV k A)} {m n : } {c d e : Config (AltV k A)} :
              M.StepsIn m c dM.StepsIn n d eM.StepsIn (m + n) c e

              Two runs compose. (DescriptiveComplexity.TMData.stepsIn_split is the converse; this direction is not in DescriptiveComplexity.Machines and could be hoisted there.)

              Dependency graph
              noncomputable def DescriptiveComplexity.AltQbf.sweepLen (k : ) (A : Type) [LinearOrder A] [Finite A] [Nonempty A] :

              The number of steps a sweep takes: right to the marker, turn, back to the other marker, and over it.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Dependency graph
                theorem DescriptiveComplexity.AltQbf.steps_sweep {k : } {A : Type} [(FirstOrder.Language.qbf k).Structure A] [LinearOrder A] [Finite A] [Nonempty A] {νs : Fin kAProp} {cnf : Bool} {i : Fin (k + 1)} (hi : i + 1 < k) :
                (altMachine k A cnf).StepsIn (sweepLen k A) (confSweep νs i (posCell qbotA)) (confSweep νs (i + 1) (posCell qbotA))

                The whole of sweep i, from the first cell to the first cell of the sweep that follows it: the round of block i is exactly this run.

                Dependency graph