Algorithm Search⌘K

Definitionintro

Miter

Also called miter circuit.

A circuit that feeds the same inputs to two designs and XORs matching outputs into one OR output, which can be 1 only if the designs differ.

A miter is a circuit built from two circuits C1C_1 and C2C_2 with the same inputs and the same number of outputs. It connects each input of C1C_1 to the matching input of C2C_2, puts an XOR gate on each pair of matching outputs, and joins the XOR gates with one OR gate. Its single output is 1 on an input exactly when the two circuits give different outputs on it. So C1C_1 and C2C_2 are equivalent if and only if the miter is unsatisfiable, and any input that satisfies it is a counterexample. Brand (1993) named the construction. This page is about the construction; the problem it serves, its algorithms and its bounds are on the Boolean equivalence checking page.

Definition

Let C1C_1 and C2C_2 be Boolean circuits over the inputs x=(x1,…,xn)x = (x_1, \ldots, x_n), each with outputs o1,…,omo_1, \ldots, o_m, and let output jj of C1C_1 compute fjf_j and output jj of C2C_2 compute gjg_j. The outputs are matched by position or by name. The miter M(C1,C2)M(C_1, C_2) is the circuit that contains both circuits on the shared inputs xx and the extra gates

dj=fj⊕gj(j=1,…,m),M(x)=d1∨⋯∨dm.d_j = f_j \oplus g_j \quad (j = 1, \ldots, m), \qquad M(x) = d_1 \vee \cdots \vee d_m.

C1C_1 and C2C_2 are equivalent when fj(a)=gj(a)f_j(a) = g_j(a) for every jj and every a∈{0,1}na \in \{0, 1\}^n.

Proposition 1 (the miter reduces equivalence to unsatisfiability). C1C_1 and C2C_2 are equivalent if and only if M(a)=0M(a) = 0 for every aa, that is, the miter is unsatisfiable. An aa with M(a)=1M(a) = 1 is an input on which the circuits differ.

Proof. For a fixed aa, M(a)=1M(a) = 1 if and only if dj(a)=1d_j(a) = 1 for some jj, if and only if fj(a)≠gj(a)f_j(a) \ne g_j(a) for some jj. So MM has a satisfying input exactly when some input separates the circuits, and that input separates them. □\square

The miter has ∣C1∣+∣C2∣+2m−1|C_1| + |C_2| + 2m - 1 gates, counting the OR as m−1m - 1 two-input gates and each XOR as one gate, so it is built in linear time. A SAT solver gets it through the Tseitin transformation.

Proposition 2 (combinational equivalence is coNP-complete). The problem "are C1C_1 and C2C_2 equivalent?" for circuits is coNP-complete.

Proof. Membership. The complement, "the circuits differ", is in NP: by Proposition 1, an input aa with M(a)=1M(a) = 1 is a certificate, and evaluating MM on aa takes time linear in the size of the miter. Hardness. Circuit satisfiability is NP-complete, so its complement, circuit unsatisfiability, is coNP-complete. Map a circuit CC with one output to the pair (CC, the circuit with the constant 0 as output). This takes polynomial time, and CC is equivalent to the constant 0 exactly when CC is unsatisfiable. □\square

Examples and non-examples

A half adder. C1C_1 has the outputs s=a⊕bs = a \oplus b and c=a∧bc = a \wedge b. C2C_2 has s′=(a∨b)∧¬(a∧b)s' = (a \vee b) \wedge \neg(a \wedge b) and c′=¬(¬a∨¬b)c' = \neg(\neg a \vee \neg b). The miter is M=(s⊕s′)∨(c⊕c′)M = (s \oplus s') \vee (c \oplus c').

aa bb ss s′s' cc c′c' MM
0 0 0 0 0 0 0
0 1 1 1 0 0 0
1 0 1 1 0 0 0
1 1 0 0 1 1 0

The miter is unsatisfiable, so the circuits are equivalent.

A bug. Replace c′c' by a∨ba \vee b. Then M(1,0)=0∨(0⊕1)=1M(1, 0) = 0 \vee (0 \oplus 1) = 1, and the input a=1,b=0a = 1, b = 0 is a counterexample: the carry is 0 in C1C_1 and 1 in C2C_2.

Non-example: wrong output matching. If ss is paired with c′c' and cc with s′s', the miter is satisfiable although the circuits are equivalent. The miter checks equivalence under the given matching of inputs and outputs only. Finding the matching when the names do not give it is Boolean matching.

Non-example: circuits with registers. If C1C_1 and C2C_2 have latches, the XOR-OR structure on their outputs is not a miter in the sense above. With the latch outputs read as free inputs, a satisfying input can be a state that no input sequence reaches, so a satisfiable output does not show that the designs differ. The sequential form is the product machine, where the question is whether a state with output 1 is reachable. If the latches of the two designs are paired one to one, the miter of the next-state and output functions decides equivalence for that pairing; see latch mapping.

  • Boolean equivalence checking is the decision problem. The miter turns it into the satisfiability of one circuit, which BDDs, SAT solvers, SAT sweeping and cutpoint equivalence checking then decide.
  • Brand used automatic test pattern generation on the miter: the output stuck at 0 is a redundant fault exactly when no input sets the output to 1, so a proof that the fault is untestable is a proof of equivalence.
  • The dual form joins XNOR gates with an AND gate. Its output is 1 everywhere exactly when the circuits are equivalent, so it turns equivalence into a tautology check.
  • The product machine is the miter of two sequential circuits, with both sets of latches kept.

References

  1. D. Brand, Verification of large synthesized designs, ICCAD 1993, 534 to 537, the joined circuit of the two designs with an XOR on the outputs, and the use of test generation to show that its output cannot be 1
  2. A. Kuehlmann and C. A. J. van Eijk, Combinational and sequential equivalence checking, in S. Hassoun and T. Sasao (editors), Logic Synthesis and Verification, Kluwer, 2002, 343 to 372, the section on combinational equivalence checking and the miter structure

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/HDNMPN/text.yaml