DynBindModelExamples: Difference between revisions
mNo edit summary |
|||
| (138 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
[[Category:ECMA]] | |||
{{Article will be deleted}} | |||
Author: Matthias Konrad[[Category:ECMA]] | |||
==The system== | ==The system== | ||
In this example we are studying a | In this example we are studying a simple system with three classes that contains both renaming and selects: | ||
{|border="0" cellpadding="2" cellspacing="0" align="center" | {|border="0" cellpadding="2" cellspacing="0" align="center" | ||
| Line 9: | Line 10: | ||
|<code>[eiffel, N] | |<code>[eiffel, N] | ||
class | class | ||
A | |||
feature | feature | ||
f1 do ... end | f1 do ... end | ||
| Line 18: | Line 19: | ||
<code>[eiffel, N] | <code>[eiffel, N] | ||
class | class | ||
B | |||
inherit | inherit | ||
A | |||
rename f1 as f2, g1 as g2 | rename f1 as f2, g1 as g2 | ||
redefine f2, g2 end | redefine f2, g2 end | ||
| Line 31: | Line 32: | ||
<code>[eiffel, N] | <code>[eiffel, N] | ||
class | class | ||
D | |||
inherit | inherit | ||
A | |||
redefine f1, g1 | redefine f1, g1 | ||
select g1 end | select g1 end | ||
B | |||
select f2 end | |||
feature | feature | ||
f1 do ... end | f1 do ... end | ||
| Line 45: | Line 47: | ||
|} | |} | ||
This system is defined by: | This system is defined by: | ||
<math>S=\left\{ A, B, D\right\}</math> | |||
<math>\tau = | |||
\left\{ | \left\{ | ||
A \mapsto \left\{ f1 \mapsto \underline{A.f1}, g1 \mapsto \underline{A.g1} \right\}, | |||
B \mapsto \left\{ f2 \mapsto \underline{B.f2}, g2 \mapsto \underline{B.g2} \right\}, | |||
D \mapsto \left\{ f1 \mapsto \underline{D.f1}, g1 \mapsto \underline{D.g1} \right\} | |||
\right\} | \right\} | ||
</math> | </math> | ||
<math>\alpha = \left\{ | |||
A \mapsto \emptyset, | |||
B \mapsto \left\{ A \right\}, | |||
D \mapsto \left\{ A, B \right\} | |||
\right\} | |||
</math> | |||
<math>\eta = | |||
\left\{ | \left\{ | ||
A \mapsto \emptyset, | |||
B \mapsto \left\{ | |||
A \mapsto \left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
\right\}, | |||
D \mapsto \left\{ | |||
A \mapsto \emptyset, B \mapsto \emptyset | |||
\right\} | \right\} | ||
\right\} | \right\} | ||
</math> | </math> | ||
<math>\sigma = \left\{ | |||
A \mapsto \emptyset, | |||
B \mapsto \left\{ A \mapsto \emptyset \right\}, | |||
D \mapsto \left\{ A \mapsto \left\{ g_1 \right\}, | |||
B \mapsto \left\{ f_2 \right\} \right\} | |||
\right\} | \right\} | ||
</math> | </math> | ||
<math> | |||
\right\} | C = \left\{ 1 \mapsto A, 2 \mapsto B, 3 \mapsto D \right\} | ||
</math> | </math> | ||
==The naming function== | ==The naming function== | ||
We proceed by calculating the naming function. According to its definition we have to do that | We proceed by calculating the naming function. According to its definition we have to do that incrementally. Meaning that we first calculate <math>\beta_{S_1}</math> then <math>\beta_{S_2}</math> and finally <math>\beta_{S_3}</math>. | ||
===Calculating <math>\beta_{S_1}</math>=== | |||
===Calculating <math>\beta_{ | Since <math>\beta_{S_1}</math> contains only one class it is sufficient to define <math>\beta_{S_1}\left( A \mapsto A\right)</math>. According to the definition: | ||
*<math> | |||
\beta_{S_1}\left( C_1 \mapsto C_1 \right) | |||
= | |||
\mbox{id} \left( | |||
\mbox{dom} \left( \tau_1 \right) | |||
\, \cup \, | |||
\mbox {UNION} \ b \, \cdot \, \left(b \in \alpha_1 | |||
\ |\ | |||
\mbox{ran} \left( \beta_{ S_0 } \left( b \mapsto b \right) \ll \eta_{1, b} \right) \right) \right) | |||
</math> | |||
We can forget about the right part of the union since <math>C_1\,</math> has no base classes. So we need to calculate: | |||
#<math>\mbox{id} \left( \mbox{dom} \left( \tau_1 \right) \right) </math> | |||
##<math> | |||
\tau_1 = \tau (C_1) = \left\{ f_1 \mapsto \underline{C_1.f_1}, g_1 \mapsto \underline{C_1.g_1} \right\} | |||
</math> | |||
##<math> | |||
\mbox{dom} \left( \tau_1 \right) = \left\{ f_1, g_1 \right\} | |||
</math> | |||
##<math> | |||
\mbox{id} \left( \mbox{dom} \left( \tau_1 \right) \right) = \left\{ f_1 \mapsto f_1, g_1 \mapsto g_1\right\} | |||
</math> | |||
So we get: | |||
<math> | |||
\beta_{S_1}\left( C_1 \mapsto C_1 \right) = \left\{ f_1 \mapsto f_1, g_1 \mapsto g_1\right\} | |||
</math> | |||
And hence: | |||
<math> | |||
\beta_{S_1} = \left\{ \left( C_1 \mapsto C_1 \right) \mapsto | |||
\left\{ f_1 \mapsto f_1, g_1 \mapsto g_1 \right\} \right\} | |||
</math> | |||
===Calculating <math>\beta_{S_2}</math>=== | |||
We show the calculation of the different (four) parts of the function in separate sections: | |||
====Calculate <math>\beta_{S_2}\left( C_1 \mapsto C_1 \right)</math>==== | |||
According to the [[DynBindModel#The_naming_function|definition]]: | |||
<math> | |||
\beta_{S_2}\left( C_1 \mapsto C_1 \right) = | |||
\beta_{S_1}\left( C_1 \mapsto C_1 \right) = \left\{ f_1 \mapsto f_1, g_1 \mapsto g_1\right\} | |||
</math> | |||
====Calculate <math>\beta_{S_2}\left( C_2 \mapsto C_1 \right)</math>==== | |||
According to the [[DynBindModel#The_naming_function|definition]]: | |||
<math> | |||
\beta_{S_2}\left( C_2 \mapsto C_1 \right) = \emptyset | |||
</math> | |||
====Calculate <math>\beta_{S_2}\left( C_2 \mapsto C_2 \right)</math>==== | |||
According to the [[DynBindModel#The_naming_function|definition]]: | |||
<math> | <math> | ||
\beta_{ | \beta_{S_2}\left( C_2 \mapsto C_2 \right) | ||
= | = | ||
\mbox{id} \left( \mbox{dom} \left( \ | \mbox{id} \left( \mbox{dom} \left( \tau_2 \right) | ||
\, \cup \, | \, \cup \, | ||
\mbox {UNION} \ b \, \cdot \, \left(b \in \ | \mbox {UNION} \ b \, \cdot \, \left(b \in \alpha_2 | ||
\ |\ | |||
\mbox{ran}\left( \beta_{ S_{1} } \left( b \mapsto b \right) \ll \eta_{2, b} \right)\right) | |||
\right) | |||
</math> | |||
Lets calculate the left part first: | |||
#<math> | |||
\tau_2 = \tau (C_2) = \left\{ f_2 \mapsto \underline{C_2.f_2}, g_2 \mapsto \underline{C_2.g_2} \right\} | |||
</math> | |||
#<math> | |||
\mbox{dom} \left( \tau_2 \right) = \left\{ f_2, g_2 \right\} | |||
</math> | |||
And now the right part: | |||
#<math> | |||
\mbox {UNION} \ b \, \cdot \, \left(b \in \left\{ C_1 \right\} | |||
\ |\ | \ |\ | ||
\beta_{ S_{0} } \left( b \mapsto b \right) \ll \eta_{ | \mbox{ran}\left( \beta_{ S_{1} } \left( b \mapsto b \right) \ll \eta_{2, b} \right)\right) | ||
= | |||
\mbox{ran}\left( \beta_{ S_{1} } \left( C_1 \mapsto C_1 \right) \ll \eta_{2, C_1} \right) | |||
</math> | |||
#<math> | |||
\beta_{ S_{1} } \left( C_1 \mapsto C_1 \right) | |||
= | |||
\left\{ f_1 \mapsto f_1, g_1 \mapsto g_1\right\} | |||
</math> | |||
#<math> | |||
\eta_{2,C_1} = \eta (C_2)(C_1) = \left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
</math> | |||
#<math> | |||
\left\{ f_1 \mapsto f_1, g_1 \mapsto g_1\right\} \ll \left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
= | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
</math> | |||
#<math> | |||
\mbox{ran}\left( \left\{ f_1 \mapsto f_2, g_1 \mapsto g_2\right\} \right) | |||
= | |||
\left\{ f_2, g_2\right\} | |||
</math> | |||
So we get: | |||
<math> | |||
\beta_{S_2} \left( C_2 \mapsto C_2 \right) | |||
= | |||
\left\{ f_2 \mapsto f_2, g_2 \mapsto g_2\right\} | |||
</math> | |||
====Calculate <math>\beta_{S_2} \left( C_1 \mapsto C_2 \right)</math>==== | |||
According to the [[DynBindModel#The_naming_function|definition]]: | |||
<math> | |||
\beta_{S_2} \left( C_1 \mapsto C_2 \right) | |||
= | |||
{\beta_{S_2}}^\prime \left( C_1 \mapsto C_2 \right) | |||
\ll | |||
\theta_{S_2} \left( C_1 \mapsto C_2 \right) | |||
</math> | |||
Where: | |||
<math> | |||
{\beta_{S_2}}^\prime \left( C_1 \mapsto C_2 \right) | |||
= | |||
\mbox {UNION} \ b \ \cdot \ \left( | |||
b \in \alpha_2 | |||
\ |\ | |||
\beta_{S_{1}} \left( C_1 \mapsto b \right) | |||
; | |||
\left( | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_{1}} \left( C_1 \mapsto b \right) \right) \right) | |||
\ll | |||
\eta_{2,b} | |||
\right) | |||
\right) | |||
</math> | |||
And: | |||
<math> | |||
\theta_{S_2} \left( C_1 \mapsto C_2 \right) | |||
= | |||
\mbox {UNION} \ b \ \cdot \ \left( | |||
b \in \alpha_2 | |||
\ |\ | |||
\beta_{S_{1}} \left( C_1 \mapsto b \right) | |||
; | |||
\left( | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_1} \left( C_1 \mapsto b \right) \right) \right) | |||
\ll | |||
\eta_{2,b} | |||
\right) | |||
\triangleright \sigma_{2,b} | |||
\right) | |||
</math> | |||
Here are the steps taken to compute the part: | |||
#<math> | |||
\beta_{S_{1}} \left( C_1 \mapsto C_1 \right) | |||
; | |||
\left( | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_{1}} \left( C_1 \mapsto C_1 \right) \right) \right) | |||
\ll | |||
\eta_{2,C_1} | |||
\right) | |||
</math> | |||
##<math> | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_{1}} \left( C_1 \mapsto C_1 \right) \right) \right) | |||
= | |||
\left\{ f_1 \mapsto f_1, g_1 \mapsto g_1 \right\} | |||
</math> | |||
##<math> | |||
\left\{ f_1 \mapsto f_1, g_1 \mapsto g_1 \right\} \ll \left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
= | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
</math> | |||
##<math> | |||
\left\{ f_1 \mapsto f_1, g_1 \mapsto g_1 \right\} \,;\, \left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
= | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
</math> | |||
##<math> | |||
{\beta_{S_2}}^\prime \left( C_1 \mapsto C_2 \right) | |||
= | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
</math> | |||
#<math> | |||
\beta_{S_1} \left( C_1 \mapsto C_1 \right) | |||
; | |||
\left( | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_1} \left( C_1 \mapsto C_1 \right) \right) \right) | |||
\ll | |||
\eta_{2,C_1} | |||
\right) | |||
\triangleright \sigma_{2,C_1} | |||
</math> | |||
##<math> | |||
\sigma_{2,C_1} = \emptyset | |||
</math> | |||
##<math> | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_1} \left( C_1 \mapsto C_1 \right) \right) \right) | |||
\ll | |||
\emptyset | |||
= | |||
\emptyset | |||
</math> | |||
##<math> | |||
\beta_{S_1} \left( C_1 \mapsto C_1 \right) | |||
; | |||
\emptyset | |||
= | |||
\emptyset | |||
</math> | |||
##<math> | |||
\theta_{S_2} \left( C_1 \mapsto C_2 \right) = \emptyset | |||
</math> | |||
# <math> | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} \ll \emptyset | |||
= | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
</math> | |||
So we get: | |||
<math> | |||
\beta_{S_2} \left( C_1 \mapsto C_2 \right) | |||
= | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
</math> | |||
====Putting the parts together:==== | |||
We can know show the complete total function: | |||
{|border="0" cellpadding="2" cellspacing="0" align="center" | |||
|-valign="top" -halign="center" | |||
| | |||
<math>\beta_{S_2} = \{</math> | |||
| | |||
<math> | |||
\left( C_1 \mapsto C_1 \right) \mapsto \left\{ f_1 \mapsto f_1, g_1 \mapsto g_1 \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_1 \mapsto C_2 \right) \mapsto \left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_2 \mapsto C_1 \right) \mapsto \emptyset, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_2 \mapsto C_2 \right) \mapsto \left\{ f_2 \mapsto f_2, g_2 \mapsto g_2 \right\} \ \} | |||
</math> | |||
|} | |||
===Calculating <math>\beta_{S_3}</math>=== | |||
We will not show the complete construction of <math>\beta_{S_3}</math> but restrict our self to the most interesting parts. | |||
====Calculate <math>\beta_{S_3} \left( C_1 \mapsto C_3 \right)</math>==== | |||
According to the [[DynBindModel#The_naming_function|definition]]: | |||
<math> | |||
\beta_{S_3} \left( C_1 \mapsto C_3 \right) | |||
= | |||
{\beta_{S_3}}^\prime \left( C_1 \mapsto C_3 \right) | |||
\ll | |||
\theta_{S_3} \left( C_1 \mapsto C_3 \right) | |||
</math> | |||
Where: | |||
<math> | |||
{\beta_{S_3}}^\prime \left( C_1 \mapsto C_3 \right) | |||
= | |||
\mbox {UNION} \ b \ \cdot \ \left( | |||
b \in \alpha_3 | |||
\ |\ | |||
\beta_{S_{2}} \left( C_1 \mapsto b \right) | |||
; | |||
\left( | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_{2}} \left( C_1 \mapsto b \right) \right) \right) | |||
\ll | |||
\eta_{3,b} | |||
\right) | |||
\right) | |||
</math> | |||
And: | |||
<math> | |||
\theta_{S_3} \left( C_1 \mapsto C_3 \right) | |||
= | |||
\mbox {UNION} \ b \ \cdot \ \left( | |||
b \in \alpha_3 | |||
\ |\ | |||
\beta_{S_{2}} \left( C_1 \mapsto b \right) | |||
; | |||
\left( | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_{2}} \left( C_1 \mapsto b \right) \right) \right) | |||
\ll | |||
\eta_{3,b} | |||
\right) | |||
\triangleright \sigma_{3,b} | |||
\right) | |||
</math> | |||
Note that we can omit <math>\eta_{3,b}\,</math> from the formulas since it is always empty. | |||
#<math> | |||
\beta_{S_2} \left( C_1 \mapsto C_2 \right) | |||
; | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_2} \left( C_1 \mapsto C_2 \right) \right) \right) | |||
\ \cup \ | |||
\beta_{S_2} \left( C_1 \mapsto C_1 \right) | |||
; | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_2} \left( C_1 \mapsto C_1 \right) \right) \right) | |||
</math> | |||
##<math> | |||
\beta_{S_{2}} \left( C_1 \mapsto C_2 \right) | |||
= | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
</math> | |||
##<math> | |||
\mbox{id}\left(\mbox{ran}\left( \beta_{S_{2}} \left( C_1 \mapsto C_2 \right) \right)\right) | |||
= | |||
\left\{ f_2 \mapsto f_2, g_2 \mapsto g_2 \right\} | |||
</math> | |||
##<math> | |||
\beta_{S_2} \left( C_1 \mapsto C_2 \right) | |||
; | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_2} \left( C_1 \mapsto C_2 \right) \right) \right) | |||
= | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
</math> | |||
##<math> | |||
\beta_{S_{2}} \left( C_1 \mapsto C_1 \right) | |||
= | |||
\left\{ f_1 \mapsto f_1, g_1 \mapsto g_1 \right\} | |||
</math> | |||
##<math> | |||
\mbox{id}\left(\mbox{ran}\left( \beta_{S_{2}} \left( C_1 \mapsto C_1 \right) \right)\right) | |||
= | |||
\left\{ f_1 \mapsto f_1, g_1 \mapsto g_1 \right\} | |||
</math> | |||
##<math> | |||
\beta_{S_2} \left( C_1 \mapsto C_1 \right) | |||
; | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_2} \left( C_1 \mapsto C_1 \right) \right) \right) | |||
= | |||
\left\{ f_1 \mapsto f_1, g_1 \mapsto g_1 \right\} | |||
</math> | |||
##<math> | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
\ \cup\ | |||
\left\{ f_1 \mapsto f_1, g_1 \mapsto g_1 \right\} | |||
= | |||
\left\{ f_1 \mapsto f_1, f_1 \mapsto f_2, g_1 \mapsto g_1, g_1 \mapsto g_2 \right\} | |||
</math> | |||
#<math> | |||
\beta_{S_2} \left( C_1 \mapsto C_2 \right) | |||
; | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_2} \left( C_1 \mapsto C_2 \right) \right) \right) | |||
\ \triangleright\ | |||
\sigma_{3,C_2} | |||
\ \cup \ | |||
\beta_{S_2} \left( C_1 \mapsto C_1 \right) | |||
; | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_2} \left( C_1 \mapsto C_1 \right) \right) \right) | |||
\ \triangleright\ | |||
\sigma_{3,C_1} | |||
</math> | |||
##<math> | |||
\sigma_{3,C_2} = \sigma \left(C_3 \right) \left(C_2\right) = \left\{ f_2 \right\} | |||
</math> | |||
##<math> | |||
\sigma_{3,C_1} = \sigma \left(C_3 \right) \left(C_1\right) = \left\{ g_1 \right\} | |||
</math> | </math> | ||
##<math> | |||
\beta_{S_2} \left( C_1 \mapsto C_2 \right) | |||
; | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_2} \left( C_1 \mapsto C_2 \right) \right) \right) | |||
\ \triangleright\ | |||
\sigma_{3,C_2} | |||
= | |||
\left\{ f_1 \mapsto f_2 \right\} | |||
</math> | |||
##<math> | |||
\beta_{S_2} \left( C_1 \mapsto C_1 \right) | |||
; | |||
\mbox{id} \left( \mbox{ran} \left( \beta_{S_2} \left( C_1 \mapsto C_1 \right) \right) \right) | |||
\ \triangleright\ | |||
\sigma_{3,C_1} | |||
= | |||
\left\{ g_1 \mapsto g_1 \right\} | |||
</math> | |||
##<math> | |||
\left\{ f_1 \mapsto f_2 \right\} \ \cup \ \left\{ g_1 \mapsto g_1 \right\} | |||
= | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_1 \right\} | |||
</math> | |||
##<math> | |||
\left\{ f_1 \mapsto f_1, f_1 \mapsto f_2, g_1 \mapsto g_1, g_1 \mapsto g_2 \right\} | |||
\ll | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_1 \right\} | |||
= | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_1 \right\} | |||
</math> | |||
So we get: | |||
<math> | |||
<math>\mbox{ | \beta_{S_3} \left( C_1 \mapsto C_3 \right) | ||
= | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_1 \right\} | |||
</math> | |||
====The complete naming function==== | |||
{|border="0" cellpadding="2" cellspacing="0" align="center" | |||
|-valign="top" -halign="center" | |||
| | |||
<math>\beta_{S_3} = \{</math> | |||
| | |||
<math> | |||
\left( C_1 \mapsto C_1 \right) \mapsto \left\{ f_1 \mapsto f_1, g_1 \mapsto g_1 \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_1 \mapsto C_2 \right) \mapsto \left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_2 \mapsto C_1 \right) \mapsto \emptyset, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_2 \mapsto C_2 \right) \mapsto \left\{ f_2 \mapsto f_2, g_2 \mapsto g_2 \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_1 \mapsto C_3 \right) \mapsto \left\{ f_1 \mapsto f_2, g_1 \mapsto g_1 \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_2 \mapsto C_3 \right) \mapsto \left\{ f_2 \mapsto f_2, g_2 \mapsto g_2 \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_3 \mapsto C_3 \right) | |||
\mapsto | |||
\left\{ f_1 \mapsto f_1, g_1 \mapsto g_1, f_2 \mapsto f_2, g_2 \mapsto g_2 \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_3 \mapsto C_1 \right) \mapsto \emptyset, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_3 \mapsto C_2 \right) \mapsto \emptyset \ \} | |||
</math> | |||
|} | |||
==The dynamic binding function== | |||
To calculate the dynamic binding function, we need to get <math>\delta_{S_3}</math>. We will again calculate it incrementally: | |||
===Calculating <math>\delta_{S_1}</math>=== | |||
According to the [[DynBindModel#The_dynamic_binding_function|definition]]: | |||
<math> | |||
\delta_{S_1} \left( C_1 \mapsto C_1 \right) | |||
= | |||
\beta_S \left( C_1 \mapsto C_1 \right) ; | |||
\left( | |||
\left( \mbox {UNION} \, b \cdot \left( | |||
b \in \alpha_1 | |||
\, |\, | |||
\left( \beta_S \left( b \mapsto b \right) ; \eta_{1,b} \right)^{-1} | |||
; | |||
\delta_{S_0}\left( b \mapsto b \right)\right) \right) \ll \tau_1 | |||
\right) | |||
</math> | |||
Since <math>\alpha_1\,</math> is empty this simplifies to: | |||
<math> | |||
\delta_{S_1} \left( C_1 \mapsto C_1 \right) | |||
= | |||
\beta_S \left( C_1 \mapsto C_1 \right) ; \tau_1 | |||
= | |||
\left\{ f_1 \mapsto f_1, g_1 \mapsto g_1 \right\} | |||
; | |||
\left\{ f_1 \mapsto \underline{C_1.f_1}, g_1 \mapsto \underline{C_1.g_1} \right\} | |||
</math> | |||
So we get: | |||
<math> | |||
\delta_{S_1} | |||
= | |||
\left\{ \left( C_1 \mapsto C_1 \right) \mapsto | |||
\left\{ f_1 \mapsto \underline{C_1.f_1}, g_1 \mapsto \underline{C_1.g_1} \right\} | |||
\right\} | |||
</math> | |||
===Calculating <math>\delta_{S_2}</math>=== | |||
Again we calculate the different parts of the function in separate sections: | |||
====Calculate <math>\delta_{S_2}\left( C_1 \mapsto C_1 \right)</math>==== | |||
According to the [[DynBindModel#The_dynamic_binding_function|definition]]: | |||
<math> | <math> | ||
\ | \delta_{S_2}\left( C_1 \mapsto C_1 \right) = | ||
\delta_{S_1}\left( C_1 \mapsto C_1 \right) = | |||
\left\{ f_1 \mapsto \underline{C_1.f_1}, g_1 \mapsto \underline{C_1.g_1} \right\} | |||
</math> | </math> | ||
====Calculate <math>\delta_{S_2}\left( C_2 \mapsto C_1 \right)</math>==== | |||
According to the [[DynBindModel#The_dynamic_binding_function|definition]]: | |||
<math> | <math> | ||
\ | \delta_{S_2}\left( C_1 \mapsto C_1 \right) = \emptyset | ||
</math> | </math> | ||
====Calculate <math>\delta_{S_2}\left( C_2 \mapsto C_2 \right)</math>==== | |||
According to the [[DynBindModel#The_dynamic_binding_function|definition]]: | |||
<math> | |||
\delta_{S_2}\left( C_2 \mapsto C_2 \right) | |||
= | |||
\beta_S \left( C_2 \mapsto C_2 \right) ; | |||
\left( | |||
\left( \mbox {UNION} \, b \cdot \left( | |||
b \in \alpha_2 | |||
\, |\, | |||
\left( \beta_S \left( b \mapsto b \right) ; \eta_{2,b} \right)^{-1} | |||
; | |||
\delta_{S_1}\left( b \mapsto b \right)\right) \right) \ll \tau_2 | |||
\right) | |||
</math> | |||
#<math> | #<math> | ||
\ | \mbox {UNION} \, b \cdot \left(b \in \left\{ C_1 \right\} | ||
\, |\, | |||
\left( \beta_S \left( b \mapsto b \right) ; \eta_{2,b} \right)^{-1} | |||
; | |||
\delta_{S_1}\left( b \mapsto b \right)\right) | |||
= | |||
\left( \beta_S \left( C_1 \mapsto C_1 \right) ; \eta_{2,C_1} \right)^{-1} | |||
; | |||
\delta_{S_1}\left( C_1 \mapsto C_1 \right) | |||
</math> | |||
##<math> | |||
\beta_S \left( C_1 \mapsto C_1 \right) ; \eta_{2,C_1} | |||
= | |||
\left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | |||
</math> | |||
##<math> | |||
\left( \beta_S \left( C_1 \mapsto C_1 \right) ; \eta_{2,C_1} \right)^{-1} | |||
= | |||
\left\{ f_2 \mapsto f_1, g_2 \mapsto g_1 \right\} | |||
</math> | |||
##<math> | |||
\left( \beta_S \left( C_1 \mapsto C_1 \right) ; \eta_{2,C_1} \right)^{-1} | |||
; | |||
\delta_{S_1}\left( C_1 \mapsto C_1 \right) | |||
= | |||
\left\{ f_2 \mapsto \underline{C_1.f_1}, g_2 \mapsto \underline{C_1.g_1} \right\} | |||
</math> | </math> | ||
#<math> | #<math> | ||
\ | \tau_2 = \tau \left( C_2 \right) | ||
= | |||
\left\{ f_2 \mapsto \underline{C_2.f_2}, g_2 \mapsto \underline{C_2.g_2} \right\} | |||
</math> | </math> | ||
#<math> | #<math> | ||
\ | \left\{ f_2 \mapsto \underline{C_1.f_1}, g_2 \mapsto \underline{C_1.g_1} \right\} | ||
\ll | |||
\left\{ f_2 \mapsto \underline{C_2.f_2}, g_2 \mapsto \underline{C_2.g_2} \right\} | |||
= | |||
\left\{ f_2 \mapsto \underline{C_2.f_2}, g_2 \mapsto \underline{C_2.g_2} \right\} | |||
</math> | </math> | ||
So we get: | So we get: | ||
<math> | |||
\delta_{S_2}\left( C_2 \mapsto C_2 \right) | |||
= | |||
\left\{ f_2 \mapsto \underline{C_2.f_2}, g_2 \mapsto \underline{C_2.g_2} \right\} | |||
</math> | |||
====Calculate <math>\delta_{S_2}\left( C_1 \mapsto C_2 \right)</math>==== | |||
According to the [[DynBindModel#The_dynamic_binding_function|definition]]: | |||
<math> | |||
\delta_{S_2}\left( C_1 \mapsto C_2 \right) | |||
= | |||
\beta_S \left( C_1 \mapsto C_2 \right) ; | |||
\left( | |||
\left( \mbox {UNION} \, b \cdot \left( | |||
b \in \alpha_2 | |||
\, |\, | |||
\left( \beta_S \left( b \mapsto b \right) ; \eta_{2,b} \right)^{-1} | |||
; | |||
\delta_{S_{1}}\left( b \mapsto b \right)\right) \right) \ll \tau_{2} | |||
\right) | |||
</math> | |||
At this stage it should be clear how to calculate this, so we just give the result: | |||
<math> | |||
\delta_{S_2}\left( C_1 \mapsto C_2 \right) | |||
= | |||
\left\{ f_1 \mapsto \underline{C_2.f_2}, g_1 \mapsto \underline{C_2.g_2} \right\} | |||
</math> | |||
====Putting the parts together:==== | |||
We can know show the complete total function: | |||
{|border="0" cellpadding="2" cellspacing="0" align="center" | |||
|-valign="top" -halign="center" | |||
| | |||
<math>\delta_{S_2} = \{</math> | |||
| | |||
<math> | |||
\left( C_1 \mapsto C_1 \right) | |||
\mapsto | |||
\left\{ f_1 \mapsto \underline{C_1.f_1}, g_1 \mapsto \underline{C_1.g_1} \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_1 \mapsto C_2 \right) | |||
\mapsto | |||
\left\{ f_1 \mapsto \underline{C_2.f_2}, g_1 \mapsto \underline{C_2.g_2} \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_2 \mapsto C_1 \right) \mapsto \emptyset, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_2 \mapsto C_2 \right) | |||
\mapsto | |||
\left\{ f_2 \mapsto \underline{C_2.f_2}, g_2 \mapsto \underline{C_2.g_2} \right\} \ \} | |||
</math> | |||
|} | |||
===Calculating <math>\delta_{S_3}</math>=== | |||
There is nothing new for this calculation so we just present the result: | |||
{|border="0" cellpadding="2" cellspacing="0" align="center" | |||
|-valign="top" -halign="center" | |||
| | |||
<math>\delta_{S_3} = \{</math> | |||
| | |||
<math> | |||
\left( C_1 \mapsto C_1 \right) | |||
\mapsto | |||
\left\{ f_1 \mapsto \underline{C_1.f_1}, g_1 \mapsto \underline{C_1.g_1} \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_1 \mapsto C_2 \right) | |||
\mapsto | |||
\left\{ f_1 \mapsto \underline{C_2.f_2}, g_1 \mapsto \underline{C_2.g_2} \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_2 \mapsto C_1 \right) \mapsto \emptyset, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_2 \mapsto C_2 \right) | |||
\mapsto | |||
\left\{ f_2 \mapsto \underline{C_2.f_2}, g_2 \mapsto \underline{C_2.g_2} \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_1 \mapsto C_3 \right) | |||
\mapsto | |||
\left\{ f_1 \mapsto \underline{C_2.f_2}, g_1 \mapsto \underline{C_3.g_1} \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | <math> | ||
\ | \left( C_2 \mapsto C_3 \right) | ||
\mapsto | |||
\left\{ f_2 \mapsto \underline{C_2.f_2}, g_2 \mapsto \underline{C_2.g_2} \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_3 \mapsto C_3 \right) | |||
\mapsto | |||
\left\{ f_1 \mapsto \underline{C_3.f_1}, g_1 \mapsto \underline{C_3.g_1}, | |||
f_2 \mapsto \underline{C_2.f_2}, g_2 \mapsto \underline{C_2.g_2} \right\}, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_3 \mapsto C_1 \right) \mapsto \emptyset, | |||
</math> | |||
|- | |||
|| | |||
| | |||
<math> | |||
\left( C_3 \mapsto C_2 \right) \mapsto \emptyset \ \} | |||
</math> | |||
|} | |||
===Deriving the dynamic binding function=== | |||
The function is now given. We evaluate it at two interesting points: | |||
*<math> | |||
\delta\left( C_1 \mapsto f_1 \right) | |||
= | |||
\left\{ | |||
C_1 \mapsto \underline{C_1.f_1}, C_2 \mapsto \underline{C_2.f_2}, C_3 \mapsto \underline{C_2.f_2} | |||
\right\} | |||
</math> | </math> | ||
*<math> | |||
\delta\left( C_1 \mapsto f_g \right) | |||
= | |||
\left\{ | |||
C_1 \mapsto \underline{C_1.f_g}, C_2 \mapsto \underline{C_2.g_2}, C_3 \mapsto \underline{C_2.g_1} | |||
\right\} | |||
</math> | |||
Latest revision as of 10:11, 11 April 2007
Template:Article will be deleted Author: Matthias Konrad
The system
In this example we are studying a simple system with three classes that contains both renaming and selects:
class A feature f1 do ... end g1 do ... end end |
class B inherit A rename f1 as f2, g1 as g2 redefine f2, g2 end feature f2 do ... end g2 do ... end end |
class D inherit A redefine f1, g1 select g1 end B select f2 end feature f1 do ... end g1 do ... end end |
This system is defined by:
The naming function
We proceed by calculating the naming function. According to its definition we have to do that incrementally. Meaning that we first calculate then and finally .
Calculating
Since contains only one class it is sufficient to define . According to the definition:
We can forget about the right part of the union since has no base classes. So we need to calculate:
So we get:
And hence:
Calculating
We show the calculation of the different (four) parts of the function in separate sections:
Calculate
According to the definition:
Calculate
According to the definition:
Calculate
According to the definition:
Lets calculate the left part first:
And now the right part:
So we get:
Calculate
According to the definition:
Where:
And:
Here are the steps taken to compute the part:
So we get:
Putting the parts together:
We can know show the complete total function:
|
|
|
|
| |
|
| |
|
|
Calculating
We will not show the complete construction of but restrict our self to the most interesting parts.
Calculate
According to the definition:
Where:
And:
Note that we can omit from the formulas since it is always empty.
So we get:
The complete naming function
|
|
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
The dynamic binding function
To calculate the dynamic binding function, we need to get . We will again calculate it incrementally:
Calculating
According to the definition:
Since is empty this simplifies to:
So we get:
Calculating
Again we calculate the different parts of the function in separate sections:
Calculate
According to the definition:
Calculate
According to the definition:
Calculate
According to the definition:
So we get:
Calculate
According to the definition:
At this stage it should be clear how to calculate this, so we just give the result:
Putting the parts together:
We can know show the complete total function:
|
|
|
|
| |
|
| |
|
|
Calculating
There is nothing new for this calculation so we just present the result:
|
|
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
Deriving the dynamic binding function
The function is now given. We evaluate it at two interesting points: