Documentation

DescriptiveComplexity.Problems.Qbf.Hardness

Hardness of QBF #

The hardness half of the completeness of DescriptiveComplexity.QBF: every problem definable by a second-order sentence with k + 1 alternating blocks admits an ordered first-order reduction to DescriptiveComplexity.QBF (k + 1) (DescriptiveComplexity.qbf_hard_of_sigmaSODefinable). This is the Cook–Levin discharge of DescriptiveComplexity.Problems.Sat.Hardness with block marks added.

The quantifier prefix of a second-order definition is merged into a single block (DescriptiveComplexity.SecondOrderMerge), the Tseitin translation (Tseitin 1968) of the resulting first-order kernel is interpreted inside an ordered input structure exactly as for SAT (DescriptiveComplexity.qbfTseitinInterp), and each propositional variable is marked with the quantifier block it belongs to: an atom variable with the block its relation variable comes from, and every gate variable with the innermost block.

Gate variables can only be marked innermost, and only work out when the innermost quantifier is existential – they are functionally determined by the atoms, so ∃ gates, CNF ↔ φ, whereas a universal player could falsify a gate clause. With an existential outermost block the innermost quantifier is existential exactly when k is odd, which is why the literal signs of the interpretation are swapped (the parameter sw), and the kernel negated, when k is even: the disjunctive matrix of DescriptiveComplexity.QBF k at even k is, by DescriptiveComplexity.dnfSat_iff_not_cnfSatWith_true, the negation of a conjunctive matrix with all signs swapped, and that negation turns the innermost universal quantifier back into an existential one over the gates. The swap is arranged so that the parity disappears from the correctness proof: whichever of posIn/negIn a satisfied clause must make true always carries the positive Tseitin literals (DescriptiveComplexity.qbfT_lit_pos).

The key correctness statement is DescriptiveComplexity.qbfT_clauses_iff, the ∃-free form of DescriptiveComplexity.tseitin_satisfiable_iff: with the truth assignment given – as the quantifier prefix of a QBF supplies it, rather than existentially quantified as for SAT – the clauses of the encoding hold exactly when the induced valuation satisfies every Tseitin gate and makes the root variable true.

The discharge itself is DescriptiveComplexity.qbf_hard_of_sigmaSODefinable; together with the membership half of DescriptiveComplexity.Problems.Qbf.Membership it gives the completeness theorem DescriptiveComplexity.QBF_complete.

@[reducible]

The block of Tseitin gate variables: one relation variable per subformula position of the kernel, of the interpretation's dimension. Reducible, so that (gateBlock M ψ).ι unfolds to the type of subformula positions.

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

    The Tseitin interpretation with block marks: the CNF instance of the encoding of ψ, with each propositional variable marked by the quantifier block it belongs to. The signs of the literals are swapped when sw is true, i.e., when the innermost quantifier of the prefix is universal.

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

      Characterization of the interpreted relations #

      The literal that a satisfied clause needs to make true: whichever of posIn/negIn carries the positive Tseitin literals.

      Dependency graph

      Correctness at a fixed valuation #

      The Tseitin correctness proof of DescriptiveComplexity.Problems.Sat.Hardness is stated with the truth assignment existentially quantified. Here the assignment is given, since the quantifier prefix of the QBF supplies it: the clauses of the encoding hold under val exactly when the induced valuation satisfies every gate and makes the root true.

      Correctness of the interpretation at a fixed valuation.

      Dependency graph

      The reduction #

      Whether the innermost quantifier of an existentially-starting prefix with Bs.length + 1 blocks is universal – equivalently, whether Bs.length + 1 is even. The Tseitin gates can only be absorbed by an existential quantifier, so this is the flag that decides both the shape of the matrix and whether the kernel gets negated.

      Equations
      Instances For
        Dependency graph
        noncomputable def DescriptiveComplexity.qbfEnc {L : FirstOrder.Language} (st : Bool) (B : SOBlock) (Bs : List SOBlock) (φ : (soLang L (B :: Bs)).Sentence) :

        The sentence that is actually Tseitin-encoded: the merged kernel, negated when the innermost quantifier is universal.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          Dependency graph
          @[reducible, inline]
          noncomputable abbrev DescriptiveComplexity.qbfGt {L : FirstOrder.Language} (st : Bool) (B : SOBlock) (Bs : List SOBlock) (φ : (soLang L (B :: Bs)).Sentence) :

          The block of gate variables of the encoding.

          Equations
          Instances For
            Dependency graph
            noncomputable def DescriptiveComplexity.qbfMk {L : FirstOrder.Language} (st : Bool) (B : SOBlock) (Bs : List SOBlock) (φ : (soLang L (B :: Bs)).Sentence) :
            (mergeBlocks (B :: Bs)).ι ⊕ (m : ℕ) × Tseitin.NodeAt (qbfEnc st B Bs φ) m → Fin (Bs.length + 1)

            The block marks of the interpreted instance: a relation variable is marked by the block it comes from, a gate variable by the innermost block.

            Equations
            Instances For
              Dependency graph
              @[reducible]

              The interpretation of the reduction: the Tseitin encoding of the merged kernel, with block marks. Reducible, so that the characterizations of DescriptiveComplexity.qbfTseitinInterp apply to it directly.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Dependency graph
                theorem DescriptiveComplexity.qbfRed_correct {L : FirstOrder.Language} (st : Bool) (B : SOBlock) (Bs : List SOBlock) (φ : (soLang L (B :: Bs)).Sentence) {A : Type} [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A] :
                (QbfProblem (Bs.length + 1) st !qbfSwap st Bs).Holds ((qbfRedInterp st B Bs φ).Map A) ↔ SORealize L A (B :: Bs) φ st

                Correctness of the reduction: the interpreted quantified Boolean formula is true exactly when the second-order sentence holds.

                Dependency graph
                noncomputable def DescriptiveComplexity.qbfReduction {L : FirstOrder.Language} (st : Bool) (B : SOBlock) (Bs : List SOBlock) (φ : (soLang L (B :: Bs)).Sentence) [L.IsRelational] (Q : DecisionProblem L) (hφ : ∀ (A : Type) [inst : L.Structure A] [Finite A] [Nonempty A], Q.Holds A ↔ SORealize L A (B :: Bs) φ st) :

                The generic marked Tseitin reduction: an ordered first-order reduction to a quantified Boolean formula problem, from any problem defined on nonempty finite structures by a second-order sentence with a nonempty prefix.

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

                  Hardness #

                  Hardness of QBF: every problem definable by a second-order sentence with k + 1 alternating blocks starting existentially admits an ordered first-order reduction to DescriptiveComplexity.QBF (k + 1).

                  This is the Cook–Levin discharge one level up: the quantifier prefix is merged into a single block, its first-order kernel is Tseitin-translated into a CNF instance inside an ordered input structure, and the propositional variables are marked with the block they belong to – the gate variables with the innermost one, which is why the matrix and the encoded sentence follow the parity of k + 1.

                  Dependency graph

                  Hardness of the dual: every problem definable by a second-order sentence with k + 1 alternating blocks starting universally admits an ordered first-order reduction to DescriptiveComplexity.QBFPi (k + 1).

                  This is the same construction at the other starting polarity. The parity of the matrix flips with it: the innermost quantifier of a universally-starting prefix of k + 1 blocks is existential exactly when k + 1 is even, so QBFPi k takes a conjunctive matrix for even k and a disjunctive one for odd k – the mirror image of DescriptiveComplexity.QBF.

                  Dependency graph