Professional Documents
Culture Documents
Let A and B be the nodes and let us label the coulours as 1 and 2. The
question is: can we bi-colour this graph? It is quite easy to realize that the
answer is yes (we can even guess a solution), but at the moment let us focus
on the fact that somebody, say Bob, knows the solution and that our only way
to nd out the solution is to ask Bob only yes or no questions. How can we
structure the questions? Well, we could ask, for example
We can write such question as a variable XA1 and associate to it the value 1
if the answer is yes and 0 if the answer is no. We could also interpret XA1 as the
statement vertex A is coloured with colour 1 . Thus, assigning 1 to XA1 means
that the statement is true , while assigning 0 would mean that it is false . For
this reason, 0 and 1 are called truth values. Therefore, by asking an exhaustive
set of questions (or presenting an exhaustive set of sentences) to Bob, we would
know if we have a solution and, if the answer is armative, we would have a
list of 0's and 1's that would tell us how to bi-colour the graph.
What sentences should we present to Bob? Well, we should ask whether
vertex A and B have at least one colour, whether vertex A and B have at most
one colour1 and whether the two adjacent verteces have dierent colours. In
1 It is important to understand that we have exactly one colour when we have at least and
1
other words, we need the following list:
We need to observe that the sentence vertex A has at least one colour is
equivalent to vertex A has colour 1 or vertex A has colour 2, which in turns can
be written XA1 ∨ XA2 , where ∨ stands for or . Likewise, vertex B has at most
one colour is equivalent to vertex B does not have colour 1 or vertex B does not
have colour 2 , i.e. ¬XB1 ∨ ¬XB2 , with ¬ the simbol for negation. In this way,
we are translating our English sentences into Propositional Logic :
XA1 ∨ XA2 ,
XB1 ∨ XB2 ,
¬XA1 ∨ ¬XA2 ,
(1)
¬XB1 ∨ ¬XB2 ,
¬XA1 ∨ ¬XB1 ,
¬X ∨ ¬X .
A2 B2
A variable, e.g. XB2 , or its negation, e.g. ¬XB2 , are called literals , a
disjunction of literals L1 , . . . , Lk , e.g. L1 ∨ · · · ∨ Lk , is called a clause , and a
conjunction of clauses C1 ∧ · · · ∧ Cn is called a conjuntive normal form (i.e.
CNF ). Thus, the list in (1) is a CNF.
2
S ={{XA1 , XA2 }, {XB1 , XB2 }, {¬XA1 , ¬XA2 }, {¬XB1 , ¬XB2 },
Step 1
Remove every tautological clause from S , i.e. every clause containing a variable
and its negation, thus forming Sclean . In this case, there are no tautologies and
S = Sclean .
Step 2
Choose a variable that occurs in the shortest clause. We call this selected
variable the pivot and write P1 . For example, let us choose P1 = XA1 .
Step 3
List all the P1 -exempted clauses, that is, clauses containing neither P1 nor ¬P1 .
In this case, {XB1 , XB2 }, {¬XB1 , ¬XB2 }, and {¬XA2 , ¬XB2 }.
Step 4
Among the remaining clauses, compute all the P1 -resolvents, that is, all possible
resolvents on P1 and ¬P1 . In this case, the remaining clauses are {XA1 , XA2 },
{¬XA1 , ¬XA2 }, and {¬XA1 , ¬XB1 }, so we can form two resolvents:
3
Step 5
Collect the P1 -exempted clauses and the P1 -resolvents and remove all the tau-
tologies possibly generated in step 4. We call the resulting set S1 . In our case,
{{XB1 , XB2 }, {¬XB1 , ¬XB2 }, {¬XA2 , ¬XB2 }, {XA2 , ¬XA2 }, {XA2 , ¬XB1 }},
but {XA2 , ¬XA2 } is a tautology (it is a clause that contains both a literal
and its negation), thus
In this way, our CNF has less variables (and ideally less clauses) and we can
repeat the procedure on S1 :
• choose P2 = XA2 ;
• among the remaining clauses, compute all the P2 -resolvents. The re-
maining ones are {¬XA2 , ¬XB2 } and {XA2 , ¬XB1 } and they generate
{¬XB2 , ¬XB1 };
• collect the P2 -exempted clauses and the P2 -resolvents and remove all the
tautologies, thus forming
• choose P3 = XB1 ;
• list all the P3 -exempted clauses. Since there are no P3 -exempted clauses,
we simply have the empty set ∅;
• among the remaining clauses, compute all the P3 -resolvents. The remain-
ing ones are {{XB1 , XB2 }, {¬XB1 , ¬XB2 }, and {¬XB1 , ¬XB2 } and they
generate {XB2 , ¬XB2 } and {XB2 , ¬XB2 };
4
Theorem 1. When DPP terminates with the empty CNF ∅, the original CNF
was true, i.e. it was a true statement.
In our particular case of bi-colouring our initial graph, the fact that S3 = ∅
guarantees that yes, the graph can be bi-coloured .
Question: can we bi-colour the following graph?
A D
B C
Apply DPP to nd out. You need to model the problem with the language
of clauses and CNF as before and apply DPP until you nd out either ∅ or
`something else '. What would that `something else' be? You can research more
on DPP and resolution of formulas in [1].
References
[1] D. Mundici, Logic: a Brief Course, Springer, 2012.