{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

encodetp encodetq m k type 2 ip uses h j p qmk

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: et(a1) : : : encodet(an)) >2 IP (relation) () H j= r(a1 : : : an ). < encodet(p) encodet(q) m k type >2 IP (uses) () H j= p [email protected] ]. 7! < encodet(p) m k type applyk (encodet(a1) : : : encodet(ak )) encodet(a) >2 IP (property) () H j= p m(a1 : : : ak ) 7! a]). We can now state the following encoding theorem (adapted from 24]) that establishes the equivalence of the encoded program and the original ORLog program. 77 Theorem 4.1 Let P be any ORLog program and be an ORLog formula. Let M M j= be any Herbrand structure, encode(M ) be the semantic structure corresponding to the language Lencode , and be a variable assignment function. Then P () encode(M ) j= encodea( ) Proof: By a case by case structural induction of atom A, (A) = (encodea(A)). By de nition, encodea(A) = pred(A)(encodet(t(A))), where pred(A) is a function that maps to the corresponding predicate symbol of A in Lencode , and t(A) is the list P of arguments for pred(A) constructed from the atom A according to the encoding algorithm. Therefore M j= A () (encodet(t(A))) 2 IP (pred(A)) () encode(M ) j= pred(A)(encodet(t(A)) () encode(M ) j= encodea(A) It is now easy to show that the equivalence holds for arbitrary formula by induction on the structure of the formula. 2 4.3 Reduction by Completion As we discussed earlier, mapping object-oriented languages to a deductive language is an e ective means to give a logical semantics to the source language. Although, the idea is simple, achieving completeness and capturing the intended features are not. Of the languages we have discussed at the outset of this chapter, most of them do not address the issue of inheritance. This is partly because the source languages do not have a semantics of their own, hence it becomes di cult to capture it in the target language. The encoded databases, however, have a relational interpretation where probably every object is viewed as a theory consisting of a collection of Horn clauses. Messages are viewed as sub-goals which succeed i they are entailed by the theory associated with the receiving objects. However, in a deductive setting, capturing inheritance as it stands, is a real challenge, because deductive systems are not equipped with the 78 notion of inheritance and hence must be simulated. The question we need to ask is that is it possible to model inheritance in the form of deduction since all rst-order systems are only capable of deduction? To put it another way, since inheritance is almost always deterministic, why not rst compute inheritability of clauses and then compute the model by restricting evaluation of the rules based on computed inheritability in a purely deductive way? Fortunately, the answers to these questions are favorable in the case of ORLog. As we shall see in the sequel of this chapter that the translation scheme of ORLog relies on the key idea of reducing inheritance to deduction using completion. The reduction enables us to implement ORLog on top of an existing deductive database system, namely Coral. We shall present the idea of i-completion that is the center point of the reduction technique. But rst, we take a closure of ORLog programs, called the l-closure, to account for clause locality right in the closed programs. This is di erent from the closure discussed in section 3.6.1. The l-closure is essential since our goal is to implement ORLog on a deductive system that lacks the capability of detecting locality of clauses in programs in addition to its inability to handle inheritance. Finally we discuss a translation algorithm of i-completed ORLog programs into coral, called the F-ORLog programs and show that the F-ORLog programs preserve the semantics of every original ORLog program. 4.3.1 L-closure of Programs Let P = h i be a de nite ORLog program. We rst de ne an l-closure Pl = h l l li of P as follows. Recall that the locality of clauses is not usually supplied by the programmers. By taking the l-closure, we account for the locality of clauses in P. The l-closure of a program P is the smallest set of clauses Pl satisfying P Pl, and the conditions below. l = l = l. Whenever a p-clause p m(a1 : : : ak ) 7! a] p mk ] r 1 ]q1 : : : r n ]qn 2 l . 7! r 1 ]q1 : : : rn ]q n G2 l we have G 2 l =) q mk < p] G 2 l. p mk < q ] G 2 l =) q mk > p] G 2 l . p mk > q ] 7! 7! 7! 7! 79 p mk s > q ] 7! G 2 l =) p mk > q] G 2 l. 7!d 7!d p mk s < q ] 7! G 2 l =) p mk < q] G 2 l. P :: P P ] 2 l. P :: Q P : R R :: Q 2 l. p mk ] G 2 l =) p ] 2 l . 7! p [email protected] ] 7! G 2 l =) p ] 2 l. The l-closure above exposes the properties of a program hidden in the de nitions of clause locality. It also captures the meaning of withdrawal in its operational sense. Furthermore, the l-closure now explicitly captures the idea of is-a transitivity and re exivity of objects in any program P. It is now a matter of simple exercise to show that the l-closed programs and the their corresponding ORLog programs admit the same class of canonical models and hence are equivalent. 4.3.2 I-completion We now present the notion of inheritance completion, called the i-complet...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online