Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Computer Science Technical Reports Computer Science 11-2003 Formal Definition of the Parameterized Aspect Calculus Curtis Clifton Iowa State University Gary T. Leavens Iowa State University Mitchell Wand Iowa State University Follow this and additional works at: http://lib.dr.iastate.edu/cs_techreports Part of the Programming Languages and Compilers Commons Recommended Citation Clifton, Curtis; Leavens, Gary T.; and Wand, Mitchell, "Formal Definition of the Parameterized Aspect Calculus" (2003). Computer Science Technical Reports. 292. http://lib.dr.iastate.edu/cs_techreports/292 This Article is brought to you for free and open access by the Computer Science at Iowa State University Digital Repository. It has been accepted for inclusion in Computer Science Technical Reports by an authorized administrator of Iowa State University Digital Repository. For more information, please contact [email protected]. Formal Definition of the Parameterized Aspect Calculus Curtis Clifton, Gary T. Leavens, and Mitchell Wand TR #03-12b October 2003 revised November 2003 Keywords: Parameterized aspect calculus, object calculus, join point model, point cut description language, aspect-oriented programming, AspectJ, advice, HyperJ, hyperslices, DemeterJ, adaptive methods 2003 CR Categories: D.3.1 [Programming Languages] Formal Definitions and Theory — Semantics D.3.2 [Programming Languages] Language Classifications — object-oriented languages D.3.3 [Programming Languages] Language Constructs and Features — classes and objects c 2003, Curtis Clifton, Gary T. Leavens, and Mitchell Wand, All Rights Reserved. Copyright Department of Computer Science 226 Atanasoff Hall Iowa State University Ames, Iowa 50011-1040, USA Formal Definition of the Parameterized Aspect Calculus Curtis Clifton and Gary T. Leavens Dept. of Computer Science, Iowa State University 226 Atanasoff Hall, Ames, IA 50011-1040 USA {cclifton,leavens}@cs.iastate.edu Mitchell Wand College of Computer and Information Science, Northeastern University Boston, MA 02115 USA [email protected] November 12, 2003 Abstract This paper gives the formal definition of the parameterized aspect calculus, or ςasp . The ςasp calculus is a core calculus for the formal study of aspect-oriented programming languages. The calculus consists of a base language, taken from Abadi and Cardelli’s object calculus, and point cut description language. The calculus is parameterized to accept a variety of point cut description languages, simplifying the study of a variety of aspect-oriented language features. The calculus exposes a rich join point model on the base language, granting great flexibility to point cut description languages. 1 Introduction This paper gives the formal definition of the parameterized aspect calculus, or ςasp . The ςasp calculus is a core calculus for the formal study of aspect-oriented programming languages. The calculus consists of a base language, taken from Abadi and Cardelli’s object calculus [1], and point cut description language. The calculus is parameterized to accept a variety of point cut description languages, simplifying the study of a variety of aspect-oriented language features. The calculus exposes a rich join point model on the base language, granting great flexibility to point cut description languages. This paper primarily provides technical details and sample reductions. The interested reader can find a more intuitive explanation of the calculus in a separate report [2]. 1 2 Formal Definitions 2.1 Syntax x ∈ Vars d ∈ Consts f ∈ FConsts l ∈ Labels S ∈ P (Labels) ∪ Consts pcd ∈ C → − P ::= a ⊗ A a, b, c ::= x | v | a.k | a.l ⇐ ς(x)b | proceedVal () | proceedIvk (a) | proceedUpd (a, ς(x)b) | π values v ::= d | [li = ς(xi )bi i∈I ] selectors k ::= l | f proceed π ::= ΠVal {|B, v|}() | closures ΠIvk {|B, S, k|}(a) | ΠUpd {|B, k|}(a, ς(x)b) −−→ −→ naked methods B ::= ς(− y )b → advice A ::= pcd B ς(− y )b programs terms step kinds ρ ::= Val | Ivk | Upd Although they are part of the term syntax, proceed closures are only generated dynamically; they may not be written in user programs. To prevent ambiguity when evaluating programs, the sets of functional constants and labels are disjoint: FConsts ∩ Labels = ∅. Similarly, Vars ∩ Consts = ∅. 2.2 Meta-Syntax reduction judgments evaluation contexts K evaluation steps κ 2.3 − a K `M ,→ A v ::= | κ · K ::= ib(l, l) | va | ia | ua Well-formedness Rules Ctx Ctx κ − `M ,→ A − κ · K `M ,→ A − K `M ,→ A 2 2.4 2.4.1 Reduction Rules When No Advice Matches Red Val 0 − K `M ,→ A → − advFor M (hVal, K, sig(v), i, A ) = • − v K `M ,→ A v Red Sel 0 (where o , [li = ς(xi )bi i∈I ]) lj ∈ li i∈I advFor M (hIvk, K, li i∈I − a K `M ,→ o →A − , lj i, A ) = • K` → − M,A a.lj − bj { ib(li i∈I , lj ) · K `M ,→ {xj ← o}} A v v Red Upd 0 (where o , [li = ς(xi )bi i∈I ]) − a K `M ,→ A o → − advFor M (hUpd, K, li i∈I , lj i, A ) = • lj ∈ li i∈I − a.lj ⇐ ς(x)b K `M ,→ A Red FConst 0 − a K `M ,→ A v0 [li = ς(xi )bi i∈I\{j} , lj = ς(x)b] → − advFor M (hIvk, K, sig(v 0 ), f i, A ) = • − a.f K `M ,→ A 0 − δ(f, v ) ib(sig(v 0 ), f ) · K `M ,→ A v v The meaning of functional constants is given by a function δ: FConsts × Values → Values. We leave δ underspecified but, following Crank and Felleisen, restrict it to just depend on the observable characteristics of its arguments [3]. This restriction is based on a notion of term context. Definition 1 (Term Context) A term context is a ςasp (M ) term with a single hole generated by the recursion: E[[−]] ::= − | [li = ς(xi )bi i∈I , l = ς(x)E[[−]]] | E[[−]].k | E[[−]].l ⇐ ς(x)c | c.l ⇐ ς(x)E[[−]] | proceedIvk (E[[−]]) | proceedUpd (E[[−]], ς(x)c) | proceedUpd (c, ς(x)E[[−]]) The size of a term context is a natural n, counting the number of recursive applications of the above rule used to generate the context. Application of a term context to a term a is modeled by non-capturing substitution, treating the hole, −, as a variable: E[[a]] = E[[−]]{{− ← a}} Let v be a value that is not a basic constant; that is, v = [li = ς(xi )bi i∈I ]. Then δ(f, v) = a implies that there exists a term context E[[−]] such that for all values v 0 , v 0 6∈ Consts, δ(f, v 0 ) = E[[v 0 ]]. 3 2.4.2 When Some Advice Matches Red Val 1 − K `M ,→ A → − advFor M (hVal, K, sig(v), i, A ) = ς()b + B − v K `M ,→ A close Val (b, {|B, v|}) = b0 0 − b va · K `M ,→ A v0 v0 Red Sel 1 (where o , [li = ς(xi )bi i∈I ]) → − − a K `M ,→ o lj ∈ li i∈I advFor M (hIvk, K, li i∈I , lj i, A ) = ς(y)b + B A 0 − b { close Ivk (b, {|(B + ς(xj )bj ), li i∈I , lj |}) = b0 ia · K `M ,→ {y ← o}} v A − a.lj K `M ,→ A v Red FConst 1 → − − a K `M ,→ v0 advFor M (hIvk, K, sig(v 0 ), f i, A ) = ς(y)b + B A 0 − b { close Ivk (b, {|B, sig(v 0 ), f |}) = b0 ia · K `M ,→ {y ← v 0 }} v A − a.f K `M ,→ A v Red Upd 1 (where o , [li = ς(xi )bi i∈I ]) → − − a K `M ,→ o advFor M (hUpd, K, li i∈I , lj i, A ) = ς(targ, rval )b0 + B A 0 00 00 − b { close Upd (b , {|B, lj |}) = b ua · K `M ,→ {rval ←- b{{x ← targ}}}}targ {{targ ← o}} A − a.lj ⇐ ς(x)b K `M ,→ A 2.4.3 v v Proceeding from Advice Red VPrcd 0 Red VPrcd 1 − K `M ,→ A − K `M ,→ A − ΠVal { K `M ,→ |•, v|}() A close Val (b, {|B, v|}) = b0 0 − b va · K `M ,→ A − ΠVal { K `M ,→ |(ς()b + B), v|}() A v v0 v0 Red SPrcd 0 − a K `M ,→ A o − b{ ib(l, l) · K `M ,→ {y ← o}} A − ΠIvk { K `M ,→ |ς(y)b, l, l|}(a) A Red SPrcd 1 − a K `M ,→ A B 6= • o v close Ivk (b, {|B, l, l|}) = b0 0 − b { ia · K `M ,→ {y ← o}} A − ΠIvk { K `M ,→ |(ς(y)b + B), l, l|}(a) A Red FPrcd 0 v0 − a K `M ,→ A Red FPrcd 1 − a K `M ,→ A v0 close Ivk (b, {|B, S, f |}) = b0 − a K `M ,→ A [li = ς(xi )bi i∈I ] 0 − b { ia · K `M ,→ {y ← v 0 }} A − a K `M ,→ A o close Upd (b0 , {|B, lj |}) = b00 v v lj ∈ li i∈I [li = ς(xi )bi i∈I\j , lj = ς(x)b] − ΠUpd { K `M ,→ |•, lj |}(a, ς(x)b) A Red UPrcd 1 v v − ΠIvk { K `M ,→ |(ς(y)b + B), S, f |}(a) A Red UPrcd 0 v v 0 − δ(f, v ) ib(S, f ) · K `M ,→ A − ΠIvk { K `M ,→ |•, S, f |}(a) A v 00 − b { ua · K `M ,→ {rval ←- b{{x ← targ}}}}targ {{targ ← o}} A − ΠUpd { K `M ,→ |(ς(targ, rval )b0 + B), lj |}(a, ς(x)b) A 4 v v 2.5 Helper Functions 2.5.1 Advice Lookup advFor M (jp, •) = • → − → advFor M (jp, (pcd B ς(− y )b) + A ) = → − → match(pcd B ς(− y )b, jp) + advFor M (jp, A ) 2.5.2 Value Signature ( li i∈I sig(v) = v 2.5.3 if v = [li = ς(xi )bi i∈I ] otherwise Transforming Proceed Terms to Proceed Closures close ρ (x, t) = x close ρ (d, t) = d close ρ (a.k, t) = close ρ (a, t).k close ρ ([li = ς(xi )bi i∈I ], t) = [li = ς(xi )close ρ (bi , t) i∈I ] close ρ (a.l ⇐ ς(x)b, t) = close ρ (a, t).l ⇐ ς(x)close ρ (b, t) close Ivk (proceedIvk (a), {|B, S, k|}) = ΠIvk {|B, S, k|}(close Ivk (a, {|B, S, k|})) close Val (proceedVal (), {|B, v|}) = ΠVal {|B, v|}() close Upd (proceedUpd (a, ς(x)b), {|B, k|}) = ΠUpd {|B, k|}(close Upd (a, {|B, k|}), ς(x)close Upd (b, {|B, k|})) close ρ (proceedVal (), {|B, v|}) = proceedVal () for ρ 6= Val close ρ (proceedIvk (a), {|B, S, k|}) = proceedIvk (close ρ (a, {|B, S, k|})) for ρ 6= Ivk close ρ (proceedUpd (a, ς(x)b), {|B, k|}) = proceedUpd (close ρ (a, {|B, k|}), ς(x)close ρ (b, {|B, k|})) for ρ 6= Upd close ρ (ΠVal {|B, v|}(), t) = ΠVal {|B, v|}() close ρ (ΠIvk {|B, S, k|}(a), t) = ΠIvk {|B, S, k|}(close ρ (a, t)) close ρ (ΠUpd {|B, k|}(a, ς(x)b), t) = ΠUpd {|B, k|}(close ρ (a, t), ς(x)close ρ (b, t)) 2.6 Variable Scoping and Substitution Substitutions are performed sequentially, left-to-right, not simultaneously. For nested substitutions, the inner-most substitution is performed first. 5 2.6.1 Variable Scoping FV (ς(y)b) , FV (b) \ {y} FV (x) , x S FV ([li = ς(xi )bi i∈I ]) , FV (ς(xi )bi ) i∈I FV (a.l) FV (a.l ⇐ ς(y)b) FV (proceedVal ()) FV (proceedIvk (a)) FV (proceedUpd (a, ς(y)b)) FV (ΠVal {|B, v|}()) FV (ΠIvk {|B, S, k|}(a)) FV (ΠUpd {|B, k|}(a, ς(y)b)) 2.6.2 FV (a) FV (a) ∪ FV (ς(y)b) ∅ FV (a) FV (a) ∪ FV (ς(y)b) ∅ FV (a) FV (a) ∪ FV (ς(y)b) Capture-Avoiding Substitution (ς(y)b){{x ← c}} x{{x ← c}} y{{x ← c}} i∈I [li = ς(xi )bi ]{{x ← c}} (a.l){{x ← c}} (a.l ⇐ ς(y)b){{x ← c}} (proceedVal ()){{x ← c}} (proceedIvk (a)){{x ← c}} (proceedUpd (a, ς(y)b)){{x ← c}} (ΠVal {|B, v|}()){{x ← c}} (ΠIvk {|B, S, k|}(a)){{x ← c}} (ΠUpd {|B, k|}(a, ς(y)b)){{x ← c}} 2.6.3 , , , , , , , , , , , , , , , , , , , , ς(y 0 )(b{{y ← y 0 }}{{x ← c}}) where y 0 ∈ / FV (ς(y)b) ∪ FV (c) ∪ {x} c y if x 6= y i∈I [li = (ς(xi )bi ){{x ← c}} ] (a{{x ← c}}).l (a{{x ← c}}).l ⇐ ((ς(y)b){{x ← c}}) proceedVal () proceedIvk (a{{x ← c}}) proceedUpd ((a{{x ← c}}), ((ς(y)b){{x ← c}})) ΠVal {|B, v|}() ΠIvk {|B, S, k|}(a{{x ← c}}) ΠUpd {|B, k|}((a{{x ← c}}), ((ς(y)b){{x ← c}})) , , , , , , , , , , , , , ς(z)({{x ←- c}}z ) ς(y 0 )(b{{y ← y 0 }}{{x ←- c}}z ) if y 6= z, where y 0 ∈ / FV (ς(y)b) ∪ FV (c) ∪ {x} c y if x 6= y i∈I [li = (ς(xi )bi ){{x ←- c}}z ] (a{{x ←- c}}z ).l (a{{x ←- c}}z ).l ⇐ ((ς(y)b){{x ←- c}}z ) proceedVal () proceedIvk (a{{x ←- c}}z ) proceedUpd ((a{{x ←- c}}z ), ((ς(y)b){{x ←- c}}z )) ΠVal {|B, v|}() ΠIvk {|B, S, k|}(a{{x ←- c}}z ) ΠUpd {|B, k|}((a{{x ←- c}}z ), ((ς(y)b){{x ←- c}}z )) Capturing Substitution (ς(z)b){{x ←- c}}z (ς(y)b){{x ←- c}}z x{{x ←- c}}z y{{x ←- c}}z i∈I [li = ς(xi )bi ]{{x ←- c}}z (a.l){{x ←- c}}z (a.l ⇐ ς(y)b){{x ←- c}}z (proceedVal ()){{x ←- c}}z (proceedIvk (a)){{x ←- c}}z (proceedUpd (a, ς(y)b)){{x ←- c}}z (ΠVal {|B, v|}()){{x ←- c}}z (ΠIvk {|B, S, k|}(a)){{x ←- c}}z (ΠUpd {|B, k|}(a, ς(y)b)){{x ←- c}}z 6 3 Sample Point Cut Description Languages 3.1 Natural Selection Let Ms = hC s , match s i, where C s ::= [l].l and: → match s ([l].lB ς(− y )b, hρ, K, S, ki) = ( → hς(− y )bi if (ρ = Ivk) ∧ (S = l) ∧ (k = l) • otherwise 3.2 General Matching The general point cut description language, MG , is defined in the following subsections. 3.2.1 Syntax of MG descriptions pcd context expr. r signatures messages 3.2.2 ::= Val | Ivk | Upd | k=k | S=S | K∈r | ¬pcd | pcd ∧ pcd | pcd ∨ pcd ::= | ib(M, m) | va | ia | ua | | r + r | rr | r* M ::= d | l | m ::= f | l | Semantics of MG Join Point Matching − match G (pcd B ς(→ y )b, jp) = ( → hς(− y )bi if matches(pcd , jp) • otherwise ( T if ρ = Val matches(Val, hρ, K, S, ki) = F otherwise ( T if ρ = Ivk matches(Ivk, hρ, K, S, ki) = F otherwise ( T if ρ = Upd matches(Upd, hρ, K, S, ki) = F otherwise ( T if k = k 0 matches(k = k , hρ, K, S, ki) = F otherwise ( T if S = S 0 matches(S = S , hρ, K, S, ki) = F otherwise ( T if K ∈ r matches(K ∈ r, hρ, K, S, ki) = F otherwise 0 0 matches(pcd 1 ∧ pcd 2 , hρ, K, S, ki) = matches(pcd 1 , hρ, K, S, ki) ∧ matches(pcd 2 , hρ, K, S, ki) matches(pcd 1 ∨ pcd 2 , hρ, K, S, ki) = matches(pcd 1 , hρ, K, S, ki) ∨ matches(pcd 2 , hρ, K, S, ki) matches(¬pcd , hρ, K, S, ki) = ¬matches(pcd , hρ, K, S, ki) 7 Context Pattern Matching ∈ ib(S, k) ∈ ib(S, k) ia ∈ ia ua ∈ ua ib(S, k) ∈ ib(, k) ib(S, k) ∈ K1 ∈ r1 K2 ∈ r2 K1 · K2 ∈ r1 r2 3.3 ib(S, k) ∈ ib(S, ) va ∈ ia ∈ ∈ r* ib(S, k) ∈ ib(, ) ua ∈ va ∈ va K ∈ r1 ∨ K ∈ r2 K ∈ r1 + r 2 K1 ∈ r K2 ∈ r* K1 · K2 ∈ r* Basic Reflection We can use ςasp to add some reflective capabilities to the object calculus. For example, we can construct a point cut description language and advice that allows a base program term to query an object for the existence of a particular label by selection on a special functional constant: a.hasLabel m. We construct a point cut description language, MB = hC B , match B i, that binds advice to selection on these special query labels: C B ::= found | notFound ( hς(x)bi if ρ = Ivk ∧ k = hasLabel l ∧ l ∈ L match B (foundB ς(x)b, hρ, K, L, ki) = • otherwise ( hς(x)bi if ρ = Ivk ∧ k = hasLabel l ∧ l ∈ /L match B (notFoundB ς(x)b, hρ, K, L, ki) = • otherwise To use this reflective mechanism, a program in ςasp (MB ) must include two pieces of advice: found B ς(s) true notFound B ς(s) false where we assume basic constants for the boolean values. With this advice, and the given definition of match B , a term a.hasLabel m will reduce to true if a reduces to an object containing the label m. Otherwise the term will reduce to false. 3.4 Quantified Advice and Adaptive Methods To model adaptive methods [4] we establish a convention that labels for fields begin with “f ” and define a point cut description language, MR = hC R , match R i, that extends MG with a mechanism to quantify over the fields of an object. All point cut descriptions in C G are valid in C R . Additionally the suffix “·∀ l ∈ fieldsOf(S)” may be added to any of C G ’s point cut descriptions. This suffix causes match R to create a sequence of advice from a single matching piece of advice. The generated sequence has one element for each field in the target object of the join point. For a point cut description without the quantifier suffix, match R is identical to match G . For a point cut description pcd G · ∀ l ∈ fieldsOf(S), match R is defined as follows: ( • if match G (pcd G B ς(y)b, hρ, K, S, ki) = • → − match R (pcd G · ∀ l ∈ fieldsOf(S)B ς( y )b, hρ, K, S, ki) = → → hς(− y )b1 , . . . , ς(− y )bm i otherwise where {l1 , . . . , lm } is the set of field labels in S and each bi is formed from b by first finding all occurrences of l as a selection or update label, and then replacing them with li . This relabeling step is formalized as 8 follows: relabel (x, l, li ) = x relabel (d, l, li ) = d relabel ([lj = ς(xj )bj j∈J ], l, li ) = [lj = ς(xj )(relabel (bj , l, li )) j∈J ] ( (relabel (a, l, li )).li relabel (a.l , l, li ) = (relabel (a, l, li )).l0 0 relabel (a.f, l, li ) = (relabel (a, l, li )).f ( (relabel (a, l, li )).li ⇐ ς(x)relabel (b, l, li ) relabel (a.l0 ⇐ ς(x)b, l, li ) = (relabel (a, l, li )).l0 ⇐ ς(x)relabel (b, l, li ) relabel (proceedVal , l, li ) = proceedVal if l0 = l otherwise if l0 = l otherwise relabel (proceedIvk (a), l, li ) = proceedIvk (relabel (a, l, li )) relabel (proceedUpd (a, ς(x)b), l, li ) = proceedUpd (relabel (a, l, li ), ς(x)relabel (b, l, li )) With MR we modeling of traversals using update advice for walking the object graph. Update advice has two parameters; we use one to track the root of the object graph to be traversed and the other to hold a visitor object for accumulating results. Suppose we have a traversal described by “to Point”, where Point is an object with the set of labels {f n, pos}. We can model this traversal in MR with the following advice, where traverse is a special functional constant and traversing is a special label, Visitor , {f obj,f acc,visit}, and Point , {f n,pos}: // initiates the traversal Ivk ∧ S = Visitor ∧ k = traverse B ς(v) proceedIvk ((v.f obj).traversing ⇐ ς(y)v) // recurses to fields for non-points Upd ∧ ¬(S = Point) ∧ k = traversing · ∀ field ∈ fieldsOf(S) B ς(t,r) proceedUpd (t, ς(y)((r.f obj.field).traversing ⇐ ς(q)(r.f obj ⇐ ς(z)r.f obj.field).f obj ⇐ ς(q)t) // prevents proceeding to actual update of traversing label, which would stick Upd ∧ ¬(S = Point) ∧ k = traversing B ς(t,r) r // selects visit method for points Upd ∧ S = Point ∧ k = traversing B ς(t,r) r.visit // extracts result from visitor object Ivk ∧ S = Visitor ∧ k = traverse B ς(v) v.f acc This traversal is used in a program as follows: [ f obj=ς(y)o, // starting object, y not free in o f acc=ς(y)a, // result accumulator visit=ς(y)b // updates accumulator based on object ].traverse 4 Sample Reductions The sample reductions given in this section were automatically generated and typeset using an interpreter for ςasp , implemented in Java. The interpreter is open-source and is available from http://www.cs.iastate. edu/~cclifton/sasp. The reductions are presented in the Abadi and Cardelli style, where a hooked arrow indicates all the premises leading to a given judgment [1, §7]. 9 4.1 Base Language Reductions We first present some reductions without advice as examples of calculation in the base language. Reducing an object value: A , • ` advFor (hVal, , {}, i, A) = • ? `[] [] Red Val 0 Reducing a method selection: A , • ` advFor (hVal, , {l}, i, A) = • ? `[l = ς(x)[]] [l = ς(x)[]] Red Val 0 l ∈ {l} advFor (hIvk, , {l}, li, A) = • ib({l}, l) ` advFor (hVal, ib({l}, l), {}, i, A) = • ? ib({l}, l) `[] [] ? `[l = ς(x)[]].l [] Red Val 0 Red Sel 0 Reducing a method update: A , • ` advFor (hVal, , {l}, i, A) = • ? `[l = ς(x)x] [l = ς(x)x] Red Val 0 advFor (hUpd, , {l}, li, A) = • l ∈ {l} ? `([l = ς(x)x].l ⇐ ς(y)[]) [l = ς(y)[]] Red Upd 0 Reducing a basic constant: A , • ` advFor (hVal, , 2, i, A) = • ? `2 2 Red Val 0 Reducing a functional constant application: A , • 10 ` advFor (hVal, , 2, i, A) = • ? `2 2 Red Val 0 advFor (hIvk, , 2, succi, A) = • δ(succ, 2) = 3 ib(2, succ) ` advFor (hVal, ib(2, succ), 3, i, A) = • ? ib(2, succ) `3 3 ? `2.succ 3 4.2 Red Val 0 Red FConsts 0 Advice on Update This section gives sample reductions using a variant of MS that associates advice with update operations instead of selections. Using the point cut description language lets us demonstrate the results of the substitution examples from the explanation of ςasp [2, §2.1.4]. Reduction without advice: A , • ` advFor (hVal, , {pos, n}, i, A) = • ? `[pos = ς(p)p.n, n = ς(y)0] [pos = ς(p)p.n, n = ς(y)0] Red Val 0 advFor (hUpd, , {pos, n}, posi, A) = • pos ∈ {pos, n} ? `([pos = ς(p)p.n, n = ς(y)0].pos ⇐ ς(x)x.n.succ) [pos = ς(x)x.n.succ, n = ς(y)0] Red Upd 0 Reduction with advice that avoids capture: A a1 a2 , h[pos, n].posB ς(targ, rval)proceedUpd (targ, ς(z)rval)i , ΠUpd {|•, pos|}([pos = ς(p)p.n, n = ς(y)0], ς(z)[pos = ς(p)p.n, n = ς(y)0].n.succ) , [pos = ς(z)[pos = ς(p)p.n, n = ς(y)0].n.succ, n = ς(y)0] ` advFor (hVal, , {pos, n}, i, A) = • ? `[pos = ς(p)p.n, n = ς(y)0] [pos = ς(p)p.n, n = ς(y)0] Red Val 0 advFor (hUpd, , {pos, n}, posi, A) = hς(targ, rval)proceedUpd (targ, ς(z)rval)i close Upd (proceedUpd (targ, ς(z)rval), {|•, pos|}) = ΠUpd {|•, pos|}(targ, ς(z)rval) ua ` advFor (hVal, ua, {pos, n}, i, A) = • ? ua `[pos = ς(p)p.n, n = ς(y)0] [pos = ς(p)p.n, n = ς(y)0] pos ∈ {pos, n} ? ua `a1 a2 ? `([pos = ς(p)p.n, n = ς(y)0].pos ⇐ ς(x)x.n.succ) a2 Reduction with advice that uses capture: A a1 a2 , h[pos, n].posB ς(targ, rval)proceedUpd (targ, ς(targ)rval.succ)i , ΠUpd {|•, pos|}([pos = ς(p)p.n, n = ς(y)0], ς(targt)targt.n.succ.succ) , [pos = ς(targt)targt.n.succ.succ, n = ς(y)0] 11 Red Val 0 Red UPrcd 0 Red Upd 1 ` advFor (hVal, , {pos, n}, i, A) = • ? `[pos = ς(p)p.n, n = ς(y)0] [pos = ς(p)p.n, n = ς(y)0] Red Val 0 advFor (hUpd, , {pos, n}, posi, A) = hς(targ, rval)proceedUpd (targ, ς(targ)rval.succ)i close Upd (proceedUpd (targ, ς(targ)rval.succ), {|•, pos|}) = ΠUpd {|•, pos|}(targ, ς(targ)rval.succ) ua ` advFor (hVal, ua, {pos, n}, i, A) = • ? ua `[pos = ς(p)p.n, n = ς(y)0] [pos = ς(p)p.n, n = ς(y)0] pos ∈ {pos, n} ? ua `a1 a2 ? `([pos = ς(p)p.n, n = ς(y)0].pos ⇐ ς(x)x.n.succ) 4.3 Red Val 0 Red UPrcd 0 a2 Red Upd 1 Before, After, and Around Advice This section gives sample reductions using MS to demonstrate the modeling of before, after, and around advice presented in the explanation of ςasp [2, §2.1.5]. Without advice: A , • ` advFor (hVal, , {pos, n}, i, A) = • ? `[pos = ς(p)p.n, n = ς(y)2] [pos = ς(p)p.n, n = ς(y)2] Red Val 0 pos ∈ {pos, n} advFor (hIvk, , {pos, n}, posi, A) = • ib({pos, n}, pos) ` advFor (hVal, ib({pos, n}, pos), {pos, n}, i, A) = • ? ib({pos, n}, pos) `[pos = ς(p)p.n, n = ς(y)2] [pos = ς(p)p.n, n = ς(y)2] Red Val 0 n ∈ {pos, n} advFor (hIvk, ib({pos, n}, pos), {pos, n}, ni, A) = • ib({pos, n}, n) · ib({pos, n}, pos) ` advFor (hVal, ib({pos, n}, n) · ib({pos, n}, pos), 2, i, A) = • ? ib({pos, n}, n) · ib({pos, n}, pos) `2 2 ? ib({pos, n}, pos) `[pos = ς(p)p.n, n = ς(y)2].n 2 ? `[pos = ς(p)p.n, n = ς(y)2].pos 2 With before advice: A a1 , h[pos, n].posB ς(x)proceedIvk ((x.n ⇐ ς(y)0))i , ΠIvk {|hς(p)p.ni, {pos, n}, pos|}((x.n ⇐ ς(y)0)) 12 Red Val 0 Red Sel 0 Red Sel 0 ` advFor (hVal, , {pos, n}, i, A) = • ? `[pos = ς(p)p.n, n = ς(y)2] [pos = ς(p)p.n, n = ς(y)2] Red Val 0 pos ∈ {pos, n} advFor (hIvk, , {pos, n}, posi, A) = hς(x)proceedIvk ((x.n ⇐ ς(y)0))i close (proceedIvk ((x.n ⇐ ς(y)0)), {|hς(p)p.ni, {pos, n}, pos|}) = a1 Ivk ia ` advFor (hVal, ia, {pos, n}, i, A) = • ? ia `[pos = ς(p)p.n, n = ς(y)2] [pos = ς(p)p.n, n = ς(y)2] Red Val 0 advFor (hUpd, ia, {pos, n}, ni, A) = • n ∈ {pos, n} ? ia`([pos = ς(p)p.n, n = ς(y)2].n ⇐ ς(y)0) ib({pos, n}, pos) · ia ` [pos = ς(p)p.n, n = ς(y)0] Red Upd 0 advFor (hVal, ib({pos, n}, pos) · ia, {pos, n}, i, A) = • ? ib({pos, n}, pos) · ia `[pos = ς(p)p.n, n = ς(y)0] [pos = ς(p)p.n, n = ς(y)0] Red Val 0 n ∈ {pos, n} advFor (hIvk, ib({pos, n}, pos) · ia, {pos, n}, ni, A) = • ib({pos, n}, n) · ib({pos, n}, pos) · ia ` advFor (hVal, ib({pos, n}, n) · ib({pos, n}, pos) · ia, 0, i, A) = • ? ib({pos, n}, n) · ib({pos, n}, pos) · ia `0 0 ? ib({pos, n}, pos) · ia `[pos = ς(p)p.n, n = ς(y)0].n 0 ? ia `ΠIvk {|hς(p)p.ni, {pos, n}, pos|}(([pos = ς(p)p.n, n = ς(y)2].n ⇐ ς(y)0)) ? `[pos = ς(p)p.n, n = ς(y)2].pos 0 With after advice: A , h[pos, n].posB ς(x)proceedIvk (x).succi 13 Red Val 0 Red Sel 0 0 Red SPrcd 0 Red Sel 1 ` advFor (hVal, , {pos, n}, i, A) = • ? `[pos = ς(p)p.n, n = ς(y)2] [pos = ς(p)p.n, n = ς(y)2] Red Val 0 pos ∈ {pos, n} advFor (hIvk, , {pos, n}, posi, A) = hς(x)proceedIvk (x).succi close Ivk (proceedIvk (x).succ, {|hς(p)p.ni, {pos, n}, pos|}) = ΠIvk {|hς(p)p.ni, {pos, n}, pos|}(x).succ ia ` advFor (hVal, ia, {pos, n}, i, A) = • ? ia`[pos [pos = ς(p)p.n, n = ς(y)2] = ς(p)p.n, n = ς(y)2] ib({pos, n}, pos) · ia ` Red Val 0 advFor (hVal, ib({pos, n}, pos) · ia, {pos, n}, i, A) = • ? ib({pos, n}, pos) · ia `[pos = ς(p)p.n, n = ς(y)2] [pos = ς(p)p.n, n = ς(y)2] Red Val 0 n ∈ {pos, n} advFor (hIvk, ib({pos, n}, pos) · ia, {pos, n}, ni, A) = • ib({pos, n}, n) · ib({pos, n}, pos) · ia ` advFor (hVal, ib({pos, n}, n) · ib({pos, n}, pos) · ia, 2, i, A) = • ? ib({pos, n}, n) · ib({pos, n}, pos) · ia `2 2 ? ib({pos, n}, pos) · ia `[pos = ς(p)p.n, n = ς(y)2].n 2 ? ia `ΠIvk {|hς(p)p.ni, {pos, n}, pos|}([pos = ς(p)p.n, n = ς(y)2]) 2 Red Val 0 Red Sel 0 Red SPrcd 0 advFor (hIvk, ia, 2, succi, A) = • δ(succ, 2) = 3 ib(2, succ) · ia ` advFor (hVal, ib(2, succ) · ia, 3, i, A) = • ? ib(2, succ) · ia `3 3 ? ia `ΠIvk {|hς(p)p.ni, {pos, n}, pos|}([pos = ς(p)p.n, n = ς(y)2]).succ ? `[pos = ς(p)p.n, n = ς(y)2].pos 3 Red Val 0 3 Red FConsts 0 Red Sel 1 With around advice: A a1 a2 , h[pos, n].posB ς(x)proceedIvk (x).succ, [pos, n].posB ς(x)proceedIvk ((x.n ⇐ ς(y)0))i , ΠIvk {|hς(x)proceedIvk ((x.n ⇐ ς(y)0)), ς(p)p.ni, {pos, n}, pos|}(x).succ , ΠIvk {|hς(x)proceedIvk ((x.n ⇐ ς(y)0)), ς(p)p.ni, {pos, n}, pos|}([pos = ς(p)p.n, n = ς(y)2]) 14 ` advFor (hVal, , {pos, n}, i, A) = • ? `[pos = ς(p)p.n, n = ς(y)2] [pos = ς(p)p.n, n = ς(y)2] Red Val 0 pos ∈ {pos, n} advFor (hIvk, , {pos, n}, posi, A) = hς(x)proceedIvk (x).succ, ς(x)proceedIvk ((x.n ⇐ ς(y)0))i close Ivk (proceedIvk (x).succ, {|hς(x)proceedIvk ((x.n ⇐ ς(y)0)), ς(p)p.ni, {pos, n}, pos|}) = a1 ia ` advFor (hVal, ia, {pos, n}, i, A) = • ? ia`[pos [pos = ς(p)p.n, n = ς(y)2] = ς(p)p.n, n = ς(y)2] ia · ia ` advFor (hVal, ia · ia, {pos, n}, i, A) = • ? ia · ia `[pos = ς(p)p.n, n = ς(y)2] [pos = ς(p)p.n, n = ς(y)2] Red Val 0 Red Val 0 advFor (hUpd, ia · ia, {pos, n}, ni, A) = • n ∈ {pos, n} ? ia· ia `([pos = ς(p)p.n, n = ς(y)2].n ⇐ ς(y)0) ib({pos, n}, pos) · ia · ia ` [pos = ς(p)p.n, n = ς(y)0] Red Upd 0 advFor (hVal, ib({pos, n}, pos) · ia · ia, {pos, n}, i, A) = • ? ib({pos, n}, pos) · ia · ia `[pos = ς(p)p.n, n = ς(y)0] [pos = ς(p)p.n, n = ς(y)0] Red Val 0 n ∈ {pos, n} advFor (hIvk, ib({pos, n}, pos) · ia · ia, {pos, n}, ni, A) = • ib({pos, n}, n) · ib({pos, n}, pos) · ia · ia ` advFor (hVal, ib({pos, n}, n) · ib({pos, n}, pos) · ia · ia, 0, i, A) = • ? ib({pos, n}, n) · ib({pos, n}, pos) · ia · ia `0 0 ? ib({pos, n}, pos) · ia · ia `[pos = ς(p)p.n, n = ς(y)0].n 0 ? ia · ia `ΠIvk {|hς(p)p.ni, {pos, n}, pos|}(([pos = ς(p)p.n, n = ς(y)2].n ⇐ ς(y)0)) ? ia `a2 0 Red Val 0 Red Sel 0 0 Red SPrcd 0 Red SPrcd 1 advFor (hIvk, ia, 0, succi, A) = • δ(succ, 0) = 1 ib(0, succ) · ia ` advFor (hVal, ib(0, succ) · ia, 1, i, A) = • ? ib(0, succ) · ia `1 1 ? ia `a2 .succ 1 ? `[pos = ς(p)p.n, n = ς(y)2].pos 1 4.4 Red Val 0 Red FConsts 0 Red Sel 1 Open Classes This section gives sample reductions using MG to model open classes, as described in §3.1.2 of the explanatory report [2]. Without advice: A , • 15 ` advFor (hVal, , {pos, n}, i, A) = • ? `[pos = ς(p)p.n, n = ς(y)0] [pos = ς(p)p.n, n = ς(y)0] Red Val 0 advFor (hUpd, , {pos, n}, ni, A) = • n ∈ {pos, n} ? `([pos = ς(p)p.n, n = ς(y)0].n ⇐ ς(y)2) [pos = ς(p)p.n, n = ς(y)2] Red Upd 0 pos ∈ {pos, n} advFor (hIvk, , {pos, n}, posi, A) = • ib({pos, n}, pos) ` advFor (hVal, ib({pos, n}, pos), {pos, n}, i, A) = • ? ib({pos, n}, pos) `[pos = ς(p)p.n, n = ς(y)2] [pos = ς(p)p.n, n = ς(y)2] Red Val 0 n ∈ {pos, n} advFor (hIvk, ib({pos, n}, pos), {pos, n}, ni, A) = • ib({pos, n}, n) · ib({pos, n}, pos) ` advFor (hVal, ib({pos, n}, n) · ib({pos, n}, pos), 2, i, A) = • ? ib({pos, n}, n) · ib({pos, n}, pos) `2 2 ? ib({pos, n}, pos) `[pos = ς(p)p.n, n = ς(y)2].n 2 ? `([pos = ς(p)p.n, n = ς(y)0].n ⇐ ς(y)2).pos 2 Red Val 0 Red Sel 0 Red Sel 0 Without advice on update, just on values: A a1 a2 a3 a4 a5 a6 a7 , , , , , , , , hVal ∧ S = {pos, n}B ς()a4 i [color = ς(s)0, pos = ς(s)s.orig.pos, orig = ς(s)a2 , n = ς(y)2] ΠVal {|•, a3 |}() [pos = ς(p)p.n, n = ς(y)0] [color = ς(s)0, pos = ς(s)s.orig.pos, orig = ς(s)proceedVal (), n = ς(s)s.orig.n] [color = ς(s)0, pos = ς(s)s.orig.pos, orig = ς(s)a2 , n = ς(s)s.orig.n] [color = ς(s)0, pos = ς(s)s.orig.pos, orig = ς(s)a7 , n = ς(s)s.orig.n] ΠVal {|•, a3 |}() `(a3 .n ⇐ ς(y)2) a1 see lemma 1 pos ∈ {color, pos, orig, n} advFor (hIvk, , {color, pos, orig, n}, posi, A) = • ib({color, pos, orig, n}, pos) ` advFor (hVal, ib({color, pos, orig, n}, pos), {color, pos, orig, n}, i, A) = • ? ib({color, pos, orig, n}, pos) `a1 a1 Red Val 0 orig ∈ {color, pos, orig, n} advFor (hIvk, ib({color, pos, orig, n}, pos), {color, pos, orig, n}, origi, A) = • ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, pos) ` ? ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, pos) `a2 a3 ? ib({color, pos, orig, n}, pos) `a1 .orig a3 Red VPrcd 0 Red Sel 0 pos ∈ {pos, n} advFor (hIvk, ib({color, pos, orig, n}, pos), {pos, n}, posi, A) = • ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a3 .n ? ib({color, pos, orig, n}, pos) `a1 .orig.pos 0 16 0 see lemma 2 Red Sel 0 ? `(a3 .n ⇐ ς(y)2).pos 0 Red Sel 0 where lemma 1 is: ` advFor (hVal, , {pos, n}, i, A) = hς()a4 i close Val (a4 , {|•, a3 |}) = a5 va ` advFor (hVal, va, {color, pos, orig, n}, i, A) = • ? va `a5 a5 ? `a3 a5 Red Val 0 Red Val 1 advFor (hUpd, , {color, pos, orig, n}, ni, A) = • n ∈ {color, pos, orig, n} ? `(a3 .n ⇐ ς(y)2) a1 Red Upd 0 lemma 2 is: ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) ` advFor (hVal, ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), {pos, n}, i, A) = hς()a4 i close Val (a4 , {|•, a3 |}) = a6 va · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) ` advFor (hVal, va · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), {color, pos, orig, n}, i, A) = • ? va · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a6 a6 Red Val 0 ? ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a3 a6 Red Val 1 n ∈ {color, pos, orig, n} advFor (hIvk, ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), {color, pos, orig, n}, ni, A) = • ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) ` advFor (hVal, ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), {color, pos, orig, n}, i, A) = ? ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a6 a6 Red Val 0 orig ∈ {color, pos, orig, n} advFor (hIvk, ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), {color, pos, orig, n}, origi, A) = ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) ` ? ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a7 a3 Red VPrcd 0 ? ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a6 .orig a3 Red Sel 0 n ∈ {pos, n} advFor (hIvk, ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), {pos, n}, ni, A) = • ib({pos, n}, n) · ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) ` advFor (hVal, ib({pos, n}, n) · ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), 0, i, A) = • ? ib({pos, n}, n) · ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `0 0 Red Val 0 ? ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a6 .orig.n 0 Red Sel 0 ? ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a3 .n 0 Red Sel 0 17 Open classes: A a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 hVal ∧ S = {pos, n}B ς()a4 , Upd ∧ S = {color, pos, orig, n} ∧ k = n ∨ k = posB ς(t, r)a2 i [color = ς(s)a5 .color, pos = ς(s)s.orig.pos, orig = ς(s)ΠUpd {|•, n|}(a5 .orig, ς(tt)2), n = ς(s)s.orig.n] [color = ς(s)t.color, pos = ς(s)s.orig.pos, orig = ς(s)proceedUpd (t.orig, ς(t)r), n = ς(s)s.orig.n] [color = ς(s)t.color, pos = ς(s)s.orig.pos, orig = ς(s)ΠUpd {|•, n|}(t.orig, ς(t)r), n = ς(s)s.orig.n] [color = ς(s)0, pos = ς(s)s.orig.pos, orig = ς(s)proceedVal (), n = ς(s)s.orig.n] [color = ς(s)0, pos = ς(s)s.orig.pos, orig = ς(s)ΠVal {|•, a9 |}(), n = ς(s)s.orig.n] ΠUpd {|•, n|}(a8 , ς(tt)2) [pos = ς(p)p.n, n = ς(tt)2] a10 .orig [pos = ς(p)p.n, n = ς(y)0] [color = ς(ss)0, pos = ς(ss)ss.orig.pos, orig = ς(ss)ΠVal {|•, a9 |}(), n = ς(ss)ss.orig.n] [color = ς(s)0, pos = ς(s)s.orig.pos, orig = ς(s)a13 , n = ς(s)s.orig.n] a11 .orig.n ΠVal {|•, a7 |}() , , , , , , , , , , , , , , `(a9 .n ⇐ ς(y)2) a1 see lemma 1 pos ∈ {color, pos, orig, n} advFor (hIvk, , {color, pos, orig, n}, posi, A) = • ib({color, pos, orig, n}, pos) `a1 .orig.pos ? `(a9 .n ⇐ ς(y)2).pos 2 2 see lemma 2 Red Sel 0 where lemma 1 is: ` advFor (hVal, , {pos, n}, i, A) = hς()a4 i close Val (a4 , {|•, a9 |}) = a5 va ` advFor (hVal, va, {color, pos, orig, n}, i, A) = • ? va `a5 a5 ? `a9 a5 Red Val 0 Red Val 1 advFor (hUpd, , {color, pos, orig, n}, ni, A) = hς(t, r)a2 i close Upd (a2 , {|•, n|}) = a3 ua ` advFor (hVal, ua, {color, pos, orig, n}, i, A) = • ? ua `a1 a1 ? `(a9 .n ⇐ ς(y)2) a1 lemma 2 is: ib({color, pos, orig, n}, pos) `a1 .orig Red Val 0 Red Upd 1 a7 see lemma 3 pos ∈ {pos, n} advFor (hIvk, ib({color, pos, orig, n}, pos), {pos, n}, posi, A) = • ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a7 .n ? ib({color, pos, orig, n}, pos) `a1 .orig.pos 2 lemma 3 is: 18 2 see lemma 4 Red Sel 0 ib({color, pos, orig, n}, pos) ` advFor (hVal, ib({color, pos, orig, n}, pos), {color, pos, orig, n}, i, A) = • ? ib({color, pos, orig, n}, pos) `a1 a1 Red Val 0 orig ∈ {color, pos, orig, n} advFor (hIvk, ib({color, pos, orig, n}, pos), {color, pos, orig, n}, origi, A) = • ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, pos) ` advFor (hVal, ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, pos), {color, pos, orig, n}, i, A) = • ? ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, pos) `a10 a10 Red Val 0 orig ∈ {color, pos, orig, n} advFor (hIvk, ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, pos), {color, pos, orig, n}, origi, A) = • ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, pos) ` ? ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, pos) `ΠVal {|•, a9 |}() a9 Red VPrcd 0 ? ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, pos) `a8 a9 Red Sel 0 n ∈ {pos, n} ? ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, pos) `a6 ? ib({color, pos, orig, n}, pos) `a1 .orig a7 a7 Red UPrcd 0 Red Sel 0 lemma 4 is: ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) ` advFor (hVal, ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), {pos, n}, i, A) = hς()a4 i close Val (a4 , {|•, a7 |}) = a11 va · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) ` advFor (hVal, va · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), {color, pos, orig, n}, i, A) = • ? va · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a11 a11 Red Val 0 ? ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a7 a11 Red Val 1 n ∈ {color, pos, orig, n} advFor (hIvk, ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), {color, pos, orig, n}, ni, A) = • ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a12 ? ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a7 .n 2 lemma 5 is: 19 2 see lemma 5 Red Sel 0 ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) ` advFor (hVal, ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), {color, pos, orig, n}, i, A) = • ? ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a11 a11 Red Val 0 orig ∈ {color, pos, orig, n} advFor (hIvk, ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), {color, pos, orig, n}, origi, A) = • ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) ` ? ib({color, pos, orig, n}, orig) · ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a13 a7 Red VPrcd 0 ? ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a11 .orig a7 Red Sel 0 n ∈ {pos, n} advFor (hIvk, ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), {pos, n}, ni, A) = • ib({pos, n}, n) · ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) ` advFor (hVal, ib({pos, n}, n) · ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos), 2, i, A) = • ? ib({pos, n}, n) · ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `2 2 Red Val 0 ? ib({color, pos, orig, n}, n) · ib({pos, n}, pos) · ib({color, pos, orig, n}, pos) `a12 2 Red Sel 0 4.5 HyperJ and Adaptive Methods The reduction proofs for HyperJ and adaptive methods are quite tedious and so are omitted here. Nevertheless, these proofs have been mechanically checked and are included as test cases with the interpreter (in the class sasp.MainTest available from http://www.cs.iastate.edu/~cclifton/sasp). 5 Acknowledgments The work of Clifton and Leavens was supported in part by the US National Science Foundation under grants CCR-0097907 and CCR-0113181. References [1] M. Abadi and L. Cardelli. A Theory of Objects. Monographs in Computer Science. Springer-Verlag, New York, NY, 1996. [2] C. Clifton, G. T. Leavens, and M. Wand. Parameterized aspect calculus: A core calculus for the direct study of aspect-oriented languages. Technical Report 03-13, Iowa State University, Department of Computer Science, Nov. 2003. Submitted for publication. [3] E. Crank and M. Felleisen. Parameter-passing and the lambda calculus. In Conference Record of the Eighteenth Annual ACM Symposium on Principles of Programming Languages, pages 233–244, Orlando, Florida, 1991. [4] K. Lieberherr, D. Orleans, and J. Ovlinger. Aspect-oriented programming with adaptive methods. Commun. ACM, 44(10):39–41, Oct. 2001. 20