{#abstractrefinements} ========================
Prop>. Int
-> Int
-> Int
@-} maxInt x y = if x <= y then y else x \end{code}
Prop>. Int
-> Int
-> Int
@-}
maxInt x y = if x <= y then y else x
\end{code}
[Key idea: ](http://goto.ucsd.edu/~rjhala/papers/abstract_refinement_types.html)
`Int
` is just $\reft{v}{\Int}{p(v)}$
Abstract Refinement is **uninterpreted function** in SMT logic
Parametric Refinements
----------------------
\begin{code}
{-@ maxInt :: forall
Prop>. Int
-> Int
-> Int
@-}
maxInt x y = if x <= y then y else x
\end{code}
**Check Implementation via SMT**
Parametric Refinements
----------------------
\begin{code}
{-@ maxInt :: forall
Prop>. Int
-> Int
-> Int
@-}
maxInt x y = if x <= y then y else x
\end{code}
**Check Implementation via SMT**
$$\begin{array}{rll}
\ereft{x}{\Int}{p(x)},\ereft{y}{\Int}{p(y)} & \vdash \reftx{v}{v = y} & \subty \reftx{v}{p(v)} \\
\ereft{x}{\Int}{p(x)},\ereft{y}{\Int}{p(y)} & \vdash \reftx{v}{v = x} & \subty \reftx{v}{p(v)} \\
\end{array}$$
Parametric Refinements
----------------------
\begin{code}
{-@ maxInt :: forall
Prop>. Int
-> Int
-> Int
@-}
maxInt x y = if x <= y then y else x
\end{code}
**Check Implementation via SMT**
$$\begin{array}{rll}
{p(x)} \wedge {p(y)} & \Rightarrow {v = y} & \Rightarrow {p(v)} \\
{p(x)} \wedge {p(y)} & \Rightarrow {v = x} & \Rightarrow {p(v)} \\
\end{array}$$
Using Abstract Refinements
--------------------------
-