Documentation

DescriptiveComplexity.Problems.TwoSat.Hardness

Hardness of 2SAT: the Krom discharge #

Every SO-Krom definable problem admits an ordered first-order reduction to 2SAT (DescriptiveComplexity.twoSat_hard_of_sigmaSOKromDefinable): the machine-free NL-hardness statement, the Krom analogue of the Horn discharge of DescriptiveComplexity.Problems.HornSat.Hardness.

The construction is the shared one of DescriptiveComplexity.ClauseDischarge: inside an ordered input structure A,

Only the last point differs from the Horn discharge, which reads a head and a body list instead of two signed slots. The consequence is the one that matters: a clause of the program has at most two literals, and canonical padding makes the element encoding each of them unique, so every interpreted clause has at most two literal occurrences (DescriptiveComplexity.KromDischarge.krom_widthAtMostTwo) – the output lands in 2SAT rather than merely in SAT, exactly as the Horn discharge's output is Horn.

Both directions of correctness (DescriptiveComplexity.KromDischarge.krom_satisfiable_iff) read through the canonical padding: an assignment ρ of the block gives the truth value ρ i (pref x) of the propositional variable (i, x), and conversely a satisfying truth assignment ν gives the assignment ρ i ā := ν (i, pad ā).

Tags and clause access #

@[reducible, inline]

The tags of the Krom interpretation: the generic clausal tags at the program's number of clauses.

Equations
Instances For
    Dependency graph
    @[reducible, inline]

    The c-th clause of the program.

    Equations
    Instances For
      Dependency graph

      The two literal slots of a clause, as a list – the shape both the defining formulas and the correctness proof quantify over.

      Equations
      Instances For
        Dependency graph
        Dependency graph
        Dependency graph
        Dependency graph

        The defining formulas of the literals #

        noncomputable def DescriptiveComplexity.KromDischarge.slotOccF {L : FirstOrder.Language} {B : SOBlock} {k : } {γ : Type} (o : Option (KromLit B k)) (pos : Bool) (i : B.ι) (u x : Fin (clauseDim B k)γ) :

        The occurrence formula of one literal slot, at a given sign: the slot's literal carries that sign, is an atom of the relation variable i, and the coordinates selected by x hold the canonically padded tuple of its arguments.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          Dependency graph
          noncomputable def DescriptiveComplexity.KromDischarge.litOccF {L : FirstOrder.Language} {B : SOBlock} {k : } {γ : Type} (c : KromClause (L.sum FirstOrder.Language.order) B k) (pos : Bool) (i : B.ι) (u x : Fin (clauseDim B k)γ) :

          The occurrence formula of a clause at a given sign: either of its two slots.

          Equations
          Instances For
            Dependency graph
            theorem DescriptiveComplexity.KromDischarge.realize_slotOccF {L : FirstOrder.Language} {B : SOBlock} {k : } {γ A : Type} [L.Structure A] [LinearOrder A] {v : γA} {o : Option (KromLit B k)} {pos : Bool} {i : B.ι} {u x : Fin (clauseDim B k)γ} :
            (slotOccF o pos i u x).Realize v lo, l.positive = pos l.atom.idx = i PadTup (atomIdx l.atom) (fun (j : Fin (clauseDim B k)) => v (u j)) fun (j : Fin (clauseDim B k)) => v (x j)
            Dependency graph
            theorem DescriptiveComplexity.KromDischarge.realize_litOccF {L : FirstOrder.Language} {B : SOBlock} {k : } {γ A : Type} [L.Structure A] [LinearOrder A] {v : γA} {c : KromClause (L.sum FirstOrder.Language.order) B k} {pos : Bool} {i : B.ι} {u x : Fin (clauseDim B k)γ} :
            (litOccF c pos i u x).Realize v oslots c, lo, l.positive = pos l.atom.idx = i PadTup (atomIdx l.atom) (fun (j : Fin (clauseDim B k)) => v (u j)) fun (j : Fin (clauseDim B k)) => v (x j)
            Dependency graph

            The interpretation #

            The Krom interpretation: the CNF instance of the propositional translation of the program, defined inside the ordered input structure.

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

              Characterization of the interpreted relations #

              Every statement below is the corresponding realization lemma read through DescriptiveComplexity.FOInterpretation.relMap_map; the tag combinations that are not listed have as defining formula, so the corresponding relation is empty.

              The clause elements: one per clause of the program and per canonically padded tuple satisfying that clause's guard.

              Dependency graph
              Dependency graph
              Dependency graph

              The positive literals: a slot of the clause carrying a positive literal, at the canonically padded tuple of its atom's arguments.

              Dependency graph

              The negative literals: a slot of the clause carrying a negated literal, at the canonically padded tuple of its atom's arguments.

              Dependency graph

              The output is width-two, and correct #

              noncomputable def DescriptiveComplexity.KromDischarge.slotPt {L : FirstOrder.Language} {B : SOBlock} {k : } {A : Type} (prog : KromProgram (L.sum FirstOrder.Language.order) B k) (a₀ : A) (l : KromLit B k) (u : Fin (clauseDim B k)A) :
              (kromInterp prog).Map A

              The propositional variable standing for the atom of a literal, at a clause tuple.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Dependency graph
                theorem DescriptiveComplexity.KromDischarge.krom_occ_cases {L : FirstOrder.Language} {B : SOBlock} {k : } {A : Type} [L.Structure A] [LinearOrder A] (prog : KromProgram (L.sum FirstOrder.Language.order) B k) {a₀ : A} (ha₀ : IsBot a₀) (c : Fin (List.length prog)) (u : Fin (clauseDim B k)A) (p : (kromInterp prog).Map A) (t : Bool) (hocc : SatOcc.OccIn (clTag c, u) p t) :
                oslots (clauseAt prog c), lo, t = l.positive p = slotPt prog a₀ l u

                Every occurrence of an interpreted clause comes from one of its two slots, at the canonical point of that slot's atom and with that slot's sign.

                Dependency graph

                The interpretation always lands in 2SAT: a clause of the program has at most two literals, and canonical padding makes the element encoding each of them unique, so every interpreted clause has at most two literal occurrences.

                Dependency graph

                Correctness of the Krom discharge: the program has a satisfying assignment iff the interpreted CNF is satisfiable.

                Dependency graph

                The program has a satisfying assignment iff the interpreted CNF is a yes-instance of 2SAT.

                Dependency graph
                noncomputable def DescriptiveComplexity.KromDischarge.kromReduction {L : FirstOrder.Language} {B : SOBlock} {k : } (prog : KromProgram (L.sum FirstOrder.Language.order) B k) (Q : DecisionProblem L) (hQ : ∀ (A : Type) [inst : L.Structure A] [inst_1 : LinearOrder A] [Finite A] [Nonempty A], Q.Holds A ∃ (ρ : B.Assignment A), prog.Holds ρ) :

                The generic Krom reduction: an ordered first-order reduction to 2SAT from any problem defined, on nonempty finite structures, by an existential second-order sentence with a Krom kernel.

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

                  NL-hardness of 2SAT, machine-free: every SO-Krom definable problem admits an ordered first-order reduction to 2SAT. This is the Krom analogue of the Horn discharge DescriptiveComplexity.hornSat_hard_of_sigmaSOHornDefinable, and of the Cook–Levin discharge above it: the clause list of the program is emitted directly, one 2-clause per clause and per instantiation of its universally quantified variables satisfying its guard.

                  Dependency graph