-
Notifications
You must be signed in to change notification settings - Fork 13
/
dynmod.tex
646 lines (591 loc) · 23.8 KB
/
dynmod.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
\section{Dynamic Semantics for Modules}
\label{dynmod-sec}
\subsection{Reduced Syntax}
Since\index{58.1} signature expressions
are mostly dealt with in the static semantics,
the dynamic semantics need only take limited account of them.
\replacement{\theconstructors}{Unlike types,
it cannot ignore them completely; }{However,
they cannot be ignored completely; }the reason is that an explicit signature
ascription plays the r\^ole of restricting the ``view'' of a structure -- that is,
restricting the domains of its component environments\insertion{\theidstatus}{ and
imposing identifier status on value identifiers}.
\replacement{\thenostrsharing}{However, the types
and the sharing properties of structures and signatures are irrelevant to
dynamic evaluation; the syntax is therefore
reduced by the following transformations (in addition to those for the Core),
for the purpose of the dynamic semantics of Modules:}{The syntax is therefore
reduced by the following transformations (in addition to those for the Core),
for the purpose of the dynamic semantics of Modules:}
\begin{itemize}
\item Qualifications ``$\OF\ \ty\,$'' are omitted from \insertion{\theconstructors}{constructor and} exception descriptions.
\deletion{\thedatatyperepl}{\item Any specification of the form ``$\typespec$'', ``$\eqtypespec$'',
``$\DATATYPE$\ $\datdesc$\,'' or
``$\sharingspec$'' is replaced by the empty specification.}
\item \deletion{\thedatatyperepl}{The Modules phrase classes TypDesc, DatDesc, ConDesc and SharEq
are omitted.}
\insertion{\thenostrsharing}{Any qualification \boxml{sharing type $\cdots$} on
a specification or \boxml{where type $\cdots$} on a signature expression is omitted.}
\end{itemize}
\subsection{Compound Objects}
\label{dynmod-comp-obj-sec}
The\index{58.2} compound objects for the Modules dynamic semantics, extra to those for the
Core dynamic semantics, are shown in Figure~\ref{comp-dynmod-obj}.
\begin{figure}[h]
\vspace{2pt}
\begin{displaymath}
\begin{array}{rcl}
\adhocreplacementl{\thenostrsharing}{1cm}{(\strid:\I,\strexp\langle:\I'\rangle,\B)}{(\strid:\I,\strexp,\B)}
& \in & \FunctorClosure\\
& & \qquad = (\StrId\times\Int)\times
\adhocreplacementl{\thenostrsharing}{-5cm}{(\StrExp\langle\times\Int\rangle)\times\Basis}{\StrExp\times\Basis}\\
\adhocreplacementl{\theidstatus}{5mm}{(\IE,\vars,\exns)\ {\rm or}\ \I}{\I\ {\rm or}\ (\SI,\TI,\VI)}
& \in & \adhocreplacementl{\theidstatus}{-8cm}{\Int = \IntEnv\times\Fin(\Var)\times\Fin(\Exn)}{\Int = \StrInt\times\TyInt\times\ValInt}\\
\adhocreplacementl{\theidstatus}{3cm}{\IE}{\SI} & \in & \adhocreplacementl{\theidstatus}{-9cm}{\IntEnv}{\StrInt} = \finfun{\StrId}{\Int}\\\adhocinsertion{\theidstatus}{2cm}{
\TI & \in & \TyInt = \finfun{\TyCon}{\ValInt}\\
\VI & \in & \ValInt = \finfun{\VId}{\IdStatus}\\ }
\G & \in & \SigEnv = \finfun{\SigId}{\Int}\\
\F & \in & \FunEnv = \finfun{\FunId}{\FunctorClosure}\\
(\F,\G,\E)\ {\rm or}\ \B
& \in & \Basis = \FunEnv\times\SigEnv\times\Env\\
(\G,\adhocreplacementl{\thedatatyperepl}{2cm}{\IE}{\I})\ {\rm or}\ \IB
& \in & \IntBasis = \SigEnv\times\adhocreplacementl{\thedatatyperepl}{-4cm}{\IntEnv}{\Int}
\end{array}
\end{displaymath}
\caption{Compound Semantic Objects}
\label{comp-dynmod-obj}
\vspace{3pt}
\end{figure}
%
%
\insertion{\thedatatyperepl}{
An {\sl interface} $\I\in\Int$ represents a ``view'' of a structure.
Specifications and signature expressions will evaluate to interfaces;
moreover, during the evaluation of a specification or signature expression,
structures (to which a specification or signature expression may
refer via datatype replicating specifications) are represented
only by their interfaces. To extract a value interface from
a dynamic value environment we define the operation $\Inter: \ValEnv \to\ValInt$
as follows:
\[\Inter(\VE) = \{\vid\mapsto\is\;;\;\VE(\vid) = (\V,\is)\}\]
In other words, $\Inter(\VE)$ is the value interface obtained from $\VE$ by
removing all values from $\VE$. We then extend $\Inter$ to a function
$\Inter:\Env\to\Int$ as follows:
\[ \Inter(\SE,\TE,\VE)\ =\ (\SI,\TI,\VI)\]
where $\VI$ = $\Inter(\VE)$ and
\begin{eqnarray*}
\SI & = & \{\strid\mapsto\Inter\E\;;\;\SE(\strid) = \E\}\\
\TI & = & \{\tycon\mapsto\Inter\VE'\;;\;\TE(\tycon) = \VE'\}
\end{eqnarray*}
An {\sl interface basis} $\IB=(\G,\I)$ is a value-free part of a basis, sufficient to
evaluate signature expressions and specifications.
The function $\Inter$ is extended to create an interface basis
from a basis $\B$ as follows:
\[ \Inter(\F,\G,\E)\ =\ (\G, \Inter\E) \]
}
\deletion{\thedatatyperepl}{
An {\sl interface} $\I\in\Int$ represents a ``view'' of a structure.
Specifications and signature expressions will evaluate to interfaces;
moreover, during the evaluation of a specification or signature expression,
structures (to which a specification or signature expression may
refer via ``$\OPEN$'') are represented only by their interfaces. To extract an
interface from a dynamic environment we define the operation
\[ \Inter\ :\ \Env\to\Int \]
as follows:
\[ \Inter(\SE,\VE,\EE)\ =\ (\IE,\Dom\VE,\Dom\EE)\]
where
\[ \IE\ =\ \{\strid\mapsto\Inter\E\ ;\ \SE(\strid)=\E\}\ .\]
An {\sl interface basis}\index{59.1} $\IB=(\G,\IE)$ is that part of a basis needed to
evaluate signature expressions and specifications.
The function $\Inter$ is extended to create an interface basis
from a basis $\B$ as follows:
\[ \Inter(\F,\G,\E)\ =\ (\G, \of{\IE}{(\Inter\E)}) \]}
\insertion{\thedatatyperepl}{
A further operation
\[ \downarrow\ :\ \Env\times\Int\to\Env\]
is required, to cut down an environment $\E$ to a given interface $\I$,
representing the effect of an explicit signature ascription. We first
define $\downarrow: \ValEnv\times\ValInt\to\ValEnv$ by
\[\VE\downarrow\VI = \{\vid\mapsto(\V,\is)\;;\;\VE(\vid) = (\V,\is')\ {\rm and}\ \VI(\vid) = \is\}\]
(Note that $\VE$ and $\VI$ need not have the same
domain and that the identifier status is taken from $\VI$.)
We then define $\downarrow: \StrEnv \times \StrInt \to \StrEnv$,
$\downarrow: \TyEnv \times\TyInt\to\TyEnv$ and
$\downarrow: \Env\times\Int\to\Env$ simultaneously as follows:
\label{downarrowdef}
\begin{center}
$\SE\downarrow\SI = \{\strid\mapsto\E\downarrow\I\ ;\
\SE(\strid)=\E\ {\rm and}\ \SI(\strid)=\I\}$\\[6pt]
$ \TE\downarrow\TI = \{\tycon\mapsto \VE'\downarrow\VI'\ ;\
\TE(\tycon) = \VE'\ {\rm and}\ \TI(\tycon) = \VI'\}$ \\[6pt]
$
(\SE,\TE,\VE)\downarrow(\SI,\TE,\VI) =
(\SE\downarrow\SI, \TE\downarrow\TI, \VE\downarrow\VI) $
\end{center}}
\deletion{\thedatatyperepl}{
A further operation
\[ \downarrow\ :\ \Env\times\Int\to\Env\]
is required, to cut down an environment $\E$ to a given interface $\I$,
representing the effect of an explicit signature ascription. It is defined
as follows:
\[ (\SE,\VE,\EE)\downarrow(\IE,\vars,\exns)\ =\ (\SE',\VE',\EE') \]
where
\[ \SE'\ =\ \{\strid\mapsto\E\downarrow\I\ ;\
\SE(\strid)=\E\ {\rm and}\ \IE(\strid)=\I\} \]
and (taking $\downarrow$ now to mean restriction of a function domain)
\[\VE'=\VE\downarrow\vars,\ \EE'=\EE\downarrow\exns.\]
}
\noindent
It is important to note that an interface \replacement{\thedatatyperepl}{is also a projection of}{can
also be obtained from} the
{\sl static} value $\Sigma$ of a signature expression;
it is obtained by \replacement{\thedatatyperepl}{omitting structure names $\m$ and type environments
$\TE$,}{first replacing every type
structure $(\typefcn, \VE)$
in the range of every type environment $\TE$ by $\VE$}
and \insertion{\thece}{then} replacing each \replacement{\theidstatus}{variable environment $\VE$ and each
exception environment $\EE$ by its domain.}{pair $(\sigma,\is)$ in the range
of every value environment $\VE$ by $\is$.}
Thus in an implementation interfaces would naturally be obtained from the
static elaboration; we choose to give separate rules here for obtaining them
in the dynamic semantics since we wish to maintain our separation of the
static and dynamic semantics, for reasons of presentation.
\subsection{Inference Rules}
The\index{59.2} semantic rules allow sentences of the form
\[ \s,A\ts\phrase\ra A',\s' \]
to be inferred, where $A$ is either a basis\replacement{\theidstatus}{ or an interface basis}{, a signature environment} or empty,
$A'$ is some semantic
object and $\s$,$\s'$ are the states before and after the evaluation
represented by the sentence. Some hypotheses in rules are not of this form;
they are called {\sl side-conditions}. The convention for options is
the same as for the Core static semantics.
The state and exception conventions are adopted as in the Core dynamic
semantics. However, it may be shown that the only Modules phrases whose
evaluation
may cause a side-effect or generate an exception packet are of the form
$\strexp$, $\strdec$, $\strbind$ or $\topdec$.
%Also, as will be seen in Section~\ref{prog-sec}, a phrase of the
%form $\program$ can have side-effects, but not generate an
%exception packet.
% SEMANTICS
%
% Structure Expressions
%
\rulesec{Structure Expressions}{\B\ts\strexp\ra \E/\p}
\begin{equation} % generative strexp
%\label{generative-strexp-dyn-rule}
\frac{\B\ts\strdec\ra\E}
{\B\ts\encstrexp\ra\E}\index{60.1}
\end{equation}
\begin{equation} % longstrid
%\label{longstrid-strexp-dyn-rule}
\frac{\B(\longstrid)=\E}
{\B\ts\longstrid\ra\E}
\end{equation}
\insertion{\theconstructors}{\begin{equation} % transparent signature constraint
\frac{\B\ts\strexp\ra\E\qquad\Inter\B\ts\sigexp\ra\I}
{\B\ts\transpconstraint\ra\E\downarrow\I}
\end{equation}
\begin{equation} % opaque signature constraint
\frac{\B\ts\strexp\ra\E\qquad\Inter\B\ts\sigexp\ra\I}
{\B\ts\opaqueconstraint\ra\E\downarrow\I}
\end{equation}}
%\vspace{6pt}
\replacement{\thenostrsharing}{\begin{equation} % functor application
\label{functor-application-dyn-rule}
\frac{ \begin{array}{c}
\B(\funid)=(\strid:\I,\strexp'\langle:\I'\rangle,\B')\\
\B\ts\strexp\ra\E\qquad
\B'+\{\strid\mapsto\E\downarrow\I\}\ts\strexp'\ra\E'\\
\end{array}
}
{\B\ts\funappstr\ra\E'\langle\downarrow\I'\rangle}
\end{equation}}{\begin{equation} % functor application
\label{functor-application-dyn-rule}
\frac{ \begin{array}{c}
\B(\funid)=(\strid:\I,\strexp',\B')\\
\B\ts\strexp\ra\E\qquad
\B'+\{\strid\mapsto\E\downarrow\I\}\ts\strexp'\ra\E'\\
\end{array}
}
{\B\ts\funappstr\ra\E'}
\end{equation}}
%\vspace{6pt}
\begin{equation} % let strexp
%\label{letstrexp-dyn-rule}
\frac{\B\ts\strdec\ra\E\qquad\B+\E\ts\strexp\ra\E'}
{\B\ts\letstrexp\ra\E'}
\end{equation}
\comments
\begin{description}
\item{(\ref{functor-application-dyn-rule})}
Before the evaluation of the functor body $\strexp'$, the
actual argument $\E$ is cut down by the formal parameter
interface $\I$, so that any opening of $\strid$ resulting
from the evaluation of $\strexp'$ will produce no more components
than anticipated during the static elaboration.
\end{description}
\rulesec{Structure-level Declarations}{\B\ts\strdec\ra\E/\p}
% declarations
\begin{equation} % core declaration
%\label{dec-dyn-rule}
\frac{ \of{\E}{\B}\ts\dec\ra\E' }
{ \B\ts\dec\ra\E' }\index{60.2}
\end{equation}
\vspace{6pt}
\begin{equation} % structure declaration
%\label{structure-decl-dyn-rule}
\frac{ \B\ts\strbind\ra\SE }
{ \B\ts\singstrdec\ra\SE\ \In\ \Env }
\end{equation}
\vspace{6pt}
\begin{equation} % local structure-level declaration
%\label{local structure-level declaration-dyn-rule}
\frac{ \B\ts\strdec_1\ra\E_1\qquad
\B+\E_1\ts\strdec_2\ra\E_2 }
{ \B\ts\localstrdec\ra\E_2 }
\end{equation}
\vspace{6pt}
\begin{equation} % empty declaration
%\label{empty-strdec-dyn-rule}
\frac{}
{\B\ts\emptystrdec\ra \emptymap{\rm\ in}\ \Env}
\end{equation}
\vspace{6pt}
\begin{equation} % sequential declaration
%\label{sequential-strdec-dyn-rule}
\frac{ \B\ts\strdec_1\ra\E_1\qquad
\B+\E_1\ts\strdec_2\ra\E_2 }
{ \B\ts\seqstrdec\ra\plusmap{\E_1}{\E_2} }
\end{equation}
\rulesec{Structure Bindings}{\B\ts\strbind\ra\SE/\p}
\replacement{\thenostrsharing}{
\begin{equation} % structure binding
\frac{ \begin{array}{cl}
\B\ts\strexp\ra\E\qquad\langle\Inter\B\ts\sigexp\ra\I\rangle\\
\langle\langle\B\ts\strbind\ra\SE\rangle\rangle
\end{array}
}
{\begin{array}{c}
\B\ts\strbinder\ra\\
\qquad\qquad\qquad\{\strid\mapsto\E\langle\downarrow\I\rangle\}
\ \langle\langle +\ \SE\rangle\rangle
\end{array}
}\index{61.1}
\end{equation}
\comment As in the static semantics, when present, $\sigexp$ constrains the
``view'' of the structure. The restriction must be done in the
dynamic semantics to ensure that any dynamic opening of the structure
produces no more components than anticipated during the static
elaboration.}{\begin{equation} % structure binding
\frac{
\B\ts\strexp\ra\E\qquad
\langle\B\ts\strbind\ra\SE\rangle
}
{
\B\ts\barestrbindera\ra\{\strid\mapsto\E\}
\ \langle +\ \SE\rangle
}\index{61.1}
\end{equation}
}
%
% Signature Rules
%
\rulesec{Signature Expressions}{\IB\ts\sigexp\ra\I}
\begin{equation} % encapsulation sigexp
%\label{encapsulating-sigexp-dyn-rule}
\frac{\IB\ts\spec\ra\I }
{\IB\ts\encsigexp\ra\I}\index{61.2}
\end{equation}
\begin{equation} % signature identifier
%\label{signature-identifier-dyn-rule}
\frac{ \IB(\sigid)=\I}
{ \IB\ts\sigid\ra\I }
\end{equation}
\rulesec{Signature Declarations}{\IB\ts\sigdec\ra\G}
\begin{equation} % single signature declaration
%\label{single-sigdec-dyn-rule}
\frac{ \IB\ts\sigbind\ra\G }
{ \IB\ts\singsigdec\ra\G }\index{61.3}
\end{equation}
\deletion{\thenostrsharing}{
\begin{equation} % empty signature declaration
%\label{empty-sigdec-dyn-rule}
\frac{}
{ \IB\ts\emptysigdec\ra\emptymap }
\end{equation}
\begin{equation} % sequential signature declaration
%\label{sequence-sigdec-dyn-rule}
\frac{ \IB\ts\sigdec_1\ra\G_1 \qquad \plusmap{\IB}{\G_1}\ts\sigdec_2\ra\G_2 }
{ \IB\ts\seqsigdec\ra\plusmap{\G_1}{\G_2} }
\end{equation}
}
\rulesec{Signature Bindings}{\IB\ts\sigbind\ra\G}
\begin{equation} % signature binding
%\label{sigbind-dyn-rule}
\frac{ \IB\ts\sigexp\ra\I
\qquad\langle\IB\ts\sigbind\ra\G\rangle }
{ \IB\ts\sigbinder\ra\{\sigid\mapsto\I\}
\ \langle +\ \G\rangle }\index{61.4}
\end{equation}
%
% Specifications
%
\rulesec{Specifications}{\IB\ts\spec\ra\I}
\replacement{\theidstatus}{\begin{equation} % value specification
%\label{valspec-dyn-rule}
\frac{ \ts\valdesc\ra\vars }
{ \IB\ts\valspec\ra\vars\ \In\ \Int }\index{61.5}
\end{equation}}{\begin{equation} % value specification
%\label{valspec-dyn-rule}
\frac{ \ts\valdesc\ra\VI }
{ \IB\ts\valspec\ra\VI\ \In\ \Int }\index{61.5}
\end{equation}}
\insertion{\thedatatyperepl}{
\begin{equation}
\frac{\ts\typdesc\ra\TI}
{\IB\ts\typespec\ra\TI\ \In\ \Int}
\end{equation}
\begin{equation}
\frac{\ts\typdesc\ra\TI}
{\IB\ts\eqtypespec\ra\TI\ \In\ \Int}
\end{equation}}
\insertion{\thedatatyperepl}{
\begin{equation}
\frac{\ts\datdesc\ra\VI,\TI}
{\IB\ts\datatypespec\ra(\VI,\TI)\ \In\ \Int}
\end{equation}
}
\insertion{\thedatatyperepl}{
\begin{equation}
\frac{\IB(\longtycon) = \VI\qquad \TI = \{\tycon\mapsto\VI\}}
{\IB\ts\datatypereplspec\ra(\VI,\TI)\ \In\ \Int}
\end{equation}
}
\replacement{\theidstatus}{
\begin{equation} % exception specification
%\label{exceptionspec-dyn-rule}
\frac{ \ts\exndesc\ra\exns}
{ \IB\ts\exceptionspec\ra\exns\ \In\ \Int }
\end{equation}}{\begin{equation} % exception specification
%\label{exceptionspec-dyn-rule}
\frac{ \ts\exndesc\ra\VI}
{ \IB\ts\exceptionspec\ra \VI\ \In\ \Int }
\end{equation}}
\oldpagebreak
\replacement{\theidstatus}{\begin{equation} % structure specification
\label{structurespec-dyn-rule}
\frac{ \IB\ts\strdesc\ra\IE }
{ \IB\ts\structurespec\ra\IE\ \In\ \Int }\index{62.1}
\end{equation}}{\begin{equation} % structure specification
\label{structurespec-dyn-rule}
\frac{ \IB\ts\strdesc\ra\SI }
{ \IB\ts\structurespec\ra\SI\ \In\ \Int }\index{62.1}
\end{equation}}
\deletion{\thenolocalspec}{
\begin{equation} % local specification
\label{localspec-dyn-rule}
\frac{ \IB\ts\spec_1\ra\I_1 \qquad
\plusmap{\IB}{\of{\IE}{\I_1}}\ts\spec_2\ra\I_2 }
{ \IB\ts\localspec\ra\I_2 }
\end{equation}}
\deletion{\thenoopenspec}{
\begin{equation} % open specification
%\label{openspec-dyn-rule}
\frac{ \IB(\longstrid_1)=\I_1\quad\cdots\quad
\IB(\longstrid_n)=\I_n }
{ \IB\ts\openspec\ra\I_1 + \cdots +\I_n }
\end{equation}}
\replacement{\thesingleincludespec}{
\begin{equation} % include signature specification
%\label{inclspec-dyn-rule}
\frac{ \IB(\sigid_1)=\I_1 \quad\cdots\quad
\IB(\sigid_n)=\I_n }
{ \IB\ts\inclspec\ra\I_1 + \cdots +\I_n }
\end{equation}}{\begin{equation} % include signature specification
%\label{inclspec-dyn-rule}
\frac{ \IB\ts\sigexp\ra\I}
{ \IB\ts\singleinclspec\ra\I}
\end{equation}}
\begin{equation} % empty specification
%\label{emptyspec-dyn-rule}
\frac{}
{ \IB\ts\emptyspec\ra\emptymap{\rm\ in}\ \Int }
\end{equation}
\replacement{\theidstatus}{\begin{equation} % sequential specification
\label{seqspec-dyn-rule}
\frac{ \IB\ts\spec_1\ra\I_1
\qquad \plusmap{\IB}{\of{\IE}{\I_1}}\ts\spec_2\ra\I_2 }
{ \IB\ts\seqspec\ra\plusmap{\I_1}{\I_2} }
\end{equation}}{\begin{equation} % sequential specification
\label{seqspec-dyn-rule}
\frac{ \IB\ts\spec_1\ra\I_1
\qquad \IB+\I_1\ts\spec_2\ra\I_2 }
{ \IB\ts\seqspec\ra\plusmap{\I_1}{\I_2} }
\end{equation}}
%\ insertion{\thenostrsharing}{
%\begin{equation}
%\frac{\IB\ts\spec\ra\I} % type sharing spec
% {\IB\ts\newsharingspec\ra\I}
%\end{equation}
%}
\deletion{\thedatatyperepl}{
\noindent\comments
\begin{description}
\item{(\ref{localspec-dyn-rule}),(\ref{seqspec-dyn-rule})}
Note that $\of{\vars}{\I_1}$ and $\of{\exns}{\I_1}$ are
not needed for the evaluation of $\spec_2$.
\end{description}}
% Descriptions
\replacement{\theidstatus}{\rulesec{Value Descriptions}{\ts\valdesc\ra\vars}}{\rulesec{Value Descriptions}{\ts\valdesc\ra\VI}}
\replacement{\theidstatus}{\begin{equation} % value description
%\label{valdesc-dyn-rule}
\frac{ \langle\ts\valdesc\ra\vars\rangle }
{ \ts\var\ \langle\AND\ \valdesc\rangle\ra
\{\var\}\ \langle\cup\ \vars\rangle }\index{62.2}
\end{equation}}{\begin{equation} % value description
%\label{valdesc-dyn-rule}
\frac{ \langle\ts\valdesc\ra\VI\rangle }
{ \ts\vid\ \langle\AND\ \valdesc\rangle\ra
\{\vid\mapsto\isv\}\ \langle+\,\VI\rangle }\index{62.2}
\end{equation}}
\insertion{\thedatatyperepl}{
\rulesec{Type Descriptions}{\ts\typdesc\ra\TI}
\begin{equation}
\frac{\langle\ts\typdesc\ra\TI\rangle}
{\ts\typdescription\ra\{\tycon\mapsto\emptymap\}\langle+\TI\rangle}
\end{equation}
}
\insertion{\thedatatyperepl}{
\rulesec{Datatype Descriptions}{\ts\datdesc\ra\VI, \TI}
\begin{equation}
\frac{\ts\condesc\ra\VI\qquad\langle\ts\datdesc'\ra\VI',\TI'\rangle}
{\ts\datdescriptiona\ra\VI\,\langle+\,\VI'\rangle, \{\tycon\mapsto\VI\}\langle+\TI'\rangle}
\end{equation}
\rulesec{Constructor Descriptions}{\ts\condesc\ra\VI}
\begin{equation}
\frac{\langle\ts\condesc\ra\VI\rangle}
{\ts\shortconviddesc\ra\{\vid\mapsto\isc\}\,\langle+\VI\rangle}
\end{equation}
}
\replacement{\theidstatus}{\rulesec{Exception Descriptions}{\ts\exndesc\ra\exns}}{\rulesec{Exception Descriptions}{\ts\exndesc\ra\VI}}
\replacement{\thefixtypos}{
\begin{equation} % exception description
%\label{exndesc-dyn-rule}
\frac{ \langle\ts\exndesc\ra\exns\rangle }
{ \ts\exn\ \langle\exndesc\rangle\ra\{\exn\}\ \langle\cup\ \exns\rangle }\index{62.3}
\end{equation}}{\begin{equation} % exception description
%\label{exndesc-dyn-rule}
\frac{ \langle\ts\exndesc\ra\VI\rangle }
{ \ts\vid\ \langle\boxml{and\ }\exndesc\rangle\ra\{\vid\mapsto\ise\}\ \langle+ \VI\rangle }\index{62.3}
\end{equation}}
\replacement{\theidstatus}{\rulesec{Structure Descriptions}{\IB\ts\strdesc\ra\IE}}{\rulesec{Structure Descriptions}{\IB\ts\strdesc\ra\SI}}
\replacement{\theidstatus}{\begin{equation}
%\label{strdesc-dyn-rule}
\frac{ \IB\ts\sigexp\ra\I\qquad\langle\IB\ts\strdesc\ra\IE\rangle }
{ \IB\ts\strdescription\ra\{\strid\mapsto\I\}\ \langle +\ \IE\rangle }\index{62.4}
\end{equation}}{\begin{equation}
%\label{strdesc-dyn-rule}
\frac{ \IB\ts\sigexp\ra\I\qquad\langle\IB\ts\strdesc\ra\SI\rangle }
{ \IB\ts\strdescription\ra\{\strid\mapsto\I\}\ \langle +\ \SI\rangle }\index{62.4}
\end{equation}}
% Functor and Program rules
%
\rulesec{Functor Bindings}{\B\ts\funbind\ra\F}
\replacement{\thenostrsharing}{
\begin{equation} % functor binding
%\label{funbind-dyn-rule}
\frac{
\begin{array}{c}
\Inter\B\ts\sigexp\ra\I\qquad
\langle\Inter\B+\{\strid\mapsto\I\} \ts\sigexp'\ra\I'\rangle \\
\langle\langle\B\ts\funbind\ra\F\rangle\rangle
\end{array}
}
{
\begin{array}{c}
\B\ts\funstrbinder\ \optfunbind\ra\\
\qquad\qquad \qquad
\{\funid\mapsto(\strid:\I,\strexp\langle:\I'\rangle,\B)\}
\ \langle\langle +\ \F\rangle\rangle
\end{array}
}\index{62.5}
\end{equation}}{\begin{equation} % functor binding
%\label{funbind-dyn-rule}
\frac{
\Inter\B\ts\sigexp\ra\I\qquad
\langle\IB\ts\funbind\ra\F\rangle
}
{
\begin{array}{c}
\IB\ts\barefunstrbinder\ \optfunbinda\ra\\
\qquad\qquad \qquad
\{\funid\mapsto(\strid:\I,\strexp,\B)\}
\ \langle +\ \F\rangle
\end{array}
}\index{62.5}
\end{equation}}
\oldpagebreak
\rulesec{Functor Declarations}{\B\ts\fundec\ra\F}
\begin{equation} % single functor declaration
%\label{singfundec-dyn-rule}
\frac{ \B\ts\funbind\ra\F }
{ \B\ts\singfundec\ra\F }\index{63.1}
\end{equation}
\deletion{\thenostrsharing}{
\vspace{6pt}
\begin{equation} % empty functor declaration
%\label{emptyfundec-dyn-rule}
\frac{}
{ \B\ts\emptyfundec\ra\emptymap }
\end{equation}
\vspace{6pt}
\begin{equation} % sequential functor declaration
%\label{seqfundec-dyn-rule}
\frac{ \B\ts\fundec_1\ra\F_1\qquad
\B+\F_1\ts\fundec_2\ra\F_2 }
{ \B\ts\seqfundec\ra\plusmap{\F_1}{\F_2} }
\end{equation}}
\rulesec{Top-level Declarations}{\B\ts\topdec\ra\B'/\p}
\replacement{\thenofuncspec}{
\begin{equation} % structure-level declaration
%\label{strdectopdec-dyn-rule}
\frac{\B\ts\strdec\ra\E}
{\B\ts\strdec\ra\E\ \In\ \Basis
}\index{63.2}
\end{equation}
\vspace{6pt}
\begin{equation} % signature declaration
%\label{sigdectopdec-dyn-rule}
\frac{\Inter\B\ts\sigdec\ra\G}
{\B\ts\sigdec\ra\G\ \In\ \Basis
}
\end{equation}
\vspace{6pt}
\begin{equation} % functor declaration
%\label{fundectopdec-dyn-rule}
\frac{\B\ts\fundec\ra\F}
{\B\ts\fundec\ra\F\ \In\ \Basis
}
\end{equation}}{\begin{equation} % structure-level declaration
%\label{strdectopdec-dyn-rule}
\frac{\B\ts\strdec\ra\E\quad\B' =\E\ \In\ \Basis\quad\langle \B+\B'\ts\topdec\ra\B''\rangle }
{\B\ts\strdecintopdec\ra\B'\langle'\rangle
}\index{63.2}
\end{equation}
\vspace{6pt}
\begin{equation} % signature declaration
%\label{sigdectopdec-dyn-rule}
\frac{\Inter\B\ts\sigdec\ra\G\quad B' = \G\ \In\ \Basis\quad
\langle \B + \B'\ts\topdec\ra\B''\rangle}
{\B\ts\sigdecintopdec\ra \B'\langle'\rangle
}
\end{equation}
\vspace{6pt}
\begin{equation} % functor declaration
%\label{fundectopdec-dyn-rule}
\frac{\B\ts\fundec\ra\F\quad \B' = \F\ \In\ \Basis\quad
\langle \B + \B'\ts\topdec\ra\B''\rangle}
{\B\ts\fundecintopdec\ra\B'\langle'\rangle
}
\end{equation}}