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

The reduction from satisfiability to (3,4)-satisfiability

Lax345332.Construction · concepts/Lax345332/Construction.lean · lax-345332

open

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

    A CNF formula FF with NN literal occurrences over variables below VV is turned into a (3,4) formula in two steps.

    Splitting. The occurrence at position pp is replaced by a fresh variable wv,pw_{v,p}, where vv is the variable occurring there. A clause becomes a chain through link variables zpz_p: the clause (l0lL1)(l_0 \vee \dots \vee l_{L-1}) becomes (l0z0),(zˉ0l1z1),,(zˉL2lL1)(l_0 \vee z_0), (\bar z_0 \vee l_1 \vee z_1), \dots, (\bar z_{L-2} \vee l_{L-1}), and an empty clause stays empty. For every vv the implications wv,p+1wv,pw_{v,p+1} \to w_{v,p}, taken cyclically over all positions, force the copies of vv to agree. Clauses now have at most three literals and every variable occurs at most three times.

    Padding. Every clause with fewer than three literals is filled with literals yˉ\bar y, each on a fresh variable yy that a private copy of Tovey's gadget forces to be true. The gadget has thirteen clauses on yy and nine further variables; yy occurs three times in it and every other variable four times.

    The reduction on words decodes a formula, applies the two steps and encodes the result; a word that encodes no formula is treated as the formula with one empty clause.

    Concept map
    9 concepts
    100%
    Proven claimOpen claimDefinitionThis conceptRelated conceptA → B: B builds on A
    Evidence

    This concept declares 4 statements. Each proof establishes one of them relative to its assumptions.

    2 reduce_polyTime open

    No proof in the archive yet — this statement is open.

    3 transform_isThreeFour proven

    4 transform_sat proven

    Lean source view on GitHub

    1import Lax345332.ThreeFourSat
    2
    3/-!
    4---
    5title: The reduction from satisfiability to (3,4)-satisfiability
    6type: definition
    7---
    8A CNF formula FF with NN literal occurrences over variables below VV is turned into a
    9(3,4) formula in two steps.
    10
    11*Splitting.* The occurrence at position pp is replaced by a fresh variable wv,pw_{v,p},
    12where vv is the variable occurring there. A clause becomes a chain through link variables
    13zpz_p: the clause (l0lL1)(l_0 \vee \dots \vee l_{L-1}) becomes
    14(l0z0),(zˉ0l1z1),,(zˉL2lL1)(l_0 \vee z_0), (\bar z_0 \vee l_1 \vee z_1), \dots, (\bar z_{L-2} \vee l_{L-1}), and an
    15empty clause stays empty. For every vv the implications wv,p+1wv,pw_{v,p+1} \to w_{v,p}, taken
    16cyclically over all positions, force the copies of vv to agree. Clauses now have at most
    17three literals and every variable occurs at most three times.
    18
    19*Padding.* Every clause with fewer than three literals is filled with literals yˉ\bar y,
    20each on a fresh variable yy that a private copy of Tovey's gadget forces to be true. The
    21gadget has thirteen clauses on yy and nine further variables; yy occurs three times in
    22it and every other variable four times.
    23
    24The reduction on words decodes a formula, applies the two steps and encodes the result; a
    25word that encodes no formula is treated as the formula with one empty clause.
    26
    27# Formalization notes
    28
    29All copies wv,pw_{v,p} with v<Vv < V and p<Np < N are created and tied together, not only those
    30of pairs that occur. This makes the cyclic successor of a position simply the next
    31position, at the cost of an output of quadratic size.
    32-/
    33
    34namespace Lax345332.Construction
    35
    36open Lax429075.CNF Lax429075.Encoding Lax434930.PolynomialTime Lax345332.ThreeFourSat
    37
    38-- The gadget
    39
    40/-- Tovey's thirteen clauses on the variables `g, g+1, …, g+9`; they force `g` to be true. -/
    41def gadget (g : ℕ) : Formula :=
    42 let y := g
    43 let a (j : ℕ) := g + 1 + 3 * j
    44 let b (j : ℕ) := g + 2 + 3 * j
    45 let d (j : ℕ) := g + 3 + 3 * j
    46 ((List.range 3).map fun j => [⟨y, true⟩, ⟨a j, true⟩, ⟨b j, true⟩]) ++
    47 ((List.range 3).flatMap fun j =>
    48 [[⟨d j, true⟩, ⟨a j, true⟩, ⟨b j, false⟩], [⟨d j, true⟩, ⟨a j, false⟩, ⟨b j, true⟩],
    49 [⟨d j, true⟩, ⟨a j, false⟩, ⟨b j, false⟩]]) ++
    50 [[⟨d 0, false⟩, ⟨d 1, false⟩, ⟨d 2, false⟩]]
    51
    52-- Padding
    53
    54/-- The base of the `t`-th gadget of the `k`-th clause, above the variables below `B`. -/
    55def ybase (B k t : ℕ) : ℕ := B + 30 * k + 10 * t
    56
    57/-- The padding literals of a clause of length `n`. -/
    58def pads (B k n : ℕ) : Clause := (List.range (3 - n)).map fun t => ⟨ybase B k t, false
    59
    60/-- The `k`-th clause, padded, with its three gadgets. -/
    61def unit (B k : ℕ) (C : Clause) : Formula :=
    62 (C ++ pads B k C.length) ::
    63 (gadget (ybase B k 0) ++ gadget (ybase B k 1) ++ gadget (ybase B k 2))
    64
    65/-- The padded formula. -/
    66def pad (B : ℕ) (G : Formula) : Formula :=
    67 (List.range G.length).flatMap fun k => unit B k (G.getD k [])
    68
    69-- Splitting
    70
    71/-- The copy of the variable `v` at position `p`. -/
    72def wv (V v p : ℕ) : ℕ := v + p * V
    73
    74/-- The link variable after position `p`. -/
    75def zv (V N p : ℕ) : ℕ := V * N + p
    76
    77def dflt : Literal := ⟨0, false
    78
    79/-- The `i`-th clause of the chain of `C`, whose first literal sits at position `o`. -/
    80def chainClause (V N o : ℕ) (C : Clause) (i : ℕ) : Clause :=
    81 (if i = 0 then [] else [⟨zv V N (o + i - 1), false⟩]) ++
    82 [⟨wv V (C.getD i dflt).index (o + i), (C.getD i dflt).positive⟩] ++
    83 (if i + 1 = C.length then [] else [⟨zv V N (o + i), true⟩])
    84
    85def chainClauses (V N o : ℕ) (C : Clause) : Formula :=
    86 if C.length = 0 then [[]] else (List.range C.length).map (chainClause V N o C)
    87
    88def chains (V N : ℕ) : ℕ → FormulaFormula
    89 | _, [] => []
    90 | o, C :: F => chainClauses V N o C ++ chains V N (o + C.length) F
    91
    92/-- The cyclic successor on positions. -/
    93def next (N p : ℕ) : ℕ := if p + 1 < N then p + 1 else 0
    94
    95/-- The implications `w v (next p) → w v p`. -/
    96def cycles (V N : ℕ) : Formula :=
    97 (List.range (V * N)).map fun k => [⟨k, true⟩, ⟨wv V (k % V) (next N (k / V)), false⟩]
    98
    99/-- The number of literal occurrences. -/
    100def size (F : Formula) : ℕ := (F.map List.length).sum
    101
    102/-- A strict bound on the variables. -/
    103def bound : Formula → ℕ
    104 | [] => 1
    105 | C :: F => max (C.foldr (fun l b => max (l.index + 1) b) 1) (bound F)
    106
    107def split (F : Formula) : Formula :=
    108 chains (bound F) (size F) 0 F ++ cycles (bound F) (size F)
    109
    110-- The reduction
    111
    112/-- The reduction on formulas. -/
    113def transform (F : Formula) : Formula := pad (bound F * size F + size F) (split F)
    114
    115/-- The formula a word stands for. -/
    116def parseF (w : Word) : Formula := (decodeCNF w).getD [[]]
    117
    118/-- The reduction on words. -/
    119def reduce (w : Word) : Word := encodeCNF (transform (parseF w))
    120
    121/-- The image is a (3,4) formula. -/
    122axiom transform_isThreeFour (F : Formula) : IsThreeFour (transform F)
    123
    124/-- The image is satisfiable exactly when the formula is. -/
    125axiom transform_sat (F : Formula) : Satisfiable F ↔ Satisfiable (transform F)
    126
    127/-- The reduction on words is correct. -/
    128axiom reduce_correct (w : Word) : w ∈ Lax429075.Satisfiability.SATreduce w ∈ SAT34
    129
    130/-- The reduction on words is computable in polynomial time. -/
    131axiom reduce_polyTime : Nonempty (Turing.TM2ComputableInPolyTime id id reduce)
    132
    133end Lax345332.Construction
    134
    Show ProofShow ProofShow Proof
    Formalization notes

    All copies wv,pw_{v,p} with v<Vv < V and p<Np < N are created and tied together, not only those of pairs that occur. This makes the cyclic successor of a position simply the next position, at the cost of an output of quadratic size.

    Builds on
    Used by

    none

    From Mathlib

    none

    Discussion

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

    Loading discussion…