Documentation

CslibFrontier.Computability.Complexity.Problems.CircuitSAT

Circuit satisfiability #

CircuitSAT is the set of De Morgan circuits with one output that output true on some input Arora and Barak, Section 6.1. Circuits are encoded by Cslib.Circuits.Boolean.encCircuit: the number n of inputs in unary, then the gates in program order with wire numbers in binary, then the output wire. Since n is written in unary, the encoding is at least n bits long, and an assignment to the inputs fits in a certificate as long as the encoding.

CircuitSAT is NP-complete (Cslib.Complexity.CircuitSAT_npComplete). It is in NP: the verifier evaluates the circuit on the first n bits of the certificate. It is NP-hard because SAT reduces to it (Cslib.Complexity.SAT.polyTimeReducible_CircuitSAT) and SAT is NP-complete by the Cook–Levin theorem. The circuit of a formula (Cslib.Complexity.SAT.toCircuit) has one input for each literal occurrence; a variable is read at the input of its first occurrence, as for the certificates of SAT.verifier. Its gates come in blocks of three, one block for each literal and one for the end of each clause, which keep the disjunction of the current clause and the conjunction of the finished clauses at fixed offsets from the end.

Main definitions #

Main results #

References #

Circuit satisfiability over an arbitrary Boolean signature: the single-output circuits over σ that output true under I on some input.

Instances For

    Circuit satisfiability: the De Morgan circuits with one output that output true on some input Arora and Barak, Section 6.1.

    Instances For

      Membership in NP #

      The verifier for CircuitSAT: evaluate the circuit on the first bits of the certificate, reading missing bits as false.

      Instances For

        Circuit satisfiability is in NP, with certificates as long as the encoded circuit.

        The circuit of a formula #

        The instructions building the circuit of a formula: each literal of each clause, flagged false, and after each clause an end marker flagged true (with a placeholder literal).

        Instances For

          The three gates of one instruction, when the three gates before it are the wires p, p + 1 and p + 2, the last two holding the disjunction of the current clause so far and the conjunction of the finished clauses. For the literal (v, b) read at input i, the gates compute the literal, add it to the clause and copy the conjunction. At the end of a clause they compute the conjunction with the clause, restart the clause at false and copy the conjunction.

          Instances For

            The gates of the circuit of a formula with n literal occurrences: three constant gates starting the clause at false and the conjunction at true, then the block of each instruction. The block of instruction t follows the gates 3 t, 3 t + 1, 3 t + 2, which are the wires n + 3 t, n + 3 t + 1 and n + 3 t + 2.

            Instances For

              The code of the circuit of a formula: its gates and, as output, the last conjunction.

              Instances For

                The circuit code of a formula is the code of a circuit with one output.

                The circuit of a formula: one input for each literal occurrence, and the gates of circuitCode.

                Instances For

                  Correctness of the circuit of a formula #

                  The circuit of a formula evaluates it: on input x, it outputs the value of the formula under the assignment giving each variable the input bit at its first occurrence (SAT.assignment).

                  The circuit of a formula is satisfiable exactly when the formula is.

                  The reduction is polynomial-time #

                  Circuit satisfiability is NP-complete, for the binary encoding of circuits encCircuit 1 Arora and Barak, Section 6.1.