Decision Procedures and Verifjcation
NAIL094 Petr Kučera
Charles University
2019/20 (5th lecture)
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 1 / 47
Decision Procedures and Verifjcation NAIL094 Petr Kuera Charles - - PowerPoint PPT Presentation
Decision Procedures and Verifjcation NAIL094 Petr Kuera Charles University 2019/20 (5th lecture) Petr Kuera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 1 / 47 Solvers based on stochastic (local)
Charles University
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 1 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 3 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 4 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 5 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 5 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 5 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 5 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 5 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 5 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 5 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 5 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 6 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 7 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 8 / 47
for instance 0.57 for random 3-CNFs
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 9 / 47
Input: CNF ϕ, max number of tries t, max number of fmips f Output: SAT or UNKNOWN for i = 1 to t do α ← random full assignment for j = 1 to f do if α satisfjes all clauses of ϕ then return SAT C ← an unsatisfjed clause of ϕ chosen at random if C contains a variable x with break-count 0 then v ← x // freebie move else if rand(0,1) < p then // random walk move x ← a randomly chosen variable in C else // greedy move x ← variable in C with the smallest break-count α(v) ← ¬α(v) // fmip the value of v return UNKNOWN
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 10 / 47
Message passing algorithms — iteratively change value of a variable according to efgect of related clauses Warning propagation (Feige, Mossel, and Vilenchik, 2006) Survey propagation
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 11 / 47
500 1000 1500 2000 2500 3000 3500 4000 2 3 4 5 6 7 8 # of DP calls Ratio of clauses-to-variables 20--variable formulas 40--variable formulas 50--variable formulas
Graph from the Handbook of Satisfjability (Biere et al., 2009) Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 12 / 47
0.2 0.4 0.6 0.8 1 3 3.5 4 4.5 5 5.5 6 6.5 7 Fraction of unsatisfiable formulae M/N Threshold for 3SAT N = 12 N = 20 N = 24 N = 40 N = 50 N = 100
Graph from the Handbook of Satisfjability (Biere et al., 2009) Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 13 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 15 / 47
Many equivalent formulas representing the same function For instance, all unsatisfjable formulas represent the constant 0 function f (x) = 0
Each function with a fjxed ordering of variables has a unique representation with a OBDD Effjcient query answering (consistency, equivalence, entailment) Effjcient manipulation (combination, conditioning, forgetting)
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 16 / 47
Many equivalent formulas representing the same function For instance, all unsatisfjable formulas represent the constant 0 function f (x) = 0
Each function with a fjxed ordering of variables has a unique representation with a OBDD Effjcient query answering (consistency, equivalence, entailment) Effjcient manipulation (combination, conditioning, forgetting)
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 16 / 47
Many equivalent formulas representing the same function For instance, all unsatisfjable formulas represent the constant 0 function f (x) = 0
Each function with a fjxed ordering of variables has a unique representation with a OBDD Effjcient query answering (consistency, equivalence, entailment) Effjcient manipulation (combination, conditioning, forgetting)
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 16 / 47
Many equivalent formulas representing the same function For instance, all unsatisfjable formulas represent the constant 0 function f (x) = 0
Each function with a fjxed ordering of variables has a unique representation with a OBDD Effjcient query answering (consistency, equivalence, entailment) Effjcient manipulation (combination, conditioning, forgetting)
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 16 / 47
Many equivalent formulas representing the same function For instance, all unsatisfjable formulas represent the constant 0 function f (x) = 0
Each function with a fjxed ordering of variables has a unique representation with a OBDD Effjcient query answering (consistency, equivalence, entailment) Effjcient manipulation (combination, conditioning, forgetting)
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 16 / 47
Many equivalent formulas representing the same function For instance, all unsatisfjable formulas represent the constant 0 function f (x) = 0
Each function with a fjxed ordering of variables has a unique representation with a OBDD Effjcient query answering (consistency, equivalence, entailment) Effjcient manipulation (combination, conditioning, forgetting)
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 16 / 47
Many equivalent formulas representing the same function For instance, all unsatisfjable formulas represent the constant 0 function f (x) = 0
Each function with a fjxed ordering of variables has a unique representation with a OBDD Effjcient query answering (consistency, equivalence, entailment) Effjcient manipulation (combination, conditioning, forgetting)
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 16 / 47
Many equivalent formulas representing the same function For instance, all unsatisfjable formulas represent the constant 0 function f (x) = 0
Each function with a fjxed ordering of variables has a unique representation with a OBDD Effjcient query answering (consistency, equivalence, entailment) Effjcient manipulation (combination, conditioning, forgetting)
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 16 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 17 / 47
1
1 1
1 1 1 1
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 18 / 47
nodes representing the same function
left and right successor are the same node
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 19 / 47
nodes representing the same function
left and right successor are the same node
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 19 / 47
nodes representing the same function
left and right successor are the same node
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 19 / 47
nodes representing the same function
left and right successor are the same node
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 19 / 47
1
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 20 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 21 / 47
1
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 22 / 47
1
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 23 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 24 / 47
1
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 25 / 47
1
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 25 / 47
1
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 25 / 47
1
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 25 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 26 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 27 / 47
n
i=1
a unique CNF with 2n−1 a unique DNF with 2n−1 an OBDD with Θ(n) nodes
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 28 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 29 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 30 / 47
1
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 31 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 32 / 47
Construct OBDD for the formula from OBDDs of its subformulas.
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 33 / 47
Construct OBDD for the formula from OBDDs of its subformulas.
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 33 / 47
Construct OBDD for the formula from OBDDs of its subformulas.
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 33 / 47
Construct OBDD for the formula from OBDDs of its subformulas.
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 33 / 47
Construct OBDD for the formula from OBDDs of its subformulas.
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 33 / 47
Construct OBDD for the formula from OBDDs of its subformulas.
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 33 / 47
Construct OBDD for the formula from OBDDs of its subformulas.
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 33 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 34 / 47
1 If u and v are both leaves then OBDD Bϕ ⊗ Bψ is a leaf with value
2 If var(u) = var(v) = x, use Shannon expansion:
3 If var(u) ≠ var(v) (and w.l.o.g. var(u) = x precedes var(v)) then
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 35 / 47
1 If u and v are both leaves then OBDD Bϕ ⊗ Bψ is a leaf with value
2 If var(u) = var(v) = x, use Shannon expansion:
3 If var(u) ≠ var(v) (and w.l.o.g. var(u) = x precedes var(v)) then
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 35 / 47
1 If u and v are both leaves then OBDD Bϕ ⊗ Bψ is a leaf with value
2 If var(u) = var(v) = x, use Shannon expansion:
3 If var(u) ≠ var(v) (and w.l.o.g. var(u) = x precedes var(v)) then
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 35 / 47
1
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 36 / 47
1
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 37 / 47
OBDD Bϕ for ϕ = (¬x1 ∨ x2) ∧ (x1 ∨ ¬x2) and OBDD Bψ for ψ = ¬x2.
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 38 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 39 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 39 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 40 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 40 / 47
Depends on the variable ordering f (x1, . . . , x2n) = (x1 ∧ x2) ∨ ⋅⋅⋅ ∨ (x2n−1 ∧ x2n)
2n+1 nodes for x1 < x3 < . . . x2n−1 < x2 < x4 < ⋅ ⋅ ⋅ < x2n 2n + 2 nodes for x1 < x2 < x3 < ⋅ ⋅ ⋅ < x2n−1 < x2n
Finding the best variable ordering is NP-hard Good heuristics exist
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 41 / 47
Depends on the variable ordering f (x1, . . . , x2n) = (x1 ∧ x2) ∨ ⋅⋅⋅ ∨ (x2n−1 ∧ x2n)
2n+1 nodes for x1 < x3 < . . . x2n−1 < x2 < x4 < ⋅ ⋅ ⋅ < x2n 2n + 2 nodes for x1 < x2 < x3 < ⋅ ⋅ ⋅ < x2n−1 < x2n
Finding the best variable ordering is NP-hard Good heuristics exist
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 41 / 47
Depends on the variable ordering f (x1, . . . , x2n) = (x1 ∧ x2) ∨ ⋅⋅⋅ ∨ (x2n−1 ∧ x2n)
2n+1 nodes for x1 < x3 < . . . x2n−1 < x2 < x4 < ⋅ ⋅ ⋅ < x2n 2n + 2 nodes for x1 < x2 < x3 < ⋅ ⋅ ⋅ < x2n−1 < x2n
Finding the best variable ordering is NP-hard Good heuristics exist
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 41 / 47
Depends on the variable ordering f (x1, . . . , x2n) = (x1 ∧ x2) ∨ ⋅⋅⋅ ∨ (x2n−1 ∧ x2n)
2n+1 nodes for x1 < x3 < . . . x2n−1 < x2 < x4 < ⋅ ⋅ ⋅ < x2n 2n + 2 nodes for x1 < x2 < x3 < ⋅ ⋅ ⋅ < x2n−1 < x2n
Finding the best variable ordering is NP-hard Good heuristics exist
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 41 / 47
Depends on the variable ordering f (x1, . . . , x2n) = (x1 ∧ x2) ∨ ⋅⋅⋅ ∨ (x2n−1 ∧ x2n)
2n+1 nodes for x1 < x3 < . . . x2n−1 < x2 < x4 < ⋅ ⋅ ⋅ < x2n 2n + 2 nodes for x1 < x2 < x3 < ⋅ ⋅ ⋅ < x2n−1 < x2n
Finding the best variable ordering is NP-hard Good heuristics exist
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 41 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 42 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 42 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 42 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 42 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 42 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 43 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 43 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 43 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 43 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 43 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 43 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 43 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 43 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 43 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 44 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 44 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 44 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 44 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 44 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 46 / 47
Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (5th lecture) 47 / 47