Boolean circuits as data #
The circuits of the succinct Cook–Levin theorem (planning/succinct-cook-levin.md, S0;
answer_reduction.tex sec:ar-tms): a circuit is a list of gates in topological order,
each gate reading input bits or the values of earlier gates, the last gate being the output.
Fan-in is at most two by the shape of the gates; fan-out at most two and a terminal output
gate are the well-formedness conditions (Circuit.WellFormed) that the arithmetization of
the Tseitin formula needs for its individual-degree bound (prop:tseitin-arith-degree).
The gate count is the paper's size parameter s. Circuits are first-order data with a
SizedEncoding, so that a program of the ambient model can output one
(MIPRE.SAT.SuccinctCookLevin.describe).
Equations
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.input a) (MIPRE.SAT.Gate.input b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.input i) (MIPRE.SAT.Gate.const b) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.input i) (MIPRE.SAT.Gate.and u v) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.input i) (MIPRE.SAT.Gate.or u v) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.input i) (MIPRE.SAT.Gate.not u) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.const b) (MIPRE.SAT.Gate.input i) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.const a) (MIPRE.SAT.Gate.const b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.const b) (MIPRE.SAT.Gate.and u v) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.const b) (MIPRE.SAT.Gate.or u v) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.const b) (MIPRE.SAT.Gate.not u) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.and u v) (MIPRE.SAT.Gate.input i) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.and u v) (MIPRE.SAT.Gate.const b) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.and a a_1) (MIPRE.SAT.Gate.and b b_1) = if h : a = b then h ▸ if h : a_1 = b_1 then h ▸ isTrue ⋯ else isFalse ⋯ else isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.and u v) (MIPRE.SAT.Gate.or u_1 v_1) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.and u v) (MIPRE.SAT.Gate.not u_1) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.or u v) (MIPRE.SAT.Gate.input i) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.or u v) (MIPRE.SAT.Gate.const b) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.or u v) (MIPRE.SAT.Gate.and u_1 v_1) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.or a a_1) (MIPRE.SAT.Gate.or b b_1) = if h : a = b then h ▸ if h : a_1 = b_1 then h ▸ isTrue ⋯ else isFalse ⋯ else isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.or u v) (MIPRE.SAT.Gate.not u_1) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.not u) (MIPRE.SAT.Gate.input i) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.not u) (MIPRE.SAT.Gate.const b) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.not u) (MIPRE.SAT.Gate.and u_1 v) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.not u) (MIPRE.SAT.Gate.or u_1 v) = isFalse ⋯
- MIPRE.SAT.instDecidableEqGate.decEq (MIPRE.SAT.Gate.not a) (MIPRE.SAT.Gate.not b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- MIPRE.SAT.instReprGate = { reprPrec := MIPRE.SAT.instReprGate.repr }
Equations
The value of a gate given the input bits x and the values vals of the earlier gates
(a missing reference reads false).
Equations
- MIPRE.SAT.Gate.eval x vals (MIPRE.SAT.Gate.input i) = x i
- MIPRE.SAT.Gate.eval x vals (MIPRE.SAT.Gate.const b) = b
- MIPRE.SAT.Gate.eval x vals (MIPRE.SAT.Gate.and u v) = (vals.getD u false && vals.getD v false)
- MIPRE.SAT.Gate.eval x vals (MIPRE.SAT.Gate.or u v) = (vals.getD u false || vals.getD v false)
- MIPRE.SAT.Gate.eval x vals (MIPRE.SAT.Gate.not u) = !vals.getD u false
Instances For
Gates as data: a tag and a payload.
Equations
- (MIPRE.SAT.Gate.input i).toData = (MIPRE.Cost.Data.ofNat 0).cons (MIPRE.Cost.encode i)
- (MIPRE.SAT.Gate.const b).toData = (MIPRE.Cost.Data.ofNat 1).cons (MIPRE.Cost.encode b)
- (MIPRE.SAT.Gate.and u v).toData = (MIPRE.Cost.Data.ofNat 2).cons (MIPRE.Cost.encode (u, v))
- (MIPRE.SAT.Gate.or u v).toData = (MIPRE.Cost.Data.ofNat 3).cons (MIPRE.Cost.encode (u, v))
- (MIPRE.SAT.Gate.not u).toData = (MIPRE.Cost.Data.ofNat 4).cons (MIPRE.Cost.encode u)
Instances For
Decoding gates.
Equations
- One or more equations did not get rendered due to their size.
- MIPRE.SAT.Gate.ofData? MIPRE.Cost.Data.nil = none
Instances For
Equations
- MIPRE.SAT.Gate.instSizedEncoding = { encode := MIPRE.SAT.Gate.toData, decode := MIPRE.SAT.Gate.ofData?, decode_encode := MIPRE.SAT.Gate.ofData?_toData }
A list of gates as data.
Equations
- MIPRE.SAT.instSizedEncodingListGate = { encode := MIPRE.Cost.Data.ofList MIPRE.SAT.Gate.toData, decode := MIPRE.Cost.Data.toList? MIPRE.SAT.Gate.ofData?, decode_encode := ⋯ }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- MIPRE.SAT.instReprCircuit = { reprPrec := MIPRE.SAT.instReprCircuit.repr }
Equations
The value of gate g of C on the input bits x: the gate evaluated on the values of
the earlier gates (a gate beyond the list reads as the constant false).
Equations
- C.valueAt x x✝ = MIPRE.SAT.Gate.eval x (List.ofFn fun (k : Fin x✝) => C.valueAt x ↑k) (C.gates.getD x✝ (MIPRE.SAT.Gate.const false))
Instances For
The number of wires leaving gate u.
Equations
- C.fanout u = (List.map (fun (g : MIPRE.SAT.Gate) => List.count u g.refs) C.gates).sum
Instances For
Well-formedness (sec:ar-tms): every gate reads earlier gates and existing inputs,
fan-out is at most two, the output gate is read by no gate, and there is an output gate.
Instances For
Circuits as data: the pair of the input count and the gate list.
Equations
- One or more equations did not get rendered due to their size.
The m-bit binary encoding of i (least significant bit first; rem:plugging-in-integers).
Equations
- MIPRE.SAT.bitsOfNat m i = List.ofFn fun (k : Fin m) => i.testBit ↑k