From 3d2132f90e14445102a1b4323cebed7cd1c5068a Mon Sep 17 00:00:00 2001 From: "Jip J. Dekker" Date: Thu, 18 Mar 2021 14:27:15 +1100 Subject: [PATCH] Fix the rewriting rules to work with tuples --- assets/packages.tex | 2 +- chapters/4_rewriting.tex | 23 +++++++++++++++++++---- dekker_thesis.tex | 1 - 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/assets/packages.tex b/assets/packages.tex index 30e1f13..704a2a6 100644 --- a/assets/packages.tex +++ b/assets/packages.tex @@ -43,7 +43,7 @@ BoldItalicFont=*-BoldItalic, \usepackage{amsmath} \usepackage{amssymb} \usepackage{unicode-math} -\setmathfont{GFSNeohellenicMath.otf} +% \setmathfont{GFSNeohellenicMath.otf} % References \usepackage[ diff --git a/chapters/4_rewriting.tex b/chapters/4_rewriting.tex index 78c7144..2c1ed3f 100644 --- a/chapters/4_rewriting.tex +++ b/chapters/4_rewriting.tex @@ -153,7 +153,7 @@ and where expressions have \mzninline{par} type. \alt "(" ["," ]* ")" ::= [ "=" ]";" - \alt "(" ["," ]* ")" "=" ";" + \alt "(" ["," ]* ")" "=" ";" \alt "constraint" ";" ::= ":" @@ -381,13 +381,13 @@ suitable alpha renaming. \begin{prooftree} \AxiomC{\(\ptinline{F(\(p_1, \ldots, p_k\)) = E;} \in \Prog\) where the \(p_i\) are fresh} - \noLine\ + \noLine{} \UnaryInfC{\Sem{\(a_i\)}{\Prog, \Env_{i-1}} \(\Rightarrow~ \tuple{v_i, \Env_i'}, \ \Env_0=\Env, \Env_i=\Env_i'\cup\{p_i\mapsto v_i\sep[]\} \quad \forall 1 \leq i \leq k\)} - \noLine\ + \noLine{} \UnaryInfC{\Sem{E}{\Prog, \Env_k} \(\Rightarrow ~ \tuple{v, \Env'}\)} \RightLabel{(Call)} @@ -471,12 +471,20 @@ simply the function applied to the evaluated parameters. (\Ctx, \Env')\)} \end{prooftree} \begin{prooftree} - \AxiomC{\Sem{\(E\)}{\Prog, \Env} \(\Rightarrow \tuple{v, \Env'}\)} + \AxiomC{\Sem{\(E\)}{\Prog, \Env} \(\Rightarrow \tuple{v, \Env'}\)} \AxiomC{\Sem{\(\mathbf{I}\)}{\Prog, \Env' \cup\ \{x \mapsto\ v \sep\ [] \}} \(\Rightarrow (\Ctx, \Env'')\)} \RightLabel{(ItemTE)} \BinaryInfC{\Sem{\(t:x = E, \mathbf{I}\)}{\Prog, \Env} \(\Rightarrow (\Ctx, \Env'')\)} \end{prooftree} +\begin{prooftree} + \AxiomC{\Sem{\(E\)}{\Prog, \Env} \(\Rightarrow \tuple{\left(v_{1}, \ldots, v_{n}\right), \Env'}\)} + \noLine{} + \UnaryInfC{\Sem{\(\mathbf{I}\)}{\Prog, \Env' \cup\ \{x_{1} \mapsto\ v_{1} \sep\ [] \} \cup\ \ldots\ \cup\ \{x_{n} \mapsto\ v_{n} \sep\ [] \}} \(\Rightarrow (\Ctx, \Env'')\)} + \RightLabel{(ItemTD)} + \UnaryInfC{\Sem{\(\left(t_{1}: x_{1}, \ldots, t_{n}: x_{n}\right) = E, \mathbf{I}\)}{\Prog, \Env} \(\Rightarrow + (\Ctx, \Env'')\)} +\end{prooftree} \begin{prooftree} \AxiomC{\Sem{\(C\)}{\Prog, \Env} \(\Rightarrow \tuple{v, \Env'}\)} \AxiomC{\Sem{\(\mathbf{I}\)}{\Prog, \Env'} \(\Rightarrow (\Ctx, \Env'')\)} @@ -519,6 +527,13 @@ is the base case for a list of let items. \AxiomC{\(c\) constant} \UnaryInfC{\Sem{c}{\Prog, \Env} \(\Rightarrow \tuple{c, \Env}\)} \end{prooftree} +\begin{prooftree} + \RightLabel{(Tuple)} + \AxiomC{\Sem{\(E_{1}\)}{\Prog,\Env} \(\Rightarrow \tuple{v_{1}, \Env^{1}}\)} + \AxiomC{\ldots} + \AxiomC{\Sem{\(E_{n}\)}{\Prog,\Env^{n-1}} \(\Rightarrow \tuple{v_{n}, \Env^{n}}\)} + \TrinaryInfC{\Sem{\(\left(E_{1}, \ldots, E_{n}\right)\)}{\Prog, \Env} \(\Rightarrow \tuple{x, \{x \mapsto \left(v_{1}, \ldots, v_{n}\right) \sep [] \} \cup \Env^{n})}\)} +\end{prooftree} \begin{prooftree} \RightLabel{(If\(_T\))} \AxiomC{\Sem{\(C\)}{\Prog, \Env} \(\Rightarrow\) \(\tuple{\ptinline{true}, \_}\)} diff --git a/dekker_thesis.tex b/dekker_thesis.tex index 8e26359..8507da9 100644 --- a/dekker_thesis.tex +++ b/dekker_thesis.tex @@ -1,4 +1,3 @@ -\nonstopmode{} \documentclass[ paper=9in:6in, DIV=calc,