Documentation

DescriptiveComplexity.Problems.HornSat.Definability

HORN-SAT is SO-Horn definable #

HORNSAT ∈ PTIME (DescriptiveComplexity.hornSat_mem_PTIME): Horn satisfiability is itself definable in the Horn fragment, which with the discharge of DescriptiveComplexity.Problems.HornSat.Hardness makes HORN-SAT PTIME-complete (DescriptiveComplexity.HORNSAT_PTIME_complete).

The obstacle, and what the order is for: a clause of the input has an unbounded number of negative literals, so the rule “if all negative literals of c are forced then its positive literal is forced” is not a Horn clause – its body would have unboundedly many atoms. The standard fix walks the literals of a clause along the order. The program guesses

and derives B by four rules following the order (base case at the minimum, step case along the successor relation, each split on whether the current element is a negative literal of c), so that B c max is the unbounded conjunction, assembled one element at a time. One further rule derives T from a clause whose body is complete, and two goal clauses reject the two ways of failing: a clause with no positive literal whose body is complete, and a clause with two distinct positive literals (the Horn condition itself, which DescriptiveComplexity.HORNSAT folds into its yes-instances).

All the order-dependent predicates – being minimal or maximal, being the immediate successor – are first-order over Language.sat.sum Language.order (the shared guards of DescriptiveComplexity.OrderWalk), and appear only in guards, where arbitrary first-order formulas are allowed. The second-order atoms are T and B only, one or two per clause body: the program is Horn.

The Horn program #

The block of the SO-Horn definition of HORN-SAT: a unary relation variable T (the variables forced true) and a binary one B (B c z: every negative literal of the clause c up to z is forced).

Equations
Instances For
    Dependency graph

    The atom T xᵢ.

    Equations
    Instances For
      Dependency graph

      The atom B (xᵢ, xⱼ).

      Equations
      Instances For
        Dependency graph
        @[reducible, inline]

        The “is a clause” symbol over the ordered expansion.

        Equations
        Instances For
          Dependency graph
          @[reducible, inline]

          The positive-occurrence symbol over the ordered expansion.

          Equations
          Instances For
            Dependency graph
            @[reducible, inline]

            The negative-occurrence symbol over the ordered expansion.

            Equations
            Instances For
              Dependency graph
              Dependency graph
              Dependency graph
              Dependency graph

              The guard “the clause xᵢ has no positive literal”.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Dependency graph
                Dependency graph
                Dependency graph
                Dependency graph
                Dependency graph
                Dependency graph
                @[simp]
                theorem DescriptiveComplexity.realize_neqG {A : Type} [FirstOrder.Language.sat.Structure A] [LinearOrder A] {v : Fin 4A} (i j : Fin 4) :
                (neqG i j).Realize v v i v j
                Dependency graph

                Base rule: at the minimum, a non-literal position starts a complete body.

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

                  Base rule: at the minimum, a negative literal must be forced.

                  Equations
                  Instances For
                    Dependency graph

                    Step rule at a non-literal position.

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

                      Step rule at a negative literal, which must be forced.

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

                        Propagation: a clause whose body is complete forces its positive literal.

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

                          Goal clause: a clause with a complete body and no positive literal is falsified.

                          Equations
                          Instances For
                            Dependency graph

                            Goal clause: two distinct positive literals in a clause violate the Horn condition, which DescriptiveComplexity.HORNSAT folds into its yes-instances.

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

                              The Horn program defining HORN-SAT.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                Dependency graph
                                theorem DescriptiveComplexity.tAt_holds {A : Type} (ρ : hsBlock.Assignment A) (v : Fin 4A) (i : Fin 4) :
                                (tAt i).Holds ρ v ρ true ![v i]
                                Dependency graph
                                theorem DescriptiveComplexity.bAt_holds {A : Type} (ρ : hsBlock.Assignment A) (v : Fin 4A) (i j : Fin 4) :
                                (bAt i j).Holds ρ v ρ false ![v i, v j]
                                Dependency graph

                                Correctness #

                                The intended interpretation of the variable B: every negative literal of the clause c up to z is forced.

                                Equations
                                Instances For
                                  Dependency graph

                                  The canonical assignment: the propagation closure and its partial bodies.

                                  Equations
                                  Instances For
                                    Dependency graph

                                    A complete body at a maximum means that all negative literals are forced.

                                    Dependency graph

                                    HORN-SAT is SO-Horn definable. The guessed relations are the propagation closure and its partial bodies; the order assembles the unbounded body of a clause one element at a time.

                                    Dependency graph
                                    Dependency graph