Lecture 6 Notes

If class o class q for any q q then for each q q for

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: 3© $   ¨ Given an object o, we can visit all the endpoints of minimal S-paths starting at o as follows, where Q ranges over subsets of Q: £ Algorithm search o S : search o QI where search o Q for any Q Q is defined by:  £ © ¨£  ¨£ ©  © ¨ 7 8£ Procedure search o Q :  £ © ¨£ 1. If class o class q for any q Q , then for each q Q , for each e in FIRST class o class q , and each o such that e o o , search o Q . £  3 ¨ ©  A£   ¨ ©£ 9 @ ¨ ¨ ¨ £ ¨£  #£ 6 © ¨ £  2. If class o class q for some q Q QF , then visit o . 3. Otherwise let Q q Q o does not have type class q q q Q such that o has type class q and S q q . Then search o Q .  B C£ F0 G5 ¨ ¨   ( E£ 0 5#£ © ¨   ¨   ¨ & D$ £ £ £ ¨  #£ £  H I( £ & ¨£ © This algorithm is much like the preceding one, except that the set Q maintains the state of a run through the non-deterministic automaton S. In step 1, we are not at a point on the subsequence, so we use the FIRST sets to search any edge that may lead us to any of the first goal classes. In step 2, we have reached a final state, so we visit the object we have reached. In step 3, we are at a set of states Q . Some of those states represent goal classes that we have not yet reached. Other states are goal classes that we have now reached. We create the next set of goal classes by carrying along those that we have not yet reached, and taking a step in the automaton S for those that we have reached. £ £ We typically start the algorithm with a unique start state and an object o that matches that state. As before, when the object graph is acyclic, this always terminates. If the object graph can be cyclic, then we need to carry around a “seen” set, as above. 6 Calculating FIRST We develop a static description of FIRST using a sequence of lemmas. This allows us to compute FIRST from the class graph. We start with a fixed class graph C.  Lemma 1 There exists an object graph O of C and objects o1 , o2 such that O o1 o2 iff class o1 C class o2 . © ¨  ¨   ¨ Lemma 2 There exists an object graph O of C and objects o1 , o2 such that O o1 o2 iff class o1 C class o2 . © ¨ P   ¨  "¨  ¨ Proof: Again, the forward direction is immediate. For the reverse, induct on the standard definition of (reflexive transitive closure), using the preceding lemma.  Q "¨ A picture of this situation is shown in figure 2. 7  Proof: The forward direction is immediate from the definition of an object graph of C. For the reverse direction, construct an object graph with two objects o1 and o2 and the specified link. The result is an object graph of C. e1 e2 e3 their classes:...
View Full Document

This document was uploaded on 03/17/2014 for the course CSG 111 at Northeastern.

Ask a homework question - tutors are online