Documentation

DescriptiveComplexity.Problems.SatUnsat.Hardness

DP-hardness of SAT-UNSAT #

The hardness half of the completeness of SAT-UNSAT (Papadimitriou & Yannakakis 1984): every DP-definable problem admits an ordered first-order reduction to SAT-UNSAT (DescriptiveComplexity.satUnsat_hard_of_dpDefinable), which with the membership half DescriptiveComplexity.satUnsat_mem_DP makes it DP-complete (DescriptiveComplexity.SATUNSAT_DP_complete).

A DP definition of Q is a Σ₁-definable S and a Π₁-definable T with Q ≡ S ⊓ T. Complementing the second half, Tᶜ is Σ₁-definable, so the Cook–Levin discharge DescriptiveComplexity.sat_hard_of_sigmaSODefinable applies to both S and Tᶜ and yields two ordered reductions to SAT. Running them side by side into one paired-CNF instance is what this file does: Q holds iff the first CNF instance is satisfiable and the second is not, which is exactly SAT-UNSAT of the pair.

Pairing two interpretations #

DescriptiveComplexity.pairInterp puts two interpretations into Language.sat together into one interpretation into Language.satPair: tags T₁ ⊕ T₂, dimension max d₁ d₂, and each of the six relations defined by its own side's formula on its own tags – and by as soon as one argument's tag belongs to the other side, so that the two formulas never see each other's points.

The two sides now share a universe of tuples longer than either originally used, and the extra coordinates must not be left free: a clause and its variables would acquire |A|^(dim−dᵢ) copies each, every clause copy containing every copy of each of its variables, and the blow-up of an unsatisfiable instance can be satisfiable ({x}, {¬x} becomes (x₁ ∨ … ∨ xₖ) ∧ (¬x₁ ∨ … ∨ ¬xₖ)). So each side's formulas are conjoined with DescriptiveComplexity.canonF, pinning the spare coordinates to a minimum of the order: the points of a side are then in bijection with the points of its own interpretation (DescriptiveComplexity.sidePt), and everything else in the paired universe is junk – neither a clause nor an occurrence, hence harmless by DescriptiveComplexity.satisfiable_iff_of_cover.

Both sides are handled once, by a section generic in the tag injection inj : T → Tg and its partial inverse get : Tg → Option T, instantiated at Sum.inl/Sum.getLeft? and Sum.inr/Sum.getRight?.

Satisfiability of one side, along a covering embedding #

The Language.satPair counterpart of DescriptiveComplexity.satisfiable_iff_of_cover: one side of a paired instance is satisfiable exactly when a plain CNF structure covering its clauses and occurrences is.

Satisfiability of a side transfers along a clause-covering embedding: the elements of the paired instance outside the image of j are neither clauses nor occurrences of that side, so they constrain nothing.

Dependency graph

One side of the paired instance #

The defining formulas of one side, and the characterization of the relations they interpret. Everything here is generic in the tag injection inj and its partial inverse get, so that it serves both sides of the pair.

noncomputable def DescriptiveComplexity.sideFml {L : FirstOrder.Language} {T Tg : Type} {dm d : } (I : FOInterpretation (L.sum FirstOrder.Language.order) FirstOrder.Language.sat T dm) (hd : dm d) (get : TgOption T) {n : } (R : FirstOrder.Language.sat.Relations n) (t : Fin nTg) :

The defining formula of one side's relation R at a tuple t of tags: this side's own formula, its coordinates re-read among the d available ones and its argument tuples pinned to canonically padded ones – and unless every argument's tag belongs to this side.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    Dependency graph
    theorem DescriptiveComplexity.sideFml_eq_bot {L : FirstOrder.Language} {T Tg : Type} {dm d : } (I : FOInterpretation (L.sum FirstOrder.Language.order) FirstOrder.Language.sat T dm) (hd : dm d) (get : TgOption T) {n : } (R : FirstOrder.Language.sat.Relations n) (t : Fin nTg) (h : ¬∀ (i : Fin n), (get (t i)).isSome = true) :
    sideFml I hd get R t =

    A tag of the other side makes a side's defining formula .

    Dependency graph
    theorem DescriptiveComplexity.realize_sideFml {L : FirstOrder.Language} {T Tg : Type} {dm d : } (I : FOInterpretation (L.sum FirstOrder.Language.order) FirstOrder.Language.sat T dm) (hd : dm d) (get : TgOption T) {n : } (R : FirstOrder.Language.sat.Relations n) (t : Fin nTg) (t' : Fin nT) (ht : ∀ (i : Fin n), get (t i) = some (t' i)) {A : Type} [L.Structure A] [LinearOrder A] (v : Fin n × Fin dA) :
    (sideFml I hd get R t).Realize v ((I.relFormula R t').Realize fun (p : Fin n × Fin dm) => v (p.1, Fin.castLE hd p.2)) ∀ (i : Fin n), Canon dm fun (j : Fin d) => v (i, j)

    Realization of a side's defining formula at tags that all belong to it: this side's own formula holds of the prefixes, and every argument tuple is canonically padded.

    Dependency graph

    The points of one side #

    A tuple congruence for relations, then the injection of one side's own interpretation into the paired universe and the characterization of the interpreted relations along it.

    The point of the paired universe holding a point of one side's own interpretation: its tag injected, its tuple canonically padded.

    Equations
    Instances For
      Dependency graph
      theorem DescriptiveComplexity.relMap_side {L : FirstOrder.Language} {T Tg : Type} {dm d : } {A : Type} [L.Structure A] [LinearOrder A] (I : FOInterpretation (L.sum FirstOrder.Language.order) FirstOrder.Language.sat T dm) (hd : dm d) (get : TgOption T) (J : FOInterpretation (L.sum FirstOrder.Language.order) FirstOrder.Language.satPair Tg d) (sym : (n : ) → FirstOrder.Language.sat.Relations nFirstOrder.Language.satPair.Relations n) (hJ : ∀ (n : ) (R : FirstOrder.Language.sat.Relations n), J.relFormula (sym n R) = sideFml I hd get R) {n : } (R : FirstOrder.Language.sat.Relations n) (xs : Fin nJ.Map A) (t : Fin nT) (ht : ∀ (i : Fin n), get (xs i).1 = some (t i)) :
      FirstOrder.Language.Structure.RelMap (sym n R) xs (FirstOrder.Language.Structure.RelMap R fun (i : Fin n) => (t i, pref hd (xs i).2)) ∀ (i : Fin n), Canon dm (xs i).2

      What a side's relations say: at tags that all belong to the side, its own relation of the prefixes, plus canonicity of every argument tuple.

      Dependency graph

      A side's relations only hold of tags belonging to it.

      Dependency graph
      theorem DescriptiveComplexity.exists_tags_of_relMap_side {L : FirstOrder.Language} {T Tg : Type} {dm d : } {A : Type} [L.Structure A] [LinearOrder A] (I : FOInterpretation (L.sum FirstOrder.Language.order) FirstOrder.Language.sat T dm) (hd : dm d) (get : TgOption T) (J : FOInterpretation (L.sum FirstOrder.Language.order) FirstOrder.Language.satPair Tg d) (sym : (n : ) → FirstOrder.Language.sat.Relations nFirstOrder.Language.satPair.Relations n) (hJ : ∀ (n : ) (R : FirstOrder.Language.sat.Relations n), J.relFormula (sym n R) = sideFml I hd get R) {n : } (R : FirstOrder.Language.sat.Relations n) (xs : Fin nJ.Map A) (h : FirstOrder.Language.Structure.RelMap (sym n R) xs) :
      ∃ (t : Fin nT), ∀ (i : Fin n), get (xs i).1 = some (t i)

      The tags of a tuple satisfying a side's relation, as a function.

      Dependency graph
      theorem DescriptiveComplexity.relMap_side_pad {L : FirstOrder.Language} {T Tg : Type} {dm d : } {A : Type} [L.Structure A] [LinearOrder A] (I : FOInterpretation (L.sum FirstOrder.Language.order) FirstOrder.Language.sat T dm) (hd : dm d) (inj : TTg) (get : TgOption T) (J : FOInterpretation (L.sum FirstOrder.Language.order) FirstOrder.Language.satPair Tg d) (sym : (n : ) → FirstOrder.Language.sat.Relations nFirstOrder.Language.satPair.Relations n) (hget : ∀ (t : T), get (inj t) = some t) (hJ : ∀ (n : ) (R : FirstOrder.Language.sat.Relations n), J.relFormula (sym n R) = sideFml I hd get R) {a₀ : A} (ha₀ : IsBot a₀) {n : } (R : FirstOrder.Language.sat.Relations n) (bs : Fin nI.Map A) :
      (FirstOrder.Language.Structure.RelMap (sym n R) fun (i : Fin n) => sidePt I inj J a₀ (bs i)) FirstOrder.Language.Structure.RelMap R bs

      A side's relations, read on its own points: on the image of DescriptiveComplexity.sidePt, the paired instance's side is a faithful copy of the interpretation it came from.

      Dependency graph
      theorem DescriptiveComplexity.exists_sidePt_of_relMap_side {L : FirstOrder.Language} {T Tg : Type} {dm d : } {A : Type} [L.Structure A] [LinearOrder A] (I : FOInterpretation (L.sum FirstOrder.Language.order) FirstOrder.Language.sat T dm) (hd : dm d) (inj : TTg) (get : TgOption T) (J : FOInterpretation (L.sum FirstOrder.Language.order) FirstOrder.Language.satPair Tg d) (sym : (n : ) → FirstOrder.Language.sat.Relations nFirstOrder.Language.satPair.Relations n) (hgetinv : ∀ (tg : Tg) (t : T), get tg = some ttg = inj t) (hJ : ∀ (n : ) (R : FirstOrder.Language.sat.Relations n), J.relFormula (sym n R) = sideFml I hd get R) {a₀ : A} (ha₀ : IsBot a₀) {n : } (R : FirstOrder.Language.sat.Relations n) (xs : Fin nJ.Map A) (h : FirstOrder.Language.Structure.RelMap (sym n R) xs) (i : Fin n) :
      ∃ (b : I.Map A), xs i = sidePt I inj J a₀ b

      Every point a side's relations mention is one of its own points.

      Dependency graph
      theorem DescriptiveComplexity.satWith_side {L : FirstOrder.Language} {T Tg : Type} {dm d : } {A : Type} [L.Structure A] [LinearOrder A] (I : FOInterpretation (L.sum FirstOrder.Language.order) FirstOrder.Language.sat T dm) (hd : dm d) (inj : TTg) (get : TgOption T) (J : FOInterpretation (L.sum FirstOrder.Language.order) FirstOrder.Language.satPair Tg d) (sym : (n : ) → FirstOrder.Language.sat.Relations nFirstOrder.Language.satPair.Relations n) [Finite A] [Nonempty A] (hget : ∀ (t : T), get (inj t) = some t) (hgetinv : ∀ (tg : Tg) (t : T), get tg = some ttg = inj t) (hJ : ∀ (n : ) (R : FirstOrder.Language.sat.Relations n), J.relFormula (sym n R) = sideFml I hd get R) :

      One side of a paired instance is satisfiable exactly when the interpretation it came from is. The junk of the paired universe – points of the other side, and tuples that are not canonically padded – is neither a clause nor an occurrence of this side, so it constrains no assignment.

      Dependency graph

      Pairing two interpretations into one #

      Dependency graph
      Dependency graph

      Two CNF interpretations, paired into one. The tags of the two sides are kept apart in a sum, the dimension is the larger of the two, and each of the six relations is defined by its own side's formula on its own tags, at canonically padded tuples – and by as soon as an argument belongs to the other side.

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

        The paired interpretation defines the first side's symbols by the first interpretation's formulas.

        Dependency graph

        The paired interpretation defines the second side's symbols by the second interpretation's formulas.

        Dependency graph

        The first side of the paired instance is satisfiable exactly when the first interpretation is.

        Dependency graph

        The second side of the paired instance is satisfiable exactly when the second interpretation is.

        Dependency graph

        The reduction #

        noncomputable def DescriptiveComplexity.pairReduction {L : FirstOrder.Language} {S T Q : DecisionProblem L} (f₁ : OrderedFOReduction S SAT) (f₂ : OrderedFOReduction T SAT) (hQ : ∀ (A : Type) [inst : L.Structure A] [Finite A] [Nonempty A], Q.Holds A S.Holds A T.Holds A) :

        Two reductions to SAT, paired into one reduction to SAT-UNSAT. Given a problem Q that is the conjunction of S and T, a reduction of S to SAT and one of Tᶜ to SAT, the paired interpretation sends A to the pair of their images: its first CNF instance is satisfiable iff S holds, and its second is unsatisfiable iff T does.

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

          DP-completeness of SAT-UNSAT #

          The hardness half: every DP-definable problem admits an ordered first-order reduction to SAT-UNSAT. The Σ₁ half and the complement of the Π₁ half are both discharged by Cook–Levin (DescriptiveComplexity.sat_hard_of_sigmaSODefinable), and the two CNF instances so produced are paired into one.

          Dependency graph
          Dependency graph

          SAT-UNSAT is DP-complete (Papadimitriou & Yannakakis 1984): membership is DescriptiveComplexity.satUnsat_mem_DP, the shape of the problem itself; hardness is DescriptiveComplexity.satUnsat_hard_of_dpDefinable, the two Cook–Levin discharges run side by side into one paired instance.

          Dependency graph