### Table 2: The CPS translation of the call-by-name -calculus

"... In PAGE 3: ... For each type A of the -calculus, we define a pair of types KA and CA of the target calculus, called, respectively, the type of continuations and of computations of type A: KA = ~ A; if A is a basic type; K1 = 0; KA^B = KA + KB; KA!B = CA KB; K? = 1; KA_B = KA KB; CA = KA ! R: For each variable x and each name of the -calculus, we assume a distinct variable ~ x, respectively ~ , of the target calculus. The call-by-name CPS translation M of a typed term M is given in Table2 . It respects the typing in the following sense: x1:B1; : : : ; xn:Bn ` M : A j 1:A1; : : : ; m:Am ~ x1:CB1; : : : ; ~ xn:CBn; ~ 1:KA1; : : : ; ~ m:KAm ` M : CA : (1)... In PAGE 6: ... Continuation and computation types are defined as before: KA = VA ! R; if A is a basic type; K1 = 0; KA^B = KA + KB; KA!B = CA KB; K? = 1; KA_B = KA KB; CA = KA ! R: Notice that the value types VA are only defined at basic types. To the interpretation of terms from Table2 , we add the following interpretation of basic constants c : A and basic functions f : B1 ! : : : ! Bn ! A: c = k:k~ c; f = hx1; : : : ; xn; ki:x1( v1:x2( v2: : : : xn( vn:k( ~ fv1 : : : vn)))): Here k : KA, xi : CBi, and vi : VBi. Notice that the interpretation of c is actually a special case of that of f for n = 0.... ..."

### Table 2: The CPS translation of the call-by-name a11a16a12 -calculus

"... In PAGE 3: ... For each type a59 of the a11a16a12 -calculus, we define a pair of types a202 a81 and a203 a81 of the target calculus, called, respectively, the type of continuations and of computations of type a59 : a202 a81 a68 a200 a59a19a50 if a59 is a basic typea50 a202 a113 a68 a198 a50 a202 a81a21a204a34a85 a68 a202 a81 a152a72a202 a85 a50 a202 a81a21a194a132a85 a68 a203 a81 a193a73a202 a85 a50 a202a98a205 a68 a70a8a50 a202 a81a21a166a34a85 a68 a202 a81 a193a46a202 a85 a50 a203 a81 a68 a202 a81 a74a93a183a206a22 For each variable a49 and each name a20 of the a11a16a12 -calculus, we assume a distinct variable a200 a49 , respectively a200 a20 , of the target calculus. The call-by-name CPS translation a24 of a typed term a24 is given in Table2 . It respects the typing in the following sense: a49 a113 a65 a62 a113 a50a53a22a54a22a54a22a135a50a52a49a38a136a135a65 a62a154a136a156a89a73a24a115a65a31a59a93a92a101a20 a113 a65 a59 a113 a50a53a22a54a22a54a22a135a50a124a20a122a146a99a65a25a59a86a146 a200 a49a135a113a186a65a25a203 a85a15a207 a50a54a22a53a22a54a22a21a50 a200 a49 a136 a65a25a203 a85a135a208 a50 a200 a20a95a113a186a65 a202 a81a15a207 a50a54a22a53a22a54a22a135a50 a200 a20 a146 a65 a202 a81a135a209 a89a73a24 a65a35a203 a81 a22 (1)... In PAGE 6: ... Continuation and computation types are defined as before: a202 a81 a68 a238 a81 a74a116a183a206a50 if a59 is a basic typea50 a202a98a113 a68 a198 a50 a202 a81a21a204a34a85 a68 a202 a81 a152a96a202 a85 a50 a202 a81a21a194a163a85 a68 a203 a81 a193a46a202 a85 a50 a202a90a205 a68 a70a31a50 a202 a81a21a166a34a85 a68 a202 a81 a193a73a202 a85 a50 a203 a81 a68 a202 a81 a74a116a183a206a22 Notice that the value types a238 a81 are only defined at basic types. To the interpretation of terms from Table2 , we add the following interpretation of basic constants a80a154a65a31a59 and basic functions a237a168a65a31a62a139a113a86a74a239a22a54a22a53a22a35a74a116a62 a136 a74a116a59 : a80 a68 a11a38a188a147a22a25a188 a200 a80a187a50 a237 a68 a11a15a105a130a49a114a113a171a50a54a22a54a22a53a22a21a50a57a49 a136 a50a124a188a16a109a187a22 a49a135a113a171a36a107a11a16a240 a113 a22 a49a10a117a8a36a107a11a16a240 a117 a22a54a22a53a22a54a22a52a49 a136 a36a107a11a16a240 a136 a22a25a188a135a36a114a200a237a10a240a8a113a147a22a54a22a53a22a57a240 a136 a39a57a39a52a39a57a39a82a22 Here a188a128a65a122a202 a81 , a49 a137 a65a95a203 a85a135a241 , and a240 a137 a65a95a238 a85a135a241 . Notice that the interpretation of a80 is actually a special case of that of a237 for a150a242a68 a198 .... ..."

### Table 8. Natural Rules for Call-by-Name Evaluation of PCF 0 + 0 true + true false + false

1994

"... In PAGE 39: ...1 Runtime safety. What properties are expected for the evaluation of a type-correct program beyond those that may hold of an arbitrary one? To appreciate the signif- icance of the types, look again at the operational rules in Table8 . Take a typical rule such as the one for application in call-by-name: M + x : t: M0 [N=x]M0 + V M(N) + V This is the only rule whose conclusion describes how to derive a value for... In PAGE 41: ... Note, in particular, that the relation H ` tyerr : t fails for each H and t since there is no typing rule for proving such a relation. The rules for a natural operational semantics are those given earlier in Table8 together with the `error apos; rules given in Table 11. Values in the new language are those of PCF together with the term tyerr for a type error.... In PAGE 63: ...emantic proof of a result such as Theorem 5.1.1. Milner apos;s proof was for the calculus ML0, but the idea can be illustrated adequately with PCF. Let us look at the analog of that theorem for PCF with type errors (that is, PCF with a new expression tyerr that does not have a type and expanding the operational rules in Table8 to include rules for type errors as given in Table 11). To give a xed-point model of the calculus, we use a domain U for which there is an isomorphism U = T N? [U ! U]? O: (6:6) In this equation, the operation D 7! D? is the lift, which adds a new bottom element to the domain D.... In PAGE 66: ... Let us write `sub for the least relation that contains the relation ` of PCF+ and satis es [Subsump] H `sub M : s s t H `sub M : t : The operational semantics of PCF+ and PCF++ is similar to that of PCF but the language is evaluated using call-by-value rather than call-by- name. The rules in Table8 are used for PCF+ and PCF++ except for the rule: M + x : s: M0 [N=x]M0 + V M(N) + V for evaluation of applications, which is replaced by the rule: M + x : s: L N + U [U=x]L + V M(N) + V The evaluation of records and variants is given by the rules in Table 19. A model of PCF++ can be given by extending the inclusive subsets interpretation for PCF.... ..."

Cited by 3

### Table 2: Call-by-Name Evaluation

1998

"... In PAGE 16: ...e. if t ! ev n v is derivable according to Table2 , then t and v have the same denotation in An . Lemma 6.... ..."

Cited by 9

### Table 4: Call-by-Name Truth De nition

1998

"... In PAGE 18: ... In the call-by-value truth de nition [[ ]]v, variables of type range over Av . The truth value [[A]]n is de ned in a similar way in Table4 . In the call-by-name truth de nition [[ ]]n, variables of type range over An and include the element ? .... ..."

Cited by 9

### Table 7. Transition Rules for Call-by-Name Evaluation of PCF

1994

"... In PAGE 30: ... The goal of such rewriting is to obtain a value to which no further rules apply. In order to de ne precisely how a term is related to a value, we de ne a binary transition relation ! to be the least relation on pairs of PCF terms that satis es the axioms and rules in Table7 . A set of evaluation rules given in this form is sometimes called a Structural Operational Semantics (SOS) because the hypotheses of the rules involve only the evaluation of proper structural components of the expressions in their conclusions.... In PAGE 31: ...emma 4.2.1. If M ! N and M ! N0 then N N0. One way to emphasize the structurality of the rules in Table7 is to rep- resent them using a grammar. An evaluation context for PCF is described by the following grammar E ::= [ ] j pred(E) j zero?(E) j succ(E) j E(L) j if E then M else N where [ ] is intended to represent a `hole apos; in a PCF term.... In PAGE 39: ... This is a property known as subject reduction. For PCF and the SOS given in Table7 it can be expressed as follows: Theorem 5.... ..."

Cited by 3

### Table 4 shows the call-by-name CPS transform of [Plo75] (in fact, a recti ed variant of it, see the notes in Section 14). Here is how a reduction ( x. M)N ?!N MfN=xg is simulated in the transform. (As in call-by-value, we choose to take call-by- name for the reduction relation on the images of the CPS, but these terms are evaluation-order independent: see Theorem 6.1.) CN[[( x. M)N]]k

1999

"... In PAGE 25: ... M] def= x. [[M]] Table4 : The call-by-name CPS transform 6 The interpretation of call-by-name In this section we develop a -calculus encoding of call-by-name -calculus. The approach is similar to that for call-by-value in Section 5.... In PAGE 44: ...5. The encoding of N into -calculus will be that of Table4 , but without i/o types. We can assume that the encoding is into the plain polyadic -calculus, without i/o types, because Lemma 6.... In PAGE 67: ... The call-by-value CPS transform of Table 2 is due to Fischer [Fis72] (of which a more complete version is [Fis93]). The call-by-name CPS transform of Table4 is that of Plotkin [Plo75], based on work by Reynolds (such as [Rey72]); however, we have adopted the recti cation in the clause for variables due to Hatcli and Danvy [HD97] (Plotkin apos;s translation for variables was CN[[x]] def= x; the recti cation is necessary for the left-to-right implication of Theorem 6.4 to... In PAGE 68: ...ounterexample (14) to the converse of Theorem 5.5. The terms M and N used in the proof of Theorem 12.15 (non-completeness of the call-by-name encoding) are the same used by Plotkin [Plo75] to prove the non-completeness of the call- by-name CPS transform ( Table4 ) as a transformation of N into V . A CPS transform for call-by-need is studied by Okasaki, Lee and Tarditi [OLT94], using a -calculus extended with mutable references as target language.... ..."

Cited by 2

### Table 1.5: Type system of ml. 1.2.5 Calculi n, n8, cp8, etc. Calculus n is intended to capture call-by-name evaluation in programming languages. The language of n is de ned by the grammar M ::= x j x:M j (M M);

1997

Cited by 4

### Table 5: Call-by-name evaluation for PCF. 0 + 0 true + true false + false

"... In PAGE 9: ... My primary interest in introducing this example was not to remake the point about compositionality|the point here concerns denotation. If M + V is supposed to indicate the meaning of M as V , then the semantics in Table5 is a very disappointing one. Note, in particular, that the value of x : t: M is simply x : t: M.... In PAGE 10: ... I am not arguing that one cannot use natural operational semantics to reason about programs; indeed, it can be very useful for proving certain properties. I am arguing that, for higher types, the operational rules in Table5 do not really say that M denotes V if M + V (unless denotation is here being taken in a trival sense) and I see no immediate way of repairing this short-coming by, say, a reshu ing of the form of the rules. To get a semantics in which a program is associated via a semantic function with an element of an abstract realm of mathematical meanings requires some further elaboration of the signi cance of the operational rules.... ..."

### Table 12. The syntactic translation from call-by-name to call-by-value

1998