Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
159 views

DS Assignment-1 Solution

The document discusses several logic puzzles and their solutions involving 5 friends accessing a chat room. It expresses the conditions for determining who is chatting using symbolic notation and shows that the only possible solution is that Kamal and Waqas are chatting. It also provides examples of translating statements to propositional logic, using De Morgan's laws to negate statements, and showing certain statements are logical tautologies.

Uploaded by

Tayyab Husaain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
159 views

DS Assignment-1 Solution

The document discusses several logic puzzles and their solutions involving 5 friends accessing a chat room. It expresses the conditions for determining who is chatting using symbolic notation and shows that the only possible solution is that Kamal and Waqas are chatting. It also provides examples of translating statements to propositional logic, using De Morgan's laws to negate statements, and showing certain statements are logical tautologies.

Uploaded by

Tayyab Husaain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Q.1. There are five friends having access to a chat room.

Is it possible to determine who is chatting


if the following information is known? Explain your reasoning. (6 marks)

1. Either Kamal or Haider, or both, are chatting.

2. Either Raheem or Waqas, but not both, are chatting.

3. If Ahmad is chatting, so is Raheem.

4. Waqas and Kamal are either both chatting or neither is.

5. If Haider is chatting, then so are Ahmad and Kamal.

Solution:

It’s easiest to use symbolic notation. Then we have the following five propositions.

1. K ∨ H.

2. R ⊕ W .

3. A → R.

4. W ↔ K.

5. H → A ∧ K.

There are many ways to proceed. Here’s one. Note that 1 and 5 both involve K and H. 1 says either K
or H, but 5 says that if H, then also A ∧ K, so K in that case, too. Thus, H occurs whenever K occurs, so
in all cases K. Now 1 is satisfied. So we now know K. By 4, therefore also W, and 4 is now satisfied. By
2, therefore ¬R, and 2 is satisfied. Then by 3, therefore ¬A, and 3 is satisfied. But by 5, since ¬A,
therefore ¬H, and 5 is satisfied. By now, we’ve satisfied all five statements in the only way possible,
namely, with K, W , but not R, not A, and not H. Thus, the answer to the question is: we can conclude
that Kamal and Waqas are chatting, but the other three aren’t.

Another way is to make truth table of whole scenario and find the values where all 5 propositions
are true.

Q.2. Translate the given statement into propositional logic. (5+5 marks)

Solution:

a. You cannot edit a protected Wikipedia entry unless you are an administrator. Express your
answer in terms of e: “You can edit a protected Wikipedia entry” and a: “You are an
administrator.”

Lets consider p→q. Another way to express this implication is q unless ∼p.

Now coming to this problem: Whenever there is unless in the statement, remove it and put NOT to
the statement after it. e.g: You cannot edit a protected Wikipedia entry unless you are an
administrator. You cannot edit a protected Wikipedia entry, you are NOT an administrator. Now,

You cannot edit a protected Wikipedia = ∼e

you are NOT an administrator = ∼a

So required propositional logic is ∼a→∼e


b. You are eligible to be President of the U.S.A. only if you are at least 35 years old, were born in
the U.S.A, or at the time of your birth both of your parents were citizens, and you have lived at
least 14 years in the country.

e: “You are eligible to be President of the U.S.A.,”


a: “You are at least 35 years old,”
b: “You were born in the U.S.A,”
p: “At the time of your birth, both of your parents where citizens,”
r: “You have lived at least 14 years in the U.S.A.”
So from that here are three conditions that has to be satisfied

1. Above 35 years
2. Born in USA or Parents were in USA
3. lived above 14 years
As they have to be satisfied together so AND operator is to be used. So the answer is
(a^(bvp)^r)→e

Q.3. Express these system specifications using the propositions p “The message is scanned for
viruses” and q “The message was sent from an unknown system” together with logical connectives
(including negations).

a) “The message is scanned for viruses whenever the message was sent from an unknown
system.”
b) “The message was sent from an unknown system but it was not scanned for viruses.”
c) “It is necessary to scan the message for viruses whenever it was sent from an unknown system.”
d) “When a message is not sent from an unknown system it is not scanned for viruses.”

Solution:
p = "The message is scanned for viruses"
q = "The message was sent from an unknown system"

a) Replace the known sub-statements by p and q in the given statement:


=> p whenever q
=> q → p

b) Replace the known sub-statements by p and q in the given statement:


=> q but not p
"but" implies "and"
=> q and not p
=> q ∧ ¬p

c) Replace the known sub-statements by p and q in the given statement:


=> p whenever q
=> q → p

d) Replace the known sub-statements by p and q in the given statement:


=> when not q then not p
"q when p" is equivalent with "if p, then q":
if not q then not p
Replace "if-then" by → and "not" by ¬
¬q→¬p
Q.4. Use De Morgan’s laws to find the negation of each of the following statements.

a) Kamal will take a job in industry or go to graduate school.

b) Yusuf knows Java and calculus.

c) Junaid is young and strong.

d) Raheem will move to Oregon or Washington.

Solution:

1. The negation of “Kamal will take a job in industry or go to graduate school” is “Kamal will not take
a job in industry and will not go to graduate school,” or “Kamal will neither go to industry nor go to
graduate school.”

2. The negation of “Yusuf knows Java and calculus” is “Yusuf does not know Java or does not know
calculus,” or (more naturally, though ignoring De Morgan’s Law) “Yusuf does not know both Java and
calculus.” The answer “Yusuf does not know Java or calculus” is incorrect, as this implies that Yusuf
knows neither. Because of the structure of English sentences, you cannot negate the proposition
simply by switching “does” with “does not” and “and” with “or.”

3. The negation of “Junaid is young and strong” is “Junaid is not young or not strong.” The answer
“Junaid is not young or strong” is incorrect since this implies that he is neither.

4. The negation of “Raheem will move to Oregon or Washington” is “Raheem will not move to
Oregon and will not move to Washington.” The answer “Raheem will not move to Oregon and
Washington” is incorrect, since this implies that she will not move to both states where we want to
say that she will not move to either.

Another way to do this is:

a) Neither Kamal will take a job in industry nor will he go to graduate school.

b) Either Yusuf does not know Java or he does not know calculus.

c) Either Junaid is not young or he is not strong.

d) Neither Raheem will move to Oregon nor will he move to Washington.

Q.5. Show that (p ∨ q) ∧ (¬p ∨ r) → (q ∨ r) is a tautology.


Q.6. Show that (p → q) ∧ (q → r) → (p → r) is a tautology.

Q.7. Show that ~p → (q → r) and q → (p ∨ r) are logically equivalent.

You might also like