You are on page 1of 38

Propositional

Logic
CS104 / IT104

Logic is the basis of all


mathematical reasoning, and of
all automated reasoning.

Logic

It has practical applications to


the :

design of computing machines,


specification of systems,
artificial intelligence,
computer programming,
Programming languages

Logic (cont).

A proposition is a declarative
sentence (that is, a sentence that
declares a fact) that is either true
or false, but not both.

Proposition

Examples:
Manila is the capital of Philippines.
Cabanatuan is in Bulacan.
1 + 1 = 2
2 + 2 = 1

Proposition (cont.)

Not included:
How are you?
Read this example.
x + 1 = 2
x + y = z

Proposition (cont.)

Compose 5 proposition.
Write 1 if the statement is a
proposition and O if it is not a
proposition.

Exercise 1

1. What is your name?


2. Please be quiet.
3. 20 + 19 = 39
4. x + 1 = 5, where x = 4
5. CIC is a catholic school.
6. x + y + z = 57
7. Come with me.
8. 10 3 = 5
9. I love mathematics.
10.Are you ok?

Exercise 2

1. 0
2. 0
3. 1
4. 1
5. 1
6. 0
7. 0
8. 1
9. 1
10.0

Exercise 2
(Answer)

The area of logic that deals with


propositions is called the
propositional calculus or
propositional logic.

Propositional Logic

It was first
developed
systematically by
the Greek
philosopher
Aristotle more
than 2 300 years
ago.

Propositional Logic
(cont.)

Propositional variables (or


statement variables) are used to
represent propositions.
The conventional letters used for
propositional variables are p, q, r,
s,

Propositional Logic
(cont.)

The truth value of a proposition


can be:
true, denoted by T
false, denoted by F,

Propositional Logic
(cont.)

Compound propositions are


formed from existing propositions
using logical operators.

Propositional Logic
(cont.)

Logical Operator/Connective
combines one or more operand
expressions into a larger
expression.
Unary
Binary

Logical Operators

Logical operators are:


Negation
Conjunction
Disjunction
Exclusive Or
Condition
Bicondition

Logical Operators
(cont.)

Negation operator/connective
negates a proposition.
It is denoted by .
p is read a not p.
Let p = It is raining.,
so p = It is not raining.

Negation Operator

p
T
F

p
F
T

Negation Operator
(Truth Tables)

Write the result of p, if p is equal


to:
1. Today is Tuesday.
2. I am not a CICian.
3. Cabanatuan is in Bulacan.
4. I hate you.
5. I do not love you.

Exercise 3

1.
2.
3.
4.
5.

Today is not Tuesday.


I am a CICian.
Cabanatuan is not in Bulacan.
I do not hate you.
I love you.

Exercise 3 (Answer)

Conjunction operator/connective
connect two proposition to form
logical conjunction.
It is denoted by .
p q is read as p and q

Conjunction
Operator

Let p = Today is Tuesday.


Let q = It is raining.
so p q =
Today is Tuesday and it is
raining.

Conjunction
Operator (cont.)

p
T
T
F
F

q
T
F
T
F

pq
T
F
F
F

Conjunction Operator
(Truth Tables)

Disjunction operator/connective
connect two proposition to form
logical disjunction.
It is denoted by .
p q is read as p or q

Disjunction
Operator

Let p = Today is Tuesday.


Let q = It is raining.
so p q =
Today is Tuesday or it is
raining.

Disjunction Operator
(cont.)

p
T
T
F
F

q
T
F
T
F

pvq
T
T
T
F

Disjunction Operator
(Truth Tables)

Let p=I am an CSIT student.,


q=I love discrete structures.
r=I am good at mathematics.
Write the result of the following:
1. p ^ q
2. r ^ q
3. r p q

Exercise 4

1. I am an CSIT student and I love


discrete structures.
2. I am not good in Mathematics and I
love discrete structures.
3. I am good in Mathematics or I am an
CSIT student or I love discrete
structures.

Exercise 4 (Answer)

Exclusive or operator excludes the


possibility that both p and q are
true.
It is denoted by .
p q is read as p or q

Exclusive Or
Operator

Let p = Today is Tuesday.


Let q = Today is Thursday.
so p q =
Today is Tuesday or today is
Thursday.

Exclusive Or
Operator (cont.)

p
T
T
F
F

q
T
F
T
F

pq
F
T
T
F

Exclusive Or Operator
(Truth Tables)

Conditional/Implication operator
implies q is the possible result of
p.
It is denoted by .
p q is read as if p, then q
p is hypothesis
q is conclusion

Conditional
Operator

Let p=I am an CSIT student.,


q=I am good at mathematics.
so p q = If I am an CSIT student
then I am good at mathematics.

Conditional Operator
(cont.)

p
T
T
F
F

q
T
F
T
F

pq
T
F
T
T

Conditional Operator
(Truth Tables)

The biconditional p q states that


p is true if and only if q is true.
It is denoted by .
p q is read as p if and only if q

Biconditional
Operator

Let p=I love discrete structures.


q=I am good at mathematics.
so p q = I love discrete structures
if and only if I am good at
mathematics.

Biconditional
Operator (cont.)

p
T
T
F
F

q
T
F
T
F

pq
T
F
F
T

Biconditional Operator
(Truth Tables)

Operator

Precedence

^
V or

1
2
3
4
5

Logical Operator
Precedence

You might also like