let S0 = local X in S1 end % statements S1 = local Y in S2 S3 S4 end S2 = Y = proc {$ ?R} R=X end S3 = X=true S4 = local X in S5 S6 end S5 = X=false S6 = local Z in {Y Z} S7 end S7 = if Z then skip else Z=X end E2 = {X-->x1, Y-->x2} % environments E3 = {X-->x5, Y-->x2} E4 = {X-->x5, Y-->x2, Z-->x6} C1 = (proc {$ ?R} R=X end, {X-->x1}) % a closure s5 = {x1=true,x2=C1,x3=C1,x4=true,x5} % some stores s6 = {x1=true,x2=C1,x3=C1,x4=true,x5,x6} s7 = {x1=true,x2=C1,x3=C1,x4=true,x5,x6=true} We calculate as follows... ((local X in S1 end,{})|nil, {}) --> ((local Y in S2 S3 S4 end,{X-->x1})|nil, {x1}) --> ((S2 S3 S4,{X-->x1,Y-->x2})|nil, {x1,x2}) --> ((Y = proc {$ ?R} R=X end,E2)|(S3 S4,E2)|nil, {x1,x2}) --> ((X=true,E2)|(local X in S5 S6 end,E2)|nil, {x1,x2=C1,x3=C1}) --> ((local X in S5 S6 end,E2)|nil, {x1=true,x2=C1,x3=C1,x4=true}) --> ((S5 S6,{X-->x5,Y-->x2})|nil, s5) --> ((local Z in {Y Z} S7 end,E3)|nil, s5) --> x6}> (({Y Z} S7,E4)|nil, s6) --> (({Y Z},E4)|(S7,E4)|nil, s6) --> ((R=X,{X-->x1,R-->x6})|(S7,E4)|nil, s6) --> ((if Z then skip else Z=X end,E4)|nil, s7) --> ((skip,E4)|nil, s7) --> (nil, s7)