Documentation

DescriptiveComplexity.Problems.HornSat.Hardness

Hardness of HORN-SAT: the Horn discharge #

Every SO-Horn definable problem admits an ordered first-order reduction to HORN-SAT (DescriptiveComplexity.hornSat_hard_of_sigmaSOHornDefinable): the machine-free P-hardness statement, one level below the Cook–Levin discharge of DescriptiveComplexity.Problems.Sat.Hardness and in the same style.

It is simpler than Cook–Levin, and this is the whole point of the Horn fragment. The Tseitin translation of an arbitrary first-order kernel has to name every subformula by an auxiliary gate variable, and the gate clauses it emits are not Horn. Here nothing has to be named: a Horn program (DescriptiveComplexity.HornProgram) is already a conjunction of clauses, its first-order guards mention the input vocabulary only – so they are evaluated in the input structure rather than encoded – and each clause instance translates to one propositional clause with at most one positive literal.

Given a block B, a number k of universally quantified first-order variables and a program prog, the reduction interprets, inside an ordered input structure A:

A clause of the program with no head (a goal clause) yields a purely negative propositional clause, and one with a head yields exactly one positive literal: the interpreted structure is always Horn (DescriptiveComplexity.horn_atMostOnePositive), which is what makes the reduction land in HORN-SAT rather than merely in SAT.

The correctness proof (DescriptiveComplexity.horn_satisfiable_iff) reads in both directions 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 #

The dimension, the tags and the two generic defining formulas are shared with the Krom discharge; they live in DescriptiveComplexity.ClauseDischarge.

@[reducible, inline]

The tags of the Horn 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 defining formulas #

      noncomputable def DescriptiveComplexity.headOccF {L : FirstOrder.Language} {B : SOBlock} {k : } {γ : Type} (c : HornClause (L.sum FirstOrder.Language.order) B k) (i : B.ι) (u x : Fin (clauseDim B k)γ) :

      The defining formula of a positive occurrence: the head atom of the clause, when it is an atom of the relation variable i.

      Equations
      Instances For
        Dependency graph
        noncomputable def DescriptiveComplexity.bodyOccF {L : FirstOrder.Language} {B : SOBlock} {k : } {γ : Type} (c : HornClause (L.sum FirstOrder.Language.order) B k) (i : B.ι) (u x : Fin (clauseDim B k)γ) :

        The defining formula of a negative occurrence: any body atom of the clause that is an atom of the relation variable i.

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

          Realization of the defining formulas #

          theorem DescriptiveComplexity.realize_headOccF {L : FirstOrder.Language} {B : SOBlock} {k : } {γ A : Type} [L.Structure A] [LinearOrder A] {v : γA} {c : HornClause (L.sum FirstOrder.Language.order) B k} {i : B.ι} {u x : Fin (clauseDim B k)γ} :
          (headOccF c i u x).Realize v ac.head, a.idx = i PadTup (atomIdx a) (fun (j : Fin (clauseDim B k)) => v (u j)) fun (j : Fin (clauseDim B k)) => v (x j)
          Dependency graph
          theorem DescriptiveComplexity.realize_bodyOccF {L : FirstOrder.Language} {B : SOBlock} {k : } {γ A : Type} [L.Structure A] [LinearOrder A] {v : γA} {c : HornClause (L.sum FirstOrder.Language.order) B k} {i : B.ι} {u x : Fin (clauseDim B k)γ} :
          (bodyOccF c i u x).Realize v ac.body, a.idx = i PadTup (atomIdx a) (fun (j : Fin (clauseDim B k)) => v (u j)) fun (j : Fin (clauseDim B k)) => v (x j)
          Dependency graph

          The Horn 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: the head atom of the clause, at the canonically padded tuple of its arguments.

            Dependency graph

            The negative literals: any body atom of the clause, at the canonically padded tuple of its arguments.

            Dependency graph

            The interpreted structure is Horn, and correct #

            The interpretation always lands in HORN-SAT: a clause of the program has at most one head atom, and canonical padding makes the element encoding it unique, so every interpreted clause has at most one positive literal.

            Dependency graph

            Correctness of the Horn 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 HORN-SAT.

            Dependency graph
            noncomputable def DescriptiveComplexity.hornReduction {L : FirstOrder.Language} {B : SOBlock} {k : } (prog : HornProgram (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 Horn reduction: an ordered first-order reduction to HORN-SAT from any problem defined, on nonempty finite structures, by an existential second-order sentence with a Horn kernel.

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

              P-hardness of HORN-SAT, machine-free: every SO-Horn definable problem admits an ordered first-order reduction to HORN-SAT. This is the Horn analogue of the Cook–Levin discharge DescriptiveComplexity.sat_hard_of_sigmaSODefinable, one level below it.

              Dependency graph