SAT verifier specification #
This file defines an executable verifier for pairLang Witness:
- split
pair(z, α)back into(z, α)viaunpair?, - decode
zas a CNF in SAT's concrete bit encoding, - check the witness length bound
|α| ≤ |z| + 1, - evaluate the decoded formula under
α.
The deterministic implementation verifyPairTM in SAT/VerifierTM.lean
computes this specification and proves pairLang Witness ∈ P; this file is
the small executable/semantic audit surface for that machine proof.
Equations
- Complexity.SAT.instDecidableEqEncToken.decEq (Complexity.SAT.EncToken.bit a) (Complexity.SAT.EncToken.bit b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- Complexity.SAT.instDecidableEqEncToken.decEq (Complexity.SAT.EncToken.bit b) Complexity.SAT.EncToken.litSep = isFalse ⋯
- Complexity.SAT.instDecidableEqEncToken.decEq (Complexity.SAT.EncToken.bit b) Complexity.SAT.EncToken.clauseSep = isFalse ⋯
- Complexity.SAT.instDecidableEqEncToken.decEq Complexity.SAT.EncToken.litSep (Complexity.SAT.EncToken.bit b) = isFalse ⋯
- Complexity.SAT.instDecidableEqEncToken.decEq Complexity.SAT.EncToken.litSep Complexity.SAT.EncToken.litSep = isTrue ⋯
- Complexity.SAT.instDecidableEqEncToken.decEq Complexity.SAT.EncToken.litSep Complexity.SAT.EncToken.clauseSep = isFalse Complexity.SAT.instDecidableEqEncToken.decEq._proof_6
- Complexity.SAT.instDecidableEqEncToken.decEq Complexity.SAT.EncToken.clauseSep (Complexity.SAT.EncToken.bit b) = isFalse ⋯
- Complexity.SAT.instDecidableEqEncToken.decEq Complexity.SAT.EncToken.clauseSep Complexity.SAT.EncToken.litSep = isFalse Complexity.SAT.instDecidableEqEncToken.decEq._proof_8
- Complexity.SAT.instDecidableEqEncToken.decEq Complexity.SAT.EncToken.clauseSep Complexity.SAT.EncToken.clauseSep = isTrue ⋯
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Concrete two-bit representation of one SAT encoding token.
Equations
Instances For
Flatten a token stream back into concrete bits.
Equations
Instances For
Split a bitstring into SAT encoding tokens. Odd-length strings are invalid.
Equations
- Complexity.SAT.tokenize? [] = some []
- Complexity.SAT.tokenize? [head] = none
- Complexity.SAT.tokenize? (false :: false :: rest) = Option.map (fun (x : List Complexity.SAT.EncToken) => Complexity.SAT.EncToken.bit false :: x) (Complexity.SAT.tokenize? rest)
- Complexity.SAT.tokenize? (true :: true :: rest) = Option.map (fun (x : List Complexity.SAT.EncToken) => Complexity.SAT.EncToken.bit true :: x) (Complexity.SAT.tokenize? rest)
- Complexity.SAT.tokenize? (false :: true :: rest) = Option.map (fun (x : List Complexity.SAT.EncToken) => Complexity.SAT.EncToken.litSep :: x) (Complexity.SAT.tokenize? rest)
- Complexity.SAT.tokenize? (true :: false :: rest) = Option.map (fun (x : List Complexity.SAT.EncToken) => Complexity.SAT.EncToken.clauseSep :: x) (Complexity.SAT.tokenize? rest)
Instances For
The empty token stream encodes to the empty bitstring.
encodeTokens unfolds on cons: the head token's bits precede the tail's encoding.
encodeTokens is a monoid homomorphism: it distributes over list append.
Round trip: tokenizing an encoded token stream recovers the original tokens.
Encoding a stream of bit tokens doubles each underlying bit.
Decode a raw literal bitstring [sign] ++ replicate var true.
Equations
Instances For
Round trip: decoding a literal's raw encoding recovers the literal.
Soundness of decodeRaw?: any successfully decoded bitstring is the raw
encoding of the resulting literal.
Token-level raw literal encoding.
Equations
Instances For
A literal's token-level encoding flattens to its raw bits, doubled.
Token-level clause encoding: doubled raw literal bits, each terminated by |.
Equations
Instances For
A clause's token-level encoding flattens to its concrete bit encoding.
Clause.tokens distributes over list append.
Token-level CNF encoding: each clause is terminated by #.
Equations
Instances For
A CNF's token-level encoding flattens to its concrete bit encoding.
CNF.tokens distributes over list append.
Core parser state:
rawRev is the reversed current raw literal, clauseRev the reversed current
clause, and cnfRev the reversed list of completed clauses.
Equations
- One or more equations did not get rendered due to their size.
- Complexity.SAT.parseTokensAux [] x✝² x✝¹ x✝ = if _hraw : x✝² = [] then if _hclause : x✝¹ = [] then some (List.reverse x✝) else none else none
- Complexity.SAT.parseTokensAux (Complexity.SAT.EncToken.bit b :: toks) x✝² x✝¹ x✝ = Complexity.SAT.parseTokensAux toks (b :: x✝²) x✝¹ x✝
- Complexity.SAT.parseTokensAux (Complexity.SAT.EncToken.clauseSep :: toks) x✝² x✝¹ x✝ = if _hraw : x✝² = [] then Complexity.SAT.parseTokensAux toks [] [] (List.reverse x✝¹ :: x✝) else none
Instances For
Decode a concrete SAT-encoded bitstring as a CNF.
Equations
- Complexity.SAT.CNF.decode? z = do let toks ← Complexity.SAT.tokenize? z Complexity.SAT.parseTokensAux toks [] [] []
Instances For
Boolean verifier for SAT's witness relation on paired inputs.
Equations
- One or more equations did not get rendered due to their size.
Instances For
On a well-formed pair pair(φ.encode, α), verifyPair reduces to the
witness length check conjoined with evaluating φ under α.
Completeness: verifyPair accepts the pairing of any witnessed instance.
Correctness of the verifier: verifyPair accepts exactly the members of
pairLang Witness.
verifyPair_eq_true_iff_mem_pairLang with the biconditional flipped.
pairLang Witness equals the language decided by verifyPair, as sets.