Sei sulla pagina 1di 1

Logic in Computer Science

Problem Sheet 1
August 12, 2014
1. (Knights and Knaves) A island is inhabited by two groups of people, the knights, who never lie and
the knaves who always lie. A traveler comes across two of the islands inhabitants A and B, and A
says to the traveler, Both of us are knaves. Can you deduce the group of A and B?
2. (Logicians in the coffee bar ) Three logicians walk in to a coffee bar, and is subsequently greeted by
the waiter who asks, Would all of you like to drink coffee?. The replies of the logicians are given
below,
Logician #1 : I dont know
Logician #2 : I dont know
Logician #3 : Yes. Bring coffee for all of us
Provide an explanation for the responses of the logicians to waiters question.
3. (Yet another inference) We have being provided with two statements, which we assume to be true.
They are,
Statement 1 : Everyone loves a lover.
Statement 2 : Romeo loves Juliette.

Can we conclude the statement, Iago loves Othello, by building upon the above statements?
4. (Another visit to the Island of Knights and Knaves) Remember the island from question #1? The
traveler comes across another inhabitant of this island, who says to him, This is not the first time
I have said what I am now saying. Can you deduce the group to which this inhabitant belongs to?
5. Suppose is a wff which doesnt use any negation symbol, show that the length of is odd.
6. Show that all the wffs have balanced parenthesis.
7. Let h be the height of the derivation tree for a wff . Prove or disprove:
h k log | | + 1
or, h O(log | |) where k is a constant.
8. Write the set of all subformulas of the following wff s.
(a) (((p1 p2 ) (p1 p3 )) p3 )
(b) (((p1 p2 ) p3 ) ((p1 p2 ) (p1 p3 )))
9. Let S be a set of all subformulas of . Prove that | S | | |.
10. Write a program to check whether a given expression (finite sequence of symbols) is a well formed
formula (wff) or not.
11. Write a program to construct a derivation tree (and a sequence) for a given wff.
12. Write a program to check whether a given valuation (model ) satisfies a given wff or not.
13. Write a program to check whether a given wff is satisfiable or not.
14. Write derivation trees and derivation sequences for the following wff s.
(a) (((p1 p2 ) (p1 p3 )) p3 )
(b) (((p1 p2 ) p3 ) ((p1 p2 ) (p1 p3 )))
15. Check whether the model V satisfies the wff s given below.
Model: V (p1 ) = T , V (p2 ) = F , and V (p3 ) = T ignore V s mappings to rest of the sentential symbols.
(a) ((p1 p2 ) (p1 ))
(b) (((p1 p2 ) (p1 p3 )) (p1 (p2 p3 )))
16. Prove or disprove:
(a) If (a wff ) is satisfiable, then it is valid.
(b) If is valid, then it is satisfiable too.

Potrebbero piacerti anche