0% found this document useful (0 votes)
11 views44 pages

Ds 2 Predicate

This document discusses predicate logic and quantifiers. It provides definitions of predicates, truth values, quantifiers like for all and there exists, and examples of applying quantifiers to express statements. Negation of quantifiers is also covered.
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)
11 views44 pages

Ds 2 Predicate

This document discusses predicate logic and quantifiers. It provides definitions of predicates, truth values, quantifiers like for all and there exists, and examples of applying quantifiers to express statements. Negation of quantifiers is also covered.
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/ 44

Logics (cont.

Nguyen An Khuong,
Tran Tuan Anh, Nguyen

Chapter 2
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Logics (cont.)
Discrete Structures for Computing on January 4, 2023

Contents
Predicate Logic
Exercise

Nguyen An Khuong, Tran Tuan Anh, Nguyen Tien Thinh, Mai


Xuan Toan, Tran Hong Tai
Faculty of Computer Science and Engineering
University of Technology - VNUHCM
[email protected]
2.1
Contents Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

1 Predicate Logic Contents


Predicate Logic
Exercise

2 Exercise

2.2
Course outcomes Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

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

L.O.2 Represent and model practical problems with discrete structures Contents
L.O.2.1  Logically describe some problems arising in Computing Predicate Logic
L.O.2.2  Use proving methods: direct, contrapositive, induction Exercise
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
Limits of Propositional Logic Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Contents
• x>3
Predicate Logic
• All square numbers are not prime numbers. 100 is a square Exercise
number. Therefore 100 is not a prime number.

2.4
Predicates Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

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
• x > 3 → P (x) Exercise
• 5 > 3 → P (5)
• A predicate with n variables P (x1 , x2 , ..., xn )
Example:

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

2.5
Truth value Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

• x>3 is true or false? Contents

• 5>3 Predicate Logic


Exercise
• For every number x, x > 3 holds

• There is a number x such that x>3

2.6
Quantifiers Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

• ∀: Universal  Vîi måi Contents


• ∀xP (x) = P (x) is T for all x Predicate Logic
• ∃: Existential  Tçn t¤i Exercise

• ∃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.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai
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
• ⇒ ∀xP (x) is false Exercise

• 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.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai
Example
Express the statement "Some student in this class comes from
Central Vietnam."

Solution 1
Contents
• M (x) = x comes from Central Vietnam Predicate Logic

• Domain for x is the students in the class Exercise

• ∃xM (x)

Solution 2
• Domain for x is all people

• ...

2.9
Negation of Quantifiers Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Statement Negation Equivalent form


∀xP (x) ¬(∀xP (x)) ∃x¬P (x)
∃xP (x) ¬(∃xP (x)) ∀x¬P (x)
Contents
Predicate Logic
Example Exercise

• 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.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Example
Translate these:

• All lions are fierce.

• Some lions do not drink coffee.


Contents
• Some fierce creatures do not drink coffee. Predicate Logic
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.11
The Order of Quantifiers Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

• 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

Example Contents
Predicate Logic
∀x ∀y (x + y = y + x) Exercise
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.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Example
∀x (C(x) ∨ ∃y (C(y) ∧ F (x, y)) )
Provided that:
Contents
• C(x): x has a computer, Predicate Logic
• F (x, y): x and y are friends, Exercise

• 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.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Example
∃x∀y∀z (((F (x, y) ∧ F (x, z) ∧ (y 6= z)) → ¬F (y, z)))
Provided that:
Contents
• F (x, y): x, y are friends Predicate Logic

• x, y, z ∈ all students in your Exercise


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.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Example
1  There is a student in the class has visited Hanoi.

2  Every student in the class has visited Nha Trang or Vung


Tau.
Contents
Predicate Logic
Answer Exercise

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.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan

Example Toan, Tran Hong Tai

If a person is a woman and a parent, then this person is mother of


someone.

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

Example
"Every people has only one best friend."
Assume:

• B(x, y) : y is the best friend of x

2.16
Translating into Logical Expressions Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Example
"Every people has only one best friend." Contents
Assume: Predicate Logic

• B(x, y) : y Exercise
is the best friend of x

Solution
∀x∃y∀z(B(x, y) ∧ ((y 6= z) → ¬B(x, z)))

2.17
Inference Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

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 Contents


special day, I will surely buy her some expensive gift. Predicate Logic
• 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.18
Propositional Rules of Inferences Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Rule of Inference Name


p
p→q
∴q Modus ponens
Contents
¬q Predicate Logic
p→q Exercise

∴ ¬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.19
Propositional Rules of Inferences Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Rule of Inference Name


p
Addition
∴p∨q
(Quy t­c cëng )
Contents
p∧q Predicate Logic
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.20
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Example Toan, Tran Hong Tai

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
Solution Predicate Logic
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.21
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Example
1. ¬p ∧ q Hypothesis
• It is not sunny this afternoon
(¬p) and it is colder than 2. ¬p Simplification using (1)
yesterday (q )
• We will go swimming (r) only if 3. r → p Hypothesis Contents
it is sunny Predicate Logic
4. ¬r Modus tollens using (2) andExercise
(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.22
Fallacies Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Definition
Fallacies (ngöy bi»n) resemble rules of inference but are based on
contingencies rather than tautologies. Contents
Predicate Logic
Example Exercise

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.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Rule of Inference Name


∀xP (x)
Universal instantiation
∴ P (c) Contents
(Cö thº hâa phê qu¡t )
Predicate Logic
P (c)for an arbitrary c Exercise
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.24
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

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

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

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


2. C(a) ∧ ¬B(a) Existential instantiation from (1)
3. C(a) Simplification from (2)
4. ∀x(C(x) → P (x)) Premise Contents
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.26
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

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
b) p(1) Predicate Logic
Exercise
c) p(2)
d) ∃x, p(x)
e) ∀x, p(x)

2.27
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

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
c) ∀y, p(1, y) Predicate Logic
d) ∀x, p(x, x) Exercise

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

Provided that: Nguyen An Khuong,


Tran Tuan Anh, Nguyen
• F (x, y) : x is father of y , Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

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

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Solutions: Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

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)).


c) `Thuyen has only one husband' (Thuyen is a private name). Contents
∃x∀y H(x, Thuyen) ∧ H(y, Thuyen) → (x = y) Predicate Logic
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.30
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

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
c) ∀x∀y(S(x, m) ∧ B(c, y) → x = y). Exercise

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

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Given a predicate N (x) "x has been to Da Lat" with the domain Tien Thinh, Mai Xuan
Toan, Tran Hong Tai
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.32
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

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:
Contents
a) ∃xN (x) Predicate Logic
Exercise
b) ∀xN (x)
c) ∃x¬N (x)
d) ∀x¬N (x)

2.33
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

What is the propositional formula for the following pseudo code:

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


Object x = Objects(i);
if isMushroom(x) Contents

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

return false; Exercise

}
return true;
• There are no mushrooms that are poisonous and purple.

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

2.34
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

What is the propositional formula for the following pseudo code:

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


Object x = Objects(i);
if isMushroom(x) && isPoisonous(x) && isPurple(x)
Contents
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.35
Logics (cont.)

Giving the following pseudo code: Nguyen An Khuong,


Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

// Look for first match


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

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

return match1Found && match2Found;


Knowing that: kids array has 3 elements: { Alice, Bob, Charles }
and Peter only have 1 child Alice.
What is the propositional formula for "Peter has at least 2
children".
∃x∃y(P arentOf (P eter, x) ∧ P arentOf (P eter, y) ∧ ¬(x = y))

2.36
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai
Let P(x) be "x can speak Russian" and Q(x) be "x can use Java".
Formalize the following:
Giving the space is ll students in your university.
a) There is a student in your university that can speak Russian and can use
Java.
b) There is a student in your university that can speak Russian but can't Contents
use Java. Predicate Logic
c) Every student in your university can speak Russian or can use Java. Exercise

d) None of the student in your university can speak Russian or can use 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.37
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Let L(x,y) be "x love y", where the space of x and y is the set of
all people in the world. Use logical quantifier to express the
following:
a) Everybody loves Jerry.
b) Everybody loves someone.
Contents
c) There is a person who everybody loves. Predicate Logic
d) Nobody loves everybody. Exercise
e) There is someone Lydica doesn't love.
f) There is someone nobody loves.
g) There is exact one person everybody loves.
h) There are exact two person Lynn loves.
i) Everybody loves themselves.
j) There is a person who love nobody but himself.

2.38
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Giving the following: Toan, Tran Hong Tai

. -P(x): "x is a math problem".


. -Q(x): "x is hard" (based on a well-defined standard).
. -R(x): "x is easy" (based on a well-defined standard - same
as above).
. -S(x): "x is not solvable".
Contents
Translate the following propositional formulas to natural English Predicate Logic
a) ∀x(P (x) → (Q(x) ⇐⇒ ¬R(x))) Exercise

b) ∃x(S(x) ∧ ¬P (x))
There are many ways to translate a formula to natural language
and the following is one of them

a) If x is a math problem, to say x is hard is the same as saying

x is not easy.

b) There is unsolvable non-math problem.

2.39
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Translate the following propositional formulas to natural English


where:
F (p) is Printer p is broken,
B(p) is Printer p is currently printing another document,
Contents
L(j) is Printing job j is lost,
Predicate Logic
and Q(j) is Printing job j is in queue.
Exercise
a) ∃p(F (p) ∧ B(p)) → ∃jL(j)
b) ∀pB(p) → ∃jQ(j)
c) ∃j(Q(j) ∧ L(j)) → ∃pF (p)
d) (∀pB(p) ∧ ∀jQ(j)) → ∃jL(j)

2.40
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Formalize the following sentences:


a) Nobody is perfect.
b) not everyone is perfect.
c) All your friends are perfect. Contents
d) At least one of your friend is perfect. Predicate Logic
e) Everybody is your friend and they are perfect. Exercise

f) Not everybody is your friend or there is somebody not perfect.


Giving: C(x): x is perfect.
D(x): x is your friend.
E(x): x is someone else.

2.41
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Giving the following Predicate:


- P(x): Program x satisfies ABET standard.
- Q(x,y): Program x has the same educational goal as program y.
- R(x): Educational outcome from program x is verifiable.
Which of the following formalize this sentence : "Every program Contents
that has the same educational goal as a ABET satisfied program Predicate Logic
and verifiable Educational outcome also satisfies ABET standard" Exercise

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

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Toan, Tran Hong Tai

Let:
- P (x, y): x is parent of y.
- M (x): x is male .
Given:
Contents
F (v, w) = M (v) ∧ ∃x∃y(P (x, y) ∧ P (x, v) ∧ (y 6= v) ∧ P (y, w)),
Predicate Logic
then F (v, w) means:
Exercise
A) v is brother of w
B) v is cousin of w
C) v is uncle of w
D) v is grand father of w

2.43
Logics (cont.)

Nguyen An Khuong,
Tran Tuan Anh, Nguyen
Tien Thinh, Mai Xuan
Formalize the following sentences using predicate logic: Toan, Tran Hong Tai

a) When a hard drive has less than 30GB free space, a warning

will be issued to all the users.

b) Do not back up the files if anyone is logging in the system.

c) YouTube's videos will be buffered if there are at least 8MB


Contents
memory and 56kb/s line rate.
Predicate Logic
d) Few computer student is good at programming. Exercise

e) No computer student is not hard working.

f) Not all computer students are smart.

g) All the Pompeians are either loyal to or hate Caesar.

h) Everyone is loyal to someone.

i) People only want to assassinate the dictator whom they are

not loyal to.

2.44

You might also like