Chapter 1 CSC510
Chapter 1 CSC510
CHAPTER 1
PROPOSITIONAL AND PREDICATE LOGIC
1. INTRODUCTION
Every day we deal with problem statements either in mathematical or sentence
form. Several rules of logic need to be used to determine whether the problem
statement is valid or invalid. Greek philosopher Aristotle was the pioneer of
logical reasoning.
This chapter aims to expose students to how to deal with problem statements,
how to produce mathematical statements and subsequently model problems
into mathematical statements.
These knowledge are important to introduce students to the basics of logical
thinking to understand mathematical reasoning which is widely used in various
fields of computer science.
These rules form the basis of computer circuit design, programming design,
verification of the program correctness, artificial intelligence, and many other
ways.
1
Nm/shahalam
3. LOGICAL CONNECTIVES
Now let us see several connectives which will allow us to build up compound
propositions. The most common logical connectives are:
2
Nm/shahalam
Negation
Definition: Let p be a proposition. The statement "It is not the case that p." is
another proposition, called the negation of p. The negation of p is denoted by
¬ p and read as "not p."
Examples:
1. It is not the case that Shah Alam is located in Selangor
2. 5 + 3 ≠ 8.
3. 10 is not a prime number.
4. It is not the case that buses stop running at 9:00pm.
Conjunction
Definition: Let p and q be propositions. The proposition "p and q" denoted by p
∧ q, is true when both p and q are true and is false otherwise. The proposition p
∧ q is called the conjunction of p and q.
Examples:
1. Shah Alam is located in Selangor and 5 + 2 = 8
2. It is raining today and 2 is a prime number.
3. 2 is a prime number and 5 + 2 ≠ 8.
4. 13 is a perfect square and 9 is a prime.
Disjunction
Examples:
1. Shah Alam is located in Selangor or 5 + 2 = 8.
2. It is raining today or 2 is a prime number.
3. 2 is a prime number or 5 + 2 ≠ 8.
4. 13 is a perfect square or 9 is a prime.
3
Nm/shahalam
Implication
Definition: Let p and q be propositions. The proposition "p implies q" denoted
by p → q is called implication. It is false when p is true and q is false and is true
otherwise.
In p → q, p is called the hypothesis and q is called the conclusion.
Examples:
Biconditional
Biconditional statements:
4
Nm/shahalam
Exclusive Or
A disjunction for which either statement may be true but not both.
For example, the use of the word or in "This morning I can go to school or I can
stay home" is exclusive. Either option may be true but not both.
5
Nm/shahalam
p ¬p
1 0
0 1
p q p∨q
1 1 1
1 0 1
0 1 1
0 0 0
6
Nm/shahalam
p q p∧q
1 1 1
1 0 0
0 1 0
0 0 0
Implication / if-then (→) : An implication p→q is the proposition “if p, then q”.
It is false if p is true and q is false. The rest cases are true.
The truth table is as follows:
p q p→q
1 1 1
1 0 0
0 1 1
0 0 1
p q p↔q
1 1 1
1 0 0
0 1 0
0 0 1
7
Nm/shahalam
p q p⊕ q
1 1 0
1 0 1
0 1 1
0 0 0
Rules to
construct Truth
Table
Step 1. Number of
possibilities can be
calculated using 2^n.
Where n is number.
of variables involved
Formula: 2^n
Step 2. Follow
sequence order of
the variable at the
column.
8
Nm/shahalam
EXERCISES 1
QUESTION 1
Determine whether each of these sentences is proposition.
a) 8 – 3 = 5.
b) Answer all questions.
c) This statement is not true.
QUESTION 2
QUESTION 3
Negate the following propositions:
a) It is raining today.
b) 2 is a prime number.
QUESTION 4
9
Nm/shahalam
q: It is raining.
r: It is hot.
c) It is not the case that today is Friday or it is raining if and only if it is hot.
QUESTION 5
Let p, q and r be the propositions
p: You have registered for the course.
q: You miss the deadline to submit application.
r: You are allowed to sit for exam.
b) (¬p v q) → ¬r
10
Nm/shahalam
4. TYPES OF PROPOSITIONS
Tautology
A Tautology is a formula which is always true for every value of its propositional
variables.
Example : Prove [(p→q)∧p]→q is a tautology.
p q p→q (p → q) ∧ p [( p → q ) ∧ p] → q
1 1 1 1 1
1 0 0 0 1
0 1 1 0 1
0 0 1 0 1
11
Nm/shahalam
Contradiction
p q ¬p ¬q p∨q (¬ p) ∧ ( ¬ q) (p ∨ q) ∧ [( ¬
p) ∧ (¬ q)]
1 1 0 0 1 0 0
1 0 0 1 1 0 0
0 1 1 0 1 0 0
0 0 1 1 0 1 0
12
Nm/shahalam
Contingency
A Contingency is a formula which has both some true and some false values for
every value of its propositional variables.
p q ¬p p∨q (p ∨ q) ∧ (¬ p)
1 1 0 1 0
1 0 0 1 0
0 1 1 1 1
0 0 1 0 0
As we can see every value of (p∨q)∧(¬p) has both “True” and “False”, it is a
contingency.
13
Nm/shahalam
Translation
• Assume a sentence:
– If you are older than 13 or you are with your parents then you can attend a
PG-13 movie.
Parse:
• If ( you are older than 13 or you are with your parents ) then ( you can
attend a PG-13 movie)
A= you are older than 13
B= you are with your parents
C=you can attend a PG-13 movie
Translation: A ∨ B → C
14
Nm/shahalam
Examples:
Hypothesis, p
●
● Conclusion, q
● • The converse of p → q is q → p.
1.The contrapositive of p → q is ¬q → ¬p
2. The converse of p → q is q → p
3. The inverse of .p → q is ¬p → ¬q
Statement If p , then q .
Converse If q , then p .
15
Nm/shahalam
Examples:
•p→q
16
Nm/shahalam
Tips on how to
answer question on
converse, inverse,
contrapositive.
17
Nm/shahalam
EXERCISES 2
QUESTION 1
Construct the truth table for the logical expression p V (¬ q ᴧ ¬ r )→
p. Determine whether it is a tautology, contradiction or contingent.
QUESTION 2
Show that the expression (P ∧ Q) → (P V Q) is a tautology.
QUESTION 3
Determine whether (¬q ∧ (p → q)) → ¬ p is a tautology by using rule of
inference.
QUESTION 4
State the converse, contrapositive, and inverse of the following conditional
statement:
Salina will go to university only if she receives a scholarship.
QUESTION 5
QUESTION 6
Determine the converse, inverse and contrapositive for the following
statement: If I don’t play with fire then I will not get burnt.
18
Nm/shahalam
object property
Basic building blocks of the predicate logic:
i. Constant –models a specific object
Examples: “Ali”, “Selangor”, “7”
ii. Variable – represents object of specific type (defined by the universe of
discourse)
Examples: x, y
(universe of discourse can be people, students, numbers)
iii. Predicate - over one, two or many variables or constants.
– Represents properties or relations among objects
Examples: Red(car23), student(x), married(John,Ann)
19
Nm/shahalam
5.2 Quantifiers
The variable of predicates is quantified by quantifiers.
There are two types of quantifier in predicate logic −
Universal Quantifier and Existential Quantifier.
Universal Quantifier
Universal quantifier states that the statements within its scope are true for every
value of the specific variable. It is denoted by the symbol ∀
∀xP(x) is read as for every value of x, P(x) is true.
Example 2:
20
Nm/shahalam
Example 3:
• Answer: Since 3 > 5 is false. So, T(x) is not true for all values of x.
Existential Quantifier
Existential quantifier states that the statements within its scope are true for some
values of the specific variable. It is denoted by the symbol ∃
∃xP(x) is read as for some values of x, P(x) is true.
Example 2:
• Let T(x) denote x > 5 and x is from Real numbers.
• What is the truth value of ∃x T(x)?
• Answer:
• Since 10 > 5 is true. Therefore, it is true that ∃x T(x).
Example 3:
• Let Q(x) denote x = x + 2 where x is real numbers
• What is the truth value of ∃x Q(x)?
• Answer: Since no real number is 2 larger than itself, the truth value of
∃x Q(x) is false.
21
Nm/shahalam
22
Nm/shahalam
Example1:
• Every real number has its corresponding negative.
Assume:
• a real number is denoted as x and its negative as y
• A predicate P(x,y) denotes: “x + y =0”
• Then we can write: ∀x ∃ y P(x,y)
Example2:
• There is a person who loves everybody.
Assume:
• Variables x and y denote people
• A predicate L(x,y) denotes: “x loves y”
23
Nm/shahalam
ii. Existential
Sentence: Someone at MSU is smart.
24
Nm/shahalam
Example:
• Assume L(x,y) denotes “x loves y”
• Then: ∀x∃y L(x,y)
• Translates to: Everybody loves somebody.
• And: ∃y ∀x L(x,y)
• Translates to: There is someone who is loved by everyone.
The meaning of the two is different.
The order of nested quantifiers does not matter if quantifiers are of the same
type.
Example:
• For all x and y, if x is a parent of y then y is a child of x
• Assume:
Parent(x,y) denotes “x is a parent of y”
Child(x,y) denotes “x is a child of y”
• Two equivalent ways to represent the statement:
∀x ∀y Parent(x,y) → Child(y,x)
∀y ∀x Parent(x,y) → Child(y,x)
25
Nm/shahalam
Negation Equivalent
26
Nm/shahalam
Exercises:
EXERCISES 3
QUESTION 1
Suppose: Variables x,y denote people
L(x,y) denotes “x loves y”.
Translate each of following predicates:
a) Everybody loves Ramli.
b) Everybody loves somebody.
c) There is somebody whom everybody loves.
d) There is somebody who Ramli does not love.
e) There is somebody whom no one loves.
QUESTION 2
Let P(x) be the statement “ x + 1 > 2x”. If the domain consists of all integers, what
is the truth value?
a) ∀x P(x).
b) ∃x ¬P(x).
c) ∀ x ¬P(x).
d) ¬∃x P(x)
QUESTION 3
Translate each of these nested quantifications into an English statement that
expresses a mathematical fact. The domain in each case consists of all real
numbers.
QUESTION 4
Translate each of the following statements into logical expression using
predicates, quantifiers, and logical connectives.
QUESTION 5
Translate each of the following statements into logical expression using
predicates, quantifiers, and logical connectives.
QUESTION 6
Express the statement “ every first year student in primary school takes
Pendidikan Jasmani“ using suitable predicate symbols for each of the following
universe of discourse:
28
Nm/shahalam
SUMMARY
1. Proposition or not proposition?
- what are differences
-how to recognise not proposition
2. Logical Connectives
- symbol each of logical connective
- how to write negation
5. Translation
- from sentence to expression
- from expression to sentence
7. Predicate logic
- building blocks of the predicate logic
- Quantifier
- Nested quantifier
- Different scope of domain
- Negation of Quantifiers
29