SlideShare a Scribd company logo
1 of 72
Download to read offline
The Art of
Computer Programming
7.2.2.2 Satisfiability p.47-76
VOLUME 4 FASCICLE 6
Random satisfiability.
Deviations from randomness in combinatorial algorithms
often have a dramatic effect,
while methods of sorting and searching
generally stay reasonably close to their expected behavior.
How many random clauses of 3SAT on 𝑛𝑛 variables
before they can't all be satisfied?
p.47
1 2 3 4 5 6 7 8 9
𝑥𝑥1, 𝑥𝑥2, 𝑥𝑥3, 𝑥𝑥4, 𝑥𝑥5
¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ ¬𝑥𝑥3 ∧ 𝑥𝑥1 ∨ ¬𝑥𝑥4 ∨ ¬𝑥𝑥5 ∧ 𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5
random
𝑘𝑘-SAT
{{9, 4, 3}, {5, 9, 3}, {8, 4, 3}, {6, 8, 3}, {1, 6, 8},
{1, 6, 7}, {1, 5, 9}, {1, 5, 7}, {9, 2, 4}, {5, 9, 2},
{8, 2, 4}, {6, 8, 2}, {7, 2, 4}, {6, 7, 2}, {5, 7, 2}}
satisfiable
cell allocations
{{1, 1, 0, 1, 1}, {1, 1, 0, 1, 0}, {1, 1, 0, 0, 1}, {1, 0, 1, 1, 1},
{1, 0, 1, 1, 0}, {1, 0, 1, 0, 1}, {1, 0, 1, 0, 0}, {1, 0, 0, 1, 1},
{1, 0, 0, 1, 0}, {1, 0, 0, 0, 1}, {0, 1, 1, 1, 0}, {0, 1, 1, 0, 1},
{0, 1, 1, 0, 0}, {0, 1, 0, 1, 0}, {0, 1, 0, 0, 1}, {0, 0, 1, 1, 0},
{0, 0, 1, 0, 1}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}}
satisfiable
boolean vectors
possible
𝑁𝑁clauses
2𝑘𝑘
𝑛𝑛
𝑘𝑘
𝑘𝑘 = 3, 𝑚𝑚 = 3, 𝑛𝑛 = 5
23
5
3
= 80
15
20
𝑞𝑞 𝑚𝑚 = 𝑄𝑄𝑚𝑚
𝑁𝑁
𝑚𝑚
−1
p.47
𝑥𝑥1, 𝑥𝑥2, 𝑥𝑥3, 𝑥𝑥4, 𝑥𝑥5
¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ ¬𝑥𝑥3 ∧ 𝑥𝑥1 ∨ ¬𝑥𝑥4 ∨ ¬𝑥𝑥5 ∧ 𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5
1 2 3 4 5 6 7 8 9
{{9, 4, 3}, {5, 9, 3}, {8, 4, 3}, {6, 8, 3}, {1, 6, 8},
{1, 6, 7}, {1, 5, 9}, {1, 5, 7}, {9, 2, 4}, {5, 9, 2},
{8, 2, 4}, {6, 8, 2}, {7, 2, 4}, {6, 7, 2}, {5, 7, 2}}
{{1, 1, 0, 1, 1}, {1, 1, 0, 1, 0}, {1, 1, 0, 0, 1}, {1, 0, 1, 1, 1},
{1, 0, 1, 1, 0}, {1, 0, 1, 0, 1}, {1, 0, 1, 0, 0}, {1, 0, 0, 1, 1},
{1, 0, 0, 1, 0}, {1, 0, 0, 0, 1}, {0, 1, 1, 1, 0}, {0, 1, 1, 0, 1},
{0, 1, 1, 0, 0}, {0, 1, 0, 1, 0}, {0, 1, 0, 0, 1}, {0, 0, 1, 1, 0},
{0, 0, 1, 0, 1}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}}
random
𝑘𝑘-SAT
satisfiable
cell allocations
satisfiable
boolean vectors
possible
𝑁𝑁clauses
2𝑘𝑘
𝑛𝑛
𝑘𝑘
𝑘𝑘 = 3, 𝑚𝑚 = 3, 𝑛𝑛 = 5
23
5
3
= 80
15
20
<
𝑞𝑞 𝑚𝑚 = 𝑄𝑄𝑚𝑚
𝑁𝑁
𝑚𝑚
−1
p.47
𝑥𝑥1, 𝑥𝑥2, 𝑥𝑥3, 𝑥𝑥4, 𝑥𝑥5
{{6, 9, 3}, {6, 8, 3}, {6, 7, 3}, {5, 9, 3}, {5, 8, 3},
{5,7, 3}, {4, 9, 3}, {4, 8, 3}, {4, 7, 3}, {6, 9, 2},
{6, 8, 2}, {6, 7, 2}, {5, 9, 2}, {5, 8, 2}, {5, 7, 2},
{4, 9, 2}, {4, 8, 2}, {4, 7, 2}, {1, 6, 9}, {1, 6, 8},
{1, 6, 7}, {1, 5, 9}, {1, 5, 8}, {1, 5, 7}, {1, 4, 9},
{1, 4, 8}, {1, 4, 7}}
{{1, 0, 0, 1, 1}, {0, 1, 1, 1, 1}, {1, 0, 0, 0, 1}, {0, 0, 1, 1, 1},
{1, 0, 0, 1, 0}, {0, 1, 0, 1, 1}, {1, 0, 0, 0, 0}, {0, 0, 0, 1, 1},
{0, 1, 1, 0, 1}, {0, 0, 1, 0, 1}, {0, 1, 0, 0, 1}, {0, 0, 0, 0, 1},
{0, 1, 1, 1, 0}, {0, 0, 1, 1, 0}, {0, 1, 0, 1, 0}, {0, 0, 0, 1, 0},
{0, 1, 1, 0, 0}, {0, 0, 1, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 0, 0, 0}}
¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ ¬𝑥𝑥3 ∧ ¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ 𝑥𝑥3 ∧ ¬𝑥𝑥1 ∨ 𝑥𝑥2 ∨ ¬𝑥𝑥3
1 2 3 4 5 6 7 8 9
random
𝑘𝑘-SAT
satisfiable
cell allocations
satisfiable
boolean vectors
possible
𝑁𝑁clauses
2𝑘𝑘
𝑛𝑛
𝑘𝑘
𝑘𝑘 = 3, 𝑚𝑚 = 3, 𝑛𝑛 = 5
23
5
3
= 80
27
20
𝑞𝑞 𝑚𝑚 = 𝑄𝑄𝑚𝑚
𝑁𝑁
𝑚𝑚
−1
p.47
𝑞𝑞 𝑚𝑚 = 𝑄𝑄𝑚𝑚
𝑁𝑁
𝑚𝑚
−1
𝑥𝑥1, 𝑥𝑥2, 𝑥𝑥3, 𝑥𝑥4, 𝑥𝑥5
¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ ¬𝑥𝑥3 ∧ ¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ 𝑥𝑥3 ∧ ¬𝑥𝑥1 ∨ 𝑥𝑥2 ∨ ¬𝑥𝑥3
1 2 3 4 5 6 7 8 9
{{6, 9, 3}, {6, 8, 3}, {6, 7, 3}, {5, 9, 3}, {5, 8, 3},
{5,7, 3}, {4, 9, 3}, {4, 8, 3}, {4, 7, 3}, {6, 9, 2},
{6, 8, 2}, {6, 7, 2}, {5, 9, 2}, {5, 8, 2}, {5, 7, 2},
{4, 9, 2}, {4, 8, 2}, {4, 7, 2}, {1, 6, 9}, {1, 6, 8},
{1, 6, 7}, {1, 5, 9}, {1, 5, 8}, {1, 5, 7}, {1, 4, 9},
{1, 4, 8}, {1, 4, 7}}
{{1, 0, 0, 1, 1}, {0, 1, 1, 1, 1}, {1, 0, 0, 0, 1}, {0, 0, 1, 1, 1},
{1, 0, 0, 1, 0}, {0, 1, 0, 1, 1}, {1, 0, 0, 0, 0}, {0, 0, 0, 1, 1},
{0, 1, 1, 0, 1}, {0, 0, 1, 0, 1}, {0, 1, 0, 0, 1}, {0, 0, 0, 0, 1},
{0, 1, 1, 1, 0}, {0, 0, 1, 1, 0}, {0, 1, 0, 1, 0}, {0, 0, 0, 1, 0},
{0, 1, 1, 0, 0}, {0, 0, 1, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 0, 0, 0}}
random
𝑘𝑘-SAT
satisfiable
cell allocations
satisfiable
boolean vectors
possible
𝑁𝑁clauses
2𝑘𝑘
𝑛𝑛
𝑘𝑘
𝑘𝑘 = 3, 𝑚𝑚 = 3, 𝑛𝑛 = 5
23
5
3
= 80
27
20
<
p.47
𝑥𝑥1, 𝑥𝑥2, 𝑥𝑥3, 𝑥𝑥4, 𝑥𝑥5
¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ ¬𝑥𝑥3 ∧ 𝑥𝑥1 ∨ ¬𝑥𝑥4 ∨ ¬𝑥𝑥5 ∧ 𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5
1 2 3 4 5 6 7 8 9
{{9, 4, 3}, {5, 9, 3}, {8, 4, 3}, {6, 8, 3}, {1, 6, 8},
{1, 6, 7}, {1, 5, 9}, {1, 5, 7}, {9, 2, 4}, {5, 9, 2},
{8, 2, 4}, {6, 8, 2}, {7, 2, 4}, {6, 7, 2}, {5, 7, 2}}
{{1, 1, 0, 1, 1}, {1, 1, 0, 1, 0}, {1, 1, 0, 0, 1}, {1, 0, 1, 1, 1},
{1, 0, 1, 1, 0}, {1, 0, 1, 0, 1}, {1, 0, 1, 0, 0}, {1, 0, 0, 1, 1},
{1, 0, 0, 1, 0}, {1, 0, 0, 0, 1}, {0, 1, 1, 1, 0}, {0, 1, 1, 0, 1},
{0, 1, 1, 0, 0}, {0, 1, 0, 1, 0}, {0, 1, 0, 0, 1}, {0, 0, 1, 1, 0},
{0, 0, 1, 0, 1}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}}
全単射でない点に注意
random
𝑘𝑘-SAT
satisfiable
cell allocations
satisfiable
boolean vectors
possible
𝑁𝑁clauses
2𝑘𝑘
𝑛𝑛
𝑘𝑘
𝑞𝑞 𝑚𝑚 = 𝑄𝑄𝑚𝑚
𝑁𝑁
𝑚𝑚
−1
p.47
𝑥𝑥1, 𝑥𝑥2, 𝑥𝑥3, 𝑥𝑥4, 𝑥𝑥5
¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ ¬𝑥𝑥3 ∧ 𝑥𝑥1 ∨ ¬𝑥𝑥4 ∨ ¬𝑥𝑥5 ∧ 𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5
1 2 3 4 5 6 7 8 9
{{9, 4, 3}, {5, 9, 3}, {8, 4, 3}, {6, 8, 3}, {1, 6, 8},
{1, 6, 7}, {1, 5, 9}, {1, 5, 7}, {9, 2, 4}, {5, 9, 2},
{8, 2, 4}, {6, 8, 2}, {7, 2, 4}, {6, 7, 2}, {5, 7, 2}}
{{1, 1, 0, 1, 1}, {1, 1, 0, 1, 0}, {1, 1, 0, 0, 1}, {1, 0, 1, 1, 1},
{1, 0, 1, 1, 0}, {1, 0, 1, 0, 1}, {1, 0, 1, 0, 0}, {1, 0, 0, 1, 1},
{1, 0, 0, 1, 0}, {1, 0, 0, 0, 1}, {0, 1, 1, 1, 0}, {0, 1, 1, 0, 1},
{0, 1, 1, 0, 0}, {0, 1, 0, 1, 0}, {0, 1, 0, 0, 1}, {0, 0, 1, 1, 0},
{0, 0, 1, 0, 1}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}}
𝑄𝑄𝑚𝑚 ∶ the number of ways to choose 𝑚𝑚 of the
𝑁𝑁 clauses so that at least one Boolean vector
𝑥𝑥 = 𝑥𝑥1,…,𝑥𝑥𝑛𝑛 satisfies them all.
𝑁𝑁
𝑚𝑚
=
80
3
𝑞𝑞 𝑚𝑚 = 𝑄𝑄𝑚𝑚
𝑁𝑁
𝑚𝑚
−1
𝑞𝑞𝑚𝑚 = Pr( 𝑚𝑚 clauses, distinct but
otherwise selected at random,
are satisfiable)
𝑄𝑄3 = �
p.47
exercise 180
p.148/219
Explain how to use BDDs to compute the numbers 𝑄𝑄𝑚𝑚 that underlie Fig. 40.
What is max0≤𝑚𝑚≤80 𝑄𝑄𝑚𝑚?
very simple BDD (?)
No natural ordering of the clause variables is evident,
but the method of sifting is able to reduce the BDD size.
𝑁𝑁 variables 𝑦𝑦𝑖𝑖 ,one of each possible clause 𝐶𝐶𝑗𝑗
𝑓𝑓 𝑦𝑦1, … 𝑦𝑦𝑁𝑁 = ⋀ 𝐶𝐶𝑗𝑗|𝑦𝑦𝑗𝑗 = 1 is satisfiable is ⋁𝑥𝑥 𝑓𝑓𝑥𝑥 𝑦𝑦 , where
𝑓𝑓𝑥𝑥 𝑦𝑦 = 𝑥𝑥 satisfies ⋀ 𝐶𝐶𝑗𝑗|𝑦𝑦𝑗𝑗 = 1 is simply ⋀ 𝑦𝑦�𝑖𝑖| 𝑥𝑥 makes 𝐶𝐶𝑗𝑗 false .
if 𝑘𝑘 = 2, 𝑛𝑛 = 3 and if 𝐶𝐶1= 𝑥𝑥1 ∨ 𝑥𝑥2 , 𝐶𝐶7= 𝑥𝑥1 ∨ 𝑥𝑥̅3 , 𝐶𝐶11 = 𝑥𝑥2 ∨ 𝑥𝑥̅3 ,
then 𝑓𝑓001 𝑦𝑦1, … , 𝑦𝑦12 = 𝑦𝑦�1 ∧ 𝑦𝑦�7 ∧ 𝑦𝑦�11.
𝑞𝑞20 ≈ 0.776
𝑞𝑞30 ≈ 0.179
𝑞𝑞40 ≈ 0.016
1
𝑇𝑇𝑚𝑚
𝑞𝑞 𝑚𝑚
Fig. 40 + 41
𝑘𝑘 = 3,  𝑛𝑛 = 5
0
𝑞𝑞 𝑚𝑚 = 1 for 𝑚𝑚 < 15 𝑞𝑞 𝑚𝑚 = 0 for 𝑚𝑚 > 55
𝑇𝑇𝑚𝑚: Deviation from randomness
𝜇𝜇 of SAT boolean vectors
+𝜎𝜎
−𝜎𝜎
𝑇𝑇2 ≈ 24.5 ± 0.743
𝑇𝑇20 ≈ 1.47 ± 1.17
1 5
𝑇𝑇30 ≈ 0.20 ± 0.45
← 𝑚𝑚 = 70 になっても,
𝑄𝑄70は たかだか 32 を超えない.
←𝑘𝑘 = 3, 𝑛𝑛 = 5 で,SAT可能な
最大の 𝑚𝑚 = 2
𝑘𝑘
− 1
𝑛𝑛
𝑘𝑘
= 1 − 2
−𝑘𝑘
𝑁𝑁
は 70.
ランダムな70節のCNFが𝑄𝑄70で
SATな場合は十分あり得る.
𝑚𝑚 が増えるにつれ 𝑞𝑞 𝑚𝑚 が限りなく 0 に近づくなかで,
偏差を考慮した 𝑇𝑇𝑚𝑚 が 1 を取るような 𝑚𝑚 に注目する.
p.48
1 < 𝑘𝑘 < 4,  𝑛𝑛 = 5
E𝑃𝑃: The expected “stopping time”
𝑆𝑆𝑘𝑘,𝑛𝑛 = E𝑃𝑃𝑘𝑘,𝑛𝑛
if 𝑃𝑃𝑘𝑘,𝑛𝑛 is the stopping time for 𝑘𝑘SAT on 𝑛𝑛 variables
𝐸𝐸𝐸𝐸 ≈ 25.22, V𝑃𝑃 ≈ 35.73
𝑆𝑆𝑘𝑘,5
4.06 ± 1.19 11.60 ± 3.04 25.22 ± 5.98 43.39 ± 7.62
𝑃𝑃 = 𝑚𝑚 : the number of clauses first unable to satisfy them all
𝑝𝑝𝑚𝑚 = 𝑞𝑞 𝑚𝑚−1 − 𝑞𝑞 𝑚𝑚 :the probability that 𝑚𝑚 − 1 random clauses are satisfiable but 𝑚𝑚 are not
SATがほぼ 1 しかなくなる 𝑚𝑚 と,
全てUNSATになり始める 𝑚𝑚 は
ほぼ一致する.
2−𝑘𝑘
𝑁𝑁 �
𝑃𝑃𝑃𝑃 𝑇𝑇𝑚𝑚 = 1
𝑁𝑁 − 𝑚𝑚
≈ 0.8853
𝑚𝑚
一番最期のSAT集合の累積.
E𝑃𝑃 = � 𝑞𝑞𝑚𝑚
𝑚𝑚
E𝑃𝑃2
= � 2𝑚𝑚 + 1
𝑚𝑚
𝑞𝑞 𝑚𝑚
p.48
𝑁𝑁 𝑚𝑚
ordered sequences after 𝑚𝑚 steps,
not 𝑁𝑁
𝑚𝑚
sets
𝑞𝑞� 𝑚𝑚 : the probability that 𝑚𝑚 random clauses 𝐶𝐶1 ∧ ⋯ ∧ 𝐶𝐶𝑚𝑚 are satisfiable,
each 𝐶𝐶𝑗𝑗 is randomly chosen from the 𝑁𝑁 = 2𝑘𝑘 𝑛𝑛
𝑘𝑘
possibilities
𝑁𝑁 = 2𝑘𝑘
𝑛𝑛
𝑘𝑘
𝑁𝑁 𝑚𝑚
2𝑛𝑛
𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5 ∧ 𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5 ∧ 𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5
も可なのでSATは増える.
“birthday paradox”
23個のキーを365の大きさの表に対応づける
ランダムな関数を選ぶとき,
2つのキーが同じ場所に対応しない確率は
0.4927(1/2以下)である.
𝑞𝑞� 𝑚𝑚 ≥ 𝑞𝑞 𝑚𝑚
Fig. 45
𝑘𝑘 = 3,  𝑛𝑛 = 5
𝑞𝑞 𝑚𝑚
𝑞𝑞� 𝑚𝑚
The expected behavior of 𝑃𝑃� is very much like that of 𝑃𝑃,
if 𝑞𝑞 𝑚𝑚 is small whenever 𝑚𝑚/𝑁𝑁 isn't small.
= ∑
𝑚𝑚
𝑡𝑡
𝑡𝑡! 𝑞𝑞𝑡𝑡
𝑁𝑁
𝑡𝑡=0
𝑁𝑁
𝑡𝑡
/𝑁𝑁 𝑚𝑚
E𝑃𝑃� = �
𝑁𝑁
𝑁𝑁 − 𝑚𝑚
𝑁𝑁−1
𝑚𝑚=0
𝑞𝑞 𝑚𝑚 D𝑃𝑃�2
= �
𝑁𝑁
𝑁𝑁 − 𝑚𝑚
𝑁𝑁−1
𝑚𝑚=0
𝑞𝑞 𝑚𝑚 1 + 2
𝑁𝑁
𝑁𝑁 − 1
+ ⋯ +
𝑁𝑁
𝑁𝑁 − 𝑚𝑚
p.50
𝛼𝛼𝑘𝑘: Satisfiability thresholds
𝑆𝑆𝑘𝑘 𝑚𝑚, 𝑛𝑛 : 𝑆𝑆𝑘𝑘 𝑚𝑚, 𝑛𝑛 = Pr 𝑚𝑚 random clauses of 𝑘𝑘SAT are satisfiable ,
where the 𝑚𝑚 clauses are "sampled with replacement"(they needn't be distinct).
Fig. 46
𝑘𝑘 = 3
𝛼𝛼𝑘𝑘 = lim
𝑛𝑛→∞
𝑆𝑆𝑘𝑘,𝑛𝑛/𝑛𝑛
Random 3SAT problems shows
“phase transition” of satisfiability
when the clauses exceeds about 4.27𝑛𝑛.
経験的に推定される 𝛼𝛼𝑘𝑘 を使えば,𝛼𝛼𝑘𝑘 𝑛𝑛節の
困難なベンチマーク𝑘𝑘SAT問題を得られる.
※ 𝛼𝛼3 = 4.26675 ± 0.00015
2𝑘𝑘
ln 2 −
1 + ln 2
2
− 𝑂𝑂 2−
𝑘𝑘
3 ≤ lim inf
𝑛𝑛→∞
𝛼𝛼𝑘𝑘 𝑛𝑛 ≤ lim sup
𝑛𝑛→∞
𝛼𝛼𝑘𝑘 𝑛𝑛 ≤ 2𝑘𝑘
ln 2 −
1 + ln 2
2
+ 𝑂𝑂 2−
𝑘𝑘
3
2𝑘𝑘
ln 2 − 𝑂𝑂 𝑘𝑘 𝑛𝑛 なランダム 𝑘𝑘SAT は,ベクトル 𝑥𝑥 ; ν𝑥𝑥 ≈
𝑛𝑛
2
で,ほぼ常に充足する.exercise 195
lim
𝑛𝑛→∞
𝑆𝑆𝑘𝑘 𝛼𝛼𝑘𝑘 𝑛𝑛 − 𝜖𝜖 𝑛𝑛 , 𝑛𝑛 = 1, lim
𝑛𝑛→∞
𝑆𝑆𝑘𝑘 𝛼𝛼𝑘𝑘 𝑛𝑛 + 𝜖𝜖 𝑛𝑛 , 𝑛𝑛 = 0,
𝑘𝑘 ≥ 2 において
となる関数𝛼𝛼𝑘𝑘 𝑛𝑛 が存在する. 𝜀𝜀 ∶ 任意の正の数
𝛼𝛼𝑘𝑘 𝑛𝑛 は,Θ 2𝑘𝑘
で押さえられ,𝑘𝑘が十分に大きい時 定数になる.
p.50
Analysis of random 2SAT
2 SAT problem corresponds to an implication digraph,
with arcs 𝑙𝑙̅ → 𝑙𝑙′ and 𝑙𝑙𝑙� → 𝑙𝑙 for each clause 𝑙𝑙 ∨ 𝑙𝑙′ .
𝑐𝑐: a fixed constant
lim
𝑛𝑛→∞
𝑆𝑆2 𝑐𝑐𝑐𝑐 , 𝑛𝑛 = �
1, if 𝑐𝑐 < 1;
0, if 𝑐𝑐 > 1.
The satisfiability threshold 𝛼𝛼2 = 1
𝑛𝑛が増えるにつれて 転移は急激に切り立っていく.
Fig. 47
𝑘𝑘 = 2
𝑆𝑆2,𝑛𝑛
MPR 21 22      非負の確率変数 𝑋𝑋 において
Pr 𝑋𝑋 > 0 ≤ E𝑋𝑋; “the first moment principle”
Pr(𝑋𝑋 > 0) ≥ E𝑋𝑋 2
/ E𝑋𝑋2
“the second moment principle”
充足確率の閾値を有界とみなして 証明を導く.
p.51
𝑥𝑥7
𝑥𝑥̅7
𝑥𝑥9
𝑥𝑥̅9
a set of 2SAT clauses is satisfiable
iff no strong component of its digraph
contains both 𝑥𝑥 and 𝑥𝑥̅ for variable 𝑥𝑥. If it were a random digraph,
only 𝑂𝑂(log 𝑛𝑛) vertices are reachable
from any given vertex when 𝑐𝑐 < 1,
Analysis of random 2SAT
p.50
𝑥𝑥̅8
𝑥𝑥8
a set of 2SAT clauses is satisfiable
iff no strong component of its digraph
contains both 𝑥𝑥 and 𝑥𝑥̅ for variable 𝑥𝑥. If it were a random digraph,
only 𝑂𝑂(log 𝑛𝑛) vertices are reachable
from any given vertex when 𝑐𝑐 < 1,
but that there is a unique
"giant strong component"
of size Ω 𝑛𝑛 when 𝑐𝑐 > 1.
𝑛𝑛 が増えるにつれ,強連結成
分のシェアは急に大きくなる.
Analysis of random 2SAT
一対有向グラフから,
強連結成分への
転移とSATの関連性?
p.50
“snares and snakes”
𝑙𝑙̅1 ∨ 𝑙𝑙2 , 𝑙𝑙̅2 ∨ 𝑙𝑙3 , ..., 𝑙𝑙̅𝑠𝑠−1 ∨ 𝑙𝑙𝑠𝑠
𝑠𝑠-chain 𝐶𝐶 ;
𝑠𝑠 = 9
𝑙𝑙𝑡𝑡 ∨ 𝑙𝑙1 and 𝑙𝑙̅𝑠𝑠 ∨ 𝑙𝑙̅−𝑢𝑢 if 𝑢𝑢 < 0
𝑙𝑙̅𝑠𝑠 ∨ 𝑙𝑙𝑢𝑢 if 𝑢𝑢 > 0,𝑙𝑙𝑡𝑡 ∨ 𝑙𝑙1 and
𝑡𝑡-snake
𝑠𝑠-snare (𝐶𝐶; 𝑡𝑡, 𝑢𝑢) 𝑡𝑡 = 5,  𝑢𝑢 = −𝑡𝑡
対有向グラフのままなら
同一強連結成分内に同時に,
𝑙𝑙𝑠𝑠 と 𝑙𝑙𝑠𝑠
� が存在しない.
→必ず充足可能
充足不能な2SATは
必ず最低一つは snareを
持っている.
snare を持つ2SATでも
𝑠𝑠 と 𝑡𝑡 と 𝑢𝑢 の関係によっては
充足可能となる.
𝑙𝑙𝑡𝑡
𝑙𝑙̅𝑡𝑡
𝑙𝑙𝑡𝑡 𝑙𝑙̅𝑡𝑡
要 𝑡𝑡 で 対の 𝑠𝑠 − 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 同士を
つなぐ際, 𝑢𝑢 の正負が
直流 交流 をスイッチする仕掛け
S A T U N S A T
p.52
“snares and snakes”
𝑙𝑙̅1 ∨ 𝑙𝑙2 , 𝑙𝑙̅2 ∨ 𝑙𝑙3 , ..., 𝑙𝑙̅𝑠𝑠−1 ∨ 𝑙𝑙𝑠𝑠
𝑠𝑠-chain 𝐶𝐶 ;
𝑠𝑠 = 9
𝑙𝑙𝑡𝑡 ∨ 𝑙𝑙1 and 𝑙𝑙̅𝑠𝑠 ∨ 𝑙𝑙̅−𝑢𝑢 if 𝑢𝑢 < 0
𝑙𝑙̅𝑠𝑠 ∨ 𝑙𝑙𝑢𝑢 if 𝑢𝑢 > 0,𝑙𝑙𝑡𝑡 ∨ 𝑙𝑙1 and
𝑡𝑡-snake
𝑠𝑠-snare (𝐶𝐶; 𝑡𝑡, 𝑢𝑢) 𝑡𝑡 = 5,  𝑢𝑢 = −𝑡𝑡
対有向グラフのままなら
同一強連結成分内に同時に,
𝑙𝑙𝑠𝑠 と 𝑙𝑙𝑠𝑠
� が存在しない.
→必ず充足可能
充足不能な2SATは
必ず最低一つは snareを
持っている.
snare を持つ2SATでも
𝑠𝑠 と 𝑡𝑡 と 𝑢𝑢 の関係によっては
充足可能となる.
𝑙𝑙𝑡𝑡
𝑙𝑙̅𝑡𝑡
𝑙𝑙𝑡𝑡 𝑙𝑙̅𝑡𝑡
p.52
Proof of Theorem C
p.53
E𝑋𝑋 is only 𝑂𝑂 𝑛𝑛−1 4⁄
when 𝑚𝑚 = 𝑛𝑛 − 𝑛𝑛3 4⁄
> 𝑐𝑐𝑐𝑐
※ c > 1 ⇔ 𝑚𝑚 > 0
E𝑋𝑋 ≥ Pr 𝑋𝑋 > 0 ; “the first moment principle”
※Pr 𝑋𝑋 = 0 = 1 − Pr 𝑋𝑋 > 0 ≥ 1 − E𝑋𝑋
2𝑠𝑠+1
𝑠𝑠 − 1 2
𝑛𝑛𝑠𝑠
≤ 2𝑠𝑠+1
𝑠𝑠 − 1 2
𝑛𝑛𝑠𝑠
𝑝𝑝 𝑠𝑠 + 1, 𝑚𝑚, 2𝑛𝑛(𝑛𝑛 − 1) ≤
𝑚𝑚𝑠𝑠+1
2𝑛𝑛(𝑛𝑛 − 1) 𝑠𝑠+1
≤
𝑚𝑚𝑠𝑠+1
2𝑛𝑛(𝑛𝑛 − 1) 𝑠𝑠+1
※2𝑛𝑛(𝑛𝑛 − 1)個の2SAT組からランダムに,𝑚𝑚節を抜き出してスネアを作るときの最大数と
その中に特定の𝑠𝑠 − 1個の変数が含まれている確率 𝑝𝑝 𝑠𝑠 + 1, 𝑚𝑚, 2𝑛𝑛(𝑛𝑛 − 1) の上限は
E 𝑋𝑋 𝐶𝐶; 𝑡𝑡, 𝑢𝑢 ≤ 𝑚𝑚𝑠𝑠+1
/ 2𝑛𝑛 𝑛𝑛 − 1
𝑠𝑠+1
E 𝑋𝑋 = � E 𝑋𝑋 𝐶𝐶; 𝑡𝑡, 𝑢𝑢 ≤ � 2𝑠𝑠+1
𝑠𝑠≥0
𝑠𝑠 𝑠𝑠 − 1 𝑛𝑛𝑠𝑠
𝑚𝑚
2𝑛𝑛 𝑛𝑛 − 1
𝑠𝑠+1
=
2
𝑛𝑛
𝑚𝑚
𝑛𝑛 − 1 − 𝑚𝑚
3
𝑚𝑚 > 𝑐𝑐𝑐𝑐, 𝑐𝑐 > 1 における 2𝑆𝑆𝑆𝑆𝑆𝑆の充足確率= 0 である
⇔ 少なくとも 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 の期待値が常に 1 に漸近する
𝑆𝑆2 𝑛𝑛 − 𝑛𝑛3/4
, 𝑛𝑛 ≥ Pr 𝑋𝑋 = 0 ≥ 1 − 𝑂𝑂 𝑛𝑛−1/4
1 − 𝑂𝑂 𝑛𝑛−1/4
𝑛𝑛
Proof of Theorem C
p.53
𝑡𝑡 = 𝑛𝑛1/5 𝑚𝑚 = 𝑛𝑛 + 𝑛𝑛5/6  にとれば、
𝑡𝑡 − 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 分だけ 𝑆𝑆2 𝑚𝑚, 𝑛𝑛 をより鋭利に押し下げられる.
Pr(𝑋𝑋 > 0) ≥ E𝑋𝑋 2
/ E𝑋𝑋2
“the second moment principle”
1 − E𝑋𝑋 2
/ E𝑋𝑋2
≥ 1 − Pr 𝑋𝑋 > 0 = Pr(𝑋𝑋 = 0)
𝑂𝑂 𝑛𝑛−
1
30 ≥ 1 − Pr 𝑋𝑋 > 0 = Pr(𝑋𝑋 = 0)
E 𝑋𝑋2
E 𝑋𝑋 2
= � 𝑝𝑝𝑟𝑟
2𝑡𝑡
𝑟𝑟=0
2𝑛𝑛(𝑛𝑛 − 1)
𝑚𝑚
𝑟𝑟
1 + 𝑂𝑂
𝑡𝑡2
𝑛𝑛
= 𝑂𝑂
𝑡𝑡4
𝑛𝑛
= 𝑂𝑂 𝑛𝑛−1/30
given any chain 𝑙𝑙1, … , 𝑙𝑙𝑡𝑡, … 𝑙𝑙2𝑡𝑡−1 , with 𝑠𝑠 = 2𝑡𝑡 − 1 and 𝑙𝑙𝑡𝑡 in the middle,
generates 𝑙𝑙̅1 ∨ 𝑙𝑙2 , 𝑙𝑙̅2 ∨ 𝑙𝑙3 , ..., 𝑙𝑙̅𝑠𝑠−1 ∨ 𝑙𝑙𝑠𝑠 together with 𝑙𝑙𝑡𝑡 ∨ 𝑙𝑙1 and 𝑙𝑙̅𝑠𝑠 ∨ 𝑙𝑙̅𝑡𝑡 .
𝑡𝑡 −snake, which is the special case (𝐶𝐶; 𝑡𝑡, −𝑡𝑡) of a (2𝑡𝑡 − 1) −snare.
𝑋𝑋𝐶𝐶= [ each clause of (𝐶𝐶; 𝑡𝑡, −𝑡𝑡) occurs exactly once ]𝑋𝑋 = � 𝑋𝑋𝐶𝐶
𝑆𝑆2 𝑛𝑛 + 𝑛𝑛5/6
, 𝑛𝑛 = 𝑂𝑂 𝑛𝑛−1/30
𝑐𝑐𝑐𝑐
𝑛𝑛 + 𝑛𝑛5/6
𝑛𝑛 + 𝑛𝑛3/4
−Θ 𝑛𝑛1/4
𝑂𝑂 𝑛𝑛−1/30
(97)
(95)
p.50
Stirling 数
1.2.6
𝑥𝑥の累乗で表現されている多項式から,
二項係数で表現されている多項式への変換で使われる係数
𝑛𝑛
𝑘𝑘
: 𝑘𝑘本の閉路をもつ𝑛𝑛個の文字の順列第一種
𝑛𝑛
𝑘𝑘
: 𝑛𝑛個の要素を持つ集合を 𝑘𝑘個の要素を持つ
異なる部分集合に分割する方法の数
第二種
階乗冪→通常の冪
通常の冪→階乗冪
𝑥𝑥 𝑛𝑛
= 𝑥𝑥 𝑥𝑥 − 1 … (𝑥𝑥 − 𝑛𝑛 + 1) = � −1 𝑛𝑛−𝑘𝑘 𝑛𝑛
𝑘𝑘
𝑘𝑘
𝑥𝑥 𝑘𝑘
𝑥𝑥 𝑛𝑛 = �
𝑛𝑛
𝑘𝑘
𝑘𝑘
𝑥𝑥 𝑘𝑘
Resolution
p.54
𝐴𝐴 = 123�, 234�, 341,41�2, 1�2�3, 2�3�4, 3�4�1�, 4�12�
axiom
resolvent clause
In-degree 2
directed acyclic graph (dag)
“Resolution proof of 𝐴𝐴”
“resolution refutation. ”
123 12�4
1�24� 1�2�3�
12 12�
1�2�1�2
1
1�
𝜖𝜖
Algorithm D and refutation tree
p.55
we can prove the empty clause
by resolution from 𝐹𝐹|𝑥𝑥̅ iff
we can prove 𝑥𝑥 by resolution from 𝐹𝐹
without resolving on 𝑥𝑥.
if 𝐹𝐹 has no short refutation tree,
Algorithm D cannot conclude those unsatisfiable
unless it runs for a long time.
exercise 224
𝐹𝐹|𝑥𝑥�を縮減して得られるラベルは,
元々の𝐹𝐹からのものではなくても,
その祖先の葉の中に 𝑥𝑥 が含まれている限り,
根は 𝑥𝑥 か 𝜖𝜖 となる.
Fig.39.
Fig.48.
SATを反駁ステップの
最小化問題に置き替える.
Prover-Delayer game
p.55
Pudlák, Pavel, and Russell Impagliazzo. "A lower bound for DLL algorithms for k-SAT." (1999).
P 12�,1�3�, 1�2�3
D 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3
P 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3
D 𝑇𝑇F,𝐹𝐹3�, 𝐹𝐹𝐹𝐹3 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 end 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3end 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹
P 𝑇𝑇F,𝐹𝐹3�, 𝐹𝐹𝐹𝐹3 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹
D end 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇end end end 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇end end 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇
P
proved
Prover-Delayer game
p.55
Pudlák, Pavel, and Russell Impagliazzo. "A lower bound for DLL algorithms for k-SAT." (1999).
P 12�,1�3�, 1�2�3
D 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3
P 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3
D 𝑇𝑇F,𝐹𝐹3�, 𝐹𝐹𝐹𝐹3 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 end 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3end 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹
P 𝑇𝑇F,𝐹𝐹3�, 𝐹𝐹𝐹𝐹3 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹
D end 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇end end end 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇end end 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇
P
proved
Proverは,最短で確実にSATとなるように
①変数の選択順位を宣言する.
②Delayerが * を選択した際の 割り当て真偽を宣言する.
Delayerは,より高得点を得られるように
①なるべく*を宣言する.
②ゲームが継続する=UNSATにもSATにもならない
真偽割り当てを実現する.
Proverがすべての変数を宣言し終える前に,
かつ誤ってゲームを終了させてしまう前に,
Delayerが何点獲得できているかが勝負.
Prover-Delayer game
p.55
P 12�,1�3�, 1�2�3
D 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3
P 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3
D 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹*1P*1P
*1P
P 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹
D 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇
*1P
*1P*1P*1P
P
Proved
If the Delayer has a strategy that guarantees a score of at
least 𝑚𝑚 points, every refutation tree has at least 2 𝑚𝑚 leaves;
hence at least 2 𝑚𝑚
− 1 resolutions must be done,
and every backtrack-based solver needs Ω 2 𝑚𝑚 operations to
declare the clauses unsatisfiable.
Proverが迷わず一方を選ばざるを得ない状況で,
Delayerが * 宣言する戦略
Theorem R p.56
P
D
*1P
𝑗𝑗𝑚𝑚−3
𝑆𝑆 = 𝑗𝑗1, … ,
𝑥𝑥̅𝑗𝑗𝑗𝑗 ,
(𝑥𝑥̅𝑖𝑖𝑗𝑗 ∨ 𝑥𝑥̅𝑗𝑗𝑘𝑘 ∨ 𝑥𝑥𝑖𝑖 𝑖𝑖),
(𝑥𝑥𝑗𝑗𝑗 ∨ 𝑥𝑥𝑗𝑗𝑗 ∨ ⋯ ∨ 𝑥𝑥𝑗𝑗𝑗𝑗)
for 1 ≤ 𝑗𝑗 ≤ 𝑚𝑚; (99)
for 1 ≤ 𝑖𝑖, 𝑗𝑗, 𝑘𝑘 ≤ 𝑚𝑚; (100)
for 1 ≤ 𝑗𝑗 ≤ 𝑚𝑚. (101)
irreflexive
transitive
“𝑗𝑗 ≺ 𝑘𝑘 ” is
a partial ordering.
Prover は𝑗𝑗固定で順に流していく.
for every 𝑗𝑗, there's a 𝑘𝑘 with 𝑗𝑗 ≺ 𝑘𝑘
𝑚𝑚2variables 𝑥𝑥𝑗𝑗𝑗𝑗, for 1 ≤ 𝑗𝑗, 𝑘𝑘 ≤ 𝑚𝑚,
the incidence matrix for a binary relation “𝑗𝑗 ≺ 𝑘𝑘 ”
𝑥𝑥11 ⋯ 𝑥𝑥1𝑚𝑚
⋮ ⋱ ⋮
𝑥𝑥 𝑚𝑚𝑚 ⋯ 𝑥𝑥 𝑚𝑚𝑚𝑚
𝑥𝑥∗∗
𝑗𝑗
𝑘𝑘
(99)(100)(101)節の適用→その中に極大値を持たない{1, … , 𝑚𝑚}の半順序集合の存在
→すべての節がSATには なり得ないが 𝑚𝑚 − 1点まで必ず取れる戦略がある.
この時点で Delayer が,𝑆𝑆 点獲得しているとする時
Proverに選ばせた 変数の履歴集合が 𝑆𝑆
𝑥𝑥𝑗𝑗𝑘𝑘
if 𝑗𝑗 = 𝑘𝑘 if 𝑗𝑗 ∉ 𝑆𝑆, 𝑘𝑘 ∉ 𝑆𝑆 if 𝑗𝑗 ∈ 𝑆𝑆, 𝑘𝑘 ∉ 𝑆𝑆 if 𝑗𝑗 = 𝑗𝑗𝑎𝑎 ∈ 𝑆𝑆, 𝑘𝑘 = 𝑗𝑗𝑏𝑏 ∈ 𝑆𝑆if 𝑗𝑗 ∉ 𝑆𝑆, 𝑘𝑘 ∈ 𝑆𝑆
𝑥𝑥𝑗𝑗𝑘𝑘 ← 0 𝑥𝑥𝑗𝑗𝑘𝑘 ← 0𝑥𝑥𝑗𝑗𝑘𝑘 ← 1 𝑥𝑥𝑗𝑗𝑘𝑘 ← 𝑎𝑎 < 𝑏𝑏𝑥𝑥𝑗𝑗𝑘𝑘 ←∗
Proverの割り当てる真偽に応じて,𝑗𝑗𝑚𝑚−2 に 𝑗𝑗 か 𝑘𝑘 を定義.
得点を 𝑠𝑠 + 1 へ変更. (101)節は,この時点まで Falseになることがない.
Every refutation tree for the clauses (99) ,(100), (101)
represents at least 2 𝑚𝑚−1
− 1 resolution steps.
Lower bounds for general resolution. p.57
4.6.3 加算連鎖
1 = 𝑎𝑎0, 𝑎𝑎1, … , 𝑎𝑎𝑟𝑟= 𝑛𝑛
ただし各要素は,すべての i=1,2,…,r について
ある 𝑘𝑘 ≤ 𝑗𝑗 < 𝑖𝑖 に対して, 𝑎𝑎𝑖𝑖 = 𝑎𝑎𝑗𝑗 + 𝑎𝑎𝑘𝑘
7.1.2 𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵連鎖
𝑛𝑛変数(𝑥𝑥1,…,𝑥𝑥𝑛𝑛)の関数の𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵連鎖とは,
各ステップで先立つステップの2つを
結ぶような列(𝑥𝑥𝑛𝑛+1, … , 𝑥𝑥𝑛𝑛+𝑟𝑟)である.
𝑥𝑥𝑖𝑖 = 𝑥𝑥𝑗𝑗(𝑖𝑖) ∘𝑖𝑖 𝑥𝑥𝑘𝑘 𝑖𝑖 , 𝑛𝑛 + 1 ≤ 𝑖𝑖 ≤ 𝑛𝑛 + 𝑟𝑟 について.
It’s a refutation chain for 𝐶𝐶1, … ,𝐶𝐶𝑚𝑚 if 𝐶𝐶𝑚𝑚+𝑟𝑟 = 𝜖𝜖.
The short clauses are crucial
if we want short chains.
If 𝑥𝑥𝑗𝑗𝑗𝑗 means that pigeon 𝑗𝑗 occupies hole 𝑘𝑘, there is
relevant unsatisfiable clauses for resolution in general.
p.58
Lemma B.
𝛼𝛼 : any sequence of clauses
𝑤𝑤 𝛼𝛼 ∶ "𝑤𝑤𝑤𝑤𝑤𝑤 𝑤𝑤𝑤𝑤 the length of its longest clause or clauses
𝑤𝑤 𝛼𝛼0 ⊢ 𝜖𝜖 : the min. of 𝑤𝑤 𝛼𝛼 over all refutation chains α = 𝐶𝐶1, … , 𝐶𝐶𝑚𝑚+𝑟𝑟 for 𝛼𝛼0
𝛼𝛼0 ⊢ 𝜖𝜖 : the minimum length 𝑟𝑟 of all such chains.
𝛼𝛼0 = 𝐶𝐶1, … , 𝐶𝐶𝑚𝑚
𝛼𝛼0 ⊢ 𝜖𝜖 ≥ 𝑒𝑒 𝑤𝑤 𝛼𝛼0⊢𝜖𝜖 −1 2 8𝑛𝑛⁄
− 2 , for clauses in 𝑛𝑛 ≥ 𝑤𝑤 𝛼𝛼0
2
variables.
Thus there‘s exponential growth if 𝑤𝑤 𝛼𝛼0 = 𝑂𝑂 1 , and 𝑤𝑤 𝛼𝛼0 ⊢ 𝜖𝜖 = Ω 𝑛𝑛 .
𝑊𝑊 ≥ 𝑤𝑤 𝛼𝛼0 特定のリテラルは 𝑊𝑊𝑊𝑊/(2𝑛𝑛) 回でてくる.
𝜌𝜌 = 1 − 𝑊𝑊/(2𝑛𝑛) で 値𝑙𝑙 で反駁した𝛼𝛼0には 高々 𝜌𝜌𝑓𝑓 回のfatな節.
𝑓𝑓 < 𝜌𝜌−𝑏𝑏
な整数 𝑏𝑏 に対して,𝛼𝛼0 の反駁 𝛽𝛽, 𝛽𝛽0 ,𝛽𝛽1,𝛽𝛽2,𝛽𝛽3を以下のように定義.
𝑏𝑏 > 0, 𝛼𝛼0|𝑙𝑙,  𝑤𝑤 𝛽𝛽0 ≤ 𝑊𝑊 + 𝑏𝑏 − 1
𝛽𝛽 = 𝛽𝛽1,𝛽𝛽2,𝛽𝛽3 with 𝛼𝛼0|𝑙𝑙̅,
𝑤𝑤 𝛽𝛽 = max 𝑤𝑤 𝛽𝛽0 + 1, 𝑤𝑤 𝛽𝛽2 , 𝑤𝑤 𝛽𝛽3 ≤ max 𝑊𝑊 + 𝑏𝑏 , 𝑤𝑤 𝛼𝛼0 , 𝑊𝑊 + 𝑏𝑏 = 𝑊𝑊 + 𝑏𝑏
Exercise 238 : 𝑐𝑐 =
1
2𝑛𝑛
, 𝑏𝑏 = 𝑊𝑊 , 𝑊𝑊 = 2𝑛𝑛 ln 𝑟𝑟 , なら 𝑓𝑓 ≤ 𝑟𝑟 < 𝜌𝜌−𝑏𝑏
.
𝑛𝑛 ≥ 𝑤𝑤 𝛼𝛼0
2
, 𝑟𝑟 ≥ 2 で 𝑊𝑊 ≥ 𝑤𝑤 𝛼𝛼0 , 𝑤𝑤 𝛼𝛼0 ⊢ 𝜖𝜖 ≤ 𝑊𝑊 + 𝑏𝑏 ≤ 8𝑛𝑛 ln 𝑟𝑟 + 1
𝑟𝑟𝑚𝑚
p.58
Restricted pigeonhole principle
𝐴𝐴 = 𝑎𝑎0, 𝑎𝑎1, … , 𝑎𝑎 𝑚𝑚
𝐵𝐵 = 𝑏𝑏1, 𝑏𝑏2, … , 𝑏𝑏𝑚𝑚
二部グラフの部分集合 𝐴𝐴′
において あらゆる
𝑏𝑏𝑘𝑘の集合が必ず対となる 𝐴𝐴′
の部分集合を一
つは持っているような境界領域
a bipartite graph 𝐺𝐺0 on those vertices for which each 𝑎𝑎𝑗𝑗 has
degree ≤ 5 and such that the following strong "expansion"
condition is satisfied as follows.
All refutation chains for 𝛼𝛼 𝐺𝐺0 have length expΩ 𝑚𝑚
if we can prove that they all have width Ω 𝑚𝑚 .
the pigeonhole clauses are unsatisfiable
if we also require 𝑥𝑥̅𝑗𝑗𝑗𝑗 whenever 𝑎𝑎𝑗𝑗 𝑏𝑏𝑘𝑘 in 𝐺𝐺0.
(106)(107)を条件にもつ全ての𝑥𝑥̅𝑗𝑗𝑗𝑗 から帰結する節を𝛼𝛼 𝐺𝐺0 とすると,
𝑤𝑤 𝛼𝛼 𝐺𝐺0 ≤ 5 となり,特定されずに残る変数𝑥𝑥𝑗𝑗𝑗𝑗 は高々5𝑚𝑚 + 5 個である.
Resolution
p.54
𝐴𝐴 = 123�, 234�, 341,41�2, 1�2�3, 2�3�4, 3�4�1�, 4�12�
axiom
resolvent clause
In-degree 2
directed acyclic graph (dag)
“Resolution proof of 𝐴𝐴”
“resolution refutation. ”
123 12�4
1�24� 1�2�3�
12 12�
1�2�1�2
1
1�
𝜖𝜖
Algorithm D and refutation tree
p.55
we can prove the empty clause
by resolution from 𝐹𝐹|𝑥𝑥̅ iff
we can prove 𝑥𝑥 by resolution from 𝐹𝐹
without resolving on 𝑥𝑥.
if 𝐹𝐹 has no short refutation tree,
Algorithm D cannot conclude those unsatisfiable
unless it runs for a long time.
exercise 224
𝐹𝐹|𝑥𝑥�を縮減して得られるラベルは,
元々の𝐹𝐹からのものではなくても,
その祖先の葉の中に 𝑥𝑥 が含まれている限り,
根は 𝑥𝑥 か 𝜖𝜖 となる.
Fig.39.
Fig.48.
SATを反駁ステップの
最小化問題に置き替える.
Prover-Delayer game
p.55
Pudlák, Pavel, and Russell Impagliazzo. "A lower bound for DLL algorithms for k-SAT." (1999).
P 12�,1�3�, 1�2�3
D 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3
P 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3
D 𝑇𝑇F,𝐹𝐹3�, 𝐹𝐹𝐹𝐹3 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 end 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3end 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹
P 𝑇𝑇F,𝐹𝐹3�, 𝐹𝐹𝐹𝐹3 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹
D end 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇end end end 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇end end 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇
P
proved
Prover-Delayer game
p.55
P 12�,1�3�, 1�2�3
D 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3
P 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3
D 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹*1P*1P
*1P
P 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹
D 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇
*1P
*1P*1P*1P
P
Proved
If the Delayer has a strategy that guarantees a score of at
least 𝑚𝑚 points, every refutation tree has at least 2 𝑚𝑚 leaves;
hence at least 2 𝑚𝑚
− 1 resolutions must be done,
and every backtrack-based solver needs Ω 2 𝑚𝑚 operations to
declare the clauses unsatisfiable.
Proverが迷わず一方を選ばざるを得ない状況で,
Delayerが * 宣言する戦略
Theorem R p.56
P
D
*1P
𝑗𝑗𝑚𝑚−3
𝑆𝑆 = 𝑗𝑗1, … ,
𝑥𝑥̅𝑗𝑗𝑗𝑗 ,
(𝑥𝑥̅𝑖𝑖𝑗𝑗 ∨ 𝑥𝑥̅𝑗𝑗𝑘𝑘 ∨ 𝑥𝑥𝑖𝑖 𝑖𝑖),
(𝑥𝑥𝑗𝑗𝑗 ∨ 𝑥𝑥𝑗𝑗𝑗 ∨ ⋯ ∨ 𝑥𝑥𝑗𝑗𝑗𝑗)
for 1 ≤ 𝑗𝑗 ≤ 𝑚𝑚; (99)
for 1 ≤ 𝑖𝑖, 𝑗𝑗, 𝑘𝑘 ≤ 𝑚𝑚; (100)
for 1 ≤ 𝑗𝑗 ≤ 𝑚𝑚. (101)
irreflexive
transitive
“𝑗𝑗 ≺ 𝑘𝑘 ” is
a partial ordering.
Prover は𝑗𝑗固定で順に流していく.
for every 𝑗𝑗, there's a 𝑘𝑘 with 𝑗𝑗 ≺ 𝑘𝑘
𝑚𝑚2variables 𝑥𝑥𝑗𝑗𝑗𝑗, for 1 ≤ 𝑗𝑗, 𝑘𝑘 ≤ 𝑚𝑚,
the incidence matrix for a binary relation “𝑗𝑗 ≺ 𝑘𝑘 ”
𝑥𝑥11 ⋯ 𝑥𝑥1𝑚𝑚
⋮ ⋱ ⋮
𝑥𝑥 𝑚𝑚𝑚 ⋯ 𝑥𝑥 𝑚𝑚𝑚𝑚
𝑥𝑥∗∗
𝑗𝑗
𝑘𝑘
(99)(100)(101)節の適用→その中に極大値を持たない{1, … , 𝑚𝑚}の半順序集合の存在
→すべての節がSATには なり得ないが 𝑚𝑚 − 1点まで必ず取れる戦略がある.
この時点で Delayer が,𝑆𝑆 点獲得しているとする時
Proverに選ばせた 変数の履歴集合が 𝑆𝑆
𝑥𝑥𝑗𝑗𝑘𝑘
if 𝑗𝑗 = 𝑘𝑘 if 𝑗𝑗 ∉ 𝑆𝑆, 𝑘𝑘 ∉ 𝑆𝑆 if 𝑗𝑗 ∈ 𝑆𝑆, 𝑘𝑘 ∉ 𝑆𝑆 if 𝑗𝑗 = 𝑗𝑗𝑎𝑎 ∈ 𝑆𝑆, 𝑘𝑘 = 𝑗𝑗𝑏𝑏 ∈ 𝑆𝑆if 𝑗𝑗 ∉ 𝑆𝑆, 𝑘𝑘 ∈ 𝑆𝑆
𝑥𝑥𝑗𝑗𝑘𝑘 ← 0 𝑥𝑥𝑗𝑗𝑘𝑘 ← 0𝑥𝑥𝑗𝑗𝑘𝑘 ← 1 𝑥𝑥𝑗𝑗𝑘𝑘 ← 𝑎𝑎 < 𝑏𝑏𝑥𝑥𝑗𝑗𝑘𝑘 ←∗
Proverの割り当てる真偽に応じて,𝑗𝑗𝑚𝑚−2 に 𝑗𝑗 か 𝑘𝑘 を定義.
得点を 𝑠𝑠 + 1 へ変更. (101)節は,この時点まで Falseになることがない.
Every refutation tree for the clauses (99) ,(100), (101)
represents at least 2 𝑚𝑚−1
− 1 resolution steps.
Lower bounds for general resolution. p.57
4.6.3 加算連鎖
1 = 𝑎𝑎0, 𝑎𝑎1, … , 𝑎𝑎𝑟𝑟= 𝑛𝑛
ただし各要素は,すべての i=1,2,…,r について
ある 𝑘𝑘 ≤ 𝑗𝑗 < 𝑖𝑖 に対して, 𝑎𝑎𝑖𝑖 = 𝑎𝑎𝑗𝑗 + 𝑎𝑎𝑘𝑘
7.1.2 𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵連鎖
𝑛𝑛変数(𝑥𝑥1,…,𝑥𝑥𝑛𝑛)の関数の𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵連鎖とは,
各ステップで先立つステップの2つを
結ぶような列(𝑥𝑥𝑛𝑛+1, … , 𝑥𝑥𝑛𝑛+𝑟𝑟)である.
𝑥𝑥𝑖𝑖 = 𝑥𝑥𝑗𝑗(𝑖𝑖) ∘𝑖𝑖 𝑥𝑥𝑘𝑘 𝑖𝑖 , 𝑛𝑛 + 1 ≤ 𝑖𝑖 ≤ 𝑛𝑛 + 𝑟𝑟 について.
It’s a refutation chain for 𝐶𝐶1, … ,𝐶𝐶𝑚𝑚 if 𝐶𝐶𝑚𝑚+𝑟𝑟 = 𝜖𝜖.
The short clauses are crucial
if we want short chains.
If 𝑥𝑥𝑗𝑗𝑗𝑗 means that pigeon 𝑗𝑗 occupies hole 𝑘𝑘, there is
relevant unsatisfiable clauses for resolution in general.
p.58
Lemma B.
𝛼𝛼 : any sequence of clauses
𝑤𝑤 𝛼𝛼 ∶ "𝑤𝑤𝑤𝑤𝑤𝑤 𝑤𝑤𝑤𝑤 the length of its longest clause or clauses
𝑤𝑤 𝛼𝛼0 ⊢ 𝜖𝜖 : the min. of 𝑤𝑤 𝛼𝛼 over all refutation chains α = 𝐶𝐶1, … , 𝐶𝐶𝑚𝑚+𝑟𝑟 for 𝛼𝛼0
𝛼𝛼0 ⊢ 𝜖𝜖 : the minimum length 𝑟𝑟 of all such chains.
𝛼𝛼0 = 𝐶𝐶1, … , 𝐶𝐶𝑚𝑚
𝛼𝛼0 ⊢ 𝜖𝜖 ≥ 𝑒𝑒 𝑤𝑤 𝛼𝛼0⊢𝜖𝜖 −1 2 8𝑛𝑛⁄
− 2 , for clauses in 𝑛𝑛 ≥ 𝑤𝑤 𝛼𝛼0
2
variables.
Thus there‘s exponential growth if 𝑤𝑤 𝛼𝛼0 = 𝑂𝑂 1 , and 𝑤𝑤 𝛼𝛼0 ⊢ 𝜖𝜖 = Ω 𝑛𝑛 .
𝑊𝑊 ≥ 𝑤𝑤 𝛼𝛼0 特定のリテラルは 𝑊𝑊𝑊𝑊/(2𝑛𝑛) 回でてくる.
𝜌𝜌 = 1 − 𝑊𝑊/(2𝑛𝑛) で 値𝑙𝑙 で反駁した𝛼𝛼0には 高々 𝜌𝜌𝑓𝑓 回のfatな節.
𝑓𝑓 < 𝜌𝜌−𝑏𝑏
な整数 𝑏𝑏 に対して,𝛼𝛼0 の反駁 𝛽𝛽, 𝛽𝛽0 ,𝛽𝛽1,𝛽𝛽2,𝛽𝛽3を以下のように定義.
𝑏𝑏 > 0, 𝛼𝛼0|𝑙𝑙,  𝑤𝑤 𝛽𝛽0 ≤ 𝑊𝑊 + 𝑏𝑏 − 1
𝛽𝛽 = 𝛽𝛽1,𝛽𝛽2,𝛽𝛽3 with 𝛼𝛼0|𝑙𝑙̅,
𝑤𝑤 𝛽𝛽 = max 𝑤𝑤 𝛽𝛽0 + 1, 𝑤𝑤 𝛽𝛽2 , 𝑤𝑤 𝛽𝛽3 ≤ max 𝑊𝑊 + 𝑏𝑏 , 𝑤𝑤 𝛼𝛼0 , 𝑊𝑊 + 𝑏𝑏 = 𝑊𝑊 + 𝑏𝑏
Exercise 238 : 𝑐𝑐 =
1
2𝑛𝑛
, 𝑏𝑏 = 𝑊𝑊 , 𝑊𝑊 = 2𝑛𝑛 ln 𝑟𝑟 , なら 𝑓𝑓 ≤ 𝑟𝑟 < 𝜌𝜌−𝑏𝑏
.
𝑛𝑛 ≥ 𝑤𝑤 𝛼𝛼0
2
, 𝑟𝑟 ≥ 2 で 𝑊𝑊 ≥ 𝑤𝑤 𝛼𝛼0 , 𝑤𝑤 𝛼𝛼0 ⊢ 𝜖𝜖 ≤ 𝑊𝑊 + 𝑏𝑏 ≤ 8𝑛𝑛 ln 𝑟𝑟 + 1
𝑟𝑟𝑚𝑚
p.60
SAT solving via resolution.
by E. W.Samson and R. K. Mueller in 1955.
𝐹𝐹 → {1234,12�, 1�2�3�, 1�3,23�, 34�}
123
℘ 12
1�2� 1�2
1�1
𝜖𝜖
← 𝐹𝐹’
← 𝑥𝑥
𝐴𝐴𝐴 𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴
SAT is the problem of evaluating the quantified formula
∃𝑥𝑥1 … ∃𝑥𝑥𝑛𝑛−1∃𝑥𝑥𝑛𝑛 𝐹𝐹 𝑥𝑥1, … , 𝑥𝑥𝑛𝑛−1, 𝑥𝑥𝑛𝑛
where 𝐹𝐹 is a Boolean function given in CNF
as a conjunction of clauses.
How to transform the CNF for 𝐹𝐹
into the CNF for 𝐹𝐹𝐹 in the reduced problem ?
∃𝑥𝑥1 … ∃𝑥𝑥𝑛𝑛−1 𝐹𝐹𝐹 𝑥𝑥1, … , 𝑥𝑥𝑛𝑛−1 , 𝐹𝐹𝐹 𝑥𝑥1, … , 𝑥𝑥𝑛𝑛−1 =
𝐹𝐹 𝑥𝑥1, … , 𝑥𝑥𝑛𝑛−1, 0 ∨ 𝐹𝐹 𝑥𝑥1, … , 𝑥𝑥𝑛𝑛−1, 1 .
, .
.
Suppose clauses of contain and clauses contain .
Then the elimination of will give us at most new clauses, in the worst case;
so will have no more clauses than did, whenever , namely when .
* This condition clearly holds whenever or ; or , and even when .
Therefore repeated elimination of variables doesn't always cause the set of clauses to explode.
In the worst case, however, it can be quite inefficient.
p.61
Algorithm I.
𝐶𝐶1 ∧ ⋯ ∧ 𝐶𝐶𝑚𝑚 : 𝑚𝑚 nonempty clauses on 𝑛𝑛 Boolean variables 𝑥𝑥1 … 𝑥𝑥𝑛𝑛
1972, Stephen Cook(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙 𝑙𝑙)
𝐶𝐶1 𝐶𝐶2 𝐶𝐶3 𝐶𝐶4 𝐶𝐶5 𝐶𝐶6 𝐶𝐶7 𝐶𝐶8 𝐶𝐶9 𝐶𝐶10 𝐶𝐶11𝐶𝐶𝑖𝑖 𝐶𝐶𝑗𝑗
1234 12� 1�2�3� 1�3 23� 34�
𝑤𝑤 𝑙𝑙1 𝑙𝑙2 𝑙𝑙3 𝑙𝑙4
3 2 1
1� 2�3�
2 2� 23�
1�2�3�
12�
3�
1 3� 4� 1� 2� 1234
2
12�
134
1 1�3
34
𝐶𝐶12
4 34� 3
3
𝜖𝜖
3�
I3.
I4.
I5.
𝐹𝐹
𝑙𝑙𝑑𝑑 :Choose a literal that occurs most frequently
in the set of currently unsatisfied clauses
that have the fewest unspecified literals.
Algorithm I is to minimize the number of resolution steps, but
tends to fill memory with a great many new clauses when it is applied
to large problems, and there's no obvious way to deal with those
clauses efficiently.
p.63
123,234,345,456,567,678,789,135,246,357,468,579,147,258,369,159,
1�2�3�, 2�3�4�, 3�4�5�, 4�5�6�, 5�6�7�, 6�7�8�, 7�8�9�, 1�3�5�, 2�4�6�, 3�5�7�, 4�6�8�, 5�7�9�, 1�4�7�, 2�5�8�, 3�6�9�, 1�5�9�.
𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤(3,3; 9)
0 ≤ 𝐹𝐹 < 𝑛𝑛 = 18
𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 𝐿𝐿3 𝐿𝐿4 𝐿𝐿5 𝐿𝐿6 𝐿𝐿7 𝐿𝐿8 𝐿𝐿9 𝐿𝐿10 𝐿𝐿11 𝐿𝐿12 𝐿𝐿13 𝐿𝐿14 𝐿𝐿15 𝐿𝐿16 𝐿𝐿17
trail
6� 9� 2 𝜖𝜖3
396 246
5
546
8
846
2�
2�5�8�
7�
7�5�3�reason
level
Λ
1
Λ
2
4�
Λ
3
depends directly on
depends on
Every conflict allows to construct a new clause 𝑐𝑐
that is true whenever the existing clauses are 𝑠𝑠𝑠𝑠𝑠𝑠,
with “learning" 𝑐𝑐 by adding it to the existing clauses,
we will find a solution or learn 𝜖𝜖.
Conflict clause 𝑐𝑐 on
level 3
CDCL: toward algorithm C.
p.64
45�68�
New clause 𝑐𝑐′
45�6
46
𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 𝐿𝐿3 𝐿𝐿4 𝐿𝐿5 𝐿𝐿6 𝐿𝐿7 𝐿𝐿8 𝐿𝐿9 𝐿𝐿10 𝐿𝐿11 𝐿𝐿12 𝐿𝐿13 𝐿𝐿14 𝐿𝐿15 𝐿𝐿16 𝐿𝐿17
trail
reason
level
6� 4 5 9 8 2 2�1�7�3�
Λ Λ46 369 678 1233�4�5� 5�7�9� 1�5�9� 2�5�8�
1 2
𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 𝐿𝐿3 𝐿𝐿4 𝐿𝐿5 𝐿𝐿6 𝐿𝐿7 𝐿𝐿8 𝐿𝐿9 𝐿𝐿10 𝐿𝐿11 𝐿𝐿12 𝐿𝐿13 𝐿𝐿14 𝐿𝐿15 𝐿𝐿16 𝐿𝐿17
trail
6� 9� 2 𝜖𝜖3
396 246
5
546
8
846
2�
2�5�8�
7�
7�5�3�reason
level
Λ
1
Λ
2
Conflict clause 𝑐𝑐 on
level 3
4�
Λ
3
135�8� → 135�67→ 35�679� → 35�69� → 35�6→ 4�5�6→ 5�6
Setting 𝐿𝐿2 ← 5� ,now forces 7, 1�,3,9,2�,8�,8, all at level 1;
finally learn the 𝑢𝑢𝑢𝑢𝑢𝑢𝑢𝑢 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 6
CDCL: toward algorithm C.
p.64
𝑙𝑙̅ 𝜖𝜖
trail
reason
Initial conflict clause
𝑙𝑙̅𝑎𝑎�1..𝑎𝑎�𝑖𝑖..𝑎𝑎�𝑘𝑘
𝑏𝑏 array
. . . . .
𝑏𝑏1 ← 𝑎𝑎1
𝑏𝑏�1
. . . 𝑏𝑏�𝑟𝑟
𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 𝐿𝐿3 𝐿𝐿4 𝐿𝐿𝑡𝑡 𝐿𝐿9 …. . . . . .
counter 1 . . .
level 𝑑𝑑𝑑𝑑’
𝐿𝐿𝑡𝑡 𝑎𝑎𝑎�1..𝑎𝑎𝑎� 𝑖𝑖..𝑎𝑎𝑎� 𝑘𝑘𝑘
𝑎𝑎𝑎𝑖𝑖
𝑏𝑏�𝑖𝑖
𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 𝐿𝐿3 𝐿𝐿4 𝐿𝐿𝑡𝑡 𝐿𝐿9 …
trail
𝑎𝑎1 𝑙𝑙̅ 𝜖𝜖𝑎𝑎𝑠𝑠
reason
stamp
𝑙𝑙̅𝑎𝑎�1..𝑎𝑎�𝑖𝑖..𝑎𝑎�𝑘𝑘
𝑏𝑏 array
level 𝑑𝑑𝑑𝑑’
. . .
𝑎𝑎𝑟𝑟. . . . . . . .
𝑏𝑏�1
. . . 𝑏𝑏�𝑟𝑟
𝑠𝑠. .
. . .
counter 1 . . .
𝑎𝑎𝑘𝑘
𝐿𝐿𝑡𝑡 𝑎𝑎𝑎�1..𝑎𝑎𝑎� 𝑖𝑖..𝑎𝑎𝑎� 𝑘𝑘𝑘
𝑎𝑎𝑎𝑖𝑖
𝑏𝑏�𝑖𝑖
𝐿𝐿𝑡𝑡 𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 …
trail
𝑎𝑎1 𝜖𝜖
reason
stamp
𝑏𝑏 array
level 𝑑𝑑𝑑𝑑’
. . .
𝑎𝑎𝑟𝑟. . . . .
𝑠𝑠. .
. . .
counter 1
𝐿𝐿�𝑡𝑡
𝐿𝐿𝑡𝑡
𝐿𝐿�𝑡𝑡 𝑏𝑏�1..𝑏𝑏�𝑟𝑟
. . .𝑏𝑏�1 𝑏𝑏�𝑟𝑟
Stamp.
Eventually the count of unresolved literals decrease to 1 ;
the learned clause is then 𝐿𝐿�𝑡𝑡 ∨ 𝑏𝑏�1 ∨ ⋯ ∨ 𝑏𝑏�𝑟𝑟.
But the learned clauses by the efficient resolution steps
might turn out to be quite large.
𝑎𝑎1 . . . 𝑎𝑎𝑘𝑘𝑎𝑎𝑠𝑠
stamp 𝑠𝑠. .𝑟𝑟
𝑎𝑎𝑟𝑟
Redundancy of CDCL p.65
a CDCL solver was applied to the 2779 clauses of 𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤(3, 10; 97),
after about 10,000 clauses had been learned.
the clauses learned unsat had an average length of 19.9 → 11.2 ; simplification run about 33% faster.
that decision eventually lead
to a conflict when trying to set 𝑳𝑳𝟔𝟔𝟔𝟔.
The complexity of a CDCL is devoted to unit propagation.
Key is the value of a literal forced by previous assignments .
Exercise 257.
A literal 𝑙𝑙′� is said to be 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟, w.r.t. a given clause 𝑐𝑐 and the current trail,
(i) 𝑙𝑙 is defined at level 0, or
(ii) 𝑙𝑙 is not a decision literal and every false literal in 𝑙𝑙's reason is either in 𝑐𝑐
or (recursively) redundant.
𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 …
trail
𝜖𝜖
reason
stamp
𝑏𝑏 array
level
1
𝑑𝑑𝑑𝑑’
. . . 𝑠𝑠
. . .
𝑙𝑙𝑙�
𝐿𝐿𝑡𝑡
𝑙𝑙𝑙�𝑏𝑏�1..𝑏𝑏�4
. . .𝑏𝑏�1 𝑏𝑏�4
conflict clause 𝑐𝑐
the reason for 𝑏𝑏4 = 𝑏𝑏4 ∨ 𝑏𝑏�1 ∨ 𝑎𝑎�1 ,
the reason for 𝑎𝑎1 = 𝑎𝑎1 ∨ 𝑏𝑏�2 ∨ 𝑎𝑎�2
the reason for 𝑎𝑎2 = 𝑎𝑎2 ∨ 𝑏𝑏�1 ∨ 𝑏𝑏�3 .
𝑏𝑏4 is redundant, because 𝑎𝑎�2 and 𝑎𝑎�1 are redundant.
a) Suppose 𝑐𝑐 = 𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ ⋯ ∨ 𝑏𝑏�𝑟𝑟 is a newly learned clause. Prove that if 𝑏𝑏�𝑗𝑗 ∈ 𝑐𝑐 is redundant, some
other 𝑏𝑏�𝑖𝑖 ∈ 𝑐𝑐 became false on the same level of the trail as 𝑏𝑏𝑗𝑗 did.
b) Devise an efficient algorithm that discovers all of the redundant literals 𝑏𝑏�𝑖𝑖
in a given newly learned clause 𝑐𝑐 = 𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ ⋯ ∨ 𝑏𝑏�𝑟𝑟 Hint: Use stamps.
p.155
Answer to Exercise 257 (b). p.233
b) Devise an efficient algorithm that discovers all of the redundant literals 𝑏𝑏�𝑖𝑖
in a given newly learned clause 𝑐𝑐 = 𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ ⋯ ∨ 𝑏𝑏�𝑟𝑟 Hint: Use stamps.
We can assume that the stamp value 𝒔𝒔 used when resolving conflicts is a multiple of 𝟑𝟑,
and that all stamps are ≤ 𝒔𝒔.
Then we can stamp literal 𝑙𝑙 with S 𝑙𝑙 ← 𝑠𝑠 + 1 if 𝑙𝑙̅ is known to be redundant,
or 𝑠𝑠 + 2 if 𝑙𝑙� is known to be nonredundant and not in 𝑐𝑐.
(These stamps serve as a '‘memo cache" to avoid repeated work.)
While building 𝑐𝑐 we can also stamp levels as well as literals,
setting LS[𝑑𝑑𝑑] ← 𝑠𝑠 if level 𝑑𝑑𝑑 has exactly one of the 𝑏𝑏𝑖𝑖 ,
or 𝑠𝑠 + 1 if it has more than one.
Then for 1 ≤ 𝑗𝑗 ≤ 𝑟𝑟,
𝑏𝑏𝑗𝑗 is redundant if and only if
LS 𝑙𝑙𝑙𝑙𝑙𝑙 𝑏𝑏𝑗𝑗 ← 𝑠𝑠 + 1 and 𝑟𝑟𝑟𝑟𝑟𝑟 𝑏𝑏�𝑗𝑗 is true,
where 𝑙𝑙𝑙𝑙𝑙𝑙(𝑙𝑙) = VAL 𝑙𝑙 ≫1 and
where 𝑟𝑟𝑟𝑟𝑟𝑟(𝑙𝑙) is the following recursive procedure:
“ If 𝑙𝑙 is a decision literal, return false.
Otherwise let 𝑙𝑙 ∨ 𝑎𝑎�1 ∨ ⋯ ∨ 𝑎𝑎�𝑘𝑘 be 𝑙𝑙′s reason.
For 1 ≤ 𝑖𝑖 ≤ 𝑘𝑘 with 𝑙𝑙𝑙𝑙𝑙𝑙 𝑎𝑎𝑖𝑖 > 0,
if S 𝑎𝑎𝑖𝑖 = s + 2 return false;
if S 𝑎𝑎𝑖𝑖 < s and either LS 𝑙𝑙𝑙𝑙𝑙𝑙 𝑎𝑎𝑖𝑖 < 𝑠𝑠 or 𝑟𝑟𝑟𝑟𝑟𝑟 𝑎𝑎�𝑖𝑖 is false, set S 𝑎𝑎𝑖𝑖 ← 𝑠𝑠 + 2 and return false .
But if none of these conditions hold,
S 𝑙𝑙 ← 𝑠𝑠 + 1 and return true. “
𝑙𝑙
𝑠𝑠 + 1
𝑠𝑠 + 2
𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 …
trail
reason
stamp : S( )
𝑏𝑏 array
level : 𝑙𝑙𝑙𝑙𝑙𝑙( )
1
𝑑𝑑𝑑𝑑’
. . . 𝑠𝑠
. . .
𝑙𝑙𝑙�
𝐿𝐿𝑡𝑡
𝑙𝑙𝑙�𝑏𝑏�1..𝑏𝑏�𝑟𝑟
. . .𝑏𝑏�1 𝑏𝑏�𝑟𝑟
LS( ) 𝑠𝑠
𝑠𝑠 + 1
conflict clause 𝑐𝑐
𝑏𝑏𝑗𝑗
Algorithm C p.68+69
(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶).
0 0 0 0 1 0 -1 -1 -1 0
-1
MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
c1.
[Initialize]
c2.
[Level
complete?]
c3.
[Advance 𝐺𝐺.]
c4.
[Does 𝑐𝑐 forceaunit?]
c5.
[New level?]
c6.
[Makeadecision.]
c7.
[Resolveaconflict.]
c8.
[Backjump.]
c9.
[Learn.]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all
literals
forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1
if 𝐺𝐺 = 𝐹𝐹
𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1
for all c in the watch list of 𝑙𝑙̅
𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.)
⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔
if 𝑙𝑙0 is true ⇔ otherwise
𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋
with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false
found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false
𝑙𝑙0 false ⇔ 𝑙𝑙0 free
𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗
𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈
𝐿𝐿𝐹𝐹 ← 𝑙𝑙0
TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0
← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1
if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f
terminate
succesfully
prepare to
purge excess
clauses
flush literals
as expected
⇔ otherwise
𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹.
𝑘𝑘 ← HEAP 0
deletek from the heap
if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠
𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1
𝐿𝐿𝐹𝐹 ← 𝑙𝑙
TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1
if 𝑤𝑤 = 0 ⇔ otherwise
terminate
unsuccesfully
use the conflictclause 𝑐𝑐
to construct
𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ …∨ 𝑏𝑏�𝑟𝑟
ACT( 𝑙𝑙 ) ← ACT( 𝑙𝑙 ) +DEL
for all literals 𝑙𝑙 stampedset d' to the max. level
occupied by 𝑏𝑏1,… , 𝑏𝑏𝑟𝑟 while 𝐹𝐹 > 𝑐𝑐𝑑𝑑′+1
𝐹𝐹 ← 𝐹𝐹 − 1
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
(Increasing ACT 𝑙𝑙 may change HEAP.)
𝑙𝑙 ← 𝐿𝐿𝐹𝐹𝑘𝑘 ← 𝑙𝑙 OVAL(𝑘𝑘) ← VAL 𝑘𝑘𝑅𝑅𝑙𝑙 ← Λ if HLOC 𝑙𝑙 < 0 insert 𝑘𝑘 into HEAP.
𝐺𝐺 ← 𝐹𝐹𝑤𝑤 ← 𝑤𝑤𝑙
set 𝑐𝑐 ←MAXL
If 𝑤𝑤 > 0
store the new clause in MEM at position 𝑐𝑐
advance MAXL to the next available position in MEM
𝑀𝑀 ← 𝑀𝑀 + 1𝐿𝐿𝐹𝐹 ← 𝑙𝑙𝑙 TLOC( 𝑙𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙′ ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 DEL←DEL/𝜌𝜌
Given a set of clauses on 𝑛𝑛 Boolean variables,
this algorithm finds a solution 𝐿𝐿0 𝐿𝐿1 … 𝐿𝐿𝑛𝑛−1 if and only if the clauses are satisfiable,
meanwhile discovering 𝑀𝑀 new ones that are consequences of the originals.
After discovering 𝑀𝑀p new clauses, it will purge some of them from its memory and reset 𝑀𝑀p ;
after discovering 𝑀𝑀f of them, it will flush part of its trail, reset 𝑀𝑀f , and start over.
(Details of purging and flushing will be discussed later.)
p.66+67
0 0 0 0 1 0 -1 -1 -1 0
MEM[ ]
𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
𝑐𝑐 − 1 𝑐𝑐 − 2
𝑐𝑐 − 3
𝑐𝑐 − 4
𝑐𝑐 − 5
c1.
[Initialize]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
A monolithic array MEM hold all of the literals in all of the clauses
Each clause 𝑐𝑐 = 𝑙𝑙0 ∨ 𝑙𝑙1 ∨ ⋯ ∨ 𝑙𝑙𝑘𝑘−1 with 𝑘𝑘 > 1 is represented by its starting position in MEM ,
with MEM 𝑐𝑐 + 𝑗𝑗 = 𝑙𝑙𝑗𝑗 for 0 ≤ 𝑗𝑗 < 𝑘𝑘.
Its two watched literals are 𝑙𝑙0 and 𝑙𝑙1,
and its size 𝑘𝑘 is stored in MEM [𝑐𝑐 − 1].
MAXL is set equal to MINL, the smallest cell in MEM that is
available for learned clauses; then MAXL grows as new
clauses are added to the repertoire.
𝑥𝑥𝑘𝑘 and 𝑥𝑥̅𝑘𝑘, for 1 ≤ 𝑘𝑘 ≤ 𝑛𝑛, are represented by 2𝑘𝑘 and 2𝑘𝑘 + 1
each of these 2𝑛𝑛 literals 𝑙𝑙 has a list pointer 𝑊𝑊𝑙𝑙,
which begins a linked list of the clauses in which 𝑙𝑙 is watched.
And We have 𝑊𝑊𝑙𝑙 = 0 if there is no such clause;
but if 𝑊𝑊𝑙𝑙 = 𝑐𝑐 > 0, the next link in this "watch list" is
in MEM [𝑐𝑐 − 2] if 𝑙𝑙 = 𝑙𝑙0, in MEM [𝑐𝑐 − 3]if 𝑙𝑙 = 𝑙𝑙1.
𝑥𝑥𝑘𝑘 for 1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 has six current attributes
S(𝑘𝑘) is the "stamp"
If neither 𝑥𝑥𝑘𝑘 𝑛𝑛𝑛𝑛𝑛𝑛 𝑥𝑥̅𝑘𝑘 appears in the current trail, then
VAL 𝑘𝑘 = −1, and we say that 𝒙𝒙𝒌𝒌 and its two literals
are "free."
But if 𝐿𝐿𝑡𝑡 = 𝑙𝑙 is a literal of the trail,
belonging to level 𝑑𝑑, we have
VAL 𝑙𝑙 ≤ 2𝑑𝑑 + 𝑙𝑙 &1 and TLOC 𝑙𝑙 = 𝑡𝑡 where 𝑙𝑙 = 𝑙𝑙 ≫ 1,
and we say that 𝑙𝑙 is "true" and 𝑙𝑙̅ is "false."
Thus a given literal 𝑙𝑙 is false if and only if
VAL 𝑙𝑙 is nonnegative and VAL(|𝑙𝑙|) + 𝑙𝑙 is odd.
𝑥𝑥𝑘𝑘 has an activity score ACT(𝒌𝒌), which heuristically
estimates its desirability for branching.
All of the free variables, and possibly others, are kept in an
array called HEAP, which is arranged so that
ACT HEAP 𝑗𝑗 ≤ ACT HEAP 𝑗𝑗 − 1 ≫ 1 for 0 < 𝑗𝑗 < ℎ
the variable DEL holds the current scaling factor 𝜌𝜌−𝑀𝑀
, divided by
10100
each time all of the activities have been rescaled.
where 𝜌𝜌 is a damping factor (say 𝜌𝜌 = .95)
OVAL(𝑘𝑘), to control the polarity of each new decision
Algorithm 𝑪𝑪 starts by simply making each OVAL 𝑘𝑘
odd, Afterwards it sets OVAL 𝑘𝑘 ←VAL 𝑘𝑘
whenever 𝑥𝑥𝑘𝑘 leaves the trail and becomes free
Algorithm C p.68
(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶).
0 0 0 0 1 0 -1 -1 -1 0
MEM[ ]
𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
𝑐𝑐 − 1 𝑐𝑐 − 2
𝑐𝑐 − 3
𝑐𝑐 − 4
𝑐𝑐 − 5
c1.
[Initialize]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
Exercise 260: Describe in detail step C1's setting-up of MEM, the watch lists, and the trail.
First, to get a random permutation in the heap we can use a variant of Algorithm 3.4.2P:
For 𝑘𝑘 ← 1, 2, … , 𝑛𝑛, let 𝑗𝑗 be a random integer in [0 . . 𝑘𝑘 − 1]
and set HEAP[𝑘𝑘 − 1] ←HEAP[𝑗𝑗], HEAP[ 𝑗𝑗 ] ← 𝑘𝑘.
Then set HLOC HEAP [ 𝑗𝑗 ] ← 𝑗𝑗 for 0 ≤ 𝑗𝑗 < 𝑛𝑛.
Next, set 𝐹𝐹 ← 0 and 𝑊𝑊𝑙𝑙 ← 0 for 2 ≤ 𝑙𝑙 ≤ 2𝑛𝑛 + 1 and 𝑐𝑐 ← 3.
Do the following for each input clause 𝑙𝑙0 𝑙𝑙1 … 𝑙𝑙𝑘𝑘−1:
Terminate unsuccessfully if 𝑘𝑘 = 0, or if 𝑘𝑘 = 1 and 0 ≤VAL 𝑙𝑙0 ≠ 𝑙𝑙0 & 1.
If 𝑘𝑘 = 1 and VAL 𝑙𝑙0 < 0 ,
set VAL 𝑙𝑙0 ← 𝑙𝑙0 & 1, TLOC 𝑙𝑙0 ← 𝐹𝐹 , 𝐹𝐹 ← 𝐹𝐹 + 1.
If 𝑘𝑘 > 1, set MEM 𝑐𝑐 + 𝑗𝑗 ← 𝑙𝑙0 for 0 ≤ 𝑗𝑗 < 𝑘𝑘 ;
also MEM 𝑐𝑐 − 1 ← 𝑘𝑘,
MEM 𝑐𝑐 − 2 ← 𝑊𝑊𝑙𝑙0
, 𝑊𝑊𝑙𝑙0
← 𝑐𝑐,
MEM 𝑐𝑐 − 3 ← 𝑊𝑊𝑙𝑙1
, 𝑊𝑊𝑙𝑙1
← 𝑐𝑐, 𝑐𝑐 ← 𝑐𝑐 + 𝑘𝑘 + 3,
Finally,
set MINL ← MAXL ← 𝑐𝑐 + 2
(allowing two cells for extra data in the preamble of the first learned clause).
Of course we must also ensure that MEM is large enough.
Algorithm C p.68
(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶).
0 0 0 0 1 0 -1 -1 -1 0
MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
c1.
[Initialize]
c2.
[Level
complete?]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all
literals
forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1
if 𝐺𝐺 = 𝐹𝐹
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
c5.
[New level?]
Algorithm C p.68
(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶).
0 0 0 0 1 0 -1 -1 -1 0
MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
c1.
[Initialize]
c2.
[Level
complete?]
c3.
[Advance 𝐺𝐺.]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all
literals
forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1
if 𝐺𝐺 = 𝐹𝐹
𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1
for all c in the watch list of 𝑙𝑙̅ ⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
c7.
[Resolveaconflict.]
c5.
[New level?]
Exercise 261: The main loop of Algorithm C is the unit-propagation process of steps C3 and C4.
Describe the low-level details of link adjustment, etc., to be done in those steps.
(Throughout this answer, 𝑙𝑙𝑗𝑗 is an abbreviation for MEM 𝑐𝑐 + 𝑗𝑗 .)
Set 𝑞𝑞 ← 0 and 𝑐𝑐 ← 𝑊𝑊𝑙𝑙̅.
While 𝑐𝑐 ≠ 0, do the following:
Set 𝑙𝑙𝑙 ← 𝑙𝑙0.
If 𝑙𝑙′
≠ 𝑙𝑙̅ (hence 𝑙𝑙1 = 𝑙𝑙̅), set 𝑐𝑐𝑐 ← 𝑙𝑙−3 ;
otherwise set 𝑙𝑙𝑙 ← 𝑙𝑙1, 𝑙𝑙0← 𝑙𝑙𝑙, 𝑙𝑙1 ← 𝑙𝑙̅ , 𝑐𝑐𝑐 ← 𝑙𝑙−2, 𝑙𝑙−2 ← 𝑙𝑙−3, and 𝑙𝑙−3← 𝑐𝑐𝑐.
If VAL 𝑙𝑙0 ≥ 0 and VAL 𝑙𝑙0 + 𝑙𝑙0 is even (that is, if 𝑙𝑙0 is true), perform the steps
if 𝑞𝑞 ≠ 0, set MEM 𝑞𝑞 − 3 ← 𝑐𝑐, else set 𝑊𝑊𝑙𝑙̅ ← 𝑐𝑐 ; then set 𝑞𝑞 ← 𝑐𝑐. *
Otherwise set 𝑗𝑗 ← 2; while 𝑗𝑗 < 𝑙𝑙−1 and VAL 𝑙𝑙𝑗𝑗 ≥ 0 and VAL 𝑙𝑙𝑗𝑗 + 𝑙𝑙𝑗𝑗 is odd, set 𝑗𝑗 = 𝐽𝐽 + 1.
If now 𝑗𝑗 < 𝑗𝑗−1, set 𝑙𝑙1 ← 𝑙𝑙𝑗𝑗, 𝑙𝑙𝑗𝑗 ← 𝑙𝑙̅, 𝑙𝑙−3 ← 𝑊𝑊𝑙𝑙1
, 𝑊𝑊𝑙𝑙1
← 𝑐𝑐.
But if 𝑗𝑗 = 𝑙𝑙−1, do(*) above; jump to C7 if VAL 𝑙𝑙0 ≥ 0 ;
otherwise set 𝐿𝐿𝐹𝐹 ← 𝑙𝑙0, etc. (see step C4) and 𝑐𝑐 ← 𝑐𝑐𝑐.
Finally, when 𝑐𝑐 = 0,
do(*) above to terminate 𝑙𝑙̅’s new watch list.
Algorithm C p.68
(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶).
0 0 0 0 1 0 -1 -1 -1 0
MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
c1.
[Initialize]
c2.
[Level
complete?]
c3.
[Advance 𝐺𝐺.]
c4.
[Does 𝑐𝑐 forceaunit?]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all
literals
forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1
if 𝐺𝐺 = 𝐹𝐹
𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1
for all c in the watch list of 𝑙𝑙̅
𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.)
⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔
if 𝑙𝑙0 is true ⇔ otherwise
𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋
with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false
found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false
𝑙𝑙0 false ⇔ 𝑙𝑙0 free
𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗
𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈
𝐿𝐿𝐹𝐹 ← 𝑙𝑙0
TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0
← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
c7.
[Resolveaconflict.]
c5.
[New level?]
Reason
Algorithm C p.68
(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶).
0 0 0 0 1 0 -1 -1 -1 0
MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
c1.
[Initialize]
c2.
[Level
complete?]
c3.
[Advance 𝐺𝐺.]
c4.
[Does 𝑐𝑐 forceaunit?]
c5.
[New level?]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all
literals
forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1
if 𝐺𝐺 = 𝐹𝐹
𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1
for all c in the watch list of 𝑙𝑙̅
𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.)
⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔
if 𝑙𝑙0 is true ⇔ otherwise
𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋
with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false
found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false
𝑙𝑙0 false ⇔ 𝑙𝑙0 free
𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗
𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈
𝐿𝐿𝐹𝐹 ← 𝑙𝑙0
TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0
← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1
if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f
terminate
succesfully
prepare to
purge excess
clauses
flush literals
as expected
⇔ otherwise
𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹.
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
c7.
[Resolveaconflict.]
Algorithm C p.68
(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶).
0 0 0 0 1 0 -1 -1 -1 0
MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
c1.
[Initialize]
c2.
[Level
complete?]
c3.
[Advance 𝐺𝐺.]
c4.
[Does 𝑐𝑐 forceaunit?]
c5.
[New level?]
c6.
[Makeadecision.]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all
literals
forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1
if 𝐺𝐺 = 𝐹𝐹
𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1
for all c in the watch list of 𝑙𝑙̅
𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.)
⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔
if 𝑙𝑙0 is true ⇔ otherwise
𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋
with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false
found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false
𝑙𝑙0 false ⇔ 𝑙𝑙0 free
𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗
𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈
𝐿𝐿𝐹𝐹 ← 𝑙𝑙0
TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0
← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1
if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f
terminate
succesfully
prepare to
purge excess
clauses
flush literals
as expected
⇔ otherwise
𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹.
𝑘𝑘 ← HEAP 0
deletek from the heap
if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠
𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1
𝐿𝐿𝐹𝐹 ← 𝑙𝑙
TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
c7.
[Resolveaconflict.]
Exercise 262 : What low-level operations underlie changes to the heap in steps C6-C8?
Otherwise set 𝑖𝑖 ← HEAP ℎ ,
𝛼𝛼 ←ACT 𝑖𝑖 , 𝑗𝑗 ← 0, 𝑗𝑗𝑗 ← 1, and do the following while 𝑗𝑗𝑗 < ℎ:
Set 𝛼𝛼′ ← ACT HEAP 𝑗𝑗𝑗 ;
if 𝑗𝑗𝑗 + 1 < ℎ and ACT HEAP 𝑗𝑗′
+ 1 > α′
,
set 𝑗𝑗′
← 𝑗𝑗𝑗 + 1 and 𝛼𝛼′ ← ACT HEAP 𝑗𝑗𝑗 ;
if 𝛼𝛼 > 𝛼𝛼′, set 𝑗𝑗𝑗 ← ℎ, otherwise set HEAP[ 𝑗𝑗 ] ← HEAP[𝑗𝑗𝑗],
HLOC HEAP[ 𝑗𝑗𝑗 ] ← 𝑗𝑗 , 𝑗𝑗 ← 𝑗𝑗𝑗, and 𝑗𝑗𝑗 ← 2𝑗𝑗 + 1.
Then set HEAP[ 𝑗𝑗] ← 𝑖𝑖 and HLOC(𝑖𝑖 ) ← 𝑗𝑗.
To delete 𝑘𝑘 = HEAP 0 in C6:
Set ℎ ← ℎ − 1 and HLOC 𝑘𝑘 ← −1.
Stop if ℎ = 0.
Algorithm C p.68
(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶).
0 0 0 0 1 0 -1 -1 -1 0
MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
c1.
[Initialize]
c2.
[Level
complete?]
c3.
[Advance 𝐺𝐺.]
c4.
[Does 𝑐𝑐 forceaunit?]
c5.
[New level?]
c6.
[Makeadecision.]
c7.
[Resolveaconflict.]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all
literals
forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1
if 𝐺𝐺 = 𝐹𝐹
𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1
for all c in the watch list of 𝑙𝑙̅
𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.)
⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔
if 𝑙𝑙0 is true ⇔ otherwise
𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋
with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false
found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false
𝑙𝑙0 false ⇔ 𝑙𝑙0 free
𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗
𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈
𝐿𝐿𝐹𝐹 ← 𝑙𝑙0
TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0
← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1
if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f
terminate
succesfully
prepare to
purge excess
clauses
flush literals
as expected
⇔ otherwise
𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹.
𝑘𝑘 ← HEAP 0
deletek from the heap
if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠
𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1
𝐿𝐿𝐹𝐹 ← 𝑙𝑙
TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1
if 𝑤𝑤 = 0 ⇔ otherwise
terminate
unsuccesfully
use the conflictclause 𝑐𝑐
to construct
𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ …∨ 𝑏𝑏�𝑟𝑟
ACT( 𝑙𝑙 ) ← ACT( 𝑙𝑙 ) +DEL
for all literals 𝑙𝑙 stampedset d' to the max. level
occupied by 𝑏𝑏1,… , 𝑏𝑏𝑟𝑟
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
(Increasing ACT 𝑙𝑙 may change HEAP.)
In C7, set 𝑘𝑘 ← 𝑙𝑙 , 𝛼𝛼 ← ACT(𝑘𝑘), ACT( 𝑘𝑘) ← α +DEL,
𝑗𝑗 ← HLOC(𝑘𝑘), and if 𝑗𝑗 > 0 perform the "siftup" operation:
"Looping repeatedly,
set 𝑗𝑗𝑗 ← (𝑗𝑗 − 1) ≫ 1 and 𝑖𝑖 ←HEAP[𝑗𝑗𝑗],
exit if ACT(𝑖𝑖) ≥ α, else set HEAP 𝑗𝑗 ← 𝑖𝑖, HLOC(𝑖𝑖) ← 𝑗𝑗 , 𝑗𝑗 ← 𝑗𝑗𝑗, and exit if 𝑗𝑗 = 0.
Then set HEAP[ 𝑗𝑗] ← 𝑘𝑘 and HLOC(𝑘𝑘) ← 𝑗𝑗."
Exercise 262 : What low-level operations underlie changes to the heap in steps C6-C8?
Algorithm C p.68
(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶).
0 0 0 0 1 0 -1 -1 -1 0
-1
MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
c1.
[Initialize]
c2.
[Level
complete?]
c3.
[Advance 𝐺𝐺.]
c4.
[Does 𝑐𝑐 forceaunit?]
c5.
[New level?]
c6.
[Makeadecision.]
c7.
[Resolveaconflict.]
c8.
[Backjump.]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all
literals
forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1
if 𝐺𝐺 = 𝐹𝐹
𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1
for all c in the watch list of 𝑙𝑙̅
𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.)
⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔
if 𝑙𝑙0 is true ⇔ otherwise
𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋
with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false
found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false
𝑙𝑙0 false ⇔ 𝑙𝑙0 free
𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗
𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈
𝐿𝐿𝐹𝐹 ← 𝑙𝑙0
TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0
← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1
if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f
terminate
succesfully
prepare to
purge excess
clauses
flush literals
as expected
⇔ otherwise
𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹.
𝑘𝑘 ← HEAP 0
deletek from the heap
if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠
𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1
𝐿𝐿𝐹𝐹 ← 𝑙𝑙
TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1
if 𝑤𝑤 = 0 ⇔ otherwise
terminate
unsuccesfully
use the conflictclause 𝑐𝑐
to construct
𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ …∨ 𝑏𝑏�𝑟𝑟
ACT( 𝑙𝑙 ) ← ACT( 𝑙𝑙 ) +DEL
for all literals 𝑙𝑙 stampedset d' to the max. level
occupied by 𝑏𝑏1,… , 𝑏𝑏𝑟𝑟 while 𝐹𝐹 > 𝑐𝑐𝑑𝑑′+1
𝐹𝐹 ← 𝐹𝐹 − 1
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
(Increasing ACT 𝑙𝑙 may change HEAP.)
𝑙𝑙 ← 𝐿𝐿𝐹𝐹𝑘𝑘 ← 𝑙𝑙 OVAL(𝑘𝑘) ← VAL 𝑘𝑘𝑅𝑅𝑙𝑙 ← Λ if HLOC 𝑙𝑙 < 0 insert 𝑘𝑘 into HEAP.
𝐺𝐺 ← 𝐹𝐹𝑤𝑤 ← 𝑤𝑤𝑙
Exercise 262 : What low-level operations underlie changes to the heap in steps C6-C8?
To insert 𝑘𝑘 in C8, set 𝛼𝛼 ← ACT(𝑘𝑘), 𝑗𝑗 ← ℎ, ℎ ← ℎ + 1;
if 𝑗𝑗 = 0 set HEAP 0 ← 𝑘𝑘 and HLOC(𝑘𝑘) ← 0;
otherwise perform the siftup operation.
Algorithm C p.68
(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶).
0 0 0 0 1 0 -1 -1 -1 0
MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
c1.
[Initialize]
c2.
[Level
complete?]
c3.
[Advance 𝐺𝐺.]
c4.
[Does 𝑐𝑐 forceaunit?]
c5.
[New level?]
c6.
[Makeadecision.]
c7.
[Resolveaconflict.]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all
literals
forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1
if 𝐺𝐺 = 𝐹𝐹
𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1
for all c in the watch list of 𝑙𝑙̅
𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.)
⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔
if 𝑙𝑙0 is true ⇔ otherwise
𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋
with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false
found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false
𝑙𝑙0 false ⇔ 𝑙𝑙0 free
𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗
𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈
𝐿𝐿𝐹𝐹 ← 𝑙𝑙0
TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0
← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1
if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f
terminate
succesfully
prepare to
purge excess
clauses
flush literals
as expected
⇔ otherwise
𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹.
𝑘𝑘 ← HEAP 0
deletek from the heap
if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠
𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1
𝐿𝐿𝐹𝐹 ← 𝑙𝑙
TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1
if 𝑤𝑤 = 0 ⇔ otherwise
terminate
unsuccesfully
use the conflictclause 𝑐𝑐
to construct
𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ …∨ 𝑏𝑏�𝑟𝑟
ACT( 𝑙𝑙 ) ← ACT( 𝑙𝑙 ) +DEL
for all literals 𝑙𝑙 stampedset d' to the max. level
occupied by 𝑏𝑏1,… , 𝑏𝑏𝑟𝑟
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
(Increasing ACT 𝑙𝑙 may change HEAP.)
Exercise 263: Write out the gory details by which step C7 constructs a new clause and
step C9 puts it into the data structures of Algorithm C.
(This answer also sets the level stamps LS [𝑑𝑑] needed in answer 257, assuming that the LS array is initially zero.)
Let “ bump 𝑙𝑙 " mean “ increase ACT 𝑙𝑙 by DEL" as in answer 262.
Also let 𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏(𝑙𝑙) be the following subroutine:
"If S 𝑙𝑙 = 𝑠𝑠 , do nothing.
Otherwise set S 𝑙𝑙 ← 𝑠𝑠, 𝑝𝑝 ← 𝑙𝑙𝑙𝑙𝑙𝑙 (𝑙𝑙).
If 𝑝𝑝 > 0, bump 𝑙𝑙 ; then if 𝑝𝑝 = 𝑑𝑑, set 𝑞𝑞 ← 𝑞𝑞 + 1; else set 𝑟𝑟 ← 𝑟𝑟 + 1,
𝑏𝑏𝑟𝑟 ← 𝑙𝑙̅, 𝑑𝑑𝑑 ← max(𝑑𝑑𝑑, 𝑝𝑝), and if LS[𝑝𝑝] ≤ 𝑠𝑠 set LS 𝑝𝑝 ← 𝑠𝑠 + LS[𝑝𝑝] = 𝑠𝑠 ."
Algorithm C p.68
(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶).
0 0 0 0 1 0 -1 -1 -1 0
MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
c1.
[Initialize]
c2.
[Level
complete?]
c3.
[Advance 𝐺𝐺.]
c4.
[Does 𝑐𝑐 forceaunit?]
c5.
[New level?]
c6.
[Makeadecision.]
c7.
[Resolveaconflict.]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all
literals
forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1
if 𝐺𝐺 = 𝐹𝐹
𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1
for all c in the watch list of 𝑙𝑙̅
𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.)
⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔
if 𝑙𝑙0 is true ⇔ otherwise
𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋
with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false
found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false
𝑙𝑙0 false ⇔ 𝑙𝑙0 free
𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗
𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈
𝐿𝐿𝐹𝐹 ← 𝑙𝑙0
TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0
← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1
if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f
terminate
succesfully
prepare to
purge excess
clauses
flush literals
as expected
⇔ otherwise
𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹.
𝑘𝑘 ← HEAP 0
deletek from the heap
if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠
𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1
𝐿𝐿𝐹𝐹 ← 𝑙𝑙
TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1
if 𝑤𝑤 = 0 ⇔ otherwise
terminate
unsuccesfully
use the conflictclause 𝑐𝑐
to construct
𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ …∨ 𝑏𝑏�𝑟𝑟
ACT( 𝑙𝑙 ) ← ACT( 𝑙𝑙 ) +DEL
for all literals 𝑙𝑙 stampedset d' to the max. level
occupied by 𝑏𝑏1,… , 𝑏𝑏𝑟𝑟
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
(Increasing ACT 𝑙𝑙 may change HEAP.)
Exercise 263: Write out the gory details by which step C7 constructs a new clause and
step C9 puts it into the data structures of Algorithm C.
When step C7 is entered from C4, assuming that 𝑑𝑑 > 0, set 𝑑𝑑𝑑 ← 𝑞𝑞 ← 𝑟𝑟 ← 0,
𝑠𝑠 ← 𝑠𝑠 + 3, S( 𝑙𝑙0 ) ← 𝑠𝑠, bump 𝑙𝑙0, and do 𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏(𝑙𝑙𝑗𝑗) for 1 ≤ 𝑗𝑗 < 𝑘𝑘.
Also set 𝑡𝑡 ← max( TLOC 𝑙𝑙1 ,…,TLOC 𝑙𝑙𝑘𝑘−1 ).
Then, while 𝑞𝑞 > 0, set 𝑙𝑙 ← 𝑙𝑙𝑡𝑡, 𝑡𝑡 ← 𝑡𝑡 − 1;
if S 𝑙𝑙 = 𝑠𝑠 then set 𝑞𝑞 ← 𝑞𝑞 − 1, and if 𝑅𝑅𝑙𝑙 ≠ Λ let clause 𝑅𝑅𝑙𝑙 be 𝑙𝑙0 𝑙𝑙1 … 𝑙𝑙𝑘𝑘−1 and do 𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏(𝑙𝑙𝑗𝑗) for 1 ≤ 𝑗𝑗 < 𝑘𝑘.
Finally set 𝑙𝑙′
← 𝐿𝐿𝑡𝑡 , and while S 𝑙𝑙𝑙 ≠ 𝑠𝑠 set 𝑡𝑡 ← 𝑡𝑡 − 1 and 𝑙𝑙′
← 𝐿𝐿𝑡𝑡.
Algorithm C p.68
(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶).
0 0 0 0 1 0 -1 -1 -1 0
-1
MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
c1.
[Initialize]
c2.
[Level
complete?]
c3.
[Advance 𝐺𝐺.]
c4.
[Does 𝑐𝑐 forceaunit?]
c5.
[New level?]
c6.
[Makeadecision.]
c7.
[Resolveaconflict.]
c8.
[Backjump.]
c9.
[Learn.]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all
literals
forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1
if 𝐺𝐺 = 𝐹𝐹
𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1
for all c in the watch list of 𝑙𝑙̅
𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.)
⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔
if 𝑙𝑙0 is true ⇔ otherwise
𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋
with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false
found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false
𝑙𝑙0 false ⇔ 𝑙𝑙0 free
𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗
𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈
𝐿𝐿𝐹𝐹 ← 𝑙𝑙0
TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0
← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1
if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f
terminate
succesfully
prepare to
purge excess
clauses
flush literals
as expected
⇔ otherwise
𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹.
𝑘𝑘 ← HEAP 0
deletek from the heap
if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠
𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1
𝐿𝐿𝐹𝐹 ← 𝑙𝑙
TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1
if 𝑤𝑤 = 0 ⇔ otherwise
terminate
unsuccesfully
use the conflictclause 𝑐𝑐
to construct
𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ …∨ 𝑏𝑏�𝑟𝑟
ACT( 𝑙𝑙 ) ← ACT( 𝑙𝑙 ) +DEL
for all literals 𝑙𝑙 stampedset d' to the max. level
occupied by 𝑏𝑏1,… , 𝑏𝑏𝑟𝑟 while 𝐹𝐹 > 𝑐𝑐𝑑𝑑′+1
𝐹𝐹 ← 𝐹𝐹 − 1
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
(Increasing ACT 𝑙𝑙 may change HEAP.)
𝑙𝑙 ← 𝐿𝐿𝐹𝐹𝑘𝑘 ← 𝑙𝑙 OVAL(𝑘𝑘) ← VAL 𝑘𝑘𝑅𝑅𝑙𝑙 ← Λ if HLOC 𝑙𝑙 < 0 insert 𝑘𝑘 into HEAP.
𝐺𝐺 ← 𝐹𝐹𝑤𝑤 ← 𝑤𝑤𝑙
set 𝑐𝑐 ←MAXL
If 𝑤𝑤 > 0
store the new clause in MEM at position 𝑐𝑐
advance MAXL to the next available position in MEM
𝑀𝑀 ← 𝑀𝑀 + 1𝐿𝐿𝐹𝐹 ← 𝑙𝑙𝑙 TLOC( 𝑙𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙′ ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 DEL←DEL/𝜌𝜌
Exercise 263: Write out the gory details by which step C7 constructs a new clause and
step C9 puts it into the data structures of Algorithm C.
The new clause can now be checked for redundancies as in answer 257.
To install it during step C9, there's a subtle point:
We must watch a literal that was defined on level 𝑑𝑑𝑑.
Thus we set 𝑐𝑐 ← MAXL, MEM[𝑐𝑐] ← 𝑙𝑙̅ ′ , 𝑘𝑘 ← 0, 𝑗𝑗 ′ ← 1;
and for 1 ≤ 𝑗𝑗 ≤ 𝑟𝑟 if S 𝑏𝑏𝑗𝑗 = 𝑠𝑠 set 𝑘𝑘 ← 𝑘𝑘 + 1 and do this:
If 𝑗𝑗𝑗 = 0 or 𝑙𝑙𝑙𝑙𝑙𝑙( 𝑏𝑏𝑗𝑗 ) < 𝑑𝑑𝑑, Set MEM[𝑐𝑐 + 𝑘𝑘 + 𝑗𝑗′] ← 𝑏𝑏�𝑗𝑗,
otherwise set MEM[𝑐𝑐 + 1] ← 𝑏𝑏�𝑗𝑗, 𝑗𝑗′ ← 0, MEM 𝑐𝑐 − 2 ← 𝑊𝑊𝑙𝑙 𝑙�, 𝑊𝑊𝑙𝑙 𝑙� ← 𝑐𝑐, MEM[𝑐𝑐 − 3] ← 𝑊𝑊𝑏𝑏�𝑗𝑗
, 𝑊𝑊𝑏𝑏�𝑗𝑗
← 𝑐𝑐.
Finally set MEM[𝑐𝑐 − 1] ← 𝑘𝑘 + 1, MAXL← 𝑐𝑐 + 𝑘𝑘 + 6.
Algorithm C p.68
(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶).
0 0 0 0 1 0 -1 -1 -1 0
MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ]
c1.
[Initialize]
c2.
[Level
complete?]
c3.
[Advance 𝐺𝐺.]
c4.
[Does 𝑐𝑐 forceaunit?]
c5.
[New level?]
c6.
[Makeadecision.]
𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠
𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ
𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛
MINL and MAXL
to 1st available position
𝑐𝑐0 ← 0
DEL 𝑐
𝑛𝑛
𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all
literals
forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1
if 𝐺𝐺 = 𝐹𝐹
𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1
for all c in the watch list of 𝑙𝑙̅
𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.)
⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔
if 𝑙𝑙0 is true ⇔ otherwise
𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋
with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false
found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false
𝑙𝑙0 false ⇔ 𝑙𝑙0 free
𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗
𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈
𝐿𝐿𝐹𝐹 ← 𝑙𝑙0
TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0
← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1
if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f
terminate
succesfully
prepare to
purge excess
clauses
flush literals
as expected
⇔ otherwise
𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹.
𝑘𝑘 ← HEAP 0
deletek from the heap
if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠
𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1
𝐿𝐿𝐹𝐹 ← 𝑙𝑙
TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1
𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1
But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲
if clause 𝑙𝑙 and 𝑙𝑙𝑙
contradiction
𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM
and the watch list
𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛
c7.
[Resolveaconflict.]
Exercise 266 : CDCL solvers are often designed to make decisions at random,
with a small probability 𝑝𝑝 (say 𝑝𝑝 = .02),
instead of always choosing a variable of maximum activity.
How would this policy change step C6?
If 𝑈𝑈 < 𝑝𝑝, where 𝑈𝑈 is a uniform deviate between 0 and 1, do this:
Set 𝑗𝑗 to a random integer with 0 ≤ 𝑗𝑗 < ℎ, and 𝑘𝑘 ←HEAP[𝑗𝑗].
If 𝑗𝑗 = 0, or if VAL(𝑘𝑘) ≥ 0, use the normal C6.
Otherwise branch on 𝑘𝑘 (and don't bother to remove 𝑘𝑘 from the heap).
Reality check
Random choices make the running time of this algorithm more variable
than it was in Algorithms A, B, D, or L; sometimes we're lucky, sometimes we're not.
The running time of Algorithms A, B, D, and L on 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓(𝑞𝑞) is proportional to 2𝑞𝑞
,
so it's way off the chart well over a gigamem already when 𝑞𝑞 = 19.
But Algorithm C polishes off the case 𝑞𝑞 = 99 in that same amount of time
(thus winning by 24 orders of magnitude)!
On the other hand,
no satisfactory theoretical explanation for the apparently linear behavior in Fig. is presently known.
Computation times (in megamems)
are shown for nine trials at each value of 𝑞𝑞.
Algorithm C often speeds things up much more dramatically, in fact.
For example, how it whips through a sequence of three-coloring problems based on "flower snarks."
It is not possible to color the edges of the flower snark graph 𝐽𝐽𝑞𝑞 with three colors, when 𝑞𝑞 is odd.
p.69
The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76
The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76
The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76
The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76
The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76
The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76
The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76
The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76
The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76
The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76
The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76
The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76

More Related Content

Viewers also liked

Viewers also liked (7)

Presentation
PresentationPresentation
Presentation
 
B8e06576
B8e06576B8e06576
B8e06576
 
Doc ley850 web - parte 2
Doc ley850 web - parte 2 Doc ley850 web - parte 2
Doc ley850 web - parte 2
 
Fullday
FulldayFullday
Fullday
 
Folder Rubbens transfer fryer EN
Folder Rubbens transfer fryer ENFolder Rubbens transfer fryer EN
Folder Rubbens transfer fryer EN
 
Why does a GP tweet?
Why does a GP tweet? Why does a GP tweet?
Why does a GP tweet?
 
Puolueet ryhmätyö kevät 2016
Puolueet ryhmätyö kevät 2016Puolueet ryhmätyö kevät 2016
Puolueet ryhmätyö kevät 2016
 

Similar to The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76

Valeri Labunets - Fast multiparametric wavelet transforms and packets for ima...
Valeri Labunets - Fast multiparametric wavelet transforms and packets for ima...Valeri Labunets - Fast multiparametric wavelet transforms and packets for ima...
Valeri Labunets - Fast multiparametric wavelet transforms and packets for ima...AIST
 
Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...
Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...
Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...inventionjournals
 
Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...
Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...
Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...inventionjournals
 
ゲーム理論 BASIC 演習71 -3人ゲーム分析:コア-
ゲーム理論 BASIC 演習71 -3人ゲーム分析:コア-ゲーム理論 BASIC 演習71 -3人ゲーム分析:コア-
ゲーム理論 BASIC 演習71 -3人ゲーム分析:コア-ssusere0a682
 
Differential Geometry for Machine Learning
Differential Geometry for Machine LearningDifferential Geometry for Machine Learning
Differential Geometry for Machine LearningSEMINARGROOT
 
Intro to Quant Trading Strategies (Lecture 2 of 10)
Intro to Quant Trading Strategies (Lecture 2 of 10)Intro to Quant Trading Strategies (Lecture 2 of 10)
Intro to Quant Trading Strategies (Lecture 2 of 10)Adrian Aley
 
ゲーム理論BASIC 演習36 -4人ゲームのシャープレイ値を求める-
ゲーム理論BASIC 演習36 -4人ゲームのシャープレイ値を求める-ゲーム理論BASIC 演習36 -4人ゲームのシャープレイ値を求める-
ゲーム理論BASIC 演習36 -4人ゲームのシャープレイ値を求める-ssusere0a682
 
Ai2418281871
Ai2418281871Ai2418281871
Ai2418281871IJMER
 
Lecture Notes: EEEC4340318 Instrumentation and Control Systems - Stability a...
Lecture Notes:  EEEC4340318 Instrumentation and Control Systems - Stability a...Lecture Notes:  EEEC4340318 Instrumentation and Control Systems - Stability a...
Lecture Notes: EEEC4340318 Instrumentation and Control Systems - Stability a...AIMST University
 
Rational function 11
Rational function 11Rational function 11
Rational function 11AjayQuines
 
ゲーム理論 BASIC 演習88 -投票ゲームにおけるシャープレイ•シュービック指数-
ゲーム理論 BASIC 演習88 -投票ゲームにおけるシャープレイ•シュービック指数-ゲーム理論 BASIC 演習88 -投票ゲームにおけるシャープレイ•シュービック指数-
ゲーム理論 BASIC 演習88 -投票ゲームにおけるシャープレイ•シュービック指数-ssusere0a682
 
SUEC 高中 Adv Maths (Quadratic Equation in One Variable)
SUEC 高中 Adv Maths (Quadratic Equation in One Variable)SUEC 高中 Adv Maths (Quadratic Equation in One Variable)
SUEC 高中 Adv Maths (Quadratic Equation in One Variable)tungwc
 
Probability Proficiency.pptx
Probability Proficiency.pptxProbability Proficiency.pptx
Probability Proficiency.pptxHarshGupta137011
 
ゲーム理論BASIC 演習3 -安定集合を求める-
ゲーム理論BASIC 演習3 -安定集合を求める-ゲーム理論BASIC 演習3 -安定集合を求める-
ゲーム理論BASIC 演習3 -安定集合を求める-ssusere0a682
 
Calculo Thomas (Solutions).pdf
Calculo Thomas  (Solutions).pdfCalculo Thomas  (Solutions).pdf
Calculo Thomas (Solutions).pdfadriano65054
 
Conjuntos e intervalos-1.pptx
Conjuntos e intervalos-1.pptxConjuntos e intervalos-1.pptx
Conjuntos e intervalos-1.pptxYehileenMoreira
 

Similar to The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76 (20)

Valeri Labunets - Fast multiparametric wavelet transforms and packets for ima...
Valeri Labunets - Fast multiparametric wavelet transforms and packets for ima...Valeri Labunets - Fast multiparametric wavelet transforms and packets for ima...
Valeri Labunets - Fast multiparametric wavelet transforms and packets for ima...
 
Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...
Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...
Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...
 
Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...
Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...
Solving Poisson’s Equation Using Preconditioned Nine-Point Group SOR Iterativ...
 
ゲーム理論 BASIC 演習71 -3人ゲーム分析:コア-
ゲーム理論 BASIC 演習71 -3人ゲーム分析:コア-ゲーム理論 BASIC 演習71 -3人ゲーム分析:コア-
ゲーム理論 BASIC 演習71 -3人ゲーム分析:コア-
 
Differential Geometry for Machine Learning
Differential Geometry for Machine LearningDifferential Geometry for Machine Learning
Differential Geometry for Machine Learning
 
Intro to Quant Trading Strategies (Lecture 2 of 10)
Intro to Quant Trading Strategies (Lecture 2 of 10)Intro to Quant Trading Strategies (Lecture 2 of 10)
Intro to Quant Trading Strategies (Lecture 2 of 10)
 
ゲーム理論BASIC 演習36 -4人ゲームのシャープレイ値を求める-
ゲーム理論BASIC 演習36 -4人ゲームのシャープレイ値を求める-ゲーム理論BASIC 演習36 -4人ゲームのシャープレイ値を求める-
ゲーム理論BASIC 演習36 -4人ゲームのシャープレイ値を求める-
 
Ai2418281871
Ai2418281871Ai2418281871
Ai2418281871
 
Stochastic Optimization
Stochastic OptimizationStochastic Optimization
Stochastic Optimization
 
Lecture Notes: EEEC4340318 Instrumentation and Control Systems - Stability a...
Lecture Notes:  EEEC4340318 Instrumentation and Control Systems - Stability a...Lecture Notes:  EEEC4340318 Instrumentation and Control Systems - Stability a...
Lecture Notes: EEEC4340318 Instrumentation and Control Systems - Stability a...
 
Rational function 11
Rational function 11Rational function 11
Rational function 11
 
ゲーム理論 BASIC 演習88 -投票ゲームにおけるシャープレイ•シュービック指数-
ゲーム理論 BASIC 演習88 -投票ゲームにおけるシャープレイ•シュービック指数-ゲーム理論 BASIC 演習88 -投票ゲームにおけるシャープレイ•シュービック指数-
ゲーム理論 BASIC 演習88 -投票ゲームにおけるシャープレイ•シュービック指数-
 
SUEC 高中 Adv Maths (Quadratic Equation in One Variable)
SUEC 高中 Adv Maths (Quadratic Equation in One Variable)SUEC 高中 Adv Maths (Quadratic Equation in One Variable)
SUEC 高中 Adv Maths (Quadratic Equation in One Variable)
 
Lf 2020 trees
Lf 2020 treesLf 2020 trees
Lf 2020 trees
 
Probability Proficiency.pptx
Probability Proficiency.pptxProbability Proficiency.pptx
Probability Proficiency.pptx
 
Periodic Solutions for Nonlinear Systems of Integro-Differential Equations of...
Periodic Solutions for Nonlinear Systems of Integro-Differential Equations of...Periodic Solutions for Nonlinear Systems of Integro-Differential Equations of...
Periodic Solutions for Nonlinear Systems of Integro-Differential Equations of...
 
ゲーム理論BASIC 演習3 -安定集合を求める-
ゲーム理論BASIC 演習3 -安定集合を求める-ゲーム理論BASIC 演習3 -安定集合を求める-
ゲーム理論BASIC 演習3 -安定集合を求める-
 
Calculo Thomas (Solutions).pdf
Calculo Thomas  (Solutions).pdfCalculo Thomas  (Solutions).pdf
Calculo Thomas (Solutions).pdf
 
Conjuntos e intervalos-1.pptx
Conjuntos e intervalos-1.pptxConjuntos e intervalos-1.pptx
Conjuntos e intervalos-1.pptx
 
Periodic Solutions for Non-Linear Systems of Integral Equations
Periodic Solutions for Non-Linear Systems of Integral EquationsPeriodic Solutions for Non-Linear Systems of Integral Equations
Periodic Solutions for Non-Linear Systems of Integral Equations
 

Recently uploaded

VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PPRINCE C P
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )aarthirajkumar25
 
Artificial Intelligence In Microbiology by Dr. Prince C P
Artificial Intelligence In Microbiology by Dr. Prince C PArtificial Intelligence In Microbiology by Dr. Prince C P
Artificial Intelligence In Microbiology by Dr. Prince C PPRINCE C P
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhousejana861314
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...RohitNehra6
 
G9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.pptG9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.pptMAESTRELLAMesa2
 
zoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistanzoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistanzohaibmir069
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)PraveenaKalaiselvan1
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptxanandsmhk
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRDelhi Call girls
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |aasikanpl
 
Disentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTDisentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTSérgio Sacani
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoSérgio Sacani
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCEPRINCE C P
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfmuntazimhurra
 
GFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxGFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxAleenaTreesaSaji
 
Behavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdfBehavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdfSELF-EXPLANATORY
 
Boyles law module in the grade 10 science
Boyles law module in the grade 10 scienceBoyles law module in the grade 10 science
Boyles law module in the grade 10 sciencefloriejanemacaya1
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...Sérgio Sacani
 

Recently uploaded (20)

VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C P
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )
 
Artificial Intelligence In Microbiology by Dr. Prince C P
Artificial Intelligence In Microbiology by Dr. Prince C PArtificial Intelligence In Microbiology by Dr. Prince C P
Artificial Intelligence In Microbiology by Dr. Prince C P
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhouse
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
 
G9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.pptG9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.ppt
 
zoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistanzoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistan
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
 
Disentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTDisentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOST
 
The Philosophy of Science
The Philosophy of ScienceThe Philosophy of Science
The Philosophy of Science
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on Io
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdf
 
GFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxGFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptx
 
Behavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdfBehavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdf
 
Boyles law module in the grade 10 science
Boyles law module in the grade 10 scienceBoyles law module in the grade 10 science
Boyles law module in the grade 10 science
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
 

The Art of Computer Programming volume 4 fascicle 6 7.7.7.2 p.47-76

  • 1. The Art of Computer Programming 7.2.2.2 Satisfiability p.47-76 VOLUME 4 FASCICLE 6
  • 2. Random satisfiability. Deviations from randomness in combinatorial algorithms often have a dramatic effect, while methods of sorting and searching generally stay reasonably close to their expected behavior. How many random clauses of 3SAT on 𝑛𝑛 variables before they can't all be satisfied? p.47
  • 3. 1 2 3 4 5 6 7 8 9 𝑥𝑥1, 𝑥𝑥2, 𝑥𝑥3, 𝑥𝑥4, 𝑥𝑥5 ¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ ¬𝑥𝑥3 ∧ 𝑥𝑥1 ∨ ¬𝑥𝑥4 ∨ ¬𝑥𝑥5 ∧ 𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5 random 𝑘𝑘-SAT {{9, 4, 3}, {5, 9, 3}, {8, 4, 3}, {6, 8, 3}, {1, 6, 8}, {1, 6, 7}, {1, 5, 9}, {1, 5, 7}, {9, 2, 4}, {5, 9, 2}, {8, 2, 4}, {6, 8, 2}, {7, 2, 4}, {6, 7, 2}, {5, 7, 2}} satisfiable cell allocations {{1, 1, 0, 1, 1}, {1, 1, 0, 1, 0}, {1, 1, 0, 0, 1}, {1, 0, 1, 1, 1}, {1, 0, 1, 1, 0}, {1, 0, 1, 0, 1}, {1, 0, 1, 0, 0}, {1, 0, 0, 1, 1}, {1, 0, 0, 1, 0}, {1, 0, 0, 0, 1}, {0, 1, 1, 1, 0}, {0, 1, 1, 0, 1}, {0, 1, 1, 0, 0}, {0, 1, 0, 1, 0}, {0, 1, 0, 0, 1}, {0, 0, 1, 1, 0}, {0, 0, 1, 0, 1}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}} satisfiable boolean vectors possible 𝑁𝑁clauses 2𝑘𝑘 𝑛𝑛 𝑘𝑘 𝑘𝑘 = 3, 𝑚𝑚 = 3, 𝑛𝑛 = 5 23 5 3 = 80 15 20 𝑞𝑞 𝑚𝑚 = 𝑄𝑄𝑚𝑚 𝑁𝑁 𝑚𝑚 −1 p.47
  • 4. 𝑥𝑥1, 𝑥𝑥2, 𝑥𝑥3, 𝑥𝑥4, 𝑥𝑥5 ¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ ¬𝑥𝑥3 ∧ 𝑥𝑥1 ∨ ¬𝑥𝑥4 ∨ ¬𝑥𝑥5 ∧ 𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5 1 2 3 4 5 6 7 8 9 {{9, 4, 3}, {5, 9, 3}, {8, 4, 3}, {6, 8, 3}, {1, 6, 8}, {1, 6, 7}, {1, 5, 9}, {1, 5, 7}, {9, 2, 4}, {5, 9, 2}, {8, 2, 4}, {6, 8, 2}, {7, 2, 4}, {6, 7, 2}, {5, 7, 2}} {{1, 1, 0, 1, 1}, {1, 1, 0, 1, 0}, {1, 1, 0, 0, 1}, {1, 0, 1, 1, 1}, {1, 0, 1, 1, 0}, {1, 0, 1, 0, 1}, {1, 0, 1, 0, 0}, {1, 0, 0, 1, 1}, {1, 0, 0, 1, 0}, {1, 0, 0, 0, 1}, {0, 1, 1, 1, 0}, {0, 1, 1, 0, 1}, {0, 1, 1, 0, 0}, {0, 1, 0, 1, 0}, {0, 1, 0, 0, 1}, {0, 0, 1, 1, 0}, {0, 0, 1, 0, 1}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}} random 𝑘𝑘-SAT satisfiable cell allocations satisfiable boolean vectors possible 𝑁𝑁clauses 2𝑘𝑘 𝑛𝑛 𝑘𝑘 𝑘𝑘 = 3, 𝑚𝑚 = 3, 𝑛𝑛 = 5 23 5 3 = 80 15 20 < 𝑞𝑞 𝑚𝑚 = 𝑄𝑄𝑚𝑚 𝑁𝑁 𝑚𝑚 −1 p.47
  • 5. 𝑥𝑥1, 𝑥𝑥2, 𝑥𝑥3, 𝑥𝑥4, 𝑥𝑥5 {{6, 9, 3}, {6, 8, 3}, {6, 7, 3}, {5, 9, 3}, {5, 8, 3}, {5,7, 3}, {4, 9, 3}, {4, 8, 3}, {4, 7, 3}, {6, 9, 2}, {6, 8, 2}, {6, 7, 2}, {5, 9, 2}, {5, 8, 2}, {5, 7, 2}, {4, 9, 2}, {4, 8, 2}, {4, 7, 2}, {1, 6, 9}, {1, 6, 8}, {1, 6, 7}, {1, 5, 9}, {1, 5, 8}, {1, 5, 7}, {1, 4, 9}, {1, 4, 8}, {1, 4, 7}} {{1, 0, 0, 1, 1}, {0, 1, 1, 1, 1}, {1, 0, 0, 0, 1}, {0, 0, 1, 1, 1}, {1, 0, 0, 1, 0}, {0, 1, 0, 1, 1}, {1, 0, 0, 0, 0}, {0, 0, 0, 1, 1}, {0, 1, 1, 0, 1}, {0, 0, 1, 0, 1}, {0, 1, 0, 0, 1}, {0, 0, 0, 0, 1}, {0, 1, 1, 1, 0}, {0, 0, 1, 1, 0}, {0, 1, 0, 1, 0}, {0, 0, 0, 1, 0}, {0, 1, 1, 0, 0}, {0, 0, 1, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 0, 0, 0}} ¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ ¬𝑥𝑥3 ∧ ¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ 𝑥𝑥3 ∧ ¬𝑥𝑥1 ∨ 𝑥𝑥2 ∨ ¬𝑥𝑥3 1 2 3 4 5 6 7 8 9 random 𝑘𝑘-SAT satisfiable cell allocations satisfiable boolean vectors possible 𝑁𝑁clauses 2𝑘𝑘 𝑛𝑛 𝑘𝑘 𝑘𝑘 = 3, 𝑚𝑚 = 3, 𝑛𝑛 = 5 23 5 3 = 80 27 20 𝑞𝑞 𝑚𝑚 = 𝑄𝑄𝑚𝑚 𝑁𝑁 𝑚𝑚 −1 p.47
  • 6. 𝑞𝑞 𝑚𝑚 = 𝑄𝑄𝑚𝑚 𝑁𝑁 𝑚𝑚 −1 𝑥𝑥1, 𝑥𝑥2, 𝑥𝑥3, 𝑥𝑥4, 𝑥𝑥5 ¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ ¬𝑥𝑥3 ∧ ¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ 𝑥𝑥3 ∧ ¬𝑥𝑥1 ∨ 𝑥𝑥2 ∨ ¬𝑥𝑥3 1 2 3 4 5 6 7 8 9 {{6, 9, 3}, {6, 8, 3}, {6, 7, 3}, {5, 9, 3}, {5, 8, 3}, {5,7, 3}, {4, 9, 3}, {4, 8, 3}, {4, 7, 3}, {6, 9, 2}, {6, 8, 2}, {6, 7, 2}, {5, 9, 2}, {5, 8, 2}, {5, 7, 2}, {4, 9, 2}, {4, 8, 2}, {4, 7, 2}, {1, 6, 9}, {1, 6, 8}, {1, 6, 7}, {1, 5, 9}, {1, 5, 8}, {1, 5, 7}, {1, 4, 9}, {1, 4, 8}, {1, 4, 7}} {{1, 0, 0, 1, 1}, {0, 1, 1, 1, 1}, {1, 0, 0, 0, 1}, {0, 0, 1, 1, 1}, {1, 0, 0, 1, 0}, {0, 1, 0, 1, 1}, {1, 0, 0, 0, 0}, {0, 0, 0, 1, 1}, {0, 1, 1, 0, 1}, {0, 0, 1, 0, 1}, {0, 1, 0, 0, 1}, {0, 0, 0, 0, 1}, {0, 1, 1, 1, 0}, {0, 0, 1, 1, 0}, {0, 1, 0, 1, 0}, {0, 0, 0, 1, 0}, {0, 1, 1, 0, 0}, {0, 0, 1, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 0, 0, 0}} random 𝑘𝑘-SAT satisfiable cell allocations satisfiable boolean vectors possible 𝑁𝑁clauses 2𝑘𝑘 𝑛𝑛 𝑘𝑘 𝑘𝑘 = 3, 𝑚𝑚 = 3, 𝑛𝑛 = 5 23 5 3 = 80 27 20 < p.47
  • 7. 𝑥𝑥1, 𝑥𝑥2, 𝑥𝑥3, 𝑥𝑥4, 𝑥𝑥5 ¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ ¬𝑥𝑥3 ∧ 𝑥𝑥1 ∨ ¬𝑥𝑥4 ∨ ¬𝑥𝑥5 ∧ 𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5 1 2 3 4 5 6 7 8 9 {{9, 4, 3}, {5, 9, 3}, {8, 4, 3}, {6, 8, 3}, {1, 6, 8}, {1, 6, 7}, {1, 5, 9}, {1, 5, 7}, {9, 2, 4}, {5, 9, 2}, {8, 2, 4}, {6, 8, 2}, {7, 2, 4}, {6, 7, 2}, {5, 7, 2}} {{1, 1, 0, 1, 1}, {1, 1, 0, 1, 0}, {1, 1, 0, 0, 1}, {1, 0, 1, 1, 1}, {1, 0, 1, 1, 0}, {1, 0, 1, 0, 1}, {1, 0, 1, 0, 0}, {1, 0, 0, 1, 1}, {1, 0, 0, 1, 0}, {1, 0, 0, 0, 1}, {0, 1, 1, 1, 0}, {0, 1, 1, 0, 1}, {0, 1, 1, 0, 0}, {0, 1, 0, 1, 0}, {0, 1, 0, 0, 1}, {0, 0, 1, 1, 0}, {0, 0, 1, 0, 1}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}} 全単射でない点に注意 random 𝑘𝑘-SAT satisfiable cell allocations satisfiable boolean vectors possible 𝑁𝑁clauses 2𝑘𝑘 𝑛𝑛 𝑘𝑘 𝑞𝑞 𝑚𝑚 = 𝑄𝑄𝑚𝑚 𝑁𝑁 𝑚𝑚 −1 p.47
  • 8. 𝑥𝑥1, 𝑥𝑥2, 𝑥𝑥3, 𝑥𝑥4, 𝑥𝑥5 ¬𝑥𝑥1 ∨ ¬𝑥𝑥2 ∨ ¬𝑥𝑥3 ∧ 𝑥𝑥1 ∨ ¬𝑥𝑥4 ∨ ¬𝑥𝑥5 ∧ 𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5 1 2 3 4 5 6 7 8 9 {{9, 4, 3}, {5, 9, 3}, {8, 4, 3}, {6, 8, 3}, {1, 6, 8}, {1, 6, 7}, {1, 5, 9}, {1, 5, 7}, {9, 2, 4}, {5, 9, 2}, {8, 2, 4}, {6, 8, 2}, {7, 2, 4}, {6, 7, 2}, {5, 7, 2}} {{1, 1, 0, 1, 1}, {1, 1, 0, 1, 0}, {1, 1, 0, 0, 1}, {1, 0, 1, 1, 1}, {1, 0, 1, 1, 0}, {1, 0, 1, 0, 1}, {1, 0, 1, 0, 0}, {1, 0, 0, 1, 1}, {1, 0, 0, 1, 0}, {1, 0, 0, 0, 1}, {0, 1, 1, 1, 0}, {0, 1, 1, 0, 1}, {0, 1, 1, 0, 0}, {0, 1, 0, 1, 0}, {0, 1, 0, 0, 1}, {0, 0, 1, 1, 0}, {0, 0, 1, 0, 1}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}} 𝑄𝑄𝑚𝑚 ∶ the number of ways to choose 𝑚𝑚 of the 𝑁𝑁 clauses so that at least one Boolean vector 𝑥𝑥 = 𝑥𝑥1,…,𝑥𝑥𝑛𝑛 satisfies them all. 𝑁𝑁 𝑚𝑚 = 80 3 𝑞𝑞 𝑚𝑚 = 𝑄𝑄𝑚𝑚 𝑁𝑁 𝑚𝑚 −1 𝑞𝑞𝑚𝑚 = Pr( 𝑚𝑚 clauses, distinct but otherwise selected at random, are satisfiable) 𝑄𝑄3 = � p.47
  • 9. exercise 180 p.148/219 Explain how to use BDDs to compute the numbers 𝑄𝑄𝑚𝑚 that underlie Fig. 40. What is max0≤𝑚𝑚≤80 𝑄𝑄𝑚𝑚? very simple BDD (?) No natural ordering of the clause variables is evident, but the method of sifting is able to reduce the BDD size. 𝑁𝑁 variables 𝑦𝑦𝑖𝑖 ,one of each possible clause 𝐶𝐶𝑗𝑗 𝑓𝑓 𝑦𝑦1, … 𝑦𝑦𝑁𝑁 = ⋀ 𝐶𝐶𝑗𝑗|𝑦𝑦𝑗𝑗 = 1 is satisfiable is ⋁𝑥𝑥 𝑓𝑓𝑥𝑥 𝑦𝑦 , where 𝑓𝑓𝑥𝑥 𝑦𝑦 = 𝑥𝑥 satisfies ⋀ 𝐶𝐶𝑗𝑗|𝑦𝑦𝑗𝑗 = 1 is simply ⋀ 𝑦𝑦�𝑖𝑖| 𝑥𝑥 makes 𝐶𝐶𝑗𝑗 false . if 𝑘𝑘 = 2, 𝑛𝑛 = 3 and if 𝐶𝐶1= 𝑥𝑥1 ∨ 𝑥𝑥2 , 𝐶𝐶7= 𝑥𝑥1 ∨ 𝑥𝑥̅3 , 𝐶𝐶11 = 𝑥𝑥2 ∨ 𝑥𝑥̅3 , then 𝑓𝑓001 𝑦𝑦1, … , 𝑦𝑦12 = 𝑦𝑦�1 ∧ 𝑦𝑦�7 ∧ 𝑦𝑦�11.
  • 10. 𝑞𝑞20 ≈ 0.776 𝑞𝑞30 ≈ 0.179 𝑞𝑞40 ≈ 0.016 1 𝑇𝑇𝑚𝑚 𝑞𝑞 𝑚𝑚 Fig. 40 + 41 𝑘𝑘 = 3,  𝑛𝑛 = 5 0 𝑞𝑞 𝑚𝑚 = 1 for 𝑚𝑚 < 15 𝑞𝑞 𝑚𝑚 = 0 for 𝑚𝑚 > 55 𝑇𝑇𝑚𝑚: Deviation from randomness 𝜇𝜇 of SAT boolean vectors +𝜎𝜎 −𝜎𝜎 𝑇𝑇2 ≈ 24.5 ± 0.743 𝑇𝑇20 ≈ 1.47 ± 1.17 1 5 𝑇𝑇30 ≈ 0.20 ± 0.45 ← 𝑚𝑚 = 70 になっても, 𝑄𝑄70は たかだか 32 を超えない. ←𝑘𝑘 = 3, 𝑛𝑛 = 5 で,SAT可能な 最大の 𝑚𝑚 = 2 𝑘𝑘 − 1 𝑛𝑛 𝑘𝑘 = 1 − 2 −𝑘𝑘 𝑁𝑁 は 70. ランダムな70節のCNFが𝑄𝑄70で SATな場合は十分あり得る. 𝑚𝑚 が増えるにつれ 𝑞𝑞 𝑚𝑚 が限りなく 0 に近づくなかで, 偏差を考慮した 𝑇𝑇𝑚𝑚 が 1 を取るような 𝑚𝑚 に注目する. p.48
  • 11. 1 < 𝑘𝑘 < 4,  𝑛𝑛 = 5 E𝑃𝑃: The expected “stopping time” 𝑆𝑆𝑘𝑘,𝑛𝑛 = E𝑃𝑃𝑘𝑘,𝑛𝑛 if 𝑃𝑃𝑘𝑘,𝑛𝑛 is the stopping time for 𝑘𝑘SAT on 𝑛𝑛 variables 𝐸𝐸𝐸𝐸 ≈ 25.22, V𝑃𝑃 ≈ 35.73 𝑆𝑆𝑘𝑘,5 4.06 ± 1.19 11.60 ± 3.04 25.22 ± 5.98 43.39 ± 7.62 𝑃𝑃 = 𝑚𝑚 : the number of clauses first unable to satisfy them all 𝑝𝑝𝑚𝑚 = 𝑞𝑞 𝑚𝑚−1 − 𝑞𝑞 𝑚𝑚 :the probability that 𝑚𝑚 − 1 random clauses are satisfiable but 𝑚𝑚 are not SATがほぼ 1 しかなくなる 𝑚𝑚 と, 全てUNSATになり始める 𝑚𝑚 は ほぼ一致する. 2−𝑘𝑘 𝑁𝑁 � 𝑃𝑃𝑃𝑃 𝑇𝑇𝑚𝑚 = 1 𝑁𝑁 − 𝑚𝑚 ≈ 0.8853 𝑚𝑚 一番最期のSAT集合の累積. E𝑃𝑃 = � 𝑞𝑞𝑚𝑚 𝑚𝑚 E𝑃𝑃2 = � 2𝑚𝑚 + 1 𝑚𝑚 𝑞𝑞 𝑚𝑚 p.48
  • 12. 𝑁𝑁 𝑚𝑚 ordered sequences after 𝑚𝑚 steps, not 𝑁𝑁 𝑚𝑚 sets 𝑞𝑞� 𝑚𝑚 : the probability that 𝑚𝑚 random clauses 𝐶𝐶1 ∧ ⋯ ∧ 𝐶𝐶𝑚𝑚 are satisfiable, each 𝐶𝐶𝑗𝑗 is randomly chosen from the 𝑁𝑁 = 2𝑘𝑘 𝑛𝑛 𝑘𝑘 possibilities 𝑁𝑁 = 2𝑘𝑘 𝑛𝑛 𝑘𝑘 𝑁𝑁 𝑚𝑚 2𝑛𝑛 𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5 ∧ 𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5 ∧ 𝑥𝑥3 ∨ 𝑥𝑥4 ∨ 𝑥𝑥5 も可なのでSATは増える. “birthday paradox” 23個のキーを365の大きさの表に対応づける ランダムな関数を選ぶとき, 2つのキーが同じ場所に対応しない確率は 0.4927(1/2以下)である. 𝑞𝑞� 𝑚𝑚 ≥ 𝑞𝑞 𝑚𝑚 Fig. 45 𝑘𝑘 = 3,  𝑛𝑛 = 5 𝑞𝑞 𝑚𝑚 𝑞𝑞� 𝑚𝑚 The expected behavior of 𝑃𝑃� is very much like that of 𝑃𝑃, if 𝑞𝑞 𝑚𝑚 is small whenever 𝑚𝑚/𝑁𝑁 isn't small. = ∑ 𝑚𝑚 𝑡𝑡 𝑡𝑡! 𝑞𝑞𝑡𝑡 𝑁𝑁 𝑡𝑡=0 𝑁𝑁 𝑡𝑡 /𝑁𝑁 𝑚𝑚 E𝑃𝑃� = � 𝑁𝑁 𝑁𝑁 − 𝑚𝑚 𝑁𝑁−1 𝑚𝑚=0 𝑞𝑞 𝑚𝑚 D𝑃𝑃�2 = � 𝑁𝑁 𝑁𝑁 − 𝑚𝑚 𝑁𝑁−1 𝑚𝑚=0 𝑞𝑞 𝑚𝑚 1 + 2 𝑁𝑁 𝑁𝑁 − 1 + ⋯ + 𝑁𝑁 𝑁𝑁 − 𝑚𝑚 p.50
  • 13. 𝛼𝛼𝑘𝑘: Satisfiability thresholds 𝑆𝑆𝑘𝑘 𝑚𝑚, 𝑛𝑛 : 𝑆𝑆𝑘𝑘 𝑚𝑚, 𝑛𝑛 = Pr 𝑚𝑚 random clauses of 𝑘𝑘SAT are satisfiable , where the 𝑚𝑚 clauses are "sampled with replacement"(they needn't be distinct). Fig. 46 𝑘𝑘 = 3 𝛼𝛼𝑘𝑘 = lim 𝑛𝑛→∞ 𝑆𝑆𝑘𝑘,𝑛𝑛/𝑛𝑛 Random 3SAT problems shows “phase transition” of satisfiability when the clauses exceeds about 4.27𝑛𝑛. 経験的に推定される 𝛼𝛼𝑘𝑘 を使えば,𝛼𝛼𝑘𝑘 𝑛𝑛節の 困難なベンチマーク𝑘𝑘SAT問題を得られる. ※ 𝛼𝛼3 = 4.26675 ± 0.00015 2𝑘𝑘 ln 2 − 1 + ln 2 2 − 𝑂𝑂 2− 𝑘𝑘 3 ≤ lim inf 𝑛𝑛→∞ 𝛼𝛼𝑘𝑘 𝑛𝑛 ≤ lim sup 𝑛𝑛→∞ 𝛼𝛼𝑘𝑘 𝑛𝑛 ≤ 2𝑘𝑘 ln 2 − 1 + ln 2 2 + 𝑂𝑂 2− 𝑘𝑘 3 2𝑘𝑘 ln 2 − 𝑂𝑂 𝑘𝑘 𝑛𝑛 なランダム 𝑘𝑘SAT は,ベクトル 𝑥𝑥 ; ν𝑥𝑥 ≈ 𝑛𝑛 2 で,ほぼ常に充足する.exercise 195 lim 𝑛𝑛→∞ 𝑆𝑆𝑘𝑘 𝛼𝛼𝑘𝑘 𝑛𝑛 − 𝜖𝜖 𝑛𝑛 , 𝑛𝑛 = 1, lim 𝑛𝑛→∞ 𝑆𝑆𝑘𝑘 𝛼𝛼𝑘𝑘 𝑛𝑛 + 𝜖𝜖 𝑛𝑛 , 𝑛𝑛 = 0, 𝑘𝑘 ≥ 2 において となる関数𝛼𝛼𝑘𝑘 𝑛𝑛 が存在する. 𝜀𝜀 ∶ 任意の正の数 𝛼𝛼𝑘𝑘 𝑛𝑛 は,Θ 2𝑘𝑘 で押さえられ,𝑘𝑘が十分に大きい時 定数になる. p.50
  • 14. Analysis of random 2SAT 2 SAT problem corresponds to an implication digraph, with arcs 𝑙𝑙̅ → 𝑙𝑙′ and 𝑙𝑙𝑙� → 𝑙𝑙 for each clause 𝑙𝑙 ∨ 𝑙𝑙′ . 𝑐𝑐: a fixed constant lim 𝑛𝑛→∞ 𝑆𝑆2 𝑐𝑐𝑐𝑐 , 𝑛𝑛 = � 1, if 𝑐𝑐 < 1; 0, if 𝑐𝑐 > 1. The satisfiability threshold 𝛼𝛼2 = 1 𝑛𝑛が増えるにつれて 転移は急激に切り立っていく. Fig. 47 𝑘𝑘 = 2 𝑆𝑆2,𝑛𝑛 MPR 21 22      非負の確率変数 𝑋𝑋 において Pr 𝑋𝑋 > 0 ≤ E𝑋𝑋; “the first moment principle” Pr(𝑋𝑋 > 0) ≥ E𝑋𝑋 2 / E𝑋𝑋2 “the second moment principle” 充足確率の閾値を有界とみなして 証明を導く. p.51
  • 15. 𝑥𝑥7 𝑥𝑥̅7 𝑥𝑥9 𝑥𝑥̅9 a set of 2SAT clauses is satisfiable iff no strong component of its digraph contains both 𝑥𝑥 and 𝑥𝑥̅ for variable 𝑥𝑥. If it were a random digraph, only 𝑂𝑂(log 𝑛𝑛) vertices are reachable from any given vertex when 𝑐𝑐 < 1, Analysis of random 2SAT p.50
  • 16. 𝑥𝑥̅8 𝑥𝑥8 a set of 2SAT clauses is satisfiable iff no strong component of its digraph contains both 𝑥𝑥 and 𝑥𝑥̅ for variable 𝑥𝑥. If it were a random digraph, only 𝑂𝑂(log 𝑛𝑛) vertices are reachable from any given vertex when 𝑐𝑐 < 1, but that there is a unique "giant strong component" of size Ω 𝑛𝑛 when 𝑐𝑐 > 1. 𝑛𝑛 が増えるにつれ,強連結成 分のシェアは急に大きくなる. Analysis of random 2SAT 一対有向グラフから, 強連結成分への 転移とSATの関連性? p.50
  • 17. “snares and snakes” 𝑙𝑙̅1 ∨ 𝑙𝑙2 , 𝑙𝑙̅2 ∨ 𝑙𝑙3 , ..., 𝑙𝑙̅𝑠𝑠−1 ∨ 𝑙𝑙𝑠𝑠 𝑠𝑠-chain 𝐶𝐶 ; 𝑠𝑠 = 9 𝑙𝑙𝑡𝑡 ∨ 𝑙𝑙1 and 𝑙𝑙̅𝑠𝑠 ∨ 𝑙𝑙̅−𝑢𝑢 if 𝑢𝑢 < 0 𝑙𝑙̅𝑠𝑠 ∨ 𝑙𝑙𝑢𝑢 if 𝑢𝑢 > 0,𝑙𝑙𝑡𝑡 ∨ 𝑙𝑙1 and 𝑡𝑡-snake 𝑠𝑠-snare (𝐶𝐶; 𝑡𝑡, 𝑢𝑢) 𝑡𝑡 = 5,  𝑢𝑢 = −𝑡𝑡 対有向グラフのままなら 同一強連結成分内に同時に, 𝑙𝑙𝑠𝑠 と 𝑙𝑙𝑠𝑠 � が存在しない. →必ず充足可能 充足不能な2SATは 必ず最低一つは snareを 持っている. snare を持つ2SATでも 𝑠𝑠 と 𝑡𝑡 と 𝑢𝑢 の関係によっては 充足可能となる. 𝑙𝑙𝑡𝑡 𝑙𝑙̅𝑡𝑡 𝑙𝑙𝑡𝑡 𝑙𝑙̅𝑡𝑡 要 𝑡𝑡 で 対の 𝑠𝑠 − 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 同士を つなぐ際, 𝑢𝑢 の正負が 直流 交流 をスイッチする仕掛け S A T U N S A T p.52
  • 18. “snares and snakes” 𝑙𝑙̅1 ∨ 𝑙𝑙2 , 𝑙𝑙̅2 ∨ 𝑙𝑙3 , ..., 𝑙𝑙̅𝑠𝑠−1 ∨ 𝑙𝑙𝑠𝑠 𝑠𝑠-chain 𝐶𝐶 ; 𝑠𝑠 = 9 𝑙𝑙𝑡𝑡 ∨ 𝑙𝑙1 and 𝑙𝑙̅𝑠𝑠 ∨ 𝑙𝑙̅−𝑢𝑢 if 𝑢𝑢 < 0 𝑙𝑙̅𝑠𝑠 ∨ 𝑙𝑙𝑢𝑢 if 𝑢𝑢 > 0,𝑙𝑙𝑡𝑡 ∨ 𝑙𝑙1 and 𝑡𝑡-snake 𝑠𝑠-snare (𝐶𝐶; 𝑡𝑡, 𝑢𝑢) 𝑡𝑡 = 5,  𝑢𝑢 = −𝑡𝑡 対有向グラフのままなら 同一強連結成分内に同時に, 𝑙𝑙𝑠𝑠 と 𝑙𝑙𝑠𝑠 � が存在しない. →必ず充足可能 充足不能な2SATは 必ず最低一つは snareを 持っている. snare を持つ2SATでも 𝑠𝑠 と 𝑡𝑡 と 𝑢𝑢 の関係によっては 充足可能となる. 𝑙𝑙𝑡𝑡 𝑙𝑙̅𝑡𝑡 𝑙𝑙𝑡𝑡 𝑙𝑙̅𝑡𝑡 p.52
  • 19. Proof of Theorem C p.53 E𝑋𝑋 is only 𝑂𝑂 𝑛𝑛−1 4⁄ when 𝑚𝑚 = 𝑛𝑛 − 𝑛𝑛3 4⁄ > 𝑐𝑐𝑐𝑐 ※ c > 1 ⇔ 𝑚𝑚 > 0 E𝑋𝑋 ≥ Pr 𝑋𝑋 > 0 ; “the first moment principle” ※Pr 𝑋𝑋 = 0 = 1 − Pr 𝑋𝑋 > 0 ≥ 1 − E𝑋𝑋 2𝑠𝑠+1 𝑠𝑠 − 1 2 𝑛𝑛𝑠𝑠 ≤ 2𝑠𝑠+1 𝑠𝑠 − 1 2 𝑛𝑛𝑠𝑠 𝑝𝑝 𝑠𝑠 + 1, 𝑚𝑚, 2𝑛𝑛(𝑛𝑛 − 1) ≤ 𝑚𝑚𝑠𝑠+1 2𝑛𝑛(𝑛𝑛 − 1) 𝑠𝑠+1 ≤ 𝑚𝑚𝑠𝑠+1 2𝑛𝑛(𝑛𝑛 − 1) 𝑠𝑠+1 ※2𝑛𝑛(𝑛𝑛 − 1)個の2SAT組からランダムに,𝑚𝑚節を抜き出してスネアを作るときの最大数と その中に特定の𝑠𝑠 − 1個の変数が含まれている確率 𝑝𝑝 𝑠𝑠 + 1, 𝑚𝑚, 2𝑛𝑛(𝑛𝑛 − 1) の上限は E 𝑋𝑋 𝐶𝐶; 𝑡𝑡, 𝑢𝑢 ≤ 𝑚𝑚𝑠𝑠+1 / 2𝑛𝑛 𝑛𝑛 − 1 𝑠𝑠+1 E 𝑋𝑋 = � E 𝑋𝑋 𝐶𝐶; 𝑡𝑡, 𝑢𝑢 ≤ � 2𝑠𝑠+1 𝑠𝑠≥0 𝑠𝑠 𝑠𝑠 − 1 𝑛𝑛𝑠𝑠 𝑚𝑚 2𝑛𝑛 𝑛𝑛 − 1 𝑠𝑠+1 = 2 𝑛𝑛 𝑚𝑚 𝑛𝑛 − 1 − 𝑚𝑚 3 𝑚𝑚 > 𝑐𝑐𝑐𝑐, 𝑐𝑐 > 1 における 2𝑆𝑆𝑆𝑆𝑆𝑆の充足確率= 0 である ⇔ 少なくとも 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 の期待値が常に 1 に漸近する 𝑆𝑆2 𝑛𝑛 − 𝑛𝑛3/4 , 𝑛𝑛 ≥ Pr 𝑋𝑋 = 0 ≥ 1 − 𝑂𝑂 𝑛𝑛−1/4 1 − 𝑂𝑂 𝑛𝑛−1/4 𝑛𝑛
  • 20. Proof of Theorem C p.53 𝑡𝑡 = 𝑛𝑛1/5 𝑚𝑚 = 𝑛𝑛 + 𝑛𝑛5/6  にとれば、 𝑡𝑡 − 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 分だけ 𝑆𝑆2 𝑚𝑚, 𝑛𝑛 をより鋭利に押し下げられる. Pr(𝑋𝑋 > 0) ≥ E𝑋𝑋 2 / E𝑋𝑋2 “the second moment principle” 1 − E𝑋𝑋 2 / E𝑋𝑋2 ≥ 1 − Pr 𝑋𝑋 > 0 = Pr(𝑋𝑋 = 0) 𝑂𝑂 𝑛𝑛− 1 30 ≥ 1 − Pr 𝑋𝑋 > 0 = Pr(𝑋𝑋 = 0) E 𝑋𝑋2 E 𝑋𝑋 2 = � 𝑝𝑝𝑟𝑟 2𝑡𝑡 𝑟𝑟=0 2𝑛𝑛(𝑛𝑛 − 1) 𝑚𝑚 𝑟𝑟 1 + 𝑂𝑂 𝑡𝑡2 𝑛𝑛 = 𝑂𝑂 𝑡𝑡4 𝑛𝑛 = 𝑂𝑂 𝑛𝑛−1/30 given any chain 𝑙𝑙1, … , 𝑙𝑙𝑡𝑡, … 𝑙𝑙2𝑡𝑡−1 , with 𝑠𝑠 = 2𝑡𝑡 − 1 and 𝑙𝑙𝑡𝑡 in the middle, generates 𝑙𝑙̅1 ∨ 𝑙𝑙2 , 𝑙𝑙̅2 ∨ 𝑙𝑙3 , ..., 𝑙𝑙̅𝑠𝑠−1 ∨ 𝑙𝑙𝑠𝑠 together with 𝑙𝑙𝑡𝑡 ∨ 𝑙𝑙1 and 𝑙𝑙̅𝑠𝑠 ∨ 𝑙𝑙̅𝑡𝑡 . 𝑡𝑡 −snake, which is the special case (𝐶𝐶; 𝑡𝑡, −𝑡𝑡) of a (2𝑡𝑡 − 1) −snare. 𝑋𝑋𝐶𝐶= [ each clause of (𝐶𝐶; 𝑡𝑡, −𝑡𝑡) occurs exactly once ]𝑋𝑋 = � 𝑋𝑋𝐶𝐶 𝑆𝑆2 𝑛𝑛 + 𝑛𝑛5/6 , 𝑛𝑛 = 𝑂𝑂 𝑛𝑛−1/30 𝑐𝑐𝑐𝑐 𝑛𝑛 + 𝑛𝑛5/6 𝑛𝑛 + 𝑛𝑛3/4 −Θ 𝑛𝑛1/4 𝑂𝑂 𝑛𝑛−1/30 (97) (95)
  • 21. p.50 Stirling 数 1.2.6 𝑥𝑥の累乗で表現されている多項式から, 二項係数で表現されている多項式への変換で使われる係数 𝑛𝑛 𝑘𝑘 : 𝑘𝑘本の閉路をもつ𝑛𝑛個の文字の順列第一種 𝑛𝑛 𝑘𝑘 : 𝑛𝑛個の要素を持つ集合を 𝑘𝑘個の要素を持つ 異なる部分集合に分割する方法の数 第二種 階乗冪→通常の冪 通常の冪→階乗冪 𝑥𝑥 𝑛𝑛 = 𝑥𝑥 𝑥𝑥 − 1 … (𝑥𝑥 − 𝑛𝑛 + 1) = � −1 𝑛𝑛−𝑘𝑘 𝑛𝑛 𝑘𝑘 𝑘𝑘 𝑥𝑥 𝑘𝑘 𝑥𝑥 𝑛𝑛 = � 𝑛𝑛 𝑘𝑘 𝑘𝑘 𝑥𝑥 𝑘𝑘
  • 22. Resolution p.54 𝐴𝐴 = 123�, 234�, 341,41�2, 1�2�3, 2�3�4, 3�4�1�, 4�12� axiom resolvent clause In-degree 2 directed acyclic graph (dag) “Resolution proof of 𝐴𝐴” “resolution refutation. ” 123 12�4 1�24� 1�2�3� 12 12� 1�2�1�2 1 1� 𝜖𝜖
  • 23. Algorithm D and refutation tree p.55 we can prove the empty clause by resolution from 𝐹𝐹|𝑥𝑥̅ iff we can prove 𝑥𝑥 by resolution from 𝐹𝐹 without resolving on 𝑥𝑥. if 𝐹𝐹 has no short refutation tree, Algorithm D cannot conclude those unsatisfiable unless it runs for a long time. exercise 224 𝐹𝐹|𝑥𝑥�を縮減して得られるラベルは, 元々の𝐹𝐹からのものではなくても, その祖先の葉の中に 𝑥𝑥 が含まれている限り, 根は 𝑥𝑥 か 𝜖𝜖 となる. Fig.39. Fig.48. SATを反駁ステップの 最小化問題に置き替える.
  • 24. Prover-Delayer game p.55 Pudlák, Pavel, and Russell Impagliazzo. "A lower bound for DLL algorithms for k-SAT." (1999). P 12�,1�3�, 1�2�3 D 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 P 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 D 𝑇𝑇F,𝐹𝐹3�, 𝐹𝐹𝐹𝐹3 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 end 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3end 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹 P 𝑇𝑇F,𝐹𝐹3�, 𝐹𝐹𝐹𝐹3 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹 D end 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇end end end 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇end end 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 P proved
  • 25. Prover-Delayer game p.55 Pudlák, Pavel, and Russell Impagliazzo. "A lower bound for DLL algorithms for k-SAT." (1999). P 12�,1�3�, 1�2�3 D 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 P 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 D 𝑇𝑇F,𝐹𝐹3�, 𝐹𝐹𝐹𝐹3 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 end 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3end 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹 P 𝑇𝑇F,𝐹𝐹3�, 𝐹𝐹𝐹𝐹3 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹 D end 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇end end end 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇end end 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 P proved Proverは,最短で確実にSATとなるように ①変数の選択順位を宣言する. ②Delayerが * を選択した際の 割り当て真偽を宣言する. Delayerは,より高得点を得られるように ①なるべく*を宣言する. ②ゲームが継続する=UNSATにもSATにもならない 真偽割り当てを実現する. Proverがすべての変数を宣言し終える前に, かつ誤ってゲームを終了させてしまう前に, Delayerが何点獲得できているかが勝負.
  • 26. Prover-Delayer game p.55 P 12�,1�3�, 1�2�3 D 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 P 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 D 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹*1P*1P *1P P 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹 D 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 *1P *1P*1P*1P P Proved If the Delayer has a strategy that guarantees a score of at least 𝑚𝑚 points, every refutation tree has at least 2 𝑚𝑚 leaves; hence at least 2 𝑚𝑚 − 1 resolutions must be done, and every backtrack-based solver needs Ω 2 𝑚𝑚 operations to declare the clauses unsatisfiable. Proverが迷わず一方を選ばざるを得ない状況で, Delayerが * 宣言する戦略
  • 27. Theorem R p.56 P D *1P 𝑗𝑗𝑚𝑚−3 𝑆𝑆 = 𝑗𝑗1, … , 𝑥𝑥̅𝑗𝑗𝑗𝑗 , (𝑥𝑥̅𝑖𝑖𝑗𝑗 ∨ 𝑥𝑥̅𝑗𝑗𝑘𝑘 ∨ 𝑥𝑥𝑖𝑖 𝑖𝑖), (𝑥𝑥𝑗𝑗𝑗 ∨ 𝑥𝑥𝑗𝑗𝑗 ∨ ⋯ ∨ 𝑥𝑥𝑗𝑗𝑗𝑗) for 1 ≤ 𝑗𝑗 ≤ 𝑚𝑚; (99) for 1 ≤ 𝑖𝑖, 𝑗𝑗, 𝑘𝑘 ≤ 𝑚𝑚; (100) for 1 ≤ 𝑗𝑗 ≤ 𝑚𝑚. (101) irreflexive transitive “𝑗𝑗 ≺ 𝑘𝑘 ” is a partial ordering. Prover は𝑗𝑗固定で順に流していく. for every 𝑗𝑗, there's a 𝑘𝑘 with 𝑗𝑗 ≺ 𝑘𝑘 𝑚𝑚2variables 𝑥𝑥𝑗𝑗𝑗𝑗, for 1 ≤ 𝑗𝑗, 𝑘𝑘 ≤ 𝑚𝑚, the incidence matrix for a binary relation “𝑗𝑗 ≺ 𝑘𝑘 ” 𝑥𝑥11 ⋯ 𝑥𝑥1𝑚𝑚 ⋮ ⋱ ⋮ 𝑥𝑥 𝑚𝑚𝑚 ⋯ 𝑥𝑥 𝑚𝑚𝑚𝑚 𝑥𝑥∗∗ 𝑗𝑗 𝑘𝑘 (99)(100)(101)節の適用→その中に極大値を持たない{1, … , 𝑚𝑚}の半順序集合の存在 →すべての節がSATには なり得ないが 𝑚𝑚 − 1点まで必ず取れる戦略がある. この時点で Delayer が,𝑆𝑆 点獲得しているとする時 Proverに選ばせた 変数の履歴集合が 𝑆𝑆 𝑥𝑥𝑗𝑗𝑘𝑘 if 𝑗𝑗 = 𝑘𝑘 if 𝑗𝑗 ∉ 𝑆𝑆, 𝑘𝑘 ∉ 𝑆𝑆 if 𝑗𝑗 ∈ 𝑆𝑆, 𝑘𝑘 ∉ 𝑆𝑆 if 𝑗𝑗 = 𝑗𝑗𝑎𝑎 ∈ 𝑆𝑆, 𝑘𝑘 = 𝑗𝑗𝑏𝑏 ∈ 𝑆𝑆if 𝑗𝑗 ∉ 𝑆𝑆, 𝑘𝑘 ∈ 𝑆𝑆 𝑥𝑥𝑗𝑗𝑘𝑘 ← 0 𝑥𝑥𝑗𝑗𝑘𝑘 ← 0𝑥𝑥𝑗𝑗𝑘𝑘 ← 1 𝑥𝑥𝑗𝑗𝑘𝑘 ← 𝑎𝑎 < 𝑏𝑏𝑥𝑥𝑗𝑗𝑘𝑘 ←∗ Proverの割り当てる真偽に応じて,𝑗𝑗𝑚𝑚−2 に 𝑗𝑗 か 𝑘𝑘 を定義. 得点を 𝑠𝑠 + 1 へ変更. (101)節は,この時点まで Falseになることがない. Every refutation tree for the clauses (99) ,(100), (101) represents at least 2 𝑚𝑚−1 − 1 resolution steps.
  • 28. Lower bounds for general resolution. p.57 4.6.3 加算連鎖 1 = 𝑎𝑎0, 𝑎𝑎1, … , 𝑎𝑎𝑟𝑟= 𝑛𝑛 ただし各要素は,すべての i=1,2,…,r について ある 𝑘𝑘 ≤ 𝑗𝑗 < 𝑖𝑖 に対して, 𝑎𝑎𝑖𝑖 = 𝑎𝑎𝑗𝑗 + 𝑎𝑎𝑘𝑘 7.1.2 𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵連鎖 𝑛𝑛変数(𝑥𝑥1,…,𝑥𝑥𝑛𝑛)の関数の𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵連鎖とは, 各ステップで先立つステップの2つを 結ぶような列(𝑥𝑥𝑛𝑛+1, … , 𝑥𝑥𝑛𝑛+𝑟𝑟)である. 𝑥𝑥𝑖𝑖 = 𝑥𝑥𝑗𝑗(𝑖𝑖) ∘𝑖𝑖 𝑥𝑥𝑘𝑘 𝑖𝑖 , 𝑛𝑛 + 1 ≤ 𝑖𝑖 ≤ 𝑛𝑛 + 𝑟𝑟 について. It’s a refutation chain for 𝐶𝐶1, … ,𝐶𝐶𝑚𝑚 if 𝐶𝐶𝑚𝑚+𝑟𝑟 = 𝜖𝜖. The short clauses are crucial if we want short chains. If 𝑥𝑥𝑗𝑗𝑗𝑗 means that pigeon 𝑗𝑗 occupies hole 𝑘𝑘, there is relevant unsatisfiable clauses for resolution in general.
  • 29. p.58 Lemma B. 𝛼𝛼 : any sequence of clauses 𝑤𝑤 𝛼𝛼 ∶ "𝑤𝑤𝑤𝑤𝑤𝑤 𝑤𝑤𝑤𝑤 the length of its longest clause or clauses 𝑤𝑤 𝛼𝛼0 ⊢ 𝜖𝜖 : the min. of 𝑤𝑤 𝛼𝛼 over all refutation chains α = 𝐶𝐶1, … , 𝐶𝐶𝑚𝑚+𝑟𝑟 for 𝛼𝛼0 𝛼𝛼0 ⊢ 𝜖𝜖 : the minimum length 𝑟𝑟 of all such chains. 𝛼𝛼0 = 𝐶𝐶1, … , 𝐶𝐶𝑚𝑚 𝛼𝛼0 ⊢ 𝜖𝜖 ≥ 𝑒𝑒 𝑤𝑤 𝛼𝛼0⊢𝜖𝜖 −1 2 8𝑛𝑛⁄ − 2 , for clauses in 𝑛𝑛 ≥ 𝑤𝑤 𝛼𝛼0 2 variables. Thus there‘s exponential growth if 𝑤𝑤 𝛼𝛼0 = 𝑂𝑂 1 , and 𝑤𝑤 𝛼𝛼0 ⊢ 𝜖𝜖 = Ω 𝑛𝑛 . 𝑊𝑊 ≥ 𝑤𝑤 𝛼𝛼0 特定のリテラルは 𝑊𝑊𝑊𝑊/(2𝑛𝑛) 回でてくる. 𝜌𝜌 = 1 − 𝑊𝑊/(2𝑛𝑛) で 値𝑙𝑙 で反駁した𝛼𝛼0には 高々 𝜌𝜌𝑓𝑓 回のfatな節. 𝑓𝑓 < 𝜌𝜌−𝑏𝑏 な整数 𝑏𝑏 に対して,𝛼𝛼0 の反駁 𝛽𝛽, 𝛽𝛽0 ,𝛽𝛽1,𝛽𝛽2,𝛽𝛽3を以下のように定義. 𝑏𝑏 > 0, 𝛼𝛼0|𝑙𝑙,  𝑤𝑤 𝛽𝛽0 ≤ 𝑊𝑊 + 𝑏𝑏 − 1 𝛽𝛽 = 𝛽𝛽1,𝛽𝛽2,𝛽𝛽3 with 𝛼𝛼0|𝑙𝑙̅, 𝑤𝑤 𝛽𝛽 = max 𝑤𝑤 𝛽𝛽0 + 1, 𝑤𝑤 𝛽𝛽2 , 𝑤𝑤 𝛽𝛽3 ≤ max 𝑊𝑊 + 𝑏𝑏 , 𝑤𝑤 𝛼𝛼0 , 𝑊𝑊 + 𝑏𝑏 = 𝑊𝑊 + 𝑏𝑏 Exercise 238 : 𝑐𝑐 = 1 2𝑛𝑛 , 𝑏𝑏 = 𝑊𝑊 , 𝑊𝑊 = 2𝑛𝑛 ln 𝑟𝑟 , なら 𝑓𝑓 ≤ 𝑟𝑟 < 𝜌𝜌−𝑏𝑏 . 𝑛𝑛 ≥ 𝑤𝑤 𝛼𝛼0 2 , 𝑟𝑟 ≥ 2 で 𝑊𝑊 ≥ 𝑤𝑤 𝛼𝛼0 , 𝑤𝑤 𝛼𝛼0 ⊢ 𝜖𝜖 ≤ 𝑊𝑊 + 𝑏𝑏 ≤ 8𝑛𝑛 ln 𝑟𝑟 + 1 𝑟𝑟𝑚𝑚
  • 30. p.58 Restricted pigeonhole principle 𝐴𝐴 = 𝑎𝑎0, 𝑎𝑎1, … , 𝑎𝑎 𝑚𝑚 𝐵𝐵 = 𝑏𝑏1, 𝑏𝑏2, … , 𝑏𝑏𝑚𝑚 二部グラフの部分集合 𝐴𝐴′ において あらゆる 𝑏𝑏𝑘𝑘の集合が必ず対となる 𝐴𝐴′ の部分集合を一 つは持っているような境界領域 a bipartite graph 𝐺𝐺0 on those vertices for which each 𝑎𝑎𝑗𝑗 has degree ≤ 5 and such that the following strong "expansion" condition is satisfied as follows. All refutation chains for 𝛼𝛼 𝐺𝐺0 have length expΩ 𝑚𝑚 if we can prove that they all have width Ω 𝑚𝑚 . the pigeonhole clauses are unsatisfiable if we also require 𝑥𝑥̅𝑗𝑗𝑗𝑗 whenever 𝑎𝑎𝑗𝑗 𝑏𝑏𝑘𝑘 in 𝐺𝐺0. (106)(107)を条件にもつ全ての𝑥𝑥̅𝑗𝑗𝑗𝑗 から帰結する節を𝛼𝛼 𝐺𝐺0 とすると, 𝑤𝑤 𝛼𝛼 𝐺𝐺0 ≤ 5 となり,特定されずに残る変数𝑥𝑥𝑗𝑗𝑗𝑗 は高々5𝑚𝑚 + 5 個である.
  • 31. Resolution p.54 𝐴𝐴 = 123�, 234�, 341,41�2, 1�2�3, 2�3�4, 3�4�1�, 4�12� axiom resolvent clause In-degree 2 directed acyclic graph (dag) “Resolution proof of 𝐴𝐴” “resolution refutation. ” 123 12�4 1�24� 1�2�3� 12 12� 1�2�1�2 1 1� 𝜖𝜖
  • 32. Algorithm D and refutation tree p.55 we can prove the empty clause by resolution from 𝐹𝐹|𝑥𝑥̅ iff we can prove 𝑥𝑥 by resolution from 𝐹𝐹 without resolving on 𝑥𝑥. if 𝐹𝐹 has no short refutation tree, Algorithm D cannot conclude those unsatisfiable unless it runs for a long time. exercise 224 𝐹𝐹|𝑥𝑥�を縮減して得られるラベルは, 元々の𝐹𝐹からのものではなくても, その祖先の葉の中に 𝑥𝑥 が含まれている限り, 根は 𝑥𝑥 か 𝜖𝜖 となる. Fig.39. Fig.48. SATを反駁ステップの 最小化問題に置き替える.
  • 33. Prover-Delayer game p.55 Pudlák, Pavel, and Russell Impagliazzo. "A lower bound for DLL algorithms for k-SAT." (1999). P 12�,1�3�, 1�2�3 D 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 P 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 D 𝑇𝑇F,𝐹𝐹3�, 𝐹𝐹𝐹𝐹3 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 end 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3end 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹 P 𝑇𝑇F,𝐹𝐹3�, 𝐹𝐹𝐹𝐹3 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹 D end 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇end end end 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇end end 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 P proved
  • 34. Prover-Delayer game p.55 P 12�,1�3�, 1�2�3 D 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 P 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝑇𝑇2�,𝐹𝐹3�, 𝐹𝐹2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 𝐹𝐹2�,𝑇𝑇3�, 𝑇𝑇2�3 D 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹*1P*1P *1P P 𝑇𝑇T,𝐹𝐹3�, 𝐹𝐹𝑇𝑇3 𝑇𝑇2�,𝐹𝐹𝐹𝐹, 𝐹𝐹2� 𝐹𝐹 𝐹𝐹𝐹𝐹,𝑇𝑇3�, 𝑇𝑇𝑇𝑇3 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝑇𝑇 𝐹𝐹2�,𝑇𝑇𝑇𝑇, 𝑇𝑇2� 𝐹𝐹 D 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝑇𝑇T,𝐹𝐹𝐹𝐹, 𝐹𝐹𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 𝐹𝐹𝐹𝐹,𝑇𝑇𝑇𝑇, 𝑇𝑇𝑇𝑇𝑇𝑇 *1P *1P*1P*1P P Proved If the Delayer has a strategy that guarantees a score of at least 𝑚𝑚 points, every refutation tree has at least 2 𝑚𝑚 leaves; hence at least 2 𝑚𝑚 − 1 resolutions must be done, and every backtrack-based solver needs Ω 2 𝑚𝑚 operations to declare the clauses unsatisfiable. Proverが迷わず一方を選ばざるを得ない状況で, Delayerが * 宣言する戦略
  • 35. Theorem R p.56 P D *1P 𝑗𝑗𝑚𝑚−3 𝑆𝑆 = 𝑗𝑗1, … , 𝑥𝑥̅𝑗𝑗𝑗𝑗 , (𝑥𝑥̅𝑖𝑖𝑗𝑗 ∨ 𝑥𝑥̅𝑗𝑗𝑘𝑘 ∨ 𝑥𝑥𝑖𝑖 𝑖𝑖), (𝑥𝑥𝑗𝑗𝑗 ∨ 𝑥𝑥𝑗𝑗𝑗 ∨ ⋯ ∨ 𝑥𝑥𝑗𝑗𝑗𝑗) for 1 ≤ 𝑗𝑗 ≤ 𝑚𝑚; (99) for 1 ≤ 𝑖𝑖, 𝑗𝑗, 𝑘𝑘 ≤ 𝑚𝑚; (100) for 1 ≤ 𝑗𝑗 ≤ 𝑚𝑚. (101) irreflexive transitive “𝑗𝑗 ≺ 𝑘𝑘 ” is a partial ordering. Prover は𝑗𝑗固定で順に流していく. for every 𝑗𝑗, there's a 𝑘𝑘 with 𝑗𝑗 ≺ 𝑘𝑘 𝑚𝑚2variables 𝑥𝑥𝑗𝑗𝑗𝑗, for 1 ≤ 𝑗𝑗, 𝑘𝑘 ≤ 𝑚𝑚, the incidence matrix for a binary relation “𝑗𝑗 ≺ 𝑘𝑘 ” 𝑥𝑥11 ⋯ 𝑥𝑥1𝑚𝑚 ⋮ ⋱ ⋮ 𝑥𝑥 𝑚𝑚𝑚 ⋯ 𝑥𝑥 𝑚𝑚𝑚𝑚 𝑥𝑥∗∗ 𝑗𝑗 𝑘𝑘 (99)(100)(101)節の適用→その中に極大値を持たない{1, … , 𝑚𝑚}の半順序集合の存在 →すべての節がSATには なり得ないが 𝑚𝑚 − 1点まで必ず取れる戦略がある. この時点で Delayer が,𝑆𝑆 点獲得しているとする時 Proverに選ばせた 変数の履歴集合が 𝑆𝑆 𝑥𝑥𝑗𝑗𝑘𝑘 if 𝑗𝑗 = 𝑘𝑘 if 𝑗𝑗 ∉ 𝑆𝑆, 𝑘𝑘 ∉ 𝑆𝑆 if 𝑗𝑗 ∈ 𝑆𝑆, 𝑘𝑘 ∉ 𝑆𝑆 if 𝑗𝑗 = 𝑗𝑗𝑎𝑎 ∈ 𝑆𝑆, 𝑘𝑘 = 𝑗𝑗𝑏𝑏 ∈ 𝑆𝑆if 𝑗𝑗 ∉ 𝑆𝑆, 𝑘𝑘 ∈ 𝑆𝑆 𝑥𝑥𝑗𝑗𝑘𝑘 ← 0 𝑥𝑥𝑗𝑗𝑘𝑘 ← 0𝑥𝑥𝑗𝑗𝑘𝑘 ← 1 𝑥𝑥𝑗𝑗𝑘𝑘 ← 𝑎𝑎 < 𝑏𝑏𝑥𝑥𝑗𝑗𝑘𝑘 ←∗ Proverの割り当てる真偽に応じて,𝑗𝑗𝑚𝑚−2 に 𝑗𝑗 か 𝑘𝑘 を定義. 得点を 𝑠𝑠 + 1 へ変更. (101)節は,この時点まで Falseになることがない. Every refutation tree for the clauses (99) ,(100), (101) represents at least 2 𝑚𝑚−1 − 1 resolution steps.
  • 36. Lower bounds for general resolution. p.57 4.6.3 加算連鎖 1 = 𝑎𝑎0, 𝑎𝑎1, … , 𝑎𝑎𝑟𝑟= 𝑛𝑛 ただし各要素は,すべての i=1,2,…,r について ある 𝑘𝑘 ≤ 𝑗𝑗 < 𝑖𝑖 に対して, 𝑎𝑎𝑖𝑖 = 𝑎𝑎𝑗𝑗 + 𝑎𝑎𝑘𝑘 7.1.2 𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵連鎖 𝑛𝑛変数(𝑥𝑥1,…,𝑥𝑥𝑛𝑛)の関数の𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵連鎖とは, 各ステップで先立つステップの2つを 結ぶような列(𝑥𝑥𝑛𝑛+1, … , 𝑥𝑥𝑛𝑛+𝑟𝑟)である. 𝑥𝑥𝑖𝑖 = 𝑥𝑥𝑗𝑗(𝑖𝑖) ∘𝑖𝑖 𝑥𝑥𝑘𝑘 𝑖𝑖 , 𝑛𝑛 + 1 ≤ 𝑖𝑖 ≤ 𝑛𝑛 + 𝑟𝑟 について. It’s a refutation chain for 𝐶𝐶1, … ,𝐶𝐶𝑚𝑚 if 𝐶𝐶𝑚𝑚+𝑟𝑟 = 𝜖𝜖. The short clauses are crucial if we want short chains. If 𝑥𝑥𝑗𝑗𝑗𝑗 means that pigeon 𝑗𝑗 occupies hole 𝑘𝑘, there is relevant unsatisfiable clauses for resolution in general.
  • 37. p.58 Lemma B. 𝛼𝛼 : any sequence of clauses 𝑤𝑤 𝛼𝛼 ∶ "𝑤𝑤𝑤𝑤𝑤𝑤 𝑤𝑤𝑤𝑤 the length of its longest clause or clauses 𝑤𝑤 𝛼𝛼0 ⊢ 𝜖𝜖 : the min. of 𝑤𝑤 𝛼𝛼 over all refutation chains α = 𝐶𝐶1, … , 𝐶𝐶𝑚𝑚+𝑟𝑟 for 𝛼𝛼0 𝛼𝛼0 ⊢ 𝜖𝜖 : the minimum length 𝑟𝑟 of all such chains. 𝛼𝛼0 = 𝐶𝐶1, … , 𝐶𝐶𝑚𝑚 𝛼𝛼0 ⊢ 𝜖𝜖 ≥ 𝑒𝑒 𝑤𝑤 𝛼𝛼0⊢𝜖𝜖 −1 2 8𝑛𝑛⁄ − 2 , for clauses in 𝑛𝑛 ≥ 𝑤𝑤 𝛼𝛼0 2 variables. Thus there‘s exponential growth if 𝑤𝑤 𝛼𝛼0 = 𝑂𝑂 1 , and 𝑤𝑤 𝛼𝛼0 ⊢ 𝜖𝜖 = Ω 𝑛𝑛 . 𝑊𝑊 ≥ 𝑤𝑤 𝛼𝛼0 特定のリテラルは 𝑊𝑊𝑊𝑊/(2𝑛𝑛) 回でてくる. 𝜌𝜌 = 1 − 𝑊𝑊/(2𝑛𝑛) で 値𝑙𝑙 で反駁した𝛼𝛼0には 高々 𝜌𝜌𝑓𝑓 回のfatな節. 𝑓𝑓 < 𝜌𝜌−𝑏𝑏 な整数 𝑏𝑏 に対して,𝛼𝛼0 の反駁 𝛽𝛽, 𝛽𝛽0 ,𝛽𝛽1,𝛽𝛽2,𝛽𝛽3を以下のように定義. 𝑏𝑏 > 0, 𝛼𝛼0|𝑙𝑙,  𝑤𝑤 𝛽𝛽0 ≤ 𝑊𝑊 + 𝑏𝑏 − 1 𝛽𝛽 = 𝛽𝛽1,𝛽𝛽2,𝛽𝛽3 with 𝛼𝛼0|𝑙𝑙̅, 𝑤𝑤 𝛽𝛽 = max 𝑤𝑤 𝛽𝛽0 + 1, 𝑤𝑤 𝛽𝛽2 , 𝑤𝑤 𝛽𝛽3 ≤ max 𝑊𝑊 + 𝑏𝑏 , 𝑤𝑤 𝛼𝛼0 , 𝑊𝑊 + 𝑏𝑏 = 𝑊𝑊 + 𝑏𝑏 Exercise 238 : 𝑐𝑐 = 1 2𝑛𝑛 , 𝑏𝑏 = 𝑊𝑊 , 𝑊𝑊 = 2𝑛𝑛 ln 𝑟𝑟 , なら 𝑓𝑓 ≤ 𝑟𝑟 < 𝜌𝜌−𝑏𝑏 . 𝑛𝑛 ≥ 𝑤𝑤 𝛼𝛼0 2 , 𝑟𝑟 ≥ 2 で 𝑊𝑊 ≥ 𝑤𝑤 𝛼𝛼0 , 𝑤𝑤 𝛼𝛼0 ⊢ 𝜖𝜖 ≤ 𝑊𝑊 + 𝑏𝑏 ≤ 8𝑛𝑛 ln 𝑟𝑟 + 1 𝑟𝑟𝑚𝑚
  • 38. p.60 SAT solving via resolution. by E. W.Samson and R. K. Mueller in 1955. 𝐹𝐹 → {1234,12�, 1�2�3�, 1�3,23�, 34�} 123 ℘ 12 1�2� 1�2 1�1 𝜖𝜖 ← 𝐹𝐹’ ← 𝑥𝑥 𝐴𝐴𝐴 𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴 SAT is the problem of evaluating the quantified formula ∃𝑥𝑥1 … ∃𝑥𝑥𝑛𝑛−1∃𝑥𝑥𝑛𝑛 𝐹𝐹 𝑥𝑥1, … , 𝑥𝑥𝑛𝑛−1, 𝑥𝑥𝑛𝑛 where 𝐹𝐹 is a Boolean function given in CNF as a conjunction of clauses. How to transform the CNF for 𝐹𝐹 into the CNF for 𝐹𝐹𝐹 in the reduced problem ? ∃𝑥𝑥1 … ∃𝑥𝑥𝑛𝑛−1 𝐹𝐹𝐹 𝑥𝑥1, … , 𝑥𝑥𝑛𝑛−1 , 𝐹𝐹𝐹 𝑥𝑥1, … , 𝑥𝑥𝑛𝑛−1 = 𝐹𝐹 𝑥𝑥1, … , 𝑥𝑥𝑛𝑛−1, 0 ∨ 𝐹𝐹 𝑥𝑥1, … , 𝑥𝑥𝑛𝑛−1, 1 . , . . Suppose clauses of contain and clauses contain . Then the elimination of will give us at most new clauses, in the worst case; so will have no more clauses than did, whenever , namely when . * This condition clearly holds whenever or ; or , and even when . Therefore repeated elimination of variables doesn't always cause the set of clauses to explode. In the worst case, however, it can be quite inefficient.
  • 39. p.61 Algorithm I. 𝐶𝐶1 ∧ ⋯ ∧ 𝐶𝐶𝑚𝑚 : 𝑚𝑚 nonempty clauses on 𝑛𝑛 Boolean variables 𝑥𝑥1 … 𝑥𝑥𝑛𝑛 1972, Stephen Cook(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙 𝑙𝑙) 𝐶𝐶1 𝐶𝐶2 𝐶𝐶3 𝐶𝐶4 𝐶𝐶5 𝐶𝐶6 𝐶𝐶7 𝐶𝐶8 𝐶𝐶9 𝐶𝐶10 𝐶𝐶11𝐶𝐶𝑖𝑖 𝐶𝐶𝑗𝑗 1234 12� 1�2�3� 1�3 23� 34� 𝑤𝑤 𝑙𝑙1 𝑙𝑙2 𝑙𝑙3 𝑙𝑙4 3 2 1 1� 2�3� 2 2� 23� 1�2�3� 12� 3� 1 3� 4� 1� 2� 1234 2 12� 134 1 1�3 34 𝐶𝐶12 4 34� 3 3 𝜖𝜖 3� I3. I4. I5. 𝐹𝐹 𝑙𝑙𝑑𝑑 :Choose a literal that occurs most frequently in the set of currently unsatisfied clauses that have the fewest unspecified literals. Algorithm I is to minimize the number of resolution steps, but tends to fill memory with a great many new clauses when it is applied to large problems, and there's no obvious way to deal with those clauses efficiently.
  • 40. p.63 123,234,345,456,567,678,789,135,246,357,468,579,147,258,369,159, 1�2�3�, 2�3�4�, 3�4�5�, 4�5�6�, 5�6�7�, 6�7�8�, 7�8�9�, 1�3�5�, 2�4�6�, 3�5�7�, 4�6�8�, 5�7�9�, 1�4�7�, 2�5�8�, 3�6�9�, 1�5�9�. 𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤(3,3; 9) 0 ≤ 𝐹𝐹 < 𝑛𝑛 = 18 𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 𝐿𝐿3 𝐿𝐿4 𝐿𝐿5 𝐿𝐿6 𝐿𝐿7 𝐿𝐿8 𝐿𝐿9 𝐿𝐿10 𝐿𝐿11 𝐿𝐿12 𝐿𝐿13 𝐿𝐿14 𝐿𝐿15 𝐿𝐿16 𝐿𝐿17 trail 6� 9� 2 𝜖𝜖3 396 246 5 546 8 846 2� 2�5�8� 7� 7�5�3�reason level Λ 1 Λ 2 4� Λ 3 depends directly on depends on Every conflict allows to construct a new clause 𝑐𝑐 that is true whenever the existing clauses are 𝑠𝑠𝑠𝑠𝑠𝑠, with “learning" 𝑐𝑐 by adding it to the existing clauses, we will find a solution or learn 𝜖𝜖. Conflict clause 𝑐𝑐 on level 3 CDCL: toward algorithm C.
  • 41. p.64 45�68� New clause 𝑐𝑐′ 45�6 46 𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 𝐿𝐿3 𝐿𝐿4 𝐿𝐿5 𝐿𝐿6 𝐿𝐿7 𝐿𝐿8 𝐿𝐿9 𝐿𝐿10 𝐿𝐿11 𝐿𝐿12 𝐿𝐿13 𝐿𝐿14 𝐿𝐿15 𝐿𝐿16 𝐿𝐿17 trail reason level 6� 4 5 9 8 2 2�1�7�3� Λ Λ46 369 678 1233�4�5� 5�7�9� 1�5�9� 2�5�8� 1 2 𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 𝐿𝐿3 𝐿𝐿4 𝐿𝐿5 𝐿𝐿6 𝐿𝐿7 𝐿𝐿8 𝐿𝐿9 𝐿𝐿10 𝐿𝐿11 𝐿𝐿12 𝐿𝐿13 𝐿𝐿14 𝐿𝐿15 𝐿𝐿16 𝐿𝐿17 trail 6� 9� 2 𝜖𝜖3 396 246 5 546 8 846 2� 2�5�8� 7� 7�5�3�reason level Λ 1 Λ 2 Conflict clause 𝑐𝑐 on level 3 4� Λ 3 135�8� → 135�67→ 35�679� → 35�69� → 35�6→ 4�5�6→ 5�6 Setting 𝐿𝐿2 ← 5� ,now forces 7, 1�,3,9,2�,8�,8, all at level 1; finally learn the 𝑢𝑢𝑢𝑢𝑢𝑢𝑢𝑢 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 6 CDCL: toward algorithm C.
  • 42. p.64 𝑙𝑙̅ 𝜖𝜖 trail reason Initial conflict clause 𝑙𝑙̅𝑎𝑎�1..𝑎𝑎�𝑖𝑖..𝑎𝑎�𝑘𝑘 𝑏𝑏 array . . . . . 𝑏𝑏1 ← 𝑎𝑎1 𝑏𝑏�1 . . . 𝑏𝑏�𝑟𝑟 𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 𝐿𝐿3 𝐿𝐿4 𝐿𝐿𝑡𝑡 𝐿𝐿9 …. . . . . . counter 1 . . . level 𝑑𝑑𝑑𝑑’ 𝐿𝐿𝑡𝑡 𝑎𝑎𝑎�1..𝑎𝑎𝑎� 𝑖𝑖..𝑎𝑎𝑎� 𝑘𝑘𝑘 𝑎𝑎𝑎𝑖𝑖 𝑏𝑏�𝑖𝑖 𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 𝐿𝐿3 𝐿𝐿4 𝐿𝐿𝑡𝑡 𝐿𝐿9 … trail 𝑎𝑎1 𝑙𝑙̅ 𝜖𝜖𝑎𝑎𝑠𝑠 reason stamp 𝑙𝑙̅𝑎𝑎�1..𝑎𝑎�𝑖𝑖..𝑎𝑎�𝑘𝑘 𝑏𝑏 array level 𝑑𝑑𝑑𝑑’ . . . 𝑎𝑎𝑟𝑟. . . . . . . . 𝑏𝑏�1 . . . 𝑏𝑏�𝑟𝑟 𝑠𝑠. . . . . counter 1 . . . 𝑎𝑎𝑘𝑘 𝐿𝐿𝑡𝑡 𝑎𝑎𝑎�1..𝑎𝑎𝑎� 𝑖𝑖..𝑎𝑎𝑎� 𝑘𝑘𝑘 𝑎𝑎𝑎𝑖𝑖 𝑏𝑏�𝑖𝑖 𝐿𝐿𝑡𝑡 𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 … trail 𝑎𝑎1 𝜖𝜖 reason stamp 𝑏𝑏 array level 𝑑𝑑𝑑𝑑’ . . . 𝑎𝑎𝑟𝑟. . . . . 𝑠𝑠. . . . . counter 1 𝐿𝐿�𝑡𝑡 𝐿𝐿𝑡𝑡 𝐿𝐿�𝑡𝑡 𝑏𝑏�1..𝑏𝑏�𝑟𝑟 . . .𝑏𝑏�1 𝑏𝑏�𝑟𝑟 Stamp. Eventually the count of unresolved literals decrease to 1 ; the learned clause is then 𝐿𝐿�𝑡𝑡 ∨ 𝑏𝑏�1 ∨ ⋯ ∨ 𝑏𝑏�𝑟𝑟. But the learned clauses by the efficient resolution steps might turn out to be quite large. 𝑎𝑎1 . . . 𝑎𝑎𝑘𝑘𝑎𝑎𝑠𝑠 stamp 𝑠𝑠. .𝑟𝑟 𝑎𝑎𝑟𝑟
  • 43. Redundancy of CDCL p.65 a CDCL solver was applied to the 2779 clauses of 𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤𝑤(3, 10; 97), after about 10,000 clauses had been learned. the clauses learned unsat had an average length of 19.9 → 11.2 ; simplification run about 33% faster. that decision eventually lead to a conflict when trying to set 𝑳𝑳𝟔𝟔𝟔𝟔. The complexity of a CDCL is devoted to unit propagation. Key is the value of a literal forced by previous assignments .
  • 44. Exercise 257. A literal 𝑙𝑙′� is said to be 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟, w.r.t. a given clause 𝑐𝑐 and the current trail, (i) 𝑙𝑙 is defined at level 0, or (ii) 𝑙𝑙 is not a decision literal and every false literal in 𝑙𝑙's reason is either in 𝑐𝑐 or (recursively) redundant. 𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 … trail 𝜖𝜖 reason stamp 𝑏𝑏 array level 1 𝑑𝑑𝑑𝑑’ . . . 𝑠𝑠 . . . 𝑙𝑙𝑙� 𝐿𝐿𝑡𝑡 𝑙𝑙𝑙�𝑏𝑏�1..𝑏𝑏�4 . . .𝑏𝑏�1 𝑏𝑏�4 conflict clause 𝑐𝑐 the reason for 𝑏𝑏4 = 𝑏𝑏4 ∨ 𝑏𝑏�1 ∨ 𝑎𝑎�1 , the reason for 𝑎𝑎1 = 𝑎𝑎1 ∨ 𝑏𝑏�2 ∨ 𝑎𝑎�2 the reason for 𝑎𝑎2 = 𝑎𝑎2 ∨ 𝑏𝑏�1 ∨ 𝑏𝑏�3 . 𝑏𝑏4 is redundant, because 𝑎𝑎�2 and 𝑎𝑎�1 are redundant. a) Suppose 𝑐𝑐 = 𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ ⋯ ∨ 𝑏𝑏�𝑟𝑟 is a newly learned clause. Prove that if 𝑏𝑏�𝑗𝑗 ∈ 𝑐𝑐 is redundant, some other 𝑏𝑏�𝑖𝑖 ∈ 𝑐𝑐 became false on the same level of the trail as 𝑏𝑏𝑗𝑗 did. b) Devise an efficient algorithm that discovers all of the redundant literals 𝑏𝑏�𝑖𝑖 in a given newly learned clause 𝑐𝑐 = 𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ ⋯ ∨ 𝑏𝑏�𝑟𝑟 Hint: Use stamps. p.155
  • 45. Answer to Exercise 257 (b). p.233 b) Devise an efficient algorithm that discovers all of the redundant literals 𝑏𝑏�𝑖𝑖 in a given newly learned clause 𝑐𝑐 = 𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ ⋯ ∨ 𝑏𝑏�𝑟𝑟 Hint: Use stamps. We can assume that the stamp value 𝒔𝒔 used when resolving conflicts is a multiple of 𝟑𝟑, and that all stamps are ≤ 𝒔𝒔. Then we can stamp literal 𝑙𝑙 with S 𝑙𝑙 ← 𝑠𝑠 + 1 if 𝑙𝑙̅ is known to be redundant, or 𝑠𝑠 + 2 if 𝑙𝑙� is known to be nonredundant and not in 𝑐𝑐. (These stamps serve as a '‘memo cache" to avoid repeated work.) While building 𝑐𝑐 we can also stamp levels as well as literals, setting LS[𝑑𝑑𝑑] ← 𝑠𝑠 if level 𝑑𝑑𝑑 has exactly one of the 𝑏𝑏𝑖𝑖 , or 𝑠𝑠 + 1 if it has more than one. Then for 1 ≤ 𝑗𝑗 ≤ 𝑟𝑟, 𝑏𝑏𝑗𝑗 is redundant if and only if LS 𝑙𝑙𝑙𝑙𝑙𝑙 𝑏𝑏𝑗𝑗 ← 𝑠𝑠 + 1 and 𝑟𝑟𝑟𝑟𝑟𝑟 𝑏𝑏�𝑗𝑗 is true, where 𝑙𝑙𝑙𝑙𝑙𝑙(𝑙𝑙) = VAL 𝑙𝑙 ≫1 and where 𝑟𝑟𝑟𝑟𝑟𝑟(𝑙𝑙) is the following recursive procedure: “ If 𝑙𝑙 is a decision literal, return false. Otherwise let 𝑙𝑙 ∨ 𝑎𝑎�1 ∨ ⋯ ∨ 𝑎𝑎�𝑘𝑘 be 𝑙𝑙′s reason. For 1 ≤ 𝑖𝑖 ≤ 𝑘𝑘 with 𝑙𝑙𝑙𝑙𝑙𝑙 𝑎𝑎𝑖𝑖 > 0, if S 𝑎𝑎𝑖𝑖 = s + 2 return false; if S 𝑎𝑎𝑖𝑖 < s and either LS 𝑙𝑙𝑙𝑙𝑙𝑙 𝑎𝑎𝑖𝑖 < 𝑠𝑠 or 𝑟𝑟𝑟𝑟𝑟𝑟 𝑎𝑎�𝑖𝑖 is false, set S 𝑎𝑎𝑖𝑖 ← 𝑠𝑠 + 2 and return false . But if none of these conditions hold, S 𝑙𝑙 ← 𝑠𝑠 + 1 and return true. “ 𝑙𝑙 𝑠𝑠 + 1 𝑠𝑠 + 2 𝐿𝐿0 𝐿𝐿1 𝐿𝐿2 … trail reason stamp : S( ) 𝑏𝑏 array level : 𝑙𝑙𝑙𝑙𝑙𝑙( ) 1 𝑑𝑑𝑑𝑑’ . . . 𝑠𝑠 . . . 𝑙𝑙𝑙� 𝐿𝐿𝑡𝑡 𝑙𝑙𝑙�𝑏𝑏�1..𝑏𝑏�𝑟𝑟 . . .𝑏𝑏�1 𝑏𝑏�𝑟𝑟 LS( ) 𝑠𝑠 𝑠𝑠 + 1 conflict clause 𝑐𝑐 𝑏𝑏𝑗𝑗
  • 46. Algorithm C p.68+69 (𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶). 0 0 0 0 1 0 -1 -1 -1 0 -1 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] c1. [Initialize] c2. [Level complete?] c3. [Advance 𝐺𝐺.] c4. [Does 𝑐𝑐 forceaunit?] c5. [New level?] c6. [Makeadecision.] c7. [Resolveaconflict.] c8. [Backjump.] c9. [Learn.] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all literals forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1 if 𝐺𝐺 = 𝐹𝐹 𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1 for all c in the watch list of 𝑙𝑙̅ 𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.) ⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔ if 𝑙𝑙0 is true ⇔ otherwise 𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋 with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false 𝑙𝑙0 false ⇔ 𝑙𝑙0 free 𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗 𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈 𝐿𝐿𝐹𝐹 ← 𝑙𝑙0 TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0 ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f terminate succesfully prepare to purge excess clauses flush literals as expected ⇔ otherwise 𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹. 𝑘𝑘 ← HEAP 0 deletek from the heap if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠 𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1 𝐿𝐿𝐹𝐹 ← 𝑙𝑙 TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1 if 𝑤𝑤 = 0 ⇔ otherwise terminate unsuccesfully use the conflictclause 𝑐𝑐 to construct 𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ …∨ 𝑏𝑏�𝑟𝑟 ACT( 𝑙𝑙 ) ← ACT( 𝑙𝑙 ) +DEL for all literals 𝑙𝑙 stampedset d' to the max. level occupied by 𝑏𝑏1,… , 𝑏𝑏𝑟𝑟 while 𝐹𝐹 > 𝑐𝑐𝑑𝑑′+1 𝐹𝐹 ← 𝐹𝐹 − 1 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 (Increasing ACT 𝑙𝑙 may change HEAP.) 𝑙𝑙 ← 𝐿𝐿𝐹𝐹𝑘𝑘 ← 𝑙𝑙 OVAL(𝑘𝑘) ← VAL 𝑘𝑘𝑅𝑅𝑙𝑙 ← Λ if HLOC 𝑙𝑙 < 0 insert 𝑘𝑘 into HEAP. 𝐺𝐺 ← 𝐹𝐹𝑤𝑤 ← 𝑤𝑤𝑙 set 𝑐𝑐 ←MAXL If 𝑤𝑤 > 0 store the new clause in MEM at position 𝑐𝑐 advance MAXL to the next available position in MEM 𝑀𝑀 ← 𝑀𝑀 + 1𝐿𝐿𝐹𝐹 ← 𝑙𝑙𝑙 TLOC( 𝑙𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙′ ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 DEL←DEL/𝜌𝜌 Given a set of clauses on 𝑛𝑛 Boolean variables, this algorithm finds a solution 𝐿𝐿0 𝐿𝐿1 … 𝐿𝐿𝑛𝑛−1 if and only if the clauses are satisfiable, meanwhile discovering 𝑀𝑀 new ones that are consequences of the originals. After discovering 𝑀𝑀p new clauses, it will purge some of them from its memory and reset 𝑀𝑀p ; after discovering 𝑀𝑀f of them, it will flush part of its trail, reset 𝑀𝑀f , and start over. (Details of purging and flushing will be discussed later.)
  • 47. p.66+67 0 0 0 0 1 0 -1 -1 -1 0 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] 𝑐𝑐 − 1 𝑐𝑐 − 2 𝑐𝑐 − 3 𝑐𝑐 − 4 𝑐𝑐 − 5 c1. [Initialize] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 A monolithic array MEM hold all of the literals in all of the clauses Each clause 𝑐𝑐 = 𝑙𝑙0 ∨ 𝑙𝑙1 ∨ ⋯ ∨ 𝑙𝑙𝑘𝑘−1 with 𝑘𝑘 > 1 is represented by its starting position in MEM , with MEM 𝑐𝑐 + 𝑗𝑗 = 𝑙𝑙𝑗𝑗 for 0 ≤ 𝑗𝑗 < 𝑘𝑘. Its two watched literals are 𝑙𝑙0 and 𝑙𝑙1, and its size 𝑘𝑘 is stored in MEM [𝑐𝑐 − 1]. MAXL is set equal to MINL, the smallest cell in MEM that is available for learned clauses; then MAXL grows as new clauses are added to the repertoire. 𝑥𝑥𝑘𝑘 and 𝑥𝑥̅𝑘𝑘, for 1 ≤ 𝑘𝑘 ≤ 𝑛𝑛, are represented by 2𝑘𝑘 and 2𝑘𝑘 + 1 each of these 2𝑛𝑛 literals 𝑙𝑙 has a list pointer 𝑊𝑊𝑙𝑙, which begins a linked list of the clauses in which 𝑙𝑙 is watched. And We have 𝑊𝑊𝑙𝑙 = 0 if there is no such clause; but if 𝑊𝑊𝑙𝑙 = 𝑐𝑐 > 0, the next link in this "watch list" is in MEM [𝑐𝑐 − 2] if 𝑙𝑙 = 𝑙𝑙0, in MEM [𝑐𝑐 − 3]if 𝑙𝑙 = 𝑙𝑙1. 𝑥𝑥𝑘𝑘 for 1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 has six current attributes S(𝑘𝑘) is the "stamp" If neither 𝑥𝑥𝑘𝑘 𝑛𝑛𝑛𝑛𝑛𝑛 𝑥𝑥̅𝑘𝑘 appears in the current trail, then VAL 𝑘𝑘 = −1, and we say that 𝒙𝒙𝒌𝒌 and its two literals are "free." But if 𝐿𝐿𝑡𝑡 = 𝑙𝑙 is a literal of the trail, belonging to level 𝑑𝑑, we have VAL 𝑙𝑙 ≤ 2𝑑𝑑 + 𝑙𝑙 &1 and TLOC 𝑙𝑙 = 𝑡𝑡 where 𝑙𝑙 = 𝑙𝑙 ≫ 1, and we say that 𝑙𝑙 is "true" and 𝑙𝑙̅ is "false." Thus a given literal 𝑙𝑙 is false if and only if VAL 𝑙𝑙 is nonnegative and VAL(|𝑙𝑙|) + 𝑙𝑙 is odd. 𝑥𝑥𝑘𝑘 has an activity score ACT(𝒌𝒌), which heuristically estimates its desirability for branching. All of the free variables, and possibly others, are kept in an array called HEAP, which is arranged so that ACT HEAP 𝑗𝑗 ≤ ACT HEAP 𝑗𝑗 − 1 ≫ 1 for 0 < 𝑗𝑗 < ℎ the variable DEL holds the current scaling factor 𝜌𝜌−𝑀𝑀 , divided by 10100 each time all of the activities have been rescaled. where 𝜌𝜌 is a damping factor (say 𝜌𝜌 = .95) OVAL(𝑘𝑘), to control the polarity of each new decision Algorithm 𝑪𝑪 starts by simply making each OVAL 𝑘𝑘 odd, Afterwards it sets OVAL 𝑘𝑘 ←VAL 𝑘𝑘 whenever 𝑥𝑥𝑘𝑘 leaves the trail and becomes free
  • 48. Algorithm C p.68 (𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶). 0 0 0 0 1 0 -1 -1 -1 0 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] 𝑐𝑐 − 1 𝑐𝑐 − 2 𝑐𝑐 − 3 𝑐𝑐 − 4 𝑐𝑐 − 5 c1. [Initialize] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 Exercise 260: Describe in detail step C1's setting-up of MEM, the watch lists, and the trail. First, to get a random permutation in the heap we can use a variant of Algorithm 3.4.2P: For 𝑘𝑘 ← 1, 2, … , 𝑛𝑛, let 𝑗𝑗 be a random integer in [0 . . 𝑘𝑘 − 1] and set HEAP[𝑘𝑘 − 1] ←HEAP[𝑗𝑗], HEAP[ 𝑗𝑗 ] ← 𝑘𝑘. Then set HLOC HEAP [ 𝑗𝑗 ] ← 𝑗𝑗 for 0 ≤ 𝑗𝑗 < 𝑛𝑛. Next, set 𝐹𝐹 ← 0 and 𝑊𝑊𝑙𝑙 ← 0 for 2 ≤ 𝑙𝑙 ≤ 2𝑛𝑛 + 1 and 𝑐𝑐 ← 3. Do the following for each input clause 𝑙𝑙0 𝑙𝑙1 … 𝑙𝑙𝑘𝑘−1: Terminate unsuccessfully if 𝑘𝑘 = 0, or if 𝑘𝑘 = 1 and 0 ≤VAL 𝑙𝑙0 ≠ 𝑙𝑙0 & 1. If 𝑘𝑘 = 1 and VAL 𝑙𝑙0 < 0 , set VAL 𝑙𝑙0 ← 𝑙𝑙0 & 1, TLOC 𝑙𝑙0 ← 𝐹𝐹 , 𝐹𝐹 ← 𝐹𝐹 + 1. If 𝑘𝑘 > 1, set MEM 𝑐𝑐 + 𝑗𝑗 ← 𝑙𝑙0 for 0 ≤ 𝑗𝑗 < 𝑘𝑘 ; also MEM 𝑐𝑐 − 1 ← 𝑘𝑘, MEM 𝑐𝑐 − 2 ← 𝑊𝑊𝑙𝑙0 , 𝑊𝑊𝑙𝑙0 ← 𝑐𝑐, MEM 𝑐𝑐 − 3 ← 𝑊𝑊𝑙𝑙1 , 𝑊𝑊𝑙𝑙1 ← 𝑐𝑐, 𝑐𝑐 ← 𝑐𝑐 + 𝑘𝑘 + 3, Finally, set MINL ← MAXL ← 𝑐𝑐 + 2 (allowing two cells for extra data in the preamble of the first learned clause). Of course we must also ensure that MEM is large enough.
  • 49. Algorithm C p.68 (𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶). 0 0 0 0 1 0 -1 -1 -1 0 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] c1. [Initialize] c2. [Level complete?] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all literals forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1 if 𝐺𝐺 = 𝐹𝐹 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 c5. [New level?]
  • 50. Algorithm C p.68 (𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶). 0 0 0 0 1 0 -1 -1 -1 0 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] c1. [Initialize] c2. [Level complete?] c3. [Advance 𝐺𝐺.] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all literals forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1 if 𝐺𝐺 = 𝐹𝐹 𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1 for all c in the watch list of 𝑙𝑙̅ ⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔ 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 c7. [Resolveaconflict.] c5. [New level?] Exercise 261: The main loop of Algorithm C is the unit-propagation process of steps C3 and C4. Describe the low-level details of link adjustment, etc., to be done in those steps. (Throughout this answer, 𝑙𝑙𝑗𝑗 is an abbreviation for MEM 𝑐𝑐 + 𝑗𝑗 .) Set 𝑞𝑞 ← 0 and 𝑐𝑐 ← 𝑊𝑊𝑙𝑙̅. While 𝑐𝑐 ≠ 0, do the following: Set 𝑙𝑙𝑙 ← 𝑙𝑙0. If 𝑙𝑙′ ≠ 𝑙𝑙̅ (hence 𝑙𝑙1 = 𝑙𝑙̅), set 𝑐𝑐𝑐 ← 𝑙𝑙−3 ; otherwise set 𝑙𝑙𝑙 ← 𝑙𝑙1, 𝑙𝑙0← 𝑙𝑙𝑙, 𝑙𝑙1 ← 𝑙𝑙̅ , 𝑐𝑐𝑐 ← 𝑙𝑙−2, 𝑙𝑙−2 ← 𝑙𝑙−3, and 𝑙𝑙−3← 𝑐𝑐𝑐. If VAL 𝑙𝑙0 ≥ 0 and VAL 𝑙𝑙0 + 𝑙𝑙0 is even (that is, if 𝑙𝑙0 is true), perform the steps if 𝑞𝑞 ≠ 0, set MEM 𝑞𝑞 − 3 ← 𝑐𝑐, else set 𝑊𝑊𝑙𝑙̅ ← 𝑐𝑐 ; then set 𝑞𝑞 ← 𝑐𝑐. * Otherwise set 𝑗𝑗 ← 2; while 𝑗𝑗 < 𝑙𝑙−1 and VAL 𝑙𝑙𝑗𝑗 ≥ 0 and VAL 𝑙𝑙𝑗𝑗 + 𝑙𝑙𝑗𝑗 is odd, set 𝑗𝑗 = 𝐽𝐽 + 1. If now 𝑗𝑗 < 𝑗𝑗−1, set 𝑙𝑙1 ← 𝑙𝑙𝑗𝑗, 𝑙𝑙𝑗𝑗 ← 𝑙𝑙̅, 𝑙𝑙−3 ← 𝑊𝑊𝑙𝑙1 , 𝑊𝑊𝑙𝑙1 ← 𝑐𝑐. But if 𝑗𝑗 = 𝑙𝑙−1, do(*) above; jump to C7 if VAL 𝑙𝑙0 ≥ 0 ; otherwise set 𝐿𝐿𝐹𝐹 ← 𝑙𝑙0, etc. (see step C4) and 𝑐𝑐 ← 𝑐𝑐𝑐. Finally, when 𝑐𝑐 = 0, do(*) above to terminate 𝑙𝑙̅’s new watch list.
  • 51. Algorithm C p.68 (𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶). 0 0 0 0 1 0 -1 -1 -1 0 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] c1. [Initialize] c2. [Level complete?] c3. [Advance 𝐺𝐺.] c4. [Does 𝑐𝑐 forceaunit?] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all literals forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1 if 𝐺𝐺 = 𝐹𝐹 𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1 for all c in the watch list of 𝑙𝑙̅ 𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.) ⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔ if 𝑙𝑙0 is true ⇔ otherwise 𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋 with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false 𝑙𝑙0 false ⇔ 𝑙𝑙0 free 𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗 𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈 𝐿𝐿𝐹𝐹 ← 𝑙𝑙0 TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0 ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 c7. [Resolveaconflict.] c5. [New level?] Reason
  • 52. Algorithm C p.68 (𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶). 0 0 0 0 1 0 -1 -1 -1 0 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] c1. [Initialize] c2. [Level complete?] c3. [Advance 𝐺𝐺.] c4. [Does 𝑐𝑐 forceaunit?] c5. [New level?] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all literals forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1 if 𝐺𝐺 = 𝐹𝐹 𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1 for all c in the watch list of 𝑙𝑙̅ 𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.) ⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔ if 𝑙𝑙0 is true ⇔ otherwise 𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋 with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false 𝑙𝑙0 false ⇔ 𝑙𝑙0 free 𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗 𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈 𝐿𝐿𝐹𝐹 ← 𝑙𝑙0 TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0 ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f terminate succesfully prepare to purge excess clauses flush literals as expected ⇔ otherwise 𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹. 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 c7. [Resolveaconflict.]
  • 53. Algorithm C p.68 (𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶). 0 0 0 0 1 0 -1 -1 -1 0 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] c1. [Initialize] c2. [Level complete?] c3. [Advance 𝐺𝐺.] c4. [Does 𝑐𝑐 forceaunit?] c5. [New level?] c6. [Makeadecision.] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all literals forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1 if 𝐺𝐺 = 𝐹𝐹 𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1 for all c in the watch list of 𝑙𝑙̅ 𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.) ⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔ if 𝑙𝑙0 is true ⇔ otherwise 𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋 with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false 𝑙𝑙0 false ⇔ 𝑙𝑙0 free 𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗 𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈 𝐿𝐿𝐹𝐹 ← 𝑙𝑙0 TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0 ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f terminate succesfully prepare to purge excess clauses flush literals as expected ⇔ otherwise 𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹. 𝑘𝑘 ← HEAP 0 deletek from the heap if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠 𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1 𝐿𝐿𝐹𝐹 ← 𝑙𝑙 TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 c7. [Resolveaconflict.] Exercise 262 : What low-level operations underlie changes to the heap in steps C6-C8? Otherwise set 𝑖𝑖 ← HEAP ℎ , 𝛼𝛼 ←ACT 𝑖𝑖 , 𝑗𝑗 ← 0, 𝑗𝑗𝑗 ← 1, and do the following while 𝑗𝑗𝑗 < ℎ: Set 𝛼𝛼′ ← ACT HEAP 𝑗𝑗𝑗 ; if 𝑗𝑗𝑗 + 1 < ℎ and ACT HEAP 𝑗𝑗′ + 1 > α′ , set 𝑗𝑗′ ← 𝑗𝑗𝑗 + 1 and 𝛼𝛼′ ← ACT HEAP 𝑗𝑗𝑗 ; if 𝛼𝛼 > 𝛼𝛼′, set 𝑗𝑗𝑗 ← ℎ, otherwise set HEAP[ 𝑗𝑗 ] ← HEAP[𝑗𝑗𝑗], HLOC HEAP[ 𝑗𝑗𝑗 ] ← 𝑗𝑗 , 𝑗𝑗 ← 𝑗𝑗𝑗, and 𝑗𝑗𝑗 ← 2𝑗𝑗 + 1. Then set HEAP[ 𝑗𝑗] ← 𝑖𝑖 and HLOC(𝑖𝑖 ) ← 𝑗𝑗. To delete 𝑘𝑘 = HEAP 0 in C6: Set ℎ ← ℎ − 1 and HLOC 𝑘𝑘 ← −1. Stop if ℎ = 0.
  • 54. Algorithm C p.68 (𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶). 0 0 0 0 1 0 -1 -1 -1 0 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] c1. [Initialize] c2. [Level complete?] c3. [Advance 𝐺𝐺.] c4. [Does 𝑐𝑐 forceaunit?] c5. [New level?] c6. [Makeadecision.] c7. [Resolveaconflict.] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all literals forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1 if 𝐺𝐺 = 𝐹𝐹 𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1 for all c in the watch list of 𝑙𝑙̅ 𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.) ⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔ if 𝑙𝑙0 is true ⇔ otherwise 𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋 with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false 𝑙𝑙0 false ⇔ 𝑙𝑙0 free 𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗 𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈 𝐿𝐿𝐹𝐹 ← 𝑙𝑙0 TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0 ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f terminate succesfully prepare to purge excess clauses flush literals as expected ⇔ otherwise 𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹. 𝑘𝑘 ← HEAP 0 deletek from the heap if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠 𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1 𝐿𝐿𝐹𝐹 ← 𝑙𝑙 TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1 if 𝑤𝑤 = 0 ⇔ otherwise terminate unsuccesfully use the conflictclause 𝑐𝑐 to construct 𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ …∨ 𝑏𝑏�𝑟𝑟 ACT( 𝑙𝑙 ) ← ACT( 𝑙𝑙 ) +DEL for all literals 𝑙𝑙 stampedset d' to the max. level occupied by 𝑏𝑏1,… , 𝑏𝑏𝑟𝑟 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 (Increasing ACT 𝑙𝑙 may change HEAP.) In C7, set 𝑘𝑘 ← 𝑙𝑙 , 𝛼𝛼 ← ACT(𝑘𝑘), ACT( 𝑘𝑘) ← α +DEL, 𝑗𝑗 ← HLOC(𝑘𝑘), and if 𝑗𝑗 > 0 perform the "siftup" operation: "Looping repeatedly, set 𝑗𝑗𝑗 ← (𝑗𝑗 − 1) ≫ 1 and 𝑖𝑖 ←HEAP[𝑗𝑗𝑗], exit if ACT(𝑖𝑖) ≥ α, else set HEAP 𝑗𝑗 ← 𝑖𝑖, HLOC(𝑖𝑖) ← 𝑗𝑗 , 𝑗𝑗 ← 𝑗𝑗𝑗, and exit if 𝑗𝑗 = 0. Then set HEAP[ 𝑗𝑗] ← 𝑘𝑘 and HLOC(𝑘𝑘) ← 𝑗𝑗." Exercise 262 : What low-level operations underlie changes to the heap in steps C6-C8?
  • 55. Algorithm C p.68 (𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶). 0 0 0 0 1 0 -1 -1 -1 0 -1 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] c1. [Initialize] c2. [Level complete?] c3. [Advance 𝐺𝐺.] c4. [Does 𝑐𝑐 forceaunit?] c5. [New level?] c6. [Makeadecision.] c7. [Resolveaconflict.] c8. [Backjump.] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all literals forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1 if 𝐺𝐺 = 𝐹𝐹 𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1 for all c in the watch list of 𝑙𝑙̅ 𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.) ⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔ if 𝑙𝑙0 is true ⇔ otherwise 𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋 with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false 𝑙𝑙0 false ⇔ 𝑙𝑙0 free 𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗 𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈 𝐿𝐿𝐹𝐹 ← 𝑙𝑙0 TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0 ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f terminate succesfully prepare to purge excess clauses flush literals as expected ⇔ otherwise 𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹. 𝑘𝑘 ← HEAP 0 deletek from the heap if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠 𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1 𝐿𝐿𝐹𝐹 ← 𝑙𝑙 TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1 if 𝑤𝑤 = 0 ⇔ otherwise terminate unsuccesfully use the conflictclause 𝑐𝑐 to construct 𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ …∨ 𝑏𝑏�𝑟𝑟 ACT( 𝑙𝑙 ) ← ACT( 𝑙𝑙 ) +DEL for all literals 𝑙𝑙 stampedset d' to the max. level occupied by 𝑏𝑏1,… , 𝑏𝑏𝑟𝑟 while 𝐹𝐹 > 𝑐𝑐𝑑𝑑′+1 𝐹𝐹 ← 𝐹𝐹 − 1 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 (Increasing ACT 𝑙𝑙 may change HEAP.) 𝑙𝑙 ← 𝐿𝐿𝐹𝐹𝑘𝑘 ← 𝑙𝑙 OVAL(𝑘𝑘) ← VAL 𝑘𝑘𝑅𝑅𝑙𝑙 ← Λ if HLOC 𝑙𝑙 < 0 insert 𝑘𝑘 into HEAP. 𝐺𝐺 ← 𝐹𝐹𝑤𝑤 ← 𝑤𝑤𝑙 Exercise 262 : What low-level operations underlie changes to the heap in steps C6-C8? To insert 𝑘𝑘 in C8, set 𝛼𝛼 ← ACT(𝑘𝑘), 𝑗𝑗 ← ℎ, ℎ ← ℎ + 1; if 𝑗𝑗 = 0 set HEAP 0 ← 𝑘𝑘 and HLOC(𝑘𝑘) ← 0; otherwise perform the siftup operation.
  • 56. Algorithm C p.68 (𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶). 0 0 0 0 1 0 -1 -1 -1 0 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] c1. [Initialize] c2. [Level complete?] c3. [Advance 𝐺𝐺.] c4. [Does 𝑐𝑐 forceaunit?] c5. [New level?] c6. [Makeadecision.] c7. [Resolveaconflict.] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all literals forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1 if 𝐺𝐺 = 𝐹𝐹 𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1 for all c in the watch list of 𝑙𝑙̅ 𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.) ⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔ if 𝑙𝑙0 is true ⇔ otherwise 𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋 with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false 𝑙𝑙0 false ⇔ 𝑙𝑙0 free 𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗 𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈 𝐿𝐿𝐹𝐹 ← 𝑙𝑙0 TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0 ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f terminate succesfully prepare to purge excess clauses flush literals as expected ⇔ otherwise 𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹. 𝑘𝑘 ← HEAP 0 deletek from the heap if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠 𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1 𝐿𝐿𝐹𝐹 ← 𝑙𝑙 TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1 if 𝑤𝑤 = 0 ⇔ otherwise terminate unsuccesfully use the conflictclause 𝑐𝑐 to construct 𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ …∨ 𝑏𝑏�𝑟𝑟 ACT( 𝑙𝑙 ) ← ACT( 𝑙𝑙 ) +DEL for all literals 𝑙𝑙 stampedset d' to the max. level occupied by 𝑏𝑏1,… , 𝑏𝑏𝑟𝑟 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 (Increasing ACT 𝑙𝑙 may change HEAP.) Exercise 263: Write out the gory details by which step C7 constructs a new clause and step C9 puts it into the data structures of Algorithm C. (This answer also sets the level stamps LS [𝑑𝑑] needed in answer 257, assuming that the LS array is initially zero.) Let “ bump 𝑙𝑙 " mean “ increase ACT 𝑙𝑙 by DEL" as in answer 262. Also let 𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏(𝑙𝑙) be the following subroutine: "If S 𝑙𝑙 = 𝑠𝑠 , do nothing. Otherwise set S 𝑙𝑙 ← 𝑠𝑠, 𝑝𝑝 ← 𝑙𝑙𝑙𝑙𝑙𝑙 (𝑙𝑙). If 𝑝𝑝 > 0, bump 𝑙𝑙 ; then if 𝑝𝑝 = 𝑑𝑑, set 𝑞𝑞 ← 𝑞𝑞 + 1; else set 𝑟𝑟 ← 𝑟𝑟 + 1, 𝑏𝑏𝑟𝑟 ← 𝑙𝑙̅, 𝑑𝑑𝑑 ← max(𝑑𝑑𝑑, 𝑝𝑝), and if LS[𝑝𝑝] ≤ 𝑠𝑠 set LS 𝑝𝑝 ← 𝑠𝑠 + LS[𝑝𝑝] = 𝑠𝑠 ."
  • 57. Algorithm C p.68 (𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶). 0 0 0 0 1 0 -1 -1 -1 0 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] c1. [Initialize] c2. [Level complete?] c3. [Advance 𝐺𝐺.] c4. [Does 𝑐𝑐 forceaunit?] c5. [New level?] c6. [Makeadecision.] c7. [Resolveaconflict.] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all literals forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1 if 𝐺𝐺 = 𝐹𝐹 𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1 for all c in the watch list of 𝑙𝑙̅ 𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.) ⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔ if 𝑙𝑙0 is true ⇔ otherwise 𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋 with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false 𝑙𝑙0 false ⇔ 𝑙𝑙0 free 𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗 𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈 𝐿𝐿𝐹𝐹 ← 𝑙𝑙0 TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0 ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f terminate succesfully prepare to purge excess clauses flush literals as expected ⇔ otherwise 𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹. 𝑘𝑘 ← HEAP 0 deletek from the heap if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠 𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1 𝐿𝐿𝐹𝐹 ← 𝑙𝑙 TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1 if 𝑤𝑤 = 0 ⇔ otherwise terminate unsuccesfully use the conflictclause 𝑐𝑐 to construct 𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ …∨ 𝑏𝑏�𝑟𝑟 ACT( 𝑙𝑙 ) ← ACT( 𝑙𝑙 ) +DEL for all literals 𝑙𝑙 stampedset d' to the max. level occupied by 𝑏𝑏1,… , 𝑏𝑏𝑟𝑟 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 (Increasing ACT 𝑙𝑙 may change HEAP.) Exercise 263: Write out the gory details by which step C7 constructs a new clause and step C9 puts it into the data structures of Algorithm C. When step C7 is entered from C4, assuming that 𝑑𝑑 > 0, set 𝑑𝑑𝑑 ← 𝑞𝑞 ← 𝑟𝑟 ← 0, 𝑠𝑠 ← 𝑠𝑠 + 3, S( 𝑙𝑙0 ) ← 𝑠𝑠, bump 𝑙𝑙0, and do 𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏(𝑙𝑙𝑗𝑗) for 1 ≤ 𝑗𝑗 < 𝑘𝑘. Also set 𝑡𝑡 ← max( TLOC 𝑙𝑙1 ,…,TLOC 𝑙𝑙𝑘𝑘−1 ). Then, while 𝑞𝑞 > 0, set 𝑙𝑙 ← 𝑙𝑙𝑡𝑡, 𝑡𝑡 ← 𝑡𝑡 − 1; if S 𝑙𝑙 = 𝑠𝑠 then set 𝑞𝑞 ← 𝑞𝑞 − 1, and if 𝑅𝑅𝑙𝑙 ≠ Λ let clause 𝑅𝑅𝑙𝑙 be 𝑙𝑙0 𝑙𝑙1 … 𝑙𝑙𝑘𝑘−1 and do 𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏(𝑙𝑙𝑗𝑗) for 1 ≤ 𝑗𝑗 < 𝑘𝑘. Finally set 𝑙𝑙′ ← 𝐿𝐿𝑡𝑡 , and while S 𝑙𝑙𝑙 ≠ 𝑠𝑠 set 𝑡𝑡 ← 𝑡𝑡 − 1 and 𝑙𝑙′ ← 𝐿𝐿𝑡𝑡.
  • 58. Algorithm C p.68 (𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶). 0 0 0 0 1 0 -1 -1 -1 0 -1 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] c1. [Initialize] c2. [Level complete?] c3. [Advance 𝐺𝐺.] c4. [Does 𝑐𝑐 forceaunit?] c5. [New level?] c6. [Makeadecision.] c7. [Resolveaconflict.] c8. [Backjump.] c9. [Learn.] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all literals forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1 if 𝐺𝐺 = 𝐹𝐹 𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1 for all c in the watch list of 𝑙𝑙̅ 𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.) ⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔ if 𝑙𝑙0 is true ⇔ otherwise 𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋 with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false 𝑙𝑙0 false ⇔ 𝑙𝑙0 free 𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗 𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈 𝐿𝐿𝐹𝐹 ← 𝑙𝑙0 TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0 ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f terminate succesfully prepare to purge excess clauses flush literals as expected ⇔ otherwise 𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹. 𝑘𝑘 ← HEAP 0 deletek from the heap if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠 𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1 𝐿𝐿𝐹𝐹 ← 𝑙𝑙 TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1 if 𝑤𝑤 = 0 ⇔ otherwise terminate unsuccesfully use the conflictclause 𝑐𝑐 to construct 𝑙𝑙𝑙� ∨ 𝑏𝑏�1 ∨ …∨ 𝑏𝑏�𝑟𝑟 ACT( 𝑙𝑙 ) ← ACT( 𝑙𝑙 ) +DEL for all literals 𝑙𝑙 stampedset d' to the max. level occupied by 𝑏𝑏1,… , 𝑏𝑏𝑟𝑟 while 𝐹𝐹 > 𝑐𝑐𝑑𝑑′+1 𝐹𝐹 ← 𝐹𝐹 − 1 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 (Increasing ACT 𝑙𝑙 may change HEAP.) 𝑙𝑙 ← 𝐿𝐿𝐹𝐹𝑘𝑘 ← 𝑙𝑙 OVAL(𝑘𝑘) ← VAL 𝑘𝑘𝑅𝑅𝑙𝑙 ← Λ if HLOC 𝑙𝑙 < 0 insert 𝑘𝑘 into HEAP. 𝐺𝐺 ← 𝐹𝐹𝑤𝑤 ← 𝑤𝑤𝑙 set 𝑐𝑐 ←MAXL If 𝑤𝑤 > 0 store the new clause in MEM at position 𝑐𝑐 advance MAXL to the next available position in MEM 𝑀𝑀 ← 𝑀𝑀 + 1𝐿𝐿𝐹𝐹 ← 𝑙𝑙𝑙 TLOC( 𝑙𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙′ ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 DEL←DEL/𝜌𝜌 Exercise 263: Write out the gory details by which step C7 constructs a new clause and step C9 puts it into the data structures of Algorithm C. The new clause can now be checked for redundancies as in answer 257. To install it during step C9, there's a subtle point: We must watch a literal that was defined on level 𝑑𝑑𝑑. Thus we set 𝑐𝑐 ← MAXL, MEM[𝑐𝑐] ← 𝑙𝑙̅ ′ , 𝑘𝑘 ← 0, 𝑗𝑗 ′ ← 1; and for 1 ≤ 𝑗𝑗 ≤ 𝑟𝑟 if S 𝑏𝑏𝑗𝑗 = 𝑠𝑠 set 𝑘𝑘 ← 𝑘𝑘 + 1 and do this: If 𝑗𝑗𝑗 = 0 or 𝑙𝑙𝑙𝑙𝑙𝑙( 𝑏𝑏𝑗𝑗 ) < 𝑑𝑑𝑑, Set MEM[𝑐𝑐 + 𝑘𝑘 + 𝑗𝑗′] ← 𝑏𝑏�𝑗𝑗, otherwise set MEM[𝑐𝑐 + 1] ← 𝑏𝑏�𝑗𝑗, 𝑗𝑗′ ← 0, MEM 𝑐𝑐 − 2 ← 𝑊𝑊𝑙𝑙 𝑙�, 𝑊𝑊𝑙𝑙 𝑙� ← 𝑐𝑐, MEM[𝑐𝑐 − 3] ← 𝑊𝑊𝑏𝑏�𝑗𝑗 , 𝑊𝑊𝑏𝑏�𝑗𝑗 ← 𝑐𝑐. Finally set MEM[𝑐𝑐 − 1] ← 𝑘𝑘 + 1, MAXL← 𝑐𝑐 + 𝑘𝑘 + 6.
  • 59. Algorithm C p.68 (𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 𝑏𝑏𝑏𝑏 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶). 0 0 0 0 1 0 -1 -1 -1 0 MEM[ ] 𝑊𝑊 S(𝑘𝑘) VAL(𝑘𝑘) OVAL(𝑘𝑘) TLOC(𝑘𝑘) HLOC(𝑘𝑘) ACT(𝑘𝑘) HEAP[ ] c1. [Initialize] c2. [Level complete?] c3. [Advance 𝐺𝐺.] c4. [Does 𝑐𝑐 forceaunit?] c5. [New level?] c6. [Makeadecision.] 𝐹𝐹𝐺𝐺𝐿𝐿 𝑀𝑀𝑅𝑅𝑐𝑐𝑤𝑤𝑐𝑐𝑘𝑘 𝑠𝑠 𝑅𝑅2𝑘𝑘 ← 𝑅𝑅2𝑘𝑘+1 ← Λ 𝑝𝑝𝑘𝑘 − 1 𝑝𝑝𝑘𝑘 − 1 ← 𝑘𝑘1 ≤ 𝑘𝑘 ≤ 𝑛𝑛 MINL and MAXL to 1st available position 𝑐𝑐0 ← 0 DEL 𝑐 𝑛𝑛 𝐿𝐿0 … 𝐿𝐿𝐹𝐹−1 contains all literals forcedby 𝐿𝐿0 … 𝐿𝐿 𝐺−1 if 𝐺𝐺 = 𝐹𝐹 𝑙𝑙 ← 𝐿𝐿 𝐺 𝐺𝐺 = 𝐺𝐺 + 1 for all c in the watch list of 𝑙𝑙̅ 𝑙𝑙0𝑙𝑙1...𝑙𝑙𝑘𝑘−1be the literals of clause 𝑐𝑐, where 𝑙𝑙1=𝑙𝑙̅.(Swap 𝑙𝑙0 ↔ 𝑙𝑙1if necessary.) ⇔ 𝐝𝐞𝐭𝐞𝐜𝐭𝐬 𝐚 𝐜𝐨𝐧𝐟𝐥𝐢𝐜𝐭if no conflict ⇔ if 𝑙𝑙0 is true ⇔ otherwise 𝐥𝐨𝐨𝐤 𝐟𝐨𝐫 𝐚 𝐥𝐢𝐭𝐞𝐫𝐚𝐥 𝒍 𝒋 with 1 < 𝑗𝑗 < 𝑘𝑘 that is not false found ⇔ 𝑙𝑙2...𝑙𝑙𝑘𝑘−1all false 𝑙𝑙0 false ⇔ 𝑙𝑙0 free 𝐦𝐨𝐯𝐞 𝒄 to the watch list of 𝑙𝑙𝑗𝑗 𝐦𝐚𝐤𝐞 𝐢𝐭 𝐭𝐫𝐮𝐞 𝐛𝐲 𝒔𝒔𝒆𝒕𝒕𝒊𝒏𝒈 𝐿𝐿𝐹𝐹 ← 𝑙𝑙0 TLOC( 𝑙𝑙0 ) ← 𝐹𝐹VAL( 𝑙𝑙0 ) ← 2𝑤𝑤+ 𝑙𝑙0&1𝑅𝑅𝑙𝑙0 ← 𝑐𝑐𝐹𝐹 ← 𝐹𝐹 + 1 if 𝐹𝐹 = 𝑛𝑛 ⇔ if 𝑀𝑀 ≥ 𝑀𝑀p ⇔ if 𝑀𝑀 ≥ 𝑀𝑀f terminate succesfully prepare to purge excess clauses flush literals as expected ⇔ otherwise 𝑤𝑤 ← 𝑤𝑤 + 1𝑐𝑐𝑑𝑑 ← 𝐹𝐹. 𝑘𝑘 ← HEAP 0 deletek from the heap if VAL 𝑘𝑘 ≥ 0 ⇔ 𝐵𝐵𝑡𝑡𝑐𝑠𝑠𝑃𝑃 𝑤𝑤𝑐𝑐𝑠𝑠𝑠𝑠 𝑙𝑙 ← 2𝑘𝑘 + OVAL 𝑘𝑘 &1 VAL(𝑘𝑘) ← 2𝑤𝑤 + OVAL 𝑘𝑘 &1 𝐿𝐿𝐹𝐹 ← 𝑙𝑙 TLOC( 𝑙𝑙 ) ← 𝐹𝐹𝑅𝑅𝑙𝑙 ← Λ𝐹𝐹 ← 𝐹𝐹 + 1 𝐏𝐮𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐮𝐧𝐢𝐭 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into 𝐿𝐿0 … 𝐿𝐿𝐹𝐹 −1 But 𝐭𝐞𝐫𝐧𝐢𝐦𝐚𝐭𝐞 𝐮𝐧𝐬𝐮𝐜𝐜𝐞𝐬𝐟𝐮𝐥𝐥𝐲 if clause 𝑙𝑙 and 𝑙𝑙𝑙 contradiction 𝐢𝐧𝐩𝐮𝐭 𝐭𝐡𝐞 𝐜𝐥𝐚𝐮𝐬𝐞𝐬 into MEM and the watch list 𝑝𝑝1 … 𝑝𝑝𝑛𝑛 is a random permutation of 1,… , 𝑛𝑛 c7. [Resolveaconflict.] Exercise 266 : CDCL solvers are often designed to make decisions at random, with a small probability 𝑝𝑝 (say 𝑝𝑝 = .02), instead of always choosing a variable of maximum activity. How would this policy change step C6? If 𝑈𝑈 < 𝑝𝑝, where 𝑈𝑈 is a uniform deviate between 0 and 1, do this: Set 𝑗𝑗 to a random integer with 0 ≤ 𝑗𝑗 < ℎ, and 𝑘𝑘 ←HEAP[𝑗𝑗]. If 𝑗𝑗 = 0, or if VAL(𝑘𝑘) ≥ 0, use the normal C6. Otherwise branch on 𝑘𝑘 (and don't bother to remove 𝑘𝑘 from the heap).
  • 60. Reality check Random choices make the running time of this algorithm more variable than it was in Algorithms A, B, D, or L; sometimes we're lucky, sometimes we're not. The running time of Algorithms A, B, D, and L on 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓(𝑞𝑞) is proportional to 2𝑞𝑞 , so it's way off the chart well over a gigamem already when 𝑞𝑞 = 19. But Algorithm C polishes off the case 𝑞𝑞 = 99 in that same amount of time (thus winning by 24 orders of magnitude)! On the other hand, no satisfactory theoretical explanation for the apparently linear behavior in Fig. is presently known. Computation times (in megamems) are shown for nine trials at each value of 𝑞𝑞. Algorithm C often speeds things up much more dramatically, in fact. For example, how it whips through a sequence of three-coloring problems based on "flower snarks." It is not possible to color the edges of the flower snark graph 𝐽𝐽𝑞𝑞 with three colors, when 𝑞𝑞 is odd. p.69