Documentation

Complexity.Logics.Propositional.CNF.ExactOne.FromSAT

Parsimonious conversion of ordinary clauses to exact-one clauses #

Each clause of width at most three is replaced by the four-clause disjunction gadget of [Hunt, Marathe, Radhakrishnan and Stearns, Theorem 3.8, Figure 3.4] [HMRS98]. Missing literals are replaced by distinct, uniquely forced false variables. Unlike repeating a source literal, this preserves the number of occurrences of every source variable. Even an empty clause has an exact-three, unsatisfiable output. Clauses longer than three are truncated; correctness therefore requires the width bound.

Main definitions #

Main results #

References #

@[reducible, inline]

Source variables and clause-indexed auxiliary slots.

Instances For

    An auxiliary slot local to one source clause.

    Instances For

      Embed a signed source literal.

      Instances For

        A positive padding literal, used only when the corresponding source position is absent.

        Instances For
          def Cslib.Logic.PL.CNF.FromSAT.core {V : Type u_1} (i : ℕ) (p q r : Literal (Variable V)) :

          The uniquely extensible disjunction gadget in local slots three through seven.

          Instances For

            Force padding slot k false, using its own three auxiliary slots.

            Instances For

              Replace one clause by exact-three exact-one clauses, retaining every source occurrence once.

              Instances For

                Replace the source clauses, distinguishing auxiliaries by clause position.

                Instances For
                  def Cslib.Logic.PL.CNF.FromSAT.sourceValue {V : Type u_1} (σ : V → Bool) (c : Clause V) (k : ℕ) :

                  The source truth value at a clause position; absent positions are false.

                  Instances For
                    def Cslib.Logic.PL.CNF.FromSAT.auxiliaryValue {V : Type u_1} (σ : V → Bool) (c : Clause V) (k : ℕ) :

                    Canonical auxiliary values, including all three possible false-padding blocks.

                    Instances For
                      def Cslib.Logic.PL.CNF.FromSAT.assignment {V : Type u_1} (φ : CNF V) (σ : V → Bool) :

                      Extend an assignment by the uniquely determined values of all occurring auxiliaries.

                      Instances For

                        A clause contributes between four and thirteen clauses.

                        theorem Cslib.Logic.PL.CNF.FromSAT.width_clause {V : Type u_1} (i : ℕ) (c : Clause V) (d : Clause (Variable V)) :
                        d ∈ clause i c → List.length d = 3

                        Every output clause has exactly three literal occurrences.

                        Clause replacement increases the number of clauses by at most a factor of thirteen.

                        theorem Cslib.Logic.PL.CNF.FromSAT.width_formula {V : Type u_1} (φ : CNF V) (c : Clause (Variable V)) :
                        c ∈ formula φ → List.length c = 3

                        Every output clause is exact-three, including on malformed source inputs.

                        theorem Cslib.Logic.PL.CNF.FromSAT.clause_sound {V : Type u_1} (i : ℕ) (c : Clause V) (hc : List.length c ≤ 3) (τ : Variable V → Bool) (hτ : evalOne τ (clause i c) = true) :
                        Clause.eval (fun (v : V) => τ (Sum.inl v)) c = true

                        Every satisfying replacement restricts to a satisfying source clause.

                        theorem Cslib.Logic.PL.CNF.FromSAT.clause_complete {V : Type u_1} (φ : CNF V) (σ : V → Bool) (i : ℕ) (c : Clause V) (hi : φ[i]? = some c) (hc : List.length c ≤ 3) :

                        The canonical extension satisfies a local gadget exactly when its source clause holds.

                        theorem Cslib.Logic.PL.CNF.FromSAT.formula_sound {V : Type u_1} (φ : CNF V) (hw : ∀ c ∈ φ, List.length c ≤ 3) (τ : Variable V → Bool) (hτ : evalOne τ (formula φ) = true) :
                        eval (fun (v : V) => τ (Sum.inl v)) φ = true

                        Restricting an exact-one output assignment recovers an ordinary satisfying assignment.

                        theorem Cslib.Logic.PL.CNF.FromSAT.evalOne_formula_assignment {V : Type u_1} (φ : CNF V) (σ : V → Bool) (hw : ∀ c ∈ φ, List.length c ≤ 3) :
                        evalOne (assignment φ σ) (formula φ) = eval σ φ

                        The canonical extension satisfies the output exactly when the source assignment does.

                        Width-three ordinary satisfiability is equivalent to exact-one output satisfiability.

                        Three literal occurrences per output clause give a constant-factor literal bound.

                        theorem Cslib.Logic.PL.CNF.FromSAT.count_inl_clause {V : Type u_1} [DecidableEq V] (i : ℕ) (c : Clause V) (hc : List.length c ≤ 3) (v : V) :

                        Every inherited variable occurs exactly as often in its clause replacement as in the source clause. This includes repeated literals with either polarity.

                        theorem Cslib.Logic.PL.CNF.FromSAT.auxiliary_index {V : Type u_1} {i j k : ℕ} {c : Clause V} (h : Sum.inr (j, k) ∈ (clause i c).vars) :
                        j = i

                        The replacement uses auxiliaries only in its own clause index.

                        No local auxiliary exceeds three occurrences.

                        theorem Cslib.Logic.PL.CNF.FromSAT.nodup_clause {V : Type u_1} (i : ℕ) (c : Clause V) (d : Clause (Variable V)) :

                        Every replacement clause has three distinct variable names, even when source variables are repeated.

                        theorem Cslib.Logic.PL.CNF.FromSAT.vars_formula {V : Type u_1} (φ : CNF V) :
                        (formula φ).vars = List.flatMap (fun (c : Clause V × ℕ) => (clause c.2 c.1).vars) (List.zipIdx φ)

                        Taking variable occurrences commutes with concatenating clause replacements.

                        theorem Cslib.Logic.PL.CNF.FromSAT.count_inl_formula {V : Type u_1} [DecidableEq V] (φ : CNF V) (hw : ∀ c ∈ φ, List.length c ≤ 3) (v : V) :

                        Source occurrence counts are preserved exactly by the whole replacement.

                        Each auxiliary belongs to just one source clause, so the local degree bound is global.

                        theorem Cslib.Logic.PL.CNF.FromSAT.count_vars_formula_le {V : Type u_1} [DecidableEq V] (φ : CNF V) (hw : ∀ c ∈ φ, List.length c ≤ 3) (ho : ∀ (v : V), List.count v φ.vars ≤ 3) (v : Variable V) :

                        A three-occurrence source produces a three-occurrence exact-one formula.

                        theorem Cslib.Logic.PL.CNF.FromSAT.inl_mem_vars_formula {V : Type u_1} (φ : CNF V) (hw : ∀ c ∈ φ, List.length c ≤ 3) (v : V) :

                        Exactly the used source variables occur among the inherited output variables.

                        theorem Cslib.Logic.PL.CNF.FromSAT.clause_agree {V : Type u_1} (i : ℕ) (c : Clause V) (σ τ : Variable V → Bool) (hσ : evalOne σ (clause i c) = true) (hτ : evalOne τ (clause i c) = true) (hs : ∀ l ∈ c, σ (Sum.inl l.1) = τ (Sum.inl l.1)) (v : Variable V) :
                        v ∈ (clause i c).vars → σ v = τ v

                        Two satisfying local assignments that agree on source variables agree everywhere used by the replacement. This is the unique-extension property on the actual variable support.

                        theorem Cslib.Logic.PL.CNF.FromSAT.assignments_agree_iff {V : Type u_1} (φ : CNF V) (hw : ∀ c ∈ φ, List.length c ≤ 3) (σ τ : Variable V → Bool) (hσ : evalOne σ (formula φ) = true) (hτ : evalOne τ (formula φ) = true) :
                        (∀ v ∈ φ.vars, σ (Sum.inl v) = τ (Sum.inl v)) ↔ ∀ v ∈ (formula φ).vars, σ v = τ v

                        Satisfying output assignments are determined exactly by their source restrictions.

                        theorem Cslib.Logic.PL.CNF.FromSAT.oneModelCount_formula {V : Type u_1} [DecidableEq V] (φ : CNF V) (hw : ∀ c ∈ φ, List.length c ≤ 3) :

                        The ordinary and exact-one counts coincide, on occurring variables on both sides.