
\begin{figure*}[ht]
\fbox{\parbox{\textwidth}{
$\Sigma; \Gamma \rtyps{q}{q'} e : B$ \hspace{1.5em}
Given resource metric $M$, expression $e$ has annotated type $A$\\
\mbox{}\hspace{7.8em}under signature $\Sigma$ in context $\Gamma$.}}
\begin{center}
  \def \MathparLineskip {\lineskip=0.45cm}
  \begin{mathpar}
 \Rule{U:App}
      {\funold[p/p']{A}{B} \in \Sigma(f)
      \\  q = p + \cApp{}
      }
      {\Sigma;x{:}A \rtyps{q}{p'}  \appS{f}{x} : B}

 \Rule{U:Let}
      {   \Sigma;\Gamma_1 \rtyps{p} {p'} e_1 : A
       \\ \Sigma;\Gamma_2,x{:}A \rtyps{p'}{q'} e_2 : B
       \\ q = p + \cLet{}
      }
      {\Sigma;\Gamma_1,\Gamma_2 \rtyps{q}{q'}  \letS{e_1}{x}{e_2} : B}

 \Rule{U:Bconst}
      { e \in \{\trueS,\falseS\}
      \\ q =  \cB + q'
      }
      {\Sigma;\Nil \rtyps{q}{q'} b : \boolT}

 \Rule{U:Cond}
      {   \Sigma;\Gamma \rtyps{q_1}{q'} e_1 : B
       \\ \Sigma;\Gamma \rtyps{q_2}{q'} e_2 : B
       \\ q = \cCond1 + q_1
       \\ q = \cCond2 + q_2
      }
      {\Sigma; \Gamma,x:\boolT \rtyps{q}{q'} \ifS{x}{e_1}{e_2} : B}

 \Rule{U:Pair}
      { q = \cPair + q'}
      {\Sigma;x_1:A_1,x_2:A_2 \rtyps{q}{q'}  \pairS{x_1}{x_2} : A_1*A_2}

 \Rule{U:MatP}
    { \Sigma; \Gamma,x_1{:}A_1,x_2{:}A_2 \rtyps{p}{q'} e' : B
    \\ q = \cMatP + p
    }
    {\Sigma; \Gamma,x : A_1 * A_2 \rtyps{q}{q'} \matchPS{e}{x_1}{x_2}{e'} : B}

 \Rule{U:Nil}
      { q = \cNil + q'
      }
      {\Sigma;\Nil \rtyps{q}{q'}  \nilS : \li[\vec p]{A}}

 \Rule{U:Cons}
      {
        \vec p = (p_1, \ldots, p_k\
        \\ q = \cCons + p_1 + q'
      }
      {\Sigma;x_1 : A,x_2 : \li[\shift(\vec p)]{A}\rtyps{q}{q'} \consS{x_1}{x_2} : \li[\vec p]{A}}

 \Rule{U:MatL}
      {\vec p = (p_1, \ldots, p_k)
      \\  \Sigma;\Gamma \rtyps{q_1}{q'} e_1 : B
       \\ \Sigma;\Gamma,x_1 : A,x_2 : \li[\shift (\vec p)]{A} \rtyps{q_2}{q'} e_2 : B
       \\ q = \cMatL1 + q_1
       \\ q + p_1 = \cMatL2 + q_2
      }
      {\Sigma;\Gamma,x{:}\li[\vec p]{A} \rtyps{q}{q'}
        \matchLS{x}{e_1}{x_1}{x_2}{e_2}
       : B}

 \Rule{U:Share}
      {\Sigma;\Gamma,x_1 : A_1,x_2 : A_2 \rtyps{q}{q'} e : B
            \\ A \share (A_1,A_2)
      }
      {\Sigma;\Gamma,x : A \rtyps{q}{q'} \shareS{x}{x_1}{x_2}{e} : B }

 \Rule{U:Supertype}
    {\Sigma;\Gamma,x{:}A \rtyps{q}{q'} e : B
    \\ A' \subtype A
    }
    {\Sigma;\Gamma,x{:}A' \rtyps{q}{q'} e : B}

  \Rule{U:Subtype}
  {\Sigma;\Gamma \rtyps{q}{q'} e : B 
  \\ B \subtype B'
  }
  {\Sigma;\Gamma \rtyps{q}{q'} e : B'}

  \Rule{U:Relax}
  {\Sigma;\Gamma \rtyps{p}{p'} e : B
 \\ q \geq p
 \\ q - p \geq q' - p'
  }
  {\Sigma;\Gamma \rtyps{q}{q'} e : B}

  \Rule{U:Weak}
  {\Sigma;\Gamma \rtyps{q}{q'} e : B
  }
  {\Sigma;\Gamma,x{:}A \rtyps{q}{q'} e : B}

  \end{mathpar}
\end{center}
  \caption{Rules of the univariate polynomial resource-annotated type rules.}
  \label{fig:trulesUni}
\end{figure*}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "main"
%%% End:
