You are on page 1of 10

Name: NIM: Class:

Assignment 2: Predicate Logic


Mathematical Logic - A (MSH1B3)
First Term 2018-2019
Instructions:

1. This assignment is due Wednesday October 10, 2018 at 5:00 p.m.. Please submit your work at School
of Computing academic roster (roster akademik Fakultas Informatika), room A203A (building A room
A203A). Do not forget to write your identity on the space provided. You may submit this assignment as
of Monday October 8, 2018 at 8:00 a.m..

2. In order to prevent any academic misconduct, you also need to submit a readable scan or photograph of
this assignment to the provided submission slot in IDEA. Please contact your class instructor for more
detailed information. The due date of this online submission is the same as the hardcopy. Please make
sure that your file size do not exceed the maximum file size allowed.

3. To save paper, you may print and reproduce this assignment on both sides of a paper.

4. Your answers should be handwritten. You may use: HB or 2B pencil, or pen with blue or black ink.

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

6. Write your solutions on the space provided. If you need more space, you may use additional A4 papers
and attach them to your assignment.

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

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

9. Please retain yourself from copying answers from elsewhere without understanding the steps. This
assignment is an individual evaluation.

10. Important: late submission without reasonable explanation will not be graded.

page 1 of 10
Problem 1 (10 points) Let Q (x) := x + 1 < 2x. If the domain consists of all integers, what are the truth
value of these formulas? Explain your reasoning.

(a). [1 point] Q (1)


A NSWER :

(b). [1 point] Q (2)


A NSWER :

(c). [2 point] 9x Q (x)


A NSWER :

(d). [2 point] 8x Q (x)


A NSWER :

(e). [2 points] 9x :Q (x)


A NSWER :

(f). [2 points] 8x :Q (x)


A NSWER :

Problem 2 (10 points) Suppose Q (x; y) is the predicate x + 2y 2x y. Determine the truth of the
following predicate formulas.

(a). [2.5 points] Q (3; 1)


A NSWER :

(b). [2.5 points] Q (1; 3)


A NSWER :

(c). [2.5 points] 9x9y Q (x; y)


A NSWER :

(d). [2.5 points] 8x8y Q (x; y)


A NSWER :

page 2 of 10
Name: NIM: Class:

Problem 3 (10 points) Suppose that the domain of the predicate P (x) consists of 1, 2, 3, 4, and 5. Write
out each of the following predicate logic formulas in propositional logic formulas using disjunctions, con-
junctions, negations, or their combinations.

(a). [1 point] 9x P (x)


A NSWER :

(b). [1 point] 8x P (x)


A NSWER :

(c). [2 points] 9x :P (x)


A NSWER :

(d). [2 points] 8x :P (x)


A NSWER :

(e). [2 points] :9x P (x)


A NSWER :

(f). [2 points] :8x P (x)


A NSWER :

page 3 of 10
Problem 4 (10 points) Let C (x), P (x), A (x), and D (x) be the statements “x is a cat”, “x is one of my
pet”, “x is an artist”, and “x is willing to dance”, respectively. Express each of these statements using
quantifiers, logical connectives, and also using the previously mentioned predicates.

(a). [2.5 points] No cats are willing to dance.


A NSWER :

(b). [2.5 points] No artist ever decline to dance.


A NSWER :

(c). [2.5 points] All my pets are cats.


A NSWER :

(d). [2.5 points] My cats are not artists.


A NSWER :

page 4 of 10
Name: NIM: Class:

Problem 5 (10 points) Translate each of these statements into logical expression using only the specified
domain and predicates.

(a). [2 points] “Someone in your school has visited Russia”.


The domain is D := fx j x is a human beingg and the predicates are P (x) := “x is a person in your
school” and R (x) := “x has visited Russia”.
A NSWER :

(b). [2 points] “Everyone in your class has studied mathematical logic and programming”.
The domain is D := fx j x is a human beingg 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”.
A NSWER :

(c). [2 points] No one in your school owns both a bicycle and a motorcycle.
The domain is D := fx j x is a human beingg and the predicates are S (x) := “x is a person in your
school”, B (x) := “x owns a bicycle”, and M (x) := “x owns a motorcycle”.
A NSWER :

(d). [2 points] There is a person in your school who is not happy.


The domain is D := fx j x is a human beingg and the predicates are S (x) := “x is a person in your
school” and H (x) := “x is happy”.
A NSWER :

(e). [2 points] Everyone in your school was born in the twentieth century.
The domain is D := fx j x is a human beingg and the predicate are S (x) := “x is a person in your
school” and T (x) := “x was born in the twentieth century”.
A NSWER :

page 5 of 10
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.
A NSWER :

(b). [5 points] “Each of five roommates, Melissa, Aaron, Ralph, Veneesha, and Keeshawn, has taken a
course in discrete mathematics. Every student who has taken a course in discrete mathematics can
take a course in algorithms. Therefore, all five roommates can take a course in algorithms next year.”
Use the following predicates: R (x) := x is one of the five roommates, M (x) := x has taken a
course in discrete mathematics, A (x) := x can take a course in algorithms. Suppose the domain for
x is the set of all students.
A NSWER :

page 6 of 10
Name: NIM: Class:

(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.
A NSWER :

(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.
A NSWER :

page 7 of 10
Problem 7 (20 points) For each of these arguments determine whether the argument is correct or incorrect
and explain why.

(a). [5 points] “Everyone enrolled in the university has lived in a dormitory. Mia has never lived in a
dormitory. Therefore, Mia is not enrolled in the university.” Use the following predicates: U (x) := x
enrolled in the university, D (x) := x has lived in a dormitory. Suppose the domain of x is the set of
all persons.
A NSWER :

(b). [5 points] “A convertible car is fun to drive. Isaac’s car is not a convertible. Therefore, Isaac’s car is
not fun to drive.” Use the following predicates: C (x) := x is a convertible car, F (x) := x is fun to
drive. Suppose the domain of x is the set of all cars.
A NSWER :

page 8 of 10
Name: NIM: Class:

(c). [5 points] “Quincy likes all horror movies. Quincy likes the movie ‘Inferno’. Therefore, ‘Inferno’
is an horror movie.” Use the following predicates: Q (x) := Quincy likes x, H (x) := x is a horror
movie. Suppose the domain of x is the set of all movies.
A NSWER :

(d). [5 points] “All lobstermen set at least a dozen traps. Hamilton is a lobsterman. Therefore, Hamilton
sets at least a dozen traps.” Use the following predicates: L (x) := x is a lobsterman, T := x set a
dozen traps. Suppose the domain of x is the set of all persons.
A NSWER :

page 9 of 10
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:

herbivore(X):- eats(X,Y), plant(Y).

carnivore(X):- eats(X,Y), animal(Y).

omnivore(X):- herbivore(X), carnivore(X).

prey(X):- eats(Y,X), animal(X), animal(Y).

Determine the output of the following queries if the program is run using SWI-Prolog:

(a). [1 point] eats(hawk,X). (e). [2 points] omnivore(X).

(b). [1 point] eats(X,caterpillar).


(f). [2 points] prey(hawk).
(c). [1 point] herbivore(frog).

(d). [1 point] carnivore(crow). (g). [2 points] prey(X), not(carnivore(X)).

A NSWER :

page 10 of 10

You might also like