Assignment CLO 2: Predicate Logic: Mathematical Logic (CII1B3)
Assignment CLO 2: Predicate Logic: Mathematical Logic (CII1B3)
Assignment CLO 2: Predicate Logic: Mathematical Logic (CII1B3)
1. This assignment is due Wednesday, November 10, 2021 at 5:00 p.m.. Please submit your work to the
correspondingsubmissionslotin LMS CeLOE. You need to submit a readable .pdf file of this assignment
to the provided submission slot in CeLOE. You can contact your class instructor for more detailed
information. Please make sure that your file size do not exceed the maximum file size allowed.
2. Please upload your assignment to the LMS CeLOE under the file name: A2-<student ID>.pdf, for
example: A2-1301218888.pdf.
a. You print this assignment and write your answer using HB/2B pencil or pen with blue/black ink
(handwrittenanswer). YoumayaddadditionalA4-sizedpapers. Afterwardsyousubmitthescan/photograph of
this assignment.
b. You use a .pdf editing tools and write your answer directly using blue/black colored writing.
c. You copy the problem from this assignment to a text/word processing program and type your answer
neatly.
d. You rewrite the problem from this assignment in an A4-sized paper and submit the scan/photograph
of your work.
4. All problems in this assignment are adapted from the textbooks. The problems are written in English.
If you are a student in a regular class, you may answer the problems in Bahasa Indonesia. However,
if you are a student in international class, your answers must be written in English—otherwise your
assignment will not be graded. You may ask your class instructor or teaching assistant for helping you
understanding the problem, but you should not ask them to give the solution of any problem.
5. Be neat and write legibly. You will be graded not only on the correctness of your answers, but also on
the clarity with which you express them.
6. This assignment consists of 8 problems, each but Problems 6 and 7 are worth 10 points. Problems 6 and
7 are worth 20 points each.
7. Please retain yourself from copying answers from elsewhere without understanding the steps. Such an
attitude will not enhance your knowledge. This assignment is an individual evaluation.
page 1 of 9
Problem 1 (10 points) Let P (x) be the statement “x2 − 3 ≤ 3x” and suppose the domain for x is the
set of all integers. Complete the following table concerning the truth value of these formulas. Provide a
relevant reason for each answer.
Truth Value
Part Formula (circle either T or F) Reason [1 point]
[0.25 points]
a. P (0) T /F P(0)≡ 0-3≤ 0 ≡ −3 ≤ 0 (T)
page 2 of 9
Raihan Abdurrahman 1301210340 IF – 45 – 01
Name: NIM: Class:
def
Problem 2 (10 points) Let Q (x) ≡ x2 + 3 > 4x . If the domain consists of all integers, what are the truth
value of these formulas? Explain your reasoning.
Problem 3 (10 points) Suppose R (x,y) is the predicate x + 2y > 2x− y. Determine the truth of the
following predicate formulas.
page 3 of 9
Problem 4 (10 points) Suppose we have the following statements
G (x) : x is participated in the game,
S (x) : x (can) stop playing,
E (x) : x will be eliminated, and
C (x) : x cheats in the game.
Suppose the domain of x is all players. Express each of these statements using quantifiers, logical
connectives, and the previously defined predicates:
(a). [2.5 points] No one participated in the game can stop playing.
ANSWER: ¬∃x ( G( x ) Λ S( x ))
(b). [2.5 points] Everyone who cheats in the game will be eliminated.
ANSWER: ∀𝑥 ( 𝐶(𝑥) → 𝐸(𝑥))
(c). [2.5 points] Someone who is participated in the game does not cheat.
ANSWER: ∃x ( G( x ) Λ ¬C( x ))
(d). [2.5 points] All players who stop playing will be eliminated.
page 6 of 9
Name: Raihan Abdurrahman NIM: 1301210340 Class: IF – 45 – 01
Problem 5 (10 points) Translate each of these statements into logical expression using only the specified
domain and predicates.
The domain is D := {x | x is a human being} and the predicates are S (x) := “x is a person in your
school” and J (x) := “x has visited Jakarta”.
ANSWER: ∃𝑥 ( S (x) ⋀ ¬J (x))
(b). [2 points] “Everyone in your class has studied mathematical logic and programming”.
The domain is D := {x | x is a human being} and the predicates are C (x) := “x is in your class”,
M (x) := “x has studied mathematical logic”, and P (x) := “x has studied programming”.
ANSWER: ∀𝑥 ( C (x) → M (x) ∧ P (x) )
The domain is D := {x | x is a human being} and the predicates are S (x) := “x is a person in your
school”, F (x) := “x speaks French”, and M (x) := “x speaks German”.
ANSWER: ¬∃𝑥 ( S(x) ∧ ( F (x) ∧ M (x)))
The domain is D := {x | x is a human being} and the predicates are S (x) := “x is a person in your
school” and H (x) := “x is happy”.
ANSWER: ∃𝑥 ( S (x) ∧ ¬ H (x))
The domain is D := {x | x is a human being} and the predicate are S (x) := “x is a person in your
school”, I (x) := “x was born in Indonesia”, and M (x) := “x was born in Malaysia”.
ANSWER: ∀𝑥 (S(x) → I (x) ∨ M (x))
page 5 of 9
Problem 6 (20 points) Verify whether each of these arguments is valid or not. Explain which rules of
inference are used for each step.
(a). [5 points] “Linda, a student in this class, owns a red car. Everyone who owns a red car has gotten at
least one speeding ticket. Therefore, someone in this class has gotten a speeding ticket.” Use the
following predicates: C (x) := x is a student in this class, R (x) := x owns red car, T (x) := x has
gotten a speeding ticket. Suppose the domain for x is the set of all persons.
ANSWER:
(1) C (Linda) ∧ R (Linda) (premis)
(2) ∀x (R (x) → T (x)) (premis)
(3) R (Linda) → T (Linda) (universal instantiation dari (2))
(4) R (Linda) (simplifikasi dari (1))
(5) T (Linda) (modus ponens dari (3) dan (4))
(6) C (Linda) (simplikasi dari (1))
(7) C (Linda) ∧ T (Linda) (konjungsi (5) dan (6))
(8) ∃x (C (x) ∧ T (x)) (existential generalization dari (7))
Kesimpulan ∃x (C (x) ∧ T (x)), atau “seseorang di kelas punya tiket tilang” terbukti kesimpulan
yang benar.
(b). [5 points] “All good players are expensive. Jack Grealish is not a good player. Therefore, Jack
Grealish is not expensive”. Use the following predicates: G (x) := x is a a good player and E (x) :=
x is expensive. Suppose the domain of x is the set of all players.
ANSWER:
(1) ∀x (G(x) → E(x)) (premis)
(2) ¬G(Jack Grealish) (premis)
(3) G(Jack Grealish)→ E(Jack Grealish) (instaniasi universal dari 1)
Kesimpulan ¬𝐸 tidak dapat dtitentukan, maka merupakan kesimpulan yang salah
page 6 of 9
Name: Raihan Abdurrahman NIM: 1301210340 Class: IF – 45 – 01
(c). [5 points] “All movies produced by Steven Spielberg are exciting. Steven Spielberg produced a
movie about dinosaurs. Therefore, there is an exciting movie about dinosaurs.” Use the following
predicates: S (x) := x is a movie produced by Steven Spielberg, E (x) := x is an exciting movie, D
(x) := x is a movie about dinosaurs. Suppose the domain of x be the set of all movies.
ANSWER:
(1) ∀x (S (x) → E (x)) (premis)
(2) ∃x (S (x) ∧ D (x)) (premis)
(3) S (c) ∧ D (c) (instansiasi eksistansial dari (2) untuk suatu c)
(4) S (c) → E (c) (instansiasi universal dari (1) untuk c di (3))
(5) S (c) (simplifikasi dari (3))
(6) E (c) (modus ponens dari (4) dan (5))
(7) D (c) (simplifikasi dari (3))
(8) E (c) ∧ D (c) (konjungsi (6) dan (7))
(9) ∀x (E (x) ∧ D (x)) (generalisasi eksistensi dari (8))
Kesimpulan “ ada film menarik tentang dinosaurus” atau ∀x (E (x) ∧ D (x)) terbukti
benar
(d). [5 points] “There is someone in this class who has been to France. Everyone who goes to France visit
the Louvre. Therefore, someone in this class has visited the Louvre.” Use the following predicates:
C (x) := x is in this class, F (x) := x has been to France, L (x) := x has visited Louvre. Suppose the
domain of x be the set of all persons.
ANSWER:
(1) ∃x (C (x) ∧ F (x)) (premis)
(2) ∀x (F (x) → L(x)) (premis)
(3) C (c) ∧ F (c) (instansiasi eksitenasi (1) untuk sebuah c)
(4) F (c) → L(c) (un from (2) for c in (3))
(5) F (c) (simplification from (3))
(6) L(c) (modus ponens from (4) and (5))
(7) C (c) (simplification from (3))
(8) C (c) ∧ L(c) (conjunction from (6) and (7))
(9) ∃x (C (x) ∧ L(x)) (existential generalization from (8))
Kesimpulan “ada seseorang yang pernah ke Louvre” atau ∃x (C (x) ∧ L(x)) terbukti
benar
page 7 of 9
Problem 7 (20 points) Mowgli lives in an Indian rainforest and recently he learned following facts:
• ∀x (T(x) → C (x))
• T(Sherkan) ∧ P (Sherkan)
• ∀x (P (x) → L (x))
(b). [10 points] Mowgli thinks only one of the following conclusion is correct:
What is the correct conclusion? Explain your reasoning using rule of inference in predicate logic.
ANSWER:
Kesimpulan yang benar adalah ada hewan karnivora yang memiliki usia yang panjang
page 8 of 9
Name: Raihan Abdurrahman NIM: 1301210340 Class: IF – 45 – 01
Problem 8 (10 points) Suppose we have the following Prolog knowledge base.
plant(herbs). eats(deer,shrub).
plant(grass). eats(grasshopper,grass).
plant(shrub). eats(rabbit,herbs).
animal(caterpillar).
eats(crow,caterpillar).
animal(deer).
eats(crow,herbs).
animal(grasshopper).
eats(crow,grasshopper).
animal(rabbit).
eats(fox,rabbit).
animal(crow).
eats(frog,caterpillar).
animal(fox).
eats(frog,grasshopper).
animal(frog).
eats(snake,frog).
animal(snake).
eats(snake,rabbit).
animal(hawk).
animal(lion).
eats(hawk,crow).
eats(caterpillar,grass). eats(hawk,snake).
eats(caterpillar,herbs). eats(lion,deer).
eats(deer,herbs). eats(lion,fox).
Suppose the above knowledge base is supplemented with the following rules:
Determine the output of the following queries if the program is run using SWI-Prolog:
ANSWER:
(a). eats(hawk,X).
X = crow ;
X = snake.
(b). eats(X,caterpillar).
X = crow;
X = frog.
(c). herbivore(frog).
false.
page 9 of 9
(d). carnivore(crow).
true.
(e). omnivore(X).
X = crow.
(f). prey(hawk).
false.