{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Then we present the last inference rule empty pc 2 and

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: G 1` GPc ` G 2 ] c 1 ^ G2 (deduction) Pc ` G ] Pc ` A C = A G 2 Pc = mgu(A A ) 0 0 Figure 8: Classical inference rules. As in 59], a proof for Pc ` G is a tree rooted at Pc ` G with internal nodes that are instances of one of the four inference rules and with the leaf nodes that are labelled with the gure empty. The height of a proof is the maximum of the number of nodes in all the branches in the proof tree, and the size of a proof is the number of nodes in the proof tree. The interpretation of the provability relation ` is straightforward. The rst three rules capture the operational semantics of classical logic with the only di erence that The classical notions of substitution and uni cation can be adapted to ORLog with minor modi cations. 14 62 our language has a di erent syntax, and an elaborate set of atoms. The rule empty says that the empty goal can be proved with the empty substitution. The rule and for conjunctive goal is intuitive: to prove G 1 G2, we have to prove G 1 and G 2 from left to right as in Prolog. The rule deduction for logical inference (or back-chaining) is as expected. To prove A, we need to prove the body G of a clause A G such that A and A unify with . In this context, we would like to make the following remark about the composition of substitutions in our proof rules. Consider, for example, the deduction rule. Initially the lower sequent is Pc ` A that states that A is derivable from Pc . Now to prove A from the clause A G , we incur a substitution on A through which A and A unify. Then we are left to prove G , since should be applied to the body as well. To prove G we may similarly incur another substitution . Note that similar to classical logic it is customary that A must inherit the substitutions that are applied to G at a later proof. Thus must be applied to A after we apply since was incurred rst. This explains our convention of right composing the substitutions in the proof rules. We denote by the composition of substitutions with as de ned in 55]. Finally, the rule inheritance in Figure 9 is unique to ORLog. This rule accounts for the structural and behavioral inheritance in our language. The key idea is that to prove a ground p-goal (a p-atom) of the form o m(a1 : : : ak ) 7! a] via inheritance, we must nd a unit i-clause o [email protected] ] in Pc and a p-clause cl such that cl de nes mk at p. Then we apply a clause-wise term replacement fp= g and prove the body of the =o clause. Note that, the term replacement fp= g captures the idea of context switching =o which is central to the realization of code reuse in ORLog. This is the basic idea. However, it is cumbersome and ine cient to force inheritance to the ground level. Consequently, our inheritance inference rule in Figure 9 incorporates this idea on general (non-ground) p-clauses, by using the context switch judiciously. 0 0 0 0 7! 7! 0 o p @mk ] 2 c B p m(a1 : : : ak) 7! a ] G 2 c B = mgu( B G = mgu(p ] p) c (inheritance) P ` Po ` (a : : % ]a ) 7! a] B % = fp ==o o ) B og m1 :k c B = mgu(< o a : : : a a > ] @ 0 0 0 7! 0 0 0 0 < p a1 : : : ak a > %]) 0 0 0 1 k 1 C C C C C C A Figure 9: Inheritance rule of ORLog. 63 Recall that % = fp = o g is a term replacement implementing context switching, = not a substitution. The way this inference rule works is as follows. In order to prove a p-atom, determine by looking in the closure Pc where the descriptor of the p-atom is supposed to inherit the property from. Once this is established, locate any clause de ning this property at the source of the inheritance, and prove the body of this clause after performing the appropriate context switch (%). All this is accomplished modulo uni cation since we are dealing with non-ground clauses. Below is an example of a proof using our proof theory. Example 3.4 Revisit Example 3.2. Let us add the is-a de nition k : p as clause (15): k : p then belongs in the component 1 in program P1 of Example 3.2. Let P1 be the closure of P1. Now consider proving the goal k m ! W ] from the program P1 using the proof rules above. A proof tree corresponding to P1 ` k m ! W ] is c given below where % is the context switch as shown. The proof returns the answer substitution fW=2g. (empty) (empty) 2 3 2 3 P1 ` 2 P1 ` 2 (deduc) (14), 5 (inherit) (9), 5 4 4 = fQ=kg P1 ` Q=k k v ! g] P1 ` X=2 k s ! X ] ] %2 = fp==kg (and) P1 ` Q=k X=2 k s ! X ] k v ! g] 2 (inheritance) (8), 3 4 5 %1 = fo==kg P1 ` W=X Q=k X=2 k m ! W ] c c c f g c c c f g c f gf g c f gf gf g 3.7 Fixpoint Semantics We now de ne a constructive way of de ning the least model for a program P. Notice that in any ORLog program P = h i, there is an implicit strati cation among its components. Namely, for a program P = h i, the dependencies ( , and ( hold, as stated in De nition 3.1. Note that to compute inheritability of property clauses, as required by the algorithm for r, we need to have a complete knowledge of the object hierarchy and the locality of clauses de ned in program P. These observations and the depends on relation \(" suggest a way of constructing a mo...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online