Documentation

DescriptiveComplexity.Problems.OneInSat.CountingFromSat

#SAT reduces parsimoniously to #1-in-SAT #

The reduction of 3SAT to 1-in-SAT in DescriptiveComplexity.Problems.OneInSat.Reduction uses the classical gadget, which gives some satisfying assignments two extensions: it preserves satisfiability, not the number of solutions. This file reduces #SAT to #1-in-SAT directly and parsimoniously (DescriptiveComplexity.sharpSat_ordered_parsimonious_sharpOneInSat), so #1-in-SAT is parsimoniously #P-complete (DescriptiveComplexity.sharpOneInSat_sharpP_parsimoniousComplete).

As in DescriptiveComplexity.Problems.ThreeSat.CountingFromSat, each occurrence (x, s) of a clause c has a prefix variable z, the truth of the disjunction of the occurrences of c up to it (DescriptiveComplexity.OccurrencePrefix). What changes is how z ↔ z' ∨ ℓ is said with exactly-one clauses, z' being the prefix variable of the preceding occurrence and ℓ the literal: three more variables name the cases z' ∧ ℓ, z' ∧ ¬ℓ and ¬z' ∧ ℓ, and three clauses,

each with exactly one true literal, force them and z. The first occurrence of a clause has the clause {¬z, ℓ}, and the last one the unit clause {z}.

The three clauses of the gate of an occurrence.

  • a : GK

    {¬z', g₁₁, g₁₀}.

  • b : GK

    {¬ℓ, g₁₁, g₀₁}.

  • c : GK

    {¬z, g₁₁, g₁₀, g₀₁}.

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

    The three case variables of the gate of an occurrence.

    • tt : GI

      z' ∧ ℓ.

    • tf : GI

      z' ∧ ¬ℓ.

    • ft : GI

      ¬z' ∧ ℓ.

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

      Tags of the interpretation.

      • var : OTag

        (.var, (x, x)) is the copy of the propositional variable x.

      • pre (s : Bool) : OTag

        (.pre s, (c, x)) is the prefix variable of the occurrence (x, s) of the clause c.

      • g (i : GI) (s : Bool) : OTag

        A case variable of the gate of an occurrence.

      • gk (k : GK) (s : Bool) : OTag

        A clause of the gate of an occurrence that has a predecessor.

      • kd (s : Bool) : OTag

        The clause {¬z, ℓ} of the first occurrence of a clause.

      • top (s : Bool) : OTag

        The unit clause {z} of the last occurrence of a clause.

      • empty : OTag

        (.empty, (c, c)) is the copy of the empty clause c.

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

          Defining formula for satPosIn.

          Equations
          Instances For
            Dependency graph

            Defining formula for satNegIn.

            Equations
            Instances For
              Dependency graph

              The parsimonious interpretation of 1-in-SAT instances in ordered CNF instances.

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

                Characterization of the interpreted relations #

                The literals of each clause #

                Dependency graph

                The prefix variable of the occurrence (x, s) of c.

                Equations
                Instances For
                  Dependency graph
                  def DescriptiveComplexity.SharpSatToOneIn.gP {A : Type} (i : GI) (s : Bool) (c x : A) :

                  A case variable of the gate of the occurrence (x, s) of c.

                  Equations
                  Instances For
                    Dependency graph
                    theorem DescriptiveComplexity.SharpSatToOneIn.pair_eq {A : Type} {t : OTag} {we : Fin 2 → A} {c x : A} (h0 : we 0 = c) (h1 : we 1 = x) :
                    (t, we) = (t, ![c, x])
                    Dependency graph
                    Dependency graph
                    Dependency graph

                    Exactly-one assignments, read as gate valuations #

                    structure DescriptiveComplexity.SharpSatToOneIn.GateVal {A : Type} [instS : FirstOrder.Language.sat.Structure A] [instO : LinearOrder A] (ν : A → Prop) (Z : A → A → Bool → Prop) (G : GI → A → A → Bool → Prop) :

                    A gate valuation of the assignment ν: prefix values Z and case values G, each forced by ν along the occurrences of every clause, with the prefix value true at the last occurrence and no empty clause.

                    Instances For
                      Dependency graph

                      The assignment read on the variable copies.

                      Equations
                      Instances For
                        Dependency graph
                        def DescriptiveComplexity.SharpSatToOneIn.preVal {A : Type} (μ : interp.Map A → Prop) (c x : A) (s : Bool) :

                        The assignment read on the prefix variables.

                        Equations
                        Instances For
                          Dependency graph
                          def DescriptiveComplexity.SharpSatToOneIn.gVal {A : Type} (μ : interp.Map A → Prop) (i : GI) (c x : A) (s : Bool) :

                          The assignment read on the case variables.

                          Equations
                          Instances For
                            Dependency graph
                            theorem DescriptiveComplexity.SharpSatToOneIn.ne_of_tag {A : Type} {t t' : OTag} {w w' : Fin 2 → A} (h : t ≠ t') :
                            (t, w) ≠ (t', w')
                            Dependency graph

                            Every clause of the interpreted instance has exactly one true literal exactly when the assignment is a gate valuation, read on the variable copies, the prefix variables and the case variables.

                            Dependency graph

                            The variables of the interpreted instance #

                            Exactly-one models of the interpreted instance are models of the input #

                            The assignment of the interpreted instance determined by an assignment of the input, before its restriction to the variables of the instance.

                            Equations
                            Instances For
                              Dependency graph
                              theorem DescriptiveComplexity.SharpSatToOneIn.val_congr {A : Type} {μ : interp.Map A → Prop} (t : OTag) {u u' : Fin 2 → A} (h : u = u') :
                              μ (t, u) ↔ μ (t, u')
                              Dependency graph
                              theorem DescriptiveComplexity.SharpSatToOneIn.gateVal_canon {A : Type} [instS : FirstOrder.Language.sat.Structure A] [instO : LinearOrder A] [Finite A] {ν : A → Prop} (hν : ∀ (c : A), SatOcc.IsCl c → ∃ (x : A) (s : Bool), SatOcc.OccIn c x s ∧ SatOcc.LitTrue ν x s) :
                              GateVal (varVal (canon ν)) (preVal (canon ν)) (gVal (canon ν))

                              A satisfying assignment has a gate valuation.

                              Dependency graph

                              The exactly-one models of the interpreted instance are the models of the input, bijectively.

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

                                Correctness of the interpretation, for counting: the interpreted instance has as many exactly-one models as the input has models.

                                Dependency graph

                                #SAT reduces parsimoniously to #1-in-SAT.

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

                                  SharpOneInSAT is #P-complete: parsimoniously, hence under subtractive reductions.

                                  Dependency graph