Logics (cont.)
Tran Vinh Tan
Chapter 2
Logics (cont.)
Discrete Mathematics I on 08 March 2011
Contents
Predicate Logic
Proof Methods
Tran Vinh Tan
Faculty of Computer Science and Engineering
University of Technology - VNUHCM
2.1
Contents
Logics (cont.)
Tran Vinh Tan
Contents
Predicate Logic
1 Predicate Logic
Proof Methods
2 Proof Methods
2.2
Limits of Propositional Logic
Logics (cont.)
Tran Vinh Tan
Contents
Predicate Logic
• x>3
Proof Methods
• All square numbers are not prime numbers. 100 is a square
number. Therefore 100 is not a prime number.
2.3
Predicates
Logics (cont.)
Tran Vinh Tan
Definition
A predicate (vị từ) is a statement containing one or more
variables. If values are assigned to all the variables in a predicate,
the resulting statement is a proposition (mệnh đề ).
Contents
Predicate Logic
Proof Methods
Example:
• x > 3 (predicate)
• 5 > 3 (proposition)
• 2 > 3 (proposition)
2.4
Predicates
Logics (cont.)
Tran Vinh Tan
Contents
Predicate Logic
• x > 3 → P (x)
Proof Methods
• 5 > 3 → P (5)
• A predicate with n variables P (x1 , x2 , ..., xn )
2.5
Truth value
Logics (cont.)
Tran Vinh Tan
Contents
Predicate Logic
• x > 3 is true or false?
Proof Methods
• 5>3
• For every number x, x > 3 holds
• There is a number x such that x > 3
2.6
Quantifiers
Logics (cont.)
Tran Vinh Tan
Contents
• ∀: Universal – Với mọi
• ∀xP (x) = P (x) is T for all x
Predicate Logic
Proof Methods
• ∃: Existential – Tồn tại
• ∃xP (x) = There exists an element x such that P (x) is T
• We need a domain of discourse for variable
2.7
Logics (cont.)
Tran Vinh Tan
Example
Let P (x) be the statement “x < 2”. What is the truth value of the
quantification ∀xP (x), where the domain consists of all real
number?
Contents
Predicate Logic
• P (3) = 3 < 2 is false
Proof Methods
• ⇒ ∀xP (x) is false
• 3 is a counterexample (phản ví dụ) of ∀xP (x)
Example
What is the truth value of the quantification ∃xP (x), where the
domain consists of all real number?
2.8
Logics (cont.)
Tran Vinh Tan
Example
Express the statement “Some student in this class comes from
Central Vietnam.”
Contents
Solution 1
• M (x) = x comes from Central Vietnam
Predicate Logic
Proof Methods
• Domain for x is the students in the class
• ∃xM (x)
Solution 2
• Domain for x is all people
• ...
2.9
Logics (cont.)
Negation of Quantifiers
Tran Vinh Tan
Statement
Negation
Equivalent form
∀xP (x)
¬(∀xP (x))
∃x¬P (x)
∃xP (x)
¬(∃xP (x))
∀x¬P (x)
Contents
Predicate Logic
Proof Methods
Example
• All CSE students study Discrete Math 1
• Let C(x) denote “x is a CSE student”
• Let S(x) denote “x studies Discrete Math 1”
• ∀x : C(x) → S(x)
• ∃x : ¬(C(x) → S(x)) ≡ ∃x : C(x) ∧ ¬S(x)
• There is a CSE student who does not study Discrete Math 1.
2.10
Another Example
Logics (cont.)
Tran Vinh Tan
Example
Translate these:
• All lions are fierce.
• Some lions do not drink coffee.
• Some fierce creatures do not drink coffee.
Contents
Predicate Logic
Proof Methods
Solution
Let P (x), Q(x) and R(x) be the statements “x is a lion”, “x is
fierce” and “x drinks coffee”, respectively.
• ∀x(P (x) → Q(x)).
• ∃x(P (x) ∧ ¬R(x)).
• ∃x(Q(x) ∧ ¬R(x)).
2.11
The Order of Quantifiers
Logics (cont.)
Tran Vinh Tan
• The order of quantifiers is important, unless all the quantifiers
are universal quantifiers or all are existential quantifiers
• Read from left to right, apply from inner to outer
Contents
Predicate Logic
Example
Proof Methods
∀x ∀y (x + y = y + x)
T for all x, y ∈ R
Example
∀x ∃y (x + y = 0) is T,
while
∃y ∀x (x + y = 0) is F
2.12
Translating Nested Quantifiers
Logics (cont.)
Tran Vinh Tan
Example
∀x (C(x) ∨ ∃y (C(y) ∧ F (x, y)) )
Provided that:
• C(x): x has a computer,
Contents
Predicate Logic
Proof Methods
• F (x, y): x and y are friends,
• x, y ∈ all students in your school.
Answer
For every student x in your school, x has a computer or there is a
student y such that y has a computer and x and y are friends.
2.13
Translating Nested Quantifiers
Logics (cont.)
Tran Vinh Tan
Example
∃x∀y∀z (((F (x, y) ∧ F (x, z) ∧ (y = z)) → ¬F (y, z)))
Provided that:
Contents
Predicate Logic
Proof Methods
• F (x, y): x, y are friends
• x, y, z ∈ all students in your school.
Answer
There is a student x, so that for every student y, every student z
not the same as y, if x and y are friends, and x and z are friends,
then y and z are not friends.
2.14
Translating into Logical Expressions
Logics (cont.)
Tran Vinh Tan
Example
1
“There is a student in the class has visited Hanoi”.
2
“Every students in the class have visited Nha Trang or Vung
Tau”.
Contents
Predicate Logic
Proof Methods
Answer
Assume:
C(x) : x has visited Hanoi
D(x) : x has visited Nha Trang
E(x) : x has visited Vung Tau
We have:
1
∃xC(x)
2
∀x(D(x) ∨ E(x))
2.15
Translating into Logical Expressions
Logics (cont.)
Tran Vinh Tan
Example
Every people has one best friend.
Contents
Predicate Logic
Proof Methods
Solution
Assume:
• B(x, y) : y is the best friend of x
We have:
∀x∃y∀z(B(x, y) ∧ ((y = z) → ¬B(x, z)))
2.16
Translating into Logical Expressions
Logics (cont.)
Tran Vinh Tan
Example
If a person is a woman and a parent, then this person is mother of
some one.
Contents
Predicate Logic
Proof Methods
Solution
We define:
• C(x) : x is woman
• D(x) : x is a parent
• E(x, y): x is mother of y
We have:
∀x((C(x) ∧ D(x)) → ∃yE(x, y))
2.17
Inference
Logics (cont.)
Tran Vinh Tan
Example
• If I have a girlfriend, I will take her to go shopping.
• Whenever I and my girlfriend go shopping and that day is a
special day, I will surely buy her some expensive gift.
Contents
Predicate Logic
Proof Methods
• If I buy my girlfriend expensive gifts, I will eat noodles for a
week.
• Today is March 8.
• March 8 is such a special day.
• Therefore, if I have a girlfriend,...
• I will eat noodles for a week.
2.18
Propositional Rules of Inferences
Logics (cont.)
Tran Vinh Tan
Rule of Inference
Name
p
p→q
∴q
Modus ponens
Contents
Predicate Logic
Proof Methods
¬q
p→q
∴ ¬p
Modus tollens
p→q
q→r
∴p→r
Hypothetical syllogism
(Tam đoạn luận giả định)
p∨q
¬p
∴q
Disjunctive syllogism
(Tam đoạn luận tuyển)
2.19
Logics (cont.)
Propositional Rules of Inferences
Tran Vinh Tan
Rule of Inference
Name
p
∴p∨q
Addition
(Quy tắc cộng )
Contents
Predicate Logic
Proof Methods
p∧q
∴p
Simplification
(Rút gọn)
p
q
∴p∧q
Conjunction
(Kết hợp)
p∨q
¬p ∨ r
∴q∨r
Resolution
(Phân giải)
2.20
Logics (cont.)
Tran Vinh Tan
Example
If it rains today, then we will not have a barbecue today. If we do
not have a barbecue today, then we will have a barbecue
tomorrow. Therefore, if it rains today, then we will have a
barbecue tomorrow.
Contents
Predicate Logic
Proof Methods
Solution
• p: It is raining today
• q: We will not have a barbecue today
• r: We will have barbecue tomorrow
p→q
q→r
∴p→r
Hypothetical syllogism
2.21
Logics (cont.)
Tran Vinh Tan
Example
• It is not sunny this afternoon
(¬p) and it is colder than
yesterday (q)
• We will go swimming (r) only if
it is sunny
• If we do not go swimming, then
we will take a canoe trip (s)
1. ¬p ∧ q
Hypothesis
2. ¬p
Simplification using (1)
3. r → p
Hypothesis
4. ¬r
Modus tollens using (2) and (3)
5. ¬r → s
Hypothesis
6. s
Modus ponens using (4) and (5)
7. s → t
Hypothesis
8. t
Modus ponens using (6) and (7)
Contents
Predicate Logic
Proof Methods
• If we take a canoe trip, then we
will be home by sunset (t)
• We will be home by sunset (t)
2.22
Fallacies
Logics (cont.)
Tran Vinh Tan
Definition
Fallacies (ngụy biện) resemble rules of inference but are based on
contingencies rather than tautologies.
Contents
Predicate Logic
Proof Methods
Example
If you do correctly every questions in mid-term exam, you will get
10 grade. You got 10 grade.
Therefore, you did correctly every questions in mid-term exam.
Is [(p → q) ∧ q] → p a tautology?
2.23
Rules of Inference for Quantified Statements
Logics (cont.)
Tran Vinh Tan
Rule of Inference
Name
∀xP (x)
∴ P (c)
Universal instantiation
(Cụ thể hóa phổ quát)
P (c)for an arbitrary c
∴ ∀xP (x)
Universal generalization
(Tổng quát hóa phổ quát)
∃xP (x)
∴ P (c)for some element c
Existential instantiation
(Cụ thể hóa tồn tại)
P (c)for some element c
∴ ∃xP (x)
Existential generalization
(Tổng quát hóa tồn tại)
Contents
Predicate Logic
Proof Methods
2.24
Logics (cont.)
Tran Vinh Tan
Example
• A student in this class has not gone to class
• Everyone in this class passed the first exam
• Someone who passed the first exam has not gone to class
Contents
Predicate Logic
Proof Methods
Hint
• C(x): x is in this class
• B(x): x has gone to class
• P (x): x passed the first exam
• Premises???
2.25