Documentation

CslibFrontier.Computability.Complexity.Problems.HornSAT

Horn satisfiability by forward chaining #

The state lists forced variables in their input occurrence order. Each pass filters the input variable list, so even exponentially large binary variable labels require no dense array. After at most the number of distinct occurring variables plus one passes, the state is closed under all positive Horn implications. Evaluating the original formula under this least assignment also checks negative-only constraints, including the empty clause.

Horn recognition counts positive occurrences, including repetitions. Negative occurrences may repeat, clauses may be tautological, and the empty formula is accepted.

Ordinary Horn satisfiability on CNF formulas with binary natural-number variable names.

Instances For

    Every negative antecedent is already forced. Positive literals impose no antecedent.

    Instances For
      def Cslib.Complexity.HornSAT.step {V : Type u_1} [DecidableEq V] (φ : Logic.PL.CNF V) (s : List V) :

      One simultaneous pass; the output is a sublist of the input's occurring variables.

      Instances For

        The forced variables after n simultaneous passes.

        Instances For

          The least-model candidate, with a budget determined by occurrences rather than labels.

          Instances For

            Check Horn syntax and the least-model candidate.

            Instances For
              theorem Cslib.Complexity.HornSAT.enabled_eq_true_iff {V : Type u_1} [DecidableEq V] (s : List V) (c : Logic.PL.Clause V) :
              enabled s c = true ↔ ∀ l ∈ c, l.2 = false → l.1 ∈ s
              theorem Cslib.Complexity.HornSAT.mem_step {V : Type u_1} [DecidableEq V] (φ : Logic.PL.CNF V) (s : List V) (v : V) :
              v ∈ step φ s ↔ v ∈ φ.vars ∧ (v ∈ s ∨ ∃ c ∈ φ, (v, true) ∈ c ∧ enabled s c = true)

              Every intermediate state has occurrence-bounded storage.

              theorem Cslib.Complexity.HornSAT.forced_subset_succ {V : Type u_1} [DecidableEq V] (φ : Logic.PL.CNF V) (n : ℕ) :
              forced φ n ⊆ forced φ (n + 1)

              Forward chaining is inflationary on its reachable states.

              theorem Cslib.Complexity.HornSAT.forced_le_model {V : Type u_1} [DecidableEq V] {φ : Logic.PL.CNF V} (hφ : φ.IsHorn) {σ : V → Bool} (hσ : Logic.PL.CNF.eval σ φ = true) (n : ℕ) (v : V) :
              v ∈ forced φ n → σ v = true

              Every variable forced by any pass is true in every model.

              theorem Cslib.Complexity.HornSAT.forced_fixed {V : Type u_1} [DecidableEq V] (φ : Logic.PL.CNF V) :
              step φ (forced φ (φ.numVars + 1)) = forced φ (φ.numVars + 1)

              The loop reaches a fixed point within the number of distinct occurring variables plus one passes. The bound is independent of their numerical labels and repeated occurrences.

              If a model exists, the closed forced assignment satisfies every clause.

              theorem Cslib.Complexity.HornSAT.assignment_le_of_eval {V : Type u_1} [DecidableEq V] {φ : Logic.PL.CNF V} (hφ : φ.IsHorn) {σ : V → Bool} (hσ : Logic.PL.CNF.eval σ φ = true) (v : V) :
              assignment φ v ≤ σ v

              The forward-chaining candidate is pointwise at most every satisfying assignment.

              Among all satisfying assignments of a satisfiable Horn formula, assignment φ is the pointwise-least model.

              Correctness of the executable decider for ordinary HornSAT.

              The entire forward-chaining loop is polynomial-time. Every state is a filtered copy of the occurring-variable list, whose encoding length is polynomially bounded by the input encoding.

              Reading a variable from the least-model candidate is polynomial-time, even for a label larger than every label occurring in the formula.

              Ordinary HornSAT is in native multi-tape polynomial time under encCNF.

              The least Horn model need not be the only model: [[(0, false), (1, true)]] (x₀ → x₁) is in HornSAT, its least model assignment sets every variable to false, yet v ↦ (v == 1) is a second satisfying model differing on the occurring variable 1.

              Satisfiable dual Horn formulas under the same binary CNF encoding.

              Instances For

                Dual Horn satisfiability reduces to Horn satisfiability by flipping literal polarities.

                Instances For

                  Correctness of the dual Horn decider.

                  Polarity flipping changes no labels and is polynomial-time under the original encoding.

                  Ordinary dual HornSAT is in native multi-tape polynomial time.