2. Logic
o Study of the principles and techniques
of reasoning
o Basis of all mathematical reasoning,
and of all automated reasoning.
o Foundation for computer science
operation.
o For reasoning about their truth or falsity.
3. Proposition
o A proposition is a *declarative
sentence/statement that is either true or
false, but not both.
• Islamabad is the capital of the Pakistan.
• 1 + 1 = 2
• If 1=2 then roses are red.
These are not proposition
What time is it?
x + 1 = 2
4. Proposition
o We use letters to denote
propositional variables (or
statement variables), that
is p, q, r, s, . . . .
o We say that the truth value of a
proposition is either true (T) or
false (F).
5. Proposition
“Today is January 27”
Is this a statement? Yes
Is this a proposition? yes
What is the truth value
of the proposition? false
7. Truth Table
o The truth value of the
compound proposition
depends only on the truth
value of the component
propositions. Such a list is a
called a truth table.
8. Negation (NOT)
o If p = “I have brown hair.”
o then ¬p = “I do not have
brown hair.”
P P
true (T) false (F)
false (F) true (T)
9. Conjunction (AND)
If p=“I will have salad for lunch.” and q=“I will have
biryani for dinner .”, then p∧q=“I will have salad for
lunch and AND I will have biryani for dinner.”
P Q P Q
T T T
T F F
F T F
F F F
10. Disjunction (OR)
o p=“My car has a bad engine.”
o q=“My car has a bad carburetor.”
o p∨q=“Either my car has a bad engine,
or my car has a bad carburetor.”
P Q P Q
T T T
T F T
F T T
F F F
11. Connectives
Let p=“It rained last night”,
q=“The sprinklers came on last night,”
r=“The lawn was wet this morning.”
Translate each of the following into English:
¬p = “It didn’t rain last night.”
r ∧ ¬p =“The lawn was wet this morning,
and it didn’t rain last night.”
¬ r ∨ p ∨ q =“Either the lawn wasn’t wet this
morning, or it rained last night, or the sprinklers
came on last night.”
12. Connectives
Let p= “It is hot”
q=““It is sunny”
1. It is not hot but it is sunny.
2. It is neither hot nor sunny.
Solution
1. ⌐p∧q
2. ⌐p∧ ⌐q
13. Exclusive Or (XOR)
o p = “I will earn an A in this course,”
o q = “I will drop this course,”
o p ⊕ q = “I will either earn an A in this
course, or I will drop it (but not both!)”
P Q PQ
T T F
T F T
F T T
F F F
14. Exclusive Or (XOR)
o The exclusive or of p and q,
denoted by p ⊕ q, is the
proposition that is true when
exactly one of p and q is true
and is false otherwise.
P Q PQ
T T F
T F T
F T T
F F F
• p = “I will earn an A in this
course,”
• q = “I will drop this course,”
• p ⊕ q = “I will either earn
an A in this course, or I will
drop it (but not both!)”
15.
16. Implication (if - then)
o The conditional statement p → q
is the proposition “if p, then q.”
The conditional statement p → q
is false when p is true and q is
false, and true otherwise. p is
called the hypothesis and q is
called the conclusion
17. Implication (if - then)
P Q PQ
T T T
T F F
F T T
F F T
p = “You study hard.”
q = “You will get a
good grade.”
p → q = “If you study
hard, then you will get
a good
grade.”
18. Biconditionals (if and Only If)
p = “Zardari wins the 2008 election.”
q = “Zardari will be president for five
years.”
p ↔ q = “If, and only if, Zardari wins the
2008 election, Zardari will be president
for five years.”
p ↔ q does not imply that p
and q are true, or that
either of them causes the other,
or that they have a
common cause.