From db1ff5fcb51583284dc44df653438a6f03a244da Mon Sep 17 00:00:00 2001 From: "Ioanna M. Dimitriou H" Date: Wed, 7 Sep 2022 13:49:26 +0200 Subject: [PATCH 1/2] valid-try-catch: Typesetting and notation like in formal-overview. --- document/core/valid/instructions.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/document/core/valid/instructions.rst b/document/core/valid/instructions.rst index fbfbfc86..d9548391 100644 --- a/document/core/valid/instructions.rst +++ b/document/core/valid/instructions.rst @@ -1375,17 +1375,17 @@ Control Instructions C \vdashblocktype \blocktype : [t_1^\ast] \to [t_2^\ast] \qquad C,\CLABELS\,[t_2^\ast] \vdashinstrseq \instr_1^\ast : [t_1^\ast] \to [t_2^\ast] \\ - (C.\CTAGS[x] = [t^\ast]\to[] \\ - C,\CLABELS\,(\LCATCH [t_2^\ast]) \vdashinstrseq \instr_2^\ast : [t^\ast]\to[t_2^\ast])\ast \\ - (C,\CLABELS\,(\LCATCH~[t_2^\ast]) \vdashinstrseq \instr_3^\ast : []\to[t_2^\ast])^? + (C.\CTAGS[x] = [t^\ast] \to [] \\ + C,\CLABELS\,(\LCATCH~[t_2^\ast]) \vdashinstrseq \instr_2^\ast : [t^\ast] \to [t_2^\ast])^\ast \\ + (C,\CLABELS\,(\LCATCH~[t_2^\ast]) \vdashinstrseq \instr_3^\ast : [] \to [t_2^\ast])^? \end{array} }{ - C \vdashinstr \TRY~\blocktype~\instr^\ast (\CATCH~x~\instr_2^\ast)^\ast (\CATCHALL~\instr_3^\ast)^? \END : [t_1^\ast]\to[t_2^\ast] + C \vdashinstr \TRY~\blocktype~\instr_1^\ast~(\CATCH~x~\instr_2^\ast)^\ast~(\CATCHALL~\instr_3^\ast)^?~\END : [t_1^\ast] \to [t_2^\ast] } .. note:: - The :ref:`notation ` :math:`C,\CLABELS\,(\LCATCH^? [t^\ast])` inserts the new label type at index :math:`0`, shifting all others. + The :ref:`notation ` :math:`C,\CLABELS\,(\LCATCH^?~[t^\ast])` inserts the new label type at index :math:`0`, shifting all others. .. _valid-try-delegate: From 06cb90a2690fdd61991edf6b38210444886cb176 Mon Sep 17 00:00:00 2001 From: "Ioanna M. Dimitriou H" Date: Wed, 7 Sep 2022 14:10:14 +0200 Subject: [PATCH 2/2] Fix todo:: Prose for valid-try-catch. --- document/core/valid/instructions.rst | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/document/core/valid/instructions.rst b/document/core/valid/instructions.rst index d9548391..143b9292 100644 --- a/document/core/valid/instructions.rst +++ b/document/core/valid/instructions.rst @@ -1366,8 +1366,30 @@ Control Instructions :math:`\TRY~\blocktype~\instr_1^\ast~(\CATCH~x~\instr_2^\ast)^\ast~(\CATCHALL~\instr_3^\ast)^?~\END` .................................................................................................... -.. todo:: - Add prose. +* The :ref:`block type ` must be :ref:`valid ` as some :ref:`function type ` :math:`[t_1^\ast] \to [t_2^\ast]`. + +* Let :math:`C'` be the same :ref:`context ` as :math:`C`, but with the :ref:`result type ` :math:`[t_2^\ast]` prepended to the |CLABELS| vector. + +* Under context :math:`C'`, + the instruction sequence :math:`\instr_1^\ast` must be :ref:`valid ` with type :math:`[t_1^\ast] \to [t_2^\ast]`. + +* Let :math:`C''` be the same :ref:`context ` as :math:`C`, but with the :ref:`label ` :math:`\LCATCH~[t_2^\ast]` prepended to the |CLABELS| vector. + +* For every :math:`(\CATCH~x~\instr_2^\ast)`: + + * The tag :math:`C.\CTAGS[x]` must be defined in the context :math:`C`. + + * Let :math:`[t^\ast] \to []` be its :ref:`tag type `. + + * Under context :math:`C''`, + the instruction sequence :math:`\instr_2^\ast` must be :ref:`valid ` with type :math:`[t^\ast] \to [t_2^\ast]`. + +* If there is a :math:`(\CATCHALL~\instr_3^\ast)`, then: + + * Under context :math:`C''`, + the instruction sequence :math:`\instr_3^\ast` must be :ref:`valid ` with type :math:`[] \to [t_2^\ast]`. + +* Then the compound instruction is valid with type :math:`[t_1^\ast] \to [t_2^\ast]`. .. math:: \frac{