0% found this document useful (0 votes)
2 views

com364

The document is an exam paper for a course on Automata, Logic, and Computation, containing three main questions with subparts that cover topics such as natural deduction proofs, predicate logic translations, and Prolog queries. It includes specific tasks such as determining the truth of formulae in a given model, providing natural deduction proofs, and defining predicates in Prolog. Additionally, it outlines the natural deduction rules and steps for converting to clausal form.

Uploaded by

patelmitul2002
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)
2 views

com364

The document is an exam paper for a course on Automata, Logic, and Computation, containing three main questions with subparts that cover topics such as natural deduction proofs, predicate logic translations, and Prolog queries. It includes specific tasks such as determining the truth of formulae in a given model, providing natural deduction proofs, and defining predicates in Prolog. Additionally, it outlines the natural deduction rules and steps for converting to clausal form.

Uploaded by

patelmitul2002
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/ 5

COM364

Data Provided:
Natural Deduction Rules (page 5)
Clausal Form Conversion Steps (page 5)

DEPARTMENT OF COMPUTER SCIENCE Spring Semester 2013-2014

AUTOMATA, LOGIC AND COMPUTATION 2 hours

Answer TWO questions.


All questions carry equal weight. Figures in square brackets indicate the per-
centage of available marks allocated to each part of a question.

COM364 1 TURN OVER


COM364

1. a) Is the following formula an example of a tautology or a contradiction? Justify your


answer using a truth table.
(P → Q) ↔ (¬P ∨ Q) [5%]

b) Consider the following model M = hD, F i such that

D = {Adam, Jane, Harry, Emily}

with the semantic value of individual constants:


F (a) = Adam F (j) = Jane
F (h) = Harry F (e) = Emily

and the semantic value of predicates:

F (M ) = {Adam, Harry}
F (W ) = {Jane, Emily}
F (P ) = {Adam, Jane}
F (C) = {hHarry, Adami, h Harry, Janei, hEmily, Adami, h Emily, Janei}

Determine whether the following formulae are true or false in this model. Justify your
answer.

(i) M (a) ∧ P (a) [5%]


(ii) ∃x.(M (x) ∧ W (x)) [10%]
(iii) ∃x.(C(x, a) ∧ C(x, j)) [10%]
(iv) ∀x.(P (x) → (M (x) ∨ W (x))) [10%]

c) Provide natural deduction proofs for the following derivabilities. [N.B. A listing of the
natural deduction proof rules is given at the end of the exam paper.]

(i) p ∧ q, q → r ` s ∨ r [15%]
(ii) p → (q ∧ r), (q ∨ r) → s ` p → s [15%]
(iii) p ∨ q, ¬p ` q [15%]
(iv) ¬a ∧ ¬b ` ¬(a ∨ b) [15%]

COM364 2 CONTINUED
COM364

2. a) Translate the following sentences into formulae of predicate logic. (Be sure to state
what each predicate symbol or constant used in the translation means.)

(i) There is a black swan [4%]


(ii) All black swans can fly [4%]
(iii) Tiddles is a happy cat [4%]
(iv) Some cats and some dogs are pets [4%]
(v) If all birds can fly then Tweety can fly too [4%]

b) Consider the two following possible translations for the sentence “Every child has a
mother.”:
Translation 1: ∃y∀x(C(x) → M (y, x))
Translation 2: ∀x(C(x) → ∃yM (y, x))
where C = is child and M (x, y) = x is mother of y
Which of the translations is more likely to be correct? Explain your answer. [15%]

c) Provide natural deduction proofs for the following derivabilities. [N.B. A listing of the
natural deduction proof rules is given at the end of the exam paper.]

(i) ∀x(P (x) → Q(x)), ∀xP (x) ` ∀xQ(x) [15%]


(ii) ∃xP (x) ` ¬∀x¬P (x) [15%]

d) Consider the following derivability:

∀x(P (x) → Q(x)), ∃xP (x) ` ∃xQ(x)

Demonstrate its correctness, using the method of proof by resolution refutation, by


doing the following:

(i) Convert the formulae to clausal form, showing the results produced at each
stage of the conversion process. [NB: A list of the steps of the conversion
process is given at the end of the paper.] [25%]
(ii) Provide a resolution proof over the clausal form formulae produced in 2(d)(i).
[10%]

COM364 3 TURN OVER


COM364

3. a) The result of the Prolog query ?- [a, b] = [X, Y] is X = a, Y = b. What is the


result of the following Prolog queries?

(i) ?- [a, b, c, d] = [X | Y]. [5%]


(ii) ?- [a] = [X | Y]. [5%]
(iii) ?- [a , [b, c]] = [X , Y | Z]. [5%]
(iv) ?- [a, b] = [X, X]. [5%]
(v) ?- 5 is 2 + 3. [5%]
(vi) ?- 5 = 2 + 3. [5%]
(vii) ?- X = 5, Y is 10 + X. [5%]
(viii) ?- X is 10 + Y, Y = 10. [5%]

b) Define a predicate items/2 which, when provided with a list L returns the number of
items in L. For example, items([1, 3, 5, 7, 9], X) would return X = 5. [10%]

c) Define a predicate split/4 which, when provided with a list L and integer N returns
two lists, A and B, where A contains the items in L that are greater than or equal to
N and B contains the items that are lower than N. For example, the goal split([1,
5, 2, 3, 4], 3, A, B) should return A = [5, 3, 4] and B = [1, 2]. [10%]

d) Define a predicate triangle/2, which when given a natural number N for its first
argument, computes the Nth triangular number (i.e. the sum of the integer values
from N down to 1). For example, a goal triangle(4,X) should succeed, returning
X=10 (since 4 + 3 + 2 + 1 = 10). [15%]

e) Show how a cut and fail combination can be used to define a predicate non zero/1
which returns false when provided with a list containing 0 and true when provided one
that does not. For example, the goal non zero([1, 2, 3]) should return true
while the goal non zero([3, 2, 1, 0]) should return false. [10%]

f) Consider the following predicate min/3 which takes two numbers as the first two
arguments, X and Y, and returns the smaller of the two as the third argument. For
example, min(1, 2, Z) returns Z = 1 and min(3, 2, Z) returns Z = 2.
min(X, Y, X) :- X =< Y.
min(X, Y, Y) :- Y < X.
Show how the predicate can be rewritten using a red cut. Explain why the cut used
in your answer is red rather than green. [15%]

END OF QUESTIONS

COM364 4 CONTINUED
COM364

Natural Deduction Rules for


Propositional & Predicate Logic

Conjunction Implication Negation Universal


(∧I): (→I): (⊥I): (∀I):
P P
P c
Q ¬P
: :
! P∧Q ! ⊥
Q φ(c)
! P→Q ! ∀x.φ(x)
(∧E): (¬I):
P∧Q (→E):
! P (or Q) P (∀E):
P→Q
P : ∀x.φ(x)
! Q ⊥ ! φ(c)
! ¬P

(¬¬E):
Disjunction Biconditional Existential
(∨I): (↔I): ¬¬P (∃I):
! P
P (or Q) P→Q φ(c)
! P∨Q Q→P ! ∃x.φ(x)
! P↔Q (⊥E):
(∨E): (∃E):

P∨Q ! P ∃x.φ(x)
P→R (↔E): c
Copy
Q→R P↔Q φ(c)
! R (=): P
! P→Q :
(or Q→P) : ψ
! P ! ψ

Summary of Clausal Form Conversion Steps


1. Eliminate implications (replace arrows with negation/disjunction)
2. Convert to Negation NF (reduce scope of negations to atomic formulae)
3. Rename bound variables so each quantifier binds a different one
4. Convert to Prenex NF (move quantifiers to prefix)
5. Skolemise existentials
6. Drop universal quantifiers
7. Convert to Conjunctive NF (conjunction of disjuncts)
8. Divide conjuncts to separate clauses
9. Standardise (apart) variables in clauses (so no variable appears in >1 clause)

COM364 5

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy