A SAMPLE CALCULATION WITH EAGER EVALUATION OF MODULES This calculation shows how the semantics makes the variable A declared in module S shared between modules M and N. module S = {var A:newint}; (module M = {import S; proc INIT=A:=0}; module N = {import S; proc SUCC=A:=@A+1}) in call M.INIT; call N.SUCC Let D be the declaration in the above program. Let piS = {S={A:intloc}dec} piM = {M={A:intloc,INIT:comm}dec} piN = {N={A:intloc,SUCC:comm}dec} piSM = piS U piM [[0 |- D:pi dec]]0 s = {by meaning of D1;D2} (e1 U e2, s2) where (e1,s1)=[[0|-module S={var A:newint}:piS dec]]0 s (e2,s2)=[[piS|-(module M=...;module N=...)]](0 U e1) s1 = {by meaning of module, 0 U e1 = e1} (e1 U e2, s2) where (e1,s1)=({S=e0},s0) where (e0,s0)=[[0|-var A:newint:{A:intloc}dec]]0 s (e2,s2)=[[piS|-(module M=...;module N=...)]]e1 s1 = {by meaning of var} (e1 U e2, s2) where (e1,s1)=({S=e0}},s0) where (e0,s0) = ({A=l},s0) where (l,s0)= allocate(s) (e2,s2)=[[piS|-(module M=...;module N=...)]]e1 s1 Below let e1 = {S={A=l}} and s1 = s1' where (l,s1')= allocate(s) = {by the above definitions, and by meaning of D2;D3} (e1 U e2, s2) where (e2,s2)=(e3 U e4, s4) where (e3,s3)=[[piS|-module M={import S;proc INIT=A:=0}:piM dec]]e1 s1 (e4,s4)=[[piSM|-module N={import S;proc SUCC=A:=@A+1}:piN dec]](e1Ue3) s3 = {by the meaning of module} (e1 U e2, s2) where (e2,s2)=(e3 U e4, s4) where (e3,s3)=({M=e5},s5) where (e5,s5)=[[piS |- import S;proc INIT=A:=0 :({A:intloc} U {INIT:comm}) dec]]e1 s1 (e4,s4)=[[piSM|-module N={import S;proc SUCC=A:=@A+1}:piN dec]](e1Ue3) s3 = {by meaning of D1;D2} (e1 U e2, s2) where (e2,s2)=(e3 U e4, s4) where (e3,s3)=({M=e5},s5) where (e5,s5)= (e6 U e7, s7) where (e6,s6)=[[piS|-import S:{A:intloc}dec]]e1 s1 (e7,s7)=[[piS U {A:intloc}|-proc INIT=A:=0 :{INIT:comm}dec]](e1 U e6) s6 (e4,s4)=[[piSM|-module N={import S;proc SUCC=A:=@A+1}:piN dec]](e1Ue3) s3 = {by meaning of import} (e1 U e2, s2) where (e2,s2)=(e3 U e4, s4) where (e3,s3)=({M=e5},s5) where (e5,s5)= (e6 U e7, s7) where (e6,s6)=(e8,s1) where e8 = [[piS|-S:{A:intloc}]]e1 (e7,s7)=[[piS U {A:intloc}|-proc INIT=A:=0 :{INIT:comm}dec]](e1 U e6) s6 (e4,s4)=[[piSM|-module N={import S;proc SUCC=A:=@A+1}:piN dec]](e1Ue3) s3 = {by meaning of the Identifier-expr S} (e1 U e2, s2) where (e2,s2)=(e3 U e4, s4) where (e3,s3)=({M=e5},s5) where (e5,s5)= (e6 U e7, s7) where (e6,s6)=(e8,s1) where e8 = {A=l} (e7,s7)=[[piS U {A:intloc}|-proc INIT=A:=0 :{INIT:comm}dec]](e1 U e6) s6 (e4,s4)=[[piSM|-module N={import S;proc SUCC=A:=@A+1}:piN dec]](e1Ue3) s3 = {by simplifying, and meaning of proc} (e1 U e2, s2) where (e2,s2)=(e3 U e4, s4) where (e3,s3)=({M=e5},s5) where (e5,s5)= (e6 U e7, s7) where (e6,s6)=({A=l},s1) (e7,s7)=({INIT=p},s6) where p s' = [[piS U {A:intloc}|-A:=0:comm]](e1 U e6) s' (e4,s4)=[[piSM|-module N={import S;proc SUCC=A:=@A+1}:piN dec]](e1Ue3) s3 = {by simplifying} (e1 U e2, s2) where (e2,s2)=(e3 U e4, s4) where (e3,s3)=({M={A=l,INIT=p}},s1) where p s' = [[piS U {A:intloc}|-A:=0:comm]](e1 U {A=l}) s' (e4,s4)=[[piSM|-module N={import S;proc SUCC=A:=@A+1}:piN dec]](e1Ue3) s3 = {as for M} (e1 U e2, s2) where (e2,s2)=(e3 U e4, s4) where (e3,s3)=({M={A=l,INIT=p}},s1) where p s' = [[piS U {A:intloc}|-A:=0:comm]](e1 U {A=l}) s' (e4,s4)=({N={A=l,SUCC=p'}},s1) where p' s' = [[piSM U {A:intloc}|-A:=@A+1:comm ]](e1 U e3 U {A=l}) s' = {by substituting definitions} ({S={A=l}, M={A=l,INIT=p}, N={A=l,SUCC=p'}}, s1) where (l,s1)= allocate(s) and p s' = [[piS U {A:intloc}|-A:=0:comm]]({S={A=l},A=l}) s' and p' s' =[[piSM U{A:intloc}|-A:=@A+1:comm ]]({S={A=l},M={A=l,INIT=p}, A=l}) s'