While this submission is a draft, it cannot be used by other submissions.

Counting the models of 3-CNF and 1-in-CNF formulas

Lax280166.CountingSatVariants · concepts/Lax280166/CountingSatVariants.lean · lax-280166

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Definition

    The instances are the CNF instances of the NP core. #3SAT counts the models of an instance whose clauses have at most three literals each, and is 00 on the others. #1-in-SAT counts the 1-in-models: the sets of variables such that every clause contains exactly one true literal.

    Concept map
    13 concepts; 25 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Lean source view on GitHub

    1import Mathlib.Tactic.FinCases
    2import Mathlib.Order.PiLex
    3import Mathlib.Data.Prod.Lex
    4import Mathlib.Data.Fintype.EquivFin
    5import Mathlib.ModelTheory.Order
    6import Mathlib.ModelTheory.Semantics
    7import Mathlib.ModelTheory.Complexity
    8import Mathlib.Logic.Equiv.Fin.Basic
    9import Mathlib.Data.Fintype.Lattice
    10import Mathlib.Data.Finite.Sigma
    11import Mathlib.Order.Lattice.Nat
    12import Mathlib.Data.Set.Card
    13import Mathlib.Data.Fintype.Pigeonhole
    14import Mathlib.Dynamics.FixedPoints.Basic
    15import Mathlib.ModelTheory.Syntax
    16import Mathlib.Algebra.Order.BigOperators.Group.Finset
    17import Mathlib.Data.Fintype.Card
    18import Mathlib.SetTheory.Cardinal.Finite
    19import Mathlib.Data.Set.Finite.Lemmas
    20import Lax366625.CountingSat
    21import Lax799700.OneInSat
    22import Lax904597.Sat
    23import Mathlib.SetTheory.Cardinal.Finite
    24import Lax366625.CountingProblems
    25import Lax366625.CountingSat
    26import Lax799700.ThreeSat
    27
    28/-!
    29---
    30title: Counting the models of 3-CNF and 1-in-CNF formulas
    31type: definition
    32---
    33The instances are the CNF instances of the NP core. #3SAT counts the models
    34of an instance whose clauses have at most three literals each, and is 00 on
    35the others. #1-in-SAT counts the 1-in-models: the sets of variables such
    36that every clause contains exactly one true literal.
    37-/
    38
    39namespace Lax280166.CountingSatVariants
    40
    41open Lax366625.CountingSat Lax799700.OneInSat Lax904597.Sat
    42
    43open FirstOrder
    44
    45open Language Structure
    46
    47/-- The set `ν` of true variables is an exactly-one model of the CNF formula:
    48every clause has exactly one true literal, and `ν` consists of variables of
    49the formula. -/
    50def OneInModel (A : Type) [sat.Structure A] (ν : A → Prop) : Prop :=
    51 OneInProper ν ∧ ∀ x : A, ν x → SatOccurs A x
    52
    53open Lax366625.CountingProblems Lax366625.CountingSat Lax799700.ThreeSat
    54
    55/-- **#3SAT**, as a counting problem. -/
    56noncomputable def SharpThreeSAT : CountingProblem Lax904597.Sat.sat :=
    57 CountingProblem.ofFun fun A _ =>
    58 Nat.card {ν : A → Prop // WidthAtMostThree A ∧ SatModel A ν}
    59
    60/-- **#1-in-SAT**, as a counting problem. -/
    61noncomputable def SharpOneInSAT : CountingProblem Lax904597.Sat.sat :=
    62 CountingProblem.ofFun fun A _ =>
    63 Nat.card {ν : A → Prop // OneInModel A ν}
    64
    65end Lax280166.CountingSatVariants
    66

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…