Download presentation
Presentation is loading. Please wait.
Published byPatience Byrd Modified over 9 years ago
1
Digitaalsüsteemide verifitseerimise kursus1 Formal verification: SAT SAT applied in equivalence checking
2
Digitaalsüsteemide verifitseerimise kursus2 Equivalence Checking Two principal approaches: Transform implementation and spec ( reference implementation) to a canonical form Search for an input assignment that would distinguish the responses of the implementation and reference implementation. SAT applied for the latter
3
Digitaalsüsteemide verifitseerimise kursus3 Satisfiability aka SAT SAT: Boolean function is satisfiable if there exists a variable assignment for which the function is TRUE
4
Digitaalsüsteemide verifitseerimise kursus4 Equivalence checking with SAT Equivalence Checking can be reduced to SAT: d = f g Iff d is satisfiable then f and g are NOT equivalent.
5
Digitaalsüsteemide verifitseerimise kursus5 Miter circuit + 1 + Specification (reference implementation) Implementation SAT?
6
Digitaalsüsteemide verifitseerimise kursus6 Satisfiability aka SAT SAT is transformed to CNF (i.e. product of sums). Sums are called terms. If terms have max 2 literals then 2-SAT 2-SAT solved in a polynomial time 3-SAT is an NP complete task
7
Digitaalsüsteemide verifitseerimise kursus7 Satisfiability aka SAT Is this CNF satisfiable? Yes: a = 1, b = 0, c = 0! Worst case: 2 n combinations to try
8
Digitaalsüsteemide verifitseerimise kursus8 Some terminology If x in the formula alwaysin one phase (i.e. always inverted or always noninverted then x is unate. If x in the formula in both phases then x is binate. Term having just one literal called unit term.
9
Digitaalsüsteemide verifitseerimise kursus9 Resolvent-algorithm Resolvent: f = (x+A)(¬x+B) = (x +A)(¬x+B)(A+B) Consensus: f = xC + ¬xD = xC + ¬xD + CD Since SAT is in CNF we use resolvent.
10
Digitaalsüsteemide verifitseerimise kursus10 Resolvent-algorithm 1.Choose another variable x. 2.If x is unate, apply unate rule. 3.If x is unit term, apply unit term rule. 4.If x is unate, solve resolvent of x. 5.Repeat the steps until all resolvents solved. 6.If the result is 1, then function satisfiable; otherwise not satisfiable (unit term).
11
Digitaalsüsteemide verifitseerimise kursus11 Resolvent-algorithm example a binate terms resolvent solved
12
Digitaalsüsteemide verifitseerimise kursus12 Resolvent-algorithm: summary Resolvent-algorithm mathematically elegant but...... Designed for small SAT problems In the worst case 2 n resolvents to solve In order to solve complex SAT instances, search based algorithms needed
13
Digitaalsüsteemide verifitseerimise kursus13 Search-based SAT
14
Digitaalsüsteemide verifitseerimise kursus14 SolveSAT() input: a formula output: SAT or UNSAT forever { state = select_branch(); // choose and assign a variable if (state == EXHAUSTED) return UNSAT; result = infer(); // infer variable values if ( result == SAT) return SAT; else if (result == UNSAT) backtrack(); // backtrack to a prior decision else // result == INDETERMINATE continue; // need further assignment } Search-based SAT
15
Digitaalsüsteemide verifitseerimise kursus15 Implication Graph Directed acyclic graph: Nodes labeled by variable names, followed by the rank of the decision Variables preceded by minus were assigned 0, not preceded by minus were assigned 1 Directed arcs show from which assignments what new assignments imply Decision nodes (grey) and implication nodes (white)
16
Digitaalsüsteemide verifitseerimise kursus16 decisions: k = 1, j = 1, a = 0, b = 1. reach a conflict: x = 1 ja x = 0! learning: add a new term (¬e + h + ¬d) Implication Graph
17
Digitaalsüsteemide verifitseerimise kursus17 It implies that c = 0; the function is simplified: Since e is a unit term then e = 1; first decision: a = 1 If we choose b=1, then conflict! Two possibilities to handle this: 1) Invert the last decision (backtrack) 2) Add a new term (learning): Implication Graph Example
18
Digitaalsüsteemide verifitseerimise kursus18 Equivalence checking with SAT Equivalence Checking can be reduced to SAT: d = f g Iff d is satisfiable then f and g are NOT equivalent.
19
Digitaalsüsteemide verifitseerimise kursus19 Miter circuit + 1 + Specification (reference implementation) Implementation SAT?
20
Digitaalsüsteemide verifitseerimise kursus20 SAT for schematics: characteristic formula Build CNFs corresponding to logic gates using logic implication: a b = ¬a + b ab abab 001 011 100 111
21
Digitaalsüsteemide verifitseerimise kursus21 Implications for describing the AND gate: ¬a ¬c & ¬b ¬c & ¬c ¬a ¬b Characteristic formula for AND in CNF: (a+ ¬c) (b+ ¬c) (c+ ¬a+ ¬b) & a b c SAT for schematics: characteristic formula
22
Digitaalsüsteemide verifitseerimise kursus22 Implications for describing the OR-gate: a c & b c & c a b Characteristic formula for OR in CNF: (¬a + c) (¬b + c) (¬c + a + b) 1 a b c SAT for schematics: characteristic formula
23
Digitaalsüsteemide verifitseerimise kursus23 Characteristic formula for a schematic: (a+¬d)(b+¬d)(d+¬a+¬b)(¬c+¬e)(c+e)(¬d+f)(¬e+f)(¬f+d+e) 1 c e f & a b d SAT for schematics: characteristic formula
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.