Succinct 3SAT
AbbreviationEncoded gates#✓fully proved
An encoded gate is a pair \((k, r)\) of a natural number \(k\), the kind of the gate, and a list \(r\) of natural numbers, its references. This is the (kind, references) encoding of the gates of a flat Boolean circuit.
abbrev S3Gate := ℕ × List ℕ
DefinitionGate values of an encoded circuit#✓fully proved
Let \(C = (g_0, \dots, g_{m-1})\) be a list of gates, each encoded as a (kind, references) pair, let \(\alpha\) be a list of booleans and let \(n\) be a natural number. The gate values of \(C\) on \(\alpha\) are the values \((v_0, \dots, v_{m-1})\) of the flat Boolean circuit on \(n + 2\) inputs obtained by decoding every \(g_j\), when input \(i\) is given entry \(i\) of \(\alpha\), read as false when \(i\) is at least the length of \(\alpha\).
def s3CircuitEval (C : List S3Gate) (assign : List Bool) (n : ℕ) : List Bool :=
circuitEval (C.map (acGateOfPair (n := n + 2))) (fun i => assign.getD i.val false)
abbrev S3Gate := ℕ × List ℕ
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:53
def circuitEval {n : ℕ} (C : List (ACGate n)) (assign : Fin n → Bool) : List Bool :=
C.foldl (fun vs g => vs ++ [gateValue vs assign g]) []
CSLibExt/Computability/Complexity/Classes.lean:447
def acGateOfPair {n : ℕ} : ℕ × List ℕ → ACGate n
| (0, [i]) => if h : i < n then .var ⟨i, h⟩ else .const false
| (1, [b]) => .const (b = 1)
| (2, [a]) => .notGate a
| (3, l) => .andGate l
| (4, l) => .orGate l
| _ => .const false
CSLibExt/Computability/Complexity/Classes.lean:469
Uses 4 · Used by 1
DefinitionOutputs of an encoded circuit#✓fully proved
Let \(C\) be a list of \(m\) gates encoded as (kind, references) pairs, let \(\alpha\) be a list of booleans and let \(k\) and \(n\) be natural numbers. The last \(k\) outputs of \(C\) on \(\alpha\) are the last \(k\) of the gate values \((v_0, \dots, v_{m-1})\) of \(C\) on \(\alpha\) as a circuit on \(n + 2\) inputs, that is \((v_{m-k}, \dots, v_{m-1})\); when \(k > m\) they are all \(m\) gate values.
def s3CircuitOutputs (C : List S3Gate) (assign : List Bool) (k n : ℕ) : List Bool :=
let vals := s3CircuitEval C assign n
vals.drop (vals.length - k)
abbrev S3Gate := ℕ × List ℕ
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:53
def s3CircuitEval (C : List S3Gate) (assign : List Bool) (n : ℕ) : List Bool :=
circuitEval (C.map (acGateOfPair (n := n + 2))) (fun i => assign.getD i.val false)
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:57
Uses 2 · Used by 1
DefinitionValid gates of a succinct 3SAT descriptor#✓fully proved
Let \(C\) be a list of gates encoded as (kind, references) pairs and let \(n\) and \(j\) be natural numbers. Gate \(j\) of \(C\) is valid when \(C\) has more than \(j\) entries and its entry \(j\) (counting from \(0\)) is one of: \((0, [i])\) with \(i < n + 2\) (an input gate); \((1, [b])\) with \(b \le 1\) (a constant gate); \((2, [a])\) with \(a < j\) (a negation gate); or \((3, r)\) or \((4, r)\) where every entry \(a\) of \(r\) satisfies \(a < j\) (a conjunction or disjunction gate). Every other entry is invalid.
def s3ValidGate (C : List S3Gate) (n j : ℕ) : Prop :=
match C[j]? with
| some (0, [i]) => i < n + 2
| some (1, [b]) => b ≤ 1
| some (2, [a]) => a < j
| some (3, l) => ∀ a ∈ l, a < j
| some (4, l) => ∀ a ∈ l, a < j
| _ => False
abbrev S3Gate := ℕ × List ℕ
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:53
Uses 1 · Used by 1
DefinitionWell-formed succinct 3SAT descriptors#✓fully proved
Let \(C\) be a list of gates encoded as (kind, references) pairs and let \(n\) be a natural number. The descriptor \(C\) is well-formed for \(n\) when \(C\) has at least \(n + 1\) gates, every gate of \(C\) is valid for \(n\), and the flat Boolean circuit on \(n + 2\) inputs obtained by decoding every gate of \(C\) is well-formed.
def s3WellFormed (C : List S3Gate) (n : ℕ) : Prop :=
n + 1 ≤ C.length ∧
(∀ j, j < C.length → s3ValidGate C n j) ∧
WellFormedCircuit (C.map (acGateOfPair (n := n + 2)))
abbrev S3Gate := ℕ × List ℕ
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:53
def s3ValidGate (C : List S3Gate) (n j : ℕ) : Prop :=
match C[j]? with
| some (0, [i]) => i < n + 2
| some (1, [b]) => b ≤ 1
| some (2, [a]) => a < j
| some (3, l) => ∀ a ∈ l, a < j
| some (4, l) => ∀ a ∈ l, a < j
| _ => False
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:68
def WellFormedCircuit {n : ℕ} (C : List (ACGate n)) : Prop :=
∀ j (h : j < C.length), ∀ a ∈ gateInputs (C[j]'h), a < j
CSLibExt/Computability/Complexity/Classes.lean:432
def acGateOfPair {n : ℕ} : ℕ × List ℕ → ACGate n
| (0, [i]) => if h : i < n then .var ⟨i, h⟩ else .const false
| (1, [b]) => .const (b = 1)
| (2, [a]) => .notGate a
| (3, l) => .andGate l
| (4, l) => .orGate l
| _ => .const false
CSLibExt/Computability/Complexity/Classes.lean:469
Uses 5 · Used by 1
DefinitionLowest \(n\) bits of a number, least significant first#✓fully proved
For natural numbers \(i\) and \(n\), this is the list of booleans \((b_0, \dots, b_{n-1})\) of length \(n\) in which \(b_k\) is true exactly when \(\lfloor i / 2^k \rfloor\) is odd: the \(n\) lowest binary digits of \(i\), least significant bit first.
def s3BitsOf (i n : ℕ) : List Bool :=
(List.range n).map (fun k => decide ((i / 2 ^ k) % 2 = 1))
Used by 1
DefinitionValue of a list of bits, least significant first#✓fully proved
A list of booleans \((b_0, \dots, b_{m-1})\) represents the natural number \(\sum_{k < m} [b_k]\, 2^k\), where \([b_k]\) is \(1\) if \(b_k\) is true and \(0\) otherwise.
def s3BitsToNum : List Bool → ℕ
| [] => 0
| b :: rest => (if b then 1 else 0) + 2 * s3BitsToNum rest
Used by 1
DefinitionLiterals of a succinctly described formula#✓fully proved
Let \(C\) be a list of gates encoded as (kind, references) pairs and let \(n\), \(i\) and \(j\) be natural numbers. Give \(C\), as a circuit on \(n + 2\) inputs, the input consisting of the \(n\) lowest bits of \(i\) followed by the \(2\) lowest bits of \(j\), each least significant bit first, and let \((o_0, \dots, o_{p-1})\) be its last \(n + 1\) outputs. Literal \(j\) of clause \(i\) is the pair \((v, s)\) with \(v = \sum_{k < \min(n, p)} [o_k]\, 2^k\), where \([o_k]\) is \(1\) if \(o_k\) is true and \(0\) otherwise, and polarity \(s = o_n\), read as false when \(p \le n\).
def succLiteral (C : List S3Gate) (n i j : ℕ) : ℕ × Bool :=
let outs := s3CircuitOutputs C (s3BitsOf i n ++ s3BitsOf j 2) (n + 1) n
(s3BitsToNum (outs.take n), outs.getD n false)
abbrev S3Gate := ℕ × List ℕ
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:53
def s3CircuitOutputs (C : List S3Gate) (assign : List Bool) (k n : ℕ) : List Bool :=
let vals := s3CircuitEval C assign n
vals.drop (vals.length - k)
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:61
def s3BitsOf (i n : ℕ) : List Bool :=
(List.range n).map (fun k => decide ((i / 2 ^ k) % 2 = 1))
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:86
def s3BitsToNum : List Bool → ℕ
| [] => 0
| b :: rest => (if b then 1 else 0) + 2 * s3BitsToNum rest
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:90
Uses 4 · Used by 1
DefinitionSatisfied clauses of a succinctly described formula#✓fully proved
Let \(C\) be a list of gates encoded as (kind, references) pairs, let \(n\) and \(i\) be natural numbers, and let \(\sigma\) assign a boolean to every natural number. Clause \(i\) of the formula described by \(C\) for \(n\) is satisfied by \(\sigma\) when, for some \(j < 3\), literal \(j\) of clause \(i\) of that formula is a pair \((v, s)\) with \(\sigma(v) = s\).
def succClauseSat (C : List S3Gate) (n : ℕ) (assign : ℕ → Bool) (i : ℕ) : Prop :=
∃ j, j < 3 ∧
match succLiteral C n i j with
| (v, pol) => assign v = pol
abbrev S3Gate := ℕ × List ℕ
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:53
def succLiteral (C : List S3Gate) (n i j : ℕ) : ℕ × Bool :=
let outs := s3CircuitOutputs C (s3BitsOf i n ++ s3BitsOf j 2) (n + 1) n
(s3BitsToNum (outs.take n), outs.getD n false)
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:95
Uses 2 · Used by 1
DefinitionSuccinct 3SAT#✓fully proved
Succinct 3SAT is the decision problem that accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding, to a pair \((n, C)\) of a natural number \(n\) and a list \(C\) of gates encoded as (kind, references) pairs such that \(C\) is a well-formed descriptor for \(n\) and some assignment \(\sigma\) of booleans to the natural numbers satisfies clause \(c\) of the formula described by \(C\) for every \(c < 2^n\). Bitstrings that do not decode are rejected.
noncomputable def succinctThreeSatDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := ℕ × List S3Gate) x with
| some i => decide (s3WellFormed i.2 i.1 ∧ ∃ assign : ℕ → Bool,
∀ c, c < 2 ^ i.1 → succClauseSat i.2 i.1 assign c)
| none => false
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def bitDecode [BitstringEncoding α] (l : List Bool) : Option α := toEncoding.decode l
MathlibExt/Computability/Complexity.lean:58
abbrev S3Gate := ℕ × List ℕ
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:53
def s3WellFormed (C : List S3Gate) (n : ℕ) : Prop :=
n + 1 ≤ C.length ∧
(∀ j, j < C.length → s3ValidGate C n j) ∧
WellFormedCircuit (C.map (acGateOfPair (n := n + 2)))
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:80
def succClauseSat (C : List S3Gate) (n : ℕ) (assign : ℕ → Bool) (i : ℕ) : Prop :=
∃ j, j < 3 ∧
match succLiteral C n i j with
| (v, pol) => assign v = pol
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:100
Uses 12 · Used by 1
TheoremSuccinct 3SAT is NEXP-complete#●ready to prove
The succinct 3SAT decision problem lies in NEXP, and every decision problem in NEXP has a polynomial-time many-one reduction to it.
public theorem_wanted succinct_three_sat_nexp_complete :
succinctThreeSatDec ∈ NEXP ∧ ∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ NEXP → Cslib.CookLevin.PolyManyOneRed L succinctThreeSatDec
noncomputable def succinctThreeSatDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := ℕ × List S3Gate) x with
| some i => decide (s3WellFormed i.2 i.1 ∧ ∃ assign : ℕ → Bool,
∀ c, c < 2 ^ i.1 → succClauseSat i.2 i.1 assign c)
| none => false
WantedExt/Complexity/KeyTheorems/SuccinctThreeSATNEXPCompleteWanted.lean:109
def NEXP : DecisionComplexityClass :=
{L | ∃ p : Polynomial ℕ, langOf L ∈ NTIME (fun n => 2 ^ (p.eval n))}
CSLibExt/Computability/Complexity/Classes.lean:192
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def PolyManyOneRed (L₁ L₂ : MetaMathlibExt.ComplexityTheory.DecisionProblem) : Prop :=
∃ reduce : List Bool → List Bool,
MetaMathlibExt.ComplexityTheory.IsPolyTime reduce ∧ ∀ x, L₁ x = L₂ (reduce x)
CSLibExt/Computability/CookLevin.lean:396
Sources
- C. H. Papadimitriou, Computational Complexity, Addison-Wesley, 1994, Theorem 20.3 (succinct 3SAT is NEXP-complete); C. H. Papadimitriou and M. Yannakakis, "A note on succinct representations of graphs", Information and Control 71 (1986), 181-185.
Uses 5
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.