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

72
The Art of Computer Programming 7.2.2.2 Satisfiability p.47-76 VOLUME 4 FASCICLE 6

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

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

The Art of Computer Programming

7.2.2.2 Satisfiability p.47-76

VOLUME 4 FASCICLE 6

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

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

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

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

2353 = 80

15

20

๐‘ž๐‘ž๐‘š๐‘š = ๐‘„๐‘„๐‘š๐‘š๐‘๐‘๐‘š๐‘š

โˆ’1

p.47

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

๐‘ฅ๐‘ฅ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

2353 = 80

15

20

<

๐‘ž๐‘ž๐‘š๐‘š = ๐‘„๐‘„๐‘š๐‘š๐‘๐‘๐‘š๐‘š

โˆ’1

p.47

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

๐‘ฅ๐‘ฅ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

2353 = 80

27

20

๐‘ž๐‘ž๐‘š๐‘š = ๐‘„๐‘„๐‘š๐‘š๐‘๐‘๐‘š๐‘š

โˆ’1

p.47

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

๐‘ž๐‘ž๐‘š๐‘š = ๐‘„๐‘„๐‘š๐‘š๐‘๐‘๐‘š๐‘š

โˆ’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

2353 = 80

27

20

<

p.47

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

๐‘ฅ๐‘ฅ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

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

๐‘ฅ๐‘ฅ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.

๐‘๐‘๐‘š๐‘š =

803

๐‘ž๐‘ž๐‘š๐‘š = ๐‘„๐‘„๐‘š๐‘š๐‘๐‘๐‘š๐‘š

โˆ’1

๐‘ž๐‘ž๐‘š๐‘š = Pr(๐‘š๐‘š clauses, distinct but otherwise selected at random, are satisfiable)

๐‘„๐‘„3 = ๏ฟฝ

p.47

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

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.

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

๐‘ž๐‘ž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 ใง๏ผŒ๏ผณ๏ผก๏ผดๅฏ่ƒฝใช ๆœ€ๅคงใฎ ๐‘š๐‘š = 2๐‘˜๐‘˜ โˆ’ 1 ๐‘›๐‘›

๐‘˜๐‘˜= 1 โˆ’ 2โˆ’๐‘˜๐‘˜ ๐‘๐‘

ใฏ 70๏ผŽ ใƒฉใƒณใƒ€ใƒ ใช70็ฏ€ใฎCNFใŒ๐‘„๐‘„70ใง SATใชๅ ดๅˆใฏๅๅˆ†ใ‚ใ‚Šๅพ—ใ‚‹๏ผŽ

๐‘š๐‘š ใŒๅข—ใˆใ‚‹ใซใคใ‚Œ ๐‘ž๐‘ž๐‘š๐‘š ใŒ้™ใ‚Šใชใ 0 ใซ่ฟ‘ใฅใใชใ‹ใง๏ผŒ ๅๅทฎใ‚’่€ƒๆ…ฎใ—ใŸ ๐‘‡๐‘‡๐‘š๐‘š ใŒ 1 ใ‚’ๅ–ใ‚‹ใ‚ˆใ†ใช ๐‘š๐‘š ใซๆณจ็›ฎใ™ใ‚‹๏ผŽ

p.48

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

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

๏ผณ๏ผก๏ผดใŒใปใผ 1 ใ—ใ‹ใชใใชใ‚‹ ๐‘š๐‘š ใจ๏ผŒ ๅ…จใฆ๏ผต๏ผฎ๏ผณ๏ผก๏ผดใซใชใ‚Šๅง‹ใ‚ใ‚‹ ๐‘š๐‘š ใฏ ใปใผไธ€่‡ดใ™ใ‚‹๏ผŽ

2โˆ’๐‘˜๐‘˜๐‘๐‘๏ฟฝ๐‘ƒ๐‘ƒ๐‘ƒ๐‘ƒ ๐‘‡๐‘‡๐‘š๐‘š = 1๐‘๐‘ โˆ’๐‘š๐‘š

โ‰ˆ 0.8853๐‘š๐‘š

ไธ€็•ชๆœ€ๆœŸใฎ๏ผณ๏ผก๏ผด้›†ๅˆใฎ็ดฏ็ฉ๏ผŽ

E๐‘ƒ๐‘ƒ = ๏ฟฝ ๐‘ž๐‘ž๐‘š๐‘š๐‘š๐‘š

E๐‘ƒ๐‘ƒ2 = ๏ฟฝ 2๐‘š๐‘š + 1๐‘š๐‘š

๐‘ž๐‘ž๐‘š๐‘š

p.48

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

๐‘๐‘๐‘š๐‘š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 ใ‚‚ๅฏใชใฎใง๏ผณ๏ผก๏ผดใฏๅข—ใˆใ‚‹๏ผŽ

โ€œ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

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

๐›ผ๐›ผ๐‘˜๐‘˜: 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 22 + ๐‘‚๐‘‚ 2โˆ’

๐‘˜๐‘˜3

2๐‘˜๐‘˜ ln 2 โˆ’ ๐‘‚๐‘‚ ๐‘˜๐‘˜ ๐‘›๐‘› ใชใƒฉใƒณใƒ€ใƒ  ๐‘˜๐‘˜SAT ใฏ๏ผŒใƒ™ใ‚ฏใƒˆใƒซ ๐‘ฅ๐‘ฅ ; ฮฝ๐‘ฅ๐‘ฅ โ‰ˆ ๐‘›๐‘›2

ใง๏ผŒใปใผๅธธใซๅ……่ถณใ™ใ‚‹๏ผŽ exercise 195

lim๐‘›๐‘›โ†’โˆž

๐‘†๐‘†๐‘˜๐‘˜ ๐›ผ๐›ผ๐‘˜๐‘˜ ๐‘›๐‘› โˆ’ ๐œ–๐œ– ๐‘›๐‘› ,๐‘›๐‘› = 1, lim๐‘›๐‘›โ†’โˆž

๐‘†๐‘†๐‘˜๐‘˜ ๐›ผ๐›ผ๐‘˜๐‘˜ ๐‘›๐‘› + ๐œ–๐œ– ๐‘›๐‘› ,๐‘›๐‘› = 0, ๐‘˜๐‘˜ โ‰ฅ 2 ใซใŠใ„ใฆ

ใจใชใ‚‹้–ขๆ•ฐ๐›ผ๐›ผ๐‘˜๐‘˜ ๐‘›๐‘› ใŒๅญ˜ๅœจใ™ใ‚‹๏ผŽ ๐œ€๐œ€ โˆถ ไปปๆ„ใฎๆญฃใฎๆ•ฐ

๐›ผ๐›ผ๐‘˜๐‘˜ ๐‘›๐‘› ใฏ๏ผŒฮ˜ 2๐‘˜๐‘˜ ใงๆŠผใ•ใˆใ‚‰ใ‚Œ๏ผŒ๐‘˜๐‘˜ใŒๅๅˆ†ใซๅคงใใ„ๆ™‚ ๅฎšๆ•ฐใซใชใ‚‹๏ผŽ

p.50

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

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,๐‘›๐‘›

๏ผญ๏ผฐ๏ผฒ ๏ผ’๏ผ‘ ๏ผ’๏ผ’ ใ€€ใ€€ใ€€ใ€€ใ€€้ž่ฒ ใฎ็ขบ็Ž‡ๅค‰ๆ•ฐ ๐‘‹๐‘‹ ใซใŠใ„ใฆ Pr ๐‘‹๐‘‹ > 0 โ‰ค E๐‘‹๐‘‹; โ€œthe first moment principleโ€ Pr (๐‘‹๐‘‹ > 0) โ‰ฅ E๐‘‹๐‘‹ 2/ E๐‘‹๐‘‹2 โ€œthe second moment principleโ€ ๅ……่ถณ็ขบ็Ž‡ใฎ้–พๅ€คใ‚’ๆœ‰็•Œใจใฟใชใ—ใฆ ่จผๆ˜Žใ‚’ๅฐŽใ๏ผŽ

p.51

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

๐‘ฅ๐‘ฅ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

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

๏ฟฝฬ…๏ฟฝ๐‘ฅ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

ไธ€ๅฏพๆœ‰ๅ‘ใ‚ฐใƒฉใƒ•ใ‹ใ‚‰๏ผŒ ๅผท้€ฃ็ตๆˆๅˆ†ใธใฎ ่ปข็งปใจ๏ผณ๏ผก๏ผดใฎ้–ข้€ฃๆ€ง๏ผŸ

p.50

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

โ€œ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

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

โ€œ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

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

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

๐‘›๐‘›

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

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)

๐‘‚๐‘‚ ๐‘›๐‘›โˆ’130 โ‰ฅ 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)

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

p.50

Stirling ๆ•ฐ 1.2.6

๐‘ฅ๐‘ฅใฎ็ดฏไน—ใง่กจ็พใ•ใ‚Œใฆใ„ใ‚‹ๅคš้ …ๅผใ‹ใ‚‰๏ผŒ ไบŒ้ …ไฟ‚ๆ•ฐใง่กจ็พใ•ใ‚Œใฆใ„ใ‚‹ๅคš้ …ๅผใธใฎๅค‰ๆ›ใงไฝฟใ‚ใ‚Œใ‚‹ไฟ‚ๆ•ฐ

๐‘›๐‘›๐‘˜๐‘˜ : ๐‘˜๐‘˜ๆœฌใฎ้–‰่ทฏใ‚’ใ‚‚ใค๐‘›๐‘›ๅ€‹ใฎๆ–‡ๅญ—ใฎ้ †ๅˆ— ็ฌฌไธ€็จฎ

๐‘›๐‘›๐‘˜๐‘˜

: ๐‘›๐‘›ๅ€‹ใฎ่ฆ็ด ใ‚’ๆŒใค้›†ๅˆใ‚’ ๐‘˜๐‘˜ๅ€‹ใฎ่ฆ็ด ใ‚’ๆŒใค ็•ฐใชใ‚‹้ƒจๅˆ†้›†ๅˆใซๅˆ†ๅ‰ฒใ™ใ‚‹ๆ–นๆณ•ใฎๆ•ฐ

็ฌฌไบŒ็จฎ

้šŽไน—ๅ†ชโ†’้€šๅธธใฎๅ†ช

้€šๅธธใฎๅ†ชโ†’้šŽไน—ๅ†ช

๐‘ฅ๐‘ฅ๐‘›๐‘› = ๐‘ฅ๐‘ฅ ๐‘ฅ๐‘ฅ โˆ’ 1 โ€ฆ (๐‘ฅ๐‘ฅ โˆ’ ๐‘›๐‘› + 1) = ๏ฟฝ โˆ’1 ๐‘›๐‘›โˆ’๐‘˜๐‘˜ ๐‘›๐‘›๐‘˜๐‘˜

๐‘˜๐‘˜

๐‘ฅ๐‘ฅ๐‘˜๐‘˜

๐‘ฅ๐‘ฅ๐‘›๐‘› = ๏ฟฝ ๐‘›๐‘›๐‘˜๐‘˜

๐‘˜๐‘˜

๐‘ฅ๐‘ฅ๐‘˜๐‘˜

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

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๏ฟฝ

๐œ–๐œ–

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

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.

๏ผณ๏ผก๏ผดใ‚’ๅ้งใ‚นใƒ†ใƒƒใƒ—ใฎ ๆœ€ๅฐๅŒ–ๅ•้กŒใซ็ฝฎใๆ›ฟใˆใ‚‹๏ผŽ

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

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๏ฟฝ,๐‘‡๐‘‡๐‘‡๐‘‡3 end ๐น๐น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

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

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๏ฟฝ,๐‘‡๐‘‡๐‘‡๐‘‡3 end ๐น๐น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ใŒไฝ•็‚น็ฒๅพ—ใงใใฆใ„ใ‚‹ใ‹ใŒๅ‹่ฒ ๏ผŽ

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

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ใŒ * ๅฎฃ่จ€ใ™ใ‚‹ๆˆฆ็•ฅ

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

Theorem R p.56

P

D

* 1P

๐‘—๐‘—๐‘š๐‘šโˆ’3 ๐‘†๐‘† = ๐‘—๐‘—1, โ€ฆ ,

๏ฟฝฬ…๏ฟฝ๐‘ฅ๐‘—๐‘—๐‘—๐‘— ,

(๏ฟฝฬ…๏ฟฝ๐‘ฅ๐‘–๐‘–๐‘—๐‘— โˆจ ๏ฟฝฬ…๏ฟฝ๐‘ฅ๐‘—๐‘—๐‘˜๐‘˜ โˆจ ๐‘ฅ๐‘ฅ๐‘–๐‘–๐‘˜๐‘˜),

(๐‘ฅ๐‘ฅ๐‘—๐‘—1 โˆจ ๐‘ฅ๐‘ฅ๐‘—๐‘—2 โˆจ โ‹ฏโˆจ ๐‘ฅ๐‘ฅ๐‘—๐‘—๐‘š๐‘š)

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๐‘š๐‘šโ‹ฎ โ‹ฑ โ‹ฎ

๐‘ฅ๐‘ฅ๐‘š๐‘š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.

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

Lower bounds for general resolution. p.57

4.6.3 ๅŠ ็ฎ—้€ฃ้Ž– 1 = ๐‘๐‘0, ๐‘๐‘1, โ€ฆ , ๐‘๐‘๐‘Ÿ๐‘Ÿ= ๐‘›๐‘› ใŸใ ใ—ๅ„่ฆ็ด ใฏ๏ผŒใ™ในใฆใฎ i=1,2,โ€ฆ,r ใซใคใ„ใฆ ใ‚ใ‚‹ ๐‘˜๐‘˜ โ‰ค ๐‘—๐‘— < ๐‘๐‘ ใซๅฏพใ—ใฆ๏ผŒ ๐‘๐‘๐‘–๐‘– = ๐‘๐‘๐‘—๐‘— + ๐‘๐‘๐‘˜๐‘˜

7.1.2 ๐ต๐ต๐ต๐ต๐ต๐ต๐‘™๐‘™๐‘ ๐‘ ้€ฃ้Ž– ๐‘›๐‘›ๅค‰ๆ•ฐ(๐‘ฅ๐‘ฅ1,โ€ฆ,๐‘ฅ๐‘ฅ๐‘›๐‘›)ใฎ้–ขๆ•ฐใฎ๐ต๐ต๐ต๐ต๐ต๐ต๐‘™๐‘™๐‘ ๐‘ ้€ฃ้Ž–ใจใฏ๏ผŒ ๅ„ใ‚นใƒ†ใƒƒใƒ—ใงๅ…ˆ็ซ‹ใคใ‚นใƒ†ใƒƒใƒ—ใฎ๏ผ’ใคใ‚’ ็ตใถใ‚ˆใ†ใชๅˆ—(๐‘ฅ๐‘ฅ๐‘›๐‘›+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.

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

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 : ๐‘๐‘ = 12๐‘›๐‘›

, ๐‘๐‘ = ๐‘Š๐‘Š , ๐‘Š๐‘Š = 2๐‘›๐‘› ln ๐‘ƒ๐‘ƒ , ใชใ‚‰ ๐‘“๐‘“ โ‰ค ๐‘ƒ๐‘ƒ < ๐œŒ๐œŒโˆ’๐‘๐‘. ๐‘›๐‘› โ‰ฅ ๐‘ค๐‘ค ๐›ผ๐›ผ0 2, ๐‘ƒ๐‘ƒ โ‰ฅ 2 ใง ๐‘Š๐‘Š โ‰ฅ ๐‘ค๐‘ค ๐›ผ๐›ผ0 , ๐‘ค๐‘ค ๐›ผ๐›ผ0 โŠข ๐œ–๐œ– โ‰ค ๐‘Š๐‘Š + ๐‘๐‘ โ‰ค 8๐‘›๐‘› ln ๐‘ƒ๐‘ƒ + 1

๐‘ƒ๐‘ƒ ๐‘š๐‘š

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

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 ๅ€‹ใงใ‚ใ‚‹๏ผŽ

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

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๏ฟฝ

๐œ–๐œ–

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

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.

๏ผณ๏ผก๏ผดใ‚’ๅ้งใ‚นใƒ†ใƒƒใƒ—ใฎ ๆœ€ๅฐๅŒ–ๅ•้กŒใซ็ฝฎใๆ›ฟใˆใ‚‹๏ผŽ

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

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๏ฟฝ,๐‘‡๐‘‡๐‘‡๐‘‡3 end ๐น๐น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

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

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ใŒ * ๅฎฃ่จ€ใ™ใ‚‹ๆˆฆ็•ฅ

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

Theorem R p.56

P

D

* 1P

๐‘—๐‘—๐‘š๐‘šโˆ’3 ๐‘†๐‘† = ๐‘—๐‘—1, โ€ฆ ,

๏ฟฝฬ…๏ฟฝ๐‘ฅ๐‘—๐‘—๐‘—๐‘— ,

(๏ฟฝฬ…๏ฟฝ๐‘ฅ๐‘–๐‘–๐‘—๐‘— โˆจ ๏ฟฝฬ…๏ฟฝ๐‘ฅ๐‘—๐‘—๐‘˜๐‘˜ โˆจ ๐‘ฅ๐‘ฅ๐‘–๐‘–๐‘˜๐‘˜),

(๐‘ฅ๐‘ฅ๐‘—๐‘—1 โˆจ ๐‘ฅ๐‘ฅ๐‘—๐‘—2 โˆจ โ‹ฏโˆจ ๐‘ฅ๐‘ฅ๐‘—๐‘—๐‘š๐‘š)

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๐‘š๐‘šโ‹ฎ โ‹ฑ โ‹ฎ

๐‘ฅ๐‘ฅ๐‘š๐‘š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.

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

Lower bounds for general resolution. p.57

4.6.3 ๅŠ ็ฎ—้€ฃ้Ž– 1 = ๐‘๐‘0, ๐‘๐‘1, โ€ฆ , ๐‘๐‘๐‘Ÿ๐‘Ÿ= ๐‘›๐‘› ใŸใ ใ—ๅ„่ฆ็ด ใฏ๏ผŒใ™ในใฆใฎ i=1,2,โ€ฆ,r ใซใคใ„ใฆ ใ‚ใ‚‹ ๐‘˜๐‘˜ โ‰ค ๐‘—๐‘— < ๐‘๐‘ ใซๅฏพใ—ใฆ๏ผŒ ๐‘๐‘๐‘–๐‘– = ๐‘๐‘๐‘—๐‘— + ๐‘๐‘๐‘˜๐‘˜

7.1.2 ๐ต๐ต๐ต๐ต๐ต๐ต๐‘™๐‘™๐‘ ๐‘ ้€ฃ้Ž– ๐‘›๐‘›ๅค‰ๆ•ฐ(๐‘ฅ๐‘ฅ1,โ€ฆ,๐‘ฅ๐‘ฅ๐‘›๐‘›)ใฎ้–ขๆ•ฐใฎ๐ต๐ต๐ต๐ต๐ต๐ต๐‘™๐‘™๐‘ ๐‘ ้€ฃ้Ž–ใจใฏ๏ผŒ ๅ„ใ‚นใƒ†ใƒƒใƒ—ใงๅ…ˆ็ซ‹ใคใ‚นใƒ†ใƒƒใƒ—ใฎ๏ผ’ใคใ‚’ ็ตใถใ‚ˆใ†ใชๅˆ—(๐‘ฅ๐‘ฅ๐‘›๐‘›+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.

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

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 : ๐‘๐‘ = 12๐‘›๐‘›

, ๐‘๐‘ = ๐‘Š๐‘Š , ๐‘Š๐‘Š = 2๐‘›๐‘› ln ๐‘ƒ๐‘ƒ , ใชใ‚‰ ๐‘“๐‘“ โ‰ค ๐‘ƒ๐‘ƒ < ๐œŒ๐œŒโˆ’๐‘๐‘. ๐‘›๐‘› โ‰ฅ ๐‘ค๐‘ค ๐›ผ๐›ผ0 2, ๐‘ƒ๐‘ƒ โ‰ฅ 2 ใง ๐‘Š๐‘Š โ‰ฅ ๐‘ค๐‘ค ๐›ผ๐›ผ0 , ๐‘ค๐‘ค ๐›ผ๐›ผ0 โŠข ๐œ–๐œ– โ‰ค ๐‘Š๐‘Š + ๐‘๐‘ โ‰ค 8๐‘›๐‘› ln ๐‘ƒ๐‘ƒ + 1

๐‘ƒ๐‘ƒ ๐‘š๐‘š

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

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.

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

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.

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

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.

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

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 123 3๏ฟฝ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.

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

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 ๐‘ ๐‘  . . ๐‘ƒ๐‘ƒ

๐‘๐‘๐‘Ÿ๐‘Ÿ

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

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 .

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

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

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

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 ๐‘๐‘

๐‘๐‘๐‘—๐‘—

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

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 ๐‘๐‘ force a unit? ]

c5.[New level? ]

c6.[Make a decision.]

c7.[Resolve a conflict.]

c8.[Backjump.]

c9.[Learn.]

๐น๐น๐บ๐บ๐ฟ๐ฟ ๐‘€๐‘€๐‘…๐‘…๐‘๐‘๐‘ค๐‘ค๐‘๐‘๐‘˜๐‘˜ ๐‘ ๐‘ 

๐‘…๐‘…2๐‘˜๐‘˜ โ† ๐‘…๐‘…2๐‘˜๐‘˜+1 โ† ฮ›๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 ๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 โ† ๐‘˜๐‘˜1 โ‰ค ๐‘˜๐‘˜ โ‰ค ๐‘›๐‘›

MINL andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐‘™๐‘™ โ† ๐ฟ๐ฟ๐บ ๐บ๐บ = ๐บ๐บ + 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 falsefound โ‡” ๐‘™๐‘™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

terminatesuccesfully

prepare topurge excess

clauses

flush literalsas expected

โ‡” otherwise

๐‘ค๐‘ค โ† ๐‘ค๐‘ค + 1๐‘๐‘๐‘‘๐‘‘ โ† ๐น๐น.

๐‘˜๐‘˜ โ†HEAP 0delete k from the heap

if VAL ๐‘˜๐‘˜ โ‰ฅ 0 โ‡”๐ต๐ต๐‘ก๐‘ก๐‘๐‘ ๐‘ ๐‘ƒ๐‘ƒ๐‘ค๐‘ค๐‘๐‘๐‘ ๐‘ ๐‘ ๐‘ 

๐‘™๐‘™ โ† 2๐‘˜๐‘˜ + OVAL ๐‘˜๐‘˜ &1 VAL(๐‘˜๐‘˜) โ† 2๐‘ค๐‘ค + OVAL ๐‘˜๐‘˜ &1 ๐ฟ๐ฟ๐น๐น โ† ๐‘™๐‘™

TLOC( ๐‘™๐‘™ )โ† ๐น๐น๐‘…๐‘…๐‘™๐‘™ โ† ฮ›๐น๐น โ† ๐น๐น + 1if ๐‘ค๐‘ค = 0 โ‡” otherwise

terminateunsuccesfully

use the conflict clause ๐‘๐‘to construct๐‘™๐‘™๐‘™๏ฟฝ โˆจ ๐‘๐‘๏ฟฝ1 โˆจโ€ฆโˆจ ๐‘๐‘๏ฟฝ๐‘Ÿ๐‘Ÿ

ACT( ๐‘™๐‘™ )โ† ACT( ๐‘™๐‘™ ) +DELfor all literals ๐‘™๐‘™ stamped set d' to the max. level

occupied by ๐‘๐‘1, โ€ฆ ,๐‘๐‘๐‘Ÿ๐‘Ÿ while ๐น๐น > ๐‘๐‘๐‘‘๐‘‘โ€ฒ+1

๐น๐น โ† ๐น๐น โˆ’ 1

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand the watch list

๐‘๐‘1 โ€ฆ๐‘๐‘๐‘›๐‘› is a random permutation of 1,โ€ฆ ,๐‘›๐‘›

(Increasing ACT ๐‘™๐‘™ may change HEAP. )๐‘™๐‘™ โ† ๐ฟ๐ฟ๐น๐น๐‘˜๐‘˜ โ† ๐‘™๐‘™ OVAL(๐‘˜๐‘˜) โ† VAL ๐‘˜๐‘˜๐‘…๐‘…๐‘™๐‘™ โ† ฮ› if HLOC ๐‘™๐‘™ < 0 insert ๐‘˜๐‘˜ into HEAP.

๐บ๐บ โ† ๐น๐น๐‘ค๐‘ค โ† ๐‘ค๐‘ค๐‘™

set ๐‘๐‘ โ†MAXLIf ๐‘ค๐‘ค > 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.)

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

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 andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand 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 10100each 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

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

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 andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand 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.

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

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 andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand the watch list

๐‘๐‘1 โ€ฆ๐‘๐‘๐‘›๐‘› is a random permutation of 1,โ€ฆ ,๐‘›๐‘›

c5.[New level? ]

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

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 andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐‘™๐‘™ โ† ๐ฟ๐ฟ๐บ ๐บ๐บ = ๐บ๐บ + 1

for all c in the watch list of ๐‘™๐‘™ ฬ… โ‡” ๐๐ž๐ญ๐ž๐œ๐ญ๐ฌ ๐š ๐œ๐จ๐ง๐Ÿ๐ฅ๐ข๐œ๐ญ if no conflict โ‡”

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand the watch list

๐‘๐‘1 โ€ฆ๐‘๐‘๐‘›๐‘› is a random permutation of 1,โ€ฆ ,๐‘›๐‘›

c7.[Resolve a conflict.]

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.

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

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 ๐‘๐‘ force a unit? ]

๐น๐น๐บ๐บ๐ฟ๐ฟ ๐‘€๐‘€๐‘…๐‘…๐‘๐‘๐‘ค๐‘ค๐‘๐‘๐‘˜๐‘˜ ๐‘ ๐‘ 

๐‘…๐‘…2๐‘˜๐‘˜ โ† ๐‘…๐‘…2๐‘˜๐‘˜+1 โ† ฮ›๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 ๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 โ† ๐‘˜๐‘˜1 โ‰ค ๐‘˜๐‘˜ โ‰ค ๐‘›๐‘›

MINL andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐‘™๐‘™ โ† ๐ฟ๐ฟ๐บ ๐บ๐บ = ๐บ๐บ + 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 falsefound โ‡” ๐‘™๐‘™2...๐‘™๐‘™๐‘˜๐‘˜โˆ’1all false

๐‘™๐‘™0 false โ‡” ๐‘™๐‘™0 free๐ฆ๐จ๐ฏ๐ž ๐’„ to the watch list of ๐‘™๐‘™๐‘—๐‘—

๐ฆ๐š๐ค๐ž ๐ข๐ญ ๐ญ๐ซ๐ฎ๐ž ๐›๐ฒ ๐’”๐’”๐’†๐’•๐’•๐’Š๐’๐’ˆ ๐ฟ๐ฟ๐น๐น โ† ๐‘™๐‘™0 TLOC( ๐‘™๐‘™0 ) โ† ๐น๐นVAL( ๐‘™๐‘™0 ) โ† 2๐‘ค๐‘ค+ ๐‘™๐‘™0&1๐‘…๐‘…๐‘™๐‘™0 โ† ๐‘๐‘๐น๐น โ† ๐น๐น + 1

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand the watch list

๐‘๐‘1 โ€ฆ๐‘๐‘๐‘›๐‘› is a random permutation of 1,โ€ฆ ,๐‘›๐‘›

c7.[Resolve a conflict.]

c5.[New level? ]

Reason

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

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 ๐‘๐‘ force a unit? ]

c5.[New level? ]

๐น๐น๐บ๐บ๐ฟ๐ฟ ๐‘€๐‘€๐‘…๐‘…๐‘๐‘๐‘ค๐‘ค๐‘๐‘๐‘˜๐‘˜ ๐‘ ๐‘ 

๐‘…๐‘…2๐‘˜๐‘˜ โ† ๐‘…๐‘…2๐‘˜๐‘˜+1 โ† ฮ›๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 ๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 โ† ๐‘˜๐‘˜1 โ‰ค ๐‘˜๐‘˜ โ‰ค ๐‘›๐‘›

MINL andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐‘™๐‘™ โ† ๐ฟ๐ฟ๐บ ๐บ๐บ = ๐บ๐บ + 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 falsefound โ‡” ๐‘™๐‘™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

terminatesuccesfully

prepare topurge excess

clauses

flush literalsas expected

โ‡” otherwise

๐‘ค๐‘ค โ† ๐‘ค๐‘ค + 1๐‘๐‘๐‘‘๐‘‘ โ† ๐น๐น.

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand the watch list

๐‘๐‘1 โ€ฆ๐‘๐‘๐‘›๐‘› is a random permutation of 1,โ€ฆ ,๐‘›๐‘›

c7.[Resolve a conflict.]

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

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 ๐‘๐‘ force a unit? ]

c5.[New level? ]

c6.[Make a decision.]

๐น๐น๐บ๐บ๐ฟ๐ฟ ๐‘€๐‘€๐‘…๐‘…๐‘๐‘๐‘ค๐‘ค๐‘๐‘๐‘˜๐‘˜ ๐‘ ๐‘ 

๐‘…๐‘…2๐‘˜๐‘˜ โ† ๐‘…๐‘…2๐‘˜๐‘˜+1 โ† ฮ›๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 ๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 โ† ๐‘˜๐‘˜1 โ‰ค ๐‘˜๐‘˜ โ‰ค ๐‘›๐‘›

MINL andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐‘™๐‘™ โ† ๐ฟ๐ฟ๐บ ๐บ๐บ = ๐บ๐บ + 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 falsefound โ‡” ๐‘™๐‘™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

terminatesuccesfully

prepare topurge excess

clauses

flush literalsas expected

โ‡” otherwise

๐‘ค๐‘ค โ† ๐‘ค๐‘ค + 1๐‘๐‘๐‘‘๐‘‘ โ† ๐น๐น.

๐‘˜๐‘˜ โ†HEAP 0delete k from the heap

if VAL ๐‘˜๐‘˜ โ‰ฅ 0 โ‡”๐ต๐ต๐‘ก๐‘ก๐‘๐‘ ๐‘ ๐‘ƒ๐‘ƒ๐‘ค๐‘ค๐‘๐‘๐‘ ๐‘ ๐‘ ๐‘ 

๐‘™๐‘™ โ† 2๐‘˜๐‘˜ + OVAL ๐‘˜๐‘˜ &1 VAL(๐‘˜๐‘˜) โ† 2๐‘ค๐‘ค + OVAL ๐‘˜๐‘˜ &1 ๐ฟ๐ฟ๐น๐น โ† ๐‘™๐‘™

TLOC( ๐‘™๐‘™ )โ† ๐น๐น๐‘…๐‘…๐‘™๐‘™ โ† ฮ›๐น๐น โ† ๐น๐น + 1

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand the watch list

๐‘๐‘1 โ€ฆ๐‘๐‘๐‘›๐‘› is a random permutation of 1,โ€ฆ ,๐‘›๐‘›

c7.[Resolve a conflict.]

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.

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

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 ๐‘๐‘ force a unit? ]

c5.[New level? ]

c6.[Make a decision.]

c7.[Resolve a conflict.]

๐น๐น๐บ๐บ๐ฟ๐ฟ ๐‘€๐‘€๐‘…๐‘…๐‘๐‘๐‘ค๐‘ค๐‘๐‘๐‘˜๐‘˜ ๐‘ ๐‘ 

๐‘…๐‘…2๐‘˜๐‘˜ โ† ๐‘…๐‘…2๐‘˜๐‘˜+1 โ† ฮ›๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 ๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 โ† ๐‘˜๐‘˜1 โ‰ค ๐‘˜๐‘˜ โ‰ค ๐‘›๐‘›

MINL andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐‘™๐‘™ โ† ๐ฟ๐ฟ๐บ ๐บ๐บ = ๐บ๐บ + 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 falsefound โ‡” ๐‘™๐‘™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

terminatesuccesfully

prepare topurge excess

clauses

flush literalsas expected

โ‡” otherwise

๐‘ค๐‘ค โ† ๐‘ค๐‘ค + 1๐‘๐‘๐‘‘๐‘‘ โ† ๐น๐น.

๐‘˜๐‘˜ โ†HEAP 0delete k from the heap

if VAL ๐‘˜๐‘˜ โ‰ฅ 0 โ‡”๐ต๐ต๐‘ก๐‘ก๐‘๐‘ ๐‘ ๐‘ƒ๐‘ƒ๐‘ค๐‘ค๐‘๐‘๐‘ ๐‘ ๐‘ ๐‘ 

๐‘™๐‘™ โ† 2๐‘˜๐‘˜ + OVAL ๐‘˜๐‘˜ &1 VAL(๐‘˜๐‘˜) โ† 2๐‘ค๐‘ค + OVAL ๐‘˜๐‘˜ &1 ๐ฟ๐ฟ๐น๐น โ† ๐‘™๐‘™

TLOC( ๐‘™๐‘™ )โ† ๐น๐น๐‘…๐‘…๐‘™๐‘™ โ† ฮ›๐น๐น โ† ๐น๐น + 1if ๐‘ค๐‘ค = 0 โ‡” otherwise

terminateunsuccesfully

use the conflict clause ๐‘๐‘to construct๐‘™๐‘™๐‘™๏ฟฝ โˆจ ๐‘๐‘๏ฟฝ1 โˆจโ€ฆโˆจ ๐‘๐‘๏ฟฝ๐‘Ÿ๐‘Ÿ

ACT( ๐‘™๐‘™ )โ† ACT( ๐‘™๐‘™ ) +DELfor all literals ๐‘™๐‘™ stamped set d' to the max. level

occupied by ๐‘๐‘1, โ€ฆ ,๐‘๐‘๐‘Ÿ๐‘Ÿ

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand 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?

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

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 ๐‘๐‘ force a unit? ]

c5.[New level? ]

c6.[Make a decision.]

c7.[Resolve a conflict.]

c8.[Backjump.]

๐น๐น๐บ๐บ๐ฟ๐ฟ ๐‘€๐‘€๐‘…๐‘…๐‘๐‘๐‘ค๐‘ค๐‘๐‘๐‘˜๐‘˜ ๐‘ ๐‘ 

๐‘…๐‘…2๐‘˜๐‘˜ โ† ๐‘…๐‘…2๐‘˜๐‘˜+1 โ† ฮ›๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 ๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 โ† ๐‘˜๐‘˜1 โ‰ค ๐‘˜๐‘˜ โ‰ค ๐‘›๐‘›

MINL andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐‘™๐‘™ โ† ๐ฟ๐ฟ๐บ ๐บ๐บ = ๐บ๐บ + 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 falsefound โ‡” ๐‘™๐‘™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

terminatesuccesfully

prepare topurge excess

clauses

flush literalsas expected

โ‡” otherwise

๐‘ค๐‘ค โ† ๐‘ค๐‘ค + 1๐‘๐‘๐‘‘๐‘‘ โ† ๐น๐น.

๐‘˜๐‘˜ โ†HEAP 0delete k from the heap

if VAL ๐‘˜๐‘˜ โ‰ฅ 0 โ‡”๐ต๐ต๐‘ก๐‘ก๐‘๐‘ ๐‘ ๐‘ƒ๐‘ƒ๐‘ค๐‘ค๐‘๐‘๐‘ ๐‘ ๐‘ ๐‘ 

๐‘™๐‘™ โ† 2๐‘˜๐‘˜ + OVAL ๐‘˜๐‘˜ &1 VAL(๐‘˜๐‘˜) โ† 2๐‘ค๐‘ค + OVAL ๐‘˜๐‘˜ &1 ๐ฟ๐ฟ๐น๐น โ† ๐‘™๐‘™

TLOC( ๐‘™๐‘™ )โ† ๐น๐น๐‘…๐‘…๐‘™๐‘™ โ† ฮ›๐น๐น โ† ๐น๐น + 1if ๐‘ค๐‘ค = 0 โ‡” otherwise

terminateunsuccesfully

use the conflict clause ๐‘๐‘to construct๐‘™๐‘™๐‘™๏ฟฝ โˆจ ๐‘๐‘๏ฟฝ1 โˆจโ€ฆโˆจ ๐‘๐‘๏ฟฝ๐‘Ÿ๐‘Ÿ

ACT( ๐‘™๐‘™ )โ† ACT( ๐‘™๐‘™ ) +DELfor all literals ๐‘™๐‘™ stamped set d' to the max. level

occupied by ๐‘๐‘1, โ€ฆ ,๐‘๐‘๐‘Ÿ๐‘Ÿ while ๐น๐น > ๐‘๐‘๐‘‘๐‘‘โ€ฒ+1

๐น๐น โ† ๐น๐น โˆ’ 1

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand 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.

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

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 ๐‘๐‘ force a unit? ]

c5.[New level? ]

c6.[Make a decision.]

c7.[Resolve a conflict.]

๐น๐น๐บ๐บ๐ฟ๐ฟ ๐‘€๐‘€๐‘…๐‘…๐‘๐‘๐‘ค๐‘ค๐‘๐‘๐‘˜๐‘˜ ๐‘ ๐‘ 

๐‘…๐‘…2๐‘˜๐‘˜ โ† ๐‘…๐‘…2๐‘˜๐‘˜+1 โ† ฮ›๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 ๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 โ† ๐‘˜๐‘˜1 โ‰ค ๐‘˜๐‘˜ โ‰ค ๐‘›๐‘›

MINL andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐‘™๐‘™ โ† ๐ฟ๐ฟ๐บ ๐บ๐บ = ๐บ๐บ + 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 falsefound โ‡” ๐‘™๐‘™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

terminatesuccesfully

prepare topurge excess

clauses

flush literalsas expected

โ‡” otherwise

๐‘ค๐‘ค โ† ๐‘ค๐‘ค + 1๐‘๐‘๐‘‘๐‘‘ โ† ๐น๐น.

๐‘˜๐‘˜ โ†HEAP 0delete k from the heap

if VAL ๐‘˜๐‘˜ โ‰ฅ 0 โ‡”๐ต๐ต๐‘ก๐‘ก๐‘๐‘ ๐‘ ๐‘ƒ๐‘ƒ๐‘ค๐‘ค๐‘๐‘๐‘ ๐‘ ๐‘ ๐‘ 

๐‘™๐‘™ โ† 2๐‘˜๐‘˜ + OVAL ๐‘˜๐‘˜ &1 VAL(๐‘˜๐‘˜) โ† 2๐‘ค๐‘ค + OVAL ๐‘˜๐‘˜ &1 ๐ฟ๐ฟ๐น๐น โ† ๐‘™๐‘™

TLOC( ๐‘™๐‘™ )โ† ๐น๐น๐‘…๐‘…๐‘™๐‘™ โ† ฮ›๐น๐น โ† ๐น๐น + 1if ๐‘ค๐‘ค = 0 โ‡” otherwise

terminateunsuccesfully

use the conflict clause ๐‘๐‘to construct๐‘™๐‘™๐‘™๏ฟฝ โˆจ ๐‘๐‘๏ฟฝ1 โˆจโ€ฆโˆจ ๐‘๐‘๏ฟฝ๐‘Ÿ๐‘Ÿ

ACT( ๐‘™๐‘™ )โ† ACT( ๐‘™๐‘™ ) +DELfor all literals ๐‘™๐‘™ stamped set d' to the max. level

occupied by ๐‘๐‘1, โ€ฆ ,๐‘๐‘๐‘Ÿ๐‘Ÿ

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand 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[๐‘๐‘] = ๐‘ ๐‘  ."

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

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 ๐‘๐‘ force a unit? ]

c5.[New level? ]

c6.[Make a decision.]

c7.[Resolve a conflict.]

๐น๐น๐บ๐บ๐ฟ๐ฟ ๐‘€๐‘€๐‘…๐‘…๐‘๐‘๐‘ค๐‘ค๐‘๐‘๐‘˜๐‘˜ ๐‘ ๐‘ 

๐‘…๐‘…2๐‘˜๐‘˜ โ† ๐‘…๐‘…2๐‘˜๐‘˜+1 โ† ฮ›๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 ๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 โ† ๐‘˜๐‘˜1 โ‰ค ๐‘˜๐‘˜ โ‰ค ๐‘›๐‘›

MINL andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐‘™๐‘™ โ† ๐ฟ๐ฟ๐บ ๐บ๐บ = ๐บ๐บ + 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 falsefound โ‡” ๐‘™๐‘™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

terminatesuccesfully

prepare topurge excess

clauses

flush literalsas expected

โ‡” otherwise

๐‘ค๐‘ค โ† ๐‘ค๐‘ค + 1๐‘๐‘๐‘‘๐‘‘ โ† ๐น๐น.

๐‘˜๐‘˜ โ†HEAP 0delete k from the heap

if VAL ๐‘˜๐‘˜ โ‰ฅ 0 โ‡”๐ต๐ต๐‘ก๐‘ก๐‘๐‘ ๐‘ ๐‘ƒ๐‘ƒ๐‘ค๐‘ค๐‘๐‘๐‘ ๐‘ ๐‘ ๐‘ 

๐‘™๐‘™ โ† 2๐‘˜๐‘˜ + OVAL ๐‘˜๐‘˜ &1 VAL(๐‘˜๐‘˜) โ† 2๐‘ค๐‘ค + OVAL ๐‘˜๐‘˜ &1 ๐ฟ๐ฟ๐น๐น โ† ๐‘™๐‘™

TLOC( ๐‘™๐‘™ )โ† ๐น๐น๐‘…๐‘…๐‘™๐‘™ โ† ฮ›๐น๐น โ† ๐น๐น + 1if ๐‘ค๐‘ค = 0 โ‡” otherwise

terminateunsuccesfully

use the conflict clause ๐‘๐‘to construct๐‘™๐‘™๐‘™๏ฟฝ โˆจ ๐‘๐‘๏ฟฝ1 โˆจโ€ฆโˆจ ๐‘๐‘๏ฟฝ๐‘Ÿ๐‘Ÿ

ACT( ๐‘™๐‘™ )โ† ACT( ๐‘™๐‘™ ) +DELfor all literals ๐‘™๐‘™ stamped set d' to the max. level

occupied by ๐‘๐‘1, โ€ฆ ,๐‘๐‘๐‘Ÿ๐‘Ÿ

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand 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 ๐‘™๐‘™โ€ฒ โ† ๐ฟ๐ฟ๐‘ก๐‘ก.

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

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 ๐‘๐‘ force a unit? ]

c5.[New level? ]

c6.[Make a decision.]

c7.[Resolve a conflict.]

c8.[Backjump.]

c9.[Learn.]

๐น๐น๐บ๐บ๐ฟ๐ฟ ๐‘€๐‘€๐‘…๐‘…๐‘๐‘๐‘ค๐‘ค๐‘๐‘๐‘˜๐‘˜ ๐‘ ๐‘ 

๐‘…๐‘…2๐‘˜๐‘˜ โ† ๐‘…๐‘…2๐‘˜๐‘˜+1 โ† ฮ›๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 ๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 โ† ๐‘˜๐‘˜1 โ‰ค ๐‘˜๐‘˜ โ‰ค ๐‘›๐‘›

MINL andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐‘™๐‘™ โ† ๐ฟ๐ฟ๐บ ๐บ๐บ = ๐บ๐บ + 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 falsefound โ‡” ๐‘™๐‘™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

terminatesuccesfully

prepare topurge excess

clauses

flush literalsas expected

โ‡” otherwise

๐‘ค๐‘ค โ† ๐‘ค๐‘ค + 1๐‘๐‘๐‘‘๐‘‘ โ† ๐น๐น.

๐‘˜๐‘˜ โ†HEAP 0delete k from the heap

if VAL ๐‘˜๐‘˜ โ‰ฅ 0 โ‡”๐ต๐ต๐‘ก๐‘ก๐‘๐‘ ๐‘ ๐‘ƒ๐‘ƒ๐‘ค๐‘ค๐‘๐‘๐‘ ๐‘ ๐‘ ๐‘ 

๐‘™๐‘™ โ† 2๐‘˜๐‘˜ + OVAL ๐‘˜๐‘˜ &1 VAL(๐‘˜๐‘˜) โ† 2๐‘ค๐‘ค + OVAL ๐‘˜๐‘˜ &1 ๐ฟ๐ฟ๐น๐น โ† ๐‘™๐‘™

TLOC( ๐‘™๐‘™ )โ† ๐น๐น๐‘…๐‘…๐‘™๐‘™ โ† ฮ›๐น๐น โ† ๐น๐น + 1if ๐‘ค๐‘ค = 0 โ‡” otherwise

terminateunsuccesfully

use the conflict clause ๐‘๐‘to construct๐‘™๐‘™๐‘™๏ฟฝ โˆจ ๐‘๐‘๏ฟฝ1 โˆจโ€ฆโˆจ ๐‘๐‘๏ฟฝ๐‘Ÿ๐‘Ÿ

ACT( ๐‘™๐‘™ )โ† ACT( ๐‘™๐‘™ ) +DELfor all literals ๐‘™๐‘™ stamped set d' to the max. level

occupied by ๐‘๐‘1, โ€ฆ ,๐‘๐‘๐‘Ÿ๐‘Ÿ while ๐น๐น > ๐‘๐‘๐‘‘๐‘‘โ€ฒ+1

๐น๐น โ† ๐น๐น โˆ’ 1

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand the watch list

๐‘๐‘1 โ€ฆ๐‘๐‘๐‘›๐‘› is a random permutation of 1,โ€ฆ ,๐‘›๐‘›

(Increasing ACT ๐‘™๐‘™ may change HEAP. )๐‘™๐‘™ โ† ๐ฟ๐ฟ๐น๐น๐‘˜๐‘˜ โ† ๐‘™๐‘™ OVAL(๐‘˜๐‘˜) โ† VAL ๐‘˜๐‘˜๐‘…๐‘…๐‘™๐‘™ โ† ฮ› if HLOC ๐‘™๐‘™ < 0 insert ๐‘˜๐‘˜ into HEAP.

๐บ๐บ โ† ๐น๐น๐‘ค๐‘ค โ† ๐‘ค๐‘ค๐‘™

set ๐‘๐‘ โ†MAXLIf ๐‘ค๐‘ค > 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.

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

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 ๐‘๐‘ force a unit? ]

c5.[New level? ]

c6.[Make a decision.]

๐น๐น๐บ๐บ๐ฟ๐ฟ ๐‘€๐‘€๐‘…๐‘…๐‘๐‘๐‘ค๐‘ค๐‘๐‘๐‘˜๐‘˜ ๐‘ ๐‘ 

๐‘…๐‘…2๐‘˜๐‘˜ โ† ๐‘…๐‘…2๐‘˜๐‘˜+1 โ† ฮ›๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 ๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 โ† ๐‘˜๐‘˜1 โ‰ค ๐‘˜๐‘˜ โ‰ค ๐‘›๐‘›

MINL andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐‘™๐‘™ โ† ๐ฟ๐ฟ๐บ ๐บ๐บ = ๐บ๐บ + 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 falsefound โ‡” ๐‘™๐‘™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

terminatesuccesfully

prepare topurge excess

clauses

flush literalsas expected

โ‡” otherwise

๐‘ค๐‘ค โ† ๐‘ค๐‘ค + 1๐‘๐‘๐‘‘๐‘‘ โ† ๐น๐น.

๐‘˜๐‘˜ โ†HEAP 0delete k from the heap

if VAL ๐‘˜๐‘˜ โ‰ฅ 0 โ‡”๐ต๐ต๐‘ก๐‘ก๐‘๐‘ ๐‘ ๐‘ƒ๐‘ƒ๐‘ค๐‘ค๐‘๐‘๐‘ ๐‘ ๐‘ ๐‘ 

๐‘™๐‘™ โ† 2๐‘˜๐‘˜ + OVAL ๐‘˜๐‘˜ &1 VAL(๐‘˜๐‘˜) โ† 2๐‘ค๐‘ค + OVAL ๐‘˜๐‘˜ &1 ๐ฟ๐ฟ๐น๐น โ† ๐‘™๐‘™

TLOC( ๐‘™๐‘™ )โ† ๐น๐น๐‘…๐‘…๐‘™๐‘™ โ† ฮ›๐น๐น โ† ๐น๐น + 1

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand the watch list

๐‘๐‘1 โ€ฆ๐‘๐‘๐‘›๐‘› is a random permutation of 1,โ€ฆ ,๐‘›๐‘›

c7.[Resolve a conflict.]

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).

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

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

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

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 ๐‘๐‘ force a unit? ]

c5.[New level? ]

c6.[Make a decision.]

c7.[Resolve a conflict.]

c8.[Backjump.]

c9.[Learn.]

๐น๐น๐บ๐บ๐ฟ๐ฟ ๐‘€๐‘€๐‘…๐‘…๐‘๐‘๐‘ค๐‘ค๐‘๐‘๐‘˜๐‘˜ ๐‘ ๐‘ 

๐‘…๐‘…2๐‘˜๐‘˜ โ† ๐‘…๐‘…2๐‘˜๐‘˜+1 โ† ฮ›๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 ๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 โ† ๐‘˜๐‘˜1 โ‰ค ๐‘˜๐‘˜ โ‰ค ๐‘›๐‘›

MINL andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐‘™๐‘™ โ† ๐ฟ๐ฟ๐บ ๐บ๐บ = ๐บ๐บ + 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 falsefound โ‡” ๐‘™๐‘™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

terminatesuccesfully

prepare topurge excess

clauses

flush literalsas expected

โ‡” otherwise

๐‘ค๐‘ค โ† ๐‘ค๐‘ค + 1๐‘๐‘๐‘‘๐‘‘ โ† ๐น๐น.

๐‘˜๐‘˜ โ†HEAP 0delete k from the heap

if VAL ๐‘˜๐‘˜ โ‰ฅ 0 โ‡”๐ต๐ต๐‘ก๐‘ก๐‘๐‘ ๐‘ ๐‘ƒ๐‘ƒ๐‘ค๐‘ค๐‘๐‘๐‘ ๐‘ ๐‘ ๐‘ 

๐‘™๐‘™ โ† 2๐‘˜๐‘˜ + OVAL ๐‘˜๐‘˜ &1 VAL(๐‘˜๐‘˜) โ† 2๐‘ค๐‘ค + OVAL ๐‘˜๐‘˜ &1 ๐ฟ๐ฟ๐น๐น โ† ๐‘™๐‘™

TLOC( ๐‘™๐‘™ )โ† ๐น๐น๐‘…๐‘…๐‘™๐‘™ โ† ฮ›๐น๐น โ† ๐น๐น + 1if ๐‘ค๐‘ค = 0 โ‡” otherwise

terminateunsuccesfully

use the conflict clause ๐‘๐‘to construct๐‘™๐‘™๐‘™๏ฟฝ โˆจ ๐‘๐‘๏ฟฝ1 โˆจโ€ฆโˆจ ๐‘๐‘๏ฟฝ๐‘Ÿ๐‘Ÿ

ACT( ๐‘™๐‘™ )โ† ACT( ๐‘™๐‘™ ) +DELfor all literals ๐‘™๐‘™ stamped set d' to the max. level

occupied by ๐‘๐‘1, โ€ฆ ,๐‘๐‘๐‘Ÿ๐‘Ÿ while ๐น๐น > ๐‘๐‘๐‘‘๐‘‘โ€ฒ+1

๐น๐น โ† ๐น๐น โˆ’ 1

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand the watch list

๐‘๐‘1 โ€ฆ๐‘๐‘๐‘›๐‘› is a random permutation of 1,โ€ฆ ,๐‘›๐‘›

(Increasing ACT ๐‘™๐‘™ may change HEAP. )๐‘™๐‘™ โ† ๐ฟ๐ฟ๐น๐น๐‘˜๐‘˜ โ† ๐‘™๐‘™ OVAL(๐‘˜๐‘˜) โ† VAL ๐‘˜๐‘˜๐‘…๐‘…๐‘™๐‘™ โ† ฮ› if HLOC ๐‘™๐‘™ < 0 insert ๐‘˜๐‘˜ into HEAP.

๐บ๐บ โ† ๐น๐น๐‘ค๐‘ค โ† ๐‘ค๐‘ค๐‘™

set ๐‘๐‘ โ†MAXLIf ๐‘ค๐‘ค > 0

store the new clause in MEM at position ๐‘๐‘advance MAXL to the next available position in MEM

๐‘€๐‘€ โ†๐‘€๐‘€ + 1๐ฟ๐ฟ๐น๐น โ† ๐‘™๐‘™๐‘™ TLOC( ๐‘™๐‘™๐‘™ )โ† ๐น๐น๐‘…๐‘…๐‘™๐‘™โ€ฒ โ† ๐‘๐‘๐น๐น โ† ๐น๐น + 1 DELโ†DEL/๐œŒ๐œŒ

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

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 ๐‘๐‘ force a unit? ]

c5.[New level? ]

c6.[Make a decision.]

c7.[Resolve a conflict.]

c8.[Backjump.]

c9.[Learn.]

๐น๐น๐บ๐บ๐ฟ๐ฟ ๐‘€๐‘€๐‘…๐‘…๐‘๐‘๐‘ค๐‘ค๐‘๐‘๐‘˜๐‘˜ ๐‘ ๐‘ 

๐‘…๐‘…2๐‘˜๐‘˜ โ† ๐‘…๐‘…2๐‘˜๐‘˜+1 โ† ฮ›๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 ๐‘๐‘๐‘˜๐‘˜ โˆ’ 1 โ† ๐‘˜๐‘˜1 โ‰ค ๐‘˜๐‘˜ โ‰ค ๐‘›๐‘›

MINL andMAXLto 1st available position

๐‘๐‘0 โ† 0

DEL ๐‘

๐‘›๐‘›

๐ฟ๐ฟ0 โ€ฆ ๐ฟ๐ฟ๐น๐นโˆ’1 contains allliterals

forced by ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐บโˆ’1if ๐บ๐บ = ๐น๐น

๐‘™๐‘™ โ† ๐ฟ๐ฟ๐บ ๐บ๐บ = ๐บ๐บ + 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 falsefound โ‡” ๐‘™๐‘™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

terminatesuccesfully

prepare topurge excess

clauses

flush literalsas expected

โ‡” otherwise

๐‘ค๐‘ค โ† ๐‘ค๐‘ค + 1๐‘๐‘๐‘‘๐‘‘ โ† ๐น๐น.

๐‘˜๐‘˜ โ†HEAP 0delete k from the heap

if VAL ๐‘˜๐‘˜ โ‰ฅ 0 โ‡”๐ต๐ต๐‘ก๐‘ก๐‘๐‘ ๐‘ ๐‘ƒ๐‘ƒ๐‘ค๐‘ค๐‘๐‘๐‘ ๐‘ ๐‘ ๐‘ 

๐‘™๐‘™ โ† 2๐‘˜๐‘˜ + OVAL ๐‘˜๐‘˜ &1 VAL(๐‘˜๐‘˜) โ† 2๐‘ค๐‘ค + OVAL ๐‘˜๐‘˜ &1 ๐ฟ๐ฟ๐น๐น โ† ๐‘™๐‘™

TLOC( ๐‘™๐‘™ )โ† ๐น๐น๐‘…๐‘…๐‘™๐‘™ โ† ฮ›๐น๐น โ† ๐น๐น + 1if ๐‘ค๐‘ค = 0 โ‡” otherwise

terminateunsuccesfully

use the conflict clause ๐‘๐‘to construct๐‘™๐‘™๐‘™๏ฟฝ โˆจ ๐‘๐‘๏ฟฝ1 โˆจโ€ฆโˆจ ๐‘๐‘๏ฟฝ๐‘Ÿ๐‘Ÿ

ACT( ๐‘™๐‘™ )โ† ACT( ๐‘™๐‘™ ) +DELfor all literals ๐‘™๐‘™ stamped set d' to the max. level

occupied by ๐‘๐‘1, โ€ฆ ,๐‘๐‘๐‘Ÿ๐‘Ÿ while ๐น๐น > ๐‘๐‘๐‘‘๐‘‘โ€ฒ+1

๐น๐น โ† ๐น๐น โˆ’ 1

๐๐ฎ๐ญ ๐๐ข๐ฌ๐ญ๐ข๐ง๐œ๐ญ ๐ฎ๐ง๐ข๐ญ ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into ๐ฟ๐ฟ0 โ€ฆ๐ฟ๐ฟ๐น๐นโˆ’1But ๐ญ๐ž๐ซ๐ง๐ข๐ฆ๐š๐ญ๐ž ๐ฎ๐ง๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ

if clause ๐‘™๐‘™ and ๐‘™๐‘™๐‘™contradiction

๐ข๐ง๐ฉ๐ฎ๐ญ ๐ญ๐ก๐ž ๐œ๐ฅ๐š๐ฎ๐ฌ๐ž๐ฌ into MEMand the watch list

๐‘๐‘1 โ€ฆ๐‘๐‘๐‘›๐‘› is a random permutation of 1,โ€ฆ ,๐‘›๐‘›

(Increasing ACT ๐‘™๐‘™ may change HEAP. )๐‘™๐‘™ โ† ๐ฟ๐ฟ๐น๐น๐‘˜๐‘˜ โ† ๐‘™๐‘™ OVAL(๐‘˜๐‘˜) โ† VAL ๐‘˜๐‘˜๐‘…๐‘…๐‘™๐‘™ โ† ฮ› if HLOC ๐‘™๐‘™ < 0 insert ๐‘˜๐‘˜ into HEAP.

๐บ๐บ โ† ๐น๐น๐‘ค๐‘ค โ† ๐‘ค๐‘ค๐‘™

set ๐‘๐‘ โ†MAXLIf ๐‘ค๐‘ค > 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.)

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

Certificates of unsatisfiability. p.70

if SAT solver report is ๐‘›๐‘›๐‘ ๐‘ ๐‘™๐‘™๐‘๐‘๐‘ก๐‘ก๐‘๐‘๐‘™๐‘™๐‘ ๐‘  - UNSAT how confident can we be that such a claim is true?

Fig.48.

let ๐‘…๐‘… be Rivest's clauses (6), which were proved unsatisfiable in Fig. 48.

๐‘…๐‘… โˆง 1๏ฟฝ โˆง 2๏ฟฝ โŠข1 3๏ฟฝ โŠข1 4๏ฟฝ โŠข1 ๐œ–๐œ– (using 123๏ฟฝ, 234๏ฟฝ, and 341); ๐‘…๐‘… โˆง 12 โˆง 1๏ฟฝ โŠข1 2 โŠข1 4๏ฟฝ โŠข1 3๏ฟฝ โŠข1 ๐œ–๐œ– ( using 12, 4๏ฟฝ12๏ฟฝ, 2๏ฟฝ3๏ฟฝ4, and 341); ๐‘…๐‘… โˆง 12 โˆง 1 โŠข1 2๏ฟฝ โŠข1 4 โŠข1 3 โŠข1 ๐œ–๐œ– (using 41๏ฟฝ2, 234๏ฟฝ, and 3๏ฟฝ4๏ฟฝ1๏ฟฝ); ๐‘…๐‘… โˆง 12 โˆง 1 โŠข1 2 โŠข1 3 โŠข1 4 โŠข1 ๐œ–๐œ– (using 1๏ฟฝ2๏ฟฝ3, 2๏ฟฝ3๏ฟฝ4, and 3๏ฟฝ4๏ฟฝ1๏ฟฝ).

Then (12, 1, 2, ๐œ–๐œ–) is a certificate of unsatisfiability, because

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

Theorem G. p.70

๐น๐น โˆง ๐ถ๐ถ1 โˆง โ‹ฏโˆง ๐ถ๐ถ๐‘–๐‘–โˆ’1 โˆง ๏ฟฝฬ…๏ฟฝ๐ถ๐‘–๐‘– โŠข1 ๐œ–๐œ– for 1 โ‰ค ๐‘๐‘ โ‰ค ๐‘ก๐‘ก.

โ€˜๐บ๐บ โŠข1 ๐œ–๐œ–โ€™ : the clauses ๐บ๐บ lead to a contradiction by unit propagation; and if ๐ถ๐ถ๐‘–๐‘– : the clause ๐‘๐‘1,โˆจ โ‹ฏโˆจ ๐‘๐‘๐‘˜๐‘˜ ๐ถ๐ถ = ๐‘†๐‘†0 and ๐‘…๐‘…๐‘™๐‘™๐‘–๐‘– = ๐‘™๐‘™๐‘–๐‘– โˆจ ๐‘†๐‘†๐‘–๐‘– , where all literals of ๐‘†๐‘†0 โˆช ๐‘†๐‘†1 โˆช โ‹ฏโˆช ๐‘†๐‘†๐‘ ๐‘  are false

If Algorithm C terminates unsuccessfully, the sequence ๐ถ๐ถ1,๐ถ๐ถ2, โ€ฆ ,๐ถ๐ถ๐‘ก๐‘ก of clauses that it has learned is a certificate of unsatisfiability.

for a family of clauses ๐น๐น if ๐ถ๐ถ๐‘ก๐‘ก = ๐œ–๐œ–,and if we have

๐ถ๐ถโ€ฒ = ๐‘™๐‘™๐‘™๏ฟฝ โˆจ ๐‘๐‘๏ฟฝ1 โ€ฆโˆจ ๐‘๐‘๏ฟฝ๐‘Ÿ๐‘Ÿ ,

๐ถ๐ถโ€ฒ = โ€ฆ ๐ถ๐ถ โ‹„ ๐‘…๐‘…๐‘™๐‘™1 โ‹„ ๐‘…๐‘…๐‘™๐‘™2 โ‹„ โ‹ฏ โ‹„ ๐‘…๐‘…๐‘™๐‘™๐‘›๐‘›

๐šค๐šค๏ฟฝฬ…๏ฟฝ๐‘– โˆˆ ๐‘†๐‘†0 โˆช โ‹ฏโˆช ๐‘†๐‘†๐‘–๐‘–โˆ’1,ใ€€for 1 โ‰ค ๐‘๐‘ โ‰ค ๐‘ ๐‘ ; ๐‘†๐‘†0 โˆช ๐‘†๐‘†1 โˆช โ‹ฏโˆช ๐‘†๐‘†๐‘ ๐‘  = ๐‘™๐‘™๐‘™๏ฟฝ, ๐‘™๐‘™1ฬ…, โ€ฆ , ๐‘™๐‘™๏ฟฝฬ…๏ฟฝ๐‘ , ๐‘๐‘๏ฟฝ1, โ€ฆ , ๐‘๐‘๏ฟฝ๐‘Ÿ๐‘Ÿ .

Unit propagations can be done without the "reasonโ€œ, however, ๐‘…๐‘…๐‘™๐‘™ as the certificate checker purge clauses

that will no longer be relevant to the proof.

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

p.71+P.157 Exercise 284.

Mark ๐‘๐‘, stamp S( ๐‘™๐‘™๐‘—๐‘— ) โ† ๐‘๐‘ for 0 โ‰ค ๐‘—๐‘— < ๐‘˜๐‘˜, set ๐‘๐‘ โ† max ( TLOC ๐‘™๐‘™1 ,โ€ฆ , TLOC ( ๐‘™๐‘™๐‘˜๐‘˜โˆ’1 )) . While ๐‘๐‘ โ‰ฅ ๐ธ๐ธ, we set ๐‘™๐‘™ โ† ๐ฟ๐ฟ๐‘๐‘, ๐‘๐‘ โ† ๐‘๐‘ โˆ’ 1, and if S ( ๐‘™๐‘™ ) = ๐‘๐‘ we also "resolve with the reason of ๐‘™๐‘™" as follows: Let clause ๐‘…๐‘…๐‘™๐‘™ be ๐‘™๐‘™0๐‘™๐‘™1 โ€ฆ ๐‘™๐‘™๐‘˜๐‘˜โˆ’1, mark ๐‘…๐‘…๐‘™๐‘™, and set S ๐‘™๐‘™๐‘—๐‘— โ† ๐‘๐‘ for 1 โ‰ค ๐‘—๐‘— < ๐‘˜๐‘˜.

Explain how to use reasons so that clauses are marked by the verifier only if they actually participate in the proof of a marked clause ๐ถ๐ถ๐‘–๐‘–.

VAL(๐‘—๐‘—) โ† 0 for 0 โ‰ค ๐‘—๐‘— โ‰ค ๐‘›๐‘›, ๐‘™๐‘™0 โ† 0: ๐ฟ๐ฟ1 โ† ๐‘๐‘๏ฟฝ1, โ€ฆ , ๐ฟ๐ฟ๐‘˜๐‘˜ โ† ๐‘๐‘๏ฟฝ๐‘˜๐‘˜, ๐ธ๐ธ โ† ๐น๐น โ† ๐‘˜๐‘˜ + 1,๐บ๐บ โ† 0, and VAL ๐ฟ๐ฟ๐‘๐‘ โ† ๐ฟ๐ฟ๐‘๐‘ & 1 for 0 โ‰ค ๐‘—๐‘— โ‰ค ๐‘›๐‘›;

Give preference to already-marked clauses when doing the unit propagations.

trail

reason

Initial conflict clause

.. ..

array

. . . . .

. . .

. . . . . .

counter . . .

level โ€™

.. .

. . .

stamp . .

trail

reason

stamp

.. ..

array

level โ€™

. . .

. . . . . . . .

. . .

. .

. . .

counter . . .

.. .

trail

reason

stamp

array

level โ€™

. . .

. . . . .

. .

. . .

counter

..

. . .

Algorithm C can inform

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

*Purging unhelpful clauses. p.71

Algorithm C periodically weed out the clauses that appear to be more harmful than helpful, as soon as it has learned ๐‘€๐‘€ โ‰ฅ ๐‘€๐‘€๐‘๐‘ clauses and arrived at a reasonably stable state (step C5).

a CDCL solver was applied to the clauses of after about clauses had been learned.

#learned clauses computation time GM

typical run 48,000 800

50,000 500๐‘€๐‘€P = 10000

learned 10002 clauses

6252 clauses actually present in MEM

at most 3126 clauses will be removed by the

purging process

Some clauses had length 2, while the maxi size was 24 and the median was 11;

12 of the 6252 fell into this category; for instance, 30 appeared on level 10 of the trail

because โ€™ 30 33 39 41 42 45 46 48 54 57 โ€™ had been learned, and we may need to know that clause in a future resolution step.

Short clauses tend to be more useful, because they reduce more quickly to units.

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

literal block distance p.72

Gilles Audemard and Laurent Simon [Proc. Int. Joint Conference on Artificial Intelligence 21 (2009), 399 โˆ’ 404].

If ๐ถ๐ถ has signature (๐‘๐‘, ๐‘ž๐‘ž) and ๐ถ๐ถ๐‘‘ has signature ๐‘๐‘โ€ฒ, ๐‘ž๐‘žโ€ฒ , where ๐‘๐‘ โ‰ค ๐‘๐‘โ€ฒand ๐‘ž๐‘ž โ‰ค ๐‘ž๐‘ž๐‘™ and (๐‘๐‘, ๐‘ž๐‘ž) โ‰  (๐‘๐‘๐‘™ ,๐‘ž๐‘ž๐‘™),

then ๐ถ๐ถ is more likely than ๐ถ๐ถ๐‘‘ to be useful in future propagations.

We can't predict the future, but small (๐‘๐‘, ๐‘ž๐‘ž) tends to

increase the ratio of black to gray.

all the literals of a clause ๐ถ๐ถ = ๐‘™๐‘™1 โˆจ โ‹ฏโˆจ ๐‘™๐‘™๐‘Ÿ๐‘Ÿ, positively as ๐‘™๐‘™๐‘—๐‘— or negatively as ๐‘™๐‘™๏ฟฝฬ…๏ฟฝ๐‘—. where ๐‘๐‘ of the levels contain at least one positive ๐‘™๐‘™๐‘—๐‘—

and the other ๐‘ž๐‘ž contain nothing but ๐‘™๐‘™๏ฟฝฬ…๏ฟฝ๐‘—. (๐‘๐‘, ๐‘ž๐‘ž) is the ๐‘ ๐‘ ๐‘๐‘๐‘™๐‘™๐‘›๐‘›๐‘๐‘๐‘ก๐‘ก๐‘ข๐‘ข๐‘ƒ๐‘ƒ๐‘ ๐‘  of ๐ถ๐ถ w.r.t the trail, and ๐‘๐‘ + ๐‘ž๐‘ž level is the literal block distance.

how many of eligible clauses had a given signature (๐‘๐‘, ๐‘ž๐‘ž), for 1 โ‰ค ๐‘๐‘ โ‰ค 7 and 0 โ‰ค ๐‘ž๐‘ž โ‰ค 8;

how many would have been used to resolve future conflict

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

RANGE( ) and โ€œtie breakersโ€ p.74

RANGE ๐‘๐‘ โ† ๐‘š๐‘š๐‘๐‘๐‘›๐‘› 16 ๐‘๐‘ + ๐›ผ๐›ผ๐‘ž๐‘ž , 255

When ๐›ผ๐›ผ has the relatively high value 1516

= .9375, this rule essentially preserves as many clauses of small literal block distance as it can;

and for constant ๐‘๐‘ + ๐‘ž๐‘ž it favors those with small ๐‘๐‘.

to each clause ๐‘๐‘; here ๐›ผ๐›ผ is a parameter, 0 โ‰ค ๐›ผ๐›ผ โ‰ค 1. RANGE(๐‘๐‘) โ† 0 if ๐‘๐‘ is the reason for some literal in the trail; RANGE ๐‘๐‘ โ† 256 if ๐‘๐‘ is satisfied at level 0. If there are ๐‘š๐‘š๐‘—๐‘— clauses of range ๐‘—๐‘—, and if we want to keep at most ๐‘‡๐‘‡ clauses in memory, we find the largest ๐‘—๐‘— โ‰ค 256 such that

๐‘š๐‘š๐‘—๐‘— > 0 and ๐‘ ๐‘ ๐‘—๐‘— = ๐‘š๐‘š0 + ๐‘š๐‘š1 + โ‹ฏ+ ๐‘š๐‘š๐‘—๐‘—โˆ’1 โ‰ค ๐‘‡๐‘‡. Then we retain all clauses for which RANGE(๐‘๐‘) < ๐‘—๐‘—, together with ๐‘‡๐‘‡ โˆ’ ๐‘ ๐‘ ๐‘—๐‘— "tie breakers" that have RANGE(๐‘๐‘) = ๐‘—๐‘— (unless ๐‘—๐‘— = 256).

safely resolve conflicts on several different levels later, learning new clauses at that time.

A full trail allows us to compute signatures based on VAL fields.

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

tie breakers with โ€œactivityโ€ p.74

learned 10002 clauses

6252 clauses actually present in MEM

at most 3126 clauses will be removed by the

purging process

For example, with ๐›ผ๐›ผ = 1516

and the data from Fig. 50, we save clauses that have ๐‘๐‘ = (1, 2, 3, 4, 5) when ๐‘ž๐‘ž โ‰ค (5, 4, 3, 2, 0), respectively.

This gives us ๐‘ ๐‘ 95 = 12 + 3069 clauses, just 45 shy of our target ๐‘‡๐‘‡ = 3126.

So 45 tie-breakers from among the 59 clauses that have RANGE ๐‘๐‘ = 95, ๐‘๐‘, ๐‘ž๐‘ž = 5, 1 , that are arranged in order of increasing secondary heuristic ACT(๐‘๐‘),

the gray-and-black pattern is

So if we retain the 45 with highest activity, we pick up 8 of the 10 that turn out to be useful.

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

*Flushing literals and restarting. p.75

Peter van der Tak, Antonio Ramos, and Marijn Heule [J. Satisfiability, Bool. Modeling and Comp. 7 (2011), 133โ€” 138],

Algorithm C interrupts itself in step C5 not only to purge clauses but also to "flush literals" that is a useful way to rejuvenate the trail periodically by

following trends in the activity scores ACT(๐‘˜๐‘˜).

Set ๐‘ค๐‘คโ€ฒ โ† 0. While ACT ๐ฟ๐ฟ๐‘–๐‘–๐‘‘๐‘‘โ€ฒ+1 โ‰ฅACT ๐‘˜๐‘˜ , set ๐‘ค๐‘คโ€ฒ = ๐‘ค๐‘คโ€ฒ + 1. Then if ๐‘ค๐‘คโ€ฒ < ๐‘ค๐‘ค, jump back to level ๐‘ค๐‘คโ€ฒ.

This is the technique called "literal flushing," because it removes the literals on levels ๐‘ค๐‘ค๐‘™ + 1 through ๐‘ค๐‘ค

and leaves the others assigned. It effectively redirects the search into new territory,

without being as drastic as a full restart.

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

AGILITY p.76

Armin Biere [LNCS 4996 (2008), 28 โˆ’ 33]

High agility: lots of the recent propagations are flipping the values of variables and trying new possibilities; low agility : the algorithm is basically in a rut, spinning its wheels and getting nowhere.

which tends to be correlated with the desirability of flushing at any given moment.

a 32-bit integer variable called AGILITY, initially zero. Whenever a literal ๐‘™๐‘™ is placed on the trail in steps C4, C6, or C9,

we update the agility by setting

AGILITYโ† AGILITY โˆ’(AGILITYโ‰ซ13) + (((OVAL( ๐‘™๐‘™ ) โˆ’VAL( ๐‘™๐‘™ ) )&1) โ‰ช19)

the fraction AGILITY/232 is essentially multiplied by 1 โˆ’ ฮด, increased by ๐›ฟ๐›ฟ if the new polarity of ๐‘™๐‘™ differs from its previous polarity, ๐›ฟ๐›ฟ = 2โˆ’13 โ‰ˆ .0001.

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

AGILITY p.76

Armin Biere [LNCS 4996 (2008), 28 โˆ’ 33]

the agility is compared to a threshold, depending on ฮ”f , according to the schedule in Table 4.

(The parameter ๐œ“๐œ“ in that table can be raised or lowered,

if you want to increase or decrease the amount of flushing.)

If the agility is sufficiently small, ๐‘ฅ๐‘ฅ๐‘˜๐‘˜ is found and (126) is performed. Nothing changes if the agility is large or if ๐‘ค๐‘ค๐‘™ = ๐‘ค๐‘ค; otherwise (126) has flushed some literals,

using the operations of step C8.