key: cord-0054944-tl1g7jew authors: Laird, James title: A Curry-style Semantics of Interaction: From Untyped to Second-Order Lazy [Formula: see text] -Calculus date: 2020-04-17 journal: Foundations of Software Science and Computation Structures DOI: 10.1007/978-3-030-45231-5_22 sha: de5ddbf2983b7c96f167c652b91af5744a86386d doc_id: 54944 cord_uid: tl1g7jew We propose a “Curry-style” semantics of programs in which a nominal labelled transition system of types, characterizing observable behaviour, is overlaid on a nominal LTS of untyped computation. This leads to a notion of program equivalence as typed bisimulation. Our semantics reflects the role of types as hiding operators, firstly via an axiomatic characterization of “parallel composition with hiding” which yields a general technique for establishing congruence results for typed bisimulation, and secondly via an example which captures the hiding of implementations in abstract data types: a typed bisimulation for the (Curry-style) lazy [Formula: see text] -calculus with polymorphic types. This is built on an abstract machine for CPS evaluation of [Formula: see text] -terms: we first give a basic typing system for this LTS which characterizes acyclicity of the environment and local control flow, and then refine this to a polymorphic typing system which uses equational constraints on instantiated type variables, inferred from observable interaction, to capture behaviour at polymorphic and abstract types. "Church-style" and "Curry-style" are used to distinguish programming languages in which the type of a term is intrinsic to its definition from those in which it is an extrinsic property. The same distinction may be applied to semantics of programming languages: in many models, type-objects are essential to the interpretation of a term -e.g. as a morphism between objects (types) in a category -but interpreting terms independently of their types (as in e.g. realizability interpretations) may have conceptual and practical advantages, particularly for describing Curry-style type systems. The aim of this semantic investigation of higher-order programs is to develop a Curry-style semantics of interaction by overlaying a labelled transition system of types onto a LTS of untyped computation, so that the observable behaviour of a typed state is restricted to the actions made available by its type. Our objective is to apply this to lazy functional programs: untyped and with Curry-style polymorphic typing systems, and to develop a theory of program equivalence -typed bisimulation -able to describe genericity and abstract datatypes in this setting. Game Semantics Games models for programming languages are typically (but not invariably) given in a Church-style: terms are interpreted as strategies on a specified two-player game which represents their type [2, 9] . This kind of semantics is compositional by definition, at the cost of forgetting the internal computational behaviour of programs, and potentially excluding system level behaviour [6] . It uses categorical structure to describe its models and prove key results -in particular soundness with respect to an operational semantics. By contrast, in operational game semantics [15, 12] , programs are interpreted as states in a labelled transition system based directly on their syntax and operational semantics. Internal computation is retained but can be factored out by restricting to observable behaviour. Soundness of these models "comes for free" -instead, the fundamental property requiring non-trivial proof is that they are compositional -that is, the equivalence induced on programs is a congruence. Basic structure which supports and systematizes these proofs would be useful (techniques such as Howe's method are not available in this intensional setting). We aim to show that defining operational game semantics in a Curry style gives the opportunity to formulate and apply such structure. This is complementary to characterization of the structure of operational game semantics at a categorical level [18] , into which we believe our semantics can fit well. Our motivation and general methodology bears similarities to the programme of Berger, Honda and Yoshida [3] --in which Curry-style types are used to characterize the πcalculus processes corresponding to functional and polymorphic programs -and to typing systems for process calculi such as those described in [10] . Hiding using types We will interpret (extrinsic) types as hiding operators: windows through which terms of a given type may interact with the world, while their internal behaviour is hidden from external observation -both passive and active. Our goal is to show that this interpretation can be used to model information hiding in two key areas of higher-order computation. The first, "parallel composition with hiding" is the fundamental operation on which game semantics is based. We axiomatize the notion of a typing system for an LTS with such an operation, in which a type is a state which characterizes precisely the possible interaction between a function and its argument at that type. The second form of information hiding for which we give a Curry-style interpretation is hiding of implementation details using polymorphic (existential) types as abstract data types. Our key example of a typed labelled transition systems is a new model of the second-order λµ-calculus: we shall now discuss the background and significance of this contribution. Our starting point is the lazy λ-calculus -the pure, untyped λ-calculus, evaluated by weak head reduction -and its extension with first-class continuations, the corresponding version of Parigot's λµ-calculus [21] . As argued in [1] , the lazy λ-calculus approximates well to the behaviour of lazy functional programming languages such as Haskell, and is thus an appropriate setting in which to explore properties such as program equivalence, for which there is now a rich and well-studied theory. For instance, open or normal form bisimilarity [25] is a coinductively defined equivalence which extends β-equivalence to infinitary behaviours. It gives a purely intensional characterization of program equivalence (by contrast to e.g. applicative bisimilarity, which involves quantifying over all possible arguments) and has a variety of alternative characterizations -for instance two terms are open bisimilar if and only if they have the same Levy-Longo trees [19] , or their (call-by-name) translations in the π-calculus are weakly bisimilar [25, 5] . (Or, indeed, if they are normal-form bisimilar as λµ-terms.) Normal form bisimilarity of simply-typed λ-terms is just β-equivalence. However, extending to polymorphic types, such as those of the second-order λcalculus (System F) [7, 24] poses deeper questions. A primary motivation for introducing polymorphic types is that they can express abstract data types which hide implementation details [20] (cf. the module systems of Haskell and ML). A useful notion of program equivalence should therefore reflect this. As a simple example, the untyped λ-terms λf.f λx.λy.x and λf.f λx.λy.y are clearly not normal form bisimilar. But at the second-order type ∃X.X ∀Y.(∀X.X → Y ) → Y (which they both inhabit in a Curry-style presentation), they should be behaviourally equivalent -since any function of type : ∀X.(X → Y ) will never call its argument. In other words, the existential type ∃X.X "hides" the difference between λf.f λx.λy.x and λf.f λx.λy.y. This is an observational equivalence, but of a particularly fundamental kind, since it (and other equivalences involving abstract data types) is robust in the presence or absence of side-effects. It can be captured by extensional methods such as applicative bisimilarity, which was extended to a polymorphic setting in [26] , but this requires quantification over instantiating terms and types, whereas our semantics is based on unification of instantiating types. The problem is that comparing the evaluation trees of terms (e.g. by normal form bisimulation) does not capture the capacity of their types to restrict interaction with the environment. Game semantics does reflect this interaction (in various manifestations), and therefore offers a potential solution. Although several games models for polymorphism do not capture data abstraction by existential types (including Hughes' semantics of System F [8] , which is faithful with respect to βη-equivalence, and Curry-style models [16] ) a series of related approaches does so. These include translation into the (polymorphically typed) π-calculus [4] , and an operational form [17, 27] and a traditional compositional presentation [14, 13] of game semantics. In these semantics, values of polymorphic variable type are interpreted as pointers to data of undisclosed type -e.g. a location where it is stored, or a channel on which it may be received. Instantiation of universally quantified type variables replaces this pointer-passing with copycat behaviour. This gives a natural interpretation of polymorphism in settings such as the π-calculus, or languages with general references, where pointers are first-class objects. However, it is closely associated with a Church-style presentation of second-order type systems -e.g. by the interpretation of type abstraction as an explicit creation of a pointer; in the case of "typed normal form bisimulation" [17] the translation of a term is explicitly determined by its type. This is significant because it is in the presence of polymorphism that key differences between Church-style and Currystyle emerge -for example, in allowing intersection types. The pointer-passing models also exhibit behaviours which go beyond untyped functional interaction, making their relationship to it unclear -in the game semantics [14] , instantiation violates the fundamental innocence and visibility conditions on strategies; the π-calculus interpretation uses free name as well as bound name passing. Curry-style semantics give a natural interpretation of second-order Currystyle typing, with a simple relationship to the semantics of the untyped λµcalculus, by overlaying a more refined LTS of second order types on the same underlying LTS of computations. In this section we describe a notion of typed labelled transition system and an associated equivalence: typed bisimulation. Based on this we axiomatize a simple typing system for parallel composition with hiding and show that it preserves typed bisimulation. Examples of typed LTS (in the form of models of the lazy λµ-calculus and lazy λµ2-calculus) follow in the rest of the paper. We work in the setting of nominal sets [23] , which allows the introduction of fresh names (for store locations, communication channels, types etc). Assume a fixed, infinite set of atoms and a group G of permutations on them. A nominal set X is an action of G on a set |X| such that each x ∈ |X| has a finite supporting set of atoms such that if π(a) = a for all atoms in this set then π ·x = x. We write sup(x) for the ⊆-least of these sets (which is the intersection of all supporting sets for x). A nominal LTS is a labelled transition system (S, Act, →) such that S (states) and Act (actions) are nominal sets and the transition relation → is equivariant -i.e. for any π ∈ G, C a −→ C if and only if π · C π·a −→ π · C . Similarly motivated notions of nominal LTS are developed in e.g. [22] . Our key example -an abstract machine for direct-style CPS evaluation -is given in the next section. The directly observable part of a labelled transition system may be characterized by defining a typing system for it. (Similar notions of typing system for a process calculus are defined in [10] , for example.) Definition 2. A typing system for a nominal LTS (S; Act; →) is a nominal LTS (T ; Obs; →) such that Obs ⊆ Act, with a relation, ⦂ (typing), from S to T which satisfies the following subject reduction properties for each C ⦂ T : where a ∈ Obs and sup(C ) ∩ sup(T ) ⊆ sup(C ) ∩ sup(T ), then C ⦂ T (we write C ⦂ T −→ C ⦂ T ). Subject reduction requires that actions which are observable (i.e. in Obs) change a computation and its type in a way that respects the typing relation, and that those which are internal to a computation (i.e. in Act\Obs) maintain its type (provided that any names fresh for the state are also fresh for its type). Let =⇒ be the reflexive, transitive closure of the internal reduction −→, and To define weak bisimulation between typed states based on these relations, we need to take account of the fact that a name may be fresh for one, but already occur internally in the other (cf. [22] ). So bisimulation is defined up to the equivalence on the states of type T which allows permutation of internal names: Definition 3. A typed bisimulation is a binary, symmetric, equivariant relation R between typed states (C ⦂ S), such that if (C ⦂ S)R(D ⦂ T ) then S = T and: Typed bisimilarity is the largest typed bisimulation: states C and D are bisimilar Having proposed an interpretation of types as operators which hide internal communication, we now characterize the properties of a typing system for parallel composition with hiding which entail that it preserves typed bisimulation (i.e. the latter is a congruence). An interaction structure is a nominal LTS (S; Act; →) such that Act = L∪({+, −}×L) for some set of L of (unpolarized) labels, with an equivariant partial binary operation | on S ( parallel composition) such that if C = C 1 |C 2 then C a −→ C if and only if C = C 1 |C 2 for some C 1 and C 2 such that either: The nominal side-conditions require that any names which are fresh for the component to which they are introduced are fresh for the whole state. Parallel composition is typed using a ternary relation between types: T 1 T2 T 3 means "T 2 is an arrow type from T 1 to T 3 " -there may be several arrow types between two types (or none). Definition 5. A typing system for an interaction structure (Comp, L, |) is a typing system (T ; ({+, −} × L); →) for Comp with an equivariant ternary relation, , on T such that if T 1 T2 T 3 then for any C 1 ⦂ T 1 and C 2 ⦂ T 2 such that sup(C 1 ) ∩ sup(C 2 ) ⊆ sup(T 1 ), the state C 1 |C 2 is well-defined, has type T 3 and satisfies the following interaction conditions: Informally (1) requires that if C 1 and C 2 may communicate, then this is permitted by T 1 and T 2 , and (2) and (3) require that the observable actions of C 1 |C 2 permitted by T 3 correspond to actions of C 2 permitted by T 3 . Note that for any there are no sidechannels of communication between C 1 and C 2 -and thus C 1 |C 2 is well-defined, has type T 3 and satisfies the interaction conditions. Moreover, these are sufficient to establish that typed bisimulation is a congruence with respect to parallel composition with hiding: a result that we will apply to our examples in the rest of the paper. Proof. We first establish the following renaming property: if -by renaming any fresh names introduced by internal transition so that they are also fresh for C 2 . Similarly, any internal reduction of C 2 corresponds to a reduction of C 1 |C 2 , up to such a renaming. . By definition of an interaction structure, and conditions (2) and (3), and by the renaming property we may rename any fresh names in this reduction sequence to avoid clashes with If C 1 |C 2 ⦂ T 3 performs an internal action then this is either an internal action of C 1 ⦂ T 1 or C 2 ⦂ T 2 , which is similar to the observable case, or else We now define a typed interaction system giving an interpretation of the (untyped) lazy λµ-calculus -i.e. a direct-style CPS interpretation of lazy functional computation -yielding a novel, direct characterization of normal form bisimulation as typed bisimulation. This acts as a non-trivial example of a typed interaction system (as defined in the previous section) and a stepping stone to the polymorphic typing system for the same underlying language in the next section. First, we define an abstract machine for lazy CPS evaluation, in the form of a nominal LTS in which actions make explicit the calls made by a program to its environment. (Cf the analysis of λµ-calculus by π-calculus translation in [5] .) Definition 6. The unnamed and named terms of the untyped λµ-calculus [21] are given (respectively) by the following grammars: We equip the set of λµ-terms with a group action by assuming a set N of distinguished identifiers, partitioned into sorts (infinite subsets) of λ-variables (x, y, z, . . .) and µ-variables (α, β, γ . . .) and (for later use) type variables (X, Y, Z, . . .) . The group of sort-preserving permutations on N acts pointwise on expressions (i.e. permuting elements of N and fixing symbols not in N ). We form a nominal set of λµ-terms consisting of the terms in which the free variables are all in N and those which occur bound (by λ or µ) are not, so that the support of a term is its set of free variables. Based on this syntax, we define the sets of expressions (control terms) which determine the next transition of our abstract machine. As above we form a nominal set of control terms in which the support of each element is its set of free variables. An environment is a sort-respecting finite partial function E from N into the nominal sets of unnamed λµ-terms and continuations. The nominal set of environments has the G-action: (π · E)(a) = π · (E(π −1 · a)). Direct-style CPS evaluation of a program in an environment proceeds as follows: -A variable inside a continuation (E; K[x]) fetches the term bound to x and names it with a fresh µ-variable which is bound to K. Table 1 . By convention, a variable name mentioned on the right of a rule but not the left is assumed not to occur there. The polarity of a state is positive if the control term is a program or continuation, and negative if it is a value or the empty context (we write V • for a passive term of either kind). Unpolarized transitions send positive states to positive states. Except for µ-abstraction reduction, each corresponds to complementary, positive and negative transitions, which send positive states to negative states and viceversa. Table 1 , we may see that C 1 |C 2 has precisely the transitions of C 1 or C 2 (provided any fresh names are fresh for C 1 |C 2 ), together with internal transitions arising from communication between C 1 and C 2 . Therefore we have an interaction structure according to Definition 4. Figure 1 gives an illustrative example: the evaluation of [α](λf.f λx.x) λy.y -which is the parallel composition (λf.f λx.x)|([α] • λy.y) -to [α]λx.x. We now define a basic typing system for configurations which records minimal information about the control term (whether it is a program, value, continuation or empty context) but captures a more significant property of environmentsacyclicity. This has practical relevance for memory management, but its immediate significance is that the second order typing in the next section relies on the fact that an acyclic environment may be contracted into a valuation by iteratively replacing variables bound in the environment until none occur as free variables. Definition 11. Given a nominal environment E, define the binary relation on N : a E b if a ∈ sup(E(b)) and let * E be its transitive closure. Say that E is a pre-valuation (i.e. acyclic) if this is a strict partial order -i.e. a * a for all a ∈ N . E is a valuation if E = * E -i.e. sup(E(a)) ∩ dom(E) = ∅ for all a ∈ dom(E). We assume a closure operation which takes an expression e and pre-valuation E to an expression E(e) obtained by replacing each atom a ∈ dom(E) with E(a) in e, having the property that sup(E(e)) ∩ dom(E) = {sup(E(a)) | a ∈ sup(e) ∩ dom(E)}. For any pre-valuation E there is a unique valuation E * such that E * (E(e)) = E * (e) for all expressions e. , the E i form a chain of pre-evaluations such that the E downward closure of {sup(E i (a)) ∩ dom(E) | a ∈ dom(E)} is empty or strictly decreasing, and thus is empty for some k -i.e. E k is a pre-valuation and thus E k (E(a)) = E(E k (a)) = E k (a) for all a ∈ dom(E), and so E * (E(e)) = E * (e) for all expressions e. If E * (e) = E * (E(e)) for all expressions e, then E * (e) = E * (E k (e)) = E k (e) for all e. Configurations are typed with polarized versions of these types. Given a polarized context (non-repeating sequence of polarized variables) Γ = p 1 x 1 , . . . , p n x n we write |Γ | for the unpolarized context x 1 , . . . , x n , Γ for the polarized context p 1 x 1 , . . . , p n x n , and Γ p for the (unpolarized) restriction of Γ to p-polarized elements. Table 2 . We now define a typing relation from configurations to types. Let Γ be a polarized context. A pre-valuation for Γ is a pre-valuation E such that Γ + ⊆ dom(E), sup(E(a)) ⊆ dom(E) ∪ Γ − for every a ∈ dom(E), and if a, b ∈ Γ and a * E b then a < Γ b. Observe that if E is a pre-valuation for Γ , then E * is a valuation for Γ such that for all a ∈ Γ + , F V (E * (a)) ⊆ Γ − . It is straightforward to check that this satisfies the subject reduction properties and thus defines a type system for Comp λµ . We may apply a second constraint via our type system: local control flow -that continuations are called according to a LIFO discipline and thus may be stored on a stack (in game semantic terms, the well-bracketing condition). Evaluation of λ-terms by internal (and positive) transitions naturally satisfies this property -we can use types to ensure that the environment also does so. Transitions for local control types are given by refining the rules for calling a continuation to enforce stack discipline: Subject reduction holds with respect to λ-configurations (in which the control term, and all terms and continuations in the environment, contain no µabstractions). We now define an arrow relation, allowing a characterization of parallel composition with hiding for acyclic configurations. (Acyclicity is not preserved by union of environments in general, so the typing rules give a useful way of identifying pairs of configurations for which it does hold.) pτ 1 pτ2 pτ 3 iff pτ 1 = −⊥ and pτ 2 = pτ 3 or pτ 3 = +⊥ and pτ 2 = pτ 1 . T i = Γ i pτ i ; ∆ i is de- fined pointwise -T 1 T2 T 3 if Γ 1 Γ2 Γ 3 , ∆ 1 Proposition 2. (Ty λµ , ) is a well-defined typing system for (Comp λµ , |). Proof. Given C 1 = (E 1 ; A 1 ) and C 2 = (E 2 ; A 2 ), suppose C 1 : T 1 , C 2 : T 2 and sup(C 1 ) ∩ sup(C 2 ) ⊆ sup(T 1 ) = |Γ 1 | ∪ |∆ 1 |: -A 1 |A 2 is well-defined, and has type τ 3 , since either A 1 : −⊥ (i.e. A 1 = •) and so A 1 |A 2 : τ 2 , or A 1 and A 2 have complementary types, and so A 1 |A 2 : +⊥ (i.e. they are a term and context which fit together to give a program). (Any cycle in this graph would have to contain vertices from both E1 and E2 , since both fragments are acyclic. Any path which enters and leaves one fragment must begin and end on points which are ordered by Γ ∪ ∆ and so composing such paths cannot lead to a cycle.) Moreover, it is straightforward to verify that the interaction conditions are satisfied and that we therefore have a typed interaction structure. Thus, by Proposition 1, typed bisimilarity is preserved by parallel composition plus hiding. In this section we describe a more restrictive and informative typing system for the interaction structure of λµ configurations. This yields a model of the lazy λµ2-calculus -i.e. lazy λµ-calculus with polymorphic (second-order) Currystyle typing, which we now describe. In order to fit such a type system to a semantics of lazy evaluation to weak head-normal form, we combine λ-abstraction and application with abstraction and instantiation of finite sequences of type variables -i.e. function types take the form ∀(X 1 . . . X n ).σ → τ , where X 1 . . . X n is a finite, non-repeating sequence of type variables. The judgments Θ τ (τ is a well-formed type over the context of type-variables Θ) are derived according to the rules: Θ,X,Θ X Θ,X 1 ,...,Xn σ Θ,X 1 ,...,Xn τ Θ ∀(X 1 ...Xn).σ→τ Typing judgments are given with respect to an equational context (finite sequence of equations between types). These contexts play a key role in defining states in our LTS of types -they record constraints that type-instantiations must satisfy. For example, if a continuation K (with a hole) of type σ is called with an argument v of type τ then the type variables in σ and τ must have been instantiated so as to make these types equal. Formally, we define the judgment Θ Ξ (Ξ is a well-formed equational context over Θ) as follows: Type equality judgments with respect to an equational context, of the form Θ; Ξ σ = τ (where Θ Ξ, σ, τ ) are derived according to the rules: A λµ2 type-in-context is a tuple Θ; Ξ; Γ τ ; ∆, where Θ is a context of type variables and Ξ is an equational context, τ is a λµ2-type (or ⊥) and Γ and ∆ are (respectively) sequences of λ-variables and µ-variables and their types (all over Θ). Assigning this type to a term may be understood as asserting that "for any valuation V of the type-variables in Θ which satisfies Ξ, the judgement V(Γ ) t : V(τ ); V(∆) is valid". So, for example, X, Y ; Y = X → X; λx.x : Y ; is derivable according to the rules in Table 3 . Note that there are no rules for introducing or discharging equational assumptions -they will be generated by the transitions of the LTS -so the terms of type Θ; ; Γ t : τ ; ∆ are precisely those derivable in second-order λµ-calulus without type equality judgments. We now define a second-order typing system for the interaction structure Comp λµ of λµ configurations. Its states (second-order configuration types) capture the totality of information about the types of the control term and environment, and the instantiations for type variables by both a program and its environment, which may be inferred by an external observer of their interaction. A second-order configuration type is a polarized λµ2 type-incontext -a tuple Θ; Ξ; Γ ; pτ ; ∆, where Θ is a polarized context of typevariables, and Ξ is a polarized equational context, Γ and ∆ are polarized contexts of typed λ and µ variables and pτ is a polarized λµ2-type (or ⊥), all over Θ . We place a further constraint -"polarized satisfiability" -on the configuration types which are permitted as states. This requires that their equational contexts can actually be satisfied by a program and environment successively instantiating type variables quantified positively and negatively (respectively), without knowing the types instantiated by the counterparty. A pre-valuation V for a polarized context of type variables Θ positively satisfies the polarized equational context Θ Ξ (written V Θ Ξ) if for any pre-valuation W for Θ, the first formula in Ξ not satisfied by the valuation (V ∪ W) * for |Θ| (if any) is negative. Θ Ξ is (polarized) satisfiable if Ξ Θ and Θ Ξ are both positively satisfiable. Note that this implies that the underlying context |Θ| |Ξ| is satisfiable. Determining whether a polarized context is satisfiable is equivalent to a series of conditional (first-order) unification problems: these can be solved using the algorithm for first-order unification [11] . We place an equivalence relation on configuration types (cf. structural congruence of processes), allowing the principal type to be replaced by any of the (finitely many) types to which it is equivalent under Ξ. Table 4 . To define a typing relation between configurations and λµ2-configuration types, we first define typing judgements Θ; Ξ; Γ A : τ ; ∆ for control terms. In the case of programs and values, these are as derived according to the rules in Table 3 Note that if C ⦂ T and T T then C ⦂ T , so typing is a well-defined relation from configurations to equivalence classes of configuration types. Observe that there are no transitions from the the final state -a call to γ is not possible because −Y, +X −(Y = X ) is not negatively satisfiable. In fact, the tree of transitions of ∃X.X branches only on negative transitions (i.e. Opponent moves). It follows that any configuration of this type will have the same set of transitions, and that therefore λf.f λxy.x ∼ ∃X.X λf.f λxy.y as proposed in the introduction. It remains to prove that Ty λµ2 is a well-defined typing system for the interaction structure on Comp λµ , and that typed bisimulation is therefore a congruence. We need to establish that the pointwise extension of the arrow relation (Definition 16) to second-order configuration types (i.e. T 1 sup(C 1 )∩sup(C 2 ) ⊆ sup(T 1 ), then C 1 |C 2 is well-defined, has type T 3 and satisfies the interaction conditions. By Proposition 2, is a well-defined configuration, and E E 1 ∪ E 2 is a pre-valuation for Γ 3 ∪ ∆ 3 . By the assumption that C 1 ⦂ T 1 and C 2 ⦂ T 2 , there are valuations V 1 C 1 ⦂ T 1 and V 2 C 2 ⦂ T 2 . Then V V 1 ∪ V 2 is a pre-valuation for Θ 3 . To show that V * C 1 |C 2 ⦂ T 3 , we need to verify that: Proof. Let W be a pre-valuation for Θ 3 . The first formula in Ξ 2 (if any) which is not satisfied by V ∪ W = V 1 ∪ V 2 ∪ W cannnot be positive in Ξ 1 (positively satisfied by V 1 ) nor in Ξ 2 (positively satisfied by V 2 ), and so must be a negative formula in Ξ 3 . Proof. Observe that E * = (E * 1 · E * 1 ) i and V = (V 2 · V 1 ) i for some i ≤ n. Hence, it suffices to prove by induction on i that Θ 2 ; ( Similarly, each term and continuation assigned to an output variable is welltyped under closure by V * and E * and thus: It remains to show that the interaction conditions of Definition 5 are satisfied. The key is establishing condition 1 -that if C 1 pl −→ C 1 and C 2 pl −→ C 2 then T 1 pl → T 1 and T 2 pl → T 2 such that T 1 T 2 T 3 . This requires some further investigation of configuration types. We have shown that the arrow relation satisfies the first interaction condition. 2 and 3 are straightforward to verify, establishing that (Comp λµ2 ⦂ Ty λµ2 ) is a well-defined typed interaction structure. Therefore, by Proposition 1, typed bisimulation is preserved by parallel composition plus hiding, and thus: Theorem 1. Typed bisimulation is a congruence for the λµ2-calculus. We have described a "Curry-style" approach to game semantics, and used it to give new models of polymorphism. Various existing models may also be framed as typed interaction systems, such as the semantics of call-by-value in [12] . Nor are instances restricted to operational game semantics: for example we can present linear combinatory algebras of games and strategies in this way, and potentially other models of concurrent interaction. Unlike basic Church-style game semantics, these models give the opportunity to make finer distinctions between programs based on internal behaviour, which we have not explored here. The notion of typed interaction structure reflects only limited structure of our models, but may be developed further. Having characterized parallel composition plus hiding within this setting, a natural next step would be a notion of copycat strategy, leading to structure for sharing and discarding information. One goal for such a development would be to put the generalization of congruence from configurations to terms on a systematic footing. In another direction, our models of polymorphism may be developed further. In particular combining and fully exploiting generic and abstract data types often requires higher-order polymorphism, in which quantifiers range over type operators (functions which take types as arguments and return them as values). Whereas this is difficult to represent in game semantics, our model readily extends to a typing system based on System F ω , which allows quantification over type-operators: the price to pay is that satisfiability of configuration types (and thus effective presentation of the states of our LTS) requires the solution of higher-order unification problems, which are undecidable, in general. Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made. The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. (or viceversa) and so they can perform the complementary actions − y, α and + y, α . We need to show that |Θ 1 |; |Ξ 1 | τ is non-atomic -that is, |Θ 1 |; |Ξ 1 | τ = ∀X 1 . . . X m .ρ → σ -for some ρ, σ. Observe that this implies that |Θ 2 |; |Ξ 2 | τ is also non-atomic (since Ξ 2 contains the equations in Ξ 1 ) so that T 1 and T 2 can perform the complementary actions − y, α and + y, α . Since any derivation of a typing judgement for λx.t or K[• s] must conclude with →-introduction followed by applications of the type-equality rule we have: Lemma 5 ⦂ to show that |Θ 1 |; |Ξ 1 | τ is non-atomic is it is sufficient to prove the contrapositive Ξ) V + (τ ) or Θ + which are equal only if syntactically identical, and prove the lemma for this extended set of types by an outer induction on the size of Θ, and an inner induction on the sum of the lengths of the types in Ξ. At least one of V + (τ ) and V − (τ ) must be atomic and so if Ξ is empty then the hypothesis holds. Otherwise, Ξ ≡ p(σ = σ ), Ξ for some types σ, σ and equational context Ξ over Θ, and polarity p ∈ {+, −}. If σ and σ are both non-atomic, then by satisfiability σ ≡ ∀X 1 + (τ ) or Θ + If σ ≡ σ , then we may discard the tautology σ = σ and apply the (inner) inductive hypothesis to Θ; Ξ τ . Otherwise at least one of σ, σ must be a type-variable with polarity p in Θ (none of the other cases are p-satisfiable). So assume without loss of generality that Θ ≡ Θ , pX, Θ and Ξ ≡ p(σ = X), Ξ . We may show that − (τ ) is atomic, and hence either Θ − The lazy λ-calculus Full abstraction for PCF. Information and Computation Sequentiality and the π-calculus Genericity and the π-calculus Process types as a descriptive tool for interaction: Control and the π-calculus System level game semantics Linear logic Games and definability for System F On full abstraction for PCF: I, II and III. Information and Computation A generic type system for the π-calculus The single-conclusion proof logic and inference rules specification A fully abstract trace semantics for general references Game semantics of call-by-value polymorphism Game semantics for a polymorphic programming language Typed normal form bisimulation Curry-style type isomorphisms and game semantics Typed normal form bisimulation for parametric polymorphism Transition systems over games Set-theoretical models of lambda calculus: Theories, expansions and isomorphisms Abstract types have existential type λµ calculus: an algorithmic interpretation of classical natural deduction Modal Logics for Nominal Transition Systems Nominal Sets: Names and Symmetry in Computer Science Towards a theory of type structure The lazy λ-calculus in a concurrency scenario The category-theoretic solution of recursive domain equations Trace semantics for polymorphic references