% generated by Ott 0.10.14 from: caml_typedef_syntax.ott caml_typedef_typing.ott caml_typedef_reduction.ott
\documentclass[10pt,titlepage]{article}
\usepackage{amsmath,amssymb}
\usepackage{supertabular}
\usepackage{geometry}
\usepackage{ifthen}
\usepackage{graphics}
%\usepackage[usenames]{color}
\usepackage{pstricks}
\geometry{%
a4paper,
% letterpaper,
dvips,
twoside,
left=15mm, right=15mm,
top=10mm,  bottom=0mm,
}
\usepackage{color}
%\geometry{landscape} 
\usepackage{ifthen}
\newcommand{\ottdrule}[4][]{{\displaystyle\frac{\begin{array}{l}#2\end{array}}{#3}\quad\ottdrulename{#4}}}
\newcommand{\ottusedruleC}[1]{\[\mbox{\cy{$\displaystyle{}#1$}}\]}
\newcommand{\ottusedrule}[1]{\[#1\]}
\newcommand{\ottpremise}[1]{ #1 \\}
\newenvironment{ottdefnblock}[3][]{ \framebox{\mbox{#2}} \quad #3 \\[0pt]}{}
\newenvironment{ottfundefnblock}[3][]{ \framebox{\mbox{#2}} \quad #3 \\[0pt]\begin{displaymath}\begin{array}{l}}{\end{array}\end{displaymath}}
\newcommand{\ottfunclause}[2]{ #1 \equiv #2 \\}
\newcommand{\ottnt}[1]{\mathit{#1}}
\newcommand{\ottmv}[1]{\mathit{#1}}
\newcommand{\ottkw}[1]{\mathbf{#1}}
\newcommand{\ottcom}[1]{\text{#1}}
\newcommand{\ottdrulename}[1]{\textsc{#1}}
\newcommand{\ottcomplu}[5]{\overline{#1}^{\,#2\in #3 #4 #5}}
\newcommand{\ottcompu}[3]{\overline{#1}^{\,#2<#3}}
\newcommand{\ottcomp}[2]{\overline{#1}^{\,#2}}
\newcommand{\ottgrammartabular}[1]{\begin{supertabular}{llcllllll}#1\end{supertabular}}
\newcommand{\ottmetavartabular}[1]{\begin{supertabular}{ll}#1\end{supertabular}}
\newcommand{\ottrulehead}[3]{$#1$ & & $#2$ & & & \multicolumn{2}{l}{#3}}
\newcommand{\ottprodline}[6]{& & $#1$ & $#2$ & $#3 #4$ & $#5$ & $#6$}
\newcommand{\ottinterrule}{\\[5.0mm]}
\newcommand{\ottafterlastrule}{\\}
\makeatletter
\input ott-spec.ltx
\newcommand{\ottenvironmentappend}[2]{%
  \begingroup%
  \def\@tempa{#1}\def\@tempb{ \ottkw{empty} }%
  \ifx\@tempa\@tempb\def\@tempc{}\else\def\@tempc{#1,}\fi%
  \expandafter\endgroup%
  \@tempc#2%
}
\newcommand{\trimbox}[1]{\raisebox{0pt}[1.20ex][0.2ex]{#1}} 
\newcommand{\cy}[1]{\colorbox{yellow}{#1}}
\newcommand{\ie}{%
i.e.,
}
\newcommand{\eg}{%
e.g.,
}
\makeatother
\newif\ifHAVEtypedefinitions \newif\ifHAVEmodules
\HAVEtypedefinitionstrue
%m\HAVEmodulestrue

%%%% End of preamble %%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% defnss
% defns JdomEB
% defn domEB
\newcommand{\ottdruleJdomEBXXtypeXXparam}[1]{\ottdrule[#1]{%
}{
\ottkw{dom} \, ( \, \ottkw{TV} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottkw{TV}}{
{\ottdrulename{JdomEB\_type\_param}}{}
}}


\newcommand{\ottdruleJdomEBXXvalueXXname}[1]{\ottdrule[#1]{%
}{
\ottkw{dom} \, ( \, \ottnt{value\_name} \, : \, \ottnt{typescheme} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{value\_name}}{
{\ottdrulename{JdomEB\_value\_name}}{}
}}


\newcommand{\ottdruleJdomEBXXconstXXconstrXXname}[1]{\ottdrule[#1]{%
}{
\ottkw{dom} \, ( \, \ottnt{constr\_name} \, \ottkw{of} \, \ottnt{typeconstr} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{constr\_name}}{
{\ottdrulename{JdomEB\_const\_constr\_name}}{}
}}


\newcommand{\ottdruleJdomEBXXconstrXXname}[1]{\ottdrule[#1]{%
}{
\ottkw{dom} \, ( \, \ottnt{constr\_name} \, \ottkw{of} \, \forall \, \ottnt{type\_params\_opt} \, , \, ( \, \ottnt{t_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t_{\ottmv{n}}} \, ) \, : \, \ottnt{typeconstr} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{constr\_name}}{
{\ottdrulename{JdomEB\_constr\_name}}{}
}}


\newcommand{\ottdruleJdomEBXXopaqueXXtypeconstrXXname}[1]{\ottdrule[#1]{%
}{
\ottkw{dom} \, ( \, \ottnt{typeconstr\_name} \, : \, \ottnt{kind} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{typeconstr\_name}}{
{\ottdrulename{JdomEB\_opaque\_typeconstr\_name}}{}
}}


\newcommand{\ottdruleJdomEBXXtransXXtypeconstrXXname}[1]{\ottdrule[#1]{%
}{
\ottkw{dom} \, ( \, \ottnt{type\_params\_opt} \, \ottnt{typeconstr\_name} \, = \, \ottnt{t} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{typeconstr\_name}}{
{\ottdrulename{JdomEB\_trans\_typeconstr\_name}}{}
}}


\newcommand{\ottdruleJdomEBXXrecordXXtypeconstrXXname}[1]{\ottdrule[#1]{%
}{
\ottkw{dom} \, ( \, \ottnt{typeconstr\_name} \, : \, \ottnt{kind} \, \ottkw{\{} \, \ottnt{field\_name_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{n}}} \, \ottkw{\}} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{typeconstr\_name}}{
{\ottdrulename{JdomEB\_record\_typeconstr\_name}}{}
}}


\newcommand{\ottdruleJdomEBXXrecordXXfieldXXname}[1]{\ottdrule[#1]{%
}{
\ottkw{dom} \, ( \, \ottnt{field\_name} \, : \, \forall \, \ottnt{type\_params\_opt} \, , \, \ottnt{typeconstr\_name} \, \rightarrow \, \ottnt{typexpr} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{field\_name}}{
{\ottdrulename{JdomEB\_record\_field\_name}}{}
}}


\newcommand{\ottdruleJdomEBXXlocation}[1]{\ottdrule[#1]{%
}{
\ottkw{dom} \, ( \, \ottmv{location} \, : \, \ottnt{t} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottmv{location}}{
{\ottdrulename{JdomEB\_location}}{}
}}

\newcommand{\ottdefnJdomEB}[1]{\begin{ottdefnblock}[#1]{$\ottkw{dom} \, ( \, \ottnt{EB} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{name}$}{\ottcom{Environment binding domain}}
\ottusedrule{\ottdruleJdomEBXXtypeXXparam{}}
\ottusedrule{\ottdruleJdomEBXXvalueXXname{}}
\ottusedrule{\ottdruleJdomEBXXconstXXconstrXXname{}}
\ottusedrule{\ottdruleJdomEBXXconstrXXname{}}
\ottusedrule{\ottdruleJdomEBXXopaqueXXtypeconstrXXname{}}
\ottusedrule{\ottdruleJdomEBXXtransXXtypeconstrXXname{}}
\ottusedrule{\ottdruleJdomEBXXrecordXXtypeconstrXXname{}}
\ottusedrule{\ottdruleJdomEBXXrecordXXfieldXXname{}}
\ottusedrule{\ottdruleJdomEBXXlocation{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJdomEB}{
\ottdefnJdomEB{}}


% defns JdomE
% defn domE
\newcommand{\ottdruleJdomEXXempty}[1]{\ottdrule[#1]{%
}{
\ottkw{dom} \, ( \, \ottkw{empty} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \,}{
{\ottdrulename{JdomE\_empty}}{}
}}


\newcommand{\ottdruleJdomEXXcons}[1]{\ottdrule[#1]{%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{name_{{\mathrm{1}}}} \, .. \, \ottnt{name_{\ottmv{n}}}}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{EB} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{name}}%
}{
\ottkw{dom} \, ( \,  \ottenvironmentappend{ \ottnt{E} }{ \ottnt{EB} }  \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{name} \, \ottnt{name_{{\mathrm{1}}}} \, .. \, \ottnt{name_{\ottmv{n}}}}{
{\ottdrulename{JdomE\_cons}}{}
}}

\newcommand{\ottdefnJdomE}[1]{\begin{ottdefnblock}[#1]{$\ottkw{dom} \, ( \, \ottnt{E} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{names}$}{\ottcom{Environment domain}}
\ottusedrule{\ottdruleJdomEXXempty{}}
\ottusedrule{\ottdruleJdomEXXcons{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJdomE}{
\ottdefnJdomE{}}


% defns Jlookup
% defn EB
\newcommand{\ottdruleJlookupXXEBXXrecOne}[1]{\ottdrule[#1]{%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{EB} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{name'}}%
\ottpremise{\ottnt{name} \, \not = \, \ottnt{name'}}%
\ottpremise{\ottnt{name'} \, \not = \, \ottkw{TV}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{EB'}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ \ottnt{EB} }  \, \vdash \, \ottnt{name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{EB'}}{
{\ottdrulename{Jlookup\_EB\_rec1}}{}
}}


\newcommand{\ottdruleJlookupXXEBXXrecTwo}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{name} \, \not = \, \ottkw{TV}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{EB'}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ \ottkw{TV} }  \, \vdash \, \ottnt{name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottkw{shift} \, 0 \, 1 \, \ottnt{EB'}}{
{\ottdrulename{Jlookup\_EB\_rec2}}{}
}}


\newcommand{\ottdruleJlookupXXEBXXhead}[1]{\ottdrule[#1]{%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{EB} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{name}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ \ottnt{EB} }  \, \vdash \, \ottnt{name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{EB}}{
{\ottdrulename{Jlookup\_EB\_head}}{}
}}

\newcommand{\ottdefnJlookupXXEB}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{EB}$}{\ottcom{Environment lookup}}
\ottusedrule{\ottdruleJlookupXXEBXXrecOne{}}
\ottusedrule{\ottdruleJlookupXXEBXXrecTwo{}}
\ottusedrule{\ottdruleJlookupXXEBXXhead{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJlookup}{
\ottdefnJlookupXXEB{}}


% defns Jidx
% defn bound
\newcommand{\ottdruleJidxXXboundXXskipOne}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{idx} \, \ottkw{bound}}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{EB} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{name}}%
\ottpremise{\ottnt{name} \, \not = \, \ottkw{TV}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ \ottnt{EB} }  \, \vdash \, \ottnt{idx} \, \ottkw{bound}}{
{\ottdrulename{Jidx\_bound\_skip1}}{}
}}


\newcommand{\ottdruleJidxXXboundXXskipTwo}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{idx} \, \ottkw{bound}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ \ottkw{TV} }  \, \vdash \, \ottnt{idx} \, + \, 1 \, \ottkw{bound}}{
{\ottdrulename{Jidx\_bound\_skip2}}{}
}}


\newcommand{\ottdruleJidxXXboundXXfound}[1]{\ottdrule[#1]{%
}{
 \ottenvironmentappend{ \ottnt{E} }{ \ottkw{TV} }  \, \vdash \, 0 \, \ottkw{bound}}{
{\ottdrulename{Jidx\_bound\_found}}{}
}}

\newcommand{\ottdefnJidxXXbound}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{idx} \, \ottkw{bound}$}{\ottcom{Well-formed index}}
\ottusedrule{\ottdruleJidxXXboundXXskipOne{}}
\ottusedrule{\ottdruleJidxXXboundXXskipTwo{}}
\ottusedrule{\ottdruleJidxXXboundXXfound{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJidx}{
\ottdefnJidxXXbound{}}


% defns JTtps_kind
% defn tps_kind
\newcommand{\ottdruleJTtpsXXkindXXkind}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{tp_{{\mathrm{1}}}} \, ... \, \ottnt{tp_{\ottmv{n}}} \, \ottkw{distinct}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{tp_{{\mathrm{1}}}} \, ) \, ... \, ( \, \ottnt{tp_{\ottmv{n}}} \, ) \, = \, \ottmv{n}}%
}{
\vdash \, ( \, \ottnt{tp_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{tp_{\ottmv{n}}} \, ) \, : \,  \ottkw{Type}^{ \ottmv{n} }\rightarrow \ottkw{Type} }{
{\ottdrulename{JTtps\_kind\_kind}}{}
}}

\newcommand{\ottdefnJTtpsXXkind}[1]{\begin{ottdefnblock}[#1]{$\vdash \, \ottnt{type\_params\_opt} \, : \, \ottnt{kind}$}{\ottcom{Type parameter kinding}}
\ottusedrule{\ottdruleJTtpsXXkindXXkind{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTtpsXXkind}{
\ottdefnJTtpsXXkind{}}


% defns JTEok
% defn Eok
\newcommand{\ottdruleJTEokXXempty}[1]{\ottdrule[#1]{%
}{
\ottkw{empty} \, \vdash \, \ottkw{ok}}{
{\ottdrulename{JTEok\_empty}}{}
}}


\newcommand{\ottdruleJTEokXXtypevar}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ \ottkw{TV} }  \, \vdash \, \ottkw{ok}}{
{\ottdrulename{JTEok\_typevar}}{}
}}


\newcommand{\ottdruleJTEokXXvalueXXname}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \forall \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ ( \, \ottnt{value\_name} \, : \, \forall \, \ottnt{t} \, ) }  \, \vdash \, \ottkw{ok}}{
{\ottdrulename{JTEok\_value\_name}}{}
}}


\newcommand{\ottdruleJTEokXXconstrXXnameXXc}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{typeconstr\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{typeconstr\_name} \, : \, \ottnt{kind}}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{names}}%
\ottpremise{\ottnt{constr\_name} \, \notin \, \ottnt{names}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ ( \, \ottnt{constr\_name} \, \ottkw{of} \, \ottnt{typeconstr\_name} \, ) }  \, \vdash \, \ottkw{ok}}{
{\ottdrulename{JTEok\_constr\_name\_c}}{}
}}


\newcommand{\ottdruleJTEokXXexnXXconstrXXnameXXc}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{names}}%
\ottpremise{\ottnt{constr\_name} \, \notin \, \ottnt{names}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ ( \, \ottnt{constr\_name} \, \ottkw{of} \, \ottkw{exn} \, ) }  \, \vdash \, \ottkw{ok}}{
{\ottdrulename{JTEok\_exn\_constr\_name\_c}}{}
}}


\newcommand{\ottdruleJTEokXXconstrXXnameXXp}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{type\_params\_opt} \, = \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{m}} \, )}%
\ottpremise{\ottnt{E} \, \vdash \, \forall \, \ottnt{type\_params\_opt} \, , \, \ottnt{t_{{\mathrm{1}}}} \, : \, \ottkw{Type} \quad ... \quad \ottnt{E} \, \vdash \, \forall \, \ottnt{type\_params\_opt} \, , \, \ottnt{t_{\ottmv{n}}} \, : \, \ottkw{Type}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{typeconstr\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{typeconstr\_name} \, : \,  \ottkw{Type}^{ \ottmv{m} }\rightarrow \ottkw{Type} }%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{names}}%
\ottpremise{\ottnt{constr\_name} \, \notin \, \ottnt{names}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{t_{{\mathrm{1}}}} \, ) \, ... \, ( \, \ottnt{t_{\ottmv{n}}} \, ) \, \geq \, 1}%
\ottpremise{\ottkw{length} \, ( \, \alpha_{{\mathrm{1}}} \, ) \, ... \, ( \, \alpha_{\ottmv{m}} \, ) \, = \, \ottmv{m}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ ( \, \ottnt{constr\_name} \, \ottkw{of} \, \forall \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{m}} \, ) \, , \, ( \, \ottnt{t_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t_{\ottmv{n}}} \, ) \, : \, \ottnt{typeconstr\_name} \, ) }  \, \vdash \, \ottkw{ok}}{
{\ottdrulename{JTEok\_constr\_name\_p}}{}
}}


\newcommand{\ottdruleJTEokXXexnXXconstrXXnameXXp}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, : \, \ottkw{Type} \quad ... \quad \ottnt{E} \, \vdash \, \ottnt{t_{\ottmv{n}}} \, : \, \ottkw{Type}}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{names}}%
\ottpremise{\ottnt{constr\_name} \, \notin \, \ottnt{names}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{t_{{\mathrm{1}}}} \, ) \, ... \, ( \, \ottnt{t_{\ottmv{n}}} \, ) \, \geq \, 1}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ ( \, \ottnt{constr\_name} \, \ottkw{of} \, \forall \,  \, , \, ( \, \ottnt{t_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t_{\ottmv{n}}} \, ) \, : \, \ottkw{exn} \, ) }  \, \vdash \, \ottkw{ok}}{
{\ottdrulename{JTEok\_exn\_constr\_name\_p}}{}
}}


\newcommand{\ottdruleJTEokXXrecordXXdestr}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \forall \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{m}} \, ) \, , \, \ottnt{t} \, : \, \ottkw{Type}}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{names}}%
\ottpremise{\ottnt{field\_name} \, \notin \, \ottnt{names}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{typeconstr\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{typeconstr\_name} \, : \,  \ottkw{Type}^{ \ottmv{m} }\rightarrow \ottkw{Type}  \, \ottkw{\{} \, \ottnt{field\_name_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{n}}} \, \ottkw{\}}}%
\ottpremise{\ottkw{length} \, ( \, \alpha_{{\mathrm{1}}} \, ) \, ... \, ( \, \alpha_{\ottmv{m}} \, ) \, = \, \ottmv{m}}%
\ottpremise{\ottnt{field\_name} \, \ottkw{in} \, \ottnt{field\_name_{{\mathrm{1}}}} \, ... \, \ottnt{field\_name_{\ottmv{n}}}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ ( \, \ottnt{field\_name} \, : \, \forall \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{m}} \, ) \, , \, \ottnt{typeconstr\_name} \, \rightarrow \, \ottnt{t} \, ) }  \, \vdash \, \ottkw{ok}}{
{\ottdrulename{JTEok\_record\_destr}}{}
}}


\newcommand{\ottdruleJTEokXXtypeconstrXXname}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{names}}%
\ottpremise{\ottnt{typeconstr\_name} \, \notin \, \ottnt{names}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ ( \, \ottnt{typeconstr\_name} \, : \, \ottnt{kind} \, ) }  \, \vdash \, \ottkw{ok}}{
{\ottdrulename{JTEok\_typeconstr\_name}}{}
}}


\newcommand{\ottdruleJTEokXXtypeconstrXXeqn}[1]{\ottdrule[#1]{%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{names}}%
\ottpremise{\ottnt{typeconstr\_name} \, \notin \, \ottnt{names}}%
\ottpremise{\ottnt{E} \, \vdash \, \forall \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{m}} \, ) \, , \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ ( \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{m}} \, ) \, \ottnt{typeconstr\_name} \, = \, \ottnt{t} \, ) }  \, \vdash \, \ottkw{ok}}{
{\ottdrulename{JTEok\_typeconstr\_eqn}}{}
}}


\newcommand{\ottdruleJTEokXXtypeconstrXXrecord}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{names}}%
\ottpremise{\ottnt{typeconstr\_name} \, \notin \, \ottnt{names}}%
\ottpremise{\ottnt{field\_name_{{\mathrm{1}}}} \, ... \, \ottnt{field\_name_{\ottmv{n}}} \, \ottkw{distinct}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ ( \, \ottnt{typeconstr\_name} \, : \, \ottnt{kind} \, \ottkw{\{} \, \ottnt{field\_name_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{n}}} \, \ottkw{\}} \, ) }  \, \vdash \, \ottkw{ok}}{
{\ottdrulename{JTEok\_typeconstr\_record}}{}
}}


\newcommand{\ottdruleJTEokXXlocation}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{names}}%
\ottpremise{\ottmv{location} \, \notin \, \ottnt{names}}%
}{
 \ottenvironmentappend{ \ottnt{E} }{ ( \, \ottmv{location} \, : \, \ottnt{t} \, ) }  \, \vdash \, \ottkw{ok}}{
{\ottdrulename{JTEok\_location}}{}
}}

\newcommand{\ottdefnJTEok}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottkw{ok}$}{\ottcom{Environment validity}}
\ottusedrule{\ottdruleJTEokXXempty{}}
\ottusedrule{\ottdruleJTEokXXtypevar{}}
\ottusedrule{\ottdruleJTEokXXvalueXXname{}}
\ottusedrule{\ottdruleJTEokXXconstrXXnameXXc{}}
\ottusedrule{\ottdruleJTEokXXexnXXconstrXXnameXXc{}}
\ottusedrule{\ottdruleJTEokXXconstrXXnameXXp{}}
\ottusedrule{\ottdruleJTEokXXexnXXconstrXXnameXXp{}}
\ottusedrule{\ottdruleJTEokXXrecordXXdestr{}}
\ottusedrule{\ottdruleJTEokXXtypeconstrXXname{}}
\ottusedrule{\ottdruleJTEokXXtypeconstrXXeqn{}}
\ottusedrule{\ottdruleJTEokXXtypeconstrXXrecord{}}
\ottusedrule{\ottdruleJTEokXXlocation{}}
\end{ottdefnblock}}


% defn typeconstr
\newcommand{\ottdruleJTtypeconstrXXabstract}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{typeconstr\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{typeconstr\_name} \, : \, \ottnt{kind}}%
}{
\ottnt{E} \, \vdash \, \ottnt{typeconstr\_name} \, : \, \ottnt{kind}}{
{\ottdrulename{JTtypeconstr\_abstract}}{}
}}


\newcommand{\ottdruleJTtypeconstrXXconcrete}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{typeconstr\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{type\_params\_opt} \, \ottnt{typeconstr\_name} \, = \, \ottnt{t}}%
\ottpremise{\vdash \, \ottnt{type\_params\_opt} \, : \, \ottnt{kind}}%
}{
\ottnt{E} \, \vdash \, \ottnt{typeconstr\_name} \, : \, \ottnt{kind}}{
{\ottdrulename{JTtypeconstr\_concrete}}{}
}}


\newcommand{\ottdruleJTtypeconstrXXrecord}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{typeconstr\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{typeconstr\_name} \, : \, \ottnt{kind} \, \ottkw{\{} \, \ottnt{field\_name_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{n}}} \, \ottkw{\}}}%
}{
\ottnt{E} \, \vdash \, \ottnt{typeconstr\_name} \, : \, \ottnt{kind}}{
{\ottdrulename{JTtypeconstr\_record}}{}
}}


\newcommand{\ottdruleJTtypeconstrXXint}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{int} \, : \, \ottkw{Type}}{
{\ottdrulename{JTtypeconstr\_int}}{}
}}


\newcommand{\ottdruleJTtypeconstrXXchar}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{char} \, : \, \ottkw{Type}}{
{\ottdrulename{JTtypeconstr\_char}}{}
}}


\newcommand{\ottdruleJTtypeconstrXXstring}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{string} \, : \, \ottkw{Type}}{
{\ottdrulename{JTtypeconstr\_string}}{}
}}


\newcommand{\ottdruleJTtypeconstrXXfloat}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{float} \, : \, \ottkw{Type}}{
{\ottdrulename{JTtypeconstr\_float}}{}
}}


\newcommand{\ottdruleJTtypeconstrXXbool}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{bool} \, : \, \ottkw{Type}}{
{\ottdrulename{JTtypeconstr\_bool}}{}
}}


\newcommand{\ottdruleJTtypeconstrXXunit}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{unit} \, : \, \ottkw{Type}}{
{\ottdrulename{JTtypeconstr\_unit}}{}
}}


\newcommand{\ottdruleJTtypeconstrXXexn}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{exn} \, : \, \ottkw{Type}}{
{\ottdrulename{JTtypeconstr\_exn}}{}
}}


\newcommand{\ottdruleJTtypeconstrXXlist}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{list} \, : \,  \ottkw{Type}^{ 1 }\rightarrow \ottkw{Type} }{
{\ottdrulename{JTtypeconstr\_list}}{}
}}


\newcommand{\ottdruleJTtypeconstrXXoption}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{option} \, : \,  \ottkw{Type}^{ 1 }\rightarrow \ottkw{Type} }{
{\ottdrulename{JTtypeconstr\_option}}{}
}}


\newcommand{\ottdruleJTtypeconstrXXref}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{ref} \, : \,  \ottkw{Type}^{ 1 }\rightarrow \ottkw{Type} }{
{\ottdrulename{JTtypeconstr\_ref}}{}
}}

\newcommand{\ottdefnJTtypeconstr}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{typeconstr} \, : \, \ottnt{kind}$}{\ottcom{Type constructor kinding}}
\ottusedrule{\ottdruleJTtypeconstrXXabstract{}}
\ottusedrule{\ottdruleJTtypeconstrXXconcrete{}}
\ottusedrule{\ottdruleJTtypeconstrXXrecord{}}
\ottusedrule{\ottdruleJTtypeconstrXXint{}}
\ottusedrule{\ottdruleJTtypeconstrXXchar{}}
\ottusedrule{\ottdruleJTtypeconstrXXstring{}}
\ottusedrule{\ottdruleJTtypeconstrXXfloat{}}
\ottusedrule{\ottdruleJTtypeconstrXXbool{}}
\ottusedrule{\ottdruleJTtypeconstrXXunit{}}
\ottusedrule{\ottdruleJTtypeconstrXXexn{}}
\ottusedrule{\ottdruleJTtypeconstrXXlist{}}
\ottusedrule{\ottdruleJTtypeconstrXXoption{}}
\ottusedrule{\ottdruleJTtypeconstrXXref{}}
\end{ottdefnblock}}


% defn ts
\newcommand{\ottdruleJTtsXXforall}[1]{\ottdrule[#1]{%
\ottpremise{ \ottenvironmentappend{ \ottnt{E} }{ \ottkw{TV} }  \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, \forall \, \ottnt{t} \, : \, \ottkw{Type}}{
{\ottdrulename{JTts\_forall}}{}
}}

\newcommand{\ottdefnJTts}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{typescheme} \, : \, \ottnt{kind}$}{\ottcom{de Bruijn type scheme well-formedness}}
\ottusedrule{\ottdruleJTtsXXforall{}}
\end{ottdefnblock}}


% defn tsnamed
\newcommand{\ottdruleJTtsnamedXXforall}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \{\!\!\{ \, \alpha_{{\mathrm{1}}} \, \!\!\leftarrow\!\! \, \ottkw{unit} \, , \, ... \, , \, \alpha_{\ottmv{n}} \, \!\!\leftarrow\!\! \, \ottkw{unit} \, \}\!\!\} \, \ottnt{t} \, : \, \ottkw{Type}}%
\ottpremise{\alpha_{{\mathrm{1}}} \, ... \, \alpha_{\ottmv{n}} \, \ottkw{distinct}}%
}{
\ottnt{E} \, \vdash \, \forall \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{n}} \, ) \, , \, \ottnt{t} \, : \, \ottkw{Type}}{
{\ottdrulename{JTtsnamed\_forall}}{}
}}

\newcommand{\ottdefnJTtsnamed}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \forall \, \ottnt{type\_params\_opt} \, , \, \ottnt{t} \, : \, \ottnt{kind}$}{\ottcom{Named type scheme well-formedness}}
\ottusedrule{\ottdruleJTtsnamedXXforall{}}
\end{ottdefnblock}}


% defn t
\newcommand{\ottdruleJTtXXvar}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{idx} \, \ottkw{bound}}%
}{
\ottnt{E} \, \vdash \, < \, \ottnt{idx} \, , \, \ottnt{num} \, > \, : \, \ottkw{Type}}{
{\ottdrulename{JTt\_var}}{}
}}


\newcommand{\ottdruleJTtXXarrow}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t'} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, \ottnt{t} \, \rightarrow \, \ottnt{t'} \, : \, \ottkw{Type}}{
{\ottdrulename{JTt\_arrow}}{}
}}


\newcommand{\ottdruleJTtXXtuple}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, : \, \ottkw{Type} \quad .... \quad \ottnt{E} \, \vdash \, \ottnt{t_{\ottmv{n}}} \, : \, \ottkw{Type}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{t_{{\mathrm{1}}}} \, ) \, .... \, ( \, \ottnt{t_{\ottmv{n}}} \, ) \, \geq \, 2}%
}{
\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, \ast \, .... \, \ast \, \ottnt{t_{\ottmv{n}}} \, : \, \ottkw{Type}}{
{\ottdrulename{JTt\_tuple}}{}
}}


\newcommand{\ottdruleJTtXXconstr}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{typeconstr} \, : \,  \ottkw{Type}^{ \ottmv{n} }\rightarrow \ottkw{Type} }%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, : \, \ottkw{Type} \quad ... \quad \ottnt{E} \, \vdash \, \ottnt{t_{\ottmv{n}}} \, : \, \ottkw{Type}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{t_{{\mathrm{1}}}} \, ) \, ... \, ( \, \ottnt{t_{\ottmv{n}}} \, ) \, = \, \ottmv{n}}%
}{
\ottnt{E} \, \vdash \, ( \, \ottnt{t_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t_{\ottmv{n}}} \, ) \, \ottnt{typeconstr} \, : \, \ottkw{Type}}{
{\ottdrulename{JTt\_constr}}{}
}}

\newcommand{\ottdefnJTt}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{typexpr} \, : \, \ottnt{kind}$}{\ottcom{Type expression well-formedness}}
\ottusedrule{\ottdruleJTtXXvar{}}
\ottusedrule{\ottdruleJTtXXarrow{}}
\ottusedrule{\ottdruleJTtXXtuple{}}
\ottusedrule{\ottdruleJTtXXconstr{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTEok}{
\ottdefnJTEok{}
\ottdefnJTtypeconstr{}
\ottdefnJTts{}
\ottdefnJTtsnamed{}
\ottdefnJTt{}}


% defns JTeq
% defn eq
\newcommand{\ottdruleJTeqXXrefl}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, \ottnt{t} \, \equiv \, \ottnt{t}}{
{\ottdrulename{JTeq\_refl}}{}
}}


\newcommand{\ottdruleJTeqXXsym}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t'} \, \equiv \, \ottnt{t}}%
}{
\ottnt{E} \, \vdash \, \ottnt{t} \, \equiv \, \ottnt{t'}}{
{\ottdrulename{JTeq\_sym}}{}
}}


\newcommand{\ottdruleJTeqXXtrans}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \equiv \, \ottnt{t'}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t'} \, \equiv \, \ottnt{t''}}%
}{
\ottnt{E} \, \vdash \, \ottnt{t} \, \equiv \, \ottnt{t''}}{
{\ottdrulename{JTeq\_trans}}{}
}}


\newcommand{\ottdruleJTeqXXexpand}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{typeconstr\_name} \, \;\vartriangleright\;\ottmaybebreakline \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{n}} \, ) \, \ottnt{typeconstr\_name} \, = \, \ottnt{t}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, : \, \ottkw{Type} \quad ... \quad \ottnt{E} \, \vdash \, \ottnt{t_{\ottmv{n}}} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, ( \, \ottnt{t_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t_{\ottmv{n}}} \, ) \, \ottnt{typeconstr\_name} \, \equiv \, \{\!\!\{ \, \alpha_{{\mathrm{1}}} \, \!\!\leftarrow\!\! \, \ottnt{t_{{\mathrm{1}}}} \, , \, ... \, , \, \alpha_{\ottmv{n}} \, \!\!\leftarrow\!\! \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, \ottnt{t}}{
{\ottdrulename{JTeq\_expand}}{}
}}


\newcommand{\ottdruleJTeqXXarrow}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, \equiv \, \ottnt{t'_{{\mathrm{1}}}}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{2}}}} \, \equiv \, \ottnt{t'_{{\mathrm{2}}}}}%
}{
\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{t_{{\mathrm{2}}}} \, \equiv \, \ottnt{t'_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{t'_{{\mathrm{2}}}}}{
{\ottdrulename{JTeq\_arrow}}{}
}}


\newcommand{\ottdruleJTeqXXtuple}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, \equiv \, \ottnt{t'_{{\mathrm{1}}}} \quad .... \quad \ottnt{E} \, \vdash \, \ottnt{t_{\ottmv{n}}} \, \equiv \, \ottnt{t'_{\ottmv{n}}}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{t_{{\mathrm{1}}}} \, ) \, .... \, ( \, \ottnt{t_{\ottmv{n}}} \, ) \, \geq \, 2}%
}{
\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, \ast \, .... \, \ast \, \ottnt{t_{\ottmv{n}}} \, \equiv \, \ottnt{t'_{{\mathrm{1}}}} \, \ast \, .... \, \ast \, \ottnt{t'_{\ottmv{n}}}}{
{\ottdrulename{JTeq\_tuple}}{}
}}


\newcommand{\ottdruleJTeqXXconstr}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{typeconstr} \, : \,  \ottkw{Type}^{ \ottmv{n} }\rightarrow \ottkw{Type} }%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, \equiv \, \ottnt{t'_{{\mathrm{1}}}} \quad ... \quad \ottnt{E} \, \vdash \, \ottnt{t_{\ottmv{n}}} \, \equiv \, \ottnt{t'_{\ottmv{n}}}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{t_{{\mathrm{1}}}} \, ) \, ... \, ( \, \ottnt{t_{\ottmv{n}}} \, ) \, = \, \ottmv{n}}%
}{
\ottnt{E} \, \vdash \, ( \, \ottnt{t_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t_{\ottmv{n}}} \, ) \, \ottnt{typeconstr} \, \equiv \, ( \, \ottnt{t'_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t'_{\ottmv{n}}} \, ) \, \ottnt{typeconstr}}{
{\ottdrulename{JTeq\_constr}}{}
}}

\newcommand{\ottdefnJTeq}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{typexpr} \, \equiv \, \ottnt{typexpr'}$}{\ottcom{Type equivalence}}
\ottusedrule{\ottdruleJTeqXXrefl{}}
\ottusedrule{\ottdruleJTeqXXsym{}}
\ottusedrule{\ottdruleJTeqXXtrans{}}
\ottusedrule{\ottdruleJTeqXXexpand{}}
\ottusedrule{\ottdruleJTeqXXarrow{}}
\ottusedrule{\ottdruleJTeqXXtuple{}}
\ottusedrule{\ottdruleJTeqXXconstr{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTeq}{
\ottdefnJTeq{}}


% defns JTidxsub
% defn idxsub
\newcommand{\ottdruleJTinxsubXXalpha}[1]{\ottdrule[#1]{%
}{
\{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, \alpha \, \;\vartriangleright\;\ottmaybebreakline \, \alpha}{
{\ottdrulename{JTinxsub\_alpha}}{}
}}


\newcommand{\ottdruleJTinxsubXXidxZero}[1]{\ottdrule[#1]{%
\ottpremise{\ottkw{length} \, ( \, \ottnt{t_{{\mathrm{1}}}} \, ) \, .. \, ( \, \ottnt{t_{\ottmv{m}}} \, ) \, = \, \ottnt{num}}%
}{
\{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{m}}} \, , \, \ottnt{t'} \, , \, \ottnt{t''_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t''_{\ottmv{n}}} \, \}\!\!\} \, < \, 0 \, , \, \ottnt{num} \, > \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{t'}}{
{\ottdrulename{JTinxsub\_idx0}}{}
}}


\newcommand{\ottdruleJTinxsubXXidxOne}[1]{\ottdrule[#1]{%
\ottpremise{\ottkw{length} \, ( \, \ottnt{t_{{\mathrm{1}}}} \, ) \, .. \, ( \, \ottnt{t_{\ottmv{n}}} \, ) \, \leq \, \ottnt{num}}%
}{
\{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, < \, 0 \, , \, \ottnt{num} \, > \, \;\vartriangleright\;\ottmaybebreakline \, \ottkw{unit}}{
{\ottdrulename{JTinxsub\_idx1}}{}
}}


\newcommand{\ottdruleJTinxsubXXidxTwo}[1]{\ottdrule[#1]{%
}{
\{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, < \, \ottnt{idx} \, + \, 1 \, , \, \ottnt{num} \, > \, \;\vartriangleright\;\ottmaybebreakline \, < \, \ottnt{idx} \, , \, \ottnt{num} \, >}{
{\ottdrulename{JTinxsub\_idx2}}{}
}}


\newcommand{\ottdruleJTinxsubXXany}[1]{\ottdrule[#1]{%
}{
\{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, \ottkw{\_} \, \;\vartriangleright\;\ottmaybebreakline \, \ottkw{\_}}{
{\ottdrulename{JTinxsub\_any}}{}
}}


\newcommand{\ottdruleJTinxsubXXarrow}[1]{\ottdrule[#1]{%
\ottpremise{\{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, \ottnt{t'_{{\mathrm{1}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{t''_{{\mathrm{1}}}}}%
\ottpremise{\{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, \ottnt{t'_{{\mathrm{2}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{t''_{{\mathrm{2}}}}}%
}{
\{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, ( \, \ottnt{t'_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{t'_{{\mathrm{2}}}} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{t''_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{t''_{{\mathrm{2}}}}}{
{\ottdrulename{JTinxsub\_arrow}}{}
}}


\newcommand{\ottdruleJTinxsubXXtuple}[1]{\ottdrule[#1]{%
\ottpremise{\{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, \ottnt{t'_{{\mathrm{1}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{t''_{{\mathrm{1}}}} \quad .... \quad \{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, \ottnt{t'_{\ottmv{m}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{t''_{\ottmv{m}}}}%
}{
\{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, ( \, \ottnt{t'_{{\mathrm{1}}}} \, \ast \, .... \, \ast \, \ottnt{t'_{\ottmv{m}}} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, ( \, \ottnt{t''_{{\mathrm{1}}}} \, \ast \, .... \, \ast \, \ottnt{t''_{\ottmv{m}}} \, )}{
{\ottdrulename{JTinxsub\_tuple}}{}
}}


\newcommand{\ottdruleJTinxsubXXtc}[1]{\ottdrule[#1]{%
\ottpremise{\{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, \ottnt{t'_{{\mathrm{1}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{t''_{{\mathrm{1}}}} \quad ... \quad \{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, \ottnt{t'_{\ottmv{m}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{t''_{\ottmv{m}}}}%
}{
\{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, ( \, \ottnt{t'_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t'_{\ottmv{m}}} \, ) \, \ottnt{typeconstr} \, \;\vartriangleright\;\ottmaybebreakline \, ( \, \ottnt{t''_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t''_{\ottmv{m}}} \, ) \, \ottnt{typeconstr}}{
{\ottdrulename{JTinxsub\_tc}}{}
}}

\newcommand{\ottdefnJTidxsub}[1]{\begin{ottdefnblock}[#1]{$\{\!\!\{ \, \ottnt{typexpr_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{typexpr_{\ottmv{n}}} \, \}\!\!\} \, \ottnt{typexpr'} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{typexpr''}$}{\ottcom{de Bruin type substitution}}
\ottusedrule{\ottdruleJTinxsubXXalpha{}}
\ottusedrule{\ottdruleJTinxsubXXidxZero{}}
\ottusedrule{\ottdruleJTinxsubXXidxOne{}}
\ottusedrule{\ottdruleJTinxsubXXidxTwo{}}
\ottusedrule{\ottdruleJTinxsubXXany{}}
\ottusedrule{\ottdruleJTinxsubXXarrow{}}
\ottusedrule{\ottdruleJTinxsubXXtuple{}}
\ottusedrule{\ottdruleJTinxsubXXtc{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTidxsub}{
\ottdefnJTidxsub{}}


% defns JTinst
% defn inst
\newcommand{\ottdruleJTinstXXidx}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \forall \, \ottnt{t'} \, : \, \ottkw{Type}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, : \, \ottkw{Type} \quad .. \quad \ottnt{E} \, \vdash \, \ottnt{t_{\ottmv{n}}} \, : \, \ottkw{Type}}%
\ottpremise{\{\!\!\{ \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, \ottnt{t'} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{t''}}%
}{
\ottnt{E} \, \vdash \, \ottnt{t''} \, \leq \, \forall \, \ottnt{t'}}{
{\ottdrulename{JTinst\_idx}}{}
}}

\newcommand{\ottdefnJTinst}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{typexpr} \, \leq \, \ottnt{typescheme}$}{\ottcom{de Bruijn type scheme instantiation}}
\ottusedrule{\ottdruleJTinstXXidx{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTinst}{
\ottdefnJTinst{}}


% defns JTinst_named
% defn inst_named
\newcommand{\ottdruleJTinstXXnamedXXnamed}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \forall \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{n}} \, ) \, , \, \ottnt{t} \, : \, \ottkw{Type}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, : \, \ottkw{Type} \quad ... \quad \ottnt{E} \, \vdash \, \ottnt{t_{\ottmv{n}}} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, \{\!\!\{ \, \alpha_{{\mathrm{1}}} \, \!\!\leftarrow\!\! \, \ottnt{t_{{\mathrm{1}}}} \, , \, ... \, , \, \alpha_{\ottmv{n}} \, \!\!\leftarrow\!\! \, \ottnt{t_{\ottmv{n}}} \, \}\!\!\} \, \ottnt{t} \, \leq \, \forall \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{n}} \, ) \, , \, \ottnt{t}}{
{\ottdrulename{JTinst\_named\_named}}{}
}}

\newcommand{\ottdefnJTinstXXnamed}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{typexpr} \, \leq \, \forall \, \ottnt{type\_params\_opt} \, , \, \ottnt{typexpr'}$}{\ottcom{Named type scheme instantiation}}
\ottusedrule{\ottdruleJTinstXXnamedXXnamed{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTinstXXnamed}{
\ottdefnJTinstXXnamed{}}


% defns JTinst_any
% defn inst_any
\newcommand{\ottdruleJTinstXXanyXXtyvar}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, < \, \ottnt{idx} \, , \, \ottnt{num} \, > \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, < \, \ottnt{idx} \, , \, \ottnt{num} \, > \, \leq \, < \, \ottnt{idx} \, , \, \ottnt{num} \, >}{
{\ottdrulename{JTinst\_any\_tyvar}}{}
}}


\newcommand{\ottdruleJTinstXXanyXXany}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, \ottnt{t} \, \leq \, \ottkw{\_}}{
{\ottdrulename{JTinst\_any\_any}}{}
}}


\newcommand{\ottdruleJTinstXXanyXXarrow}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, \leq \, \ottnt{t'_{{\mathrm{1}}}}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{2}}}} \, \leq \, \ottnt{t'_{{\mathrm{2}}}}}%
}{
\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{t_{{\mathrm{2}}}} \, \leq \, \ottnt{t'_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{t'_{{\mathrm{2}}}}}{
{\ottdrulename{JTinst\_any\_arrow}}{}
}}


\newcommand{\ottdruleJTinstXXanyXXtuple}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, \leq \, \ottnt{t'_{{\mathrm{1}}}} \quad .... \quad \ottnt{E} \, \vdash \, \ottnt{t_{\ottmv{n}}} \, \leq \, \ottnt{t'_{\ottmv{n}}}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{t_{{\mathrm{1}}}} \, ) \, .... \, ( \, \ottnt{t_{\ottmv{n}}} \, ) \, \geq \, 2}%
}{
\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, \ast \, .... \, \ast \, \ottnt{t_{\ottmv{n}}} \, \leq \, \ottnt{t'_{{\mathrm{1}}}} \, \ast \, .... \, \ast \, \ottnt{t'_{\ottmv{n}}}}{
{\ottdrulename{JTinst\_any\_tuple}}{}
}}


\newcommand{\ottdruleJTinstXXanyXXctor}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, \leq \, \ottnt{t'_{{\mathrm{1}}}} \quad ... \quad \ottnt{E} \, \vdash \, \ottnt{t_{\ottmv{n}}} \, \leq \, \ottnt{t'_{\ottmv{n}}}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{typeconstr} \, : \,  \ottkw{Type}^{ \ottmv{n} }\rightarrow \ottkw{Type} }%
\ottpremise{\ottkw{length} \, ( \, \ottnt{t_{{\mathrm{1}}}} \, ) \, ... \, ( \, \ottnt{t_{\ottmv{n}}} \, ) \, = \, \ottmv{n}}%
}{
\ottnt{E} \, \vdash \, ( \, \ottnt{t_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t_{\ottmv{n}}} \, ) \, \ottnt{typeconstr} \, \leq \, ( \, \ottnt{t'_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t'_{\ottmv{n}}} \, ) \, \ottnt{typeconstr}}{
{\ottdrulename{JTinst\_any\_ctor}}{}
}}

\newcommand{\ottdefnJTinstXXany}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{typexpr} \, \leq \, \ottnt{typexpr'}$}{\ottcom{Wildcard type instantiation}}
\ottusedrule{\ottdruleJTinstXXanyXXtyvar{}}
\ottusedrule{\ottdruleJTinstXXanyXXany{}}
\ottusedrule{\ottdruleJTinstXXanyXXarrow{}}
\ottusedrule{\ottdruleJTinstXXanyXXtuple{}}
\ottusedrule{\ottdruleJTinstXXanyXXctor{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTinstXXany}{
\ottdefnJTinstXXany{}}


% defns JTval
% defn value_name
\newcommand{\ottdruleJTvalueXXnameXXvalueXXname}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{value\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{value\_name} \, : \, \ottnt{ts}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \leq \, \ottnt{ts}}%
}{
\ottnt{E} \, \vdash \, \ottnt{value\_name} \, : \, \ottnt{t}}{
{\ottdrulename{JTvalue\_name\_value\_name}}{}
}}

\newcommand{\ottdefnJTvalueXXname}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{value\_name} \, : \, \ottnt{typexpr}$}{\ottcom{Variable typing}}
\ottusedrule{\ottdruleJTvalueXXnameXXvalueXXname{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTval}{
\ottdefnJTvalueXXname{}}


% defns JTfield
% defn field
\newcommand{\ottdruleJTfieldXXname}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{field\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{field\_name} \, : \, \forall \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{m}} \, ) \, , \, \ottnt{typeconstr\_name} \, \rightarrow \, \ottnt{t}}%
\ottpremise{\ottnt{E} \, \vdash \, ( \, \ottnt{t'_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t'_{\ottmv{m}}} \, ) \, \ottnt{typeconstr\_name} \, \rightarrow \, \ottnt{t''} \, \leq \, \forall \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{m}} \, ) \, , \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{m}} \, ) \, \ottnt{typeconstr\_name} \, \rightarrow \, \ottnt{t}}%
}{
\ottnt{E} \, \vdash \, \ottnt{field\_name} \, : \, ( \, \ottnt{t'_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t'_{\ottmv{m}}} \, ) \, \ottnt{typeconstr\_name} \, \rightarrow \, \ottnt{t''}}{
{\ottdrulename{JTfield\_name}}{}
}}

\newcommand{\ottdefnJTfield}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{field\_name} \, : \, \ottnt{typexpr} \, \rightarrow \, \ottnt{typexpr'}$}{\ottcom{Field name typing}}
\ottusedrule{\ottdruleJTfieldXXname{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTfield}{
\ottdefnJTfield{}}


% defns JTconstr_p
% defn constr_p
\newcommand{\ottdruleJTconstrXXpXXname}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{constr\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{constr\_name} \, \ottkw{of} \, \forall \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{m}} \, ) \, , \, ( \, \ottnt{t_{{\mathrm{1}}}} \, , \, .... \, , \, \ottnt{t_{\ottmv{n}}} \, ) \, : \, \ottnt{typeconstr}}%
\ottpremise{\ottnt{E} \, \vdash \, ( \, \ottnt{t'_{{\mathrm{1}}}} \, \ast \, .... \, \ast \, \ottnt{t'_{\ottmv{n}}} \, ) \, \rightarrow \, ( \, \ottnt{t''_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t''_{\ottmv{m}}} \, ) \, \ottnt{typeconstr} \, \leq \, \forall \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{m}} \, ) \, , \, ( \, \ottnt{t_{{\mathrm{1}}}} \, \ast \, .... \, \ast \, \ottnt{t_{\ottmv{n}}} \, ) \, \rightarrow \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{m}} \, ) \, \ottnt{typeconstr}}%
}{
\ottnt{E} \, \vdash \, \ottnt{constr\_name} \, : \, \ottnt{t'_{{\mathrm{1}}}} \, .... \, \ottnt{t'_{\ottmv{n}}} \, \rightarrow \, ( \, \ottnt{t''_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t''_{\ottmv{m}}} \, ) \, \ottnt{typeconstr}}{
{\ottdrulename{JTconstr\_p\_name}}{}
}}


\newcommand{\ottdruleJTconstrXXpXXinvarg}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{Invalid\_argument} \, : \, \ottkw{string} \, \rightarrow \, \ottkw{exn}}{
{\ottdrulename{JTconstr\_p\_invarg}}{}
}}


\newcommand{\ottdruleJTconstrXXpXXsome}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, \ottkw{Some} \, : \, \ottnt{t} \, \rightarrow \, ( \, \ottnt{t} \, \ottkw{option} \, )}{
{\ottdrulename{JTconstr\_p\_some}}{}
}}

\newcommand{\ottdefnJTconstrXXp}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{constr} \, : \, \ottnt{typexpr_{{\mathrm{1}}}} \, ... \, \ottnt{typexpr_{\ottmv{n}}} \, \rightarrow \, \ottnt{typexpr'}$}{\ottcom{Non-constant constructor typing}}
\ottusedrule{\ottdruleJTconstrXXpXXname{}}
\ottusedrule{\ottdruleJTconstrXXpXXinvarg{}}
\ottusedrule{\ottdruleJTconstrXXpXXsome{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTconstrXXp}{
\ottdefnJTconstrXXp{}}


% defns JTconstr_c
% defn constr_c
\newcommand{\ottdruleJTconstrXXcXXconstr}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{constr\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{constr\_name} \, \ottkw{of} \, \ottnt{typeconstr\_name}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{typeconstr\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{typeconstr\_name} \, : \,  \ottkw{Type}^{ \ottmv{n} }\rightarrow \ottkw{Type} }%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, : \, \ottkw{Type} \quad ... \quad \ottnt{E} \, \vdash \, \ottnt{t_{\ottmv{n}}} \, : \, \ottkw{Type}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{t_{{\mathrm{1}}}} \, ) \, ... \, ( \, \ottnt{t_{\ottmv{n}}} \, ) \, = \, \ottmv{n}}%
}{
\ottnt{E} \, \vdash \, \ottnt{constr\_name} \, : \, ( \, \ottnt{t_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t_{\ottmv{n}}} \, ) \, \ottnt{typeconstr\_name}}{
{\ottdrulename{JTconstr\_c\_constr}}{}
}}


\newcommand{\ottdruleJTconstrXXcXXexnXXconstr}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{constr\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{constr\_name} \, \ottkw{of} \, \ottkw{exn}}%
}{
\ottnt{E} \, \vdash \, \ottnt{constr\_name} \, : \, \ottkw{exn}}{
{\ottdrulename{JTconstr\_c\_exn\_constr}}{}
}}


\newcommand{\ottdruleJTconstrXXcXXnotfound}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{Not\_found} \, : \, \ottkw{exn}}{
{\ottdrulename{JTconstr\_c\_notfound}}{}
}}


\newcommand{\ottdruleJTconstrXXcXXassertXXfail}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{Assert\_failure} \, : \, \ottkw{exn}}{
{\ottdrulename{JTconstr\_c\_assert\_fail}}{}
}}


\newcommand{\ottdruleJTconstrXXcXXmatchXXfail}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{Match\_failure} \, : \, \ottkw{exn}}{
{\ottdrulename{JTconstr\_c\_match\_fail}}{}
}}


\newcommand{\ottdruleJTconstrXXcXXdivXXbyXXZero}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{Division\_by\_zero} \, : \, \ottkw{exn}}{
{\ottdrulename{JTconstr\_c\_div\_by\_0}}{}
}}


\newcommand{\ottdruleJTconstrXXcXXnone}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, \ottkw{None} \, : \, \ottnt{t} \, \ottkw{option}}{
{\ottdrulename{JTconstr\_c\_none}}{}
}}

\newcommand{\ottdefnJTconstrXXc}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{constr} \, : \, \ottnt{typexpr}$}{\ottcom{Constant constructor typing}}
\ottusedrule{\ottdruleJTconstrXXcXXconstr{}}
\ottusedrule{\ottdruleJTconstrXXcXXexnXXconstr{}}
\ottusedrule{\ottdruleJTconstrXXcXXnotfound{}}
\ottusedrule{\ottdruleJTconstrXXcXXassertXXfail{}}
\ottusedrule{\ottdruleJTconstrXXcXXmatchXXfail{}}
\ottusedrule{\ottdruleJTconstrXXcXXdivXXbyXXZero{}}
\ottusedrule{\ottdruleJTconstrXXcXXnone{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTconstrXXc}{
\ottdefnJTconstrXXc{}}


% defns JTconst
% defn const
\newcommand{\ottdruleJTconstXXint}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottmv{integer\_literal} \, : \, \ottkw{int}}{
{\ottdrulename{JTconst\_int}}{}
}}


\newcommand{\ottdruleJTconstXXfloat}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottmv{float\_literal} \, : \, \ottkw{float}}{
{\ottdrulename{JTconst\_float}}{}
}}


\newcommand{\ottdruleJTconstXXchar}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottmv{char\_literal} \, : \, \ottkw{char}}{
{\ottdrulename{JTconst\_char}}{}
}}


\newcommand{\ottdruleJTconstXXstring}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottmv{string\_literal} \, : \, \ottkw{string}}{
{\ottdrulename{JTconst\_string}}{}
}}


\newcommand{\ottdruleJTconstXXconstr}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{constr} \, : \, \ottnt{t}}%
}{
\ottnt{E} \, \vdash \, \ottnt{constr} \, : \, \ottnt{t}}{
{\ottdrulename{JTconst\_constr}}{}
}}


\newcommand{\ottdruleJTconstXXfalse}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{false} \, : \, \ottkw{bool}}{
{\ottdrulename{JTconst\_false}}{}
}}


\newcommand{\ottdruleJTconstXXtrue}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{true} \, : \, \ottkw{bool}}{
{\ottdrulename{JTconst\_true}}{}
}}


\newcommand{\ottdruleJTconstXXunit}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{()} \, : \, \ottkw{unit}}{
{\ottdrulename{JTconst\_unit}}{}
}}


\newcommand{\ottdruleJTconstXXnil}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, \ottkw{[]} \, : \, \ottnt{t} \, \ottkw{list}}{
{\ottdrulename{JTconst\_nil}}{}
}}

\newcommand{\ottdefnJTconst}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{constant} \, : \, \ottnt{typexpr}$}{\ottcom{Constant typing}}
\ottusedrule{\ottdruleJTconstXXint{}}
\ottusedrule{\ottdruleJTconstXXfloat{}}
\ottusedrule{\ottdruleJTconstXXchar{}}
\ottusedrule{\ottdruleJTconstXXstring{}}
\ottusedrule{\ottdruleJTconstXXconstr{}}
\ottusedrule{\ottdruleJTconstXXfalse{}}
\ottusedrule{\ottdruleJTconstXXtrue{}}
\ottusedrule{\ottdruleJTconstXXunit{}}
\ottusedrule{\ottdruleJTconstXXnil{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTconst}{
\ottdefnJTconst{}}


% defns JTpat
% defn pat
\newcommand{\ottdruleJTpatXXvar}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{x} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \,  \ottenvironmentappend{ \ottkw{empty} }{ \ottnt{x} \, : \, \ottnt{t} } }{
{\ottdrulename{JTpat\_var}}{}
}}


\newcommand{\ottdruleJTpatXXany}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{\_} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottkw{empty}}{
{\ottdrulename{JTpat\_any}}{}
}}


\newcommand{\ottdruleJTpatXXconstant}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{constant} \, : \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{constant} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottkw{empty}}{
{\ottdrulename{JTpat\_constant}}{}
}}


\newcommand{\ottdruleJTpatXXalias}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}}%
\ottpremise{\ottkw{dom} \, ( \,  \ottenvironmentappend{ \ottnt{E'} }{ \ottnt{x} \, : \, \ottnt{t} }  \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{name_{{\mathrm{1}}}} \, .. \, \ottnt{name_{\ottmv{n}}}}%
\ottpremise{\ottnt{name_{{\mathrm{1}}}} \, .. \, \ottnt{name_{\ottmv{n}}} \, \ottkw{distinct}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern} \, \ottkw{as} \, \ottnt{x} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \,  \ottenvironmentappend{ \ottnt{E'} }{ \ottnt{x} \, : \, \ottnt{t} } }{
{\ottdrulename{JTpat\_alias}}{}
}}


\newcommand{\ottdruleJTpatXXtyped}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t'} \, \leq \, \sigma^T \, \ottnt{src\_t}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \equiv \, \ottnt{t'}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, ( \, \ottnt{pattern} \, : \, \ottnt{src\_t} \, ) \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}}{
{\ottdrulename{JTpat\_typed}}{}
}}


\newcommand{\ottdruleJTpatXXor}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern'} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E''}}%
\ottpremise{\ottnt{E'} \, \ottkw{PERMUTES} \, \ottnt{E''}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern} \, \ottkw{\mbox{$\mid$}} \, \ottnt{pattern'} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}}{
{\ottdrulename{JTpat\_or}}{}
}}


\newcommand{\ottdruleJTpatXXconstruct}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{constr} \, : \, \ottnt{t_{{\mathrm{1}}}} \, ... \, \ottnt{t_{\ottmv{n}}} \, \rightarrow \, \ottnt{t}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E_{{\mathrm{1}}}} \quad ... \quad \sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E_{\ottmv{n}}}}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E_{{\mathrm{1}}}} \, @ \, ... \, @ \, \ottnt{E_{\ottmv{n}}} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{name_{{\mathrm{1}}}} \, .. \, \ottnt{name_{\ottmv{m}}}}%
\ottpremise{\ottnt{name_{{\mathrm{1}}}} \, .. \, \ottnt{name_{\ottmv{m}}} \, \ottkw{distinct}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{constr} \, ( \, \ottnt{pattern_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{pattern_{\ottmv{n}}} \, ) \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E_{{\mathrm{1}}}} \, @ \, ... \, @ \, \ottnt{E_{\ottmv{n}}}}{
{\ottdrulename{JTpat\_construct}}{}
}}


\newcommand{\ottdruleJTpatXXconstructXXany}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{constr} \, : \, \ottnt{t_{{\mathrm{1}}}} \, ... \, \ottnt{t_{\ottmv{n}}} \, \rightarrow \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{constr} \, \ottkw{\_} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottkw{empty}}{
{\ottdrulename{JTpat\_construct\_any}}{}
}}


\newcommand{\ottdruleJTpatXXtuple}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E_{{\mathrm{1}}}} \quad .... \quad \sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E_{\ottmv{n}}}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{pattern_{{\mathrm{1}}}} \, ) \, .... \, ( \, \ottnt{pattern_{\ottmv{n}}} \, ) \, \geq \, 2}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E_{{\mathrm{1}}}} \, @ \, .... \, @ \, \ottnt{E_{\ottmv{n}}} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{name_{{\mathrm{1}}}} \, .. \, \ottnt{name_{\ottmv{m}}}}%
\ottpremise{\ottnt{name_{{\mathrm{1}}}} \, .. \, \ottnt{name_{\ottmv{m}}} \, \ottkw{distinct}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern_{{\mathrm{1}}}} \, , \, .... \, , \, \ottnt{pattern_{\ottmv{n}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, \ast \, .... \, \ast \, \ottnt{t_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E_{{\mathrm{1}}}} \, @ \, .... \, @ \, \ottnt{E_{\ottmv{n}}}}{
{\ottdrulename{JTpat\_tuple}}{}
}}


\newcommand{\ottdruleJTpatXXrecord}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E_{{\mathrm{1}}}} \quad ... \quad \sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E_{\ottmv{n}}}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{field\_name_{{\mathrm{1}}}} \, : \, \ottnt{t} \, \rightarrow \, \ottnt{t_{{\mathrm{1}}}} \quad ... \quad \ottnt{E} \, \vdash \, \ottnt{field\_name_{\ottmv{n}}} \, : \, \ottnt{t} \, \rightarrow \, \ottnt{t_{\ottmv{n}}}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{pattern_{{\mathrm{1}}}} \, ) \, ... \, ( \, \ottnt{pattern_{\ottmv{n}}} \, ) \, \geq \, 1}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E_{{\mathrm{1}}}} \, @ \, ... \, @ \, \ottnt{E_{\ottmv{n}}} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{name_{{\mathrm{1}}}} \, .. \, \ottnt{name_{\ottmv{m}}}}%
\ottpremise{\ottnt{name_{{\mathrm{1}}}} \, .. \, \ottnt{name_{\ottmv{m}}} \, \ottkw{distinct}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{\{} \, \ottnt{field\_name_{{\mathrm{1}}}} \, = \, \ottnt{pattern_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{n}}} \, = \, \ottnt{pattern_{\ottmv{n}}} \, \ottkw{\}} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E_{{\mathrm{1}}}} \, @ \, ... \, @ \, \ottnt{E_{\ottmv{n}}}}{
{\ottdrulename{JTpat\_record}}{}
}}


\newcommand{\ottdruleJTpatXXcons}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern'} \, : \, \ottnt{t} \, \ottkw{list} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E''}}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E'} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{name_{{\mathrm{1}}}} \, .. \, \ottnt{name_{\ottmv{m}}}}%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E''} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{name'_{{\mathrm{1}}}} \, .. \, \ottnt{name'_{\ottmv{n}}}}%
\ottpremise{\ottnt{name_{{\mathrm{1}}}} \, .. \, \ottnt{name_{\ottmv{m}}} \, \ottnt{name'_{{\mathrm{1}}}} \, .. \, \ottnt{name'_{\ottmv{n}}} \, \ottkw{distinct}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern} \, \ottkw{::} \, \ottnt{pattern'} \, : \, \ottnt{t} \, \ottkw{list} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'} \, @ \, \ottnt{E''}}{
{\ottdrulename{JTpat\_cons}}{}
}}

\newcommand{\ottdefnJTpat}[1]{\begin{ottdefnblock}[#1]{$\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern} \, : \, \ottnt{typexpr} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}$}{\ottcom{Pattern typing and binding collection}}
\ottusedrule{\ottdruleJTpatXXvar{}}
\ottusedrule{\ottdruleJTpatXXany{}}
\ottusedrule{\ottdruleJTpatXXconstant{}}
\ottusedrule{\ottdruleJTpatXXalias{}}
\ottusedrule{\ottdruleJTpatXXtyped{}}
\ottusedrule{\ottdruleJTpatXXor{}}
\ottusedrule{\ottdruleJTpatXXconstruct{}}
\ottusedrule{\ottdruleJTpatXXconstructXXany{}}
\ottusedrule{\ottdruleJTpatXXtuple{}}
\ottusedrule{\ottdruleJTpatXXrecord{}}
\ottusedrule{\ottdruleJTpatXXcons{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTpat}{
\ottdefnJTpat{}}


% defns JTuprim
% defn uprim
\newcommand{\ottdruleJTuprimXXraise}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, \ottkw{raise} \, : \, \ottkw{exn} \, \rightarrow \, \ottnt{t}}{
{\ottdrulename{JTuprim\_raise}}{}
}}


\newcommand{\ottdruleJTuprimXXnot}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{not} \, : \, \ottkw{bool} \, \rightarrow \, \ottkw{bool}}{
{\ottdrulename{JTuprim\_not}}{}
}}


\newcommand{\ottdruleJTuprimXXuminus}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \mathrel{\sim\!\!-} \, : \, \ottkw{int} \, \rightarrow \, \ottkw{int}}{
{\ottdrulename{JTuprim\_uminus}}{}
}}


\newcommand{\ottdruleJTuprimXXref}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, \ottkw{ref} \, : \, \ottnt{t} \, \rightarrow \, ( \, \ottnt{t} \, \ottkw{ref} \, )}{
{\ottdrulename{JTuprim\_ref}}{}
}}


\newcommand{\ottdruleJTuprimXXderef}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, ! \, : \, ( \, \ottnt{t} \, \ottkw{ref} \, ) \, \rightarrow \, \ottnt{t}}{
{\ottdrulename{JTuprim\_deref}}{}
}}

\newcommand{\ottdefnJTuprim}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{unary\_prim} \, : \, \ottnt{typexpr}$}{\ottcom{Unary primitive typing}}
\ottusedrule{\ottdruleJTuprimXXraise{}}
\ottusedrule{\ottdruleJTuprimXXnot{}}
\ottusedrule{\ottdruleJTuprimXXuminus{}}
\ottusedrule{\ottdruleJTuprimXXref{}}
\ottusedrule{\ottdruleJTuprimXXderef{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTuprim}{
\ottdefnJTuprim{}}


% defns JTbprim
% defn bprim
\newcommand{\ottdruleJTbprimXXequal}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, = \, : \, \ottnt{t} \, \rightarrow \, ( \, \ottnt{t} \, \rightarrow \, \ottkw{bool} \, )}{
{\ottdrulename{JTbprim\_equal}}{}
}}


\newcommand{\ottdruleJTbprimXXplus}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, + \, : \, \ottkw{int} \, \rightarrow \, ( \, \ottkw{int} \, \rightarrow \, \ottkw{int} \, )}{
{\ottdrulename{JTbprim\_plus}}{}
}}


\newcommand{\ottdruleJTbprimXXminus}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, - \, : \, \ottkw{int} \, \rightarrow \, ( \, \ottkw{int} \, \rightarrow \, \ottkw{int} \, )}{
{\ottdrulename{JTbprim\_minus}}{}
}}


\newcommand{\ottdruleJTbprimXXtimes}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ast \, : \, \ottkw{int} \, \rightarrow \, ( \, \ottkw{int} \, \rightarrow \, \ottkw{int} \, )}{
{\ottdrulename{JTbprim\_times}}{}
}}


\newcommand{\ottdruleJTbprimXXdiv}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, / \, : \, \ottkw{int} \, \rightarrow \, ( \, \ottkw{int} \, \rightarrow \, \ottkw{int} \, )}{
{\ottdrulename{JTbprim\_div}}{}
}}


\newcommand{\ottdruleJTbprimXXassign}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\ottnt{E} \, \vdash \, \ottkw{:=} \, : \, \ottnt{t} \, \ottkw{ref} \, \rightarrow \, ( \, \ottnt{t} \, \rightarrow \, \ottkw{unit} \, )}{
{\ottdrulename{JTbprim\_assign}}{}
}}

\newcommand{\ottdefnJTbprim}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{binary\_prim} \, : \, \ottnt{typexpr}$}{\ottcom{Binary primitive typing}}
\ottusedrule{\ottdruleJTbprimXXequal{}}
\ottusedrule{\ottdruleJTbprimXXplus{}}
\ottusedrule{\ottdruleJTbprimXXminus{}}
\ottusedrule{\ottdruleJTbprimXXtimes{}}
\ottusedrule{\ottdruleJTbprimXXdiv{}}
\ottusedrule{\ottdruleJTbprimXXassign{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTbprim}{
\ottdefnJTbprim{}}


% defns JTe
% defn e
\newcommand{\ottdruleJTeXXuprim}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{unary\_prim} \, : \, \ottnt{t}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \equiv \, \ottnt{t'}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, ( \, \ottkw{\%prim} \, \ottnt{unary\_prim} \, ) \, : \, \ottnt{t'}}{
{\ottdrulename{JTe\_uprim}}{}
}}


\newcommand{\ottdruleJTeXXbprim}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{binary\_prim} \, : \, \ottnt{t}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \equiv \, \ottnt{t'}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, ( \, \ottkw{\%prim} \, \ottnt{binary\_prim} \, ) \, : \, \ottnt{t'}}{
{\ottdrulename{JTe\_bprim}}{}
}}


\newcommand{\ottdruleJTeXXident}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{value\_name} \, : \, \ottnt{t}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \equiv \, \ottnt{t'}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{value\_name} \, : \, \ottnt{t'}}{
{\ottdrulename{JTe\_ident}}{}
}}


\newcommand{\ottdruleJTeXXconstant}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{constant} \, : \, \ottnt{t}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \equiv \, \ottnt{t'}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{constant} \, : \, \ottnt{t'}}{
{\ottdrulename{JTe\_constant}}{}
}}


\newcommand{\ottdruleJTeXXtyped}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e} \, : \, \ottnt{t}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t'} \, \leq \, \sigma^T \, \ottnt{src\_t}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \equiv \, \ottnt{t'}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, ( \, \ottnt{e} \, : \, \ottnt{src\_t} \, ) \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_typed}}{}
}}


\newcommand{\ottdruleJTeXXtuple}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \quad .... \quad \sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{e_{{\mathrm{1}}}} \, ) \, .... \, ( \, \ottnt{e_{\ottmv{n}}} \, ) \, \geq \, 2}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t_{{\mathrm{1}}}} \, \ast \, .... \, \ast \, \ottnt{t_{\ottmv{n}}} \, \equiv \, \ottnt{t'}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, , \, .... \, , \, \ottnt{e_{\ottmv{n}}} \, : \, \ottnt{t'}}{
{\ottdrulename{JTe\_tuple}}{}
}}


\newcommand{\ottdruleJTeXXconstruct}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{constr} \, : \, \ottnt{t_{{\mathrm{1}}}} \, ... \, \ottnt{t_{\ottmv{n}}} \, \rightarrow \, \ottnt{t}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \quad ... \quad \sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \equiv \, \ottnt{t'}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{constr} \, ( \, \ottnt{e_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{e_{\ottmv{n}}} \, ) \, : \, \ottnt{t'}}{
{\ottdrulename{JTe\_construct}}{}
}}


\newcommand{\ottdruleJTeXXcons}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottnt{t}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{2}}}} \, : \, \ottnt{t} \, \ottkw{list}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \ottkw{list} \, \equiv \, \ottnt{t'}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{::} \, \ottnt{e_{{\mathrm{2}}}} \, : \, \ottnt{t'}}{
{\ottdrulename{JTe\_cons}}{}
}}


\newcommand{\ottdruleJTeXXrecordXXconstr}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \quad ... \quad \sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{field\_name_{{\mathrm{1}}}} \, : \, \ottnt{t} \, \rightarrow \, \ottnt{t_{{\mathrm{1}}}} \quad ... \quad \ottnt{E} \, \vdash \, \ottnt{field\_name_{\ottmv{n}}} \, : \, \ottnt{t} \, \rightarrow \, \ottnt{t_{\ottmv{n}}}}%
\ottpremise{\ottnt{t} \, = \, ( \, \ottnt{t'_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t'_{\ottmv{l}}} \, ) \, \ottnt{typeconstr\_name}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{typeconstr\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{typeconstr\_name} \, : \, \ottnt{kind} \, \ottkw{\{} \, \ottnt{field\_name'_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name'_{\ottmv{m}}} \, \ottkw{\}}}%
\ottpremise{\ottnt{field\_name_{{\mathrm{1}}}} \, ... \, \ottnt{field\_name_{\ottmv{n}}} \, \ottkw{PERMUTES} \, \ottnt{field\_name'_{{\mathrm{1}}}} \, ... \, \ottnt{field\_name'_{\ottmv{m}}}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{e_{{\mathrm{1}}}} \, ) \, ... \, ( \, \ottnt{e_{\ottmv{n}}} \, ) \, \geq \, 1}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \equiv \, \ottnt{t'}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{\{} \, \ottnt{field\_name_{{\mathrm{1}}}} \, = \, \ottnt{e_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{n}}} \, = \, \ottnt{e_{\ottmv{n}}} \, \ottkw{\}} \, : \, \ottnt{t'}}{
{\ottdrulename{JTe\_record\_constr}}{}
}}


\newcommand{\ottdruleJTeXXrecordXXwith}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{expr} \, : \, \ottnt{t}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{field\_name_{{\mathrm{1}}}} \, : \, \ottnt{t} \, \rightarrow \, \ottnt{t_{{\mathrm{1}}}} \quad ... \quad \ottnt{E} \, \vdash \, \ottnt{field\_name_{\ottmv{n}}} \, : \, \ottnt{t} \, \rightarrow \, \ottnt{t_{\ottmv{n}}}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \quad ... \quad \sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}}}%
\ottpremise{\ottnt{field\_name_{{\mathrm{1}}}} \, ... \, \ottnt{field\_name_{\ottmv{n}}} \, \ottkw{distinct}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{e_{{\mathrm{1}}}} \, ) \, ... \, ( \, \ottnt{e_{\ottmv{n}}} \, ) \, \geq \, 1}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \equiv \, \ottnt{t'}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{\{} \, \ottnt{expr} \, \ottkw{with} \, \ottnt{field\_name_{{\mathrm{1}}}} \, = \, \ottnt{e_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{n}}} \, = \, \ottnt{e_{\ottmv{n}}} \, \ottkw{\}} \, : \, \ottnt{t'}}{
{\ottdrulename{JTe\_record\_with}}{}
}}


\newcommand{\ottdruleJTeXXapply}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e} \, : \, \ottnt{t_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{t}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e} \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_apply}}{}
}}


\newcommand{\ottdruleJTeXXrecordXXproj}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e} \, : \, \ottnt{t}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{field\_name} \, : \, \ottnt{t} \, \rightarrow \, \ottnt{t'}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t'} \, \equiv \, \ottnt{t''}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e} \, . \, \ottnt{field\_name} \, : \, \ottnt{t''}}{
{\ottdrulename{JTe\_record\_proj}}{}
}}


\newcommand{\ottdruleJTeXXand}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottkw{bool}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{2}}}} \, : \, \ottkw{bool}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{bool} \, \equiv \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{\&\&} \, \ottnt{e_{{\mathrm{2}}}} \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_and}}{}
}}


\newcommand{\ottdruleJTeXXor}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottkw{bool}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{2}}}} \, : \, \ottkw{bool}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{bool} \, \equiv \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{\mbox{$\mid$}\mbox{$\mid$}} \, \ottnt{e_{{\mathrm{2}}}} \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_or}}{}
}}


\newcommand{\ottdruleJTeXXifthenelse}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottkw{bool}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{2}}}} \, : \, \ottnt{t}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{3}}}} \, : \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{if} \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{then} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{else} \, \ottnt{e_{{\mathrm{3}}}} \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_ifthenelse}}{}
}}


\newcommand{\ottdruleJTeXXwhile}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottkw{bool}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{2}}}} \, : \, \ottkw{unit}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{unit} \, \equiv \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{while} \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{do} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{done} \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_while}}{}
}}


\newcommand{\ottdruleJTeXXfor}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottkw{int}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{2}}}} \, : \, \ottkw{int}}%
\ottpremise{\sigma^T \, \ottkw{\&} \,  \ottenvironmentappend{ \ottnt{E} }{ \ottmv{lowercase\_ident} \, : \, \ottkw{int} }  \, \vdash \, \ottnt{e_{{\mathrm{3}}}} \, : \, \ottkw{unit}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{unit} \, \equiv \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{for} \, \ottmv{lowercase\_ident} \, = \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{\relax{\sf[}down{\sf]}to} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{do} \, \ottnt{e_{{\mathrm{3}}}} \, \ottkw{done} \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_for}}{}
}}


\newcommand{\ottdruleJTeXXsequence}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottkw{unit}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{2}}}} \, : \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, ; \, \ottnt{e_{{\mathrm{2}}}} \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_sequence}}{}
}}


\newcommand{\ottdruleJTeXXmatch}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e} \, : \, \ottnt{t}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern\_matching} \, : \, \ottnt{t} \, \rightarrow \, \ottnt{t'}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{match} \, \ottnt{e} \, \ottkw{with} \, \ottnt{pattern\_matching} \, : \, \ottnt{t'}}{
{\ottdrulename{JTe\_match}}{}
}}


\newcommand{\ottdruleJTeXXfunction}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern\_matching} \, : \, \ottnt{t} \, \rightarrow \, \ottnt{t'}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \rightarrow \, \ottnt{t'} \, \equiv \, \ottnt{t''}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{function} \, \ottnt{pattern\_matching} \, : \, \ottnt{t''}}{
{\ottdrulename{JTe\_function}}{}
}}


\newcommand{\ottdruleJTeXXtry}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e} \, : \, \ottnt{t}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern\_matching} \, : \, \ottkw{exn} \, \rightarrow \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{try} \, \ottnt{e} \, \ottkw{with} \, \ottnt{pattern\_matching} \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_try}}{}
}}


\newcommand{\ottdruleJTeXXletXXmono}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pat} \, = \, \ottnt{expr} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{x_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, @ \, \ottnt{x_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}} \, \vdash \, \ottnt{e} \, : \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{let} \, \ottnt{pat} \, = \, \ottnt{expr} \, \ottkw{in} \, \ottnt{e} \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_let\_mono}}{}
}}


\newcommand{\ottdruleJTeXXletXXpoly}[1]{\ottdrule[#1]{%
\ottpremise{\ottkw{shift} \, 0 \, 1 \, \sigma^T \, \ottkw{\&} \,  \ottenvironmentappend{ \ottnt{E} }{ \ottkw{TV} }  \, \vdash \, \ottnt{pat} \, = \, \ottnt{nexp} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{x_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, @ \, \ottnt{x_{{\mathrm{1}}}} \, : \, \forall \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{n}}} \, : \, \forall \, \ottnt{t_{\ottmv{n}}} \, \vdash \, \ottnt{e} \, : \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{let} \, \ottnt{pat} \, = \, \ottnt{nexp} \, \ottkw{in} \, \ottnt{e} \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_let\_poly}}{}
}}


\newcommand{\ottdruleJTeXXletrec}[1]{\ottdrule[#1]{%
\ottpremise{\ottkw{shift} \, 0 \, 1 \, \sigma^T \, \ottkw{\&} \,  \ottenvironmentappend{ \ottnt{E} }{ \ottkw{TV} }  \, \vdash \, \ottnt{letrec\_bindings} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{x_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{x_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, @ \, ( \, \ottnt{x_{{\mathrm{1}}}} \, : \, \forall \, \ottnt{t_{{\mathrm{1}}}} \, ) \, , \, ... \, , \, ( \, \ottnt{x_{\ottmv{n}}} \, : \, \forall \, \ottnt{t_{\ottmv{n}}} \, ) \, \vdash \, \ottnt{e} \, : \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{let} \, \ottkw{rec} \, \ottnt{letrec\_bindings} \, \ottkw{in} \, \ottnt{e} \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_letrec}}{}
}}


\newcommand{\ottdruleJTeXXassert}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{e} \, : \, \ottkw{bool}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{unit} \, \equiv \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{assert} \, \ottnt{e} \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_assert}}{}
}}


\newcommand{\ottdruleJTeXXassertfalse}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, : \, \ottkw{Type}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{assert} \, \ottkw{false} \, : \, \ottnt{t}}{
{\ottdrulename{JTe\_assertfalse}}{}
}}


\newcommand{\ottdruleJTeXXlocation}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottmv{location} \, \;\vartriangleright\;\ottmaybebreakline \, \ottmv{location} \, : \, \ottnt{t}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{t} \, \ottkw{ref} \, \equiv \, \ottnt{t'}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottmv{location} \, : \, \ottnt{t'}}{
{\ottdrulename{JTe\_location}}{}
}}

\newcommand{\ottdefnJTe}[1]{\begin{ottdefnblock}[#1]{$\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{expr} \, : \, \ottnt{typexpr}$}{\ottcom{Expression typing}}
\ottusedrule{\ottdruleJTeXXuprim{}}
\ottusedrule{\ottdruleJTeXXbprim{}}
\ottusedrule{\ottdruleJTeXXident{}}
\ottusedrule{\ottdruleJTeXXconstant{}}
\ottusedrule{\ottdruleJTeXXtyped{}}
\ottusedrule{\ottdruleJTeXXtuple{}}
\ottusedrule{\ottdruleJTeXXconstruct{}}
\ottusedrule{\ottdruleJTeXXcons{}}
\ottusedrule{\ottdruleJTeXXrecordXXconstr{}}
\ottusedrule{\ottdruleJTeXXrecordXXwith{}}
\ottusedrule{\ottdruleJTeXXapply{}}
\ottusedrule{\ottdruleJTeXXrecordXXproj{}}
\ottusedrule{\ottdruleJTeXXand{}}
\ottusedrule{\ottdruleJTeXXor{}}
\ottusedrule{\ottdruleJTeXXifthenelse{}}
\ottusedrule{\ottdruleJTeXXwhile{}}
\ottusedrule{\ottdruleJTeXXfor{}}
\ottusedrule{\ottdruleJTeXXsequence{}}
\ottusedrule{\ottdruleJTeXXmatch{}}
\ottusedrule{\ottdruleJTeXXfunction{}}
\ottusedrule{\ottdruleJTeXXtry{}}
\ottusedrule{\ottdruleJTeXXletXXmono{}}
\ottusedrule{\ottdruleJTeXXletXXpoly{}}
\ottusedrule{\ottdruleJTeXXletrec{}}
\ottusedrule{\ottdruleJTeXXassert{}}
\ottusedrule{\ottdruleJTeXXassertfalse{}}
\ottusedrule{\ottdruleJTeXXlocation{}}
\end{ottdefnblock}}


% defn pat_matching
\newcommand{\ottdruleJTpatXXmatchingXXpm}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern_{{\mathrm{1}}}} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E_{{\mathrm{1}}}} \quad ... \quad \sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern_{\ottmv{n}}} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E_{\ottmv{n}}}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, @ \, \ottnt{E_{{\mathrm{1}}}} \, \vdash \, \ottnt{e_{{\mathrm{1}}}} \, : \, \ottnt{t'} \quad ... \quad \sigma^T \, \ottkw{\&} \, \ottnt{E} \, @ \, \ottnt{E_{\ottmv{n}}} \, \vdash \, \ottnt{e_{\ottmv{n}}} \, : \, \ottnt{t'}}%
\ottpremise{\ottkw{length} \, ( \, \ottnt{pattern_{{\mathrm{1}}}} \, ) \, ... \, ( \, \ottnt{pattern_{\ottmv{n}}} \, ) \, \geq \, 1}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{\mbox{$\mid$}} \, ... \, \ottkw{\mbox{$\mid$}} \, \ottnt{pattern_{\ottmv{n}}} \, \rightarrow \, \ottnt{e_{\ottmv{n}}} \, : \, \ottnt{t} \, \rightarrow \, \ottnt{t'}}{
{\ottdrulename{JTpat\_matching\_pm}}{}
}}

\newcommand{\ottdefnJTpatXXmatching}[1]{\begin{ottdefnblock}[#1]{$\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern\_matching} \, : \, \ottnt{typexpr} \, \rightarrow \, \ottnt{typexpr'}$}{\ottcom{Pattern matching/expression pair typing}}
\ottusedrule{\ottdruleJTpatXXmatchingXXpm{}}
\end{ottdefnblock}}


% defn let_binding
\newcommand{\ottdruleJTletXXbindingXXpoly}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{x_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{expr} \, : \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pattern} \, = \, \ottnt{expr} \, \;\vartriangleright\;\ottmaybebreakline \, ( \, \ottnt{x_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, ) \, , \, .. \, , \, ( \, \ottnt{x_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}} \, )}{
{\ottdrulename{JTlet\_binding\_poly}}{}
}}

\newcommand{\ottdefnJTletXXbinding}[1]{\begin{ottdefnblock}[#1]{$\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{let\_binding} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}$}{\ottcom{Let binding typing}}
\ottusedrule{\ottdruleJTletXXbindingXXpoly{}}
\end{ottdefnblock}}


% defn letrec_binding
\newcommand{\ottdruleJTletrecXXbindingXXequalXXfunction}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E'} \, = \, \ottnt{E} \, @ \, \ottnt{value\_name_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{t'_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{value\_name_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}} \, \rightarrow \, \ottnt{t'_{\ottmv{n}}}}%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E'} \, \vdash \, \ottnt{pattern\_matching_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{t'_{{\mathrm{1}}}} \quad ... \quad \sigma^T \, \ottkw{\&} \, \ottnt{E'} \, \vdash \, \ottnt{pattern\_matching_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}} \, \rightarrow \, \ottnt{t'_{\ottmv{n}}}}%
\ottpremise{\ottnt{value\_name_{{\mathrm{1}}}} \, ... \, \ottnt{value\_name_{\ottmv{n}}} \, \ottkw{distinct}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{value\_name_{{\mathrm{1}}}} \, = \, \ottkw{function} \, \ottnt{pattern\_matching_{{\mathrm{1}}}} \, \ottkw{and} \, ... \, \ottkw{and} \, \ottnt{value\_name_{\ottmv{n}}} \, = \, \ottkw{function} \, \ottnt{pattern\_matching_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{value\_name_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{t'_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{value\_name_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}} \, \rightarrow \, \ottnt{t'_{\ottmv{n}}}}{
{\ottdrulename{JTletrec\_binding\_equal\_function}}{}
}}

\newcommand{\ottdefnJTletrecXXbinding}[1]{\begin{ottdefnblock}[#1]{$\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{letrec\_bindings} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}$}{\ottcom{Recursive let binding typing}}
\ottbreakconclusionlinetrue
\ottusedrule{\ottdruleJTletrecXXbindingXXequalXXfunction{}}
\ottbreakconclusionlinefalse
\end{ottdefnblock}}


\newcommand{\ottdefnsJTe}{
\ottdefnJTe{}
\ottdefnJTpatXXmatching{}
\ottdefnJTletXXbinding{}
\ottdefnJTletrecXXbinding{}}


% defns JTconstr_decl
% defn constr_decl
\newcommand{\ottdruleJTconstrXXdeclXXnullary}[1]{\ottdrule[#1]{%
}{
( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{n}} \, ) \, \ottnt{typeconstr} \, \vdash \, \ottnt{constr\_name} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{constr\_name} \, \ottkw{of} \, \ottnt{typeconstr}}{
{\ottdrulename{JTconstr\_decl\_nullary}}{}
}}


\newcommand{\ottdruleJTconstrXXdeclXXnary}[1]{\ottdrule[#1]{%
}{
( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{n}} \, ) \, \ottnt{typeconstr} \, \vdash \, \ottnt{constr\_name} \, \ottkw{of} \, \ottnt{t_{{\mathrm{1}}}} \, \ast \, ... \, \ast \, \ottnt{t_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{constr\_name} \, \ottkw{of} \, \forall \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{n}} \, ) \, , \, ( \, \ottnt{t_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{t_{\ottmv{n}}} \, ) \, : \, \ottnt{typeconstr}}{
{\ottdrulename{JTconstr\_decl\_nary}}{}
}}

\newcommand{\ottdefnJTconstrXXdecl}[1]{\begin{ottdefnblock}[#1]{$\ottnt{type\_params\_opt} \, \ottnt{typeconstr} \, \vdash \, \ottnt{constr\_decl} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{EB}$}{\ottcom{Variant constructor declaration}}
\ottusedrule{\ottdruleJTconstrXXdeclXXnullary{}}
\ottusedrule{\ottdruleJTconstrXXdeclXXnary{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTconstrXXdecl}{
\ottdefnJTconstrXXdecl{}}


% defns JTfield_decl
% defn field_decl
\newcommand{\ottdruleJTfieldXXdeclXXonly}[1]{\ottdrule[#1]{%
}{
( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{n}} \, ) \, \ottnt{typeconstr\_name} \, \vdash \, \ottnt{fn} \, : \, \ottnt{t} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{fn} \, : \, \forall \, ( \, \alpha_{{\mathrm{1}}} \, , \, ... \, , \, \alpha_{\ottmv{n}} \, ) \, , \, \ottnt{typeconstr\_name} \, \rightarrow \, \ottnt{t}}{
{\ottdrulename{JTfield\_decl\_only}}{}
}}

\newcommand{\ottdefnJTfieldXXdecl}[1]{\begin{ottdefnblock}[#1]{$\ottnt{type\_params\_opt} \, \ottnt{typeconstr\_name} \, \vdash \, \ottnt{field\_decl} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{EB}$}{\ottcom{Record field declaration}}
\ottusedrule{\ottdruleJTfieldXXdeclXXonly{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTfieldXXdecl}{
\ottdefnJTfieldXXdecl{}}


% defns JTtypedef
% defn typedef
\newcommand{\ottdruleJTtypedefXXempty}[1]{\ottdrule[#1]{%
}{
\vdash \, \, \, \;\vartriangleright\;\ottmaybebreakline \, \ottkw{empty} \, \ottkw{and} \, \ottkw{empty} \, \ottkw{and} \, \ottkw{empty}}{
{\ottdrulename{JTtypedef\_empty}}{}
}}


\newcommand{\ottdruleJTtypedefXXeq}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottcomp{\ottnt{typedef_{\ottmv{i}}}}{\ottmv{i}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E} \, \ottkw{and} \, \ottnt{E'} \, \ottkw{and} \, \ottnt{E''}}%
}{
\vdash \, \ottnt{type\_params\_opt} \, \ottnt{typeconstr\_name} \, = \, \ottnt{t} \, \ottkw{and} \, \ottcomp{\ottnt{typedef_{\ottmv{i}}}}{\ottmv{i}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E} \, \ottkw{and} \,  \ottenvironmentappend{ \ottnt{E'} }{ ( \, \ottnt{type\_params\_opt} \, \ottnt{typeconstr\_name} \, = \, \ottnt{t} \, ) }  \, \ottkw{and} \, \ottnt{E''}}{
{\ottdrulename{JTtypedef\_eq}}{}
}}


\newcommand{\ottdruleJTtypedefXXdefXXsum}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottcomp{\ottnt{typedef_{\ottmv{i}}}}{\ottmv{i}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E} \, \ottkw{and} \, \ottnt{E'} \, \ottkw{and} \, \ottnt{E''}}%
\ottpremise{\vdash \, \ottnt{type\_params\_opt} \, : \, \ottnt{kind}}%
\ottpremise{\ottnt{type\_params\_opt} \, \ottnt{typeconstr\_name} \, \vdash \, \ottnt{constr\_decl_{{\mathrm{1}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{EB_{{\mathrm{1}}}} \quad ... \quad \ottnt{type\_params\_opt} \, \ottnt{typeconstr\_name} \, \vdash \, \ottnt{constr\_decl_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{EB_{\ottmv{n}}}}%
}{
\vdash \, \ottnt{type\_params\_opt} \, \ottnt{typeconstr\_name} \, = \, \ottnt{constr\_decl_{{\mathrm{1}}}} \, \ottkw{\mbox{$\mid$}} \, ... \, \ottkw{\mbox{$\mid$}} \, \ottnt{constr\_decl_{\ottmv{n}}} \, \ottkw{and} \, \ottcomp{\ottnt{typedef_{\ottmv{i}}}}{\ottmv{i}} \, \;\vartriangleright\;\ottmaybebreakline \,  \ottenvironmentappend{ \ottnt{E} }{ ( \, \ottnt{typeconstr\_name} \, : \, \ottnt{kind} \, ) }  \, \ottkw{and} \, \ottnt{E'} \, \ottkw{and} \, \ottnt{E''} \, @ \, \ottnt{EB_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{EB_{\ottmv{n}}}}{
{\ottdrulename{JTtypedef\_def\_sum}}{}
}}


\newcommand{\ottdruleJTtypedefXXdefXXrecord}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottcomp{\ottnt{typedef_{\ottmv{i}}}}{\ottmv{i}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E} \, \ottkw{and} \, \ottnt{E'} \, \ottkw{and} \, \ottnt{E''}}%
\ottpremise{\vdash \, \ottnt{type\_params\_opt} \, : \, \ottnt{kind}}%
\ottpremise{\ottnt{type\_params\_opt} \, \ottnt{typeconstr\_name} \, \vdash \, \ottnt{field\_name_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{EB_{{\mathrm{1}}}} \quad ... \quad \ottnt{type\_params\_opt} \, \ottnt{typeconstr\_name} \, \vdash \, \ottnt{field\_name_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{EB_{\ottmv{n}}}}%
}{
\vdash \, \ottnt{type\_params\_opt} \, \ottnt{typeconstr\_name} \, = \, \ottkw{\{} \, \ottnt{field\_name_{{\mathrm{1}}}} \, : \, \ottnt{t_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{n}}} \, : \, \ottnt{t_{\ottmv{n}}} \, \ottkw{\}} \, \ottkw{and} \, \ottcomp{\ottnt{typedef_{\ottmv{i}}}}{\ottmv{i}} \, \;\vartriangleright\;\ottmaybebreakline \,  \ottenvironmentappend{ \ottnt{E} }{ ( \, \ottnt{typeconstr\_name} \, : \, \ottnt{kind} \, \ottkw{\{} \, \ottnt{field\_name_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{n}}} \, \ottkw{\}} \, ) }  \, \ottkw{and} \, \ottnt{E'} \, \ottkw{and} \, \ottnt{E''} \, @ \, \ottnt{EB_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{EB_{\ottmv{n}}}}{
{\ottdrulename{JTtypedef\_def\_record}}{}
}}

\newcommand{\ottdefnJTtypedef}[1]{\begin{ottdefnblock}[#1]{$\vdash \, \ottnt{typedef_{{\mathrm{1}}}} \, \ottkw{and} \, .. \, \ottkw{and} \, \ottnt{typedef_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'} \, \ottkw{and} \, \ottnt{E''} \, \ottkw{and} \, \ottnt{E'''}$}{\ottcom{Type definitions collection}}
\ottusedrule{\ottdruleJTtypedefXXempty{}}
\ottusedrule{\ottdruleJTtypedefXXeq{}}
\ottbreakconclusionlinetrue
\ottusedrule{\ottdruleJTtypedefXXdefXXsum{}}
\ottusedrule{\ottdruleJTtypedefXXdefXXrecord{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTtypedef}{
\ottdefnJTtypedef{}}


% defns JTtype_definition
% defn type_definition
\newcommand{\ottdruleJTtypeXXdefinitionXXlist}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{typedef_{{\mathrm{1}}}} \, \ottkw{and} \, ... \, \ottkw{and} \, \ottnt{typedef_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'} \, \ottkw{and} \, \ottnt{E''} \, \ottkw{and} \, \ottnt{E'''}}%
\ottpremise{\ottnt{E''''} \, = \, \ottnt{E'} \, @ \, \ottnt{E''} \, @ \, \ottnt{E'''}}%
\ottpremise{\ottnt{E} \, @ \, \ottnt{E''''} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \, \ottkw{type} \, \ottnt{typedef_{{\mathrm{1}}}} \, \ottkw{and} \, ... \, \ottkw{and} \, \ottnt{typedef_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E''''}}{
{\ottdrulename{JTtype\_definition\_list}}{}
}}


\newcommand{\ottdruleJTtypeXXdefinitionXXswap}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{type} \, \ottcomp{\ottnt{typedef_{\ottmv{i}}}}{\ottmv{i}} \, \ottkw{and} \, \ottnt{typedef'} \, \ottkw{and} \, \ottnt{typedef} \, \ottkw{and} \, \ottcomp{\ottnt{typedef''_{\ottmv{j}}}}{\ottmv{j}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}}%
}{
\ottnt{E} \, \vdash \, \ottkw{type} \, \ottcomp{\ottnt{typedef_{\ottmv{i}}}}{\ottmv{i}} \, \ottkw{and} \, \ottnt{typedef} \, \ottkw{and} \, \ottnt{typedef'} \, \ottkw{and} \, \ottcomp{\ottnt{typedef''_{\ottmv{j}}}}{\ottmv{j}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}}{
{\ottdrulename{JTtype\_definition\_swap}}{}
}}

\newcommand{\ottdefnJTtypeXXdefinition}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{type\_definition} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}$}{\ottcom{Type definition well-formedness and binding collection}}
\ottusedrule{\ottdruleJTtypeXXdefinitionXXlist{}}
\ottusedrule{\ottdruleJTtypeXXdefinitionXXswap{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTtypeXXdefinition}{
\ottdefnJTtypeXXdefinition{}}


% defns JTdefinition
% defn definition
\newcommand{\ottdruleJTdefinitionXXletXXpoly}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \,  \ottenvironmentappend{ \ottnt{E} }{ \ottkw{TV} }  \, \vdash \, \ottnt{pat} \, = \, \ottnt{nexp} \, \;\vartriangleright\;\ottmaybebreakline \, ( \, \ottnt{x_{{\mathrm{1}}}} \, : \, \ottnt{t'_{{\mathrm{1}}}} \, ) \, , \, .. \, , \, ( \, \ottnt{x_{\ottmv{k}}} \, : \, \ottnt{t'_{\ottmv{k}}} \, )}%
}{
\ottnt{E} \, \vdash \, \ottkw{let} \, \ottnt{pat} \, = \, \ottnt{nexp} \, : \, ( \, \ottnt{x_{{\mathrm{1}}}} \, : \, \forall \, \ottnt{t'_{{\mathrm{1}}}} \, ) \, , \, .. \, , \, ( \, \ottnt{x_{\ottmv{k}}} \, : \, \forall \, \ottnt{t'_{\ottmv{k}}} \, )}{
{\ottdrulename{JTdefinition\_let\_poly}}{}
}}


\newcommand{\ottdruleJTdefinitionXXletXXmono}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{pat} \, = \, \ottnt{expr} \, \;\vartriangleright\;\ottmaybebreakline \, ( \, \ottnt{x_{{\mathrm{1}}}} \, : \, \ottnt{t'_{{\mathrm{1}}}} \, ) \, , \, .. \, , \, ( \, \ottnt{x_{\ottmv{k}}} \, : \, \ottnt{t'_{\ottmv{k}}} \, )}%
}{
\ottnt{E} \, \vdash \, \ottkw{let} \, \ottnt{pat} \, = \, \ottnt{expr} \, : \, ( \, \ottnt{x_{{\mathrm{1}}}} \, : \, \ottnt{t'_{{\mathrm{1}}}} \, ) \, , \, .. \, , \, ( \, \ottnt{x_{\ottmv{k}}} \, : \, \ottnt{t'_{\ottmv{k}}} \, )}{
{\ottdrulename{JTdefinition\_let\_mono}}{}
}}


\newcommand{\ottdruleJTdefinitionXXletrec}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \,  \ottenvironmentappend{ \ottnt{E} }{ \ottkw{TV} }  \, \vdash \, \ottnt{letrec\_bindings} \, \;\vartriangleright\;\ottmaybebreakline \, ( \, \ottnt{x_{{\mathrm{1}}}} \, : \, \ottnt{t'_{{\mathrm{1}}}} \, ) \, , \, .. \, , \, ( \, \ottnt{x_{\ottmv{k}}} \, : \, \ottnt{t'_{\ottmv{k}}} \, )}%
}{
\ottnt{E} \, \vdash \, \ottkw{let} \, \ottkw{rec} \, \ottnt{letrec\_bindings} \, : \, ( \, \ottnt{x_{{\mathrm{1}}}} \, : \, \forall \, \ottnt{t'_{{\mathrm{1}}}} \, ) \, , \, .. \, , \, ( \, \ottnt{x_{\ottmv{k}}} \, : \, \forall \, \ottnt{t'_{\ottmv{k}}} \, )}{
{\ottdrulename{JTdefinition\_letrec}}{}
}}


\newcommand{\ottdruleJTdefinitionXXtypedef}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{type} \, \ottnt{typedef_{{\mathrm{1}}}} \, \ottkw{and} \, ... \, \ottkw{and} \, \ottnt{typedef_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}}%
}{
\ottnt{E} \, \vdash \, \ottkw{type} \, \ottnt{typedef_{{\mathrm{1}}}} \, \ottkw{and} \, ... \, \ottkw{and} \, \ottnt{typedef_{\ottmv{n}}} \, : \, \ottnt{E'}}{
{\ottdrulename{JTdefinition\_typedef}}{}
}}


\newcommand{\ottdruleJTdefinitionXXexndef}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
\ottpremise{ \, \ottkw{exn} \, \vdash \, \ottnt{constr\_decl} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{EB}}%
}{
\ottnt{E} \, \vdash \, \ottkw{exception} \, \ottnt{constr\_decl} \, : \, \ottnt{EB}}{
{\ottdrulename{JTdefinition\_exndef}}{}
}}

\newcommand{\ottdefnJTdefinition}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{definition} \, : \, \ottnt{E'}$}{\ottcom{Definition typing}}
\ottusedrule{\ottdruleJTdefinitionXXletXXpoly{}}
\ottusedrule{\ottdruleJTdefinitionXXletXXmono{}}
\ottusedrule{\ottdruleJTdefinitionXXletrec{}}
\ottusedrule{\ottdruleJTdefinitionXXtypedef{}}
\ottusedrule{\ottdruleJTdefinitionXXexndef{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTdefinition}{
\ottdefnJTdefinition{}}


% defns JTdefinitions
% defn definitions
\newcommand{\ottdruleJTdefinitionsXXempty}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottkw{ok}}%
}{
\ottnt{E} \, \vdash \,  \, : \, \,}{
{\ottdrulename{JTdefinitions\_empty}}{}
}}


\newcommand{\ottdruleJTdefinitionsXXitem}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{definition} \, : \, \ottnt{E'}}%
\ottpremise{\ottnt{E} \, @ \, \ottnt{E'} \, \vdash \, \ottnt{definitions'} \, : \, \ottnt{E''}}%
}{
\ottnt{E} \, \vdash \, \ottnt{definition} \, \ottnt{definitions'} \, : \, \ottnt{E'} \, @ \, \ottnt{E''}}{
{\ottdrulename{JTdefinitions\_item}}{}
}}

\newcommand{\ottdefnJTdefinitions}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{definitions} \, : \, \ottnt{E'}$}{\ottcom{Definition sequence typing}}
\ottusedrule{\ottdruleJTdefinitionsXXempty{}}
\ottusedrule{\ottdruleJTdefinitionsXXitem{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTdefinitions}{
\ottdefnJTdefinitions{}}


% defns JTprog
% defn prog
\newcommand{\ottdruleJTprogXXdefs}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{definitions} \, : \, \ottnt{E'}}%
}{
\ottnt{E} \, \vdash \, \ottnt{definitions} \, : \, \ottnt{E'}}{
{\ottdrulename{JTprog\_defs}}{}
}}


\newcommand{\ottdruleJTprogXXraise}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{v} \, : \, \ottnt{t}}%
}{
\ottnt{E} \, \vdash \, \ottkw{(\%prim} \, \ottkw{raise)} \, \ottnt{v} \, : \, \,}{
{\ottdrulename{JTprog\_raise}}{}
}}

\newcommand{\ottdefnJTprog}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{program} \, : \, \ottnt{E'}$}{\ottcom{Program typing}}
\ottusedrule{\ottdruleJTprogXXdefs{}}
\ottusedrule{\ottdruleJTprogXXraise{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTprog}{
\ottdefnJTprog{}}


% defns JTstore
% defn store
\newcommand{\ottdruleJTstoreXXempty}[1]{\ottdrule[#1]{%
}{
\ottnt{E} \, \vdash \, \ottkw{empty} \, : \, \,}{
{\ottdrulename{JTstore\_empty}}{}
}}


\newcommand{\ottdruleJTstoreXXmap}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, \vdash \, \ottnt{store} \, : \, \ottnt{E'}}%
\ottpremise{\{\!\!\{ \, \, \, \}\!\!\} \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{v} \, : \, \ottnt{t}}%
}{
\ottnt{E} \, \vdash \, \ottnt{store} \, , \, \ottmv{l} \, \mapsto \, \ottnt{v} \, : \,  \ottenvironmentappend{ \ottnt{E'} }{ ( \, \ottmv{l} \, : \, \ottnt{t} \, ) } }{
{\ottdrulename{JTstore\_map}}{}
}}

\newcommand{\ottdefnJTstore}[1]{\begin{ottdefnblock}[#1]{$\ottnt{E} \, \vdash \, \ottnt{store} \, : \, \ottnt{E'}$}{\ottcom{Store typing}}
\ottusedrule{\ottdruleJTstoreXXempty{}}
\ottusedrule{\ottdruleJTstoreXXmap{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTstore}{
\ottdefnJTstore{}}


% defns JTtop
% defn top
\newcommand{\ottdruleJTtopXXdefs}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{E} \, @ \, \ottnt{E'} \, \vdash \, \ottnt{store} \, : \, \ottnt{E'}}%
\ottpremise{\ottnt{E} \, @ \, \ottnt{E'} \, \vdash \, \ottnt{program} \, : \, \ottnt{E''}}%
}{
 \ottnt{E}  \vdash \langle  \ottnt{program} ,  \ottnt{store}  \rangle }{
{\ottdrulename{JTtop\_defs}}{}
}}

\newcommand{\ottdefnJTtop}[1]{\begin{ottdefnblock}[#1]{$ \ottnt{E}  \vdash \langle  \ottnt{program} ,  \ottnt{store}  \rangle $}{\ottcom{Top-level typing}}
Checks the combination of a program with a store.  The store is typed in an
environment that includes its bindings, so that it can contain cyclic
structures.
\ottusedrule{\ottdruleJTtopXXdefs{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTtop}{
\ottdefnJTtop{}}


% defns JTLin
% defn Lin
\newcommand{\ottdruleJTLinXXnil}[1]{\ottdrule[#1]{%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, }{
{\ottdrulename{JTLin\_nil}}{}
}}


\newcommand{\ottdruleJTLinXXalloc}[1]{\ottdrule[#1]{%
\ottpremise{\ottkw{dom} \, ( \, \ottnt{E} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{names}}%
\ottpremise{\ottmv{location} \, \notin \, \ottnt{names}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{ref} \, \ottnt{v} \, = \, \ottmv{location}}{
{\ottdrulename{JTLin\_alloc}}{}
}}


\newcommand{\ottdruleJTLinXXderef}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{v} \, : \, \ottnt{t}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottmv{location} \, \;\vartriangleright\;\ottmaybebreakline \, ( \, \ottmv{location} \, : \, \ottnt{t} \, )}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, ! \, \ottmv{location} \, = \, \ottnt{v}}{
{\ottdrulename{JTLin\_deref}}{}
}}


\newcommand{\ottdruleJTLinXXassign}[1]{\ottdrule[#1]{%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottmv{location} \, \ottkw{:=} \, \ottnt{v}}{
{\ottdrulename{JTLin\_assign}}{}
}}

\newcommand{\ottdefnJTLin}[1]{\begin{ottdefnblock}[#1]{$\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{L}$}{\ottcom{Label-to-environment extraction}}
\ottusedrule{\ottdruleJTLinXXnil{}}
\ottusedrule{\ottdruleJTLinXXalloc{}}
\ottusedrule{\ottdruleJTLinXXderef{}}
\ottusedrule{\ottdruleJTLinXXassign{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJTLin}{
\ottdefnJTLin{}}


% defns JTLout
% defn Lout
\newcommand{\ottdruleJTLoutXXnil}[1]{\ottdrule[#1]{%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \,  \, \;\vartriangleright\;\ottmaybebreakline \, \,}{
{\ottdrulename{JTLout\_nil}}{}
}}


\newcommand{\ottdruleJTLoutXXalloc}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{v} \, : \, \ottnt{t}}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottkw{ref} \, \ottnt{v} \, = \, \ottmv{location} \, \;\vartriangleright\;\ottmaybebreakline \, ( \, \ottmv{location} \, : \, \ottnt{t} \, )}{
{\ottdrulename{JTLout\_alloc}}{}
}}


\newcommand{\ottdruleJTLoutXXderef}[1]{\ottdrule[#1]{%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, ! \, \ottmv{location} \, = \, \ottnt{v} \, \;\vartriangleright\;\ottmaybebreakline \, \,}{
{\ottdrulename{JTLout\_deref}}{}
}}


\newcommand{\ottdruleJTLoutXXassign}[1]{\ottdrule[#1]{%
\ottpremise{\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{v} \, : \, \ottnt{t}}%
\ottpremise{\ottnt{E} \, \vdash \, \ottmv{location} \, \;\vartriangleright\;\ottmaybebreakline \, ( \, \ottmv{location} \, : \, \ottnt{t} \, )}%
}{
\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottmv{location} \, \ottkw{:=} \, \ottnt{v} \, \;\vartriangleright\;\ottmaybebreakline \, \,}{
{\ottdrulename{JTLout\_assign}}{}
}}

\newcommand{\ottdefnJTLout}[1]{\begin{ottdefnblock}[#1]{$\sigma^T \, \ottkw{\&} \, \ottnt{E} \, \vdash \, \ottnt{L} \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{E'}$}{\ottcom{Label-to-environment extraction}}
\ottusedrule{\ottdruleJTLoutXXnil{}}
\ottusedrule{\ottdruleJTLoutXXalloc{}}
\ottusedrule{\ottdruleJTLoutXXderef{}}
\ottusedrule{\ottdruleJTLoutXXassign{}}

\end{ottdefnblock}}


\newcommand{\ottdefnsJTLout}{
\ottdefnJTLout{}}


% defns JmatchP
% defn matchP
\newcommand{\ottdruleJMXXmatchPXXvar}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{x}}{
{\ottdrulename{JM\_matchP\_var}}{}
}}


\newcommand{\ottdruleJMXXmatchPXXany}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottkw{\_}}{
{\ottdrulename{JM\_matchP\_any}}{}
}}


\newcommand{\ottdruleJMXXmatchPXXconstant}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{constant} \, \ottkw{matches} \, \ottnt{constant}}{
{\ottdrulename{JM\_matchP\_constant}}{}
}}


\newcommand{\ottdruleJMXXmatchPXXalias}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat}}%
}{
\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat} \, \ottkw{as} \, \ottnt{x}}{
{\ottdrulename{JM\_matchP\_alias}}{}
}}


\newcommand{\ottdruleJMXXmatchPXXtyped}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat}}%
}{
\vdash \, \ottnt{v} \, \ottkw{matches} \, ( \, \ottnt{pat} \, : \, \ottnt{t} \, )}{
{\ottdrulename{JM\_matchP\_typed}}{}
}}


\newcommand{\ottdruleJMXXmatchPXXorXXleft}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}}}%
}{
\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \, \ottkw{\mbox{$\mid$}} \, \ottnt{pat_{{\mathrm{2}}}}}{
{\ottdrulename{JM\_matchP\_or\_left}}{}
}}


\newcommand{\ottdruleJMXXmatchPXXorXXright}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{2}}}}}%
}{
\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \, \ottkw{\mbox{$\mid$}} \, \ottnt{pat_{{\mathrm{2}}}}}{
{\ottdrulename{JM\_matchP\_or\_right}}{}
}}


\newcommand{\ottdruleJMXXmatchPXXconstruct}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v_{{\mathrm{1}}}} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \quad ... \quad \vdash \, \ottnt{v_{\ottmv{n}}} \, \ottkw{matches} \, \ottnt{pat_{\ottmv{n}}}}%
}{
\vdash \, \ottnt{constr} \, ( \, \ottnt{v_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{v_{\ottmv{n}}} \, ) \, \ottkw{matches} \, \ottnt{constr} \, ( \, \ottnt{pat_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{pat_{\ottmv{n}}} \, )}{
{\ottdrulename{JM\_matchP\_construct}}{}
}}


\newcommand{\ottdruleJMXXmatchPXXconstructXXany}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{constr} \, ( \, \ottnt{v_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{v_{\ottmv{n}}} \, ) \, \ottkw{matches} \, \ottnt{constr} \, \ottkw{\_}}{
{\ottdrulename{JM\_matchP\_construct\_any}}{}
}}


\newcommand{\ottdruleJMXXmatchPXXtuple}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v_{{\mathrm{1}}}} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \quad .... \quad \vdash \, \ottnt{v_{\ottmv{n}}} \, \ottkw{matches} \, \ottnt{pat_{\ottmv{n}}}}%
}{
\vdash \, ( \, \ottnt{v_{{\mathrm{1}}}} \, , \, .... \, , \, \ottnt{v_{\ottmv{n}}} \, ) \, \ottkw{matches} \, ( \, \ottnt{pat_{{\mathrm{1}}}} \, , \, .... \, , \, \ottnt{pat_{\ottmv{n}}} \, )}{
{\ottdrulename{JM\_matchP\_tuple}}{}
}}


\newcommand{\ottdruleJMXXmatchPXXrecord}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{field\_name'_{{\mathrm{1}}}} \, = \, \ottnt{v'_{{\mathrm{1}}}} \, ... \, \ottnt{field\_name'_{\ottmv{n}}} \, = \, \ottnt{v'_{\ottmv{n}}} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{v''_{{\mathrm{1}}}} \, .. \, \ottnt{fn_{\ottmv{l}}} \, = \, \ottnt{v''_{\ottmv{l}}} \, \ottkw{PERMUTES} \, \ottnt{field\_name_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ... \, \ottnt{field\_name_{\ottmv{m}}} \, = \, \ottnt{v_{\ottmv{m}}}}%
\ottpremise{\vdash \, \ottnt{v'_{{\mathrm{1}}}} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \quad ... \quad \vdash \, \ottnt{v'_{\ottmv{n}}} \, \ottkw{matches} \, \ottnt{pat_{\ottmv{n}}}}%
\ottpremise{\ottnt{field\_name_{{\mathrm{1}}}} \, ... \, \ottnt{field\_name_{\ottmv{m}}} \, \ottkw{distinct}}%
}{
\vdash \, \ottkw{\{} \, \ottnt{field\_name_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{m}}} \, = \, \ottnt{v_{\ottmv{m}}} \, \ottkw{\}} \, \ottkw{matches} \, \ottkw{\{} \, \ottnt{field\_name'_{{\mathrm{1}}}} \, = \, \ottnt{pat_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name'_{\ottmv{n}}} \, = \, \ottnt{pat_{\ottmv{n}}} \, \ottkw{\}}}{
{\ottdrulename{JM\_matchP\_record}}{}
}}


\newcommand{\ottdruleJMXXmatchPXXcons}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v_{{\mathrm{1}}}} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}}}%
\ottpremise{\vdash \, \ottnt{v_{{\mathrm{2}}}} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{2}}}}}%
}{
\vdash \, \ottnt{v_{{\mathrm{1}}}} \, \ottkw{::} \, \ottnt{v_{{\mathrm{2}}}} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \, \ottkw{::} \, \ottnt{pat_{{\mathrm{2}}}}}{
{\ottdrulename{JM\_matchP\_cons}}{}
}}

\newcommand{\ottdefnJMXXmatchP}[1]{\begin{ottdefnblock}[#1]{$\vdash \, \ottnt{expr} \, \ottkw{matches} \, \ottnt{pattern}$}{\ottcom{Pattern matching}}
\ottusedrule{\ottdruleJMXXmatchPXXvar{}}
\ottusedrule{\ottdruleJMXXmatchPXXany{}}
\ottusedrule{\ottdruleJMXXmatchPXXconstant{}}
\ottusedrule{\ottdruleJMXXmatchPXXalias{}}
\ottusedrule{\ottdruleJMXXmatchPXXtyped{}}
\ottusedrule{\ottdruleJMXXmatchPXXorXXleft{}}
\ottusedrule{\ottdruleJMXXmatchPXXorXXright{}}
\ottusedrule{\ottdruleJMXXmatchPXXconstruct{}}
\ottusedrule{\ottdruleJMXXmatchPXXconstructXXany{}}
\ottusedrule{\ottdruleJMXXmatchPXXtuple{}}
\ottusedrule{\ottdruleJMXXmatchPXXrecord{}}
\ottusedrule{\ottdruleJMXXmatchPXXcons{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJmatchP}{
\ottdefnJMXXmatchP{}}


% defns Jmatch
% defn match
\newcommand{\ottdruleJMXXmatchXXvar}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{x} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{x} \, \!\!\leftarrow\!\! \, \ottnt{v} \, \}\!\!\}}{
{\ottdrulename{JM\_match\_var}}{}
}}


\newcommand{\ottdruleJMXXmatchXXany}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottkw{\_} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \, \, \}\!\!\}}{
{\ottdrulename{JM\_match\_any}}{}
}}


\newcommand{\ottdruleJMXXmatchXXconstant}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{constant} \, \ottkw{matches} \, \ottnt{constant} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \, \, \}\!\!\}}{
{\ottdrulename{JM\_match\_constant}}{}
}}


\newcommand{\ottdruleJMXXmatchXXalias}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{n}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{\ottmv{n}}} \, \}\!\!\}}%
}{
\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat} \, \ottkw{as} \, \ottnt{x} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{n}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{\ottmv{n}}} \, , \, \ottnt{x} \, \!\!\leftarrow\!\! \, \ottnt{v} \, \}\!\!\}}{
{\ottdrulename{JM\_match\_alias}}{}
}}


\newcommand{\ottdruleJMXXmatchXXtyped}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{n}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{\ottmv{n}}} \, \}\!\!\}}%
}{
\vdash \, \ottnt{v} \, \ottkw{matches} \, ( \, \ottnt{pat} \, : \, \ottnt{t} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{n}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{\ottmv{n}}} \, \}\!\!\}}{
{\ottdrulename{JM\_match\_typed}}{}
}}


\newcommand{\ottdruleJMXXmatchXXorXXleft}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{n}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{\ottmv{n}}} \, \}\!\!\}}%
}{
\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \, \ottkw{\mbox{$\mid$}} \, \ottnt{pat_{{\mathrm{2}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{n}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{\ottmv{n}}} \, \}\!\!\}}{
{\ottdrulename{JM\_match\_or\_left}}{}
}}


\newcommand{\ottdruleJMXXmatchXXorXXright}[1]{\ottdrule[#1]{%
\ottpremise{ \neg( \ottnt{v} ~\ottkw{matches}~ \ottnt{pat_{{\mathrm{1}}}} ) }%
\ottpremise{\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{2}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{n}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{\ottmv{n}}} \, \}\!\!\}}%
}{
\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \, \ottkw{\mbox{$\mid$}} \, \ottnt{pat_{{\mathrm{2}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{n}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{\ottmv{n}}} \, \}\!\!\}}{
{\ottdrulename{JM\_match\_or\_right}}{}
}}


\newcommand{\ottdruleJMXXmatchXXconstruct}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v_{{\mathrm{1}}}} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{substs\_x_{{\mathrm{1}}}} \, \}\!\!\} \quad ... \quad \vdash \, \ottnt{v_{\ottmv{n}}} \, \ottkw{matches} \, \ottnt{pat_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{substs\_x_{\ottmv{n}}} \, \}\!\!\}}%
}{
\vdash \, \ottnt{constr} \, ( \, \ottnt{v_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{v_{\ottmv{n}}} \, ) \, \ottkw{matches} \, \ottnt{constr} \, ( \, \ottnt{pat_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{pat_{\ottmv{n}}} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{substs\_x_{{\mathrm{1}}}} \, @ \, ... \, @ \, \ottnt{substs\_x_{\ottmv{n}}} \, \}\!\!\}}{
{\ottdrulename{JM\_match\_construct}}{}
}}


\newcommand{\ottdruleJMXXmatchXXconstructXXany}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{constr} \, ( \, \ottnt{v_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{v_{\ottmv{n}}} \, ) \, \ottkw{matches} \, \ottnt{constr} \, \ottkw{\_} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \, \, \}\!\!\}}{
{\ottdrulename{JM\_match\_construct\_any}}{}
}}


\newcommand{\ottdruleJMXXmatchXXtuple}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v_{{\mathrm{1}}}} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{substs\_x_{{\mathrm{1}}}} \, \}\!\!\} \quad .... \quad \vdash \, \ottnt{v_{\ottmv{n}}} \, \ottkw{matches} \, \ottnt{pat_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{substs\_x_{\ottmv{n}}} \, \}\!\!\}}%
}{
\vdash \, ( \, \ottnt{v_{{\mathrm{1}}}} \, , \, .... \, , \, \ottnt{v_{\ottmv{n}}} \, ) \, \ottkw{matches} \, ( \, \ottnt{pat_{{\mathrm{1}}}} \, , \, .... \, , \, \ottnt{pat_{\ottmv{n}}} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{substs\_x_{{\mathrm{1}}}} \, @ \, .... \, @ \, \ottnt{substs\_x_{\ottmv{n}}} \, \}\!\!\}}{
{\ottdrulename{JM\_match\_tuple}}{}
}}


\newcommand{\ottdruleJMXXmatchXXrecord}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{field\_name'_{{\mathrm{1}}}} \, = \, \ottnt{v'_{{\mathrm{1}}}} \, ... \, \ottnt{field\_name'_{\ottmv{n}}} \, = \, \ottnt{v'_{\ottmv{n}}} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{v''_{{\mathrm{1}}}} \, .. \, \ottnt{fn_{\ottmv{l}}} \, = \, \ottnt{v''_{\ottmv{l}}} \, \ottkw{PERMUTES} \, \ottnt{field\_name_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ... \, \ottnt{field\_name_{\ottmv{m}}} \, = \, \ottnt{v_{\ottmv{m}}}}%
\ottpremise{\vdash \, \ottnt{v'_{{\mathrm{1}}}} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{substs\_x_{{\mathrm{1}}}} \, \}\!\!\} \quad ... \quad \vdash \, \ottnt{v'_{\ottmv{n}}} \, \ottkw{matches} \, \ottnt{pat_{\ottmv{n}}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{substs\_x_{\ottmv{n}}} \, \}\!\!\}}%
\ottpremise{\ottnt{field\_name_{{\mathrm{1}}}} \, ... \, \ottnt{field\_name_{\ottmv{m}}} \, \ottkw{distinct}}%
}{
\vdash \, \ottkw{\{} \, \ottnt{field\_name_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{m}}} \, = \, \ottnt{v_{\ottmv{m}}} \, \ottkw{\}} \, \ottkw{matches} \, \ottkw{\{} \, \ottnt{field\_name'_{{\mathrm{1}}}} \, = \, \ottnt{pat_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name'_{\ottmv{n}}} \, = \, \ottnt{pat_{\ottmv{n}}} \, \ottkw{\}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{substs\_x_{{\mathrm{1}}}} \, @ \, ... \, @ \, \ottnt{substs\_x_{\ottmv{n}}} \, \}\!\!\}}{
{\ottdrulename{JM\_match\_record}}{}
}}


\newcommand{\ottdruleJMXXmatchXXcons}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v_{{\mathrm{1}}}} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{substs\_x_{{\mathrm{1}}}} \, \}\!\!\}}%
\ottpremise{\vdash \, \ottnt{v_{{\mathrm{2}}}} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{2}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{substs\_x_{{\mathrm{2}}}} \, \}\!\!\}}%
}{
\vdash \, \ottnt{v_{{\mathrm{1}}}} \, \ottkw{::} \, \ottnt{v_{{\mathrm{2}}}} \, \ottkw{matches} \, \ottnt{pat_{{\mathrm{1}}}} \, \ottkw{::} \, \ottnt{pat_{{\mathrm{2}}}} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{substs\_x_{{\mathrm{1}}}} \, @ \, \ottnt{substs\_x_{{\mathrm{2}}}} \, \}\!\!\}}{
{\ottdrulename{JM\_match\_cons}}{}
}}

\newcommand{\ottdefnJMXXmatch}[1]{\begin{ottdefnblock}[#1]{$\vdash \, \ottnt{expr} \, \ottkw{matches} \, \ottnt{pattern} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{substs\_x} \, \}\!\!\}$}{\ottcom{Pattern matching with substitution creation}}
\ottusedrule{\ottdruleJMXXmatchXXvar{}}
\ottusedrule{\ottdruleJMXXmatchXXany{}}
\ottusedrule{\ottdruleJMXXmatchXXconstant{}}
\ottusedrule{\ottdruleJMXXmatchXXalias{}}
\ottusedrule{\ottdruleJMXXmatchXXtyped{}}
\ottusedrule{\ottdruleJMXXmatchXXorXXleft{}}
\ottusedruleC{\ottdruleJMXXmatchXXorXXright{}}
\ottusedrule{\ottdruleJMXXmatchXXconstruct{}}
\ottusedrule{\ottdruleJMXXmatchXXconstructXXany{}}
\ottusedrule{\ottdruleJMXXmatchXXtuple{}}
\ottusedruleC{\ottdruleJMXXmatchXXrecord{}}
\ottusedrule{\ottdruleJMXXmatchXXcons{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJmatch}{
\ottdefnJMXXmatch{}}


% defns Jrecfun
% defn recfun
\newcommand{\ottdruleJrecfunXXletrec}[1]{\ottdrule[#1]{%
\ottpremise{ \ottnt{letrec\_bindings}  = ( \ottnt{x_{{\mathrm{1}}}} \, = \, \ottkw{function} \, \ottnt{pattern\_matching_{{\mathrm{1}}}} \, \ottkw{and} \, ... \, \ottkw{and} \, \ottnt{x_{\ottmv{n}}} \, = \, \ottkw{function} \, \ottnt{pattern\_matching_{\ottmv{n}}} ) }%
}{
\ottkw{recfun} \, ( \, \ottnt{letrec\_bindings} \, , \, \ottnt{pattern\_matching} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottkw{let} \, \ottkw{rec} \, \ottnt{letrec\_bindings} \, \ottkw{in} \, \ottnt{x_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{x_{\ottmv{n}}} \, \!\!\leftarrow\!\! \, \ottkw{let} \, \ottkw{rec} \, \ottnt{letrec\_bindings} \, \ottkw{in} \, \ottnt{x_{\ottmv{n}}} \, \}\!\!\} \, ( \, \ottkw{function} \, \ottnt{pattern\_matching} \, )}{
{\ottdrulename{Jrecfun\_letrec}}{}
}}

\newcommand{\ottdefnJrecfun}[1]{\begin{ottdefnblock}[#1]{$\ottkw{recfun} \, ( \, \ottnt{letrec\_bindings} \, , \, \ottnt{pattern\_matching} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{expr}$}{\ottcom{Recursive function helper}}
\ottusedrule{\ottdruleJrecfunXXletrec{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJrecfun}{
\ottdefnJrecfun{}}


% defns Jfunval
% defn funval
\newcommand{\ottdruleJfunvalXXup}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{funval} \, ( \, ( \, \ottkw{\%prim} \, \ottnt{unary\_prim} \, ) \, )}{
{\ottdrulename{Jfunval\_up}}{}
}}


\newcommand{\ottdruleJfunvalXXbp}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{funval} \, ( \, ( \, \ottkw{\%prim} \, \ottnt{binary\_prim} \, ) \, )}{
{\ottdrulename{Jfunval\_bp}}{}
}}


\newcommand{\ottdruleJfunvalXXbpXXapp}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{funval} \, ( \, ( \, \ottkw{\%prim} \, \ottnt{binary\_prim} \, ) \, \ottnt{v} \, )}{
{\ottdrulename{Jfunval\_bp\_app}}{}
}}


\newcommand{\ottdruleJfunvalXXfunc}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{funval} \, ( \, \ottkw{function} \, \ottnt{pattern\_matching} \, )}{
{\ottdrulename{Jfunval\_func}}{}
}}

\newcommand{\ottdefnJfunval}[1]{\begin{ottdefnblock}[#1]{$\vdash \, \ottkw{funval} \, ( \, \ottnt{e} \, )$}{\ottcom{Function values}}
\ottusedrule{\ottdruleJfunvalXXup{}}
\ottusedrule{\ottdruleJfunvalXXbp{}}
\ottusedrule{\ottdruleJfunvalXXbpXXapp{}}
\ottusedrule{\ottdruleJfunvalXXfunc{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJfunval}{
\ottdefnJfunval{}}


% defns JRuprim
% defn Ruprim
\newcommand{\ottdruleJuprimXXnotXXtrue}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{not} \, \ottkw{true} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{false}}{
{\ottdrulename{Juprim\_not\_true}}{}
}}


\newcommand{\ottdruleJuprimXXnotXXfalse}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{not} \, \ottkw{false} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{true}}{
{\ottdrulename{Juprim\_not\_false}}{}
}}


\newcommand{\ottdruleJuprimXXuminus}[1]{\ottdrule[#1]{%
}{
\vdash \, \mathrel{\sim\!\!-} \, \dot{n} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \,  0  \stackrel\centerdot-  \dot{n} }{
{\ottdrulename{Juprim\_uminus}}{}
}}


\newcommand{\ottdruleJuprimXXrefXXalloc}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{ref} \, \ottnt{v} \,  \stackrel{  \ottkw{ref} \, \ottnt{v} \, = \, \ottmv{l}  }{\longrightarrow}\ottmaybebreakline  \, \ottmv{l}}{
{\ottdrulename{Juprim\_ref\_alloc}}{}
}}


\newcommand{\ottdruleJuprimXXderef}[1]{\ottdrule[#1]{%
}{
\vdash \, ! \, \ottmv{l} \,  \stackrel{  ! \, \ottmv{l} \, = \, \ottnt{v}  }{\longrightarrow}\ottmaybebreakline  \, \ottnt{v}}{
{\ottdrulename{Juprim\_deref}}{}
}}

\newcommand{\ottdefnJRuprim}[1]{\begin{ottdefnblock}[#1]{$\vdash \, \ottnt{unary\_prim} \, \ottnt{expr} \, \stackrel{\ottnt{L} }{\longrightarrow}\ottmaybebreakline \, \ottnt{expr'}$}{\ottcom{Unary primitive evaluation}}
\ottusedrule{\ottdruleJuprimXXnotXXtrue{}}
\ottusedrule{\ottdruleJuprimXXnotXXfalse{}}
\ottusedrule{\ottdruleJuprimXXuminus{}}
\ottusedruleC{\ottdruleJuprimXXrefXXalloc{}}
\ottusedrule{\ottdruleJuprimXXderef{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJRuprim}{
\ottdefnJRuprim{}}


% defns JRbprim
% defn Rbprim
\newcommand{\ottdruleJbprimXXequalXXfun}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottkw{funval} \, ( \, \ottnt{v} \, )}%
}{
\vdash \, \ottnt{v} \, = \, \ottnt{v'} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, ( \, \ottkw{Invalid\_argument} \, ( \, \ottkw{equal\_error\_string} \, ) \, )}{
{\ottdrulename{Jbprim\_equal\_fun}}{}
}}


\newcommand{\ottdruleJbprimXXequalXXconstXXtrue}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{constant} \, = \, \ottnt{constant} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{true}}{
{\ottdrulename{Jbprim\_equal\_const\_true}}{}
}}


\newcommand{\ottdruleJbprimXXequalXXconstXXfalse}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{constant} \, \not = \, \ottnt{constant'}}%
}{
\vdash \, \ottnt{constant} \, = \, \ottnt{constant'} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{false}}{
{\ottdrulename{Jbprim\_equal\_const\_false}}{}
}}


\newcommand{\ottdruleJbprimXXequalXXloc}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottmv{l} \, = \, \ottmv{l'} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, ( \, \ottkw{\%prim} \, = \, ) \, ( \, ( \, \ottkw{\%prim} \, ! \, ) \, \ottmv{l} \, ) \, ) \, ( \, ( \, \ottkw{\%prim} \, ! \, ) \, \ottmv{l'} \, )}{
{\ottdrulename{Jbprim\_equal\_loc}}{}
}}


\newcommand{\ottdruleJbprimXXequalXXcons}[1]{\ottdrule[#1]{%
}{
\vdash \, ( \, \ottnt{v_{{\mathrm{1}}}} \, \ottkw{::} \, \ottnt{v_{{\mathrm{2}}}} \, ) \, = \, ( \, \ottnt{v'_{{\mathrm{1}}}} \, \ottkw{::} \, \ottnt{v'_{{\mathrm{2}}}} \, ) \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, ( \, ( \, \ottkw{\%prim} \, = \, ) \, \ottnt{v_{{\mathrm{1}}}} \, ) \, \ottnt{v'_{{\mathrm{1}}}} \, ) \, \ottkw{\&\&} \, ( \, ( \, ( \, \ottkw{\%prim} \, = \, ) \, \ottnt{v_{{\mathrm{2}}}} \, ) \, \ottnt{v'_{{\mathrm{2}}}} \, )}{
{\ottdrulename{Jbprim\_equal\_cons}}{}
}}


\newcommand{\ottdruleJbprimXXequalXXconsXXnil}[1]{\ottdrule[#1]{%
}{
\vdash \, ( \, \ottnt{v_{{\mathrm{1}}}} \, \ottkw{::} \, \ottnt{v_{{\mathrm{2}}}} \, ) \, = \, \ottkw{[]} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{false}}{
{\ottdrulename{Jbprim\_equal\_cons\_nil}}{}
}}


\newcommand{\ottdruleJbprimXXequalXXnilXXcons}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{[]} \, = \, ( \, \ottnt{v_{{\mathrm{1}}}} \, \ottkw{::} \, \ottnt{v_{{\mathrm{2}}}} \, ) \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{false}}{
{\ottdrulename{Jbprim\_equal\_nil\_cons}}{}
}}


\newcommand{\ottdruleJbprimXXequalXXtuple}[1]{\ottdrule[#1]{%
\ottpremise{\ottkw{length} \, ( \, \ottnt{v_{{\mathrm{1}}}} \, ) \, .... \, ( \, \ottnt{v_{\ottmv{n}}} \, ) \, \geq \, 2}%
}{
\vdash \, ( \, \ottnt{v_{{\mathrm{1}}}} \, , \, .... \, , \, \ottnt{v_{\ottmv{n}}} \, ) \, = \, ( \, \ottnt{v'_{{\mathrm{1}}}} \, , \, .... \, , \, \ottnt{v'_{\ottmv{n}}} \, ) \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{AND} \, ( \, ( \, ( \, \ottkw{\%prim} \, = \, ) \, \ottnt{v_{{\mathrm{1}}}} \, ) \, \ottnt{v'_{{\mathrm{1}}}} \, \ottkw{\&\&} \, .... \, \ottkw{\&\&} \, ( \, ( \, \ottkw{\%prim} \, = \, ) \, \ottnt{v_{\ottmv{n}}} \, ) \, \ottnt{v'_{\ottmv{n}}} \, )}{
{\ottdrulename{Jbprim\_equal\_tuple}}{}
}}


\newcommand{\ottdruleJbprimXXequalXXconstr}[1]{\ottdrule[#1]{%
}{
\vdash \, ( \, \ottnt{constr} \, ( \, \ottnt{v_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{v_{\ottmv{n}}} \, ) \, ) \, = \, ( \, \ottnt{constr} \, ( \, \ottnt{v'_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{v'_{\ottmv{n}}} \, ) \, ) \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{AND} \, ( \, ( \, ( \, \ottkw{\%prim} \, = \, ) \, \ottnt{v_{{\mathrm{1}}}} \, ) \, \ottnt{v'_{{\mathrm{1}}}} \, \ottkw{\&\&} \, ... \, \ottkw{\&\&} \, ( \, ( \, \ottkw{\%prim} \, = \, ) \, \ottnt{v_{\ottmv{n}}} \, ) \, \ottnt{v'_{\ottmv{n}}} \, )}{
{\ottdrulename{Jbprim\_equal\_constr}}{}
}}


\newcommand{\ottdruleJbprimXXequalXXconstrXXfalse}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{constr} \, \not = \, \ottnt{constr'}}%
}{
\vdash \, \ottnt{constr} \, ( \, \ottnt{v_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{v_{\ottmv{m}}} \, ) \, = \, \ottnt{constr'} \, ( \, \ottnt{v'_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{v'_{\ottmv{n}}} \, ) \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{false}}{
{\ottdrulename{Jbprim\_equal\_constr\_false}}{}
}}


\newcommand{\ottdruleJbprimXXequalXXconstXXconstrXXfalse}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{constr'} \, = \, \ottnt{constr} \, ( \, \ottnt{v_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{v_{\ottmv{n}}} \, ) \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{false}}{
{\ottdrulename{Jbprim\_equal\_const\_constr\_false}}{}
}}


\newcommand{\ottdruleJbprimXXequalXXconstrXXconstXXfalse}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{constr} \, ( \, \ottnt{v_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{v_{\ottmv{n}}} \, ) \, = \, \ottnt{constr'} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{false}}{
{\ottdrulename{Jbprim\_equal\_constr\_const\_false}}{}
}}


\newcommand{\ottdruleJbprimXXequalXXrec}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{v'} \, = \, \ottkw{\{} \, \ottnt{fn''_{{\mathrm{1}}}} \, = \, \ottnt{v''_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn''_{\ottmv{m}}} \, = \, \ottnt{v''_{\ottmv{m}}} \, \ottkw{\}}}%
\ottpremise{\ottnt{fn_{{\mathrm{1}}}} \, ... \, \ottnt{fn_{\ottmv{n}}} \, \ottkw{PERMUTES} \, \ottnt{fn''_{{\mathrm{1}}}} \, ... \, \ottnt{fn''_{\ottmv{m}}}}%
}{
\vdash \, \ottkw{\{} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn_{\ottmv{n}}} \, = \, \ottnt{v_{\ottmv{n}}} \, \ottkw{\}} \, = \, \ottnt{v'} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{AND} \, ( \, ( \, ( \, \ottkw{\%prim} \, = \, ) \, \ottnt{v_{{\mathrm{1}}}} \, ) \, ( \, \ottnt{v'} \, . \, \ottnt{fn_{{\mathrm{1}}}} \, ) \, \ottkw{\&\&} \, ... \, \ottkw{\&\&} \, ( \, ( \, \ottkw{\%prim} \, = \, ) \, \ottnt{v_{\ottmv{n}}} \, ) \, ( \, \ottnt{v'} \, . \, \ottnt{fn_{\ottmv{n}}} \, ) \, )}{
{\ottdrulename{Jbprim\_equal\_rec}}{}
}}


\newcommand{\ottdruleJbprimXXplus}[1]{\ottdrule[#1]{%
}{
\vdash \, \dot{n}_{{\mathrm{1}}} \, + \, \dot{n}_{{\mathrm{2}}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \,  \dot{n}_{{\mathrm{1}}}  \stackrel\centerdot+  \dot{n}_{{\mathrm{2}}} }{
{\ottdrulename{Jbprim\_plus}}{}
}}


\newcommand{\ottdruleJbprimXXminus}[1]{\ottdrule[#1]{%
}{
\vdash \, \dot{n}_{{\mathrm{1}}} \, - \, \dot{n}_{{\mathrm{2}}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \,  \dot{n}_{{\mathrm{1}}}  \stackrel\centerdot-  \dot{n}_{{\mathrm{2}}} }{
{\ottdrulename{Jbprim\_minus}}{}
}}


\newcommand{\ottdruleJbprimXXtimes}[1]{\ottdrule[#1]{%
}{
\vdash \, \dot{n}_{{\mathrm{1}}} \, \ast \, \dot{n}_{{\mathrm{2}}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \,  \dot{n}_{{\mathrm{1}}}  \stackrel\centerdot*  \dot{n}_{{\mathrm{2}}} }{
{\ottdrulename{Jbprim\_times}}{}
}}


\newcommand{\ottdruleJbprimXXdivZero}[1]{\ottdrule[#1]{%
}{
\vdash \, \dot{n} \, / \, 0 \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottkw{Division\_by\_zero}}{
{\ottdrulename{Jbprim\_div0}}{}
}}


\newcommand{\ottdruleJbprimXXdiv}[1]{\ottdrule[#1]{%
\ottpremise{\dot{n}_{{\mathrm{2}}} \, \not = \, 0}%
}{
\vdash \, \dot{n}_{{\mathrm{1}}} \, / \, \dot{n}_{{\mathrm{2}}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \,  \dot{n}_{{\mathrm{1}}}  \stackrel\centerdot/  \dot{n}_{{\mathrm{2}}} }{
{\ottdrulename{Jbprim\_div}}{}
}}


\newcommand{\ottdruleJbprimXXassign}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottmv{l} \, \ottkw{:=} \, \ottnt{v} \,  \stackrel{  \ottmv{l} \, \ottkw{:=} \, \ottnt{v}  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{()}}{
{\ottdrulename{Jbprim\_assign}}{}
}}

\newcommand{\ottdefnJRbprim}[1]{\begin{ottdefnblock}[#1]{$\vdash \, \ottnt{expr_{{\mathrm{1}}}} \, \ottnt{binary\_prim} \, \ottnt{expr_{{\mathrm{2}}}} \, \stackrel{\ottnt{L} }{\longrightarrow}\ottmaybebreakline \, \ottnt{expr}$}{\ottcom{Binary primitive evaluation}}
\ottusedrule{\ottdruleJbprimXXequalXXfun{}}
\ottusedrule{\ottdruleJbprimXXequalXXconstXXtrue{}}
\ottusedrule{\ottdruleJbprimXXequalXXconstXXfalse{}}
\ottusedruleC{\ottdruleJbprimXXequalXXloc{}}
\ottusedruleC{\ottdruleJbprimXXequalXXcons{}}
\ottusedrule{\ottdruleJbprimXXequalXXconsXXnil{}}
\ottusedrule{\ottdruleJbprimXXequalXXnilXXcons{}}
\ottusedrule{\ottdruleJbprimXXequalXXtuple{}}
\ottusedrule{\ottdruleJbprimXXequalXXconstr{}}
\ottusedrule{\ottdruleJbprimXXequalXXconstrXXfalse{}}
\ottusedrule{\ottdruleJbprimXXequalXXconstXXconstrXXfalse{}}
\ottusedrule{\ottdruleJbprimXXequalXXconstrXXconstXXfalse{}}
\ottusedrule{\ottdruleJbprimXXequalXXrec{}}
\ottusedrule{\ottdruleJbprimXXplus{}}
\ottusedrule{\ottdruleJbprimXXminus{}}
\ottusedrule{\ottdruleJbprimXXtimes{}}
\ottusedrule{\ottdruleJbprimXXdivZero{}}
\ottusedrule{\ottdruleJbprimXXdiv{}}
\ottusedrule{\ottdruleJbprimXXassign{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJRbprim}{
\ottdefnJRbprim{}}


% defns JRmatching_step
% defn matching_step
\newcommand{\ottdruleJRmatchingXXnext}[1]{\ottdrule[#1]{%
\ottpremise{ \neg( \ottnt{v} ~\ottkw{matches}~ \ottnt{pat} ) }%
\ottpremise{\ottkw{length} \, ( \, \ottnt{e_{{\mathrm{1}}}} \, ) \, ... \, ( \, \ottnt{e_{\ottmv{n}}} \, ) \, \geq \, 1}%
}{
\vdash \, \ottnt{v} \, \ottkw{with} \, \ottnt{pat} \, \rightarrow \, \ottnt{e} \, \ottkw{\mbox{$\mid$}} \, \ottnt{pat_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{\mbox{$\mid$}} \, ... \, \ottkw{\mbox{$\mid$}} \, \ottnt{pat_{\ottmv{n}}} \, \rightarrow \, \ottnt{e_{\ottmv{n}}} \, \longrightarrow \, \ottnt{pat_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{\mbox{$\mid$}} \, ... \, \ottkw{\mbox{$\mid$}} \, \ottnt{pat_{\ottmv{n}}} \, \rightarrow \, \ottnt{e_{\ottmv{n}}}}{
{\ottdrulename{JRmatching\_next}}{}
}}

\newcommand{\ottdefnJRmatchingXXstep}[1]{\begin{ottdefnblock}[#1]{$\vdash \, \ottnt{expr} \, \ottkw{with} \, \ottnt{pattern\_matching} \, \longrightarrow \, \ottnt{pattern\_matching'}$}{\ottcom{Pattern matching step}}
\ottusedrule{\ottdruleJRmatchingXXnext{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJRmatchingXXstep}{
\ottdefnJRmatchingXXstep{}}


% defns JRmatching_success
% defn matching_success
\newcommand{\ottdruleJRmatchingXXfound}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{m}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{\ottmv{m}}} \, \}\!\!\}}%
}{
\vdash \, \ottnt{v} \, \ottkw{with} \, \ottnt{pat} \, \rightarrow \, \ottnt{e} \, \ottkw{\mbox{$\mid$}} \, \ottnt{pat_{{\mathrm{1}}}} \, \rightarrow \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{\mbox{$\mid$}} \, ... \, \ottkw{\mbox{$\mid$}} \, \ottnt{pat_{\ottmv{n}}} \, \rightarrow \, \ottnt{e_{\ottmv{n}}} \, \longrightarrow \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{m}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{\ottmv{m}}} \, \}\!\!\} \, \ottnt{e}}{
{\ottdrulename{JRmatching\_found}}{}
}}


\newcommand{\ottdruleJRmatchingXXfail}[1]{\ottdrule[#1]{%
\ottpremise{ \neg( \ottnt{v} ~\ottkw{matches}~ \ottnt{pat} ) }%
}{
\vdash \, \ottnt{v} \, \ottkw{with} \, \ottnt{pat} \, \rightarrow \, \ottnt{e} \, \longrightarrow \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottkw{Match\_failure}}{
{\ottdrulename{JRmatching\_fail}}{}
}}

\newcommand{\ottdefnJRmatchingXXsuccess}[1]{\begin{ottdefnblock}[#1]{$\vdash \, \ottnt{expr} \, \ottkw{with} \, \ottnt{pattern\_matching} \, \longrightarrow \, \ottnt{expr'}$}{\ottcom{Pattern matching finished}}
\ottusedrule{\ottdruleJRmatchingXXfound{}}
\ottusedrule{\ottdruleJRmatchingXXfail{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJRmatchingXXsuccess}{
\ottdefnJRmatchingXXsuccess{}}


% defns Jred
% defn expr
\newcommand{\ottdruleJRXXexprXXuprim}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{unary\_prim} \, \ottnt{v} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e}}%
}{
\vdash \, ( \, \ottkw{\%prim} \, \ottnt{unary\_prim} \, ) \, \ottnt{v} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e}}{
{\ottdrulename{JR\_expr\_uprim}}{}
}}


\newcommand{\ottdruleJRXXexprXXbprim}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v_{{\mathrm{1}}}} \, \ottnt{binary\_prim} \, \ottnt{v_{{\mathrm{2}}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e}}%
}{
\vdash \, ( \, ( \, \ottkw{\%prim} \, \ottnt{binary\_prim} \, ) \, \ottnt{v_{{\mathrm{1}}}} \, ) \, \ottnt{v_{{\mathrm{2}}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e}}{
{\ottdrulename{JR\_expr\_bprim}}{}
}}


\newcommand{\ottdruleJRXXexprXXtypedXXctx}[1]{\ottdrule[#1]{%
}{
\vdash \, ( \, \ottnt{e} \, : \, \ottnt{t} \, ) \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e}}{
{\ottdrulename{JR\_expr\_typed\_ctx}}{}
}}


\newcommand{\ottdruleJRXXexprXXapplyXXctxXXarg}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e_{{\mathrm{0}}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'_{{\mathrm{0}}}}}%
}{
\vdash \, \ottnt{e_{{\mathrm{1}}}} \, \ottnt{e_{{\mathrm{0}}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e_{{\mathrm{1}}}} \, \ottnt{e'_{{\mathrm{0}}}}}{
{\ottdrulename{JR\_expr\_apply\_ctx\_arg}}{}
}}


\newcommand{\ottdruleJRXXexprXXapplyXXraiseOne}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{e} \, ( \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, ) \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_apply\_raise1}}{}
}}


\newcommand{\ottdruleJRXXexprXXapplyXXctxXXfun}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e_{{\mathrm{1}}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'_{{\mathrm{1}}}}}%
}{
\vdash \, \ottnt{e_{{\mathrm{1}}}} \, \ottnt{v_{{\mathrm{0}}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'_{{\mathrm{1}}}} \, \ottnt{v_{{\mathrm{0}}}}}{
{\ottdrulename{JR\_expr\_apply\_ctx\_fun}}{}
}}


\newcommand{\ottdruleJRXXexprXXapplyXXraiseTwo}[1]{\ottdrule[#1]{%
}{
\vdash \, ( \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, ) \, \ottnt{v'} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_apply\_raise2}}{}
}}


\newcommand{\ottdruleJRXXexprXXapply}[1]{\ottdrule[#1]{%
}{
\vdash \, ( \, \ottkw{function} \, \ottnt{pattern\_matching} \, \ottnt{v_{{\mathrm{0}}}} \, ) \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{match} \, \ottnt{v_{{\mathrm{0}}}} \, \ottkw{with} \, \ottnt{pattern\_matching}}{
{\ottdrulename{JR\_expr\_apply}}{}
}}


\newcommand{\ottdruleJRXXexprXXletXXctx}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e_{{\mathrm{0}}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'_{{\mathrm{0}}}}}%
}{
\vdash \, \ottkw{let} \, \ottnt{pat} \, = \, \ottnt{e_{{\mathrm{0}}}} \, \ottkw{in} \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottkw{let} \, \ottnt{pat} \, = \, \ottnt{e'_{{\mathrm{0}}}} \, \ottkw{in} \, \ottnt{e}}{
{\ottdrulename{JR\_expr\_let\_ctx}}{}
}}


\newcommand{\ottdruleJRXXexprXXletXXraise}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{let} \, \ottnt{pat} \, = \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, \ottkw{in} \, \ottnt{e} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_let\_raise}}{}
}}


\newcommand{\ottdruleJRXXexprXXletXXsubst}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{m}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{\ottmv{m}}} \, \}\!\!\}}%
}{
\vdash \, \ottkw{let} \, \ottnt{pat} \, = \, \ottnt{v} \, \ottkw{in} \, \ottnt{e} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{m}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{\ottmv{m}}} \, \}\!\!\} \, \ottnt{e}}{
{\ottdrulename{JR\_expr\_let\_subst}}{}
}}


\newcommand{\ottdruleJRXXexprXXletXXfail}[1]{\ottdrule[#1]{%
\ottpremise{ \neg( \ottnt{v} ~\ottkw{matches}~ \ottnt{pat} ) }%
}{
\vdash \, \ottkw{let} \, \ottnt{pat} \, = \, \ottnt{v} \, \ottkw{in} \, \ottnt{e} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottkw{Match\_failure}}{
{\ottdrulename{JR\_expr\_let\_fail}}{}
}}


\newcommand{\ottdruleJRXXexprXXletrec}[1]{\ottdrule[#1]{%
\ottpremise{ \ottnt{letrec\_bindings}  = ( \ottnt{x_{{\mathrm{1}}}} \, = \, \ottkw{function} \, \ottnt{pattern\_matching_{{\mathrm{1}}}} \, \ottkw{and} \, ... \, \ottkw{and} \, \ottnt{x_{\ottmv{n}}} \, = \, \ottkw{function} \, \ottnt{pattern\_matching_{\ottmv{n}}} ) }%
\ottpremise{\ottkw{recfun} \, ( \, \ottnt{letrec\_bindings} \, , \, \ottnt{pattern\_matching_{{\mathrm{1}}}} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{e_{{\mathrm{1}}}} \quad ... \quad \ottkw{recfun} \, ( \, \ottnt{letrec\_bindings} \, , \, \ottnt{pattern\_matching_{\ottmv{n}}} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{e_{\ottmv{n}}}}%
}{
\vdash \, \ottkw{let} \, \ottkw{rec} \, \ottnt{letrec\_bindings} \, \ottkw{in} \, \ottnt{e} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{e_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{x_{\ottmv{n}}} \, \!\!\leftarrow\!\! \, \ottnt{e_{\ottmv{n}}} \, \}\!\!\} \, \ottnt{e}}{
{\ottdrulename{JR\_expr\_letrec}}{}
}}


\newcommand{\ottdruleJRXXexprXXsequenceXXctxXXleft}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e_{{\mathrm{1}}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'_{{\mathrm{1}}}}}%
}{
\vdash \, \ottnt{e_{{\mathrm{1}}}} \, ; \, \ottnt{e_{{\mathrm{2}}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'_{{\mathrm{1}}}} \, ; \, \ottnt{e_{{\mathrm{2}}}}}{
{\ottdrulename{JR\_expr\_sequence\_ctx\_left}}{}
}}


\newcommand{\ottdruleJRXXexprXXsequenceXXraise}[1]{\ottdrule[#1]{%
}{
\vdash \, ( \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, ) \, ; \, \ottnt{e} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_sequence\_raise}}{}
}}


\newcommand{\ottdruleJRXXexprXXsequence}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{v} \, ; \, \ottnt{e_{{\mathrm{2}}}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e_{{\mathrm{2}}}}}{
{\ottdrulename{JR\_expr\_sequence}}{}
}}


\newcommand{\ottdruleJRXXexprXXifthenelseXXctx}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e_{{\mathrm{1}}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'_{{\mathrm{1}}}}}%
}{
\vdash \, \ottkw{if} \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{then} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{else} \, \ottnt{e_{{\mathrm{3}}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottkw{if} \, \ottnt{e'_{{\mathrm{1}}}} \, \ottkw{then} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{else} \, \ottnt{e_{{\mathrm{3}}}}}{
{\ottdrulename{JR\_expr\_ifthenelse\_ctx}}{}
}}


\newcommand{\ottdruleJRXXexprXXifXXraise}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{if} \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, \ottkw{then} \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{else} \, \ottnt{e_{{\mathrm{2}}}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_if\_raise}}{}
}}


\newcommand{\ottdruleJRXXexprXXifthenelseXXtrue}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{if} \, \ottkw{true} \, \ottkw{then} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{else} \, \ottnt{e_{{\mathrm{3}}}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e_{{\mathrm{2}}}}}{
{\ottdrulename{JR\_expr\_ifthenelse\_true}}{}
}}


\newcommand{\ottdruleJRXXexprXXifthenelseXXfalse}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{if} \, \ottkw{false} \, \ottkw{then} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{else} \, \ottnt{e_{{\mathrm{3}}}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e_{{\mathrm{3}}}}}{
{\ottdrulename{JR\_expr\_ifthenelse\_false}}{}
}}


\newcommand{\ottdruleJRXXexprXXmatchXXctx}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'}}%
}{
\vdash \, \ottkw{match} \, \ottnt{e} \, \ottkw{with} \, \ottnt{pattern\_matching} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottkw{match} \, \ottnt{e'} \, \ottkw{with} \, \ottnt{pattern\_matching}}{
{\ottdrulename{JR\_expr\_match\_ctx}}{}
}}


\newcommand{\ottdruleJRXXexprXXmatchXXraise}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{match} \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, \ottkw{with} \, \ottnt{pattern\_matching} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_match\_raise}}{}
}}


\newcommand{\ottdruleJRXXexprXXmatchXXstep}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v} \, \ottkw{with} \, \ottnt{pattern\_matching} \, \longrightarrow \, \ottnt{pattern\_matching'}}%
}{
\vdash \, \ottkw{match} \, \ottnt{v} \, \ottkw{with} \, \ottnt{pattern\_matching} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{match} \, \ottnt{v} \, \ottkw{with} \, \ottnt{pattern\_matching'}}{
{\ottdrulename{JR\_expr\_match\_step}}{}
}}


\newcommand{\ottdruleJRXXexprXXmatchXXsuccess}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v} \, \ottkw{with} \, \ottnt{pattern\_matching} \, \longrightarrow \, \ottnt{e'}}%
}{
\vdash \, \ottkw{match} \, \ottnt{v} \, \ottkw{with} \, \ottnt{pattern\_matching} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'}}{
{\ottdrulename{JR\_expr\_match\_success}}{}
}}


\newcommand{\ottdruleJRXXexprXXand}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{\&\&} \, \ottnt{e_{{\mathrm{2}}}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{if} \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{then} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{else} \, \ottkw{false}}{
{\ottdrulename{JR\_expr\_and}}{}
}}


\newcommand{\ottdruleJRXXexprXXor}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{\mbox{$\mid$}\mbox{$\mid$}} \, \ottnt{e_{{\mathrm{2}}}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{if} \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{then} \, \ottkw{true} \, \ottkw{else} \, \ottnt{e_{{\mathrm{2}}}}}{
{\ottdrulename{JR\_expr\_or}}{}
}}


\newcommand{\ottdruleJRXXexprXXwhile}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{while} \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{do} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{done} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{if} \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{then} \, ( \, \ottnt{e_{{\mathrm{2}}}} \, ; \, \ottkw{while} \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{do} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{done} \, )}{
{\ottdrulename{JR\_expr\_while}}{}
}}


\newcommand{\ottdruleJRXXexprXXforXXctxOne}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e_{{\mathrm{1}}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'_{{\mathrm{1}}}}}%
}{
\vdash \, \ottkw{for} \, \ottnt{x} \, = \, \ottnt{e_{{\mathrm{1}}}} \, \ottkw{\relax{\sf[}down{\sf]}to} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{do} \, \ottnt{e_{{\mathrm{3}}}} \, \ottkw{done} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottkw{for} \, \ottnt{x} \, = \, \ottnt{e'_{{\mathrm{1}}}} \, \ottkw{\relax{\sf[}down{\sf]}to} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{do} \, \ottnt{e_{{\mathrm{3}}}} \, \ottkw{done}}{
{\ottdrulename{JR\_expr\_for\_ctx1}}{}
}}


\newcommand{\ottdruleJRXXexprXXforXXraiseOne}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{for} \, \ottnt{x} \, = \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, \ottkw{\relax{\sf[}down{\sf]}to} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{do} \, \ottnt{e_{{\mathrm{3}}}} \, \ottkw{done} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_for\_raise1}}{}
}}


\newcommand{\ottdruleJRXXexprXXforXXctxTwo}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e_{{\mathrm{2}}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'_{{\mathrm{2}}}}}%
}{
\vdash \, \ottkw{for} \, \ottnt{x} \, = \, \ottnt{v_{{\mathrm{1}}}} \, \ottkw{\relax{\sf[}down{\sf]}to} \, \ottnt{e_{{\mathrm{2}}}} \, \ottkw{do} \, \ottnt{e_{{\mathrm{3}}}} \, \ottkw{done} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottkw{for} \, \ottnt{x} \, = \, \ottnt{v_{{\mathrm{1}}}} \, \ottkw{\relax{\sf[}down{\sf]}to} \, \ottnt{e'_{{\mathrm{2}}}} \, \ottkw{do} \, \ottnt{e_{{\mathrm{3}}}} \, \ottkw{done}}{
{\ottdrulename{JR\_expr\_for\_ctx2}}{}
}}


\newcommand{\ottdruleJRXXexprXXforXXraiseTwo}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{for} \, \ottnt{x} \, = \, \ottnt{v} \, \ottkw{\relax{\sf[}down{\sf]}to} \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v'} \, \ottkw{do} \, \ottnt{e_{{\mathrm{3}}}} \, \ottkw{done} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v'}}{
{\ottdrulename{JR\_expr\_for\_raise2}}{}
}}


\newcommand{\ottdruleJRXXexprXXforXXtoXXdo}[1]{\ottdrule[#1]{%
\ottpremise{ \dot{n}_{{\mathrm{1}}}  \stackrel\centerdot\leq  \dot{n}_{{\mathrm{2}}} }%
}{
\vdash \, \ottkw{for} \, \ottnt{x} \, = \, \dot{n}_{{\mathrm{1}}} \, \ottkw{to} \, \dot{n}_{{\mathrm{2}}} \, \ottkw{do} \, \ottnt{e} \, \ottkw{done} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{let} \, \ottnt{x} \, = \, \dot{n}_{{\mathrm{1}}} \, \ottkw{in} \, \ottnt{e} \, ) \, ; \, \ottkw{for} \, \ottnt{x} \, = \,  \dot{n}_{{\mathrm{1}}}  \stackrel\centerdot+  1  \, \ottkw{to} \, \dot{n}_{{\mathrm{2}}} \, \ottkw{do} \, \ottnt{e} \, \ottkw{done}}{
{\ottdrulename{JR\_expr\_for\_to\_do}}{}
}}


\newcommand{\ottdruleJRXXexprXXforXXtoXXdone}[1]{\ottdrule[#1]{%
\ottpremise{ \dot{n}_{{\mathrm{1}}}  \stackrel\centerdot >  \dot{n}_{{\mathrm{2}}} }%
}{
\vdash \, \ottkw{for} \, \ottnt{x} \, = \, \dot{n}_{{\mathrm{1}}} \, \ottkw{to} \, \dot{n}_{{\mathrm{2}}} \, \ottkw{do} \, \ottnt{e} \, \ottkw{done} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{()}}{
{\ottdrulename{JR\_expr\_for\_to\_done}}{}
}}


\newcommand{\ottdruleJRXXexprXXforXXdowntoXXdo}[1]{\ottdrule[#1]{%
\ottpremise{ \dot{n}_{{\mathrm{2}}}  \stackrel\centerdot\leq  \dot{n}_{{\mathrm{1}}} }%
}{
\vdash \, \ottkw{for} \, \ottnt{x} \, = \, \dot{n}_{{\mathrm{1}}} \, \ottkw{downto} \, \dot{n}_{{\mathrm{2}}} \, \ottkw{do} \, \ottnt{e} \, \ottkw{done} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{let} \, \ottnt{x} \, = \, \dot{n}_{{\mathrm{1}}} \, \ottkw{in} \, \ottnt{e} \, ) \, ; \, \ottkw{for} \, \ottnt{x} \, = \,  \dot{n}_{{\mathrm{1}}}  \stackrel\centerdot-  1  \, \ottkw{downto} \, \dot{n}_{{\mathrm{2}}} \, \ottkw{do} \, \ottnt{e} \, \ottkw{done}}{
{\ottdrulename{JR\_expr\_for\_downto\_do}}{}
}}


\newcommand{\ottdruleJRXXexprXXforXXdowntoXXdone}[1]{\ottdrule[#1]{%
\ottpremise{ \dot{n}_{{\mathrm{2}}}  \stackrel\centerdot >  \dot{n}_{{\mathrm{1}}} }%
}{
\vdash \, \ottkw{for} \, \ottnt{x} \, = \, \dot{n}_{{\mathrm{1}}} \, \ottkw{downto} \, \dot{n}_{{\mathrm{2}}} \, \ottkw{do} \, \ottnt{e} \, \ottkw{done} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{()}}{
{\ottdrulename{JR\_expr\_for\_downto\_done}}{}
}}


\newcommand{\ottdruleJRXXexprXXtryXXctx}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'}}%
}{
\vdash \, \ottkw{try} \, \ottnt{e} \, \ottkw{with} \, \ottnt{pattern\_matching} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottkw{try} \, \ottnt{e'} \, \ottkw{with} \, \ottnt{pattern\_matching}}{
{\ottdrulename{JR\_expr\_try\_ctx}}{}
}}


\newcommand{\ottdruleJRXXexprXXtryXXreturn}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{try} \, \ottnt{v} \, \ottkw{with} \, \ottnt{pattern\_matching} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_try\_return}}{}
}}


\newcommand{\ottdruleJRXXexprXXtryXXcatch}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{try} \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, \ottkw{with} \, \ottnt{pat\_exp_{{\mathrm{1}}}} \, \ottkw{\mbox{$\mid$}} \, ... \, \ottkw{\mbox{$\mid$}} \, \ottnt{pat\_exp_{\ottmv{n}}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{match} \, \ottnt{v} \, \ottkw{with} \, \ottnt{pat\_exp_{{\mathrm{1}}}} \, \ottkw{\mbox{$\mid$}} \, ... \, \ottkw{\mbox{$\mid$}} \, \ottnt{pat\_exp_{\ottmv{n}}} \, \ottkw{\mbox{$\mid$}} \, \ottkw{\_} \, \rightarrow \, ( \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, )}{
{\ottdrulename{JR\_expr\_try\_catch}}{}
}}


\newcommand{\ottdruleJRXXexprXXtupleXXctx}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'}}%
}{
\vdash \, \ottnt{e_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{e_{\ottmv{m}}} \, , \, \ottnt{e} \, , \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{v_{\ottmv{n}}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{e_{\ottmv{m}}} \, , \, \ottnt{e'} \, , \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{v_{\ottmv{n}}}}{
{\ottdrulename{JR\_expr\_tuple\_ctx}}{}
}}


\newcommand{\ottdruleJRXXexprXXtupleXXraise}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{e_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{e_{\ottmv{m}}} \, , \, ( \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, ) \, , \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{v_{\ottmv{n}}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_tuple\_raise}}{}
}}


\newcommand{\ottdruleJRXXexprXXconstrXXctx}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'}}%
}{
\vdash \, \ottnt{constr} \, ( \, \ottnt{e_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{e_{\ottmv{m}}} \, , \, \ottnt{e} \, , \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{v_{\ottmv{n}}} \, ) \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{constr} \, ( \, \ottnt{e_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{e_{\ottmv{m}}} \, , \, \ottnt{e'} \, , \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{v_{\ottmv{n}}} \, )}{
{\ottdrulename{JR\_expr\_constr\_ctx}}{}
}}


\newcommand{\ottdruleJRXXexprXXconstrXXraise}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{constr} \, ( \, \ottnt{e_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{e_{\ottmv{m}}} \, , \, ( \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, ) \, , \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{v_{\ottmv{n}}} \, ) \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_constr\_raise}}{}
}}


\newcommand{\ottdruleJRXXexprXXconsXXctxOne}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'}}%
}{
\vdash \, \ottnt{e_{{\mathrm{0}}}} \, \ottkw{::} \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e_{{\mathrm{0}}}} \, \ottkw{::} \, \ottnt{e'}}{
{\ottdrulename{JR\_expr\_cons\_ctx1}}{}
}}


\newcommand{\ottdruleJRXXexprXXconsXXraiseOne}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{e} \, \ottkw{::} \, ( \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, ) \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_cons\_raise1}}{}
}}


\newcommand{\ottdruleJRXXexprXXconsXXctxTwo}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'}}%
}{
\vdash \, \ottnt{e} \, \ottkw{::} \, \ottnt{v} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'} \, \ottkw{::} \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_cons\_ctx2}}{}
}}


\newcommand{\ottdruleJRXXexprXXconsXXraiseTwo}[1]{\ottdrule[#1]{%
}{
\vdash \, ( \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, ) \, \ottkw{::} \, \ottnt{v'} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_cons\_raise2}}{}
}}


\newcommand{\ottdruleJRXXexprXXrecordXXctx}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{expr} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{expr'}}%
}{
\vdash \, \ottkw{\{} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{e_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn_{\ottmv{m}}} \, = \, \ottnt{e_{\ottmv{m}}} \, ; \, \ottnt{field\_name} \, = \, \ottnt{expr} \, ; \, \ottnt{fn'_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn'_{\ottmv{n}}} \, = \, \ottnt{v_{\ottmv{n}}} \, \ottkw{\}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottkw{\{} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{e_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn_{\ottmv{m}}} \, = \, \ottnt{e_{\ottmv{m}}} \, ; \, \ottnt{field\_name} \, = \, \ottnt{expr'} \, ; \, \ottnt{fn'_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn'_{\ottmv{n}}} \, = \, \ottnt{v_{\ottmv{n}}} \, \ottkw{\}}}{
{\ottdrulename{JR\_expr\_record\_ctx}}{}
}}


\newcommand{\ottdruleJRXXexprXXrecordXXraise}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{\{} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{e_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn_{\ottmv{m}}} \, = \, \ottnt{e_{\ottmv{m}}} \, ; \, \ottnt{fn} \, = \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, ; \, \ottnt{fn'_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn'_{\ottmv{n}}} \, = \, \ottnt{v_{\ottmv{n}}} \, \ottkw{\}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_record\_raise}}{}
}}


\newcommand{\ottdruleJRXXexprXXrecordXXwithXXctxOne}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'}}%
}{
\vdash \, \ottkw{\{} \, \ottnt{v} \, \ottkw{with} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{e_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn_{\ottmv{m}}} \, = \, \ottnt{e_{\ottmv{m}}} \, ; \, \ottnt{field\_name} \, = \, \ottnt{e} \, ; \, \ottnt{fn'_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn'_{\ottmv{n}}} \, = \, \ottnt{v_{\ottmv{n}}} \, \ottkw{\}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottkw{\{} \, \ottnt{v} \, \ottkw{with} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{e_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn_{\ottmv{m}}} \, = \, \ottnt{e_{\ottmv{m}}} \, ; \, \ottnt{field\_name} \, = \, \ottnt{e'} \, ; \, \ottnt{fn'_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn'_{\ottmv{n}}} \, = \, \ottnt{v_{\ottmv{n}}} \, \ottkw{\}}}{
{\ottdrulename{JR\_expr\_record\_with\_ctx1}}{}
}}


\newcommand{\ottdruleJRXXexprXXrecordXXwithXXraiseOne}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{\{} \, \ottnt{v'} \, \ottkw{with} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{e_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn_{\ottmv{m}}} \, = \, \ottnt{e_{\ottmv{m}}} \, ; \, \ottnt{fn} \, = \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, ; \, \ottnt{fn'_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn'_{\ottmv{n}}} \, = \, \ottnt{v_{\ottmv{n}}} \, \ottkw{\}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_record\_with\_raise1}}{}
}}


\newcommand{\ottdruleJRXXexprXXrecordXXwithXXctxTwo}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'}}%
}{
\vdash \, \ottkw{\{} \, \ottnt{e} \, \ottkw{with} \, \ottnt{field\_name_{{\mathrm{1}}}} \, = \, \ottnt{e_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{n}}} \, = \, \ottnt{e_{\ottmv{n}}} \, \ottkw{\}} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottkw{\{} \, \ottnt{e'} \, \ottkw{with} \, \ottnt{field\_name_{{\mathrm{1}}}} \, = \, \ottnt{e_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{n}}} \, = \, \ottnt{e_{\ottmv{n}}} \, \ottkw{\}}}{
{\ottdrulename{JR\_expr\_record\_with\_ctx2}}{}
}}


\newcommand{\ottdruleJRXXexprXXrecordXXraiseXXctxTwo}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{\{} \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, \ottkw{with} \, \ottnt{field\_name_{{\mathrm{1}}}} \, = \, \ottnt{e_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{field\_name_{\ottmv{n}}} \, = \, \ottnt{e_{\ottmv{n}}} \, \ottkw{\}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_record\_raise\_ctx2}}{}
}}


\newcommand{\ottdruleJRXXexprXXrecordXXwithXXmany}[1]{\ottdrule[#1]{%
\ottpremise{\ottkw{length} \, ( \, \ottnt{v''_{{\mathrm{1}}}} \, ) \, ... \, ( \, \ottnt{v''_{\ottmv{l}}} \, ) \, \geq \, 1}%
\ottpremise{\ottnt{field\_name} \, \notin \, \ottnt{fn_{{\mathrm{1}}}} \, ... \, \ottnt{fn_{\ottmv{m}}}}%
}{
\vdash \, \ottkw{\{} \, \ottkw{\{} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn_{\ottmv{m}}} \, = \, \ottnt{v_{\ottmv{m}}} \, ; \, \ottnt{field\_name} \, = \, \ottnt{v} \, ; \, \ottnt{fn'_{{\mathrm{1}}}} \, = \, \ottnt{v'_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn'_{\ottmv{n}}} \, = \, \ottnt{v'_{\ottmv{n}}} \, \ottkw{\}} \, \ottkw{with} \, \ottnt{field\_name} \, = \, \ottnt{v'} \, ; \, \ottnt{fn''_{{\mathrm{1}}}} \, = \, \ottnt{v''_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn''_{\ottmv{l}}} \, = \, \ottnt{v''_{\ottmv{l}}} \, \ottkw{\}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{\{} \, \ottkw{\{} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn_{\ottmv{m}}} \, = \, \ottnt{v_{\ottmv{m}}} \, ; \, \ottnt{field\_name} \, = \, \ottnt{v'} \, ; \, \ottnt{fn'_{{\mathrm{1}}}} \, = \, \ottnt{v'_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn'_{\ottmv{n}}} \, = \, \ottnt{v'_{\ottmv{n}}} \, \ottkw{\}} \, \ottkw{with} \, \ottnt{fn''_{{\mathrm{1}}}} \, = \, \ottnt{v''_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn''_{\ottmv{l}}} \, = \, \ottnt{v''_{\ottmv{l}}} \, \ottkw{\}}}{
{\ottdrulename{JR\_expr\_record\_with\_many}}{}
}}


\newcommand{\ottdruleJRXXexprXXrecordXXwithXXOne}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{field\_name} \, \notin \, \ottnt{fn_{{\mathrm{1}}}} \, ... \, \ottnt{fn_{\ottmv{m}}}}%
}{
\vdash \, \ottkw{\{} \, \ottkw{\{} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn_{\ottmv{m}}} \, = \, \ottnt{v_{\ottmv{m}}} \, ; \, \ottnt{field\_name} \, = \, \ottnt{v} \, ; \, \ottnt{fn'_{{\mathrm{1}}}} \, = \, \ottnt{v'_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn'_{\ottmv{n}}} \, = \, \ottnt{v'_{\ottmv{n}}} \, \ottkw{\}} \, \ottkw{with} \, \ottnt{field\_name} \, = \, \ottnt{v'} \, \ottkw{\}} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{\{} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn_{\ottmv{m}}} \, = \, \ottnt{v_{\ottmv{m}}} \, ; \, \ottnt{field\_name} \, = \, \ottnt{v'} \, ; \, \ottnt{fn'_{{\mathrm{1}}}} \, = \, \ottnt{v'_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn'_{\ottmv{n}}} \, = \, \ottnt{v'_{\ottmv{n}}} \, \ottkw{\}}}{
{\ottdrulename{JR\_expr\_record\_with\_1}}{}
}}


\newcommand{\ottdruleJRXXexprXXrecordXXaccessXXctx}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'}}%
}{
\vdash \, \ottnt{e} \, . \, \ottnt{field\_name} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'} \, . \, \ottnt{field\_name}}{
{\ottdrulename{JR\_expr\_record\_access\_ctx}}{}
}}


\newcommand{\ottdruleJRXXexprXXrecordXXaccessXXraise}[1]{\ottdrule[#1]{%
}{
\vdash \, ( \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, ) \, . \, \ottnt{field\_name} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_record\_access\_raise}}{}
}}


\newcommand{\ottdruleJRXXexprXXrecordXXaccess}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{field\_name} \, \notin \, \ottnt{fn_{{\mathrm{1}}}} \, ... \, \ottnt{fn_{\ottmv{n}}}}%
}{
\vdash \, \ottkw{\{} \, \ottnt{fn_{{\mathrm{1}}}} \, = \, \ottnt{v_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn_{\ottmv{n}}} \, = \, \ottnt{v_{\ottmv{n}}} \, ; \, \ottnt{field\_name} \, = \, \ottnt{v} \, ; \, \ottnt{fn'_{{\mathrm{1}}}} \, = \, \ottnt{v'_{{\mathrm{1}}}} \, ; \, ... \, ; \, \ottnt{fn'_{\ottmv{m}}} \, = \, \ottnt{v'_{\ottmv{m}}} \, \ottkw{\}} \, . \, \ottnt{field\_name} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_record\_access}}{}
}}


\newcommand{\ottdruleJRXXexprXXassertXXctx}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'}}%
}{
\vdash \, \ottkw{assert} \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottkw{assert} \, \ottnt{e'}}{
{\ottdrulename{JR\_expr\_assert\_ctx}}{}
}}


\newcommand{\ottdruleJRXXexprXXassertXXraise}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{assert} \, ( \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, ) \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v}}{
{\ottdrulename{JR\_expr\_assert\_raise}}{}
}}


\newcommand{\ottdruleJRXXexprXXassertXXtrue}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{assert} \, \ottkw{true} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottkw{()}}{
{\ottdrulename{JR\_expr\_assert\_true}}{}
}}


\newcommand{\ottdruleJRXXexprXXassertXXfalse}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottkw{assert} \, \ottkw{false} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottkw{Assert\_failure}}{
{\ottdrulename{JR\_expr\_assert\_false}}{}
}}

\newcommand{\ottdefnJRXXexpr}[1]{\begin{ottdefnblock}[#1]{$\vdash \, \ottnt{expr} \, \stackrel{\ottnt{L} }{\longrightarrow}\ottmaybebreakline \, \ottnt{expr'}$}{\ottcom{Expression evaluation}}
\ottusedrule{\ottdruleJRXXexprXXuprim{}}
\ottusedrule{\ottdruleJRXXexprXXbprim{}}
\ottusedrule{\ottdruleJRXXexprXXtypedXXctx{}}
\ottusedrule{\ottdruleJRXXexprXXapplyXXctxXXarg{}}
\ottusedrule{\ottdruleJRXXexprXXapplyXXraiseOne{}}
\ottusedruleC{\ottdruleJRXXexprXXapplyXXctxXXfun{}}
\ottusedrule{\ottdruleJRXXexprXXapplyXXraiseTwo{}}
\ottusedrule{\ottdruleJRXXexprXXapply{}}
\ottusedrule{\ottdruleJRXXexprXXletXXctx{}}
\ottusedrule{\ottdruleJRXXexprXXletXXraise{}}
\ottusedrule{\ottdruleJRXXexprXXletXXsubst{}}
\ottusedruleC{\ottdruleJRXXexprXXletXXfail{}}
\ottusedrule{\ottdruleJRXXexprXXletrec{}}
\ottusedrule{\ottdruleJRXXexprXXsequenceXXctxXXleft{}}
\ottusedrule{\ottdruleJRXXexprXXsequenceXXraise{}}
\ottusedrule{\ottdruleJRXXexprXXsequence{}}
\ottusedrule{\ottdruleJRXXexprXXifthenelseXXctx{}}
\ottusedrule{\ottdruleJRXXexprXXifXXraise{}}
\ottusedrule{\ottdruleJRXXexprXXifthenelseXXtrue{}}
\ottusedrule{\ottdruleJRXXexprXXifthenelseXXfalse{}}
\ottusedrule{\ottdruleJRXXexprXXmatchXXctx{}}
\ottusedrule{\ottdruleJRXXexprXXmatchXXraise{}}
\ottusedrule{\ottdruleJRXXexprXXmatchXXstep{}}
\ottusedrule{\ottdruleJRXXexprXXmatchXXsuccess{}}
\ottusedrule{\ottdruleJRXXexprXXand{}}
\ottusedrule{\ottdruleJRXXexprXXor{}}
\ottusedrule{\ottdruleJRXXexprXXwhile{}}
\ottusedrule{\ottdruleJRXXexprXXforXXctxOne{}}
\ottusedrule{\ottdruleJRXXexprXXforXXraiseOne{}}
\ottusedrule{\ottdruleJRXXexprXXforXXctxTwo{}}
\ottusedrule{\ottdruleJRXXexprXXforXXraiseTwo{}}
\ottusedrule{\ottdruleJRXXexprXXforXXtoXXdo{}}
\ottusedrule{\ottdruleJRXXexprXXforXXtoXXdone{}}
\ottusedrule{\ottdruleJRXXexprXXforXXdowntoXXdo{}}
\ottusedrule{\ottdruleJRXXexprXXforXXdowntoXXdone{}}
\ottusedrule{\ottdruleJRXXexprXXtryXXctx{}}
\ottusedrule{\ottdruleJRXXexprXXtryXXreturn{}}
\ottusedrule{\ottdruleJRXXexprXXtryXXcatch{}}
\ottusedrule{\ottdruleJRXXexprXXtupleXXctx{}}
\ottusedrule{\ottdruleJRXXexprXXtupleXXraise{}}
\ottusedrule{\ottdruleJRXXexprXXconstrXXctx{}}
\ottusedrule{\ottdruleJRXXexprXXconstrXXraise{}}
\ottusedrule{\ottdruleJRXXexprXXconsXXctxOne{}}
\ottusedrule{\ottdruleJRXXexprXXconsXXraiseOne{}}
\ottusedrule{\ottdruleJRXXexprXXconsXXctxTwo{}}
\ottusedrule{\ottdruleJRXXexprXXconsXXraiseTwo{}}
\ottbreakconclusionlinetrue
\ottusedrule{\ottdruleJRXXexprXXrecordXXctx{}}
\ottbreakconclusionlinefalse
\ottusedrule{\ottdruleJRXXexprXXrecordXXraise{}}
\ottbreakconclusionlinetrue
\ottusedrule{\ottdruleJRXXexprXXrecordXXwithXXctxOne{}}
\ottbreakconclusionlinefalse
\ottusedrule{\ottdruleJRXXexprXXrecordXXwithXXraiseOne{}}
\ottusedrule{\ottdruleJRXXexprXXrecordXXwithXXctxTwo{}}
\ottusedrule{\ottdruleJRXXexprXXrecordXXraiseXXctxTwo{}}
\ottbreakconclusionlinetrue
\ottusedrule{\ottdruleJRXXexprXXrecordXXwithXXmany{}}
\ottusedrule{\ottdruleJRXXexprXXrecordXXwithXXOne{}}
\ottbreakconclusionlinefalse
\ottusedrule{\ottdruleJRXXexprXXrecordXXaccessXXctx{}}
\ottusedrule{\ottdruleJRXXexprXXrecordXXaccessXXraise{}}
\ottusedrule{\ottdruleJRXXexprXXrecordXXaccess{}}
\ottusedrule{\ottdruleJRXXexprXXassertXXctx{}}
\ottusedrule{\ottdruleJRXXexprXXassertXXraise{}}
\ottusedrule{\ottdruleJRXXexprXXassertXXtrue{}}
\ottusedrule{\ottdruleJRXXexprXXassertXXfalse{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJred}{
\ottdefnJRXXexpr{}}


% defns JRdefn
% defn Rdefn
\newcommand{\ottdruleJdefnXXletXXctx}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{e} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{e'}}%
}{
 \vdash \langle  \ottnt{ds\_value}  ,  \ottkw{let} \, \ottnt{pat} \, = \, \ottnt{e} \, \ottkw{;;} \, \ottnt{definitions}  \rangle   \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline   \langle  \ottnt{ds\_value}  ,  \ottkw{let} \, \ottnt{pat} \, = \, \ottnt{e'} \, \ottkw{;;} \, \ottnt{definitions}  \rangle }{
{\ottdrulename{Jdefn\_let\_ctx}}{}
}}


\newcommand{\ottdruleJdefnXXletXXraise}[1]{\ottdrule[#1]{%
}{
 \vdash \langle  \ottnt{ds\_value}  ,  \ottkw{let} \, \ottnt{pat} \, = \, ( \, \ottkw{\%prim} \, \ottkw{raise} \, ) \, \ottnt{v} \, \ottkw{;;} \, \ottnt{definitions}  \rangle   \stackrel{  }{\longrightarrow}\ottmaybebreakline   \langle  \ottnt{ds\_value}  ,  \ottkw{(\%prim} \, \ottkw{raise)} \, \ottnt{v}  \rangle }{
{\ottdrulename{Jdefn\_let\_raise}}{}
}}


\newcommand{\ottdruleJdefnXXletXXmatch}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{v} \, \ottkw{matches} \, \ottnt{pat} \, \;\vartriangleright\;\ottmaybebreakline \, \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{m}}} \, \!\!\leftarrow\!\! \, \ottnt{v_{\ottmv{m}}} \, \}\!\!\}}%
}{
 \vdash \langle  \ottnt{ds\_value}  ,  \ottkw{let} \, \ottnt{pat} \, = \, \ottnt{v} \, \ottkw{;;} \, \ottnt{definitions}  \rangle   \stackrel{  }{\longrightarrow}\ottmaybebreakline   \langle  \ottnt{ds\_value}  ,  \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottkw{remv\_tyvar} \, \ottnt{v_{{\mathrm{1}}}} \, , \, .. \, , \, \ottnt{x_{\ottmv{m}}} \, \!\!\leftarrow\!\! \, \ottkw{remv\_tyvar} \, \ottnt{v_{\ottmv{m}}} \, \}\!\!\} \, \ottnt{definitions}  \rangle }{
{\ottdrulename{Jdefn\_let\_match}}{}
}}


\newcommand{\ottdruleJdefnXXletXXnotXXmatch}[1]{\ottdrule[#1]{%
\ottpremise{ \neg( \ottnt{v} ~\ottkw{matches}~ \ottnt{pat} ) }%
}{
 \vdash \langle  \ottnt{ds\_value}  ,  \ottkw{let} \, \ottnt{pat} \, = \, \ottnt{v} \, \ottkw{;;} \, \ottnt{definitions}  \rangle   \stackrel{  }{\longrightarrow}\ottmaybebreakline   \langle  \ottnt{ds\_value}  ,  \ottkw{(\%prim} \, \ottkw{raise)} \, \ottkw{Match\_failure}  \rangle }{
{\ottdrulename{Jdefn\_let\_not\_match}}{}
}}


\newcommand{\ottdruleJdefnXXletrec}[1]{\ottdrule[#1]{%
\ottpremise{ \ottnt{letrec\_bindings}  = ( \ottnt{x_{{\mathrm{1}}}} \, = \, \ottkw{function} \, \ottnt{pattern\_matching_{{\mathrm{1}}}} \, \ottkw{and} \, ... \, \ottkw{and} \, \ottnt{x_{\ottmv{n}}} \, = \, \ottkw{function} \, \ottnt{pattern\_matching_{\ottmv{n}}} ) }%
\ottpremise{\ottkw{recfun} \, ( \, \ottnt{letrec\_bindings} \, , \, \ottnt{pattern\_matching_{{\mathrm{1}}}} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{e_{{\mathrm{1}}}} \quad ... \quad \ottkw{recfun} \, ( \, \ottnt{letrec\_bindings} \, , \, \ottnt{pattern\_matching_{\ottmv{n}}} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{e_{\ottmv{n}}}}%
}{
 \vdash \langle  \ottnt{ds\_value}  ,  \ottkw{let} \, \ottkw{rec} \, \ottnt{letrec\_bindings} \, \ottkw{;;} \, \ottnt{definitions}  \rangle   \stackrel{  }{\longrightarrow}\ottmaybebreakline   \langle  \ottnt{ds\_value}  ,  \{\!\!\{ \, \ottnt{x_{{\mathrm{1}}}} \, \!\!\leftarrow\!\! \, \ottkw{remv\_tyvar} \, \ottnt{e_{{\mathrm{1}}}} \, , \, ... \, , \, \ottnt{x_{\ottmv{n}}} \, \!\!\leftarrow\!\! \, \ottkw{remv\_tyvar} \, \ottnt{e_{\ottmv{n}}} \, \}\!\!\} \, \ottnt{definitions}  \rangle }{
{\ottdrulename{Jdefn\_letrec}}{}
}}


\newcommand{\ottdruleJdefnXXtype}[1]{\ottdrule[#1]{%
}{
 \vdash \langle  \ottnt{ds\_value}  ,  \ottnt{type\_definition} \, \ottkw{;;} \, \ottnt{definitions}  \rangle   \stackrel{  }{\longrightarrow}\ottmaybebreakline   \langle  \ottnt{ds\_value} \, \ottkw{;;} \, \ottnt{type\_definition}  ,  \ottnt{definitions}  \rangle }{
{\ottdrulename{Jdefn\_type}}{}
}}


\newcommand{\ottdruleJdefnXXexn}[1]{\ottdrule[#1]{%
}{
 \vdash \langle  \ottnt{ds\_value}  ,  \ottnt{exception\_definition} \, \ottkw{;;} \, \ottnt{definitions}  \rangle   \stackrel{  }{\longrightarrow}\ottmaybebreakline   \langle  \ottnt{ds\_value} \, \ottkw{;;} \, \ottnt{exception\_definition}  ,  \ottnt{definitions}  \rangle }{
{\ottdrulename{Jdefn\_exn}}{}
}}

\newcommand{\ottdefnJRdefn}[1]{\begin{ottdefnblock}[#1]{$ \vdash \langle  \ottnt{definitions}  ,  \ottnt{program}  \rangle  \stackrel{\ottnt{L} }{\longrightarrow}\ottmaybebreakline  \langle  \ottnt{definitions'}  ,  \ottnt{program'}  \rangle $}{\ottcom{Definition sequence evaluation}}
\ottusedrule{\ottdruleJdefnXXletXXctx{}}
\ottusedrule{\ottdruleJdefnXXletXXraise{}}
\ottusedrule{\ottdruleJdefnXXletXXmatch{}}
\ottusedrule{\ottdruleJdefnXXletXXnotXXmatch{}}
\ottusedrule{\ottdruleJdefnXXletrec{}}
\ottusedrule{\ottdruleJdefnXXtype{}}
\ottusedrule{\ottdruleJdefnXXexn{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJRdefn}{
\ottdefnJRdefn{}}


% defns JSlookup
% defn lookup
\newcommand{\ottdruleJSstlookupXXrec}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{st} \, ( \, \ottmv{l} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{e'}}%
\ottpremise{\ottmv{l} \, \not = \, \ottmv{l'}}%
}{
\ottnt{st} \, , \, \ottmv{l'} \, \mapsto \, \ottnt{e} \, ( \, \ottmv{l} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{e'}}{
{\ottdrulename{JSstlookup\_rec}}{}
}}


\newcommand{\ottdruleJSstlookupXXfound}[1]{\ottdrule[#1]{%
}{
\ottnt{st} \, , \, \ottmv{l} \, \mapsto \, \ottnt{e} \, ( \, \ottmv{l} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{e}}{
{\ottdrulename{JSstlookup\_found}}{}
}}

\newcommand{\ottdefnJSlookup}[1]{\begin{ottdefnblock}[#1]{$\ottnt{store} \, ( \, \ottmv{location} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{expr}$}{\ottcom{Store lookup}}
\ottusedrule{\ottdruleJSstlookupXXrec{}}
\ottusedrule{\ottdruleJSstlookupXXfound{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJSlookup}{
\ottdefnJSlookup{}}


% defns JRstore
% defn store
\newcommand{\ottdruleJRstoreXXempty}[1]{\ottdrule[#1]{%
}{
\vdash \, \ottnt{st} \,  \stackrel{  }{\longrightarrow}\ottmaybebreakline  \, \ottnt{st}}{
{\ottdrulename{JRstore\_empty}}{}
}}


\newcommand{\ottdruleJRstoreXXlookup}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{st} \, ( \, \ottmv{l} \, ) \, \;\vartriangleright\;\ottmaybebreakline \, \ottnt{v}}%
}{
\vdash \, \ottnt{st} \,  \stackrel{  ! \, \ottmv{l} \, = \, \ottnt{v}  }{\longrightarrow}\ottmaybebreakline  \, \ottnt{st}}{
{\ottdrulename{JRstore\_lookup}}{}
}}


\newcommand{\ottdruleJRstoreXXassign}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{st'} \, ( \, \ottmv{l} \, ) \, \ottkw{unallocated}}%
}{
\vdash \, \ottnt{st} \, , \, \ottmv{l} \, \mapsto \, \ottnt{expr} \, , \, \ottnt{st'} \,  \stackrel{  \ottmv{l} \, \ottkw{:=} \, \ottnt{v}  }{\longrightarrow}\ottmaybebreakline  \, \ottnt{st} \, , \, \ottmv{l} \, \mapsto \, \ottkw{remv\_tyvar} \, \ottnt{v} \, , \, \ottnt{st'}}{
{\ottdrulename{JRstore\_assign}}{}
}}


\newcommand{\ottdruleJRstoreXXalloc}[1]{\ottdrule[#1]{%
\ottpremise{\ottnt{st} \, ( \, \ottmv{l} \, ) \, \ottkw{unallocated}}%
}{
\vdash \, \ottnt{st} \,  \stackrel{  \ottkw{ref} \, \ottnt{v} \, = \, \ottmv{l}  }{\longrightarrow}\ottmaybebreakline  \, \ottnt{st} \, , \, \ottmv{l} \, \mapsto \, \ottkw{remv\_tyvar} \, \ottnt{v}}{
{\ottdrulename{JRstore\_alloc}}{}
}}

\newcommand{\ottdefnJRstore}[1]{\begin{ottdefnblock}[#1]{$\vdash \, \ottnt{store} \, \stackrel{\ottnt{L} }{\longrightarrow}\ottmaybebreakline \, \ottnt{store'}$}{\ottcom{Store transition}}
\ottusedrule{\ottdruleJRstoreXXempty{}}
\ottusedrule{\ottdruleJRstoreXXlookup{}}
\ottusedrule{\ottdruleJRstoreXXassign{}}
\ottusedruleC{\ottdruleJRstoreXXalloc{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJRstore}{
\ottdefnJRstore{}}


% defns JRtop
% defn top
\newcommand{\ottdruleJRtopXXdefs}[1]{\ottdrule[#1]{%
\ottpremise{\vdash \, \ottnt{store} \,  \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline  \, \ottnt{store'}}%
\ottpremise{ \vdash \langle  \ottnt{definitions\_value}  ,  \ottnt{program}  \rangle   \stackrel{ \ottnt{L} }{\longrightarrow}\ottmaybebreakline   \langle  \ottnt{definitions}  ,  \ottnt{program'}  \rangle }%
}{
 \vdash \langle  \ottnt{definitions\_value}  ,  \ottnt{program}  ,  \ottnt{store}  \rangle  \longrightarrow  \langle  \ottnt{definitions}  ,  \ottnt{program'}  ,  \ottnt{store'}  \rangle }{
{\ottdrulename{JRtop\_defs}}{}
}}

\newcommand{\ottdefnJRtop}[1]{\begin{ottdefnblock}[#1]{$ \vdash \langle  \ottnt{definitions}  ,  \ottnt{program}  ,  \ottnt{store}  \rangle  \longrightarrow  \langle  \ottnt{definitions'}  ,  \ottnt{program'}  ,  \ottnt{store'}  \rangle $}{\ottcom{Top-level reduction}}
\ottusedruleC{\ottdruleJRtopXXdefs{}}
\end{ottdefnblock}}


\newcommand{\ottdefnsJRtop}{
\ottdefnJRtop{}}

% defns Jdbehaviour
% defn dbehaviour
\newcommand{\ottdruleJRBXXbehaviourXXvalue}[1]{\ottdrule[#1]{%
}{
 \vdash \langle  \ottnt{definitions\_value}  ,    ,  \ottnt{store}  \rangle  \ottkw{behaves} }{
{\ottdrulename{JRB\_behaviour\_value}}{}
}}


\newcommand{\ottdruleJRBXXbehaviourXXreduces}[1]{\ottdrule[#1]{%
\ottpremise{ \vdash \langle  \ottnt{definitions\_value}  ,  \ottnt{program}  ,  \ottnt{store}  \rangle  \longrightarrow  \langle  \ottnt{definitions'}  ,  \ottnt{program'}  ,  \ottnt{store'}  \rangle }%
}{
 \vdash \langle  \ottnt{definitions\_value}  ,  \ottnt{program}  ,  \ottnt{store}  \rangle  \ottkw{behaves} }{
{\ottdrulename{JRB\_behaviour\_reduces}}{}
}}


\newcommand{\ottdruleJRBXXbehaviourXXraises}[1]{\ottdrule[#1]{%
}{
 \vdash \langle  \ottnt{definitions\_value}  ,  \ottkw{(\%prim} \, \ottkw{raise)} \, \ottnt{v}  ,  \ottnt{store}  \rangle  \ottkw{behaves} }{
{\ottdrulename{JRB\_behaviour\_raises}}{}
}}

\newcommand{\ottdefnJRBXXdbehaviour}[1]{\begin{ottdefnblock}[#1]{$ \vdash \langle  \ottnt{definitions}  ,  \ottnt{program}  ,  \ottnt{store}  \rangle  \ottkw{behaves} $}{\ottcom{structure body behaviour}}
\ottusedrule{\ottdruleJRBXXbehaviourXXvalue{}}
\ottusedrule{\ottdruleJRBXXbehaviourXXreduces{}}
\ottusedrule{\ottdruleJRBXXbehaviourXXraises{}}

\end{ottdefnblock}}


\newcommand{\ottdefnsJdbehaviour}{
\ottdefnJRBXXdbehaviour{}}

\begin{document}
%\scalebox{.25}{
%\framebox{
%\begin{minipage}{24cm}
%\section{Type system}
%\ottdefnsJdomEB
%\ottdefnsJdomE
%\ottdefnsJlookup
%\ottdefnsJidx
%\ottdefnsJTtpsXXkind
%\ottdefnsJTEok
%\ottdefnsJTeq
%\ottdefnsJTidxsub
%\ottdefnsJTinst
%\end{minipage}
%}}
%
%\scalebox{.25}{
%\framebox{
%\begin{minipage}{29.7cm}
%\ottdefnsJTinstXXnamed
%\ottdefnsJTinstXXany
%\ottdefnsJTval
%\ottdefnsJTfield
%\ottdefnsJTconstrXXp
%\ottdefnsJTconstrXXc
%\ottdefnsJTconst
%\ottdefnsJTpat
%\ottdefnsJTuprim
%\ottdefnsJTbprim
%\ottdefnsJTe
%\ottdefnsJTconstrXXdecl
%\ottdefnsJTfieldXXdecl
%\ottdefnsJTtypedef
%\ottdefnsJTtypeXXdefinition
%\ottdefnsJTdefinition
%\ottdefnsJTdefinitions
%\ottdefnsJTprog
%\ottdefnsJTstore
%\ottdefnsJTtop
%\ottdefnsJTLin
%\ottdefnsJTLout
%\end{minipage}
%}}

\newcommand{\OCL}{OCaml$_\textit{light}$}

\newenvironment{vtightlist}{\begin{list}{$\bullet\;$}{\setlength{\topsep}{0.2ex}\setlength{\itemsep}{0.0ex}\setlength{\labelsep}{0.0ex}\setlength{\labelwidth}{5mm}\setlength{\parsep}{0.0ex}\setlength{\itemindent}{0mm}\setlength{\leftmargin}{5mm}}}{\end{list}}

\newenvironment{mtightlist}{\begin{list}{$\bullet\;$}{\setlength{\topsep}{0.8ex}\setlength{\itemsep}{0.6ex}\setlength{\labelsep}{0.0ex}\setlength{\labelwidth}{5mm}\setlength{\parsep}{0.6ex}\setlength{\itemindent}{0mm}\setlength{\leftmargin}{5mm}}}{\end{list}}

\newrgbcolor{pmc}{.0 .5  .5}


\hspace*{6cm}
{\pmc\sf\Large OCaml$_{\textit{light}}$ in Ott \hfill \large Scott Owens}

\vspace{10pt}

\sf

\noindent \OCL{} (ESOP '08) is a formal semantics for a substantial subset of the Objective Caml
core language, suitable for writing and verifying real programs. 

\scalebox{.5}{
\begin{minipage}{15cm}
\huge
{\color{blue}\OCL{} key points}
\begin{itemize}
\item
Written in Ott
\item
Faithful to Objective Caml (very nearly)
\item
Type soundness proof mechanized in HOL\\
(Coq and Isabelle/HOL definitions generated too)

\item
Operational semantics validated on test programs
\item
Small-step operational semantics (131 rules)

%\begin{itemize}
%\Large
%\item
%Inductively defined relations
%\item
%SOS-style
%\item
%Labelled transitions for state
%\item
%Substution-based
%\end{itemize}
\item
Type system (179 rules, below)
%\begin{itemize}
%\Large
%\item
%Inductively defined relations
%\item
%Syntactic
%\item
%Declarative (non-algorithmic)
%\end{itemize}

\end{itemize}
\end{minipage}
}
%
\hspace{1.5cm}
%
\scalebox{.52}{
\begin{minipage}{16.5cm}
\huge

\vspace{10pt}
\Large
\begin{vtightlist}
\item
definitions:
\begin{vtightlist}
\item[-- ]
variant data types (e.g., \texttt{type t = I of int | C of char}),
\item[-- ]
record types (e.g., \texttt{type t = \{f : int; g : bool\}}),
\item[-- ]
parametric type constructors (e.g., \texttt{type 'a t = C of 'a}),
\item[-- ]
type abbreviations (e.g., \texttt{type 'a t = 'a * int}),
\item[-- ]
mutually recursive combinations of the above (excepting abbreviations),
\item[-- ]
exceptions, and values;
\end{vtightlist}
\item
expressions for type annotations, sequencing, and primitive values\\
(functions, lists, tuples, and records);
\item
\texttt{with} (record update), \texttt{if}, \texttt{while}, \texttt{for}, \texttt{assert}, \texttt{try}, and \texttt{raise} expressions;
\item
let-based polymorphism with an SML-style value restriction;
\item
mutually-recursive function definitions via \texttt{let rec};
\item
pattern matching, with nested patterns, \texttt{as} patterns, and ``or'' (\texttt{|})patterns;
\item
mutable references with \texttt{ref}, \texttt{!}, and \texttt{:=};
\item
polymorphic equality (the Objective Caml \texttt{=} operator);
\item
31-bit word semantics for \texttt{int}s (using an existing HOL library); and
\item
IEEE-754 semantics for \texttt{float}s (using an existing HOL library).
\end{vtightlist}
\end{minipage}
}

\vspace{3mm}

\hspace*{-1.5cm}\scalebox{.25}{
%\framebox{
\begin{minipage}[t]{19cm}
%\ottdefnsJdomEB
%\ottdefnsJdomE
%\ottdefnsJlookup
%\ottdefnsJidx
%\ottdefnsJTtpsXXkind
\ottdefnsJTEok
\ottdefnsJTeq
\ottdefnsJTidxsub
\end{minipage}}
%
\scalebox{.25}{
%\framebox{
\begin{minipage}[t]{19cm}
\ottdefnsJTinst
\ottdefnsJTinstXXnamed
\ottdefnsJTinstXXany
\ottdefnsJTval
\ottdefnsJTfield
\ottdefnsJTconstrXXp
\ottdefnsJTconstrXXc
\ottdefnsJTconst
\ottdefnsJTpat
\end{minipage}
}
%
\scalebox{.25}{
\begin{minipage}[t]{19cm}
\ottdefnsJTuprim
\ottdefnsJTbprim
\ottdefnsJTe
\end{minipage}
}
%
\scalebox{.25}{
\begin{minipage}[t]{19cm}
\ottdefnsJTconstrXXdecl
\ottdefnsJTfieldXXdecl
\ottdefnsJTtypedef
\ottdefnsJTtypeXXdefinition
\ottdefnsJTdefinition
\ottdefnsJTdefinitions
\ottdefnsJTprog
\ottdefnsJTstore
\ottdefnsJTtop
\ottdefnsJTLin
\ottdefnsJTLout
\end{minipage}
}

\newpage

{\pmc\sf\Large The OCaml$_{\textit{light}}$ Operational Semantics
  {\large (131 rules)}}

\scalebox{.3}{
%\framebox{
\begin{minipage}{29.7cm}
\ottdefnsJmatchP
\ottdefnsJmatch
\ottdefnsJrecfun
\ottdefnsJfunval
\ottdefnsJRuprim
\ottdefnsJRbprim
\ottdefnsJRmatchingXXstep
\ottdefnsJRmatchingXXsuccess
\ottdefnsJRstore
\ottdefnsJSlookup
\end{minipage}
}%}
\scalebox{.3}{
%\framebox{
\begin{minipage}{29.7cm}
\ottdefnsJred
\ottdefnsJRdefn
\ottdefnsJRtop
\end{minipage}
}%}



\end{document}
