Documentation

DescriptiveComplexity.Problems.Machine.AltProg

The machine of a quantified Boolean formula #

The program half of QBF k ≤ᶠᵒ[≤] ATMAccept k: the states, symbols and transitions of the alternating machine M_φ built inside an ordered QBF instance, on the tape laid out in DescriptiveComplexity.Problems.Machine.AltTape.

The program #

  sweep i:  ⊢ →  at each cell (x, b): if block i marks x and b is false,
                 write true or leave it – the round's choice        → ⊣
            ⊣ ←  back over the cells, unchanged                     → ⊢
            at ⊢: hand over to sweep i + 1, or start the check
  check c:  sweep over the cells accumulating
              flag := flag ∨ (the literal of c at this cell is `good`)
            at the far marker: settle the clause, or die
  accept:   the check has settled every clause

Three things differ from the SAT machine of DescriptiveComplexity.Problems.Machine.Hardness.

The guess is spread over k sweeps, and it accumulates. A cell holds one truth value, initially false, and sweep i may turn it to true when block i marks the variable – never back. After the k sweeps the cell holds DescriptiveComplexity.qbfVal, which is a disjunction over the blocks marking the variable. So there are two transitions available at a cell block i marks and holds false, and one everywhere else: the choice a round makes is exactly its block's truth assignment.

Only the guess is nondeterministic, as in the SAT machine – which is what makes the check work at either polarity: a universal block whose configuration has a single available move is an existential one.

The check serves both matrix shapes. For a conjunctive matrix the flag records that some literal of the clause is satisfied, and a clause is settled when the flag is set; for a disjunctive one it records that some literal is violated, and a term is settled – by accepting – when the flag is clear. The two are the same clause with the truth value flipped (DescriptiveComplexity.xorB), which is why one table serves both.

Semantics first #

Everything here is a plain predicate on tagged tuples: the machine is assembled as a DescriptiveComplexity.ATMData and reasoned about directly. Only once its correctness is proved does the first-order transcription happen.

The instance, read #

Being a clause – a term, for a disjunctive matrix – of the instance.

Equations
Instances For
    Dependency graph
    Dependency graph
    Dependency graph
    Dependency graph

    The variable x carries the mark of the block of index i, where i is allowed to be the sentinel k: at the sentinel, no mark.

    Equations
    Instances For
      Dependency graph

      The literal test: the cell x, holding the truth value v, satisfies the clause c. This is the first-order test on the source structure that the transition relation performs.

      Equations
      Instances For
        Dependency graph

        The truth value the check phase tests: the value itself for a conjunctive matrix, its negation for a disjunctive one, so that the flag records a satisfied literal in the first case and a violated one in the second.

        Equations
        Instances For
          Dependency graph
          Dependency graph
          Dependency graph

          c' is the clause immediately above c.

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

            The elements of the machine #

            noncomputable def DescriptiveComplexity.AltQbf.qbotA {A : Type} [LinearOrder A] [Finite A] [Nonempty A] :
            A

            The least element of the instance, to which every constant of the machine is pinned.

            Equations
            Instances For
              Dependency graph
              Dependency graph
              Dependency graph
              @[reducible, inline]

              The universe of the machine: tagged pairs.

              Equations
              Instances For
                Dependency graph
                noncomputable def DescriptiveComplexity.AltQbf.acstI {k : } {A : Type} [LinearOrder A] [Finite A] [Nonempty A] (t : AltBase) (i : Fin (k + 1)) :
                AltV k A

                A constant of the machine at the sweep index i.

                Equations
                Instances For
                  Dependency graph
                  noncomputable def DescriptiveComplexity.AltQbf.aoneI {k : } {A : Type} [LinearOrder A] [Finite A] [Nonempty A] (t : AltBase) (i : Fin (k + 1)) (a : A) :
                  AltV k A

                  A tag carrying one element at the sweep index i.

                  Equations
                  Instances For
                    Dependency graph
                    @[reducible, inline]
                    noncomputable abbrev DescriptiveComplexity.AltQbf.acst {k : } {A : Type} [LinearOrder A] [Finite A] [Nonempty A] (t : AltBase) :
                    AltV k A

                    A constant of the machine: a tag on the pair of least elements.

                    Equations
                    Instances For
                      Dependency graph
                      @[reducible, inline]
                      noncomputable abbrev DescriptiveComplexity.AltQbf.aone {k : } {A : Type} [LinearOrder A] [Finite A] [Nonempty A] (t : AltBase) (a : A) :
                      AltV k A

                      A tag carrying one element, pinned in the second coordinate.

                      Equations
                      Instances For
                        Dependency graph

                        Symbols #

                        Dependency graph
                        @[reducible, inline]
                        noncomputable abbrev DescriptiveComplexity.AltQbf.symEnd {k : } {A : Type} [LinearOrder A] [Finite A] [Nonempty A] :
                        AltV k A

                        The right-marker symbol.

                        Equations
                        Instances For
                          Dependency graph
                          Dependency graph
                          @[reducible, inline]
                          noncomputable abbrev DescriptiveComplexity.AltQbf.symV {k : } {A : Type} [LinearOrder A] [Finite A] [Nonempty A] (v : Bool) (x : A) :
                          AltV k A

                          The symbol of the cell of x, holding the truth value v.

                          Equations
                          Instances For
                            Dependency graph

                            Positions #

                            Dependency graph
                            @[reducible, inline]
                            noncomputable abbrev DescriptiveComplexity.AltQbf.posCell {k : } {A : Type} [LinearOrder A] [Finite A] [Nonempty A] (x : A) :
                            AltV k A

                            The cell of the element x.

                            Equations
                            Instances For
                              Dependency graph
                              Dependency graph

                              States #

                              @[reducible, inline]
                              noncomputable abbrev DescriptiveComplexity.AltQbf.stG {k : } {A : Type} [LinearOrder A] [Finite A] [Nonempty A] (i : Fin (k + 1)) (d : Bool) :
                              AltV k A

                              Sweeping in direction d during the sweep of index i. The index runs over Fin (k + 1), but only the values below k are ever reached.

                              Equations
                              Instances For
                                Dependency graph
                                @[reducible, inline]
                                noncomputable abbrev DescriptiveComplexity.AltQbf.stChk {k : } {A : Type} [LinearOrder A] [Finite A] [Nonempty A] (f d : Bool) (c : A) :
                                AltV k A

                                Checking the clause c, flag f, sweeping in direction d.

                                Equations
                                Instances For
                                  Dependency graph
                                  Dependency graph

                                  The transition table #

                                  Which tagged tuples are transitions. The payload is pinned exactly as far as the transition needs it, the sweep index is required to be a real sweep, and the clause coordinates are required to be clauses, so that no junk element is ever a transition.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    Dependency graph
                                    def DescriptiveComplexity.AltQbf.AltSrc {k : } {A : Type} [LinearOrder A] [Finite A] [Nonempty A] (cnf : Bool) (τ q : AltV k A) :

                                    The state a transition applies in. The accepting turn fires at the flag cnf: set, for a conjunctive matrix, where it means the clause is satisfied; clear, for a disjunctive one, where it means no literal of the term is violated.

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

                                      The symbol a transition reads.

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

                                        The state a transition moves to. The only place the instance is consulted is the check clause, where the new flag depends on DescriptiveComplexity.QbfLit.

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

                                          The symbol a transition writes: only a guessing sweep ever changes the tape, and only from false to true.

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

                                            Which transitions move the head right: a sweep goes in its own direction, and every transition that fires at a marker moves away from it.

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

                                              The quantifier block an element belongs to: its sweep index for a sweeping state, the last block for the check and the accepting state, and block 0 for everything else – DescriptiveComplexity.ATMData.BlocksWellFormed asks every element for a block, junk included.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                Dependency graph
                                                def DescriptiveComplexity.AltQbf.AltBlkOf {k : } {A : Type} (j : ) (q : AltV k A) :

                                                The block marks of the machine.

                                                Equations
                                                Instances For
                                                  Dependency graph

                                                  The alternating machine of a quantified Boolean formula.

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

                                                    The instance obligations #

                                                    Everything DescriptiveComplexity.TMData.WellFormed and DescriptiveComplexity.ATMData.BlocksWellFormed ask, discharged before any run is considered.

                                                    Dependency graph
                                                    theorem DescriptiveComplexity.AltQbf.altBlockOf_lt {k : } {A : Type} (hk : 0 < k) (q : AltV k A) :
                                                    Dependency graph
                                                    theorem DescriptiveComplexity.AltQbf.altBlockOf_stG {k : } {A : Type} [LinearOrder A] [Finite A] [Nonempty A] {i : Fin (k + 1)} (hi : i < k) (d : Bool) :
                                                    altBlockOf (stG i d) = i

                                                    A sweeping state's block is its sweep index.

                                                    Dependency graph
                                                    theorem DescriptiveComplexity.AltQbf.altBlockOf_stChk {k : } {A : Type} [LinearOrder A] [Finite A] [Nonempty A] (f d : Bool) (c : A) :
                                                    altBlockOf (stChk f d c) = k - 1
                                                    Dependency graph
                                                    Dependency graph

                                                    The block structure is well formed: every element has exactly one block, a transition stays in its block or moves to the next one, and a start state is in block 0.

                                                    Dependency graph