-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopsem.lyx
1643 lines (1264 loc) · 38.6 KB
/
opsem.lyx
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
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass extreport
\use_default_options true
\begin_modules
fixltx2e
fix-cm
theorems-ams-bytype
\end_modules
\maintain_unincluded_children false
\language british
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date true
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 1
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 2
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Chapter
\noindent
\begin_inset CommandInset label
LatexCommand label
name "chap:Syntax-and-Operational"
\end_inset
Syntax and Operational Semantics
\end_layout
\begin_layout Standard
The syntax and operational semantics of Pony is presented here as a small-step
operational semantics that expresses a simplified subset of the full Pony
language.
Additional features in the full language can be encoded in this subset,
including control structures, exception handling, algebraic data types
(tuples, unions, and intersections), machine word types, singleton types,
C ABI compatible structures, single-assignment fields and variables, embedded
fields, nominal and structural subtyping via traits and interfaces, object
literals, lambdas, partial application, pattern matching, case functions,
and generic types and methods.
Various forms of syntactic sugar are also used in the full language to
allow for more succinct code.
\end_layout
\begin_layout Standard
The syntax and formalisation of inheritance, union types, tuples, and intersecti
on types appears in Steed
\begin_inset CommandInset citation
LatexCommand cite
key "steed2016"
\end_inset
.
The syntax and formalisation of generics, value-dependent types, and compile-ti
me expressions appears in Cheeseman
\begin_inset CommandInset citation
LatexCommand cite
key "cheeseman2016"
\end_inset
.
The operational semantics presented here differs from previous work
\begin_inset CommandInset citation
LatexCommand cite
key "clebsch2015deny"
\end_inset
, particularly in the treatment of message sends and in providing a distributed
semantics.
\end_layout
\begin_layout Section
Syntax
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open
\begin_layout Plain Layout
\align center
\begin_inset Formula $\begin{array}{rcccl}
\mathtt{P} & \in & \mathit{Program} & ::= & \mathtt{\overline{CT}\,\overline{AT}}\\
\mathtt{CT} & \in & \mathit{ClassDef} & ::= & \mathtt{class\,C\,\overline{F}\,\overline{K}\,\overline{M}}\\
\mathtt{AT} & \in & \mathit{ActorDef} & ::= & \mathtt{actor\,A\,\overline{F}\,\overline{K}\,\overline{M}\,\overline{B}}\\
\mathtt{S} & \in & \mathit{TypeID} & ::= & \mathtt{A\,|\,C}\\
\mathtt{T} & \in & \mathit{Type} & ::= & \mathtt{S\,\kappa}\\
\mathtt{ET} & \in & ExtType & ::= & \mathtt{T\,|\,S\,\kappa\circ}\\
\mathtt{F} & \in & \mathit{Field} & ::= & \mathtt{var\,f:T}\\
\mathtt{K} & \in & \mathit{Ctor} & ::= & \mathtt{new\,k(\overline{x}:\overline{T})\Rightarrow e}\\
\mathtt{M} & \in & \mathit{Func} & ::= & \mathtt{fun\,\kappa\,m(\overline{x}:\overline{T}):ET\Rightarrow e}\\
\mathtt{B} & \in & \mathit{Behv} & ::= & \mathtt{be\,b(\overline{x}:\overline{T})\Rightarrow e}\\
\mathtt{n} & \in & \mathit{MethodID} & ::= & \mathtt{k\,|\,m\,|\,b}\\
\mathtt{\kappa} & \in & \mathit{Cap} & ::= & \mathtt{iso\,|\,trn\,|\,ref\,|\,val\,|\,box\,|\,tag}\\
\mathtt{e} & \in & \mathit{Expr} & ::= & \mathtt{this\,|\,x\,|\,var\,x:T\,|\,x=e\,|\,e;e\,|\,e.f}\\
& & & | & \mathtt{e.f=e\,|\,consume\,x\,|\,recover\,e}\\
& & & | & \mathtt{e.m(\overline{e})\,|\,e.b(\overline{e})\,|\,S.k(\overline{e})}\\
\mathtt{E[\cdot]} & \in & \mathit{ExprHole} & ::= & \mathtt{x=E[\cdot]\,|\,E[\cdot];e\,|\,(E[\cdot])\,|\,E[\cdot].f}\\
& & & | & \mathtt{e.f=E[\cdot]\,|\,E[\cdot].f=z\,|\,E[\cdot].n(\overline{z})}\\
& & & | & \mathtt{e.n(\overline{z},E[\cdot],\overline{e})\,|\,recover\,E[\cdot]}
\end{array}$
\end_inset
\end_layout
\begin_layout Plain Layout
\begin_inset Caption Standard
\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Syntax"
\end_inset
Syntax
\end_layout
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open
\begin_layout Plain Layout
\align center
\begin_inset Formula $\begin{array}{rclcccl}
\mathtt{C} & \in & \mathit{ClassID} & & \mathtt{k} & \in & \mathit{CtorID}\\
\mathtt{A} & \in & \mathit{ActorID} & & \mathtt{m} & \in & \mathit{FuncID}\\
\mathtt{f} & \in & \mathit{FieldID} & & \mathtt{b} & \in & \mathit{BehvID}\\
\mathtt{this,x} & \in & \mathit{SourceID} & & \mathtt{n} & \in & \mathit{CtorID\cup BehvID}\\
\mathtt{t} & \in & \mathit{TempID} & & \mathtt{y,z} & \in & \mathit{LocalID}
\end{array}$
\end_inset
\end_layout
\begin_layout Plain Layout
\begin_inset Caption Standard
\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Identifiers"
\end_inset
Identifiers
\end_layout
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
The syntax is presented in figure
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Syntax"
\end_inset
.
Actors have a type, in the mould of active objects, and are introduced
with the keyword
\begin_inset Formula $\mathtt{actor}$
\end_inset
.
These can have both synchronous methods (
\emph on
functions
\emph default
, introduced through the keyword
\begin_inset Formula $\mathtt{fun}$
\end_inset
) and asynchronous methods (
\emph on
behaviours
\emph default
, introduced through the keyword
\begin_inset Formula $\mathtt{be}$
\end_inset
) as well as named constructors (introduced through the keyword
\begin_inset Formula $\mathtt{new}$
\end_inset
).
\end_layout
\begin_layout Standard
Passive objects (introduced through the keyword
\begin_inset Formula $\mathtt{class}$
\end_inset
) have only synchronous methods (functions) and constructors.
The term
\emph on
method
\emph default
is used to refer to constructors, functions, and behaviours.
\end_layout
\begin_layout Standard
The novel element of the syntax is the inclusion of
\emph on
reference capability annotations
\emph default
\begin_inset Formula $\kappa$
\end_inset
on types and functions, where:
\end_layout
\begin_layout Standard
\begin_inset Formula $\kappa\in\{\mathtt{iso,trn,ref,val,box,tag}\}$
\end_inset
\end_layout
\begin_layout Standard
These reference capabilities are the foundation of the Pony type system.
\end_layout
\begin_layout Standard
Types consist of a class or actor identifier
\begin_inset Formula $\mathtt{S}$
\end_inset
followed by a reference capability
\begin_inset Formula $\kappa$
\end_inset
.
In addition, extended types
\begin_inset Formula $\mathtt{ET}$
\end_inset
can be
\emph on
unaliased
\emph default
,
\begin_inset Formula $\circ$
\end_inset
.
An
\emph on
unaliased type
\emph default
is created with constructors and destructive reads.
This is described in detail in chapter
\begin_inset CommandInset ref
LatexCommand ref
reference "chap:Reference-Capabilities"
\end_inset
.
\end_layout
\begin_layout Standard
The over-bar notation indicates a sequence of elements such as
\begin_inset Formula $\mathtt{\overline{F}}$
\end_inset
, with the convention that the
\begin_inset Formula $n^{th}$
\end_inset
element is referred to as
\begin_inset Formula $\mathtt{F_{n}}$
\end_inset
.
Similarly,
\begin_inset Formula $\mathtt{\overline{x}:\overline{T}}$
\end_inset
indicates a pairwise sequence of identifiers and types.
To reduce notation, a
\emph on
fixed
\emph default
program
\begin_inset Formula $\mathtt{P}$
\end_inset
is assumed.
\end_layout
\begin_layout Section
Operational Semantics
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open
\begin_layout Plain Layout
\align center
\begin_inset Formula $\begin{array}{rclcl}
\chi & \in & \mathit{Heap} & = & \mathit{Addr\rightarrow(Actor\vee Object)}\\
\sigma & \in & \mathit{Stack} & = & \mathit{ActorAddr\cdot\overline{Frame}}\\
\varphi & \in & \mathit{Frame} & = & \mathit{MethodID\times(LocalID\rightarrow Value)}\\
& & & \times & \mathit{ExprHole}\\
& & \mathit{LocalID} & = & \mathit{SourceID}\cup\mathit{TempID}\\
v & \in & \mathit{Value} & = & \mathit{Addr\cup\{null\}}\\
\iota & \in & \mathit{Addr} & = & \mathit{ActorAddr\cup ObjectAddr}\\
\alpha & \in & \mathit{ActorAddr}\\
\omega & \in & \mathit{ObjectAddr}\\
& & \mathit{Actor} & = & \mathit{ActorID\times(FieldID\rightarrow Value)}\\
& & & \times & \mathit{\overline{Message}}\times Stack\times Expr\\
& & & \times & (\mathit{ActorID}\rightarrow\overline{Message})\\
& & \mathit{Object} & = & \mathit{ClassID\times(FieldID\rightarrow Value)}\\
\mu & \in & \mathit{Message} & = & \mathit{MethodID\times\overline{Value}}
\end{array}$
\end_inset
\end_layout
\begin_layout Plain Layout
\begin_inset Caption Standard
\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Runtime-entities"
\end_inset
Runtime entities
\end_layout
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open
\begin_layout Plain Layout
\align center
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
makebox[
\backslash
textwidth][c]{
\end_layout
\end_inset
\begin_inset Formula $\begin{array}{ccc}
\dfrac{\chi,\sigma\cdot\varphi,\mathtt{e}\rightsquigarrow\chi',\sigma\cdot\varphi',\mathtt{e'}}{\chi,\sigma\cdot\varphi,\mathtt{E[e]}\rightsquigarrow\chi',\sigma\cdot\varphi',\mathtt{E[e']}}\;\textrm{\textsc{ExprHole}} & & \dfrac{\mathtt{t}\notin\varphi\quad\iota=\varphi(\mathtt{z})\quad\varphi'=\varphi[\mathtt{t}\mapsto\chi(\iota,\mathtt{f})]}{\chi,\sigma\cdot\varphi,\mathtt{z.f}\rightsquigarrow\chi,\sigma\cdot\varphi',\mathtt{t}}\;\textrm{\textsc{Fld}}\\
\\
\dfrac{\mathtt{x}\notin\varphi\quad\varphi'=\varphi[\mathtt{x}\mapsto\mathit{null}]}{\chi,\sigma\cdot\varphi,\mathtt{var\,x:ET}\rightsquigarrow\chi,\sigma\cdot\varphi',\mathit{null}}\;\textrm{\textsc{DeclLocal}} & & \dfrac{}{\chi,\sigma,\mathtt{z}\mathtt{;e}\rightsquigarrow\chi,\sigma,\mathtt{e}}\;\textrm{\textsc{Seq}}\\
\\
\dfrac{\mathtt{t}\notin\varphi\quad\varphi'=\varphi[\mathtt{x}\mapsto\varphi(\mathtt{z}),\mathtt{t}\mapsto\varphi(\mathtt{x})]}{\chi,\sigma\cdot\varphi,\mathtt{x=z}\rightsquigarrow\chi,\sigma\cdot\varphi',\mathtt{t}}\;\textrm{\textsc{AsnLocal}} & & \dfrac{\begin{array}{c}
\mathtt{t}\notin\varphi\quad\iota=\varphi(\mathtt{z})\quad\varphi'=\varphi[\mathtt{t}\mapsto\chi(\iota,\mathtt{f})]\\
\chi'=\chi[\varphi(\mathtt{z}),\mathtt{f}\mapsto\varphi(\mathtt{y})]
\end{array}}{\chi,\sigma\cdot\varphi,\mathtt{z.f=y}\rightsquigarrow\chi',\sigma\cdot\varphi',\mathtt{t}}\;\textrm{\textsc{AsnFld}}\\
\\
\dfrac{\begin{array}{c}
\iota=\varphi(\mathtt{z})\quad\mathcal{M}(\chi(\iota)\downarrow_{1},\mathtt{m})=\mathtt{(\_,\overline{x}:\_,e,\_)}\\
\varphi'=(\mathtt{m},[\mathtt{this}\mapsto\iota,\mathtt{\overline{x}}\mapsto\varphi(\mathtt{\overline{y}})],\mathtt{E[\cdot]})
\end{array}}{\chi,\sigma\cdot\varphi,\mathtt{E[z.m(\overline{y})}]\rightsquigarrow\chi,\sigma\cdot\varphi\cdot\varphi',\mathtt{e}}\;\textrm{\textsc{Sync}} & & \dfrac{\begin{array}{c}
\mathtt{t}\notin\varphi\quad\iota=\varphi'(\mathtt{z})\\
\varphi'\downarrow_{3}=\mathtt{E[\cdot]}\quad\varphi''=\varphi[\mathtt{t}\mapsto\iota]
\end{array}}{\chi,\sigma\cdot\varphi\cdot\varphi',\mathtt{z}\rightsquigarrow\chi,\sigma\cdot\varphi'',\mathtt{E[t]}}\;\textrm{\textsc{Return}}\\
\\
\dfrac{\begin{array}{c}
\alpha'=\varphi(\mathtt{z})\\
\chi'=\chi[\alpha'++(\mathtt{b},\varphi(\mathtt{\overline{y}})]
\end{array}}{\chi,\alpha\cdot\overline{\varphi}\cdot\varphi,\mathtt{z.b(\overline{y})}\rightsquigarrow\chi',\alpha\cdot\overline{\varphi}\cdot\varphi,\mathtt{z}}\;\textrm{\textsc{Async}} & & \dfrac{\begin{array}{c}
\mathtt{A}=\chi(\alpha)\downarrow_{1}\quad(\mathtt{n},\overline{v})\cdot\overline{\mu}=\chi(\alpha)\downarrow_{3}\\
\mathcal{M}(\mathtt{A,n})=\mathtt{(\_,\overline{x}:\_,e,\_)}\\
\varphi=(\mathtt{n},[\mathtt{this}\mapsto\alpha,\mathtt{\overline{x}}\mapsto\overline{v}],\cdot)
\end{array}}{\chi,\alpha,\varepsilon\rightsquigarrow\chi[\alpha\mapsto\overline{\mu}],\alpha\cdot\varphi,\mathtt{e}}\;\textrm{\textsc{Behave}}\\
\\
\dfrac{\begin{array}{c}
(\omega,\chi')=\mathit{New}(\chi,\mathtt{C})\\
\mathcal{M}(\mathtt{C,k})=\mathtt{(\_,\overline{x}:\_,e,\_)}\\
\varphi'=(\mathtt{k},[\mathtt{this}\mapsto\omega,\mathtt{\overline{x}}\mapsto\varphi(\mathtt{\overline{y}})],\mathtt{E[\cdot]})
\end{array}}{\chi,\sigma\cdot\varphi,\mathtt{E[C.k(\overline{y})]}\rightsquigarrow\chi',\sigma\cdot\varphi\cdot\varphi',\mathtt{e}}\;\textrm{\textsc{Ctor}} & & \dfrac{\begin{array}{c}
(\alpha,\chi')=\mathit{New}(\chi,\mathtt{A},\mathtt{k},\varphi(\overline{\mathtt{y}}))\\
\mathtt{t}\notin\varphi\quad\varphi'=\varphi[\mathtt{t}\mapsto\alpha]
\end{array}}{\chi,\sigma\cdot\varphi,\mathtt{A.k(\overline{y})}\rightsquigarrow\chi',\sigma\cdot\varphi',\mathtt{t}}\;\textrm{\textsc{Ator}}\\
\\
\dfrac{\mathtt{t}\notin\varphi\quad\varphi'=\varphi[\mathtt{t}\mapsto\varphi(\mathtt{x})]\backslash\mathtt{x}}{\chi,\sigma\cdot\varphi,\mathtt{consume\,x}\rightsquigarrow\chi,\sigma\cdot\varphi',\mathtt{t}}\;\textrm{\textsc{Consume}} & & \dfrac{\mathtt{t}\notin\varphi\quad\varphi'=\varphi[\mathtt{t}\mapsto\varphi(\mathtt{z})]}{\chi,\sigma,\mathtt{recover\,z}\rightsquigarrow\chi,\sigma,\mathtt{t}}\;\textrm{\textsc{Recover}}
\end{array}$
\end_inset
\begin_inset ERT
status open
\begin_layout Plain Layout
}
\end_layout
\end_inset
\end_layout
\begin_layout Plain Layout
\begin_inset Caption Standard
\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Local-execution"
\end_inset
Local execution
\end_layout
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open
\begin_layout Plain Layout
\align center
\begin_inset Formula $\begin{array}{c}
\dfrac{\chi,\chi(\alpha)\downarrow_{4},\chi(\alpha)\downarrow_{5}\rightsquigarrow\chi',\sigma,\mathtt{e}}{\chi\rightarrow\chi'[\alpha\mapsto(\sigma,\mathtt{e})]}\;\textrm{\textsc{Global}}\end{array}$
\end_inset
\end_layout
\begin_layout Plain Layout
\begin_inset Caption Standard
\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Global-execution."
\end_inset
Global execution
\end_layout
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open
\begin_layout Itemize
\begin_inset Formula $\varphi(\mathtt{x})=\varphi\downarrow_{2}(\mathtt{x})\downarrow_{1}$
\end_inset
\end_layout
\begin_layout Itemize
\begin_inset Formula $\varphi[\mathtt{x}\mapsto v]=(\varphi\downarrow_{1},\varphi\downarrow_{2}[\mathtt{x}\mapsto v],\varphi\downarrow_{3})$
\end_inset
\end_layout
\begin_layout Itemize
\begin_inset Formula $\varphi\backslash\mathtt{x}=(\varphi\downarrow_{1},[\mathtt{z}\mapsto v\,|\,\varphi(\mathtt{z})=v\wedge\mathtt{z}\neq\mathtt{x}],\varphi\downarrow_{3})$
\end_inset
\end_layout
\begin_layout Itemize
\begin_inset Formula $\chi(\iota,\mathtt{f})=\chi(\iota)\downarrow_{2}(\mathtt{f})$
\end_inset
\end_layout
\begin_layout Itemize
\begin_inset Formula $\chi[\omega,\mathtt{f}\mapsto v]=\chi[\omega\mapsto(\chi(\omega)\downarrow_{1},\chi(\omega)\downarrow_{2}[\mathtt{f}\mapsto v]]$
\end_inset
\end_layout
\begin_layout Itemize
\begin_inset Formula $\chi[\alpha,\mathtt{f}\mapsto v]=\chi[\alpha\mapsto(\chi(\alpha)\downarrow_{1},\chi(\alpha)\downarrow_{2}[\mathtt{f}\mapsto v],\chi(\alpha)\downarrow_{3}...\chi(\alpha)\downarrow_{5})]$
\end_inset
\end_layout
\begin_layout Itemize
\begin_inset Formula $\chi[\alpha\mapsto(\sigma,\mathtt{e})]=\chi[\alpha\mapsto(\chi(\alpha)\downarrow_{1}...\chi(\alpha)\downarrow_{3},\sigma,\mathtt{e})]$
\end_inset
\end_layout
\begin_layout Itemize
\begin_inset Formula $\chi[\alpha++\mu]=\chi[\alpha\mapsto(\chi(\alpha)\downarrow_{1},\chi(\alpha)\downarrow_{2},\chi(\alpha)\downarrow_{3}\cdot\mu,\chi(\alpha)\downarrow_{4},\chi(\alpha)\downarrow_{5})]$
\end_inset
\end_layout
\begin_layout Itemize
\begin_inset Formula $\chi[\alpha\mapsto\overline{\mu}]=\chi[\alpha\mapsto(\chi(\alpha)\downarrow_{1},\chi(\alpha)\downarrow_{2},\overline{\mu},\chi(\alpha)\downarrow_{4},\chi(\alpha)\downarrow_{5})]$
\end_inset
\end_layout
\begin_layout Itemize
\begin_inset Formula $\mathit{New}(\chi,\mathtt{C})=(\omega,\chi')\,\mathit{where}\,\omega\not\in\mathit{dom}(\chi)\wedge\chi'=\chi[\omega\mapsto(\mathtt{C},{\cal F}s(\mathtt{C})\mapsto\mathit{null})]$
\end_inset
\end_layout
\begin_layout Itemize
\begin_inset Formula $\mathit{New}(\chi,\mathtt{A},\mathtt{k},\overline{v})=(\alpha,\chi')\,\mathit{where}$
\end_inset
\begin_inset Newline newline
\end_inset
\begin_inset Formula $\alpha\not\in\mathit{dom}(\chi)\wedge\chi'=\chi[\alpha\mapsto(\mathtt{A},{\cal F}s(\mathtt{A})\mapsto\mathit{null},(\mathtt{k},\overline{v}),\alpha,\varepsilon,[])]$
\end_inset
\end_layout
\begin_layout Plain Layout
\begin_inset Caption Standard
\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Auxiliary-definitions"
\end_inset
Auxiliary definitions
\end_layout
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
The operational semantics has the shape
\begin_inset Formula $\chi\rightarrow\chi'$
\end_inset
, where
\begin_inset Formula $\chi,\chi'$
\end_inset
are heaps mapping object addresses
\begin_inset Formula $\omega$
\end_inset
to their class identifier and their fields, and actor addresses
\begin_inset Formula $\alpha$
\end_inset
to their actor identifier, their fields, their message queue, their stack,
and the next expression to execute.
These runtime entities are defined in figure
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Runtime-entities"
\end_inset
.
Some shorthand notation is used for clarity, as defined in figure
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Auxiliary-definitions"
\end_inset
.
\end_layout
\begin_layout Standard
Note that
\emph on
null
\emph default
is used to indicate an undefined field or variable in the operational semantics.
However, the full language does not permit the use of undefined fields
or variables, or the construction of a partially defined object (one where
some subset of fields remains undefined).
Thus there is no
\emph on
null
\emph default
, in the sense of a bottom value that can inhabit any type, in the full
language.
\end_layout
\begin_layout Standard
The symbol
\begin_inset Formula $\mathtt{x}$
\end_inset
is used to indicate a source identifier,
\begin_inset Formula $\mathtt{t}$
\end_inset
to indicate a temporary identifier, and
\begin_inset Formula $\mathtt{y}$
\end_inset
and
\begin_inset Formula $\mathtt{z}$
\end_inset
to indicate identifiers which may be either.
Temporary identifiers are used in the semantics instead of values in order
to associate a type, including a reference capability, with intermediate
expression results.
Importantly, temporary identifiers are accounted for in well-formedness.
\end_layout
\begin_layout Standard
A call stack consists of an actor address
\begin_inset Formula $\alpha$
\end_inset
followed by a sequence of frames
\begin_inset Formula $\varphi$
\end_inset
.
A frame consists of the method identifier, a mapping of its parameters
to values, and an expression hole.
The latter is the continuation of the caller and will be executed by the
previous frame when the current activation terminates.
\end_layout
\begin_layout Standard
The auxiliary judgement
\begin_inset Formula $\chi,\sigma,\mathtt{e}\rightsquigarrow\chi',\sigma',\mathtt{e'}$
\end_inset
expresses local execution within a
\emph on
single
\emph default
actor.
\begin_inset Formula $\mathcal{M}$
\end_inset
and
\begin_inset Formula $\mathcal{F}$
\end_inset
return method and field declarations, as defined in figure
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Lookup-functions"
\end_inset
.
\end_layout
\begin_layout Subsection
Notation
\end_layout
\begin_layout Standard
To simplify the presentation, some notation conventions are followed.
The use of
\begin_inset Formula $\overline{x}$
\end_inset
indicates a sequence of
\begin_inset Formula $x$
\end_inset
, whereas
\begin_inset Formula $xs$
\end_inset
indicates a set of
\begin_inset Formula $x$
\end_inset
.
The projection
\begin_inset Formula $x\downarrow_{k}$
\end_inset
is used to express the
\begin_inset Formula $k^{th}$
\end_inset
element of the tuple
\begin_inset Formula $x$
\end_inset
.
The use of
\begin_inset Formula $x\downarrow_{k}...x\downarrow_{k+n}$
\end_inset
refers to a sequence of the
\begin_inset Formula $k^{th}$
\end_inset
through
\begin_inset Formula $k+n^{th}$
\end_inset
elements of the tuple
\begin_inset Formula $x$
\end_inset
.
\end_layout
\begin_layout Subsection
Concurrent Execution
\end_layout
\begin_layout Standard
Local execution is defined in figure
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Local-execution"
\end_inset
.
These rules define local execution within an actor.
\noun on
ExprHole
\noun default
allows execution to propagate to the context, and also determines the order
of evaluation for complex expressions.
\noun on
Fld,
\noun default
\noun on
DeclLocal
\noun default
, and
\noun on
Seq
\noun default
are as expected.
\end_layout
\begin_layout Standard
\noun on
AsnLocal
\noun default
and
\noun on
AsnFld
\noun default
combine assignment with a destructive read, returning the previous value
of the left-hand side.
The resulting value is
\emph on
unaliased
\emph default
: while there may be other paths pointing to the value in the program, this
one no longer does.
In effect, one alias to the value has been discarded.
The existence of unaliased values is used in the type system, where
\noun on
T-AsnLocal
\noun default
and
\noun on
T-AsnField
\noun default
both return an
\emph on
unaliased type
\emph default
, as explained in chapter
\begin_inset CommandInset ref
LatexCommand ref
reference "chap:Reference-Capabilities"
\end_inset
.
\end_layout
\begin_layout Standard
\noun on
Sync
\noun default
and
\noun on
Return
\noun default
describe synchronous method call and return.
In
\noun on
Sync
\noun default
, method
\begin_inset Formula $\mathtt{m}$
\end_inset
is called on object or actor
\begin_inset Formula $\iota$
\end_inset
.
The method parameters
\begin_inset Formula $\mathtt{\overline{x}}$
\end_inset
and the method body
\family typewriter
\begin_inset Formula $\mathtt{e}$
\end_inset
\family default
are looked up using the method
\begin_inset Formula $\mathtt{m}$
\end_inset
and the type
\begin_inset Formula $\mathtt{S}$
\end_inset
of
\begin_inset Formula $\iota$
\end_inset
from the heap.
A new frame is pushed on to the stack, consisting of
\begin_inset Formula $\mathtt{m}$
\end_inset
, the address of the receiver, the values of the arguments, and the continuation.
In
\noun on
Return
\noun default
, the topmost frame is popped from the stack and execution continues.
\end_layout
\begin_layout Standard