P in practice as in the case of f logic we only want

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: odels of a program where the method data respects the signature de nitions associated with that method. This notion of \well-typing" is left outside the proof theory again as in F-logic, but can be dealt with using an approach similar to that adopted in 47]. We do not elaborate on this issue further here, as our main interest here is in inheritance. 54 De nition 3.9 (Proper Models) An Herbrand structure M is a proper model of a program P i it is proper and for every ground instance cl of any clause Cl 2 P, M j= cl. 2 De nition 3.10 (Local Properness of Models) Let P be a program and M be any model such that M = hM M M i. Then M is locally proper if it satis es conditions (1) through (5) of de nition 3.8. Likewise, M and M are locally proper if they satisfy condition (6) and (7) of de nition 3.8 respectively. Furthermore, M is proper, if M M , and M are locally proper. 2 However, not every proper model is an \intended" model. An intended model must respect certain consistency criteria. These are formalized below. In De nition 3.11 below and the sequel, we treat equality as syntactic identity. De nition 3.11 (I-consistent and Canonical Models) A proper structure M is inheritance consistent, or i-consistent, i the following conditions are satis ed: 1. o :: p 2 M and p :: o 2 M =) o = p { no cycles in object hierarchy. 2. o p@mk ] 2 M and o mk ] 2 M =) p = o { overriding is respected. 7! 7! 3. o m(a1 : : : ak ) ! v] 2 M and o m(a1 : : : ak ) ! w] 2 M =) v = w { functionality of methods is not violated. 4. o p@mk ] 2 M and o r@mk ] 2 M =) p = r { uniqueness of inheritability is respected. 7! 7! A canonical model of a program P is a model of P that is i-consistent as an Herbrand structure. 2 A program is i-consistent if it has a canonical model. In the sequel we only consider i-consistent programs. Example 3.3 The table below in Figure 3.3 shows a canonical model MP of the program P1 of Example 3.2, where we use molecular abbreviations like o m0 s0 v0 ] o m0 ] ^ o s0 ] ^ o v0 ], o m ! 5 s ! 5] o m ! 5] ^ o s ! 5], etc. The model MP 1 ! ! ! ! ! ! below formally captures the ideas informally discussed in Example 3.2 concerning locality and inheritability. We shall see later in section 3.5.3 that MP1 above is indeed the intended model of P1, in a sense to be made precise (see also Example 3.2). 55 1 Object o Object p immediate is-a p:o transitive is-a o :: o p :: p p :: o locality inheritability withdrawal data Object q q:o q :: q q :: o ! ! ! o m0 s0 v0 ] o o@ m0 o@s0 o@v0 ] ! ! ! ! ! ! om!5 s!5 v ! g] p s0 t0 q t0 u0 u0 v0 ] v0 ] p o@m0 q o@m0 r o@m0 0 p@t0 0 q @t0 p@s o@s q@t0 p@u0 p@v0 ] q@u0 q@v0 ] r@v0 ] r t0 < p] pm!2 s!2 q m!5 s!5 rt!c t!a u!d t!c u!d v ! g] v ! g] v ! g] ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Object r r:p r:q r :: r r :: p r :: q r :: o r v0 ] Figure 7: Intended model M1 for the example program P1. 3.5.2 Correspondence between Herbrand Structures and ORLog Structures The correspondence between Herbrand structures and general ORLog structures can be stated in a way similar to 47] as follows : Given a general structure for a set of clauses S, the corresponding Herbrand structure is the set of ground atoms that are true in the general structure. Conversely, for an Herbrand structure, H, the corresponding general ORLog structure, IH = hD O O Is Id L C W i, is de ned as follows: 7! 7! 7! The domain D is identical to U . The orderings O and O are derived from the transitive and immediate is-a assertions in H : For all p q 2 D, we assert q O p i q :: p 2 H , and q O p i q:p2H . 8 s < ftg if o m(t1 : : : tk )7!t] 2 H Is(m)(o t1 : : : tk ) = : unde ned otherwise 8 <t if o m(t1 : : : tk ) ! t] 2 H Id(m)(o t1 : : : tk ) = : unde ned otherwise 8 < ftg if o m(t1 : : : tk )! t] 2 H ! Id(m)(o t1 : : : tk ) = : unde ned otherwise 56 L (m)(k) = ffog j o mk ] 2 H g: 7! 7! C (m)(k)(o) = fp j o p@mk ] 2 H g: 7! 7! W (m)(k)(o) = ffpg j o mk < p] 2 H or p mk > o] 2 H g. 7! 7! 7! It is easy to see that IH = hD O O Is Id L C W i is well-de ned and is indeed an ORLog structure. The following proposition, adapted from 47], follows from the above correspondence between the two structures. The proof for this proposition is similar to the corresponding proof in 47] and hence omitted. 7! 7! 7! Herbrand model. Proof: It is easy to verify that for every Herbrand structure H, the entailment H j= S takes place if and only if IH j= S, where IH is the ORLog structure corresponding to H as de ned above. 2 Proposition 3.1 Let S be a set of clauses. Then S is unsatis able i S has no 3.5.3 Intended Models We de ne the declarative semantics of an ORLog program P as the least canonical model MP of P. An ordering relation v over Herbrand structures can be derived from the partial order (set inclusion) as in the classical case. For any program P, if I1 = hI1 I1 I1 i and I2 = hI2 I2 I2 i are two structures, then I1 v I2 () I1 I2 I1 I2 I1 I2 Consequently, for every program, the set of associated structures P (H) is a complete lattice L with join and meet operators de ned respectively as follows. (join) I1 t I2 = hI1 I2 I1 I2 I1 I2 i (meet) I1 u I2 = hI1 \ I2 I1...
View Full Document

This document was uploaded on 01/10/2011.

Ask a homework question - tutors are online