Professional Documents
Culture Documents
A puzzle
If I am a student in School of Biological Sciences, I am not a student in School of Computer Science. I am student in School of Computer Science or I am not a student in School of Biological Sciences.
Logic
Logic is a system based on propositions. A proposition is a (declarative) statement that is either true or false (not both). We say that the truth value of a proposition is either true (T) or false (F). Corresponds to 1 and 0 in digital circuits
Examples of non-statements: a. (Question): Why are you late? b. (Command): Open the door. c. (Wish): If only I had studied a little harder d. (Something Vague): (d-i) x + y = 4. (d-ii) x>y.
CS201: Discrete Mathematical Structures 3
The Statement/Proposition
Elephants are bigger than mice.
Is this a statement? Is this a proposition? What is the truth value of the proposition?
yes yes
true Or, 1
The Statement/Proposition
520 < 111
The Statement/Proposition
Elephants are bigger than mice and ants are smaller than mice.
Is this a statement? Is this a proposition? What is the truth value of the proposition?
yes yes
Is this a statement? Is this a proposition? What is the truth value of the proposition?
yes yes
false
true Or, 1
The Statement/Proposition
Elephants are bigger than mice or ants are bigger than mice.
The Statement/Proposition
y > 5
Is this a statement? Is this a proposition? What is the truth value of the proposition?
yes yes
yes no
true Or, 1
Its truth value depends on the value of y, but this value is not specified. specified. We call this type of statement a predicate, or an open sentence or a predicate, propositional function. function.
7 CS201: Discrete Mathematical Structures 8
The Statement/Proposition
Today is 27th July and 99 < 5.
The Statement/Proposition
Please do not fall asleep.
Is this a statement? Is this a proposition? What is the truth value of the proposition?
yes yes
no
no
false
10
The Statement/Proposition
If the moon is made of cheese, then I will be rich.
The Statement/Proposition
x < y if and only if y > x.
Is this a statement? Is this a proposition? What is the truth value of the proposition?
*(we
CS201: Discrete Mathematical Structures
yes yes
Is this a statement? yes Is this a proposition? yes because its truth value does not depend on specific values of x and y. What is the truth value of the proposition?
11 CS201: Discrete Mathematical Structures
True*
shall see the justification based on vacuous truth of conditional later.) truth
true
12
Combining Propositions
As we have seen in the previous examples, one or more propositions can be combined to form a single compound proposition. We formalize this by denoting propositions with letters such as p, q, r, s, and introducing several logical operators or logical connectives.
Truth tables are used to show how these operators can combine propositions to compound propositions.
13 CS201: Discrete Mathematical Structures 14
Negation (NOT)
Unary Operator, Symbol: ~ (also ) p false (F) true (T) ~ p true (T) false (F)
Conjunction (AND)
Binary Operator, Symbol:
p F F T T q F T F T p q F F F T
15
16
Disjunction (OR)
Binary Operator, Symbol:
p F F T T q F T F T pq F T T T
17
18
p F F T T
q F T F T
~p T T F F
~q T F T F
(~p)(~ q) T T T F
19
20
Truth Table
Construct the truth table for p or q but not both p and q called p exclusive or q, abbreviated as p q, or p XOR q. pq
p F F T T
q F T F T
pq F F F T
~ (pq) T T T F
(~p)(~ q) T T T F
p q
F F T T F T F T
pq pq ~(pq)
F T T T F F F T T T T F
(pq)~(pq)
F T T F
22
21
Exercises
Express the following statements in their propositional logic form: It rains and your sister has not loaned you an umbrella. You help me in my homework, otherwise I play football. If you work hard, then you will do well in your studies.
Puzzle Revisited
If I am a student in School of Biological Sciences, I am not a student in School of Computer Science. I am student in School of Computer Science or I am not a student in School of Biological Sciences.
Let p = I am a student in School of Biological Sciences. Let q = I am a student in School of Computer Science. We model the given sentences as: (p ~q)(q ~p).
23
24
Equivalent Statements
p q ~ (pq) (~p)(~q)
F F T T
F T F T
T T T F
T T T F
T T T T
The statement forms ~ (pq) and (~p)(~q) are logically equivalent, since they have the same truth table, or,
the statement form ~ (pq) (~p)(~q) is always true, irrespective of whether its constituents (p, q) are true or false.
CS201: Discrete Mathematical Structures 25
r (~r) ~[~(pq)(~p)(~q)]
The negation of any tautology is a contradiction, and the negation of any contradiction is a tautology.
26
Equivalence
Definition: two proposition forms S1 and S2 are said to be (logically) equivalent, denoted S1 S2 if
They have the same truth table, or S1 S2 is a tautology
Logical Equivalence
Q: Is ~(p q) equivalent to ~p ~q ? p T T F F q p q ~(p q) T T F F T F T T F F F T ~p ~q ~p ~q F F F F T T T F T T T T
A: NO.
CS201: Discrete Mathematical Structures 27 CS201: Discrete Mathematical Structures 28
Logical Equivalence
De Morgans Law: ~(p q) ~p ~q ~(p q) ~p ~q p T T F F q p q ~(p q) T T F F F T T F T F F T ~p ~q ~p ~q F F F F T T T F T T T T
29
~ ( p q ) ~ p ~ q
~ ( p q ) ~ p ~ q
Commutative
pq q p
pq q p
CS201: Discrete Mathematical Structures 30
p F p
Domination
pT T
pF F
Distributive p (q r ) ( p q ) ( p r ) p (q r ) ( p q ) ( p r ) [Remember?
CS201: Discrete Mathematical Structures
Inverse
p ~ p F
p ~ p T
a(b+c)=ab+ac ]
31 CS201: Discrete Mathematical Structures 32
Exercises
Show that p q ~ p q by truth table. Show that (p q) (p r) p (q r) by equivalence laws (Use the result p q ~ p q, distributivity, and, other laws )
~ (~ p) p
Idempotent
p p p
Absorption
p ( p q) p
p p p
p ( p q) p
33
34
Puzzle Revisited .. 2
If I am a student in School of Biological Sciences, I am not a student in School of Computer Science. I am student in School of Computer Science or I am not a student in School of Biological Sciences.
Let p = I am a student in School of Biological Sciences. Let q = I am a student in School of Computer Science. We model the given sentences as: (p ~q)(q ~p). (p ~q)(q ~p) (~p ~q)(q ~p) (~p~q)(~p q)
CS201: Discrete Mathematical Structures 35
Summary
Proposition Truth value Truth table Operators and their truth tables Equivalence of propositional statements
Definition Proving equivalence (by truth table or equivalence laws)
CS201: Discrete Mathematical Structures 36