0% found this document useful (0 votes)
76 views46 pages

Logics (Cont.) : Discrete Structures For Computing On August 31, 2017

The document discusses predicate logic and quantifiers. It defines predicates as statements containing variables, and gives examples. Predicates become propositions when values are assigned to the variables. Quantifiers like "for all" (universal) and "there exists" (existential) are introduced, along with their truth values. The document provides examples of applying quantifiers to predicates over different domains. It also discusses how to negate quantified statements by changing the quantifier.

Uploaded by

Vũ Trần Minh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views46 pages

Logics (Cont.) : Discrete Structures For Computing On August 31, 2017

The document discusses predicate logic and quantifiers. It defines predicates as statements containing variables, and gives examples. Predicates become propositions when values are assigned to the variables. Quantifiers like "for all" (universal) and "there exists" (existential) are introduced, along with their truth values. The document provides examples of applying quantifiers to predicates over different domains. It also discusses how to negate quantified statements by changing the quantifier.

Uploaded by

Vũ Trần Minh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

Logics (cont.

Nguyen An Khuong,
Tran Tuan Anh, Le

Chapter 2 Hong Trang

Logics (cont.)
Discrete Structures for Computing on August 31, 2017
Contents

Predicate Logic

Exercise

Nguyen An Khuong, Tran Tuan Anh, Le Hong Trang


Faculty of Computer Science and Engineering
University of Technology - VNUHCM
[email protected]
2.1
Logics (cont.)
Contents
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Contents
1 Predicate Logic Predicate Logic

Exercise

2 Exercise

2.2
Logics (cont.)
Course outcomes
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Course learning outcomes

L.O.1 Understanding of logic and discrete structures


L.O.1.1 – Describe definition of propositional and predicate logic
L.O.1.2 – Define basic discrete structures: set, mapping, graphs
Contents
L.O.2 Represent and model practical problems with discrete structures Predicate Logic
L.O.2.1 – Logically describe some problems arising in Computing Exercise
L.O.2.2 – Use proving methods: direct, contrapositive, induction
L.O.2.3 – Explain problem modeling using discrete structures

L.O.3 Understanding of basic probability and random variables


L.O.3.1 – Define basic probability theory
L.O.3.2 – Explain discrete random variables

L.O.4 Compute quantities of discrete structures and probabilities


L.O.4.1 – Operate (compute/ optimize) on discrete structures
L.O.4.2 – Compute probabilities of various events, conditional
ones, Bayes theorem

2.3
Logics (cont.)
Limits of Propositional Logic
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Contents

• x>3 Predicate Logic

Exercise
• All square numbers are not prime numbers. 100 is a square
number. Therefore 100 is not a prime number.

2.4
Logics (cont.)
Predicates
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Definition
A predicate (vị từ) is a statement containing one or more Contents
variables. If values are assigned to all the variables in a predicate, Predicate Logic

the resulting statement is a proposition (mệnh đề ). Exercise

Example:
• x > 3 (predicate)
• 5 > 3 (proposition)
• 2 > 3 (proposition)

2.5
Logics (cont.)
Predicates
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Contents

• x > 3 → P (x) Predicate Logic

Exercise
• 5 > 3 → P (5)
• A predicate with n variables P (x1 , x2 , ..., xn )

2.6
Logics (cont.)
Truth value
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Contents
• x > 3 is true or false? Predicate Logic

• 5>3 Exercise

• For every number x, x > 3 holds


• There is a number x such that x > 3

2.7
Logics (cont.)
Quantifiers
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

• ∀: Universal – Với mọi Contents

Predicate Logic
• ∀xP (x) = P (x) is T for all x
Exercise
• ∃: 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.8
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

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

• P (3) = 3 < 2 is false Predicate Logic

Exercise
• ⇒ ∀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.9
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang
Example
Express the statement “Some student in this class comes from
Central Vietnam.”

Solution 1 Contents

Predicate Logic
• M (x) = x comes from Central Vietnam
Exercise
• Domain for x is the students in the class
• ∃xM (x)

Solution 2

• Domain for x is all people


• ...

2.10
Logics (cont.)
Negation of Quantifiers
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Statement Negation Equivalent form


∀xP (x) ¬(∀xP (x)) ∃x¬P (x)
∃xP (x) ¬(∃xP (x)) ∀x¬P (x)
Contents

Predicate Logic

Exercise
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.11
Logics (cont.)
Another Example
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Example
Translate these:
• All lions are fierce.
• Some lions do not drink coffee. Contents

Predicate Logic
• Some fierce creatures do not drink coffee.
Exercise

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.12
Logics (cont.)
The Order of Quantifiers
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

• 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

Example Predicate Logic

Exercise
∀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.13
Logics (cont.)
Translating Nested Quantifiers
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Example
∀x (C(x) ∨ ∃y (C(y) ∧ F (x, y)) )
Provided that: Contents

Predicate Logic
• C(x): x has a computer,
Exercise
• 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.14
Logics (cont.)
Translating Nested Quantifiers
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Example
∃x∀y∀z (((F (x, y) ∧ F (x, z) ∧ (y 6= z)) → ¬F (y, z)))
Provided that: Contents

Predicate Logic
• F (x, y): x, y are friends
Exercise
• 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.15
Logics (cont.)
Translating into Logical Expressions
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

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

Exercise
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.16
Logics (cont.)
Translating into Logical Expressions
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Example
Every people has only one best friend. Contents

Predicate Logic

Exercise
Solution
Assume:
• B(x, y) : y is the best friend of x
We have:
∀x∃y∀z(B(x, y) ∧ ((y 6= z) → ¬B(x, z)))

2.17
Logics (cont.)
Translating into Logical Expressions
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Example
If a person is a woman and a parent, then this person is mother of
some one. Contents

Predicate Logic
Solution Exercise

We define:
• W (x) : x is woman
• P (x) : x is a parent
• M (x, y): x is mother of y
We have:
∀x((W (x) ∧ P (x)) → ∃yM (x, y))

2.18
Logics (cont.)
Inference
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Example

• If I have a girlfriend, I will take her to go shopping.


Contents
• Whenever I and my girlfriend go shopping and that day is a
Predicate Logic
special day, I will surely buy her some expensive gift.
Exercise
• 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.19
Logics (cont.)
Propositional Rules of Inferences
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Rule of Inference Name


p
p→q
∴q Modus ponens Contents

Predicate Logic
¬q Exercise
p→q
∴ ¬p Modus tollens
p→q
q→r
Hypothetical syllogism
∴p→r
(Tam đoạn luận giả định)
p∨q
¬p
Disjunctive syllogism
∴q
(Tam đoạn luận tuyển)

2.20
Logics (cont.)
Propositional Rules of Inferences
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Rule of Inference Name


p
Addition
∴p∨q
(Quy tắc cộng ) Contents

Predicate Logic
p∧q
Simplification Exercise
∴p
(Rút gọn)
p
q
Conjunction
∴p∧q
(Kết hợp)
p∨q
¬p ∨ r
Resolution
∴q∨r
(Phân giải)

2.21
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang
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
Solution
Exercise

• 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.22
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Example
1. ¬p ∧ q Hypothesis
• It is not sunny this afternoon
(¬p) and it is colder than 2. ¬p Simplification using (1)
yesterday (q) Contents
• We will go swimming (r) only if 3. r → p Hypothesis Predicate Logic
it is sunny Exercise
4. ¬r Modus tollens using (2) and (3)
• If we do not go swimming, then
we will take a canoe trip (s) 5. ¬r → s Hypothesis
• If we take a canoe trip, then we
will be home by sunset (t) 6. s Modus ponens using (4) and (5)
• We will be home by sunset (t)
7. s → t Hypothesis

8. t Modus ponens using (6) and (7)

2.23
Logics (cont.)
Fallacies
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Definition
Fallacies (ngụy biện) resemble rules of inference but are based on
contingencies rather than tautologies. Contents

Predicate Logic

Exercise
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.24
Logics (cont.)
Rules of Inference for Quantified Statements
Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Rule of Inference Name


∀xP (x)
Universal instantiation Contents
∴ P (c)
(Cụ thể hóa phổ quát) Predicate Logic

Exercise
P (c)for an arbitrary c
Universal generalization
∴ ∀xP (x)
(Tổng quát hóa phổ quát)
∃xP (x)
Existential instantiation
∴ P (c)for some element c
(Cụ thể hóa tồn tại)
P (c)for some element c
Existential generalization
∴ ∃xP (x)
(Tổng quát hóa tồn tại)

2.25
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Example

• A student in this class has not gone to class


• Everyone in this class passed the first exam
Contents
• Someone who passed the first exam has not gone to class
Predicate Logic

Exercise

Hint

• C(x): x is in this class


• B(x): x has gone to class
• P (x): x passed the first exam
• Premises???

2.26
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

1. ∃x(C(x) ∧ ¬B(x)) Premise


2. C(a) ∧ ¬B(a) Existential instantiation from (1)
3. C(a) Simplification from (2) Contents
4. ∀x(C(x) → P (x)) Premise Predicate Logic

5. C(a) → P (a) Universal instantiation from (4) Exercise

6. P (a) Modus ponens from (3) and (5)


7. ¬B(a) Simplification from (2)
8. P (a) ∧ ¬B(a) Conjunction from (6) and (7)
9. ∃x(P (x) ∧ ¬B(x)) Existential generalization from (8)

2.27
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Given the predicate p(x) :00 x2 − 3x + 2 = 000 . What is the truth


value (chân trị) of the following propositions:
a) p(0) Contents

Predicate Logic
b) p(1) Exercise

c) p(2)
d) ∃x, p(x)
e) ∀x, p(x)

2.28
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Let x, y ∈ Z+ , and the predicate: p(x, y): "x is a divisor of y"


Determine the truth value of the following propositions:
a) p(2, 3)
b) p(2, 6) Contents

Predicate Logic
c) ∀y, p(1, y)
Exercise
d) ∀x, p(x, x)
e) ∀x∃y, p(x, y)
f) ∃y∀x, p(x, y)
g) ∀x∀y, (p(x, y) ∧ p(y, x)) → (x = y)
h) ∀x∀y∀z(p(x, y) ∧ p(y, z)) → (p(x, z))

2.29
Logics (cont.)
Provided that: Nguyen An Khuong,
Tran Tuan Anh, Le
• F (x, y) : x is father of y, Hong Trang

• M (x, y) : x is mother of y,
• S(x, y) : x is sister of y,
• B(x, y) : x is brother of y,
• H(x, y) : x is spouse (wife/husband) of y,
Contents
• O(x, y) : x is elder than y. Predicate Logic

Exercise
Express each of these statements using predicates:

a) ‘He (a person) has an elder sister and younger brother’.


b) ‘All of her brothers are younger than her’.
c) ‘Thuyen has only one husband’ (Thuyen is a private name).
d) ‘One of his sisters is younger than him’.
e) ‘Everyone has grandfather, grandmother, maternal grandfather,
maternal grandmother’.
f) ‘A father of a person cannot be a mother of other ones’.

2.30
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Solutions: Hong Trang

a) ‘He (a person) has an elder sister and younger brother’.


∃x∃y(S(x, m) ∧ O(x, m) ∧ B(y, m) ∧ ¬O(y, m)).
b) ‘All of her brothers are younger than her’.
∀x(B(x, m) → ¬O(x, m)).
Contents
c) ‘Thuyen has only one husband’ (Thuyen is a private name). Predicate Logic
∃x∀y H(x, Thuyen) ∧ H(y, Thuyen) → (x = y) Exercise
or ∃x∀y H(x, Thuyen) ∧ (x 6= y) → ¬H(y, Thuyen).
d) ‘One of his sisters is younger than him’.
∃x∀y(S(x, m) ∧ ¬O(x, m) ∧ S(y, m) ∧ (x 6= y) → O(y, m)).
e) ‘Everyone has grandfather, grandmother, maternal grandfather,
maternal grandmother’. ∀x∃y∃z∃y1 ∃y2 ∃z1 ∃z2
(F (y, x) ∧ M (z, x) ∧ F (y1 , y) ∧ M (y2 , y) ∧ F (z1 , z) ∧ M (z2 , z)).
f) ‘A father of a person cannot be a mother of other ones’.
∃x∃y∀z(F (x, y) → ¬M (x, z)).

2.31
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Translating the following nested quantifiers:

a) B(c, m) ∧ (O(c, m) ∨ O(m, c)). Contents

b) B(c, m) ∧ F (a, m) → O(a, c) ∧ F (a, c). Predicate Logic

Exercise
c) ∀x∀y(S(x, m) ∧ B(c, y) → x = y).
d) ∃x((S(x, m) ∨ H(c, x)) ∨ ∃x(H(x, m) ∧ O(x, m))).
e) ∀x∀y(S(x, m) ∧ S(y, m) → O(x, y) ∨ O(y, x))

2.32
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang
Solutions:

a) B(c, m) ∧ (O(c, m) ∨ O(m, c)).


c is a brother (elder/younger) of m.
b) B(c, m) ∧ F (a, m) → O(a, c) ∧ F (a, c).
If c is a brother of m and a is a father of m, then a is elder Contents

than c and a is the father of c. Predicate Logic

Exercise
c) ∀x∀y(S(x, m) ∧ B(c, y) → x = y).
Whoever is the sister of m, then c is also a brother of that
person.
d) ∃x((S(x, m) ∨ H(c, x)) ∨ ∃x(H(x, m) ∧ O(x, m))).
There is a sister of m or c is her husband, or there is a husband
of m and elder than m.
e) ∀x∀y(S(x, m) ∧ S(y, m) → O(x, y) ∨ O(y, x))
All of the sisters of m are older or younger together.

2.33
Logics (cont.)

Nguyen An Khuong,
Given a predicate N (x) "x has been to Da Lat" with the domain Tran Tuan Anh, Le
Hong Trang
is the all students in Mathematics class. Translate the following
predicates into English
a) ∃xN (x)
b) ∀xN (x)
c) ¬∃xN (x) Contents

d) ∃x¬N (x) Predicate Logic

Exercise
e) ¬∀xN (x)
f) ∀x¬N (x)

a) There is a student in this class has been to Da Lat.


b) All students in Math class have been to Da Lat.
c) There is no exists a student in Math class has gone to Da Lat.
d) There is a student in this class has never gone to Da Lat.
e) Not all students in Math class have ever been to Da Lat.
f) All students in Math class have never been to Da Lat.

2.34
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Given the predicate N (x) "x studies more than 5 hours in class
every weekday" with the domain is the all students in
Mathematics class. Express the following predicates:
a) ∃xN (x)
b) ∀xN (x) Contents

Predicate Logic
c) ∃x¬N (x)
Exercise
d) ∀x¬N (x)
a) There is a student who studies in the class over 5 hours in class every
weekday.
b) All of the students in Math class study over 5 hours every weekday.
c) There is a student who does not study in the class over 5 hours every
weekday.
d) There are no student studies in the class over 5 hours every weekday.

2.35
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Hãy cho biết công thức vị từ của đoạn mã giả (pseudo code) sau:

for (i = 0; i<numObjects; i++) {


Object x = Objects(i); Contents
if isMushroom(x) Predicate Logic
if isPoisonous(x) && isPurple(x) Exercise
return false;
}
return true;

• There are no mushrooms that are poisonous and purple.


• ∀xM ushroom(x) → ¬(P oisonous(x) ∧ P urple(x))

2.36
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Hãy cho biết công thức vị từ của đoạn mã giả (pseudo code) sau:

for (i=0; i<numObjects; i++) {


Object x = Objects(i); Contents

if isMushroom(x) && isPoisonous(x) && isPurple(x) Predicate Logic

return true; Exercise

}
return false;

• There is a mushroom that is purple and poisonous.


• ∃xM ushroom(x) ∧ P oisonous(x) ∧ P urple(x)

2.37
Logics (cont.)

Nguyen An Khuong,
Cho đoạn mã giả (pseudo code) sau: Tran Tuan Anh, Le
Hong Trang

//— Look for first match


for (x=0; x<numKids; x++)
if isParent(Peter, kids[x])
match1Found = true; Contents

Predicate Logic
//— Now look for a second match Exercise
for (y=0; (y<numKids)&&(y!=x); y++)
if isParent(Peter, kids[y])
match2Found = true;

return match1Found && match2Found;


Biết rằng: Mảng kids gồm 3 phần tử: { Alice, Bob, Charles } và
Peter chỉ có 1 con là Alice.
Hãy cho biết công thức vị từ của câu "Peter có ít nhất 2 con".
∃x∃y(P arentOf (P eter, x) ∧ P arentOf (P eter, y) ∧ ¬(x = y))

2.38
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Cho P(x) là câu "x nói được tiếng Nga" và Q(x) là câu "x biết Hong Trang

ngôn ngữ Java".


Hãy diễn đạt các câu sau bằng cách dùng P(x), Q(x), các lượng
từ và các liên từ logic.
Cho không gian đối với các lượng từ là tập hợp tất cả sinh viên ở
trường bạn. Contents
a) Có một sinh viên ở trường bạn nói được tiếng Nga và biết Java. Predicate Logic

b) Có một sinh viên ở trường bạn nói được tiếng Nga nhưng không biết Java. Exercise

c) Mọi sinh viên ở trường bạn đều nói được tiếng Nga hoặc biết Java.
d) Không có một sinh viên nào ở trường bạn nói được tiếng Nga hoặc biết
Java.

a) ∃x(P (x) ∧ Q(x))


b) ∃x(P (x) ∧ ¬Q(x))
c) ∀x(P (x) ∨ Q(x))
d) ∀x¬(P (x) ∧ Q(x))

2.39
Cho L(x,y) là câu "x yêu y", với không gian của cả x và y là tập Logics (cont.)

hợp mọi người trên thế giới. Hãy dùng các lượng từ để diễn đạt Nguyen An Khuong,
Tran Tuan Anh, Le
các câu sau Hong Trang
a) Mọi người đều yêu Jerry.
b) Mọi người đều yêu một ai đó.
c) Có một người mà tất cả mọi người đều yêu.
d) Không có ai yêu tất cả mọi người.
e) Có một người mà Lydia không yêu.
f) Có một người mà không ai yêu.
g) Có đúng một người mà tất cả mọi người đều yêu. Contents

h) Có đúng hai người mà Lynn yêu. Predicate Logic


i) Mọi người đều yêu chính mình. Exercise
j) Có một người nào đó không yêu ai ngoài chính mình.
a) ∀xL(x, Jerry)
b) ∀x∃yL(x, y)
c) ∃y∀xL(x, y)
d) ¬(∃x(∀yL(x, y)), ¬(∃x(∧y L(x, y)) hoặc ∀x¬(∧y L(x, y))
e) ∃x¬L(Lydia, x)
f) ∃x∀y¬L(x, y)
g) ∃x(∀yL(x, y) ∧ ∀z((∀wL(w, z)) → z = x))
h) ∃x∃y(x 6= y ∧ L(Lynn, x) ∧ L(Lynn, y) ∧ ∀z(L(Lynn, z) →
(z = x ∨ z = y)))
i) ∀xL(x, x)
j) ∃x∀y(L(x, y) → x = y) 2.40
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Cho các vị từ: Hong Trang

. -P(x): "x là một vấn đề toán học".


. -Q(x): "x khó" (theo một tiêu chuẩn được định nghĩa tốt
nào đó).
. -R(x): "x dễ" (theo một tiêu chuẩn được định nghĩa tốt nào
đó - giống như trên). Contents
. -S(x): "x không thể giải được". Predicate Logic

Diễn giải những công thức vị từ sau dưới dạng ngôn ngữ tự nhiên Exercise

a) ∀x(P (x) → (Q(x) ⇐⇒ ¬R(x)))


b) ∃x(S(x) ∧ ¬P (x))
Vì có nhiều cách diễn đạt một công thức vị từ dưới dạng ngôn
ngữ tự nhiên và sau đây là một cách
a) Nếu x là một vấn đề toán học thì x là bài toán khó tương
đương với x không dễ.
b) Có vấn đề không toán học không thể giải được

2.41
Logics (cont.)

Nguyen An Khuong,
Dịch các bản mô tả sau đây sang tiếng Việt trong đó F (p) là Tran Tuan Anh, Le
Hong Trang
“Máy in p bị hỏng”,
B(p) là “Máy in p đang bận in tài liệu khác”,
L(j) là “Việc in j đã bị mất”,
và Q(j) là “Việc in j đang trong hàng đợi.”
a) ∃p(F (p) ∧ B(p)) → ∃jL(j)
Contents
b) ∀pB(p) → ∃jQ(j) Predicate Logic

c) ∃j(Q(j) ∧ L(j)) → ∃pF (p) Exercise

d) (∀pB(p) ∧ ∀jQ(j)) → ∃jL(j)


a) Nếu có một máy in nào đó bị hỏng trong khi đang bận in tài liệu thì chắc
chắn sẽ có tài liệu bị mất.
b) Nếu tất cả máy in đều đang bận in tài liệu thì sẽ có tài liệu đang đợi được
in.
c) Nếu một tài liệu đang được đợi in nhưng lại bị mất, chứng tỏ có máy in
nào đó đã bị hỏng.
d) Khi tất cả các máy in đều đang bận in tài liệu khác, mà tất cả các công
việc in vẫn phải chờ, thì sẽ có một việc in nào đó bị mất.

2.42
Logics (cont.)

Chuyển các câu sau sang vị từ, lượng từ và toán tử logic: Nguyen An Khuong,
Tran Tuan Anh, Le
a) Không có ai là hoàn hảo. Hong Trang

b) Không phải mọi người đều hoàn hảo.


c) Tất cả bạn bè của bạn đều hoàn hảo.
d) Ít nhất có một đứa bạn của bạn là hoàn hảo.
e) Mọi người đều là bạn của bạn và họ hoàn hảo.
f) Không phải tất cả mọi người là bạn của bạn hoặc có ai đó không hoàn Contents

hảo. Predicate Logic

Exercise
C(x): x là hoàn hảo.
D(x): x là bạn của bạn.
E(x): x là bất kỳ người nào khác.
a) ¬∃xC(x)
b) ∃x¬C(x)
c) ∀xD(x) → C(x)
d) ∃x∀y(D(x) ∧ D(y) ∧ (x 6= y)) → C(x) =⇒ ∃y(D(y) → C(y))
e) ∀x(D(x) ∧ C(x))
f) ∀x∃y(D(y) ∧ (y 6= x) ∨ ¬C(y)) =⇒ ¬∀xD(x) ∨ ∃yC(y)

2.43
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang
Cho các vị từ sau:
- P(x): Chương trình x đáp ứng chuẩn ABET.
- Q(x,y): Chương trình x có mục tiêu đào tạo giống chương
trình y.
- R(x): Kết quả đầu ra của chương trình x là có thể kiểm
chứng được. Contents

Predicate Logic
Mệnh đề vị từ nào sau biểu diễn câu : "Mọi chương trình đào tạo
Exercise
nếu có mục tiêu giống một chương trình khác đã đáp ứng chuẩn
ABET và kết quả đầu ra có thể kiểm chứng được thì cũng tuân
theo chuẩn ABET"
A) ∀x(P (x) ∧ ¬Q(x)) → ∃x(R(x))
B) ∀x(∃y(Q(x, y) ∧ P (y) ∧ R(x)) → P (x))
C) ∀x(∃y(Q(x, y) ∧ P (y) ∧ R(x)) → P (x) ∨ R(x))
D) ∀x(∀y(Q(x, y) ∧ P (y) ∨ R(x)) → P (x))

2.44
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Hong Trang

Trong câu hỏi này giả sử các vị từ:


- P (x, y): x là phụ huynh của y.
- M (x): x là nam giới .
Nếu ta cho: Contents

F (v, w) = M (v) ∧ ∃x∃y(P (x, y) ∧ P (x, v) ∧ (y 6= v) ∧ P (y, w)), Predicate Logic

thì F (v, w) có nghĩa là Exercise

A) v là anh của w
B) v là cháu trai của w
C) v là chú của w
D) v là ông của w

2.45
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Le
Chuyển các câu sau sang vị từ, lượng từ và toán tử logic: Hong Trang

a) Khi ổ cứng còn ít hơn 30 GB, một thông điệp cảnh báo sẽ
được gửi tới mọi người dùng.
b) Không được sao lưu hệ thống tập tin nếu có một người nào đó
đang đăng nhập vào hệ thống.
c) Đoạn phim Youtube sẽ được buffer khi còn ít nhất 8 MB bộ Contents

nhớ và tốc độ đường tuyền tối thiểu là 56 kbits/s. Predicate Logic

Exercise
d) Chỉ vài sinh viên máy tính lập trình tốt.
e) Không một sinh viên máy tính nào không cần cù.
f) Không phải tất cả các sinh viên máy tính đều thông minh.
g) Tất cả người Pompei hoặc trung thành với Caesar hoặc ghét
ông ta.
h) Mỗi người đều trung thành với một người nào đó.
i) Người ta chỉ muốn ám sát những nhà cầm quyền mà người ta
không trung thành.

2.46

You might also like