Midterm Examination: Logic Rules and Inferences, Exams of Distributed Database Management Systems

Instructions and problems for a midterm examination in the field of logic. The examination covers topics such as prime and composite numbers, edb predicates, dependency graph, and conjunctive queries. Students are required to construct well-founded models, prove inferences, and convert rules. The document also includes a reference to the gupta test.

Typology: Exams

2011/2012

Uploaded on 07/15/2012

sajann
sajann 🇮🇳

4.5

(2)

43 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS345A Midterm Examination
Monday,May 16, 1994, 2:15 { 3:30 pm
Directions
The exam is
open book
any written materials may be used. Answer all 6 questions on the
exam paper itself. The total number of points is 150. You maymake additional comments
at the bottoms of pages or at the end if you feel the need to clarify or justify your answers.
Do not forget to
sign the pledge
below.
Iacknowledge and accept the honor co de.
Printyour name here:
1 2 3
4 5 6
Problem 1:
(40 points) Consider the following rules:
p(X) :- int(X) & X >= 2 & not c(X)
c(X) :- int(X) & p(Y) & divides(X,Y) & X != Y
Think of
p
(
X
) as meaning \
X
is a prime" and
c
(
X
)as\
X
is composite." The EDB
predicate
int
(
X
)says that
X
is a positiveinteger, and in practice it will hold a nite set
of integers. The EDB predicate
divides
(
X Y
) means that
Y
evenly divides
X
.
Suppose that
int
=
f
1
2
3
4
g
, and
divides
is the expected relation on these four
integers that is,
divides
=
f
(1
1)
(2
1)
(3
1)
(4
1)
(2
2)
(4
2)
(3
3)
(4
4)
g
. If
we instantiate these rules in all possible ways, eliminate rules with a kno
wn false subgoal
and then eliminate known true subgoals from the remaining rules, we are left with the
following:
p(2) :- not c(2) c(2) :- p(1)
p(3) :- not c(3) c(3) :- p(1)
p(4) :- not c(4) c(4) :- p(1)
c(4) :- p(2)
a) In the table at the top of the next page, construct the well-founded model by the
denition (not the alternating xedpoint). Indicate what inferences are made about
the truth or falsehood of
p
(
i
) and
c
(
i
), for 1
i
4 at each round.
1
docsity.com
pf3
pf4
pf5

Partial preview of the text

Download Midterm Examination: Logic Rules and Inferences and more Exams Distributed Database Management Systems in PDF only on Docsity!

CSA Midterm Examination Monday May     pm

Directions

The exam is open book any written materials may b e used Answer all  questions on the exam pap er itself The total numb er of p oints is   You may make additional comments at the b ottoms of pages or at the end if you feel the need to clarify or justify your answers Do not forget to sign the pledge b elow

I acknowledge and accept the honor co de

Print your name here

Problem   p oints Consider the following rules

pX  intX  X   not cX cX  intX  pY  dividesX Y  X  Y

Think of pX  as meaning X is a prime and cX  as X is comp osite The EDB predicate intX  says that X is a p ositive integer and in practice it will hold a nite set of integers The EDB predicate div idesX  Y  means that Y evenly divides X 

Supp ose that int  f   g and div ides is the exp ected relation on these four integers that is div ides  f                 g If we instantiate these rules in all p ossible ways eliminate rules with a known false subgoal and then eliminate known true subgoals from the remaining rules we are left with the following

p   not c  c   p  p   not c  c   p  p  not c c  p  c  p 

a In the table at the top of the next page construct the wellfounded mo del by the denition not the alternating xedp oint Indicate what inferences are made ab out the truth or falseho o d of pi and ci for   i   at each round

Round Positive Inferences Negative Inferences

 

b In the space b elow draw the dep endency graph for the instantiated atoms pi and ci for   i  

c Are the rules with the given EDB lo cally stratied If so tell what the strata are if not describ e an innite negative path

d Supp ose int contains the integers from  to n and div ides contains all those pairs i j  such that j divides i and i and j are integers b etween  and n For what values of n will the rules and EDB b e lo cally stratied Explain briey

c Briey explain why your expression from b holds Hint  The implication of disjunc tion logical OR can b e shown true by showing that the hyp othesis implies any one of the disjuncts

Problem   p oints For the rules

pX Y Z  aX Y Z pX Y Z  pX Y W  pY W Z

draw the rule goal graph starting with the goal pbf^ f^ in the space b elow

Problem   p oints Convert the following rules

pX Y  aX Y pX Y  pX Z  pZ Z  pZ Y

into equivalent rules with rectied subgoals

Problem   p oints For the query p  Z  apply a magicsets transformation to the following rules

r  pX Y  cX Y r  pX Y  aX U  pU V  bV W  pW Y

You may use either the basic transformation or a simplied transformation that eliminates some supplementary predicates