Curry-style type Isomorphisms and Game Semantics
aa r X i v : . [ c s . L O ] M a y Curry-style type isomorphisms and game semantics
Joachim de LatailladePreuves Programmes SystèmesCNRS - Paris [email protected]
Abstract
Curry-style system F, i.e. system F with no explicit types in terms, can be seen as a core presentation ofpolymorphism from the point of view of programming languages.This paper gives a characterisation of type isomorphisms for this language, by using a game modelwhose intuition comes both from the syntax and from the game semantics universe. The model is composedof: an untyped part to interpret terms, a notion of game to interpret types, and a typed part to express thefact that an untyped strategy σ plays on a game A .By analysing isomorphisms in the model, we prove that the equational system corresponding to typeisomorphisms for Curry-style system F is the extension of the equational system for Church-style isomor-phisms with a new, non-trivial equation: ∀ X . A ≃ ε A [ ∀ Y . Y / X ] if X appears only positively in A . Types isomorphisms.
The problem of type isomorphisms is a purely syntactical question: two types A and B are isomorphic if there exist two terms f : A → B and g : B → A such that f ◦ g = id B and g ◦ f = id A .This equivalence relation on data types allows to translate a program from one type to the other withoutany change on the calculatory meaning of the program. Thus, a search in a library up to type isomorphismwill help the programmer to find all the functions that can potentially serve his purpose, and to reuse themin the new typing context [Rit91]. This is particularly appealing with functional languages, because inthis case the type can really be seen as a partial specification of the program: such a library search up toisomorphisms has been implemented in particular for Caml Light by Jérôme Vouillon. It can also be usedin proof assistants to help finding proofs in libraries and reusing them [BP01] (for more details on the use oftype isomorphisms in computer science, see [DC95]). From a more general point of view, type isomorphismsare the natural answer to the question of equivalence between types in a programming language.The question of characterising these type isomorphisms is then a very simple problem to formulate,however its resolution is often non-trivial, especially when dealing with polymorphism. Roberto DiCosmo [DC95] has solved syntactically this question for Church-style system F (i.e. system F where typesappear explicitly in the terms) by giving an equational system on types equivalent to type isomorphisms.In a preceding work [dL07], we have given a new proof of this result by using a game semantics modelof Church-style system F. In this more geometrical approach, types were interpreted by an arborescentstructure, hyperforests : the natural equality for this structure happened to be exactly the equality induced bytype isomorphisms. The e ffi ciency of game semantics in this context was an incitement to go further and toexplore the possibility of resolving this question for other languages. Curry-style system F.
In the present work, we deal with type isomorphisms for
Curry-style system F, i.e.system F where the terms grammar is simply the untyped λ -calculus’ one. Although this system appearsto be less relevant than Church-style system F in proof-theory (a term does not correspond exactly to oneproof), it is actually more accurate when we consider programming languages. Indeed, in Church-style1ystem F, a term t of type ∀ X . A will not have the type A [ B / X ]: only t { B } will be of this type; whereasin Curry-style, a term t of type ∀ X . A will have all the types A [ B / X ], which is more the idea induced bythe notion of polymorphism: the same function may be used with di ff erent types. The typing rules andequalities of this language are presented on figure 1. Grammars: A :: = X | A → A | ∀ X . A | A × A | ⊥ t :: = x | λ x . t | ( tt ) | h t , t i | π ( t ) | π ( t ) Typing rules: (ax) x : A , . . . , x n : A n ⊢ x i : A i Γ , x : A ⊢ t : B ( → I ) Γ ⊢ λ x . t : A → B Γ ⊢ t : A → B Γ ⊢ u : A ( → E ) Γ ⊢ ( tu ) : B Γ ⊢ t : A Γ ⊢ u : B ( × I ) Γ ⊢ h t , u i : A × B Γ ⊢ t : A × B ( × E Γ ⊢ π ( t ) : A Γ ⊢ t : A × B ( × E Γ ⊢ π ( t ) : B Γ ⊢ t : A ( ∀ I ) Γ ⊢ t : ∀ X . A if X < ΓΓ ⊢ t : ∀ X . A ( ∀ E ) Γ ⊢ t : A [ B / X ] Equalities: ( λ x . t ) u = t [ u / x ] ( β ) λ x . tx = t if x < t ( η ) π ( h u , v i ) = u ( π ) π ( h u , v i ) = v ( π ) h π ( u ) , π ( u ) i = u ( × ) Type isomorphism: ( t , u ) s.t. ⊢ t : A → B ⊢ u : B → A λ x . t ( ux ) = λ x . u ( tx ) = λ x . x Figure 1: Curry-style system F2ompared with this system, Church-style system F has a di ff erent grammar of terms: t :: = x | λ x A . t | ( tt ) | h t , t i | π ( t ) | π ( t ) | Λ X . t | t { A } di ff erent typing rules for the quantification: Γ ⊢ t : A ( ∀ I ) Γ ⊢ Λ X . t : ∀ X . A if X < Γ Γ ⊢ t : ∀ X . A ( ∀ E ) Γ ⊢ t { B } : A [ B / X ]and two additional equalities: ( Λ X . t ) { A } = t [ A / X ] ( β Λ X . t { X } = t if X < t ( η λ -term t is of type A if there exists a term ˜ t of Church-style systemF such that t is obtained from ˜ t by erasing all the type indications (for example, Λ X .λ x ∀ Y . Y λ y Y . x { Y } becomes λ x λ y . x ). In this case, we say that t is the erasure of ˜ t .The characterisation of type isomorphisms for Curry-style system F is not directly reducible to theChurch-style corresponding question: indeed, types of the form ∀ X . A and A with X < A are not equivalentin the Church-style setting, but they are in the Curry-style one (where the isomorphism is realised bythe identity). We prove in this paper that the distinction between Church-style and Curry-style typeisomorphisms can be resumed in one new and non-trivial equation. To express it, one first have to recallthe definition of positive and negative type variables in a formula : Definition 1
If A is a formula, its sets of positive variables
Pos A and negative variables Neg A are defined by: • Pos X = { X } , Neg X = ∅• Pos ⊥ = Neg ⊥ = ∅• Pos A × B = Pos A ∪ Pos B , Neg A × B = Neg A ∪ Neg B • Pos A → B = Neg A ∪ Pos B , Neg A → B = Pos A ∪ Neg B • Pos ∀ X . A = Pos A \ { X } , Neg ∀ X . A = Neg A \ { X } We also define FTV ( A ) = Pos A ∪ Neg A . The new equation is then the following: ∀ X . A ≃ ε A [ ∀ Y . Y / X ] if X < Neg A It is true in Curry-style but false (in general) in Church-style system F. Note that, although the isomorphismis realised by the identity, the Church-style terms t : ∀ X . A → A [ ∀ Y . Y / X ] and u : A [ ∀ Y . Y / X ] → ∀ X . A , fromwhich we extract the identity by erasing explicit types, are not trivial (they will be explicitly described inthe proof of theorem 2 at the end of the paper). This is a di ff erence with Church-style system F, where typeisomorphisms were exactly the expected ones, even if proving that point was not an elementary task.Type isomorphisms for Curry-style system F are finally characterised by the following equational system: A × B ≃ ε B × AA × ( B × C ) ≃ ε ( A × B ) × CA → ( B → C ) ≃ ε ( A × B ) → CA → ( B × C ) ≃ ε ( A → B ) × ( A → C ) ∀ X . ∀ Y . A ≃ ε ∀ Y . ∀ X . AA → ∀ X . B ≃ ε ∀ X . ( A → B ) if X < FTV ( A ) ∀ X . ( A × B ) ≃ ε ∀ X . A × ∀ X . B ∀ X . A ≃ ε A [ ∀ Y . Y / X ] if X < Neg A All along this article we will identify the notions of type and formula (according to the Curry-Howard correspondence).
The model.
Models of second order calculi do not come about easily due to impredicativity. Amongthe di ff erent possibilities, we choose models based on game semantics because of their high degree ofadequation with the syntax: indeed, game semantics has been widely used to construct fully completemodels for various calculi, such as PCF [AJM00, HO00], µ PCF [Lai97], Idealized Algol [AM99], etc. Thismeans that this semantics gives a very faithful description of the behaviour of the syntax modulo reductionrules in the system. And this is precisely what we need to deal semantically with type isomorphisms: amodel which is so precise that it contains no more isomorphisms than the syntax.The present paper introduces a game model for Curry-style system F. This model was largely inspiredby two preceding game semantics works: the PhD thesis of Juliusz Chroboczek [Chr03], which presentsamong others a game semantics for an untyped calculus that we will almost copy-paste in this paper; andthe game semantics model for generic polymorphism by Samson Abramsky and Radha Jagadeesan [AJ03],from which we will extract many ideas in our context. Other game semantics models had an influence onour work: Dominic Hughes gave the first game models of Church-style system F [Hug00] and introducedthe notion of hyperforests that we reuse here; Andrzej Murawski and Luke Ong presented a simple ande ffi cient model for dealing with a ffi ne polymorphism [MO01], and their presentation of moves inspiredours.It shall be noticed that the design of our Curry-style game model is actually very connected to theconcepts present in the syntax: the notion of erasure we introduce is of course reminiscent of the erasure oftypes in a Church-like term to obtain a Curry-like term. This is no surprise as we need a model describingvery precisely the syntax (that is why, in particular, one cannot be satisfied by an interpretation of thequantification as an intersection or a greatest lower bound). The specificities of (HON-)game semantics, asfor example the arborescent structure that interprets types, are however decisive for our demonstration. In this section we give general constructions that will apply on the di ff erent grammars we use in the model.These constructions are strongly related to usual HON-style games operations (cf. [HO00]). We consider the set of type variables X , Y , . . . to be in bijection with N \{ } , and we will further write thisset X = { X j | j > } .All along this article, we define several grammars of the form: µ :: = ↑ µ | ↓ µ | α i µ | j ( i ∈ I , j ∈ N )Let us note M the set of words (often called moves ) defined by this grammar.Intuitively, the token ↑ (resp. ↓ ) corresponds to the right side (resp. the left side) of an arrow type, the α i ’sare related to additional (covariant) connectors, the constants j ∈ N \{ } correspond to free type variables X j and the constant 0 corresponds either to bounded type variables or to ⊥ .On such a grammar, we define automatically a function λ of polarity , with values in { O , P } : • λ ( j ) = O • λ ( ↑ µ ) = λ ( α i µ ) = λ ( µ ) • λ ( ↓ µ ) = λ ( µ )where O = P and P = O .We also introduce an enabling relation ⊢ ⊆ M ∪ ( M × M ):4 ⊢ j • if ⊢ µ then ⊢ α i µ, and ⊢ ↑ µ • if ⊢ µ and ⊢ µ ′ then ↑ µ ⊢ ↓ µ ′ • if µ ⊢ µ ′ then α i µ ⊢ α i µ ′ , ↑ µ ⊢ ↑ µ ′ and ↓ µ ⊢ ↓ µ ′ .which induces a partial order ≤ for this grammar by reflexive and transitive closure. If ⊢ µ we say that µ isan initial move (in which case λ ( µ ) = O ). As we want to deal with polymorphism, we need some operations acting directly on the leafs j : • a function ♯ of leaf extracting : – ♯ ( j ) = j – ♯ ( ↑ µ ) = ♯ ( ↓ µ ) = ♯ ( α i µ ) = ♯ ( µ ) • an operation of substitution µ [ µ ′ ]: – j [ µ ′ ] = µ ′ – ↑ µ [ µ ′ ] = ↑ ( µ [ µ ′ ]), ↓ µ [ µ ′ ] = ↓ ( µ [ µ ′ ]) and α i µ [ µ ′ ] = α i ( µ [ µ ′ ])We say that µ is a prefix of µ if there exists µ ′ ∈ M such that µ = µ [ µ ′ ]. This is denoted µ ⊑ p µ . Definition 2 (justified sequence, play) A justified sequence on a given grammar is a sequence s = µ . . . µ n ofmoves, together with a partial function f : { , . . . , n } ⇀ { , . . . , n } such that: if f ( i ) is not defined then ⊢ µ i , and iff ( i ) = j then j < i and µ j ⊢ µ i : in this case we say that µ j justifies µ i .A play on a grammar is a justified sequence s = µ . . . µ n on this grammar such that: for every ≤ i ≤ n − , if λ ( µ i ) = P then λ ( µ i + ) = O and if λ ( µ i ) = O then λ ( µ i + ) = P and ♯ ( µ i ) = ♯ ( µ i + ) .We note E the set of plays of even length. If s and t are two plays, we note t (cid:22) s if t is a prefix of s. The definition of a play implies that if s µν is an even-length play then ♯ ( µ ) = ♯ ( ν ). This will be a verysignificant property in our model. Definition 3 (strategy) A strategy σ on a given grammar is a non-empty set of even-length plays, which is closedunder even-length prefix and deterministic: if s µ and s ν are two plays of σ then s µ = s ν . Definition 4 (view, innocence)
Let s be a play on a grammar, we define its view p s q by: • p ε q = ε • p s µ q = p s q µ if λ ( µ ) = P • p s µ q = µ if ⊢ µ • p s µ t ν q = p s q µν if λ ( ν ) = O and µ justifies ν A strategy σ is called innocent if, for every play s ν of σ , the justifier of ν is in p s q , and if we have: if s µν ∈ σ ,t ∈ σ , t µ is a play and p s µ q = p t µ q then t µν ∈ σ . Definition 5 (bi-view) A bi-view on a given grammar is a justified sequence s = µ . . . µ n (with n ≥ ) such thatany move is justified by its predecessor. The set of bi-views is denoted BV . .4 Composition Composition is usually defined between arenas of the form A → B and B → C . We are going to define it ina context where arenas do not explicitly exist, but are however represented by the tokens ↑ and ↓ . Definition 6 (shape)
Let ζ ∈ ( {↑ , ↓} ∪ { α i } i ∈ I ) ∗ , a move µ is said to be of shape ζ if ζ ⊑ p µ .Let Σ be a finite set of elements ζ j ∈ ( {↑ , ↓} ∪ { α i } i ∈ I ) ∗ . A justified sequence is said to be of shape Σ if each of itsmoves is of shape ζ j for some j. A strategy is of shape Σ if each of its plays is of shape Σ .In the case where Σ = {↑ , ↓} , we say that the justified sequence (or the strategy) is of arrow shape . Consider a justified sequence s = µ . . . µ n , we define the sequence s ↾ ζ as the restriction of s to the movesof shape ζ where the prefix ζ has been erased, and the pointers are given as follows: if µ i = ζµ ′ i is justifiedby µ j = ζµ ′ j in s , then the corresponding occurrence of µ ′ i is justified by µ ′ j Consider ζ, ξ ∈ ( {↑ , ↓} ∪ { α i } i ∈ I ) ∗ such that neither of the two is a prefix of the other. Let us define thesequence s ↾ ζ,ξ : first we consider s ′ , the restriction of s to the moves of shape ζ and the moves of shape ξ hereditarily justified by a move of shape ζ . s ↾ ζ,ξ is the sequence s ′ where the prefix ζ has been replaced by ↑ where it appears, the prefix ξ has been replaced by ↓ where it appears, and the pointers are given as follows:if µ i = ζµ ′ i (resp. µ i = ξµ ′ i ) is justified by µ j = ζµ ′ j (resp. µ j = ξµ ′ j ) in s , then the corresponding occurrence of ↑ µ ′ i (resp. ↓ µ ′ i ) is justified by ↑ µ ′ j (resp. ↓ µ ′ j ); and if µ i = ξµ ′ i is hereditarily justified by a move µ j = ζµ ′ j in s , then the corresponding occurrence of ↓ µ ′ i is justified by the corresponding occurrence of ↑ µ ′ j i ff ⊢ µ ′ i and ⊢ µ ′ j . Definition 7 (interacting sequence, composition) An interacting sequence s = µ . . . µ n is a justified sequenceof shape {↑ , ↓↑ , ↓↓} such that s ↾ ↑ , ↓↑ , s ↾ ↓↑ , ↓↓ and s ↾ ↑ , ↓↓ are plays. The set of interacting sequences is denoted Int .Suppose we have two strategies σ and τ . We call composition of σ and τ the set of plays σ ; τ = { u ↾ ↑ , ↓↓ | u ∈ Int , u ↾ ↑ , ↓↑ ∈ τ and u ↾ ↓↑ , ↓↓ ∈ σ } σ ; τ is a strategy: this can be proven like in the standard HON game model. Moreover if σ and τ areinnocent then σ ; τ is innocent. Definition 8 (totality on a shape)
Let σ be a strategy and ζ ∈ ( {↑ , ↓} ∪ { α i } i ∈ I ) ∗ . We say that σ is total on the shape ζ if, for every play s ∈ σ of shape ζ , for every move µ such that s µ is a play of shape ζ , there exists a move ν of shape ζ such that s µν ∈ σ . Our model is defined through three grammars: • X is the grammar of untyped moves which generate the untyped model to interpret untyped lambda-terms • A is the grammar of occurrences which are used for the interpretation of formulas • M is the grammar of typed moves which generate an interpretation of the terms of Church-stylesystem F.The interpretation of Curry-style system F in the model will be as follows: • a type A will be interpreted as a game (also denoted A ), i.e. a specific structure based on the grammar A a term t of type A will be interpreted as a strategy σ on the grammar X , with the condition that thisstrategy is the erasure of a strategy ˜ σ , defined on the grammar M and played on the game A (this willbe denoted ˜ σ :: A ) • two additional properties are required: hyperuniformity which applies on σ , and uniformity whichapplies on ˜ σ .In what follows, we first define the untyped model to interpret untyped lambda-terms, then we definegames and typed strategies on games, and finally we introduce the notion of erasure and prove that wehave a model of Curry-style system F. Next we prove, using this model, our result on type isomorphisms. In this section we give a semantics for the untyped λ -calculus with binary products, i.e. for the calculus offigure 1 restricted to the language of terms with their reduction rules.The untyped model that we present below has been defined by Julius Chroboczek in his PhD the-sis [Chr03]. Our definition is formally a little bit di ff erent from Chroboczek’s one, but the substance of thework is the same. The grammar of untyped moves is the following: x :: = ↑ x | ↓ x | rx | lx | j ( j ∈ N )The set of untyped moves is denoted X .The justified sequences, plays and strategies induced by this grammar will be called untyped justifiedsequences, plays and strategies. We define the following strategies: • identity : id = { s ∈ E | s of arrow shape and ∀ t ∈ E , t (cid:22) s ⇒ t ↾ ↑ = t ↾ ↓ }• projections : π r = { s ∈ E | s of shape {↑ , ↓ r , ↓ l } and ∀ t ∈ E , t (cid:22) s ⇒ t ↾ ↑ = t ↾ ↓ r } π l = { s ∈ E | s of shape {↑ , ↓ r , ↓ l } and ∀ t ∈ E , t (cid:22) s ⇒ t ↾ ↑ = t ↾ ↓ l }• evaluation : eval = { s ∈ E | s of shape {↑ , ↓ l ↑ , ↓ l ↓ , ↓ r } and ∀ t ∈ E , t (cid:22) s ⇒ t ↾ ↑ = t ↾ ↓ l ↑ ∧ t ↾ ↓ r = t ↾ ↓ l ↓ } We also define three basic operations on strategies: • pairing without context : if σ and τ are two strategies, h σ, τ i a = { s ∈ E | s of shape { r , l } and s ↾ l ∈ σ and s ↾ r ∈ τ }• pairing with context : if σ and τ are two strategies of arrow shape, h σ, τ i b = { s ∈ E | s of shape {↑ r , ↑ l , ↓} and s ↾ ↑ l , ↓ ∈ σ and s ↾ ↑ r , ↓ ∈ τ }• abstraction : if σ is a strategy of shape {↑ , ↓ r , ↓ l } , Λ ( σ ) is the strategy of shape {↑↑ , ↑↓ , ↓} which is deducedfrom σ by replacing each move ↑ x by ↑↑ x , each move ↓ rx by ↑↓ x and each move ↓ lx by ↓ x .7 .3 Hyperuniformity We have enough material to define an untyped model. However, our use of untyped strategies in theCurry-style model forces us to impose new requirements: for example, consider the formula X → X . Itwould be reasonable to think that the innocent strategy σ whose set of views is { ε, ↑ · ↓ } has this type.However, because we deal with a Curry-style model, any strategy of type X → X should also have thetype ∀ X . X → X , and thus A → A for any A , and should be able to do a copycat between the left and theright side of the arrow.This is the meaning of the notion of hyperuniformity defined below. Definition 9 (copycat extension of an untyped play)
Let s = x . . . x n be an untyped play, x i an O -move of sand v = y . . . y p ∈ BV . Suppose s = s x i x i + s . The copycat extension of s at position i with parameter v is theuntyped play s ′ = cc s ( i , v ) , defined by : • s ′ = s x i [ y ] x i + [ y ] s if p = • s ′ = s x i [ y ] x i + [ y ] x i + [ y ] x i [ y ] . . . x i + [ y p ] x i [ y p ] if p even • s ′ = s x i [ y ] x i + [ y ] x i + [ y ] x i [ y ] . . . x i [ y p ] x i + [ y p ] if p > and p odd Definition 10 (hyperuniform strategy)
An untyped strategy σ is called hyperuniform if it is innocent and if, forany play s ∈ σ , any copycat extension of s is in σ . Lemma 1
The identity strategy, the projections and the evaluation strategy are hyperuniform. If σ and τ arehyperuniform then h σ, τ i and Λ ( σ ) are hyperuniform. The preceding lemma is straightforward. The interesting case is composition:
Lemma 2 If σ and τ are hyperuniform then σ ; τ is hyperuniform. P roof : Let us consider a play s = x . . . x p ∈ σ ; τ , an O -move x i of s and a bi-view v = y . . . y q . We haveto prove that s ′ = cc s ( i , v ) belongs to σ ; τ .There exists a justified sequence u such that u ↾ ↑ , ↓↓ = s , u ↾ ↓↑ , ↓↓ ∈ σ and u ↾ ↑ , ↓↑ ∈ τ . If u = t x i b . . . b q x i + t ,we build a new justified sequence U depending on the value of p : • if p = U = t x i [ y ] b [ y ] . . . b q [ y ] x i + [ y ] t • if p even, U = t x i [ y ] b [ y ] . . . b q [ y ] x i + [ y ] x i + [ y ] b q [ y ] . . . b [ y ] x i [ y ] . . . . . . x i + [ y p ] b q [ y p ] . . . b [ y p ] x i [ y p ] • if p odd and p > U = t x i [ y ] b [ y ] . . . b q [ y ] x i + [ y ] x i + [ y ] b q [ y ] . . . b [ y ] x i [ y ] . . . . . . x i [ y p ] b [ y p ] . . . b q [ y p ] x i + [ y p ]We have U ↾ ↓↑ , ↓↓ ∈ σ and U ↾ ↑ , ↓↑ ∈ τ by hyperuniformity of σ and τ . So, U ↾ ↑ , ↓↓ = s ′ ∈ σ ; τ . (cid:3) λ -calculus with binary products We now present the interpretation of the untyped calculus. Instead of directly interpreting terms, weinterpret sequents of the form Γ ⊢ t , where t is a term and Γ is simply a list of variables that includes the freevariables occurring in t . 8he interpretation is as follows: ~ x ⊢ x (cid:127) = id ~ Γ , x ⊢ x (cid:127) = π r if Γ , ∅ ~ Γ , y ⊢ x (cid:127) = π l ; ~ Γ ⊢ x (cid:127)~ Γ ⊢ λ x . t (cid:127) = Λ ( ~ Γ , x ⊢ t (cid:127) ) ~ Γ ⊢ ( tu ) (cid:127) = h ~ Γ ⊢ t (cid:127) , ~ Γ ⊢ u (cid:127) i a ( Γ ) ; eval ~ Γ ⊢ h t , u i (cid:127) = h ~ Γ ⊢ t (cid:127) , ~ Γ ⊢ u (cid:127) i a ( Γ ) ~ Γ ⊢ π ( t ) (cid:127) = ~ Γ ⊢ t (cid:127) ; π l ~ Γ ⊢ π ( t ) (cid:127) = ~ Γ ⊢ t (cid:127) ; π r with a ( Γ ) = a if Γ = ∅ and a ( Γ ) = b otherwise.From lemmas 1 and 2 we derive: Lemma 3
Let t be a term whose free variables are contained in the list Γ , then ~ Γ ⊢ t (cid:127) is a hyperuniform strategy. Proposition 1
If two terms t and u are equal up to the equalities of the language, and if all their free variables arecontained in the list Γ , then ~ Γ ⊢ t (cid:127) = ~ Γ ⊢ u (cid:127) . See [Chr03] for the proof of the equivalent proposition in Chroboczek’s setting.
In this section we introduce the notion of game , the structure that will interpret Curry-style types. Thisstructure is very similar to the one presented in [AJ03].We define the following grammar of occurrences : a :: = ↑ a | ↓ a | ra | la | ⋆ a | j ( j ∈ N )The set of all occurrences is denoted A .We define a translation E from A to X : E ( a ) is obtained by erasing all the tokens ⋆ in a . Inductively: • E ( i ) = i • E ( ⋆ a ) = E ( a ) • E ( α a ) = α E ( a ) if α ∈ {↑ , ↓ , r , l } .The syntactic tree of a formula A is a tree with nodes labelled by type connectors ( → , × , ∀ ) or integers,edges labelled by the tokens ↑ , ↓ , r , l , ⋆ , and possibly some arrows linking a leaf to a node. It is defined asfollows: • T ⊥ is reduced to a leaf 0 • T X i is reduced to a leaf i The denomination arena would also fit, but we wanted to stress the fact that our games are not trees like HON-arenas, but justpartial orders. T A → B consists in a root → with the two trees T A and T B as sons; the edge between → and T A (resp. T B )is labelled ↓ (resp. ↑ ) • T A × B consists in a root × with the two trees T A and T B as sons; the edge between × and T A (resp. T B )is labelled l (resp. r ) • T ∀ X i . A consists in a root ∀ with the tree T as unique son, where T is deduced from T A by linking each ofits leafs labelled by i to its root, and relabelling these leafs by 0; the edge between ∀ and T is labelled ⋆ .A maximal branch in a syntactic tree is a path from the root to a leaf; it will be described by the sequenceof labels of its edges, with the index of the leaf at the end of the sequence. Such a maximal branch is thenan occurrence.The set O A of occurrences of a formula A is the set of maximal branches of T A . We define a function of linkage L A : O A → A ∪ {†} as follows: if the leaf reached by the maximal branch a is linked to a node c , then L A ( a ) is the sequence of labels of the edges we cross to reach c starting from the root, with a 0 at the end;otherwise, L A ( a ) = † .The structure ( O A , L A ) will be called a game . It will also be denoted A , with no risk of confusion. Example:
The type A = ∀ X . ( X → (( ∀ X . X ) → ( X × ⊥ ))) has as set of occurrences: O A = { ⋆ ↓ , ⋆ ↑↓ ⋆ , ⋆ ↑↑ l , ⋆ ↑↑ r } And its function of linkage is given by: L A ( ⋆ ↓ = ⋆ L A ( ⋆ ↑↓ ⋆ = ⋆ ↑↓ ⋆ L A ( ⋆ ↑↑ l = †L A ( ⋆ ↑↑ r = † Definition 11 (game) A game A is defined by a finite non-empty set O A ⊆ A and a function of linkage L A : O A → A ∪ {†} satisfying the following conditions: • O A is coherent : for every a ∈ O A , either ⊢ a or ∃ a ′ ∈ O A , a ′ ⊢ a • O A is non-ambiguous : ∀ a , a ′ ∈ O A , if E ( a ) ⊑ p E ( a ′ ) then a = a ′ • for every a ∈ O A , either L A ( a ) = † or L A ( a ) = a ′ [ ⋆ ⊑ p a for some a ′ ∈ A • for every a ∈ O A , if ♯ ( a ) , then L A ( a ) = † The set of games is denoted G . We stress the fact that the set O A shall not be empty: this will be a crucial point in our proofs. Definition 12 (auxiliary polarity)
Given a game A, we define its auxiliary polarity as a partial function paux A : O A ⇀ { O , P } by: paux A ( c ) = λ ( L A ( c )) if L A ( c ) , † , otherwise it is undefined. .2 Alternative, inductive interpretation of a formula We define the following constructions on games: (atoms) ⊥ = ( { } ,
7→ † ) X i = ( { i } , i
7→ † ) for i > (product) if A , B ∈ G , we define A × B by: • O A × B = { la | a ∈ O A } ∪ { rb | b ∈ O B }• L A × B ( la ) = † if L A ( a ) = † l L A ( a ) otherwise L A × B ( rb ) = † if L B ( b ) = † r L B ( b ) otherwise (arrow) if A , B ∈ G , we define A → B by: • O A → B = {↓ a | a ∈ O A } ∪ {↑ b | b ∈ O B }• L A → B ( ↓ a ) = † if L A ( a ) = †↓L A ( a ) otherwise L A → B ( ↑ b ) = † if L B ( b ) = †↑L B ( b ) otherwise (quantification) if A ∈ G and i >
0, we define ∀ X i . A by: • O ∀ X i . A = { ⋆ a | a ∈ O A ∧ ♯ ( a ) , i } ∪ { ⋆ a [0] | a ∈ O A ∧ ♯ ( a ) = i }• L ∀ X i . A ( ⋆ a ) = † if L A ( a ) = † ⋆ L A ( a ) otherwise L ∀ X i . A ( ⋆ a [0]) = ⋆ Definition 13 (substitution)
Let A , B ∈ G . The substitution of X i by B in A is the game A [ B / X i ] defined by: • O A [ B / X ] = { a ∈ O A | ♯ ( a ) , i } ∪ { a [ b ] | a ∈ O A ∧ ♯ ( a ) = i ∧ b ∈ O B }• L A [ B / X ] ( a ) = L A ( a ) and L A [ B / X ] ( a [ b ]) = † if L B ( b ) = † a [ L B ( b )] otherwise One can check that this coincides with the operation of substitution on formulas.
We are now going to describe how we can play in a game. We will take advantage of the way we havedefined games: whereas in many second order game models like [Hug00] or [dL07] moves have a complexstructure, here they will be easy to derive from O A and L A .As in [AJ03], the intuition is that a move in A can either be built directly from an occurrence of O A , orit can be decomposed as m [ m ], where m is built from an occurrence of O A and m is a move in anothergame B which substitutes a quantifier.Note that the moves and strategies defined this way do not constitute the morphisms of our model, butthey will be used as interpretations of Church-style terms.We introduce the grammar of typed moves : m :: = ↑ m | ↓ m | rm | lm | ⋆ B m | j ( B ∈ G , j ∈ N )These moves form the set M .The operation of anonymity A : M → A erases the game indication in a typed move:11 A ( i ) = i for i ≥ • A ( ⋆ A m ) = ⋆ A ( m ) • A ( α m ) = α A ( m ) for α ∈ { r , l , ↑ , ↓} .For m ∈ M and a ∈ A , we define a partial operation of formula extraction ma by: • ⋆ B m ⋆ = B • if ma is defined, ⋆ B m ⋆ a = α m α a = ma where α ∈ {↑ , ↓ , r , l } Definition 14 (moves of a game)
Let A be a game. Its set of moves M A ⊆ M is given by defining the relationm ∈ M A by induction on m: • if A ( m ) = a ∈ O A and L A ( a ) = † then m ∈ M A • if m = m [ m ] , where A ( m ) = a ∈ O A , L A ( a ) , † and m ∈ M B with B = m L A ( a ) , then m ∈ M A . This definition is well-defined, because in the second case we necessarily have at least one token ⋆ B in m , so the size of m is strictly smaller than the size of m [ m ]: that is why we say that the definition isinductive. Example:
Let us recall the type A = ∀ X . ( X → (( ∀ X . X ) → ( X × ⊥ ))) of the preceding example. Onepossible way to “play a move” in this game is to instantiate the variable X with a type B (take B = ⊥ × X for example), then to go on the left side of the first arrow and to play a move of B .This corresponds to a move like m = ⋆ B ↓ r
3. One can check with the definition that this move indeedbelongs to M A : m = m [ m ] with m = ⋆ B ↓ m = r A ( m ) = ⋆ ↓ ∈ O A , L A ( ⋆ ↓ = ⋆ ⋆ B ↓ ⋆ = B .Moreover, A ( m ) = r ∈ O B and L B ( m ) = † so m ∈ M B (first case of the definition). So, m ∈ M B (secondcase of the definition).Intuitively, we have the following: • m is the part of the move played in A , and c = A ( m ) is the corresponding occurrence • L a ( c ) indicates where the interesting quantifier has been instantiated • m L A ( c ) = B indicates by which game it has been instantiated • m is the part of the move played in B . Definition 15 (justified sequence, play on a game)
Let A be a game and s be a play (resp. a justified sequence)on the grammar M . If every move of s belongs to M A , then we say that s is a play (resp. a justified sequence) on thegame A. The set of plays on the game A is denoted P A . This notion is related to the idea of evolving game introduced in [MO01] and reused in [dL07]. xample: Let us consider the play s = ⋆ B ↑↑ l · ⋆ B ↓ r B = ⊥ × X . This is of course a play inA = ∀ X . ( X → ( ∀ X . X ) → ( X × ⊥ )).What is interesting to notice is that, if for example C = X × ⊥ , then the sequence s ′ = ⋆ C ↑↑ l · ⋆ B ↓ r B = C if we want m = ⋆ B ↓ r m = ⋆ C ↑↑ l m in a play s which contains the token ⋆ B , there is a sequence of moves m , . . . , m n that also contains the token ⋆ B at the same place, with m n = m and m i justifies m i + for 1 ≤ i < n .If this sequence is chosen to be of maximal length, then m is the minimal hereditarily justifier of m whichcontains the token ⋆ B : it is the first time that it appears (at the right place). We will say that B is played by λ ( m ) at the level of m . Note that λ ( m ) = paux A ( m ).One can formalise this definition: Definition 16 (level)
If a move m in a play s ∈ P A contains the token ⋆ B , then it can be written m = m ⋆ B [ m ] .We say that B is played (by λ ( m ) ) at the level of m if m does not contain the token ↓ . Typed strategies are defined as expected:
Definition 17 (strategy on a game)
Let σ be a strategy on the grammar M , we say that σ is a strategy on A andwe note σ :: A if any play of σ belongs to P A . We say that σ is a typed strategy in this case. Strategies on games have to be understood as interpretations of Church-style system F terms; theywill be used in the Curry-style model because we have to express in the model the fact that a well-typedCurry-style term is the erasure of a well-typed Church-style term. In [dL07], we saw that strategies defined as generally as possible were not able to capture exactly the typeisomorphisms of the syntax, because they were generating too many isomorphisms in the model. Thatis why we introduced a notion of uniformity , which restrained the behaviour of strategies (in order toavoid confusion, we will call weak uniformity the notion of uniformity defined in [dL07]; by the way, weakuniformity plays no role in the present model).The situation is similar here: we are not able to derive the characterisation of Curry-style type isomor-phisms if the well-typed Church-style terms are interpreted by the (typed) strategies defined above. So weintroduce a notion of uniformity on these strategies.The intuition of this notion is the following: consider an η -long, β -normal term t of the Church-stylesystem F, and suppose ⊢ t : ∀ X . A . The term t has the form t = Λ X . t ′ with ⊢ t ′ : A : so it behaves like if it wasinstantiating the quantifier ( ∀ X ) with a variable ( X ). More generally, the terms of the Church-style systemF should be interpreted by strategies where, each time O has to play a game, he gives a variable game X i .But these strategies (that we will call symbolic ) do not compose: in the Church-style syntax, thiscorresponds to the fact that the term ⊢ t : ∀ X . A can be instantiated at any type B through the operation t t { B } , and so the term t can be extended to any type A [ B / X ]. In the model, this means that the symbolicstrategy interpreting t must be extensible to a more complete strategy, where O can play any game he wants.This extension consists in playing copycat plays between the di ff erent occurrences of the variables X (likein the syntax, the η -long β -normal form of t { B } is generated from t through η -expansions), that is why it iscalled the copycat extension .To sum up, a uniform strategy will be a symbolic strategy extended by copycat extension. This ideahas to be related with the strategies of Dominic Hughes [Hug00] and, above all, with Murawski’s notion of good strategies [MO01]. The notion of weak uniformity discussed above is an analogous, but less restrictive,condition: uniformity implies weak uniformity. Finally, uniformity has of course a strong connection We chose not to explicit this interpretation because we do not need it; one could also prove that we have a model of Church-stylesystem F, but it is not an important question here. BV ( A ) stands for the set of bi-views in a game A , and m [ B / j ] (resp. s [ B / j ])is obtained from the move m (resp. the play s ) by replacing each token of the form ⋆ A by ⋆ A [ B / X j ] . Note that s [ B / j ] is a play, but does not necessarily belong to any M A for some A : actually, this play will only be usedas an intermediate construction. Definition 18 (copycat extension of a typed play)
Let s = m . . . m n be a typed play on the game A, let B ∈ G and j > .We first define the flat extension of s: given a sequence of initial moves r = ( r i ) i ∈ N in M B , Fl sj , B ( r ) is the play t [ B / j ] where t is obtained from s by replacing each sequence m i m i + such that ♯ ( m i ) = j and λ ( m i ) = O by m i [ r i ] m i + [ r i ] .Let m i be an O -move of s such that ♯ ( m i ) = j, suppose Fl sj , B ( r ) = s m ′ i [ r i ] m ′ i + [ r i ] s with m ′ i = m i [ B / j ] andm ′ i + = m i + [ B / j ] , and let v = n . . . n p ∈ BV ( B ) . The B -copycat extension of s at position i along the index j (withparameters v , r) is the play s ′ = CC sj , B ( i , v , r ) defined by: • s ′ = s m ′ i [ n ] m ′ i + [ n ] s if p = • s ′ = s m ′ i [ n ] m ′ i + [ n ] m ′ i + [ n ] m ′ i [ n ] . . . m ′ i + [ n p ] m ′ i [ n p ] if p even • s ′ = s m ′ i [ n ] m ′ i + [ n ] m ′ i + [ n ] m ′ i [ n ] . . . m ′ i [ n p ] m ′ i + [ n p ] if p > and p odd Definition 19 (symbolic strategy)
A play s on the game A is said to be symbolic if, whenever a game is played by O it is a variable game X i < FTV ( A ) . These variable games are called the copycat variables of the play.A symbolic strategy is a strategy which contains only symbolic plays. Definition 20 (copycat extension of an innocent symbolic strategy)
The copycat extension of an innocent sym-bolic strategy ¯ σ : A is the smallest innocent strategy which contains ¯ σ and is stable under any copycat extension alonga copycat variable. Definition 21 (uniform strategy)
Let σ be a strategy on the game A. σ is said to be uniform if there exists a symbolicinnocent strategy ¯ σ on A such that σ is the copycat extension of ¯ σ . Proposition 2 If σ :: A → B and τ :: B → C are two uniform strategies then σ ; τ :: A → C is uniform.
The proof of this proposition can be found in appendix A.
We are now ready to define our model: the key ingredient will be to relate untyped strategies with typedstrategies through a notion of realization . First we relate untyped moves with typed moves through anoperation of erasure erase : M → X defined by: erase = E ◦ A
Definition 22 (realization)
Let σ be an untyped strategy and ˜ σ a typed strategy on A. We say that ˜ σ is a realization of σ on A if we have: for every sxy ∈ σ and s ′ ∈ ˜ σ , if s ′ m ′ ∈ P A is such that erase ( s ′ m ′ ) = sx then there exists n ′ suchthat s ′ m ′ n ′ ∈ ˜ σ and erase ( s ′ m ′ n ′ ) = sxy. At present we have all the ingredients to define the model: • objects are games • a morphism between A and B is an untyped strategy σ such that:14 σ is hyperuniform – there exists a typed strategy ˜ σ which is a realization of σ on A → B – ˜ σ is uniform.In this case we note σ : A → B .Let us prove that we have a model of Curry-style system F indeed. Lemma 4 If σ : A → B and τ : B → C then σ ; τ : A → C. P roof : If we note ˜ σ and ˜ τ two realizations of σ and τ respectively, we obtain a realization of σ ; τ on A → C by taking the composite ˜ σ ; ˜ τ in the grammar M . Indeed, suppose sxy ∈ σ ; τ , s ′ ∈ ˜ σ ; ˜ τ with erase ( s ′ ) = s and s ′ m ′ ∈ P A → C with erase ( s ′ m ′ ) = sx . There exist an untyped justified sequence u such that u ↾ ↓↑ , ↓↓ = s ∈ σ , u ↾ ↑ , ↓↑ = s ∈ τ and u ↾ ↑ , ↓↓ = sxy , and a typed justified sequence t such that t ↾ ↓↑ , ↓↓ = t ∈ ˜ σ , t ↾ ↑ , ↓↑ = t ∈ ˜ τ and t ↾ ↑ , ↓↓ = s ′ .We note u = u xb . . . b q y , with b , . . . b q of shape ↓↑ . Suppose for example that m ′ is of shape ↓ . Thenthere exists n ′ such that t m ′ n ′ ∈ ˜ σ and erase ( t m ′ n ′ ) = s xb ; we set T = tm ′ n ′ . Then there exists n ′ suchthat t n ′ n ′ ∈ ˜ τ and erase ( t n ′ n ′ ) = s b b ; we set T = tm ′ n ′ n ′ , etc. So, we construct step by step a justifiedsequence T such that T ↾ ↓↑ , ↓↓ ∈ ˜ σ , T ↾ ↑ , ↓↑ ∈ ˜ τ and erase ( T ) = u . This gives us also that T ↾ ↑ , ↓↓ = s ′ m ′ n ′ is a play,so it belongs to ˜ σ ; ˜ τ and erase ( s ′ m ′ n ′ ) = sxy .Finally: ˜ σ and ˜ τ are innocent and uniform, so ˜ σ ; ˜ τ is innocent and uniform by prop. 2; σ and τ arehyperuniform so σ ; τ is hyperuniform by lemma 2. (cid:3) Lemma 5 If σ : Γ → A and X j < Γ then σ : Γ → ∀ X j . A P roof : Let us consider ˜ σ :: Γ → A a realization of σ on Γ → A : if ˜ σ is the copycat extension of a symbolicstrategy ¯ σ , then we define the strategy ¯ σ ′ as the strategy ¯ σ where each move written ↑ m in a play has beenreplaced by ↑ ⋆ X j m . This strategy is symbolic on Γ → ∀ X j . A , and its copycat extension ˜ σ ′ is a realizationof σ because of hyperuniformity (indeed, the only di ff erence between ˜ σ and ˜ σ ′ is a copycat extension along X j ). (cid:3) Lemma 6 If σ : Γ → ∀ X j . A and B is a game then σ : Γ → A [ B / X j ] . P roof : If ˜ σ is a realization of σ on Γ → ∀ X j . A , a realization ˜ σ ′ on Γ → A [ B / X j ] is obtained by taking onlyplays where each initial move takes the form ↑ ⋆ B m , and by replacing each move ↑ ⋆ B m by ↑ m .Let us now prove the uniformity of ˜ σ ′ : if ˜ σ is the copycat extension of a symbolic strategy ¯ σ , we considera view s of ¯ σ . Let X j be the first copycat variable appearing in s , we choose a variable X k < FTV ( A ) ∪ FTV ( B )and we call s k the (unique) X k -copycat extension of s along j . Let us define E ( s ) as the smallest set of playscontaining s k and stable by B -copycat extensions along k . The strategy ¯ σ ′ will be the smallest innocentstrategy containing all the sets E ( s ), for s describing all the views of ¯ σ . Then one can check that ˜ σ ′ is thecopycat extension of ¯ σ ′ . (cid:3) Lemma 7
The following holds: • id : A → A • π r : Γ × A → A • If σ : Γ → A and τ : Γ → B then h σ, τ i : Γ → ( A × B ) . • eval : ( A → B ) × A → B More precisely n ′ = ↑ n ′′ should be renamed as ↓ n ′′ . If σ : Γ × A → B then Λ ( σ ) : Γ → ( A → B ) . These cases are trivial: for example, a realization of id on A → A is ρ = { s ∈ P A → A | s of arrow shape and ∀ t ∈ E , t (cid:22) s ⇒ t ↾ ↑ = t ↾ ↓ } and it is uniform, with symbolic strategy ¯ ρ defined by:¯ ρ = { s ∈ P A → A | s of arrow shape, s symbolic and ∀ t ∈ E , t (cid:22) s ⇒ t ↾ ↑ = t ↾ ↓ } If Γ is a typing context of the form Γ = x : A , x : A , . . . , x n : A n , we define the sequence of variables Γ = x , x , . . . , x n and the type | Γ | = A × A × · · · × A n , and we have: Proposition 3 If Γ ⊢ t : A then ~ Γ ⊢ t (cid:127) : | Γ | → A. This, together with prop. 1, means that we have obtained a model of Curry-style system F.
In this section we introduce the notion of hyperforest , an arborescent structure built from games. In [dL07],following [Hug00], we interpreted second-order types directly as hyperforests (that we called polymorphicarenas). But the substitution was di ffi cult to define in this context, and moves had a complicated formulation;that is why in this paper we introduce hyperforests only as an indirect interpretation of types.Hyperforests will be the fundamental structure for our work on isomorphisms. In what follows, the set of subsets of a set E will be denoted P ( E ). Definition 23 (forest) A forest is an ordered set ( E , ≤ ) such that, for every y in E, { x | x ≤ y } is finite and totallyordered by ≤ . The forest is finite if E is finite. Definition 24 (hyperforest) An hyperforest H = ( F , R , D ) is a finite forest F together with a set of hyperedges R ⊆ F × P ( F ) and a partial function of decoration D : F ⇀ X , where: • for every ( t , S ) ∈ R , if s ∈ S then t ≤ s and D ( s ) is undefined • for every b = ( t , S ) and b ′ = ( t ′ , S ′ ) in R , S ∩ S ′ , ∅ ⇒ b = b ′ We note T H = { t ∈ F | ∃ S ⊆ F , ( t , S ) ∈ R} and S H = { s ∈ F | ∃ ( t , S ) ∈ R , s ∈ S } . Definition 25 (reference, friends)
Let H = ( F , R , D ) be an hyperforest. For any s ∈ F , if s ∈ S H then there exists ( t , S ) ∈ R with s ∈ S: the reference of s is defined as ref H ( s ) = t and the set of friends of s is fr H ( s ) = S \{ s } . If s < S H ,ref H and fr H are not defined in s. We are now going to exhibit the hyperforest structure associated with a game A . Let ( E , ≤ ) be a partially ordered set. The relation ⊢⊆ E ∪ ( E × E ) is given by: ⊢ e i ff e ′ ≤ e ⇒ ( e ′ = e ) e ⊢ e ′ i ff e ≤ e ′ ∧ ∀ f , e ≤ f ≤ e ′ ⇒ ( e = f ∨ e ′ = f )One defines the set F of paths in ( E , ≤ ), i.e. the set of sequences e e . . . e n of elements of E such that ⊢ e and e i ⊢ e i + for 1 ≤ i ≤ n −
1. If we consider the prefix ordering ≤ ′ on F , then ( F , ≤ ′ ) is a forest.We also define the operation or : F → E by or ( f ) = e n if f = e . . . e n ( or ( f ) is called the origin of f ).16 .3 From games to hyperforests If A is a game, O A is a finite partially ordered set, to which one can associate a forest F A through the precedingconstruction. Extending ⊢ to F A generates the enabling relation of the forest: this justifies a posteriori thedefinition of an enabling relation for arbitrary moves given in section 2.Furthermore, one deduces from L A the relation R A ⊆ F A × P ( F A ) as follows: let L = { a [ ⋆ ∈ A | ∃ a ′ ∈O A , a [ ⋆ ⊑ p a ′ } . Then : ( t , S ) ∈ R A i ff there exists y ∈ L such that, for every s ∈ S : • L A ( or ( s )) = y • t ≤ s • y ⊑ p or ( t ) • for every t ′ ≤ t , y ⊑ p or ( t ′ ) implies t ′ = t .One also defines the partial function D A : F A ⇀ X by: D A ( x ) = X i i ff ♯ ( or ( x )) = i ( i > Lemma 8
If A is a game, then H A = ( F A , R A , D A ) is an hyperforest. Example:
Consider the type A = ∀ X . (( X × X ) → ( X × ⊥ )). We have: O A = { ⋆ ↓ l , ⋆ ↓ r , ⋆ ↑ l , ⋆ ↑ r } and: L A ( ⋆ ↓ l = ⋆ L A ( ⋆ ↓ r = †L A ( ⋆ ↑ l = ⋆ L A ( ⋆ ↑ r = † The paths are: a = ⋆ ↑ l b = ⋆ ↑ l · ⋆ ↓ l c = ⋆ ↑ l · ⋆ ↓ r d = ⋆ ↑ r e = ⋆ ↑ r · ⋆ ↓ l f = ⋆ ↑ r · ⋆ ↓ r L = { ⋆ } .Hence the hyperforest H A is given by: F A = { a , b , c , d , e , f }R A = { ( a , { a , b } ) , ( d , { e } ) }D A ( c ) = D A ( f ) = X This can be resume in the following representation of H A : ab c e fd X X One can extend the definition of polarity to the nodes of the hyperforest: if A is a game with associatedhyperforest H A = ( F A , R A , D A ), then for a ∈ F A we define λ ( a ) = λ ( or ( a )). This coincides with an alternativedefinition of polarity, which is common in arena games: λ ( a ) = O (resp. λ ( a ) = P ) if the set { a ′ ∈ F A | a ′ ≤ a } has an odd cardinality (resp. an even cardinality). Note also that paux A ( or ( a )) = λ ( ref A ( a )).17inally, if A is a game, we note: fr A = fr H A ref A = ref H A S A = S H A T A = T H A Note that the nodes of the forest F A contain “more information” than the occurrences of O A . Indeed,given a node c ∈ F A , one is able to give the ordered list of its ancestors, whereas for an occurrence we mayhave many ancestors that are not compatible one with the order for the ordering. This idea will be used inthe proof of theorem 1 to reason about plays with nodes instead of occurrences. Definition 26 (Church-isomorphism)
Let H = ( F , R , D ) and H = ( F , R , D ) be two hyperforests. We saythat H and H are Church-isomorphic (H ≃ Ch H ) if there exists a bijection f : F → F which preserves thehyperforest structure, i.e. such that: • a ≤ a ′ i ff f ( a ) ≤ f ( a ′ ) • R = f ( R ) • D ◦ f = D Definition 27 (Curry-isomorphism)
Let H = ( F , R , D ) and H = ( F , R , D ) be two hyperforests. We saythat H and H are Curry-isomorphic (H ≃ Cu H ) if there exists a bijection f : F → F such that: • a ≤ a ′ i ff f ( a ) ≤ f ( a ′ ) • S H = f ( S H ) • for every ( t , S ) ∈ R (resp. ( t , S ) ∈ R ), if there exists s ∈ S such that λ ( s ) , λ ( t ) , then ( f ( t ) , f ( S )) ∈ R (resp. ( f − ( t ) , f − ( S )) ∈ R ) • D ◦ f = D . Definition 28 (game isomorphism) A game isomorphism between two games A and B is a couple of untypedstrategies σ : A → B and τ : B → A such that σ ; τ = τ ; σ = id. We note A ≃ g B if there is a game isomorphismbetween A and B.
We are now able to formulate the key theorem of our paper. This theorem provides a geometricalcharacterisation of isomorphisms in the model, which is the core of the proof of equational characterisationfor the syntax.
Theorem 1
Let A , B ∈ G . If there exists a game isomorphism ( σ, τ ) between A and B ( A ≃ g B) then their hyperforestsare Curry-isomorphic (H A ≃ Cu H B ). The proof of this theorem can be found in appendix B.18 .2 Characterisation of Curry-style type isomorphisms
Proving theorem 1 was the main step towards the characterisation of Curry-style isomorphisms: we arenow able to establish our final result.Let us recall the equational system ≃ ε which we claim to characterise Curry-style type isomorphisms: A × B ≃ ε B × AA × ( B × C ) ≃ ε ( A × B ) × CA → ( B → C ) ≃ ε ( A × B ) → CA → ( B × C ) ≃ ε ( A → B ) × ( A → C ) ∀ X . ∀ Y . A ≃ ε ∀ Y . ∀ X . AA → ∀ X . B ≃ ε ∀ X . ( A → B ) if X < FTV ( A ) ∀ X . ( A × B ) ≃ ε ∀ X . A × ∀ X . B ∀ X . A ≃ ε A [ ∀ Y . Y / X ] if X < Neg A Lemma 9
Let A and B be two types such that the hyperforests H A and H B are Curry-isomorphic. Then A and B areequal up to the equational system ≃ ε . P roof : Let A ′ and B ′ be the normal forms of A and B for the following rewriting system: ∀ X . C ⇒ C [ ∀ Y . Y / X ] if X < Neg C and C , X If D = ∀ X . C and D = C [ ∀ Y . Y / X ] with X < Neg C , then H D ≃ Cu H D : indeed, the bijection f : F D → F D which preserves the ordering and such that S D = f ( S D ) and D D ◦ f = D is easy to define (in fact O D and O D are already in bijection). The fact that X < Neg C precisely implies that, for any ( t , S ) ∈ R D correspondingto the quantification ∀ X (i.e. such that L ∀ X . A ( or ( s )) = ⋆ s ∈ S ), there is no s ∈ S such that λ ( s ) , λ ( t ).Reciprocally, if for any ( t , S ) ∈ R D corresponding to a quantification ∀ Y . Y , S = { t } so there is no s ∈ S suchthat λ ( s ) , λ ( t ). Any other hyperedge is preserved by f .Moreover, being Curry-isomorphic is a congruence (i.e. it is preserved by context), so H A ≃ Cu H A ′ , H B ≃ Cu H B ′ , and hence H A ′ ≃ Cu H B ′ . H A ′ and H B ′ are such that for every ( t , S ) ∈ R A ′ (or ( t , S ) ∈ R B ′ ), either S = { t } or S contains a node s with λ ( t ) , λ ( s ). Because of the definitions of ≃ Cu and ≃ Ch , this implies H A ′ ≃ Ch H B ′ .It has already been proved in [dL07] that in this case A ′ ≃ ′ ε B ′ , where ≃ ′ ε is the same equational systemas ≃ ε , except that it does not make use of the last equation. Hence, we have A ≃ ε B . (cid:3) Theorem 2
Two types A and B are isomorphic in Curry-style system F if and only if A ≃ ε B. P roof : The implication comes from the fact that we have a model (so, each type isomorphism inCurry-style system F implies a game isomorphism) and from theorem 1 and lemma 9.For the reciprocal, we already know from [DC95] the existence in the Church-style system F of theisomorphisms corresponding to each equation of ≃ ε , except the last one ( ∀ X . A ≃ ε A [ ∀ Y . Y / X ] if X < Neg A ).This implies their existence in the Curry-style system F.Hence, we need, given a type A such that X < Neg A , to find two Curry-style terms t : ∀ X . A → A [ ∀ Y . Y / X ]and u : A [ ∀ Y . Y / X ] → ∀ X . A which compose in both ways to give the identity. We suppose Y does not appearat all in A , even as a bounded variable.We take t = λ x . x : indeed, the identity can be shown to be of type ∀ X . A → A [ ∀ Y . Y / X ] through thefollowing type derivation: x : ∀ X . A ⊢ x : ∀ X . Ax : ∀ X . A ⊢ x : A [ ∀ Y . Y / X ] ⊢ λ x . x : ∀ X . A → A [ ∀ Y . Y / X ] In [dL07] the interpretation of types was directly hyperforests. is easy to build: consider the Church-style term M = λ x ∀ X . A . ( x ) {∀ Y . Y } . We have ⊢ M : ∀ X . A → A [ ∀ Y . Y / X ]in Church-style system F, and t is the λ -term obtained by erasing each type indication in M . Then wenecessarily have ⊢ t : ∀ X . A → A [ ∀ Y . Y / X ], and besides t = λ x . x .To define u , let us consider the Church-style term P which is the η -long normal form of the identity on A [ ∀ Y . Y / X ]. This term takes the form P = λ x A [ ∀ Y . Y / X ] . P ′ . Now consider the Church-style term Q obtainedfrom P ′ by replacing each occurrence of y { Z } , where Z is some type variable and y has the type ∀ Y . Y coming from the substitution of X , by y { X } . For example, if A = X → ⊥ → ⊥ , this would give us Q = ( x ) λ y ( ∀ Y . Y ) →⊥ . ( y ) λ z ∀ Y . Y . ( z ) { X } Then we introduce the Church-style term N = λ x A [ ∀ Y . Y / X ] . Λ X . Q , and we can check that ⊢ N : A [ ∀ Y . Y / X ] →∀ X . A in Church-style system F. u is now defined to be the erasure of N . Then we necessarily have ⊢ u : A [ ∀ Y . Y / X ] → ∀ X . A , and besides u = λ x . x (modulo η -reductions) because we only modified the typeindications when going from P to N .Finally, t and u trivially compose to give the identity in both directions. (cid:3) Conclusion
We have proved that type isomorphisms in Curry-style system F can be characterised by adding to theequational system of Church-style system F isomorphisms a new, non-trivial equation: ∀ X . A ≃ ε A [ ∀ Y . Y / X ]if X < Neg A . Otherwise said, this equation characterises all the new type equivalences one can generate byerasing type indications in Church-style terms.We used a game semantics model in order to take advantage of its dynamical and geometrical properties.The main features of the model were however often inspired by a precise analysis of the syntax: indeed, aninterpretation of the quantifier as an intersection (or a lower bound like in [Chr03]) was not precise enoughto be able to characterise type isomorphisms.One can notice that our type system does not contain the type ⊤ ; correspondingly, our model has noempty game. This is because the rule generally associated to ⊤ takes the form: t = ⋆ if Γ ⊢ t : ⊤ . This rule isof course di ffi cult to insert in a Curry-style setting, where terms are not typed a priori, and we have no cluewhether such a rule can be adapted to this context. Anyway, the introduction of an empty game in the modelwould break the proof and, more interestingly, give raise to new isomorphisms like ∀ X . ( X → ⊥ ) ≃ g ⊥ . Thecharacterisation of isomorphisms in this model, and the possible connection with an actual syntax, have tobe explored.But the main trail of future exploration concerns parametric polymorphism. The notion of relationalparametricity, introduced by Reynolds [Rey83], comes historically from the idea that a second-order functionshall not depend on the type at which it is instantiated. This has led first to a semantic definition ofparametricity, then to a syntactic formalisation of this notion, first by Abadi-Cardelli-Curien [ACC93] andthen by Plotkin-Abadi [PA93]. Dunphy [Dun02] recently gave a categorical characterisation of parametricpolymorphism.The great advantage of parametric models is that second-order enjoys nice and natural properties inthese models. For example: • ∀ X . X → X is a terminal object • ∀ X . ( A → B → X ) → X is a product of A and B • ∀ X . X is an initial object • ∀ X . ( A → X ) → ( B → X ) → X is a coproduct of A and B .All these properties are of course wrong in the model described in the present paper.Trying to build a parametric game model is a highly appealing challenge: one would be glad to extend theconcrete notions and flexible features of games into a context where parametricity is understood. Studyingisomorphisms in this context would be a natural question, considering the particularly powerful onescorresponding to the above properties. 20inally, relational parametricity seems to be related to Curry-style system F, if we believe in a conjectureof Abadi-Cardelli-Curien which says the following: suppose you have two terms of type A whose typeerasures are the same. Then they are parametrically equal (the converse is false). This means that theparametric equality is (strictly) stronger than the Curry-style equality: the study on both Curry-style systemF and parametricity in the context of games may help to explore this question. References [ACC93] Martin Abadi, Luca Cardelli, and Pierre-Louis Curien. Formal parametric polymorphism.
Theo-retical Computer Science , 121:9–58, 1993.[AJ03] Samson Abramsky and Radha Jagadeesan. A game semantics for generic polymorphism. InAndrew D. Gordon, editor,
Foundations of Software Science and Computational Structures , volume2620 of
LNCS , pages 1–22. Springer, 2003.[AJM00] Samson Abramsky, Radha Jagadeesan, and Pasquale Malacaria. Full abstraction for PCF.
Infor-mation and Computation , 163(2):409–470, December 2000.[AM99] Samson Abramsky and Guy McCusker. Full abstraction for idealized algol with passive expres-sions.
Theoretical Computer Science , 227:3–42, September 1999.[BP01] Gilles Barthe and Olivier Pons. Type isomorphisms and proof reuse in dependent type theory.In F. Honsell and M. Miculan, editors,
Foundations of Software Science and Computation Structures ,volume 2030 of
LNCS , 2001.[Chr03] Julius Chroboczek.
Game Semantics and Subtyping . Ph.D. thesis, University of Edinburgh, 2003.[DC95] Roberto Di Cosmo.
Isomorphisms of Types . Progress in Theoretical Computer Science. Birkhäuser,1995.[dL07] Joachim de Lataillade. Second-order type isomorphisms through game semantics. To appearin
Annals of Pure and Applied Logic , Special Issue on Game Semantics, 2007. Available at ∼ delatail/isotypes.pdf .[Dun02] Brian Patrick Dunphy. Parametricity as a notion of uniformity in reflexive graphs . Ph.D. thesis,University of Illinois, 2002.[HO00] Martin Hyland and Luke Ong. On full abstraction for PCF.
Information and Computation , 163(2):285–408, December 2000.[Hug00] Dominic Hughes.
Hypergame semantics: full completeness for system F . D.Phil. thesis, OxfordUniversity, 2000.[Lai97] James Laird. Full abstraction for functional languages with control. In
Proceedings of the twelfthannual symposium on Logic In Computer Science , pages 58–67, Warsaw, June 1997. IEEE, IEEEComputer Society Press.[Lau05] Olivier Laurent. Classical isomorphisms of types.
Mathematical Structures in Computer Science ,15(5):969–1004, October 2005.[MO01] Andrzej Murawski and Luke Ong. Evolving games and essential nets for a ffi ne polymorphism.In Samson Abramsky, editor, Typed Lambda Calculi and Applications ’01 , volume 2044 of
LNCS .Springer, 2001. 21PA93] Gordon Plotkin and Martín Abadi. A logic for parametric polymorphism. In M. Bezem and J. F.Groote, editors,
International Conference on Typed Lambda Calculi and Applications , pages 361–375,Utrecht, The Netherlands, 1993. Springer-Verlag.[Rey83] John C. Reynolds. Types, abstraction and parametric polymorphism. In
International Federationfor Information Processing Congress , pages 513–523, 1983.[Rit91] Mikael Rittri. Using types as search keys in function libraries.
Journal of Functional Programming ,1(1):71–89, 1991. 22
Uniform strategies compose
Proposition 2 If σ :: A → B and τ :: B → C are two uniform strategies then σ ; τ :: A → C is uniform. P roof : Consider the following strategy¯ ρ = { u ↾ ↑ , ↓↓ | u ∈ Int ∧ u ↾ ↓↑ , ↓↓ ∈ σ ∧ u ↾ ↑ , ↓↑ ∈ τ ∧ u ↾ ↑ , ↓↓ symbolic play } It is an innocent strategy on A → C (the proof is the same as in HON models), and it is of course symbolic.We call ρ its copycat extension, and we want to prove that ρ = σ ; τ .First we prove that ρ ⊆ σ ; τ : as ¯ ρ ⊆ σ ; τ , we need to show that σ ; τ is stable by any copycat extensionalong any index j . Note that, if the variable game X j is played by O in A → C , it is also played by O in A → B or B → C . Consider the play s ′ = Fl sj , D ( r ) for s = m . . . m n ∈ σ ; τ , D ∈ G and r sequence of initialmove in M D . One shows that s ′ ∈ σ ; τ : indeed there exist a justified sequence u and two plays s ∈ σ and s ∈ τ such that u ↾ ↓↑ , ↓↓ = s , u ↾ ↑ , ↓↑ = s and u ↾ ↑ , ↓↓ = s . Let us consider the justified sequence U obtainedfrom u by replacing each sequence m i b . . . b q m i + by m i [ r i ] b [ r i ] . . . b q [ r i ] m i + [ r i ], and set U = U [ D / j ]. Then U ↾ ↓↑ , ↓↓ = s ′ ∈ σ (it is a flat extension, hence a copycat extension, of s ), U ↾ ↑ , ↓↑ ∈ τ (it is a flat extension, hencea copycat extension, of s ) and U ↾ ↑ , ↓↓ = s ′ ∈ σ ; τ .Now consider a move m i of s such that ♯ ( m i ) = j and a bi-view v = n . . . n p in the game D , and set S = CC sj , D ( i , v , r ). If U = U m ′ i [ r i ] b [ r i ] . . . b q [ r i ] m ′ i + [ r i ] U with m ′ i = m i [ D / j ] and m ′ i + = m i + [ D / j ], one canbuild another justified sequence U ′ , depending on the value of p : • if p = U ′ = U m ′ i [ n ] b [ n ] . . . b q [ n ] m ′ i + [ n ] U • if p even, U ′ = U m ′ i [ n ] b [ n ] . . . b q [ n ] m ′ i + [ n ] m ′ i + [ n ] b q [ n ] . . . b [ n ] m ′ i [ n ] . . . . . . m ′ i + [ n p ] b q [ n p ] . . . b [ n p ] m ′ i [ n p ] • if p odd and p > U ′ = U m ′ i [ n ] b [ n ] . . . b q [ n ] m ′ i + [ n ] m ′ i + [ n ] b q [ n ] . . . b [ n ] m ′ i [ n ] . . . . . . m ′ i [ n p ] b [ n p ] . . . b q [ n p ] m ′ i + [ n p ] U ′ ↾ ↓↑ , ↓↓ is a copycat extension of s ( s ′ was the flat extension) so U ′ ↾ ↓↑ , ↓↓ ∈ σ , and similarly U ′ ↾ ↑ , ↓↑ ∈ τ . U ′ ↾ ↑ , ↓↓ is a play so U ′ ↾ ↑ , ↓↓ = S ∈ σ ; τ .The last thing to prove is that σ ; τ ⊆ ρ . We suppose that σ and τ are the copycat extensions of thesymbolic strategies ¯ σ and ¯ τ respectively. Consider a play s ∈ σ ; τ , there exists a justified sequence u forwhich u ↾ ↓↑ , ↓↓ = s ∈ σ , u ↾ ↑ , ↓↑ = s ∈ τ and u ↾ ↑ , ↓↓ = s .Let D , . . . , D N be the sequence of games played by O in u at the level of moves of shape ↑ or ↓↓ . Supposefor simplicity that X , . . . , X N < FTV ( A ). Consider a subsequence U = m [ m ] b [ m ] . . . b q [ m q + ] n [ m q + ] of u such that: A ( m ) , A ( b ) , . . . , A ( b q ) , A ( n ) ∈ O ( A → B ) → C , paux ( A → B ) → C ( c ) = O if c = A ( m ), and b , . . . , b q are ofshape ↓↑ whereas m , n are not of this shape. Suppose U is the first such sequence in u and m is of shape ↑ (the case where m is of shape ↓↓ is similar). Then m L ( A → B ) → C ( c ) = D j for some 1 ≤ j ≤ N (it is a game played by O , because paux ( A → B ) → C ( c ) = O ).If u = u Uu , we build a new sequence u ′ as follows: • t = ( u m [ m ] b [ m ]) ↾ ↓↑ , ↓↓ ∈ σ is a D j -copycat extension of some ¯ s ∈ σ : indeed, σ is the smallestinnocent strategy that contains O and is stable by copycat extension, so t must be composed of manyviews that are obtained from ¯ σ by copycat extensions; besides, U is the first subsequence of its kind,so there is in fact only one of these copycat extensions that applies on a variable played at the level ofa move of shape ↑ or ↓↓ (so, only one B j -extension). ¯ s takes the form ¯ s = ( u ′ m [ j ] b [ M ]) ↾ ↓↑ , ↓↓ where u ′ is obtained by replacing each occurrence of D j in u by X j • t = ( u b [ m ] b [ m ]) ↾ ↑ , ↓↑ ∈ τ is a D j -copycat extension of some ¯ s ∈ τ : indeed, τ is the smallest innocentstrategy that contains O and is stable by copycat extension, so t must be composed of many viewsthat are obtained from ¯ τ by copycat extensions; besides, U is the first subsequence of its kind, so thereis in fact only one of these copycat extensions that applies on a variable played at the level of a moveof shape ↑ or ↓↓ (so, only one B j -extension). ¯ s takes the form ¯ s = ( u ′ m [ j ] b [ M ]) ↾ ↑ , ↓↑ we iterate this process until we get to n [ M q + ] for some M q + : this gives us a justified sequence u ′ on( A → B ) → C which can be copycat extended to u U , and such that u ′ ↾ ↓↑ , ↓↓ ∈ σ , u ′ ↾ ↑ , ↓↑ ∈ τ .Now we iterate this process for each subsequence of u having the same properties as U , and what we obtainis a justified sequence u ′′ on ( A → B ) → C such that u ′ ↾ ↓↑ , ↓↓ ∈ σ , u ′ ↾ ↑ , ↓↑ ∈ τ and t = u ′′ ↾ ↑ , ↓↓ is a play. Moreovereach D j has been replaced by X j (it might actually not be the case if some D j did not correspond to any ofour sequences, but in this case we just replace D j by X j harmlessly), so t ∈ ¯ ρ .Finally, u can be obtained from u ′′ by copycat extension, so s can be obtained from t by copycat extension.Hence, s ∈ ρ . (cid:3) B Proof of A ≃ g B ⇒ H A ≃ Cu H B Definition 29 (zig-zag play)
A play s of arrow shape is said to be zig-zag if • each Player move following an Opponent move of the form ↑ m (resp. ↓ m) has the form ↓ m ′ (resp. ↑ m ′ ) • each (Player) move which follows an (Opponent) initial move is justified by it • s ↾ ↑ and s ↾ ↓ have the same pointers.If s is a zig-zag even-length play, we note ˘ s the unique zig-zag play such that ˘ s ↾ ↑ = s ↾ ↓ and ˘ s ↾ ↓ = s ↾ ↑ . Theorem 1
Let A , B ∈ G . If there exists a game isomorphism ( σ, τ ) between A and B (A ≃ g B) then their hyperforestsare Curry-isomorphic (H A ≃ Cu H B ). P roof : For the sake of simplicity, we will throughout this proof identify the nodes of F A (resp. of F B )with the corresponding nodes of F A → B . Zig-zag property
Let σ : A → B and τ : B → A be the untyped strategies which form the game isomorphism, and let ˜ σ :: A → B and ˜ τ :: B → A be two realizations of σ and τ , respectively on A → B and B → A .We begin with the following: • every play of σ or τ is zig-zag • τ = { ˘ s | s ∈ σ }• σ and τ are total on the shape {↑ , ↓} .This has been proven in a simply typed context, i.e. with strategies playing on forests, in [Lau05]. Thepresent situation is actually a particular case of the simply typed one where the two forests to considerare universal (in the sense that they contain any move). Totality for universal forests immediately impliestotality on the arrow shape.One consequence of totality on the arrow shape is that, whenever s ∈ ˜ σ , we have erase ( s ) ∈ σ . Copycat property
We now prove the following:if sm [ m ′ ] m [ m ′ ] ∈ ˜ σ with A ( m ) , A ( m ) ∈ O A → B , then erase ( m ′ ) = erase ( m ′ )We call it the copycat property . Note that this property will hold only because ( σ, τ ) is a game isomor-phism, it is not true in general. 24irst consider the case where S = sm [ m ′ ] m [ m ′ ] is symbolic. We note u = erase ( S ) and we have u ∈ σ and v = ˘ u ∈ τ . We will prove by recurrence that erase ( m ′ ) = erase ( m ′ ), and that it is possible to build a play T ∈ ˜ τ such that erase ( T ) is a copycat extension of v . So, suppose this is true for every t ∈ E such that t (cid:22) s .We set x = erase ( m ) x = erase ( m ) , a = A ( m ) a = A ( m ) , x ′ = erase ( m ′ ) x ′ = erase ( m ′ ) and a ′ = A ( m ′ ) b ′ = A ( m ′ )We have three cases: • if paux A → B ( a ) is undefined (so that m ′ = m ′ ,
0: then paux A → B ( a ) = P (because ♯ ( m ′ ) = O has only played symbolically), so paux B → A ( a ) = O . As we have T ′ ∈ ˜ τ such that t ′ = erase ( T ′ )is a copycat extension of t (so t ′ ∈ τ by hyperuniformity), one can build T ′ m [ j ] ∈ P B → A for some j , O plays symbolically), so by definition of the realization there exists N ∈ M B → A such that T ′ m [ j ] N ∈ ˜ τ . Then t ′ x [ j ] y ∈ τ with y = erase ( N ) and ♯ ( y ) = j , so by hyperuniformity t ′ x [ x ′ ] y [ x ′ ] ∈ τ :this breaks determinacy since tx [ x ′ ] x [0] ∈ τ implies t ′ x [ x ′ ] x [0] ∈ τ by hyperuniformity, so m ′ , T ′′ = T ′ m [0] m [0] ∈ ˜ τ with erase ( T ′′ ) copycat extension of v . • if paux A → B ( a ) = O , then sm [ j ] m [ M [ j ]] ∈ ˜ σ for some j such that X j < FTV ( A ), so paux A → B ( a ) isdefined. The case paux A → B ( a ) = P implies paux B → A ( a ) = O ; as we have T ′ ∈ ˜ τ such that t ′ = erase ( T ′ )copycat extension of t (so t ′ ∈ τ by hyperuniformity), there exists k such that T ′ m [ k ] ∈ P B → A so T ′ m [ k ] N [ N ′ ] ∈ ˜ τ for some typed moves N , N ′ with A ( N ) ∈ O B → A . Hence t ′ x [ k ] y [ y ′ [ k ]] ∈ τ with y = erase ( N ) and y ′ = erase ( N ′ ), and by hyperuniformity t ′ x [ x ′ ] y [ y ′ [ x ′ ]] ∈ τ . But tx [ x ′ ] x [ j ] ∈ τ implies t ′ x [ x ′ ] x [ j ] ∈ τ by hyperuniformity, so y ′ [ x ′ ] = j (hence x ′ = j ) and y [ j ] = x [ j ].The case paux A → B ( a ) = O directly implies M [ j ] = j . One still has to build in this case the play T ∈ ˜ τ such that erase ( T ) is a copycat extension of v : we have T ′ ∈ ˜ τ such that t ′ = erase ( T ′ ) copycat extensionof t (so t ′ ∈ τ by hyperuniformity); moreover, if D = m L A ( a ) then there is at least one initial move M [ j ] ∈ M D . So, T ′ m [ M [ j ]] ∈ P B → A , and then T = T ′ m [ M [ j ]] N [ N ′ ] ∈ ˜ τ for some typed moves N , N ′ with A ( N ) ∈ O B → A . Hence t ′ x [ z ] y [ y ′ ] ∈ τ with z = erase ( M ), y = erase ( N ) and y ′ = erase ( N ′ ). But tx [ j ] x [ j ] ∈ τ implies t ′ x [ z ] x [ z ] by hyperuniformity, so by determinacy erase ( T ) = t ′ x [ z ] x [ z ]: it is acopycat extension of v . • if paux A → B ( a ) = P , then paux B → A ( a ) = O . As we have T ′ ∈ ˜ τ such that t ′ = erase ( T ′ ) copycat extensionof t , one can build as above T ′ m [ M ] ∈ P B → A for some typed move M (if D = m L A ( a ) then there is atleast one initial move M ∈ M D ), so T ′ m [ M ] N [ N ′ ] ∈ ˜ τ for some N , N ′ with A ( N ) = c ∈ O B → A . Weset y = erase ( M ), z = erase ( N ) and z ′ = erase ( N ′ ). There are two possibilities: if paux A → B ( a ) = O ,then M = j for some j . As tx [ j ] x [ x ′ ] ∈ τ , one has t ′ x [ y ] x [ x ′ [ y ]] ∈ τ by hyperuniformity, so x [ x ′ [ y ]] = z [ z ′ ] by determinacy. This means z [ j ] = x [ j ], so paux B → A ( c ) = O . Hence z ′ [ k ] = k , and so y [ k ] = x ′ [ k ] = k . If paux A → B ( a ) = P , then paux B → A ( a ) = O so y = j for some j . As tx [ k ] z [ z ′ [ k ]] ∈ τ ,one has t ′ x [ x ′ ] z [ z ′ [ x ′ ]] ∈ τ by hyperuniformity, so z [ z ′ [ x ′ ]] = x [ x ′ ] by determinacy. This means z [ k ] = x [ k ], so paux B → A ( c ) = O . Then z ′ [ k ] = k , so x ′ = x ′ .Finally, if S is not symbolic, there exists a symbolic play S ′ = s ′ M [ M ′ ] M [ M ′ ] ∈ ˜ σ whose S is a copycatextension. So erase ( M ′ ) = erase ( M ′ ) and erase ( m ′ ) = erase ( m ′ ) because of the definition of the copycatextension. Construction of the untyped copycat play
Let a be a node of F A and a , . . . , a p be the sequence of nodes of F A such that ⊢ a , a i ⊢ a i + and a p = a . We aregoing to construct a function f : F A → F B such that, for any i ∈ N : E ′ ( f ( a ))[ i ] E ′ ( a )[ i ] E ′ ( a )[ i ] E ′ ( f ( a ))[ i ] E ′ ( f ( a ))[ i ] E ′ ( a )[ i ] · · · ∈ σ where E ′ = E ◦ or : F A ∪ F B → X . 25he construction of f will use the determinacy of σ and τ , which generates a unique move starting froma play with its complete history (not just the last move). That is why we could not work with a function f ′ : O A → O B , because in that case, the choice of f ′ ( a ) would depend not only on a , but also on the choiceof the ancestors. As said at the end of section 7, the information contained in a node c ∈ F A is preciselythe node or ( c ) ∈ O A plus its ancestors: so, the forests are the good structure to ensure that the function f is well-defined. Having this in mind, one can identify or ( a i ) (resp. or ( f ( a i ))) with a i (resp. f ( a i )), and try toprove: E ( f ( a ))[ i ] E ( a )[ i ] E ( a )[ i ] E ( f ( a ))[ i ] E ( f ( a ))[ i ] E ( a )[ i ] · · · ∈ σ .Moreover, by the property of non-ambiguity (cf. def. 11), one has, for any b in F A (resp. in F B ): E ( a i ) = E ( b ) ⇒ b = a i (resp. E ( f ( a i )) = E ( b ) ⇒ b = f ( a i )). That is why we will also identify a i (resp. f ( a i ))with E ( a i ) (resp. E ( f ( a i ))). What has to be proved is then: f ( a )[ i ] a [ i ] a [ i ] f ( a )[ i ] f ( a )[ i ] a [ i ] · · · ∈ σ If p =
1, we build a symbolic play s = m ∈ P B → A such that erase ( m ) = a [ i ] for X i = m L B → A ( a ) . Let b be theonly untyped move such that a [ i ] b ∈ τ (which exists by totality of τ ). ˜ τ being a realisation of τ , there mustbe a play m M ∈ ˜ τ with erase ( M ) = b , and we have a decomposition M = m [ m ′ ] with A ( m ) = c ∈ O B → A .We choose f ( a ) = c , and we have erase ( m ′ ) = i because of the copycat property.If p = p ′ + p ′ odd, we have by induction hypothesis: f ( a )[ i ] a [ i ] a [ i ] f ( a )[ i ] . . . f ( a p ′ )[ i ] a p ′ [ i ] ∈ σ ,and by totality of σ there exists a unique move x such that f ( a )[ i ] a [ i ] a [ i ] f ( a )[ i ] . . . f ( a p ′ )[ i ] a p ′ [ i ] a p [ i ] x ∈ σ .One is able to build inductively a play S ∈ σ such that erase ( S ) = f ( a )[ y ] a [ y ] . . . f ( a p ′ )[ y p ′ ] a p ′ [ y p ′ ] for agood choice of the moves y k : indeed, if S ′ ∈ σ with erase ( S ′ ) = f ( a )[ y ] a [ y ] . . . f ( a k )[ y k ] a k [ y k ] (the case erase ( S ′ ) = f ( a )[ y ] a [ y ] . . . a k [ y k ] f ( a k )[ y k ] is similar), we choose a move M = m [ m ] with A ( m ) = a k + and m initial move of M D where D = m L A → B ( a k + ) ; we note erase ( m k + ) = y k + . ˜ σ being a realisation of σ , we have S ′ MM ′ ∈ ˜ σ for some typed move M ′ , and erase ( M ′ ) = a k + [ y k + ] by hyperuniformity of σ . Hence we haveobtained S = S ′ MM ′ ∈ ˜ σ such that erase ( S ) = f ( a )[ y ] a [ y ] . . . a k + [ y k + ] f ( a k + )[ y k + ] for some y k + .Then one chooses a typed move N such that tN ∈ P A → B and erase ( M ) = a p [ y p ] for some initial move y p (it su ffi ces once again to choose y p as initial in M D for the appropriate game D ).As f ( a )[ y ] a [ y ] . . . f ( a p ′ )[ y p ′ ] a p ′ [ y p ′ ] a p [ y p ] x [ y p ] ∈ σ by hyperuniformity, we have tNN ′ ∈ ˜ σ for some N ′ with erase ( N ′ ) = x [ y p ]. So x = b [ z ] with b ∈ O A → B , and we choose f ( a p ) = b . By the copycat property z [ y p ] = y p , so z [ i ] = i : this means f ( a )[ i ] a [ i ] a [ i ] f ( a )[ i ] . . . a p [ i ] f ( a p )[ i ] ∈ σ .If p = p ′ + p ′ even, one can do the same reasoning by using τ instead of σ .In the same way, one can associate a function g with τ and easily verify that f ◦ g is the identity on O B and g ◦ f is the identity on O A , so f is a bijection. Moreover, by construction, if a ≤ a ′ then f ( a ) ≤ f ( a ′ ). Construction of the typed copycat play
To prove that f satisfies the requirements of a Curry-isomorphism, we will construct a play s p ∈ ˜ σ such that erase ( s p ) = t p , where t p = f ( a )[ y ] a [ y ] a [ y ] f ( a )[ y ] . . . f ( a p )[ y p ] a p [ y p ] if p odd f ( a )[ y ] a [ y ] a [ y ] f ( a )[ y ] . . . a p [ y p ] f ( a p )[ y p ] if p evenfor an appropriate choice of the moves y i . Moreover, one will have s p = s p − m [ m ] M ′ where A ( m ) = c ∈O A → B and erase ( m ) = y p uniquely determined by D = m L A → B ( c ) .In the plays s p , we will use the games ( C j ) j ∈ N defined by: C = ⊥ × ⊥ and C j + = C j × C j . Note that eachinitial move of C j takes the form b ( b ( . . . ( b j (0)) . . . )), where each b i can be either r or l . We call r j the initialmove of C j where each b i is equal to r . These games will be used in order to have “fresh” moves, i.e. movesthat cannot come from a game defined before C j is played. In what follows, the integer n p is made to ensurethat no game defined before step p can belong to C q for q ≥ p .We now build the triple ( s p , y p , n p ) inductively: In the next part of the proof we will also build a typed play s p ∈ ˜ σ such that erase ( s p ) = f ( a )[ y ] a [ y ] . . . f ( a p )[ y p ] a p [ y p ], but therewill be more constraints on s p . If p =
1, we define the typed move M = m [ m ] such that: A ( m ) = f ( a ), the d games played atthe level of m are C , . . . , C d and we choose m = ♯ ( f ( a )) if paux A → B ( f ( a )) is undefined, m = r j if m L A → B ( f ( a )) = C j . As M ∈ P A → B and ˜ σ is a realization of σ , there exists M ′ such that M M ′ ∈ ˜ σ and erase ( M M ′ ) = f ( a )[ y ] a [ y ], where y = erase ( m ). We choose s = M M ′ . Let us define N as thebiggest number of tokens r in any initial occurrence of a game D defined at the level of M ′ . We choose n = max ( d , N ) + • If p = p ′ + p ′ odd, we define the typed move M p = m [ m ] such that: erase ( m ) = f ( a p ), the d p games defined at the level of m are C n p ′ , . . . , C n p ′ + d p and m is chosen as follows: – if paux A → B ( f ( a p )) is undefined, m = ♯ ( f ( a p )) – if paux A → B ( f ( a p )) = O , m = r j if m L A → B ( f ( a p )) = C j – if paux A → B ( f ( a p )) = P , let D = m L A → B ( f ( a p )) . Either there exists c ∈ O D such that ⊢ c and L D ( c ) , † ,and in this case one chooses m = m ′ [ m ′ ] with A ( m ′ ) = c , m ′ L D ( c ) = ⊥ × ⊥ and m ′ = l
0; we note r D = erase ( m ) , and we require that r D is a function of D ; or there exists no such c and in thiscase we choose m such that A ( m ) is one of the initial occurrences of D : we just require that thischoice is a function of D , and note it r D .As s p ′ M p ∈ P A → B and ˜ σ is a realization of σ , there exists M ′ p such that s p ′ M p M ′ p ∈ ˜ σ and erase ( s p ′ M p M ′ p ) = t p if y p = erase ( m ). We choose s p = s p ′ M p M ′ p . Let us define N as the biggest number of tokens r in anyinitial occurrence of a game D defined at the level of M ′ p . We choose n p = max ( n p ′ + d p , N ) + • If p = p ′ + p ′ odd, we do the same choices as in the preceding case, except that f ( a p ) must bereplaced by a p , and conversely.Suppose paux A → B ( a p ) is defined, then ref A → B ( a p ) = b is also defined. It is important for the next sectionof the proof to understand the link between b and the play s p . First, note that b = a i for some 1 ≤ i ≤ p ;then, because of the definition of the set R A → B of hyperedges, we know that a i is the minimal occurrence c of O A → B such that L A → B ( a p ) is a prefix of c . Hence, if M i (resp. M p ) is the move in s p such that erase ( M i ) = a i [ y i ](resp. erase ( M p ) = a p [ y p ]) and if D = M p L A → B ( a p ) , then the game D is played by paux A → B ( a p ) at the level of M i .So, in the construction of s p , D has been played at step i .We also need to build a play u p ∈ ˜ τ such that erase ( u p ) = v p , where v p = a [ y ′ ] f ( a )[ y ′ ] f ( a )[ y ′ ] a [ y ′ ] . . . a p ′ [ y p ′ ] f ( a p ′ )[ y p ′ ] if p odd a [ y ′ ] f ( a )[ y ′ ] f ( a )[ y ′ ] a [ y ′ ] . . . f ( a p )[ y ′ p ] a p [ y ′ p ] if p even for an appropriate choice of the moves y ′ i .The procedure is similar (we just need to swap σ and τ ). Note that we do not have in general u p = ˘ s p , oreven erase ( u p ) = ˘ w p with w p = erase ( s p ), because the untyped moves y i and y ′ i may di ff er. Curry-isomorphism
We are now going to prove that the bijection f satisfies each requirement of a Curry-isomorphism.We first prove that D B ◦ f = D A : suppose D A ( a p ) = X i , then s p = s p − MM ′ with erase ( M ) = a p [ i ] and erase ( M ′ ) = f ( a p )[ i ]; likewise, u p = u p − NN ′ with erase ( N ) = f ( a p )[ i ] and erase ( M ′ ) = a p [ i ]. If paux A → B ( f ( a p )) = O then one should have i = r j for some j by construction of s p , which is impossible. If paux A → B ( f ( a p )) = P then paux B → A ( f ( a p )) = O and one should have i = r j for some j by construction of u p , which is impossible.Then paux A → B ( f ( a p )) is not defined, and ♯ ( f ( a p )) = i which means D B ( f ( a p )) = X i . Similarly, D B ( f ( a p )) = X i implies D A ( a p ) = X i as well. In this case, m is precisely built in such a way that we cannot have r D = r j for any j .
27e then prove that f ( S A ) = S B : if a p ∈ S with ( t , S ) ∈ R A for some t , suppose L A → B ( f ( a p )) = † . If paux A → B ( a p ) = O then s p = s p − MM ′ with erase ( M ) = a p [ y p ] and erase ( M ′ ) = f ( a p )[ y p ], and one shouldhave y p = r j for some j by construction of s p . But this is impossible since L A → B ( f ( a p )) = † implies A ( M ′ ) ∈ O A → B , so y p ∈ N . If paux A → B ( a p ) = P then paux B → A ( a p ) = O , u p = u p − NN ′ with erase ( N ) = f ( a p )[ y p ]and erase ( N ′ ) = a p [ y p ] and one should have y p = r j for some j by construction of u p . But this is impossiblesince L A → B ( f ( a p )) = † implies A ( N ) ∈ O A → B , so y p ∈ N .Finally, we need to prove the following: for every ( t , S ) ∈ R A , if there exists c ∈ S such that λ ( c ) , λ ( t ),then ( f ( t ) , f ( S )) ∈ R B (the reciprocal would be done similarly). Let us take a , . . . , a p the sequence of nodessuch that: ⊢ a , a i ⊢ a i + and a p = c . We necessarily have t = a i for some i ≤ p .First we prove that ref B ( f ( a p )) = f ( a i ): suppose that it is false, then ref B ( f ( a p )) = f ( a j ) with j , i . Firsttake j < i : if paux A → B ( a p ) = O , then f ( a p ) is an O -move on A → B , so s p = SM p M ′ p where: M p = m [ m ], A ( m ) = f ( a p ) and m L A → B ( f ( a p )) = D for some D chosen at step j ; and M ′ p = m ′ [ m ′ ], A ( m ′ ) = a p and m ′ L A → B ( a p ) = C k ′ for some k ′ ≥ n i − . So we should have y p = r k to be the move we choose in D , which is impossible byconstruction of n i − . If paux A → B ( a p ) = P , we simply note that paux B → A ( a p ) = O and do the same reasoningwith u p in B → A . In the case where i < j , the reasoning is similar: if paux A → B ( a p ) = P , then s p = SM p M ′ p where: M p = m [ m ], A ( m ) = a p and m L A → B ( a p ) = D for some D chosen at step i ; and M ′ p = m ′ [ m ′ ], A ( m ′ ) = f ( a p ) and m ′ L A → B ( f ( a p )) = C k ′ for some k ′ ≥ n j − . This leads to a contradiction. If paux A → B ( f ( a p )) = P , we work on B → A .Let us now have b ∈ fr A ( a p ), and suppose that f ( b ) < fr B f ( a p ). By what has been proved before we knowthat paux A → B ( f ( b )) is defined, but also that ref B ( f ( b )) has the same polarity as ref A ( b ): indeed, if paux A ( b ) , λ ( b )then ref B ( f ( b )) = f ( ref A ( b )), so λ ( ref B ( f ( b ))) = λ ( f ( ref A ( b ))) = λ ( ref A ( b )); similarly, if paux B ( f ( b )) , λ ( f ( b )) then ref A ( b ) = f − ( ref B ( f ( b ))), so λ ( ref A ( b )) = λ ( f − ( ref B ( f ( b )))) = λ ( ref B ( f ( b ))). Finally, if paux A ( b ) = λ ( b ) and paux B ( f ( b )) = λ ( f ( b )) then paux A ( b ) = paux B ( f ( b )) because b and f ( b ) have the same polarity. Then, in allcases, paux ( b ) = paux ( f ( b )).We consider that paux A → B ( f ( b )) = O (if not, one works with u p on B → A ), so paux A → B ( a p ) = P and s p = s p − m [ m ] m ′ [ m ′ ] with m ′ L A → B ( f ( a p )) = C k for some k . Let D = m L A → B ( a p ) , we necessarily have that y p = r k = erase ( r D ). But a problem arises with b and f ( b ): as a first case, suppose that b has the polarity P in A . Then there is a play s ′ q = s ′ q − M [ M ] M ′ [ M ′ ] in ˜ σ constructed the same way as s p , such that erase ( s ′ q ) = erase ( s ′ q − ) b [ y ′ q ] f ( b )[ y ′ q ], and where M L A → B ( b ) = D and M ′ L A → B ( f ( b )) = C k ′ with k ′ , k . Then we shouldhave y ′ q = erase ( r D ) occurrence of C k ′ , so r k = r k ′ which is impossible.The second case is where b has the polarity O in A . Then there is a play s ′ q = M [ M ] M ′ [ M ′ ] in ˜ σ constructed the same way as s p , such that erase ( s ′ q ) = s ′ f ( b )[ y ′ q ] b [ y ′ q ], and where M L A → B ( f ( b )) = C k ′ with k ′ , k and M ′ L A → B ( b ) = D . Then we should have y ′ q = r k ′ = erase ( d ′ ) with d ′ move in D . But in this case A ( d ) , A ( d ′ ) ∈ O D (if not we have a token l in d or d ′ ), so E ( d ) = r k and E ( d ′ ) = r k ′ , hence k = k ′ because D is unambiguous. Thisis impossible. f ( b ) ∈ fr B ( f ( a p )) similarly implies b ∈ fr A ( a p ), so f ( S ) = { b | s ∈ fr B ( f ( a p )) } . This allows us to conclude that( f ( t ) , f ( S )) ∈ R B . (cid:3)(cid:3)