Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

TRƯỜNG ĐẠI HỌC BÁCH KHOA - ĐẠI HỌC QUỐC GIA TP.

HCM
KHOA KHOA HỌC VÀ KỸ THUẬT MÁY TÍNH

CẤU TRÚC RỜI RẠC (CO1007)

HOMEWORK 1

GVHD: Nguyễn An Khương


Sinh viên: Nguyễn Minh Quý-2212868

TP.Hồ Chí Minh, 9/2023


Trường Đại học Bách Khoa - Đại học Quốc gia TP.HCM
Khoa Khoa học và Kỹ thuật Máy tính

Mục lục
1 1.1 2

2 1.2 2

3 1.3 3

4 1.4 5

5 1.5 8

CẤU TRÚC RỜI RẠC (CO1007)) Trang 1/10


Trường Đại học Bách Khoa - Đại học Quốc gia TP.HCM
Khoa Khoa học và Kỹ thuật Máy tính

1 1.1
8. A. True B. True C. False D. False E. False
9. a False b True c True d True e True
11.
a) Sharks have not been spotted near the shore.
(b) Swimming at the New Jersey shore is allowed and sharks have not been spotted near the
shore.
(c) Swimming at the New Jersey shore is not allowed or sharks have been spotted near the shore.
(d) If swimming at the New Jersey shore is allowed, then sharks have not been spotted near the
shore.
(e) If sharks have not been spotted near the shore, then swimming at the New Jersey Shore is
allowed.
(f) If swimming at the New Jersey shore is not allowed, then sharks have not been spotted near
the shore.
(g) Swimming at the New Jersey shore is allowed if and only if sharks have not been spotted
near the shore.
(h) Swimming at the New Jersey shore is not allowed and, either swimming at the New Jersey
shore is allowed or sharks have not been spotted near the shore.
15. a) ¬p
b) p ∧¬q
c)p → q
d)¬p → ¬q
e)p → q
f )q ∧ ¬p
g)q → p
16.a)r ∧ ¬q
b)p ∧ q ∧ r
c)r → p
d)p ∧ ¬q ∧ r
e)(q ∧ p) → r
17.a)r ∧ ¬p
b)¬p ∧ q ∧ r
d)¬q ∧ ¬p ∧ r

2 1.2
9. If someone were to ask you whether the left road leads to the ruins, would your response
be yes?
6.
u="You can upgrade your operating system"
b32="You have a 32-bit processor"
b64="You have a 64-bit processor"
g1="Your processor runs at 1 GHz or faster"
g2="Your processor runs at 2 GHz or faster"
r1="Your processor has at least 1 GB RAM"
r2="Your processor has at least 2 GB RAM"
h16="You have at least 16 GB free hard disk space"
h32="You have at least 16 GB free hard disk space"

CẤU TRÚC RỜI RẠC (CO1007)) Trang 2/10


Trường Đại học Bách Khoa - Đại học Quốc gia TP.HCM
Khoa Khoa học và Kỹ thuật Máy tính

anwser: u → ((b32 ∧ g1 ∧ r1 ∧ h16) ∨ (b64 ∧ g2 ∧ r2 ∧ h32))


7.a)q → p
b)q ∧ ¬p
c)q → p
d)¬q → ¬p

38.
Let K, be the statement "Kevin is chatting"
Let H, be the statement "Heather is chatting"
Let R, be the statement "Randy is chatting"
Let V, be the statement "Vijay is chatting"
Let A, be the statement "Abby is chatting"
let s1,be the statement "Either Kevin or Heather, or both, are chatting.
let s2,be the statement "Either Randy or Vijay, but not both, are chatting.
let s3, be the statement "If Abby is chatting, so is Randy
let s4, be the statement "Vijay and Kevin are either both chatting or neither is
let s5, be the statement "If Heather is chatting, then so are Abby and Kevin

3 1.3
1. 43
Đối ngẫu của hai mệnh đề ghép tương đương vẫn tương đương do cách thức hoạt động của
phủ định logic (¬) và các tính chất của sự tương đương logic. Hãy phân tích lý do tại sao
lại như vậy:
Sự tương đương logic: Hai mệnh đề phức hợp được cho là tương đương về mặt logic khi
chúng có cùng các giá trị chân lý cho tất cả các kết hợp có thể có của các giá trị chân lý
của các mệnh đề thành phần của chúng. Nói cách khác, chúng có cùng bảng chân lý.
Mệnh đề kép: Mệnh đề kép của một mệnh đề ghép được hình thành bằng cách thay thế tất
cả các lần xuất hiện của ∧ (logic AND) bằng ∨ (logic OR) và ngược lại, đồng thời bằng
cách phủ định tất cả các mệnh đề nguyên tử trong mệnh đề ban đầu.
Bây giờ, hãy xem xét tại sao các đối ngẫu của các mệnh đề ghép tương đương vẫn tương
đương:
Giả sử chúng ta có hai mệnh đề ghép tương đương A và B, có nghĩa là A và B có cùng
bảng chân lý.
Khi chúng ta lấy đối ngẫu của A và đối ngẫu của B, về cơ bản chúng ta đang áp dụng các
phép toán phủ định (¬), hoán đổi ∧ với ∨ và ngược lại, cho các mệnh đề thành phần của
A và B. Vì A và B có cùng bảng chân lý, việc áp dụng các phép toán này một cách nhất
quán cho cả A và B cũng sẽ dẫn đến hai mệnh đề tương đương về mặt logic.
Nói cách khác, phép toán kép bảo toàn tính tương đương logic vì nó áp dụng các phép
biến đổi giống nhau cho cả hai mệnh đề. Mấu chốt ở đây là sự phủ định và hoán đổi ∧ với
∨ không làm thay đổi mối quan hệ logic tổng thể giữa các mệnh đề thành phần trong các
mệnh đề ghép; họ chỉ thay đổi cách thể hiện những mối quan hệ đó.
Thuộc tính này là một khía cạnh cơ bản của Định luật De Morgan, mô tả mối quan hệ
giữa các phép toán logic ∧ và ∨ cùng với phép phủ định. Định luật De Morgan giúp chính

CẤU TRÚC RỜI RẠC (CO1007)) Trang 3/10


Trường Đại học Bách Khoa - Đại học Quốc gia TP.HCM
Khoa Khoa học và Kỹ thuật Máy tính

thức hóa lý do tại sao các đối ngẫu của các mệnh đề tương đương về mặt logic vẫn tương
đương khi chúng chỉ chứa các toán tử ∧, ∨, ¬.

2. 47
¬, ∧, ∨
p → q ≡ ¬p ∨ q
p q ¬p p→q ¬p ∨ q
T T F T T
T F F F F
F T T T T
F F T T T
p ↔ q ≡ (p → q) ∧ (q → p) ≡ (¬p ∨ q) ∧ (¬q ∨ p)
XOR: (¬((¬(A ∧ (¬(A ∧ B)))) ∧ (¬(B ∧ (¬(A ∧ B))))))
NAND: ¬∧
NOR: ¬∨
3. 49
¬, ∨
p → q ≡ ¬p ∨ q
p q ¬p p→q ¬p ∨ q
T T F T T
T F F F F
F T T T T
F F T T T
p ↔ q ≡ (p → q)∧(q → p) ≡ (¬p∨q)∧(¬q∨p) ≡ ((¬p∨q)∨¬(¬p∨q))∨¬((¬q∨p)∨¬(¬q∨p))
XOR: (A¬ ∨ (A¬ ∨ B)) ∨ ((A¬ ∨ B)¬ ∨ B)
NAND: ¬(¬A¬ ∨ ¬B)
NOR: ¬∨

4. 54
a) p ↓ p
p p↓p ¬p
T F F
F T T
Vậy p ↓ p = ¬p
b) (p ↓ q) ↓ (p ↓ q)
p q (p ↓ q) ↓ (p ↓ q) p∨q
T T T T
T F T TF
T T TF F
F T

CẤU TRÚC RỜI RẠC (CO1007)) Trang 4/10


Trường Đại học Bách Khoa - Đại học Quốc gia TP.HCM
Khoa Khoa học và Kỹ thuật Máy tính

5. 59
Số lượng các bảng chân lý khác nhau cho các mệnh đề ghép liên quan đến các biến mệnh
đề p và q phụ thuộc vào số lượng các kết hợp duy nhất của các giá trị chân lý cho p và q.
Mỗi biến có thể có hai giá trị thật là true (T) hoặc false (F). Do đó, đối với hai biến p và
q, có tổng cộng 2(∧)2 = 4 tổ hợp giá trị đúng có thể có:
p q
T T
T F
F T
F F
Đối với mỗi kết hợp này, có thể tạo một bảng chân lý khác nhau bằng cách chỉ định giá
trị chân lý của các mệnh đề phức hợp khác nhau liên quan đến p và q. Vì vậy, có 4 bảng
chân lý khác nhau cho các mệnh đề ghép có các biến mệnh đề p và q.

6. 61
7. 72

4 1.4
1. 9
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. 10
a) ∃!x(C(x) ∧ D(x) ∧ F (x))
b) ∀x(C(x) ∧ D(x) ∨ F (x))
c) ∃x(C(x) ∧ F (x) ∧ ¬D(x))
d) ∄(C(x) ∧ D(x) ∧ F (x))
e) ∀x∃(C(x) ∨ D(x) ∨ F (x))
3. 33
a) ∃xC(x) (x là old dogs, C(x) là learn new trick)
Neg form: ∀x¬C(x)
All old dogs can not learn new trick
b) ¬∃xC(x) (x là rabbit, C(x) là calculus)
Neg form: ∃x¬C(x)
There is a rabbit know calculus
c) ∀xF (x) (x là bird, F(x) là fly)
Neg form: ∃x¬F (x)
There is a bird can not fly

CẤU TRÚC RỜI RẠC (CO1007)) Trang 5/10


Trường Đại học Bách Khoa - Đại học Quốc gia TP.HCM
Khoa Khoa học và Kỹ thuật Máy tính

d) ¬∃xT (x) (x là dogs, T(x) là talk)


Neg form: ∃xT (x)
There is a dog that can talk.
e) ¬∃x(F (x) ∧ R(x)) (x là people, F(x) là speak french, R(x) là speak russian)
Neg form: ∃x(F (x) ∧ R(x))
Someone in this class that know French and Russian.
4. 34
a) ∃x(¬O(x))
Neg form: ∀xO(x)
All the drivers obey the speed limit
b) ∀xS(x)
Neg form: ∃x¬S(x)
Some Swedish movies are not serious
c) ¬∃xK(x)
Neg form: ∃xK(x)
Someone can keep a secret
d) ∃x¬A(x)
Neg form: ∀xA(x) All student in this class have good attitude
5. 39
a) ∀x : P (x) ↔ (F (x) ∨ T (x))
b) For men:
∀x : M (x) → (Q(x) ↔ T (x) < 3)
For women:
∀x : W (x) → (Q(x) ↔ T (x).5)
c) ∀x : S(x) → (C(x) ∨ (C(x) ≥ 45 ∧ T (x) ∧ G(x)))
d) ∃x : S(x) ∧ H(x) ∧ A(x)
6. 44
a)Let U(x) be the predicate "x is a user," and M(x) be the predicate "x has access to an
electronic mailbox." The statement can be expressed as:
∀x : U (x) → M (x)
b) Let G be the predicate "everyone in the group," F be the predicate "the file system is
locked," and M be the predicate "the system mailbox can be accessed by someone." The
statement can be expressed as:
G → (F → M )
c) Let D be the predicate "the firewall is in a diagnostic state," and P be the predicate
"the proxy server is in a diagnostic state." The statement can be expressed as:
D→P

CẤU TRÚC RỜI RẠC (CO1007)) Trang 6/10


Trường Đại học Bách Khoa - Đại học Quốc gia TP.HCM
Khoa Khoa học và Kỹ thuật Máy tính

d) Let R(x) be the predicate "x is a router," T be the predicate "the throughput is between
100 kbps and 500 kbps," and D be the predicate "the proxy server is not in diagnostic
mode." The statement can be expressed as:
∃x : R(x) ∧ (T ∧ ¬D)
7. 45
8. 46
9. 47

10. 63
a)Babies are illogical.
∀x : (P (x) → ¬Q(x))
This statement asserts that for all people x, if x is a baby, then x is not logical.
b)Nobody is despised who can manage a crocodile.
∀x : (R(x) → ¬S(x)) → R(x) → R(x) → S(x)
This statement asserts that for all people x, if x can manage a crocodile (R(x) → S(x)),
then x is not despised (¬S(x)), and reverse.
c) Illogical persons are despised.
∀x : (P (x) ∧ ¬Q(x)) → S(x)
This statement asserts that for all people x, if x is both a baby and not logical (P(x) ∧¬
Q(x)), then x is despised (S(x)).
d) Babies cannot manage crocodiles.
∀x : P (x) → ¬R(x)
This statement asserts that for all people x, if x is a baby (P(x)), then x cannot manage a
crocodile (¬R(x)).
e) Does (d) follow from (a), (b), and (c)? If not, is there a correct conclusion?
No, (d) does not necessarily follow from (a), (b), and (c). While (d) states that babies
cannot manage crocodiles, it is not explicitly implied by (a), (b), or (c).
However, based on the provided statements (a), (b), and (c), we can conclude the following:
∀x : P (x) → ¬Q(x)) → (R(x) → ¬S(x))
This statement asserts that if babies are illogical (a), nobody is despised who can manage a
crocodile (b), and illogical persons are despised (c), then babies cannot manage crocodiles
(d).

11. 64
a) No ducks are willing to waltz.
¬∃x : P (x) ∧ S(x)
This statement asserts that there does not exist an x such that x is a duck (P(x)) and x is
willing to waltz (S(x)).
b) No officers ever decline to waltz.
¬∃x : R(x) ∧ ¬S(x)

CẤU TRÚC RỜI RẠC (CO1007)) Trang 7/10


Trường Đại học Bách Khoa - Đại học Quốc gia TP.HCM
Khoa Khoa học và Kỹ thuật Máy tính

This statement asserts that there does not exist an x such that x is an officer (R(x)) and
x does not decline to waltz (¬S(x)).
c) All my poultry are ducks.
∀x : Q(x) → P (x)
This statement asserts that for all x, if x is one of your poultry (Q(x)), then x is a duck
(P(x)).
d) My poultry are not officers.
∀x : Q(x) → ¬R(x)
This statement asserts that for all x, if x is one of your poultry (Q(x)), then x is not an
officer (¬R(x)).
e) Does (d) follow from (a), (b), and (c)? If not, is there a correct conclusion?
No, (d) does not necessarily follow from (a), (b), and (c). The statements (a), (b), and (c)
provide information about ducks, officers, and poultry but do not directly imply that your
poultry are not officers.
A correct conclusion based on (a), (b), and (c) would be:
¬∃x : Q(x) ∧ R(x)
This statement asserts that there does not exist an x such that x is one of your poultry
(Q(x)) and x is an officer (R(x)), which implies that your poultry are not officers.

5 1.5
1. 17
a) Every user has access to exactly one mailbox.
∀x∃y(A(x, y) ∧ ∀z(A(x, z) → y = z))
This statement asserts that for every user x, there exists a mailbox y (A(x, y)) such that
no other mailbox z can be accessed by x (if z is accessed by x, then z must be the same as
y).
b) There is a process that continues to run during all error conditions only if the kernel is
working correctly.
∃x : P (x) ∧ ∀y(EC(y) → (KW C() → CT R(x, y)))
This statement asserts that there exists a process x (P(x)) such that for all error conditions
y (EC(y)), if the kernel works correctly (KWC()), then x continues to run during y (CTR(x,
y)).
c) All users on the campus network can access all websites whose URL has a .edu extension.
∀x(U OCN (x) → ∀y(W (y) ∧ U RLExt(y, ”.edu”) → A(x, y)))
This statement asserts that for all users x on the campus network (UOCN(x)), if there
exists a website y with a .edu extension (W(y) ∧ URLExt(y, ".edu")), then x can access y
(A(x, y)).
d) There are exactly two systems that monitor every remote server.
∃x∃y∀z : (RemoteServer(z) → (M onitors(x, z) ∧ M onitors(y, z) ∧ x ̸= y) ∧ ¬∃w :
(RemoteServer(w) ∧ (M onitors(x, w) ∨ M onitors(y, w)) ∧ x ̸= y))

CẤU TRÚC RỜI RẠC (CO1007)) Trang 8/10


Trường Đại học Bách Khoa - Đại học Quốc gia TP.HCM
Khoa Khoa học và Kỹ thuật Máy tính

This statement asserts that there exist two systems x and y (x ̸= y) such that for every
remote server z (RemoteServer(z)), both x and y monitor z (Monitors(x, z) ∧ Monitors(y,
z)), and there are no other systems w (¬∃w) that monitor the same remote server as x or
y (Monitors(x, w) ∨ Monitors(y, w)) with x ̸= y. This ensures that exactly two systems
monitor every remote server.
2. 18
a) ∀x(F aultCondition(x) → ∃y(Console(y) ∧ Accessible(y, x)))
b) ∀x(U ser(x) → (∀y(U ser(y) → ∃z(M essageSentBy(z, y)∧InArchive(z))) → CanRetrieveEmail(x)))
c) ∀x(SecurityBreach(x) → (∃y(M echanism(y) ∧ CanDetect(y, x)) ↔ ∃z(P rocess(z) ∧
N otCompromised(z))))
d) ∀x∀y(Endpoint(x) ∧ Endpoint(y) ∧ x ̸= y → ∃p∃q(P ath(p) ∧ P ath(q) ∧ p ̸= q ∧
Connects(p, x, y) ∧ Connects(q, x, y)))
e) ∀x(U ser(x) ∧ x ̸= SystemAdministrator → ¬∀y(U ser(y) → KnowsP assword(x, y)))

3. 34
∀x∀y((x ̸= y) → ∀z((z = x) ∨ (z = y)))
To make it true:
We can choose a domain consisting of only two elements, say 0, 1. For all x and y in this
domain, if x ̸= y, then all elements (0 and 1) in the domain are either equal to x or equal
to y.
To make it false:
We can choose a domain consisting of three or more distinct elements, say A, B, C. In this
case, there will exist x and y in the domain (ex: x = A and y = B) such that x y, but there
will be elements in the domain (ex: C) that are neither equal to x nor equal to y, making
the statement false.
4. 35
5. 36
a) ∀x¬(LostM oreT hanOneT housand(x) ∧ P layedLottery(x))
Neg: ∃x(LostM oreT hanOneT housand(x) ∧ P layedLottery(x))
Someone has lost more than one thousand dollars playing the lottery.
b) ∃x∃y(Student(x) ∧ Student(y) ∧ (x ̸= y) ∧ (ChatW ith(x, y)))
Neg: ∀x∀y(Student(x) ∧ Student(y) ∧ (x ̸= y) ∧ (ChatW ith(x, y)))
All student in this class who has chatted with every student.
c) ∀x¬(Sentemailto2otherstudent(x))
Neg: ∃x(Sentemailto2otherstudent(x))
There is a student in this class has sent e-mail to exactly two other students in this class.
d) ∃x∀y(student(x) → (solve(x, y)))
Neg: ∀x∃y(student(x) → (solve(x, y)))
All student has solved exactly one exercise in this book.
e) ∀x∃y∀z¬(student(x) ∧ oneexer(x, y) ∧ solveatsect(x, y, z))

CẤU TRÚC RỜI RẠC (CO1007)) Trang 9/10


Trường Đại học Bách Khoa - Đại học Quốc gia TP.HCM
Khoa Khoa học và Kỹ thuật Máy tính

Neg: ∃x∀y∃z¬(student(x) ∧ oneexer(x, y) ∧ solveatsect(x, y, z))


Some students has solved all exercise in at least one section of this book.

6. 37
a) Every student in this class has taken exactly two mathematics classes at this school.
b) Someone has visited every country in the world except Libya.
c) No one has climbed every mountain in the Himalayas.
d) Every movie actor has either been in a movie with Kevin Bacon or has been in a movie
with someone who has been in a movie with Kevin Bacon.
a) ∀x(Student(x) → (∃y(M athClass(y)∧T akenBy(x, y))∧∀z(M athClass(z) → T akenBy(x, z) →
(y ̸= z))))
Neg:
b) ∃x∀y(Country(y) ∧ ¬(y = Libya) → V isited(x, y))
c) ¬∃x∀y(mountain(y) → climb(x, y))
d) ∀x(movieactor(x) → (∃y(KB(x)) ∧ with(x, y)) ∨ (movieactor(x) → (∃z(KB(z)) ∧
with(x, z)))
7. 47 We will start from the first given statement: ¬∃x∀yP (x, y)
≡ ∀x∃y¬P (x, y)(DeM organ′ sLawf orQualif iers)

8. 48 ∀xP (x) ∨ ∀xQ(x)


It doesn’t matter if the variables are called x or are called y, thus let us recall the variable in the
second expression of the disjunction:
≡ ∀xP (x) ∨ ∀yQ(y)
≡ ∀x(P (x) ∨ (∀yQ(y))) ≡ ∀x((∀yQ(y)) ∨ P (x))(commutativelaw)
≡ ∀x∀y(P (x) ∨ Q(y)(commutativelaw)

CẤU TRÚC RỜI RẠC (CO1007)) Trang 10/10

You might also like