0% found this document useful (0 votes)
25 views5 pages

SAT Exercises

The document contains 33 exercises involving propositional logic and problems that can be modeled with propositional logic formulas. Some of the exercises involve proving statements using techniques like truth tables, resolution, or transforming formulas between conjunctive normal form and disjunctive normal form. Other exercises involve modeling problems as propositional logic formulas, such as graph coloring problems, radio frequency assignment problems, jury selection problems, and more. The exercises increase in complexity and cover a wide range of topics involving propositional logic.

Uploaded by

Ahmad Eid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views5 pages

SAT Exercises

The document contains 33 exercises involving propositional logic and problems that can be modeled with propositional logic formulas. Some of the exercises involve proving statements using techniques like truth tables, resolution, or transforming formulas between conjunctive normal form and disjunctive normal form. Other exercises involve modeling problems as propositional logic formulas, such as graph coloring problems, radio frequency assignment problems, jury selection problems, and more. The exercises increase in complexity and cover a wide range of topics involving propositional logic.

Uploaded by

Ahmad Eid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Propositional Logic: exercises

1. Prove that p ∧ ¬p is unsatisfiable

2. Prove that p ∨ ¬p is a tautology

3. Write the truth table of the following two formula (p ∧ ¬(q ∨ r)) and (¬p ∨ (q ∨ r)). Say for each
one if it is a tautology, satisfiable or contradiction. Say if one is a logical consequence of the
other

4. Let F and G be two formula. Is it true that F ∨ G is a tautology iff one of them is a tautology?

5. Find three formula F 1, F 2, and F 3 such that F 1 ∧ F 2 ∧ F 3 is unsatisfiable and such that the
conjunction of any pair of them is satisfiable

6. Prove that (¬q ∨ ¬r ∨ p) ∧ (p ∨ q) ∧ (r ∨ p) and p ∨ q are not logically equivalent

7. Prove that (p ∨ q) ∧ (r ∨ p) ∧ (¬q ∨ ¬r ∨ p) ≡ p

8. if Si F → G is a tautology and F is a tautology, then G is a tautology?

9. Let F and G be two formula. Is it true that F |= G or F |= ¬G?

10. Are there any F and G such that F |= G and F |= ¬G?

11. Write a satisfying interpretation and a non-satisfying interpretation for the following formula,

(p ∧ (q ∨ r) ∧ ¬(p ∧ q) ∧ ¬(p ∧ r)) ∨ (p ∧ ¬r)

12. Consider the following formula,


F = (p → q) ∨ (q → r)
G = (p ∨ q ∨ r) ∧ (¬p → q) ∧ (¬r → p)
For each pair of formulas in the set {F, G, ¬F, ¬G} indicate whether one is a logical consequence
of the other.

13. Prove using truth tables that p → (q ∧ r) |= (¬q ∨ ¬r) → ¬p

14. Let F = ¬(¬p ∧ ¬q ∧ ¬r) ∧ (¬p ∨ q ∨ r) and G = q ∨ r. Say which one of the following properties
hold: F |= G, G |= F , F ≡ G, F ∧ ¬G is a tautology, F ∧ ¬G is a contradiction, ¬F ∨ G is a
tautology, ¬F ∨ G is a contradiction.

15. Is the following statement true? (provide a justification for your answer). If F → G is satisfiable
and F is satisfiable, then G is satisfiable.

16. Say wether the following statements are true or not:

• For every formula F there is a logically equivalent formula G in CNF


• For every formula F there is a unique logically equivalent formula G in CNF
• If F is a tautology, there is a unique equivalent formula in CNF.
• If F is a contradiction, there is a unique equivalent formula in CNF.

17. Transform the following sentence into CNF using two methods: i) via distributivity, ii) via
Tseitin.

F = ¬p ∧ q ∨ ¬(¬r ∨ ¬q)
18. A boolean formula is in disjunctive normal form (DNF) if it is a disjunction of one or more
conjunctions of one or more literals (e.g. (x ∧ ¬y ∧ z) ∨ (¬x ∧ z) ∨ (w ∧ y ∧ ¬z) ). Contradictory
conjunctions (i.e, containing a literal and its negation xi ∧ ¬xi ,) are not permitted. Say wether
the following statements are true or not:

• For every formula F there is a logically equivalent formula G in DNF


• For every formula F there is a unique logically equivalent formula G in DNF
Solution: False. p ∨ q ≡ (p ∧ ¬r) ∨ (q ∧ ¬r) ∨ (p ∧ r) ∨ (q ∧ r)
• If F is a tautology, there is a unique equivalent formula in DNF.
• If F is a contradiction, there is a unique equivalent formula in DNF.

19. Show that there is a polynomial algorithm that says if a DNF formula is satisfiable or not.
Solution: To satisfy a DNF formula, all we need is to satisfy one conjunction of literals and
the disjunction is satisied. Traverse the firs conjunction and assign 0 to all variables that appear
with ¬ sign, assign 1 to all variables without ¬ sign, assign arbitrary values to all variables that
do not appear in the clause at all.

20. Show how to transform a CNF formula into an equivalent DNF formula using the distributive
law. What is the size of the resulting DNF formula ?
Solution:

• (x1 ∨ x2 ∨ x3) =⇒ (x1) ∨ (x2) ∨ (x3)


• (x1 ∨ x2 ∨ x3) ∧ (x4 ∨ x5 ∨ x6) =⇒ (x1 ∧ x4) ∨ (x2 ∧ x4) ∨ (x3 ∧ x4)( x1 ∧ x5) ∨ (x2 ∧ x5) ∨
(x3 ∧ x5)( x1 ∧ x6) ∨ (x2 ∧ x6) ∨ (x3 ∧ x6)
• (x1∨x2∨x3)∧(x4∨x5∨x6)∧(x7∨x8∨x9) =⇒ (x1∧x4∧x7)∨(x1∧x4∧x8)∨. . .∨(x3∧x6∧x9)

A CNF formula with m size-3 clauses is converted into a DNF formula with 3m disjunctions

21. Prove using resolution that p → (q ∧ r) |= (¬q ∨ ¬r) → ¬p

22. Use resolution to prove that p → q is a logical consequence of ((t → q) ∧ (¬r → ¬s) ∧ (p →
u) ∧ (¬t → ¬r) ∧ (u → s))

23. Prove with resolution that the following formulas are tautologies:

• p → (q → p)
• (p ∧ (p → q)) → q
• ((p → q) ∧ ¬q) → ¬p
• ((p → q) ∧ ¬q) → ¬q

24. A unary clause is a clause containing only one literal (i.e. p or ¬p). Unit resolution is resolution
restricted to pairs of clauses in which at least one of them is a unary clause. Is unit resolution
correct? is refutationally complete?

25. A binary clause is a clause with no more than two literals. Binary resolution is resolution
restricted to pairs of binary clauses (i.e. from p ∨ q and ¬p ∨ r we obtain q ∨ r).

• Is binary resolution correct? and complete? and refutationally complete?


Solución: Es correcta porque es una caso particular de resolución, que vimos en clase que
era correcta. No es completa exactamente por el mismo motivo. No es refutacionalmente
correcta porque se puede construir una formula insatisfactible cuyas clausulas sean todas
ternarias. La resolución binaria no podrı́a deducir nada en este caso.
• A binary CNF formula is a CNF formula containing only binary clauses. If we apply binary
resolution only to binary CNF formulas, is it a correct inference rule? is it refutationally
complete?
Solución: Es correcta por el mismo motivo que antes. Ahora si es refutacionalmente
correcta. Para verlo hay que darse cuenta de que resolucion binaria nunca genera cláusulas
de tamaño mayor de dos. Por lo tanto si aplicamos resolución a una formula binaria,
siempre estaremos aplicando resolucion binaria.

26. Let (x1 , x2 , ..., xn ) be an ordered list of propositional variables. Write Formulas (and tell their
size) with the following meanings:

• Two consecutive variables cannot take the same value.


• k > 1 consecutive variables cannot take the same value.
P
• No more than one variable takes value 1 (i.e. i xi ≤ 1)
P
• No more than two variables take value 1 (i.e. i xi ≤ 2)
P
• No more than k variables take value 1 (i.e. i xi ≤ k)
P
• At least one variable takes value 1 (i.e. i xi > 0)
P
• More than one variable takes value 1 (i.e. i xi > 1)
P
• More than k variables take value 1 (i.e. i xi > k)
P
• k variables take value 1 (i.e. i xi = k)
• No zero occurs after a one.
• No zero occurs after k consecutive ones.

27. The K-coloring problem: given a graph G and a natural number K, assign to each vertex of G
a natural between 1 and K such that adjacent vertices do not have the same number. Express
the problem in CNF.

28. There are N towns each one having a local radio station. We have to assing a radio frequency out
of Q available ones to each radio station. To avoid interferences, towns closer than 20Km can
not use the same frequency. We have a function Distance(i,j) indicating the distance between
town i and j. Is it possible to assign the frequencies? Express the problem in CNF.

29. A judge must form a jury of k people. No one in the jury should know any other member. There
are n candidates and Knows(i,j) is a boolean predicate telling whether i knows j. Express the
problem in CNF

30. Let G = (V, E) be an undirected graph. We would like to know if G is connected. Model this
problem with propositional logic. Hint: a graph is connected iff for all non-empty A ⊂ V there
are edges between A and V − A.

31. Let G = (V, E) be an undirected graph. A matching M in G is a set of edges M ⊆ E such


that no two edges share a common vertex. A perfect matching is a matching such that every
vertex of the graph is incident to exactly one edge of the matching. We would like to know if G
contains a perfect matching. Model this problem with propositional logic. Disclaimer: there are
much better ways to solve this problem than using propositional logic

32. Let A = {a1 , a2 , . . . , an } be a set and B1 , B2 , . . . Bm subsets of A. Let k be a natural number.


We want to find out if there exists a subset H ⊂ A of size k such that contains at least one
element from each subset Bi . Model this problem as a CNF formula.
Solución:

• Variables: Para 1 ≤ i ≤ n y 1 ≤ j ≤ k sea xij una variable que me dice si el objeto ai es el


j-esimo elemento de H.
• Para cada j, exactamente un elemento es el j-esimo
– Para 1 ≤ j ≤ k, ponemos una cláusula x1j ∨ x2j ∨ ... ∨ xnj
– Para 1 ≤ j ≤ k, Para 1 ≤ i < i′ ≤ n, ponemos una cláusula ¬xij ∨ ¬xi′ j
• Al menos un elemento de cada Br es escogido en alguna posicion,
– Para 1 ≤ r ≤ m, sea Br = {ar1 , ar2 , ..., arpk }, ponemos una cláusula
(xr1 1 ∨ xr2 1 ∨ ... ∨ xrpk 1 ) ∨ (xr1 2 ∨ xr2 2 ∨ ... ∨ xrpk 2 ) ∨ . . . ∨ (xr1 k ∨ xr2 k ∨ ... ∨ xrpk k )

33. Three students A, B and C are accused of introducing a virus in the school lab. During the
interrogation they make the following claims:

• A says: “B did it and C is innocent”.


• B says: “If A is guilty then C is guilty too”.
• C says: “I did not do it. One of the others, or maybe both of them did it”.

Solution: To answer the following questions it is convenient to write the truth table of the
following formula
B ∧ ¬C ∧ (¬A ∨ C) ∧ ¬C ∧ (A ∨ B)
where A, B, C means being guilty. Note that the formula represents the conjunction of the three
claims.

(a) Are the three statements contradictory?


Solution: No, because the formula is satisfiable (e.g. ¬A ∧ B ∧ ¬C is a model), meaning
that the three claims can be simultaneously satisfied.
(b) Assuming that all of them are guilty, who lied during the interrogation?
Solution: From the corresponding entry of the truth table, one can see that A and C lied
(e.g. their claims are not satisfied)
(c) Assuming that nobody lied, who is innocent and who is guilty?
Solution: B is guilty, the other two are innocent. This is the only model for the three
claims.

34. Consider a chess-board (the size is 8 by 8), and 8 queens. Is it possible to place the queens in
the board in such a way that they do not attack each other?. Recall that, according to chess
rules, queens can move any number of cells along rows, columns or diagonals.
Write a propositional logic formula such that from its models, we can easily compute solutions
to the previous problem.
Solution: I use variables xij to indicate that there is a queen in cell (i, j)
I need the following constraints (indices are bounded as appropriate):

• There is exactly one queen in each row

∀i, xi1 ∨ ... ∨ xi8

∀i, j 6= j ′ , ¬xij ∨ ¬xij ′

• There is exactly one queen in each column

∀j, x1j ∨ ... ∨ x8j

∀i 6= i′ , j, ¬xij ∨ ¬xi′ j

• For every pair of cells in the same diagonal, no two queens can be placed there
∀i, j, i′ , j ′ such that (i, j) 6= (i′ , j ′ ) and |i − i′ | = |j − j ′ |

¬xij ∨ ¬xi′ j ′
35. Supose that you have a SAT-solver, such as Minisat, available (what you have available is the
executable, not the source code). What would you do if you want to know the number of models
of a CNF formula F ? (This problem is usually called Model Counting or #SAT)
Solution: The idea is to execute the SAT-solver sequentially. At each iteration, if the SAT-
solver returns a solution we add to the formula a new clause forbidding that solution. We repeat
this process until the formula becomes unsatisfiable. The number of iterations will be the number
of solutions of the original formula. In algorithmic form, Assuming SAT − Solver(F ) returns
one model of F ,

c:=0
while SAT-Solver(F)<> Nil do
(l1, l2,...,ln):=SAT-Solver(F)
F:= F and (no l1 or no l2 or ... or no ln)
c++
endwhile

36. Supose that you have a SAT-solver, such as Minisat, available (what you have available is the
executable, not the source code). Supose as well that you have an unsatifiable CNF formula F .
What would you do if you want to know if it is possible to satisfy at least k clauses? and if
you want to know the maximum number of clauses that can be satisfied? (this is the so-called
MAX-SAT problem)

37. Let G = (V, E) be an undirected graph. A cut of size 1 exists if there is a A ⊂ V such that
exactly one edge goes between A and V − A. We would like to know if G contains a cut of size
larger than k (this is the so-called Max-CUT problem)

38. Let G = (V, E) be an undirected graph. A clique of size k exists if there is a A ⊂ V such that
|A| = k and all the vertices in A are pairwise connected by an edge. We would like to know if G
contains a clique of size larger than or equal to k (this is the so-called Max-CLIQUE problem)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy