All language subtitles for dpll

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German Download
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,840 --> 00:00:05,520 hello everybody so we're going to  now move on to the dpll algorithm   2 00:00:07,360 --> 00:00:13,440 so this is a complete algorithm for solving  satisfiability for propositional formulas   3 00:00:13,440 --> 00:00:19,440 based on two recipes the first one is search we  use depth first search and the second recipe is   4 00:00:19,440 --> 00:00:24,400 deduction we use a simplified version of  resolution that we saw earlier this week   5 00:00:25,600 --> 00:00:35,200 called unit resolution this algorithm was first  developed by um davis putnam yeah so the so-called   6 00:00:35,200 --> 00:00:45,120 dp algorithm so this uses only the deduction part  of the algorithm but then later on davis hired the   7 00:00:45,120 --> 00:00:50,400 program as logan and laughlin to implement this  algorithm and found out that this was not this   8 00:00:50,400 --> 00:01:00,160 was too memory intensive to yield a an efficient  algorithm and therefore the programmers discovered   9 00:01:01,680 --> 00:01:05,200 that combining it with search  namely depth first search   10 00:01:06,800 --> 00:01:12,000 was a good way to make this algorithm more  efficient and more amenable to implementation   11 00:01:12,000 --> 00:01:16,240 so uh this is basically the version that we're  going to see this dpll algorithm so there's   12 00:01:16,240 --> 00:01:23,680 a little history behind it so dpll is also the  basis for modern set solvers today um which uses   13 00:01:23,680 --> 00:01:33,360 the so-called cdcl algorithm and um which this  enhances dpl with very many heuristics like close   14 00:01:33,360 --> 00:01:40,320 learning non-chronological backtracking and this a  lot of these heuristics we're gonna see if you're   15 00:01:40,320 --> 00:01:45,040 interested we're gonna see um we're gonna cover we  cover this thing in the course automated reasoning   16 00:01:46,800 --> 00:01:53,840 so contact me if you're interested um also  one one thing one more thing to say is that   17 00:01:54,640 --> 00:02:01,680 we only gonna cover in this lecture a recursive  a recursive version of dpll which is a simpler   18 00:02:01,680 --> 00:02:08,800 version of dpl it has all the um all the  basic ideas of the pll but it's uh more memory   19 00:02:08,800 --> 00:02:14,160 intensive than the iterative version of that  okay which we're not gonna cover in the course   20 00:02:15,920 --> 00:02:21,680 okay so to start with let's talk a little bit  about the a simple depth first search algorithm   21 00:02:21,680 --> 00:02:28,960 for solving satisfiability here of course  we don't need the formula to be in cnf so 22 00:02:32,000 --> 00:02:38,000 basically what it does here is you  have an enumeration of the variables   23 00:02:38,640 --> 00:02:43,920 and then you go through this variables  one by one and then assign it by zero   24 00:02:43,920 --> 00:02:50,160 or one yeah by zero or one and then when you  hit unsatisfiability you go you you backtrack   25 00:02:50,160 --> 00:02:54,480 and then you flip the assignment and so on and so  forth so you want to enumerate all the possible   26 00:02:55,040 --> 00:03:01,440 all the possible assignments so what makes this  different from uh the truth table uh yeah by just   27 00:03:01,440 --> 00:03:09,120 by using a truth table the main difference here  is simply the the boolean short circuit or here   28 00:03:10,480 --> 00:03:18,720 and and what what what's going on here is that  when you when let's say the left part is already   29 00:03:18,720 --> 00:03:26,400 uh it's already satisfiable you will then just  return true yeah without actually having to   30 00:03:26,400 --> 00:03:32,560 go through the right part of of the boolean  or here okay so this is a short circuit it   31 00:03:32,560 --> 00:03:38,080 might save some time so this is of course um  yeah i mean this is uh probably more efficient   32 00:03:38,080 --> 00:03:42,480 can be more efficient in some cases than  just enumerating all the possibilities yeah   33 00:03:43,680 --> 00:03:51,120 also if you just try to take a look at the details  here this is written in a python style pseudocode   34 00:03:51,120 --> 00:03:59,360 so you can see here you have this is recursive  in particular you check if the formula is top   35 00:03:59,360 --> 00:04:04,080 or bottom so there are the two cases here and  then after that if it's not top or bottom so   36 00:04:04,080 --> 00:04:07,440 it means there's a variable you just use  one of the variable and then you assign   37 00:04:07,440 --> 00:04:16,640 zero or one to it okay and then you then recurse  on the function okay so um let's take a look at uh 38 00:04:19,040 --> 00:04:28,560 let's try to apply this algorithm on this  example so let's say we start with x equals zero 39 00:04:31,440 --> 00:04:38,160 yeah x equals zero and if you simplify this thing  you'll realize that this actually ends up with   40 00:04:38,160 --> 00:04:42,960 bottom you don't really know you don't really need  to know what the y is in fact yeah you already can   41 00:04:42,960 --> 00:04:50,000 say that this is in fact this is equivalent to um  it's already equivalent to bottom all right so um   42 00:04:51,760 --> 00:04:56,800 then we don't really need to continue it means  so we just have to go we just have to go back now   43 00:04:56,800 --> 00:05:03,200 and then say okay so that's not good now we're  gonna check if it if x equals one all right so   44 00:05:04,160 --> 00:05:14,720 in this case we have uh y so we simplify we assign  0 to x yeah and then we do the simplification   45 00:05:15,280 --> 00:05:25,280 so we get y and not y okay of course if you just  assign y equals 0 or 1 here in both cases you will   46 00:05:25,280 --> 00:05:33,600 get bottom as well yeah so after you get here from  here you go back to the initial uh the top level   47 00:05:33,600 --> 00:05:38,480 of the recursion and you say it is unsatisfiable  but i think the the thing that i wanna   48 00:05:39,440 --> 00:05:43,440 uh the message here is that  you do actually save some time   49 00:05:43,440 --> 00:05:48,480 if you're actually just using truth table you  will have to assign every single um i'll have to   50 00:05:48,480 --> 00:05:53,040 go through every single assignment but in this  case you don't actually need to go through the   51 00:05:53,040 --> 00:05:59,680 case of y equals zero or y equals one is where you  already know that it is unsatisfiable right so um 52 00:06:02,720 --> 00:06:10,000 yeah so the so the main point here is that  this is actually faster than truth table   53 00:06:10,000 --> 00:06:15,520 in some cases yeah so um here i just  wanted to say here if you have a term   54 00:06:17,040 --> 00:06:27,200 that is what is a term so a term is a conjunction  of a conjunction of um of literals yeah if you   55 00:06:27,200 --> 00:06:33,600 if you use this if you use this uh if you use this  algorithm then this will run in actually will run   56 00:06:33,600 --> 00:06:39,840 in polynomial time on on terms yeah conjunctions  of literals but truth tables you will you have to   57 00:06:39,840 --> 00:06:44,400 uh this will have to run in exponential time  i mean this is all i meant here in the note   58 00:06:45,040 --> 00:06:51,520 okay so um that's the search part of dpll so let's  take a look at the second part which is the uh   59 00:06:52,640 --> 00:06:58,560 the deduction part of the dpl and as i mentioned  this is a simplified version of resolution   60 00:06:58,560 --> 00:07:05,440 the so-called unit resolution and  this rule can be summarized as follows 61 00:07:07,760 --> 00:07:15,120 using this using this uh this tableau here  basically what it says is that we apply we   62 00:07:15,120 --> 00:07:24,400 try to produce a resolvent yeah by taking one  of the one of the one of the clauses in the   63 00:07:25,760 --> 00:07:32,160 one of the two clauses that we need to take to  produce a resolvement must be a unit clause a unit   64 00:07:32,160 --> 00:07:38,880 clause means a clause consisting only of a single  literal so in this case is this bit here yeah okay 65 00:07:42,960 --> 00:07:49,360 um so here's a little example so suppose  you have two clauses so the clause   66 00:07:50,320 --> 00:08:01,360 x here and the clause not x y not z and if you  apply this rule this unit resolution basically   67 00:08:01,360 --> 00:08:08,480 you apply it just like you apply resolution so you  take you remove the you remove the um two opposite   68 00:08:08,480 --> 00:08:13,440 literals which is x and not x here yeah and then  you just take this the remaining literal which   69 00:08:13,440 --> 00:08:18,720 is y and not that okay so that's basically unit  resolution it's simpler than a normal resolution   70 00:08:20,000 --> 00:08:27,520 so here's a little example of unit resolution  um so as you can see here there's only one way   71 00:08:27,520 --> 00:08:33,280 to apply unit resolution at the beginning you  just have to pick a unit literal which is this   72 00:08:33,280 --> 00:08:39,600 only one option which is this one right p um  so in this case there's actually also only one   73 00:08:39,600 --> 00:08:44,880 option you have to pick this one because this  is only p and not p area so in this case you   74 00:08:44,880 --> 00:08:55,280 produce q now you can then apply another unit  um another unit resolution by applying this this   75 00:08:55,280 --> 00:09:02,000 um and that yeah and then you get r commas  yeah so that's basically the end of uh   76 00:09:02,720 --> 00:09:06,880 um so you can apply unit resolution  several times and this procedure   77 00:09:06,880 --> 00:09:15,760 where you apply unit resolutions repeatedly this  is called boolean constraint propagation bcp so um   78 00:09:17,040 --> 00:09:23,760 and that's basically the underlying one of the  underlying procedure uh sub procedure behind   79 00:09:24,800 --> 00:09:35,840 the depela algorithm so so here this dpl  algorithm is simply a modification of the dfs   80 00:09:36,480 --> 00:09:42,560 algorithm for satya the one that we saw  earlier by having this line here before you   81 00:09:44,000 --> 00:09:49,440 go through this you try to assign true and false  etc you just try to simplify the formula first by   82 00:09:49,440 --> 00:09:55,520 applying unit resolution as much as possible  yeah so let's take a look at some examples 83 00:09:57,680 --> 00:10:05,040 so here is a little formula with four  um oh actually one one thing i need to   84 00:10:05,040 --> 00:10:12,960 note here quickly in this case uh you do need  the formula to be in cnf otherwise this will not   85 00:10:12,960 --> 00:10:18,000 work yeah this bcp thing i mean this is unlike of  course unlike the dfs algorithm which would work   86 00:10:18,560 --> 00:10:24,720 regardless whether or not the  formula the input formula is in cnf   87 00:10:26,640 --> 00:10:32,080 okay so let's take a look at this  example here a formula with four clauses 88 00:10:34,160 --> 00:10:36,000 um right so 89 00:10:38,480 --> 00:10:44,320 if you apply if you try to apply dpl the first  thing that we notice is that we cannot actually   90 00:10:45,360 --> 00:10:50,720 in the beginning we cannot apply bcp right because  there is no unit clause so for this reason we will   91 00:10:50,720 --> 00:10:56,880 have to branch yeah so this branching here it  means that we will have to consider q equals   92 00:10:56,880 --> 00:11:02,480 let's say well i mean you have the sine of uh one  or zero to one of the variables basically right   93 00:11:02,480 --> 00:11:08,560 and here the choose variable function let's say  it returns q okay so we just pick a variable   94 00:11:08,560 --> 00:11:15,760 let's say q and let's say q equals one and we  consider two cases we split two cases q equals   95 00:11:15,760 --> 00:11:21,200 one and q equals zero let's take a look at the  left case first in this case we assign one to   96 00:11:21,200 --> 00:11:26,480 zero so this is the simplification so the if  you assign one of course this because this is a   97 00:11:27,760 --> 00:11:31,680 this is a clause so each clause here  for example this one if you assign one   98 00:11:31,680 --> 00:11:35,520 it means that the entire clause is true so you  remove it you don't actually need to consider   99 00:11:35,520 --> 00:11:41,520 that because it's or yeah remember so this is  gone and then you only consider the cases where   100 00:11:41,520 --> 00:11:47,040 the uh the clause the clause the remaining  clauses that are not um there are that were   101 00:11:47,040 --> 00:11:52,000 not made true by this assignment okay so in in  which case we have this uh the second one here   102 00:11:52,640 --> 00:11:58,720 so you assign zero here so you only have r and  then also you have not r and you have p and not   103 00:11:58,720 --> 00:12:07,040 r yeah okay so that's uh the resulting um the  resulting formula after assigning q to one   104 00:12:07,600 --> 00:12:13,520 now what do we have next well we see now that  we can actually apply unit resolution here yeah   105 00:12:13,520 --> 00:12:20,800 so uh in fact if you just apply if you just  uh take this r and not r you will immediately   106 00:12:20,800 --> 00:12:26,000 get a contradiction you will immediately derive  the empty you will immediately derive the empty   107 00:12:27,920 --> 00:12:32,960 the empty clause okay so you use bcp here  by resolving this so you get empty clause   108 00:12:32,960 --> 00:12:40,080 and of course if you get an empty clause you  remember that we um basically this is already   109 00:12:40,080 --> 00:12:46,480 unsatisfiable and if you just let's say go back  again to the procedure here so if this gives   110 00:12:46,480 --> 00:12:50,720 you unsatisfiable basically you get here and  you're gonna return false yeah so you're gonna   111 00:12:52,400 --> 00:12:56,880 basically that's what you get here if you return  false but then if you return false then you have   112 00:12:56,880 --> 00:13:01,120 to it means that you have to consider the other  cases because you split you've only considered one   113 00:13:01,120 --> 00:13:05,840 case that is q equals one now we can consider  the second case that is q equals zero yeah   114 00:13:06,560 --> 00:13:12,320 so if in this case when you assign q equals  zero we do the same thing and the remaining   115 00:13:13,760 --> 00:13:17,840 in fact clause here are not clauses only have  one plus left because the other clauses have   116 00:13:17,840 --> 00:13:25,360 been made true by this assignment so you have  not b comma r yeah now what do we have here   117 00:13:25,360 --> 00:13:31,840 so in this case not p comma r we don't actually  have a unit clause so we have to do assignment   118 00:13:31,840 --> 00:13:38,080 again we have to assign uh something to p and also  to r so let's just say that we make the assignment   119 00:13:38,080 --> 00:13:45,280 now p equals zero p equals one if p equals zero  um this is actually already true yeah so actually   120 00:13:45,280 --> 00:13:51,120 you could you could have stopped here and you  don't need you don't actually need to to continue   121 00:13:51,120 --> 00:13:55,280 because you already know that there's something  that already makes this entire formula true   122 00:13:56,320 --> 00:14:01,760 yeah but let's just say for our for an argument's  sake we just look at the other cases yeah so we   123 00:14:01,760 --> 00:14:10,240 get uh if you look consider the case of r equals  um so if you let's say start with p equals one you   124 00:14:10,240 --> 00:14:15,920 get this yeah and then you have to assign r equals  zero or r equals one and then you get uh in this   125 00:14:15,920 --> 00:14:23,040 case you get false in this case you get uh you got  a bottom and you got top yeah so in any of these   126 00:14:23,040 --> 00:14:30,240 cases where you get top you would the procedure  will return um satisfiable and will return true   127 00:14:30,240 --> 00:14:38,000 to um we'll say that the formula is satisfiable  okay so that's the um that's the example   128 00:14:39,520 --> 00:14:45,520 and of course you can read a solution so  so if you have a path from um if you hit   129 00:14:46,080 --> 00:14:51,520 a top at the end you can actually then read  off the solution from the path from the root   130 00:14:52,160 --> 00:14:57,840 to the leaf yeah by just reading the um  by just uh by just taking a look at the um   131 00:14:58,480 --> 00:15:05,280 uh so we just have to look at the assignments  that you make for um for the for the variables 132 00:15:07,680 --> 00:15:17,680 um here's a little simple improvement that you  can make this is uh basically already this was   133 00:15:17,680 --> 00:15:26,240 already proposed by davis and putnam initially  before loggerman and laughlin came around and 134 00:15:28,400 --> 00:15:33,360 introduced the improvement using dfs yeah  so this is the so-called pure literal rules   135 00:15:33,920 --> 00:15:40,160 so what is what is going on here so  appear so um we say that a literal   136 00:15:40,160 --> 00:15:49,120 yeah a literal basically x or not axia we say that  a literal is pure if it appears only positively or   137 00:15:49,120 --> 00:15:53,840 negatively in the formula okay so it means only  positively or only negatively in the formula 138 00:15:56,320 --> 00:16:05,360 so what is so special about pure literals we  can simply yeah we can make them true before   139 00:16:05,360 --> 00:16:16,080 we choose a decision variable to branch yeah so  so because we we know that it only appears either   140 00:16:16,080 --> 00:16:20,640 only positively or only negatively so basically  you say like okay so let's say if it only appears   141 00:16:20,640 --> 00:16:26,560 positively we just make this uh we just make x  true yeah if it only appears negatively we just   142 00:16:26,560 --> 00:16:31,760 makes x false and this will save some time um so  you so that you don't have to consider the case   143 00:16:31,760 --> 00:16:39,440 of x equals true or x equals false and you will  we'll see in a we'll try to apply this to the   144 00:16:39,440 --> 00:16:46,960 example that we just saw just now um okay before  that let's just uh summarize the algorithm here   145 00:16:46,960 --> 00:16:51,600 with this pure literals so basically  what's going on here is that   146 00:16:52,960 --> 00:16:59,120 you apply pure literals these pure  literal rule which is uh written   147 00:16:59,840 --> 00:17:04,560 here yeah set pure true we just set  all the pure literals to be true   148 00:17:05,680 --> 00:17:17,840 and we also apply the bcp algorithms um repeatedly  okay in turn and and we break when these two   149 00:17:18,400 --> 00:17:25,440 when these two procedures set pure true and  bcp do not change the formula at all okay   150 00:17:26,560 --> 00:17:32,480 so this is basically the only addition to  it so you just add this set pure true so 151 00:17:36,640 --> 00:17:40,240 so this is the example that we saw  just now so this is the entire tree   152 00:17:40,800 --> 00:17:48,880 so let's see what the tree looks like when we  apply this sub-pure true in this in this case 153 00:17:51,680 --> 00:17:58,240 the tree looks like this if we apply  the set pure true so when so we so   154 00:17:59,360 --> 00:18:05,280 we go through this from start to finish so from  start so remember initially we try to see like   155 00:18:05,280 --> 00:18:09,920 here yeah we try to see that uh the formula  you can apply bcp to the formula and you say no   156 00:18:10,800 --> 00:18:17,200 you can't apply bcp but can you apply pure um the  set pure true here and then you check like okay   157 00:18:17,200 --> 00:18:24,560 um what about p so p appears both positively and  negatively so here positive and negative so that's   158 00:18:24,560 --> 00:18:29,840 not a pure literal p is not a pure literal yeah  pure not p is not a pure literal uh what about q   159 00:18:30,400 --> 00:18:36,880 q here negative positively and negatively so  that's not pure what about r the same yeah   160 00:18:36,880 --> 00:18:42,480 so you can see r and not r here so you can also  so you also you cannot apply this set pure true   161 00:18:42,480 --> 00:18:45,520 so this means that you still have to do  the branching without actually this this   162 00:18:46,080 --> 00:18:49,440 it means it doesn't make a  difference at the top level so you   163 00:18:49,440 --> 00:18:54,240 um so this is fine so i'm not going to cover this  bit so let's just cover this bit here yeah so   164 00:18:54,240 --> 00:18:57,440 this is the the part or the second part that's  kind of where it's going to make a difference   165 00:18:58,960 --> 00:19:04,720 so in this case so if you take a look at  this what's going on is that well so for this 166 00:19:07,120 --> 00:19:12,960 clause here or for this formula here you see that  both not p and r are actually pure literals at the   167 00:19:12,960 --> 00:19:19,200 step yeah um in this step so you can simply  make this pure literal true so for example   168 00:19:19,200 --> 00:19:24,800 um not p is your pure literal so you just make  p true that is we set p to be zero um so we just   169 00:19:24,800 --> 00:19:30,320 apply this thing and then we get a top okay so we  don't have to you can you can see the two cases   170 00:19:30,320 --> 00:19:35,760 here so this can be for example can be big like  this but in this case you only get a single um   171 00:19:37,040 --> 00:19:42,320 so you actually save some time like having to go  through some of the some of the combination of   172 00:19:42,320 --> 00:19:49,600 b and r yeah so it can be pretty handy sometime  to apply this and that's just one example right   173 00:19:49,600 --> 00:19:57,120 so that's pretty much it i have to i have some  exercises for you um to exercise in fact and uh   174 00:19:57,840 --> 00:20:05,440 yeah try to spend some time to go through this  try to apply both the pll with or without the   175 00:20:05,440 --> 00:20:11,600 pure literal rule and see how you can um how  this uh how you can solve this thing yeah so   176 00:20:11,600 --> 00:20:16,880 also try to look at different combination of  um the choose variable strategy yeah in which   177 00:20:16,880 --> 00:20:21,680 order it can be better and for which example when  you well actually in the final exam can be handy   178 00:20:21,680 --> 00:20:26,400 when you try to do this yeah because if you know  how to do this well then it can be faster for you   179 00:20:27,280 --> 00:20:33,840 okay so we'll go through the solution at some  point okay so we're gonna now talk about how to   180 00:20:35,040 --> 00:20:40,400 implement dpll efficiently in particular  we're going to talk about boolean constraint   181 00:20:40,400 --> 00:20:47,600 propagation how to implement this efficiently  because like it or not the main bottleneck of   182 00:20:47,600 --> 00:20:57,760 this algorithm the depel algorithm is really in  the frequent use of bcp and unit resolution so   183 00:20:57,760 --> 00:21:06,080 one rule that is really important is the so-called  deleting redundant clauses rules and this consists   184 00:21:06,080 --> 00:21:12,000 of two different rules sub proofs the first one  is that we want to delete all clauses containing   185 00:21:12,000 --> 00:21:18,880 the unit clause that is suppose we want to  apply unit resolution on the unit clause 186 00:21:21,360 --> 00:21:27,280 on this unit clause here so we want to do what  we want to do is that after we finish applying 187 00:21:29,520 --> 00:21:35,040 all unit resolutions involving this unit  clause we want to delete this unit clause   188 00:21:35,040 --> 00:21:42,560 all right and the second one is that we want to  delete all occurrences of the negation of l from   189 00:21:42,560 --> 00:21:48,560 the other classes so let me just first show you  um before i explain to you why this is the case   190 00:21:48,560 --> 00:21:55,600 why this is okay to do let me first explain by  an example say we have the full example here   191 00:21:56,480 --> 00:22:03,680 and we in this case we have to apply um  unit resolution involving this clause here   192 00:22:04,400 --> 00:22:08,720 so what you do here in this case you only  have a chance to do it with this one for   193 00:22:08,720 --> 00:22:16,080 example yeah so this and that so in this case  you need to then delete these clauses here   194 00:22:17,360 --> 00:22:22,480 and then after that what you do next is you're  gonna then delete the not l from the other   195 00:22:22,480 --> 00:22:28,080 clauses which is in this case this is their the  only remaining one so the question is why can we   196 00:22:28,080 --> 00:22:35,680 um why can we do this why can we  delete these clauses so one thing is   197 00:22:37,120 --> 00:22:43,200 in order to understand this it is important to  perhaps reformulate a little bit what we are   198 00:22:43,200 --> 00:22:49,920 really doing when we do this unit resolution and  boolean constraint propagation so every time we do   199 00:22:49,920 --> 00:22:55,360 boolean uh every time we do unit resolution  yeah let's say involving this unit clause   200 00:22:56,160 --> 00:23:02,240 oops involving this unit clause l here what  we're really doing is that because this is   201 00:23:02,240 --> 00:23:09,440 a clause and this contains only of a  single literal and we have a formula in cnf   202 00:23:10,560 --> 00:23:15,600 what we have to do here is in order to keep  this in order to keep this formula satisfiable   203 00:23:17,280 --> 00:23:22,800 the satisfying assignment must set l to be true  you have no other choice right this is what you   204 00:23:22,800 --> 00:23:29,200 have to do and if you set l to be true of course  all the other of course all the other l and the   205 00:23:29,200 --> 00:23:33,360 all occurrences of l everywhere else is going  to be true and for example in this case here   206 00:23:34,480 --> 00:23:39,120 if you set this thing to be true this is gone  why is this gone because this is a clause a   207 00:23:39,120 --> 00:23:44,480 clause is a disjunction of stuff as soon as one  of the literals is true it's true right so it's   208 00:23:44,480 --> 00:23:50,640 gone in the sense that you know it's no longer is  it's no longer a problem so it's true so we just   209 00:23:50,640 --> 00:23:55,280 we just get rid of it yeah so we are only worried  about it when this is false not when it's true   210 00:23:55,280 --> 00:24:00,080 because you have the conjunction of clauses  yeah so if you have one of the conjuncts is   211 00:24:00,080 --> 00:24:03,680 true you just simply get rid of it you don't care  about it so this is basically what's going on   212 00:24:03,680 --> 00:24:11,200 you set l to be true so all the clauses containing  l you just simply remove them all right and by the   213 00:24:11,200 --> 00:24:18,720 same token you have the not l as well for example  this one here yeah so if you set out to be true of   214 00:24:18,720 --> 00:24:24,800 course not all has to be said to be false yeah so  in this case uh again remember a clause you have a   215 00:24:24,800 --> 00:24:30,960 um it's a disjunction of literals so as soon as  if you have one of if one of the literals is false   216 00:24:31,920 --> 00:24:35,840 and you have a disjunction it doesn't matter  right so you just have to simply remove   217 00:24:35,840 --> 00:24:40,240 this literal yeah all right so this is  basically what you're doing here as well   218 00:24:40,240 --> 00:24:45,520 okay so that's basically the reason why we  can remove the clauses uh while we can do this   219 00:24:45,520 --> 00:24:51,040 to why we can do these two rules here because  they preserve satisfiability yeah and this is   220 00:24:52,560 --> 00:25:00,160 for um this is formally stated in this proposition  so if you have a formula of this form that is   221 00:25:00,160 --> 00:25:06,480 one of the so your formula in cnf and one of the  clauses is a unit clause let's say l containing   222 00:25:06,480 --> 00:25:12,640 of only of l here then of course you have to set  l to be true so in that case you simply just set   223 00:25:12,640 --> 00:25:20,000 l to be uh replace l by true but by top sorry and  then you replace not l by bottom yeah so this is   224 00:25:20,000 --> 00:25:27,040 has this has to be equally satisfiable yeah so  um yeah so this i've explained to you why this   225 00:25:27,040 --> 00:25:34,000 is the case and i encourage you to try to write  down the formal proof of this um the main idea   226 00:25:34,000 --> 00:25:42,800 as i've already just described yeah so um now the  next thing of course is uh okay so we can do this   227 00:25:42,800 --> 00:25:49,840 this sounds good but how does this affect the  complexity of boolean constraint propagation why   228 00:25:49,840 --> 00:25:55,520 does this make things faster the main reason why  this makes things faster is that with the deletion   229 00:25:55,520 --> 00:26:02,400 rules that we just mentioned the number of clauses  kept in the memory will never really grow yeah so   230 00:26:03,360 --> 00:26:12,400 each application of unit resolution will remove  will remove one of the one of the clauses yeah   231 00:26:12,400 --> 00:26:18,400 and the unit clause yeah and for the other  clauses the what's really going to happen is   232 00:26:18,400 --> 00:26:23,360 that you're just simply going to remove one of  the literals from them okay so you don't really   233 00:26:23,360 --> 00:26:30,000 add new colossals to this to this formula okay  so this is why you can essentially the reason   234 00:26:30,000 --> 00:26:35,920 why you can implement this thing in polynomial  time and also if you want to make this faster   235 00:26:36,640 --> 00:26:40,320 you can actually make this you can actually  implement this in linear time in fact   236 00:26:40,320 --> 00:26:47,840 and this you can be done by help of hash maps so  you can for example take a couple of hash maps as   237 00:26:48,560 --> 00:26:56,000 as described here you can have a hash map  from formulas to um so from formulas to   238 00:26:56,560 --> 00:27:00,800 the corresponding clauses so basically  let's say you index the clauses one two   239 00:27:00,800 --> 00:27:08,400 three et cetera in this case you you have one  two let me just write down here so one two three   240 00:27:08,400 --> 00:27:16,960 etc here and you also have a map from from the  literal to the claw so for example here you map it   241 00:27:16,960 --> 00:27:22,800 here and this you map it here etc so this is this  will help you so as soon as you for example need   242 00:27:22,800 --> 00:27:29,360 to delete not p you just simply have to look at  this uh lookup table the hashmap and then you then   243 00:27:29,360 --> 00:27:36,560 get mapped to the corresponding the corresponding  clauses to delete them etc yeah so this is um this   244 00:27:37,520 --> 00:27:42,240 basically then you don't really need to go through  the entire set of clauses so you can simply go   245 00:27:42,240 --> 00:27:50,000 directly to the the clause that you really need  to modify and finally you have a set of keys for   246 00:27:50,000 --> 00:27:55,680 f for unit classes that is this one yeah so  this is basically um this will help you to   247 00:27:57,280 --> 00:28:00,240 trigger the corresponding unit  clauses that you have to apply   248 00:28:00,880 --> 00:28:07,520 all right so um yeah so i um this is one of the  main one of the possibilities um if you want to   249 00:28:07,520 --> 00:28:11,040 implement this thing in linear time there are  of course other ways to do it but the important   250 00:28:11,040 --> 00:28:14,720 thing is yeah you need to use some kind of hash  maps and maybe you can decide several of them   251 00:28:15,680 --> 00:28:21,200 okay so um i'll just say something i'll just  say really quickly about correctness of dpll   252 00:28:22,240 --> 00:28:27,200 so in order to prove correctness of dpl you need  to prove termination and partial correctness   253 00:28:27,200 --> 00:28:34,960 namely that the algorithm terminates and partially  correct correctness means if it terminates it will   254 00:28:34,960 --> 00:28:40,640 output the right thing um so the proof of  this is actually not really difficult but   255 00:28:40,640 --> 00:28:45,280 if you want to write down in detail it actually  can be a little bit long but in order to prove   256 00:28:45,280 --> 00:28:50,080 correctness what you really need to do is just to  observe that all the subroutine yeah that is bcp   257 00:28:50,080 --> 00:28:58,080 sub pure true and dfs here all of this um all of  this terminate yeah so one thing that is important   258 00:28:58,080 --> 00:29:04,640 of course with vcp is uh yeah i mean this is  a again as you saw it's a kind of uh um this   259 00:29:04,640 --> 00:29:09,360 is a kind of a fixed point it's kind of a fixed  point thing and this is um when you implement   260 00:29:09,360 --> 00:29:15,440 this together with sad pure true is also kind of  a fixed point thing as well so you can sort of use   261 00:29:16,800 --> 00:29:25,040 an argument related to you know that that you will  reach a fixed point yeah so for dfs i mean this is   262 00:29:25,040 --> 00:29:30,480 uh i guess um there's nothing much to say about  this thing because you really just enumerate all   263 00:29:30,480 --> 00:29:36,160 the all the possibilities and finally for partial  correctness yeah i mean this you can try to argue   264 00:29:36,160 --> 00:29:44,480 by induction on the size of the formulas yeah and  so on and so forth so um yeah i think i want to   265 00:29:44,480 --> 00:29:49,280 stop here and again i want to mention that i  want to emphasize that we've only looked at the   266 00:29:51,280 --> 00:29:57,680 recursive version of dpl of dpll yeah and  this is not the most efficient version of dpl   267 00:29:58,880 --> 00:30:03,600 the reason of course the reason behind it is that  if you use recursion there's an implicit implicit   268 00:30:03,600 --> 00:30:09,360 stack and every time you need to go to the next  level of the recursion you need to copy things   269 00:30:10,560 --> 00:30:15,520 you need to copy the entire formula which can  be quite large and this is quite expensive so   270 00:30:16,400 --> 00:30:22,400 if you want to make this fast you need to turn  this into an iterative version of the algorithm   271 00:30:23,840 --> 00:30:28,320 and in order to do that i encourage  you to take a look at some of these   272 00:30:29,360 --> 00:30:33,440 references and of course  these references also contain   273 00:30:33,440 --> 00:30:40,320 the the algorithm the cdcl algorithm that i that  we mentioned at the beginning of the lecture   274 00:30:41,440 --> 00:30:46,720 yeah and um i especially encourage you  to look at this one if you're interested 36050

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.