Extended Addressing Machines for PCF, with Explicit Substitutions

Addressing machines have been introduced as a formalism to construct models of the pure, untyped lambda-calculus. We extend the syntax of their programs by adding instructions for executing arithmetic operations on natural numbers, and introduce a reflection principle allowing certain machines to access their own address and perform recursive calls. We prove that the resulting extended addressing machines naturally model a weak call-by-name PCF with explicit substitutions. Finally, we show that they are also well-suited for representing regular PCF programs (closed terms) computing natural numbers.


Introduction
Turing machines (TM) and λ-calculus constitute two fundamental formalisms in theoretical computer science.Because of the difficulty in emulating higher-order calculations on a TM, their equivalence on partial numeric functions is not obtained directly, but rather composing different encodings.As a consequence, no model of λ-calculus (λ-model) based on TM's has arisen in the literature so far.Recently, Della Penna et al. have successfully built a λ-model based on so-called addressing machines (AM) [11].The intent is to propose a model of computation, alternative to von Neumann architecture, where computation is based on communication between machines rather than performing local operations.In fact, these machines are solely capable of manipulating the addresses of other machines-this opens the way for modelling higherorder computations since functions can be passed via their addresses.An AM can read an address from its input-tape, store in a register the result of applying an address to another and, finally, pass the execution

8-2
Exxtended Addresing Machines for PCF,... to another machine by calling its address (possibly extending its input-tape).The set of instructions is deliberately small, to identify the minimal setting needed to represent λ-terms.The downside is that performing calculations on natural numbers is as awkward as using Church numerals in λ-calculus.
Contents.In this paper we extend the formalism of AM's with a set of instructions representing basic arithmetic operations and conditional tests on natural numbers.As we are entering a world of machines and addresses, we need specific machines to represent numerals and assign them recognizable addresses.Finally, in order to model recursion, we rely on the existence of machines representing fixed point combinators.These machines can be programmed in the original formalism but we can avoid any dependency on self-application by manipulating the addressing mechanism so that they have access to their own address.This can be seen as a very basic version of the reflection principle which is present in some programming languages.We call the resulting formalism extended addressing machines (EAMs).
Considering these features, one might expect EAMs to be well-suited for simulating Plotkin's Programming Computable Functions (PCF) [23], a simply typed λ-calculus with constants, arithmetical operations, conditional testing and a fixed point combinator.A PCF term of the form (λx.M )N can indeed be translated into a machine M reading as input (x) from its tape the address of N. As M has control over the computation, it naturally models a weak leftmost call-by-name evaluation.However, while in the contractum M [N/x] of the redex the substitution is instantaneous, M needs to pass the address of N to the machines representing the subterms of M , with the substitution only being performed if N gains control of the computation.As a result, rather than PCF, EAMs naturally emulate the behavior of EPCF-a weak call-by-name PCF with explicit substitutions that are only performed "on demand", as in [19].We endow EAMs with a typing mechanism based on simple types and define a type-preserving translation from well-typed EPCF terms to EAMs.Subsequently, we prove that also the operational behavior of EPCF is faithfully represented by the translation.Finally, by showing the equivalence between PCF and EPCF on terminating programs of type int, we are capable of drawing conclusions for the original language PCF.
In this paper we mainly focus on the properties of the translation, but our long-term goal is to construct a sequential model of higher-order computations.The problem of finding a fully abstract model of PCF was originally proposed by Robin Milner in [21] and is a difficult one.A model is called fully abstract (FA) whenever two programs sharing the type α get the same denotation in the model if and only if they are observationally indistinguishable when plugged in the same context C[] of type α → int.Therefore, a FA model provides a semantic characterization of the observational equivalence of PCF.Quoting from [3]: "the problem is to understand what should be meant by a semantic characterization [. . .] Our view is that the essential content of the problem, what makes it important, is that it calls for a semantic characterization of sequential, functional computation at higher-types".
A celebrated result is that FA models of PCF can be obtained by defining suitable categories of games [4,3,13].Preliminary investigations show that EAMs open the way to construct a more 'computational' FA model.E.g., in [21], the model construction starts with first-order definable functions and requires-to cope with fixed point operator-the addition of extra 'limit points' to ensure that the resulting partial order is direct complete.In the game semantics approach the fixed point operator is treated similarly, namely via its canonical interpretation in a cpo-enriched Cartesian closed category [4].On the contrary, in our approach no limit construction is required to give the fixed point operator a meaning.The fact that EAMs possess a given recursor having its own address stored inside is easily obtained from a mathematical point of view and, as argued above, can be seen as an abstract view of the usual implementation of recursion.We believe this new point of view may increase our understanding of PCF observational equivalence.
Outline.The paper is organized as follows.In Section 1 we introduce the language EPCF along with its syntax, simply typed assignment system and associated (call-by-name) big-step operational semantics.In Section 2 we define EAMs (no familiarity with [11] is assumed) and introduce their operational semantics.In Section 3 we describe a type-checking algorithm for determining whether an EAM is well-typed.In Section 4 we present our main results, namely: (i) the translation of a well-typed EPCF term is an EAM typable with the same type (Theorem 4.6); (ii) if an EPCF term reduces to a value, then their translations as machines are interconvertible (Thm.4.7); Fig. 1.The big-step operational semantics of EPCF.
(iii) the operational semantics of PCF and EPCF coincide on terminating programs of type int (Thm.4.13); (iv) the translation of a PCF program computing a number is an EAM evaluating the corresponding numeral (Theorem 4.14).

Related works.
A preliminary version of AMs was introduced in Della Penna's MSc thesis [10] in order to model computation as communication between distinguished processes by means of their addresses.They were subsequently refined in [11] with the theoretical purpose of constructing a model of λ-calculus.Similarly, our paper should be seen as a first step towards the construction of a denotational model of PCF.Thus, the natural comparison is 6 with other models rather than other machine-based formalisms that have been proposed in the literature (e.g., call-by-name: SECD [16], KAM [15], call-by-need: TIM [12], Lazy KAM [6,17]); call-by-value: ZINC [18]) from which they differ at an implementational level.
Compared with models of PCF based on Scott-continuous functions [21,5,7], EAMs provide a more operational interpretation of a program and naturally avoid parallel features that would lead to the failure of FA as in the continuous semantics.Compared with Curien's sequential algorithms [8] and categories of games [4,13] they share the intensionality of programs' denotations, while presenting an original way of modelling sequential computation.The model based on AMs also bares some similarities with the categories of assembly used to model PCF [20], mostly on a philosophical level, in the sense that these models are based on the 'codes' (rather than addresses) of recursive functions realizing a formula ( ∼ = type).
Concerning explicit substitutions we refer to the pioneering articles [1,2,9,19].Explicit substitutions have been barely considered in the context of PCF-with the notable exception of [24].

Preliminaries
The paradigmatic programming language PCF [23] is a simply typed λ-calculus enriched with constants representing natural numbers, the fundamental arithmetical operations, an if-then-else conditional instruction, and a fixed-point operator.We give PCF for granted and rather present EPCF, an extension of PCF with explicit substitutions [19].We draw conclusions for the standard PCF by exploiting the fact that they are equivalent on programs (closed terms) of type int.Definition 1.1 Consider fixed a countably infinite set Var of variables.EPCF terms and explicit substitutions are defined by (for n ≥ 0 and x ∈ Var): As is customary, M • N stands for the application of a term M to its argument N , 0 represents the

8-4
Exxtended Addresing Machines for PCF,... natural number 0, pred and succ indicate the predecessor and successor respectively, ifz is the conditional test on zero, and finally, fix is a fixed-point operator.We assume that application -often denoted as juxtaposition -associates to the left and has higher precedence than abstraction.Concerning λx.M σ , it represents an abstraction where σ is a list of assignments from variables to closures (terms with the associated substitutions), where each variable can only have one closure assigned to it.Definition 1.2 (i) In an explicit substitution the x i 's are assumed to be fresh and distinguished.(ii) By (i), we can define σ(x i ) = (σ i , M i ).(iii) The domain of σ is given by dom(σ) = {x 1 , . . ., x n }. (iv) We write σ + ρ for the concatenation of σ and ρ, and in this case we assume dom(σ) ∩ dom(ρ) = ∅.
The set FV(M ) of free variables of an EPCF term M is defined as usual, except for the abstraction case FV(λx.M σ ) = FV(M ) − ({x} ∪ dom(σ)).The term M is closed if FV(M ) = ∅, and in that case it is called an EPCF program.
Hereafter terms are considered up to renaming of bound variables.Therefore the symbol = will denote syntactic equality up to α-conversion.
Notation 1 (i) For every n ∈ N, we let n = succ n (0).In particular, 0 is an alternative notation for 0.
(ii) As a syntactic sugar, we write λx.M for λx.M .With this notation in place, PCF terms are simply EPCF terms containing empty explicit substitutions.(iii) For n ∈ N, we often write λx 1 . . .λx n .M as λx 1 . . .x n .M , or even λ x.M when n is clear from the context.Summing up, and recalling that denotes the capture-free substitution of N for all free occurrences of x in M .
The operational semantics of EPCF is defined via a call-by-name big-step (leftmost) weak reduction.Otherwise, we say that M is a non-terminating, or looping, term.
Example 1.5 We show some of the terms from Example 1.3, at work.
To get the reader familiar with the operational semantics, we give the details: We now endow EPCF terms with a type system based on simple types.
(iii) Typing judgements are triples, denoted Γ ⊢ E M : α, where Γ is a typing context, M is an EPCF term and α ∈ T. (iv) Typing derivations are finite trees built bottom-up in such a way that the root has shape Γ ⊢ E M : α and every node is an instance of a rule from Figure 2. In the rule (→ I ) we assume wlog that x / ∈ Γ, by α-conversion.We also use an auxiliary predicate σ |= Γ whose intuitive meaning is that Γ is a typing context constructed from an explicit substitution σ. (v) When writing Γ ⊢ E M : α, we mean that this typing judgement is derivable.
The following lemma summarizes the main (rather standard) properties of the language EPCF.
Lemma 1.8 Let M be an EPCF term, V ∈ Val, α, β ∈ T and Γ be a context.
It follows that, if an EPCF program M is typable, then it is also typable in the empty context.

Extended Addressing Machines
We extend the addressing machines from [11] with instructions for performing arithmetic operations and conditional testing.Natural numbers are represented by particular machines playing the role of numerals.

Main definitions
We consider fixed a countably infinite set A of addresses together with a distinguished countable subset X ⊂ A, such that A − X remains infinite.Intuitively, X is the set of addresses that we reserve for the numerals, therefore hereafter we work under the hypothesis that X = N, an assumption that we can make without loss of generality.Let ∅ / ∈ A be a "null" constant corresponding to an uninitialised register.Set A ∅ = A ∪ {∅}.Definition 2.1 (i) An A-valued tape T is a finite ordered list of addresses T = [a 1 , . . ., a n ] with a i ∈ A for all i (1 ≤ i ≤ n).When A is clear from the context, we simply call T a tape.We denote by T A the set of all A-valued tapes.(ii) Let a ∈ A and T, T ′ ∈ T A .We denote by a :: T the tape having a as first element and T as tail.We write T @ T ′ for the concatenation of T and T ′ , which is an A-valued tape itself.(iii) Given an index i ≥ 0, an A ∅ -valued register R i is a memory-cell capable of storing either ∅ or an address a ∈ A. We write !R i to represent the value stored in the register R i .(The notation !R i is borrowed from ML, where !represents an explicit dereferencing operator.)(iv) Given A ∅ -valued registers R 0 , . . ., R n for n ≥ 0, an address a ∈ A and an index i ≥ 0, we write R[R i := a] for the list of registers R where the value of R i has been updated by setting !R i = a.Notice that, whenever i > n, we assume that the contents of R remains unchanged, i.e.R[R i := a] = R.
Intuitively, the contents of the registers R 0 , . . ., R n constitutes the state of a machine, while the tape correspond to the list of its inputs.The addressing machines from [11] are endowed with only three instructions (i, j, k, l range over indices of registers): 1. Load i : reads an address a from the input tape, assuming it is non-empty, and stores a in the register R i .If the tape is empty then the machine suspends its execution without raising an error.2. k App(i, j) : reads the addresses a 1 , a 2 from R i and R j respectively, and stores in R k the address of the machine obtained by extending the tape of the machine of address a 1 with the address a 2 .The resulting address is not calculated internally but rather obtained calling an external application map. 3.Call i : transfers the computation to the machine having as address the value stored in R i , whose tape is extended with the remainder of the current machine's tape.
As a general principle, writing on a non-existing register does not cause issues as the value is simply discarded-this is in fact the way one can erase an argument.The attempt of reading an uninitialized Intrigila, Manzonetto, Münnich 8-7 register would raise an error-we however show that these kind of errors can be avoided statically (see Lemma 2.4).We enrich the above set of instructions with arithmetic operations mimicking the ones present in PCF: 4. l Test(i, j, k): implements the "is zero?" test on !R i .Assuming that the value of R i is an address n ∈ N, the instruction stores in R l the value of R j or R k , depending on whether n = 0. 5. j Pred(i Notice that the instructions above need R i to contain a natural number to perform the corresponding operation.However, they are also supposed to work on addresses of machines that compute a numeral.For this reason, the machine whose address is stored in R i must first be executed, and only if the computation terminates with a numeral is the arithmetic operation performed.Clearly, if the computation terminates in an address not representing a numeral, then an error should be raised at execution time.We will see that these kind of errors can be avoided using a type inference algorithm (see Proposition 3.5, below).Definition 2.2 (i) A program P is a finite list of instructions generated by the following grammar, where ε represents the empty string and i, j, k, l are indices of registers: Thus, a program starts with a list of Load's, continues with a list of App, Test, Pred, Succ, and possibly ends with a Call.Each of these lists may be empty, in particular the empty program ε can be generated.(ii) In a program, we write Load (i 1 , . . ., i n ) as an abbreviation for the instructions Load i 1 ; • • • ; Load i n .(iii) Let P be a program, r ≥ 0, and I ⊆ {0, . . ., r − 1} be a set of indices corresponding to the indices of initialized registers.Define the relation I |= r P , whose intent is to specify that P does not read uninitialized registers, as the least relation closed under the rules: Example 2.3 For each of these programs, we specify its validity with respect to R 0 = 7, R 1 = a, R 2 = ∅ (i.e., r = 3).
Proof.Decidability follows from the syntax directedness of Definition 2.2(iii), and the preservation of the invariant I ⊆ {0, . . ., r − 1}, since I is only extended with k < r. ✷ Definition 2.5 (i) An extended addressing machine (EAM ) M with r registers over A is given by a tuple: M = R 0 , . . ., R r−1 , P, T where R are A ∅ -valued registers, P is a program valid w.r.t.R and T ∈ T A is an (input) tape.(ii) We write M.r for the number of registers of M, M.R i for its i-th register, M.P for the associated program and M.T for its input tape.When writing "R i = a" in a tuple we indicate that R i is present and !R i = a.(iii) We say that an extended addressing machine M as above is stuck, written stuck(M), whenever its program has shape M.P = Load i; P but its input-tape is empty M.T = [].Otherwise M is ready, written ¬stuck(M).(iv) The set of all extended addressing machines over A will be denoted by where P = Load (1, . . ., n + 1); 0 App(0, 1); We now enter into the details of the addressing mechanism which constitutes the core of this formalism.
Definition 2.6 Recall that N stands for an infinite subset of A, here identified with the set of natural numbers, and Y a n has been introduced in Definition 2.5(vi).(i) Since M A is countable, we can fix a bijective function # : M A → A satisfying the following conditions: (a) (Numerals) ∀n ∈ N .#n = n, where n is the n-th numeral machine; (b) (Fixed point combinator) for all n ≥ 0, there exists an address a ∈ A − N such that #(Y a n ) = a.We say that the bijection #(•) is an address table map and call the element #M the address of the EAM M. We simply write Y n for the machine satisfying the equation above and a Yn for its address, i.e. #(Y n ) = a Yn .(ii) For a ∈ A, we write # −1 (a) for the unique machine having address a, i.e., # −1 (a) = M ⇐⇒ #M = a.
(iii) Given M ∈ M A and T ′ ∈ T A , we write M @ T ′ for the machine M. R, M.P, M.T @ T ′ .(iv) Define the application map (•) : Remark 2.8 In general, there are uncountably many possible address table maps of arbitrary computational complexity.A natural example of such maps is given by Gödelization, which can be performed effectively.The framework is however more general and allows to consider non-r.e.sets of addresses like the complement K c of the halting set In an implementation of EAMs the address table map should be computable-one can choose a fresh address from A whenever a new machine is constructed, save the correspondence in some table and retrieve it in constant time.
Remark 2.9 Depending on the chosen address table map, it might be possible to construct infinite (static) chains of EAMs (M) n∈N , e.g., The results we present are independent from the choice of #.

Operational semantics
The operational semantics of extended addressing machines is given through a small-step rewriting system.The reduction strategy is deterministic, since the only applicable rule at every step is univocally determined by the first instruction of the internal program, the contents of the registers and the head of the tape.Notice that since the redexes in Figure 3 are not overlapping, the confluence of ։ c follows easily (cf.[11,Lemma 2.11(2)]).
Proof.By induction on the length of M ։ c M ′ .✷ Example 2.12 See Example 2.7 for the definition of Succ1, Succ2, Add aux.

Unconditional rewriting rules
Under the assumption that l Test(i, j, k); P, T Fig. 3. Small-step operational semantics for extended addressing machines.

Typing Algorithm
Recall that the set T of (simple) types has been introduced in Definition 1.6(i).We now show that certain EAMs can be typed, and that typable machines do not raise error during their execution.Definition 3.1 (i) A typing context ∆ is a finite set of associations between registers and types, represented as a list R i 1 : α 1 , . . ., R in : α n .The indices i 1 , . . ., i n are not necessarily consecutive.(ii) We denote by ∆[R i : α] the typing context ∆ where the type associated with R i becomes α.
Let ∆ be a typing context, M ∈ M A , P be a program, T ∈ T A and α ∈ T. We define the typing judgements ∆ ⊢ M : α ∆ (P, T ) : α by mutual induction as the least relations closed under the rules of Figure 4.The rules (nat) and (fix) are the base cases and take precedence over (R ∅ ) and (R T ).
The algorithm in Figure 4 deserves some discussion.As it is presented as a set of inference rules, one should reason bottom-up.To give a machine M a type α, one needs to derive the judgement ⊢ M : α.The machines n and Y n are recognizable from their addresses and the rules (nat) and (fix) can thus be given higher precedence.Otherwise, the rule (R T ) allows to check whether the value in a register is typable and only retain its type, the rule (R ∅ ) allows to get rid of uninitialized registers.Once this initial step is performed, one needs to derive a judgement of the form R i 1 : β i 1 , . . ., R in : β in (P, T ) : α, where P and T are the program and the input tape of the original machine respectively.This is done by verifying the coherence of the instructions in the program with the types of the registers and of the values in the input tape.As a final consideration, notice that the rules in Figure 4 can only be considered as an algorithm when the address table map is effectively given.Otherwise, the algorithm would depend on an oracle deciding a = #M.Remark 3.2 (i) For all M ∈ M A and α ∈ T, we have ⊢ M : α if and only if there exists a ∈ A such that both # −1 (a) : α and #M = a hold.
The higher priority assigned to the rules (nat) and (fix) does not modify the set of typable machines, rather guarantees the syntax-directedness of the system.

Example 3.3
The following typing judgements are derivable.
(iii) For a smaller example, like ⊢ Succ1 : int → int, we can provide the whole derivation tree: then the typing algorithm is capable of deciding whether ⊢ M : α holds.
(ii) In general, the typing algorithm semi-decides whether ⊢ M : α holds.
Proof.(Sketch) (i) In this case, ⊢ M : α holds if and only if (M.P, []) does.By induction on the length of M.P , one verifies if it is possible to construct a derivation.Otherwise, conclude that ⊢ M : α is not

derivable.
(ii) In the rules (R T ) and (load T ), one needs to show that a type for the premises exists.As the set of types is countable, and effectively given, one can easily design an algorithm constructing a derivation tree (by dovetailing).However, the algorithm cannot terminate when executed on M 0 from Remark 2.9. ✷ The machine M 0 in Remark 2.9 cannot be typable because it would require an infinite derivation tree.Case (nat) is vacuous.Case (fix n ).We show the case for n = 0, the others being similar.By definition of Y 0 , we have: Notice that, in this case, β = α → α.Using # −1 (a Y 0 ) = Y 0 , we derive: (ii) The cases M = Y n or M = n for some n ∈ N are vacuous, as these machines are in final state.Otherwise, by Remark 3.2(ii), ∆ (M.P, M.T ) : α for some ∆ |= M. R. By cases on the shape of M.P .
(iii) Assume that ⊢ M : int and M ։ c N for some N in final state.By (ii), we obtain that ⊢ N : int holds, therefore N = n since numerals are the only machines in final state typable with int.
(iv) The three cases from Figure 3 where a machine can raise an error are ruled out by the typing rules (pred), (succ) and (test), respectively.Therefore, no error can be raised during the execution.✷

Translation and Simulation
We define a type-preserving translation from EPCF terms to extended addressing machines.More precisely, we show that if Γ ⊢ E M : α is derivable then M is transformed into a machine M which is typable with the same α.By Proposition 3.5, M never raises a runtime error and well-typedness is preserved during its execution.We then show that if a well-typed EPCF program M computes a value n, then its translation M reduces to the corresponding EAM n.Finally, this result is transported to PCF using their equivalence on programs of type int.
We start by showing that EAMs implementing the main PCF instructions are definable.We do not need any machinery for representing explicit substitutions because they are naturally modelled by the evaluation strategy of EAMs.
Proof.Easy.As an example, we give a possible definition of the predecessor: The others are similar.✷ Lemma 4.2 The EAMs in the previous lemma can be defined in order to ensure their typability (for all n ≥ 0, α, β, γ, δ i ∈ T): Proof.The naive implementations are, in fact, typable.✷ We will show that, using the auxiliary EAMs given in Lemma 4.2, we can translate any EPCF term into an EAM.In order to proceed by induction, we first need to define the size of an EPCF term.Definition 4.3 Let M be an EPCF term and σ be an explicit substitution.The sizes |−| of σ, M and (σ, M ) are defined by mutual induction, e.g.
and the other cases of |M | are standard whence they are omitted.
(iv) Given a PCF term P and a value U , we write P ⇓ U if this judgement can be obtained by applying the rules from Figure 5. (v) The set T of simple types and typing contexts have already been defined in items (i) and (ii) of Definition 1.6, respectively.(vi) Given a PCF term P , a typing context Γ and α ∈ T, we write Γ ⊢ PCF P : α if this typing judgement is derivable from the rules of Figure 6.
Recall that any PCF program P can be seen as an EPCF term, thanks to the notation λx.N := λx.N .However, the hypotheses ⊢ PCF P : int and P ⇓ n are a priori not sufficient for applying Corollary 4.8, since one needs to show that also the corresponding EPCF judgments ⊢ E P : int and P ⇓ d n hold.The former is established by the following lemma.

Example 1 . 3
We introduce some notations for the following (E)PCF programs, that will be used as running examples.(i) I = λx.x,representing the identity.(ii) Ω = fix (I) representing the paradigmatic looping program.(iii) succ1 = λx.succ(x), representing the successor function.

Definition 1 . 4
(i) We let Val = {n | n ∈ N} ∪ {λx.M σ | M is an EPCF term} be the set of EPCF values.(ii) The big-step weak reduction is the least relation ⇓ d from EPCF terms to Val, closed under the rules of Figure 1.(iii) We say that an EPCF program M is terminating whenever M ⇓ d V holds, for some V ∈ Val.

Definition 1 . 6
(i) The set T of (simple) types over a ground type int is inductively defined by the grammar:α, β ::= int | α → β (T) The arrow associates to the right, in other words we write α 1

Example 1 . 7
The following are examples of derivable typing judgments.
x) | the program i terminates when run on input x} Intrigila, Manzonetto, Münnich 8-9 and a non-computable function # : M K c → K c as a map.

Definition 2 . 10
We introduce a fresh constant err / ∈ M A to represent a machine raising an error.(i) Define a reduction strategy → c on EAMs, representing one step of computation, as the least relation → c ⊆ M A × (M A ∪ {err}) closed under the rules in Figure 3. (ii) The multistep reduction ։ c is defined as the transitive-reflexive closure of → c .(iii) Given M, N, M ։ c N, we write |M ։ c N| ∈ N for the length of the (unique) reduction path from M to N.(iv) For M, N ∈ M A , we write M ↔ c N if they have a common reduct Z ∈ M A ∪ {err}, i.e.M ։ c Z c և N. (v) An extended address machine M: is in final state if it cannot reduce, written M → c ; reaches a final state if M ։ c M ′ for some M ′ ∈ M A infinal state; raises an error if M ։ c err; does not terminate, otherwise.

Theorem 4 . 7 Corollary 4 . 8
Let M be an EPCF term and V ∈ Val.Thenσ ⊲ M ⇓ d V ⇒ σ, M ↔ c V Proof.By induction on a derivation of σ ⊲ M ⇓ d V .✷ For an EPCF program M of type ⊢ E M : int we have [ ] ⊲ M ⇓ d n ⇒ M ։ c n Proof.Assume that [ ] ⊲ M ⇓ d n.ByTheorem 4.7, we have [ ], M ↔ c n .Since n ։ c n and the numeral machine n is in final state we conclude M ։ c n. ✷ 4.1 Applying the translation to regular PCFLet us show how to apply our machinery to the usual (call-by-name) PCF.Our presentation follows[22].

Lemma 4 .
10 Let M be a PCF term, α ∈ T and Γ be a context.ThenΓ ⊢ PCF M : α ⇒ Γ ⊢ E M : αProof.By a straightforward induction on a derivation of Γ ⊢ PCF M .✷An EPCF term is easily translated into PCF by performing all its explicit substitutions.The converse is trickier as the representation is not unique: for every PCF term P there are several decompositionsP = P ′ [Q 1 /x 1 , . . ., Q n /x n ].Recallthat the size |(σ, M )| has been defined in Definition 4.3.Definition 4.11 Let M be an EPCF term and σ be an explicit substitution.Define a PCF term (σ, M ) *