You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
It Coercion IMatrix Ia1 Iɛ1 Iɛ2 Iɛ3 Iɛ4 . . .<br />
0 M ∗ ∗ ∗ ∗ ∗ ∗<br />
1 . . . M ∗ ∗ ∗ ∗ ∗ ∗<br />
1 M ⋖ a1 M M, V ∗ ∗ ∗ ∗ ∗<br />
2 . . . M M, V ∗ ∗ ∗ ∗ ∗<br />
2 a1 ⋖ ɛ1 M M, V M, V ∗ ∗ ∗ ∗<br />
2 ɛ1 ⋖ ɛ2 M M, V M, V M, V ∗ ∗ ∗<br />
2 ɛ2 ⋖ ɛ3 M M, V M, V M, V M, V ∗ ∗<br />
2 ɛ3 ⋖ ɛ4 M M, V M, V M, V M, V M, V ∗<br />
2 . . . M M, V M, V M, V M, V M, V ∗<br />
3 . . . M M, V M, V M, V M, V M, V ∗<br />
Table 1. Example CONSISTENT<br />
<strong>The</strong> <strong>algorithm</strong> WTYPE: <strong>The</strong> presented <strong>algorithm</strong>s are now summerized in<br />
the adaptation of WTYPE. In WTYPE an own well-typing is determined <strong>for</strong><br />
each function declaration.<br />
<strong>The</strong> function WTYPE is given as:<br />
WTYPE: TypeAssumptions × class→ { <strong>Well</strong>Typing } ∪ { fail }<br />
WTYPE( Ass, Class( cl, extends( τ ′ ), fdecls, ivardecls ) ) =<br />
let<br />
({ f1 : a1, . . . , fn : an }, CoeS) = TYPE( Ass, Class( cl, extends( τ ′ ),<br />
fdecls, ivardecls ) )<br />
(σ, AC) = MATCH( CoeS )<br />
in<br />
if CONSISTENT( AC ) then<br />
{ (AC, Ass ⊢ fi : σ( ai )) | 1�i�n }<br />
else fail<br />
Now we will complete our example.<br />
Example 5. In 2 we declared the <strong>Java</strong>λ program<br />
class Matrix extends Vector {<br />
op = #{ m -> #{ f -> f(Matrix.this, m) } } },<br />
determined the set of assumptions Ass1 and the type assumptions op : aop.<br />
In 3 we determined the substition σ and the set of atomic coercions AC and in<br />
4 we showed that AC is consistent.<br />
From this follows, that in WTYPE <strong>for</strong> op the well-typing<br />
(AC, Ass1 ⊢ op : # # γ ′ 3 (# ɛ ′′<br />
4 (ɛ4, ɛ ′ 4)) (β1)).<br />
is determined.<br />
As in the function CONSISTENT all possible instances are determined, it holds:<br />
ɛ4 = Matrix or Vector.<br />
Furthermore, from AC follows, that it holds β1 ⋖ ɛ ′ 4 and ɛ ′′<br />
4 ⋖ γ ′ 3, which describes<br />
corelations of type variables of the result type.