You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$$
(\operatorname{fn} x \Rightarrow e)[e'/x] = \operatorname{fn} x \Rightarrow e
$$
$$
(\operatorname{fn} y \Rightarrow e)[e'/x] =
\begin{cases}
\operatorname{fn} y \Rightarrow (e[e'/x]) &\text{if } y \neq x \text{ and } (y \notin FV(e') \text{ or } x \notin FV(e)) \\
\operatorname{fn} z \Rightarrow (e[z/y][e'/x]) &\text{if } y \neq x \text{ and } y \in FV(e') \text{ and } x \in FV(e) \text{ and } z \notin FV(e') \cup FV(e)
\end{cases}
$$
$$
(\operatorname{let} y=e_1 \operatorname{in} e_2 \operatorname{end})[e/x] =
\begin{cases}
\operatorname{let} y=e_1[e/x] \operatorname{in} e_2[e/x] \operatorname{end} &\text{if } y \neq x \text{ and } (y \notin FV(e) \text{ or } x \notin FV(e_2)) \\
\operatorname{let} z=e_1[e/x] \operatorname{in} e_2[z/y][e/x] \operatorname{end} &\text{if } y \neq x \text{ and } y \in FV(e) \text{ and } x \in FV(e_2) \text{ and } z \notin FV(e) \cup FV(e_2)
\end{cases}
$$
$$
(\operatorname{case} e \operatorname{of} \operatorname{inl} x_1 \Rightarrow e_1 \mid \operatorname{inr} x_2 \Rightarrow e_2)[e'/x] =
\begin{cases}
\operatorname{case} e[e'/x] \operatorname{of} \operatorname{inl} x_1 \Rightarrow e_1[e'/x] \mid \operatorname{inr} x_2 \Rightarrow e_2[e'/x] &\text{if } x \neq x_1 \text{ and } x \neq x_2 \text{ and } (x_1 \notin FV(e') \text{ or } x \notin FV(e_1)) \text{ and } (x_2 \notin FV(e') \text{ or } x \notin FV(e_2)) \\
\operatorname{case} e[e'/x] \operatorname{of} \operatorname{inl} z_1 \Rightarrow e_1[z_1/x_1][e'/x] \mid \operatorname{inr} x_2 \Rightarrow e_2[e'/x] &\text{if } x \neq x_1 \text{ and } x \neq x_2 \text{ and } x_1 \in FV(e') \text{ and } x \in FV(e_1) \text{ and } (x_2 \notin FV(e') \text{ or } x \notin FV(e_2)) \text{ and } z_1 \notin FV(e') \cup FV(e_1) \\
\operatorname{case} e[e'/x] \operatorname{of} \operatorname{inl} x_1 \Rightarrow e_1[e'/x] \mid \operatorname{inr} z_2 \Rightarrow e_2[z_2/x_2][e'/x] &\text{if } x \neq x_1 \text{ and } x \neq x_2 \text{ and } (x_1 \notin FV(e') \text{ or } x \notin FV(e_1)) \text{ and } x_2 \in FV(e') \text{ and } x \in FV(e_2) \text{ and } z_2 \notin FV(e') \cup FV(e_2) \\
\operatorname{case} e[e'/x] \operatorname{of} \operatorname{inl} z_1 \Rightarrow e_1[z_1/x_1][e'/x] \mid \operatorname{inr} z_2 \Rightarrow e_2[z_2/x_2][e'/x] &\text{if } x \neq x_1 \text{ and } x \neq x_2 \text{ and } x_1 \in FV(e') \text{ and } x \in FV(e_1) \text{ and } x_2 \in FV(e') \text{ and } x \in FV(e_2) \text{ and } z_1 \notin FV(e') \cup FV(e_1) \text{ and } z_2 \notin FV(e') \cup FV(e_2)
\end{cases}
$$
$$
(\operatorname{rec} x \Rightarrow e)[e'/x] = \operatorname{rec} x \Rightarrow e
$$
$$
(\operatorname{rec} y \Rightarrow e)[e'/x] =
\begin{cases}
\operatorname{rec} y \Rightarrow (e[e'/x]) &\text{if } y \neq x \text{ and } (y \notin FV(e') \text{ or } x \notin FV(e)) \\
\operatorname{rec} z \Rightarrow (e[z/y][e'/x]) &\text{if } y \neq x \text{ and } y \in FV(e') \text{ and } x \in FV(e) \text{ and } z \notin FV(e') \cup FV(e)
\end{cases}
$$