Chapter 5 Equality and Object-Level Unification
5.1.5 the relationship between ! and
Having argued for the practicality of using instead of
when working with depen- dent types, I nonetheless feel obliged to point out that the two are equivalent—provided we mean
equipped withg*:yg;A¥y> . Let me now give the mutual construction. First,
the easy direction:
CONSTRUCTION: c from
This is so easy that I will just tell you the answers—by construction,
is just telescopic equation for telescopes of length b
. Y ç D LMNPORQ Y  ð D ç  ² DeE ç D LMNPORQ E ÂX ð D ç O >< > DeE ç D LMNPOQ E  D ç ÂE g)(c¥ £ =?h >;*(c¥ £ =?h K DeE ç D LMNPORQ E  D ç EjC D ç LMNPORQ E { DFC  E² D ç E D  ² C ² g):yg;A¥y> >;*:yg;A¥y> K DeE ç D LMNPORQ E  D ç EjC D   «LMNPORQ E { DFC >< ÂH E D · C
Furthermore, the reduction behaviour for g)(c¥
£
=Bh and g):yg;A¥y> is ex-
actly that for>;)(c¥
£ =?h K and>;):yg;A¥y> K .
The other direction is the interesting one.
CONSTRUCTION: from c withdfehgjid!kmln
Let us assume we have
XR D}E D LMNPORQ E Â D ç EpoàD LMNPORQ E ð D]o O X > D}E ç D LMNPORQ E Â D ç Â Â XM>;A§fg¨ D}E ç D LMNPOQ E Â D ç EjC D}E ÂEC Dç J Â ÂC «LMNPORQ E { DFC ÂK > ÂH E Â C D ç E D Â Â C C Â C D
Let us first make a little abbreviation:
kl>ff ,+ ú ç D LMNPORQJ ç
kl>ff packages up a typed term. The idea is that is just
fork>ffs: Y ç D LMNPORQ Y  D ç Y oàD LMNPORQ Yð DNo üç x1 ý üo x ð¦ý > Y ç D LMNPORQ Y  D ç >< üç x1 ý
This makes the elimination rule
XM>;A§fg¨ D}E ç D LMNPOQ E  D ç EjC D}E²cD ç E DHü ç x ý ü ç x ² ý LMNPOQ E { DFC ÂK >' ü ç x1 ý E² D ç E Drüç x1 ý üç x ² ý Cn²
If we could only deduceÂ
²
from
, we would be most of the way there. For that, we need a proof that equal cells have equal second projections.
The equivalence of g):yg;4¥¦> and equality of second projections from
dependent pairs is folklore knowledge, but I shall do the work nonetheless.
It is even difficult to state the equality of the second projections, because they are not of convertible types—we must use the substitutivity of equal- ity to make a type coercion.
The lemma we need is as shown. Let us claim it globally and work on the main goal. Observe that W ¶q ñVr DsE Dç ç J ~ Â7 ² X<W ¶q ñLr DVE ç Â Ay²cD kl>ff E D ç Â Ay² ç Â ç Â Ay² A ² E D ç A ~ ÂH7 ² so that W ¶q ñLr : >' ç D Â ²
Let us exploit this discovery. Introducing all the hypotheses, this is the goal we now must solve. SMð W ¶q ñLr : > ç D Â ² X<Q·ñXS'T DºCn² As the type of contains² , it is wise to reabstract it:
We may now eliminate SMð by g)(c¥ £ =Bh. Â ² W ¶q ñLr ( >< ç ÂE ² XRQ·ñ?S'T C DeE C D~üç x1Â ý üç x ² ý C ² C Q·ñ?S'T D Q·ñ?S'T C Now C is a reflexive equation!
We may eliminate it byg):yg;4¥¦> .
X<W ¹ ð Q·ñXS'T D}E C D~üç x1Â ý üç x1Â ý C Â4 C
The subgoal we acquire follows from{ . XNsutvtxw¬òXs7S'yNw DFC ÂK >v9z ü ç x ý
All that remains is to prove W ¶q
ñLr. Firstly, we eliminate the equation on
the cells,
withg)(c¥
£
Although the two pairs unpacked by the bind- ing sugar are the same, we have two names for each projection. We can clear this up by elimi- natingç
Â
, reducing the projections and cutting the sugared -bindings. X<WS't{w DE ç  D kl>ff ç ÂR ç ¬ ç ÂR A ² E D ç A ~ Â7 ²
Now we may useg*:yg;A¥y> to remove the reflex-
ive . X*ñ ¶ w[| D}E ç D LMNPORQ E Â D ç E D ç ç ~ ÂH7·Â
The remaining subgoal has exactly the type of >' ! X q w} DVE ç D LMNPORQ E ç D Â ÂÚÂ
As far as reduction behaviour is concerned, first observe that
W ¶q ñLr >' üç x ý > ç ÿ ><  This is because W ¶q
ñLr eliminates in succession the first equation, the cell,
then the second equation, and all three are in constructor form. Conse- quently, when >;A§pfg¨ is applied to
> ÂH
, the computed equality proof
SMð turns out to be
> Â
. Since both these equations are reflexive, both theg)(c¥
£
=?h andg):yg;4¥¦> steps reduce as required.