Skip to content
Snippets Groups Projects
Commit b6325554 authored by Max New's avatar Max New
Browse files

correct impl of function upcast I think

parent 1a8ea286
No related branches found
No related tags found
No related merge requests found
...@@ -579,6 +579,7 @@ We implement the appropriate casts and their adjoints as follows ...@@ -579,6 +579,7 @@ We implement the appropriate casts and their adjoints as follows
\[ \upcast {U \u M} {U \dync} x = \u \roll \thunk [ \pi_{\u M} \mapsto \force x; \pi_{\u M'} \mapsto \err ] \] \[ \upcast {U \u M} {U \dync} x = \u \roll \thunk [ \pi_{\u M} \mapsto \force x; \pi_{\u M'} \mapsto \err ] \]
\begin{figure} \begin{figure}
\begin{mathpar}
\inferrule \inferrule
{A \vtype \and \u B \ctype} {A \vtype \and \u B \ctype}
{A \to \u B \ctype} {A \to \u B \ctype}
...@@ -604,22 +605,25 @@ We implement the appropriate casts and their adjoints as follows ...@@ -604,22 +605,25 @@ We implement the appropriate casts and their adjoints as follows
{\Phi \pipe \Psi \vdash M_1 \ltdyn M_2 : A_1 \to \u B_1 \ltdyn A_2 \to \u B_2 \and {\Phi \pipe \Psi \vdash M_1 \ltdyn M_2 : A_1 \to \u B_1 \ltdyn A_2 \to \u B_2 \and
\Phi \vdash v_1 \ltdyn v_2 : A_1 \ltdyn A_2} \Phi \vdash v_1 \ltdyn v_2 : A_1 \ltdyn A_2}
{\Phi \pipe \Psi \vdash M_1(v_1) \ltdyn M_2(v_2) : \u B_1 \ltdyn \u B_2} {\Phi \pipe \Psi \vdash M_1(v_1) \ltdyn M_2(v_2) : \u B_1 \ltdyn \u B_2}
\end{mathpar}
\caption{Function Type} \caption{Function Type}
\end{figure} \end{figure}
\begin{figure} \begin{figure}
\begin{mathpar}
\inferrule \inferrule
{} {}
{\dncast {A_1 \to \u B_1}{A_2 \to \u B_2} \bullet \equidyn \lambda x:A_1. \dncast {\u B_1}{\u B_2} (\bullet(\upcast {A_1} {A_2}))} {\dncast {A_1 \to \u B_1}{A_2 \to \u B_2} \bullet \equidyn \lambda x:A_1. \dncast {\u B_1}{\u B_2} (\bullet(\upcast {A_1} {A_2} x))}
\inferrule \inferrule
{} {}
{\upcast {U({A_1 \to \u B_1})}{U({A_2 \to \u B_2})} (f : U(A_1 \to \u B_1)) \equidyn {\upcast {U({A_1 \to \u B_1})}{U({A_2 \to \u B_2})} (f : U(A_1 \to \u B_1)) \equidyn\\
\thunk \lambda x_2 : A_2. \force \upcast{U \u B_1}{U \u B_2}(\thunk ((\force f))) \thunk \lambda x_2 : A_2.
\lett x_1 = \dncast{\u F A_1}{\u F A_2}\ret x_2;
(\force \upcast{U \u B_1}{U \u B_2}(\thunk ((\force f)(x_1))))
} }
\end{mathpar}
\caption{Function Contract Theorem, Proof} \caption{Function Contract Theorem, Proof}
\end{figure} \end{figure}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment