Professional Documents
Culture Documents
Lecture # 02 - New
Lecture # 02 - New
Lecture # 02 - New
Lecture No 1
UNDERSTANDING STATEMENTS
1. x + 2 is positive.
2. May I come in?
3. Logic is interesting.
4. It is hot today.
5. -1 > 0
6. x + y = 12
EXAMPLES
p = “Islamabad is the capital of Pakistan”
q = “17 is divisible by 3”
EXAMPLES
1. It is not hot. ~p
p ~p
T F
F T
p q pq
T T T
T F F
F T F
F F F
Switches Light
P Q Bulb
_ Light
Bulb P Q State
+
Closed Closed On
Switches Light P Q P Q
Bulb
P Q State T T T
Closed Closed On
T F F
Closed Open Off
F T F
Open Closed Off
The words closed and on are replaced by T and open and off are
replaced by F
p q pq
T T T
T F T
F T T
F F F
P
Switches Light
Bulb
_ Q
Light P Q State
+ Bulb
Closed Closed On
Closed Open On
Open Closed On
The words closed and on are replaced by T and open and off are
replace by F.
Department of Computer Science 28
Remark
T T T T F F
T F T F T T
F T T F T T
F F F F T F
T T T T F
T F F T T
F T F T T
F F F F F
1. ~pq
2. ~ p (q ~ r)
3. (pq) ~ (pq)
p q ~p ~pq
T T F F
T F F F
F T T T
F F T F
T T T T F F
T F T F T T
F T T F T T
F F F F T F
1. NOT-gate
A NOT-gate (or inverter) is a circuit with one input and one
output signal. If the input signal is 1, the output signal is 0.
Conversely, if the input signal is 0, then the output signal is 1.
P R
Input Output
NOT
P R
1 0
0 1
Department of Computer Science 40
2. AND-gate
An AND-gate is a circuit with two input signals and one output
signal.
If both input signals are 1, the output signal is 1. Otherwise the
output signal is 0.
Symbolic representation & Input/Output Table
Input Output
P P Q R
AND R
Q 1 1 1
1 0 0
0 1 0
0 0 0
Department of Computer Science 41
3. OR-gate
An OR-gate is a circuit with two input signals and one output
signal.
If both input signals are 0, then the output signal is 0.
Otherwise, the output signal is 1.
Symbolic representation & Input/Output Table
Input Output
P P Q R
R
OR
1 1 1
Q
1 0 1
0 1 1
0 0 0
Department of Computer Science 42
Application of Propositional
Logic
P
AND
Q
OR
R NOT
EXERCISE
Construct circuit for the Boolean expression (PQ) ~R
SOLUTION
P PQ
AND
Q
(P Q) ~R
OR
~R
R NOT
Department of Computer Science 45
Finding a Boolean Expression for a Circuit
EXERCISE
Find the Boolean expression for circuit
P
OR
Q
AND
R OR
P PQ
OR
Q
(PQ) (PR)
AND
R OR
PR
1. What is a statement?
2. How a compound statement is formed.
3. Logical connectives (negation, conjunction, disjunction).
4. How to construct a truth table for a statement form.