On Berrys conjectures about the stable order in PCF

PCF is a sequential simply typed lambda calculus language. There is a unique order-extensional fully abstract cpo model of PCF, built up from equivalence classes of terms. In 1979, G\'erard Berry defined the stable order in this model and proved that…

Authors: Fritz M"uller (Saarl, University)

Logical Methods in Computer Science Vo l. 8(4:7)2012, pp. 1–39 www.lmcs-online.o rg Submitte d Aug. 2 , 2011 Published Oct. 12, 2012 ON BERR Y’S CONJEC TURES ABOUT THE ST ABLE ORDER IN PCF FRITZ M ¨ ULLER Saarland Universit y , Departmen t of Co mputer Science, Campus E1.3, 66123 Saarbr¨ uck en, Ger- many , http://rw4.cs .uni- saarland.de/ ~ mueller e-mail addr ess : ( λ x.muellerxcs.uni -saarland. de)@ Abstra ct. PCF is a sequen tial simply typed lam b da calculus language. There is a u nique order-extensional fully abstract cp o-mod el of PCF, built up from equiv a lence classes of terms. In 1979, G´ erard Berry defi ned the stable order in th is mo del and prov ed that the extensional and the stable order together form a bicp o. He made the follow ing tw o con- jectures: 1) “Extensional and stable order form not only a bicp o, bu t a bidomain.” W e refute this conjecture by showing that t he stable order is not bou n ded complete, al- ready for finitary PCF of second- order types. 2) “The stable order of the mo del h as the syntactic order as its image: If a is less th an b in the stable order of t he mo del, for finite a and b , t h en there are normal form terms A and B with the seman tics a , resp. b , such th at A is less than B in the syntactic order.” W e give counter-examples to this conjecture, again in finitary PCF of second-order typ es, and also refute an improve d conjecture: There seems to b e n o simple syntactic character- ization of the stable order. But we show that Berry’s conjecture is true for unary PCF. F or the preliminaries, w e explain the basic fully abstract semantics of PCF in the general setting of (not-n ecessarily complete) partial order mo dels ( f-mo dels). And we restrict t he syntax to “game terms”, with a graphical representation. 1. Introduction PCF is a simple fun ctional programming language, a call-b y-name typ ed lambd a calculus with inte gers and b o oleans as ground t yp es, some simple sequ en tial op erations on the ground t yp es, and a fi xp oint combinato r. The concept of PCF was formed by Dana Scott in 1969 , see the h istorical docu m en t [27]. It is us ed as a protot yp ical programming language to explore the relati onship b et w een op er ational and denotational seman tics, s ee the seminal pap er of Gordon Plotkin [24]. The (op erational) observational pr e or der M ⊑ op N o f t w o terms (of equal t yp e) is defined as: F or all con texts C [ ] of intege r t y p e, if C [ M ] r ed uces to the intege r n , then C [ N ] also reduces to the same n . The denotational semantic s (the mo del) assigns to ev ery term M an element [ [ M ] ] of a p artial order ( D , ⊑ ) (usu ally a complete partial order, cp o) 1998 ACM Subje ct Classific ation: F.3.2, F.4.1. Key wor ds and phr ases: functional p rogram, typ ed lam b d a calculus, PCF, denotational seman tics, fully abstract mod el, non-cp o mo del, game semantics, stable function, stable order, dI- domain, bicp o, b idomain, syntactic order. LOGICAL METHODS l IN COMPUTER SCIENCE DOI:10.216 8/LMCS-8(4:7) 2012 c  F . Müller CC  Creative Commons 2 F. M ¨ ULLER as meanin g. The mo del is said to b e (or der) ful ly abstr act if the t w o orders coincide: M ⊑ op N ⇐ ⇒ [ [ M ] ] ⊑ [ [ N ] ]. The standard mo del of S cott domains and con tin uous fun ctions is adequate (i.e. the d irection ⇐ = of the coincidence), but not fully abstract, b ecause the seman tic domains contai n fi nite elemen ts that are not expressible as terms , lik e the parallel or function. First Robin Milner [16] constructed in 1977 a u nique fully abstract order- extensional cp o-mo del of PCF that can b e built up from equiv alence classes of terms b y some ideal completion. The problem to constru ct a f ully abstract mo del of PC F that do es not use the syntax of terms (the “full abstraction problem”) w as the drivin g force of the subsequent deve lopmen ts, see also the handb o ok article [22]. In 1979 G ´ erard Berry pu blished his PhD thesis [4] w ith the translated title “F ully abstract and stable mo dels of typed lam b da-calculi”, which is the main basis of our w ork. In order to sort out f u nctions lik e the parallel or fr om the semanti c domains, to get “closer” to the fully abstr act mo d el, he ga v e the defin ition of stable function: A function f is stable if for the computation of some fi nite part of the output a d eterministic minimal part of the inp ut is needed. In the case that th er e are only finitely many element s smaller than a finite element , this d efinition is equiv alen t to the definition of a c onditional ly multiplic ative function f : If a and b are compatible, then f ( a ⊓ b ) = f a ⊓ f b . T o mak e the op eration of functional application of stable functions itself stable, Berry had to replace the p oint w ise order of functions, the extensional order, by the new stable ord er: Two functions are in the stable or der , f ≤ g , if for all x ≤ y : f x = f y ⊓ g x . Th is en tails the p oin t wise ord er , but it demands in add ition that g m us t n ot output some result for in p ut x that f outputs only for greater y . Side remark: Stabilit y is a u niv ersal concept that was indep enden tly (re)disco ve red in man y mathematical con texts. So Jean-Yve s Girard foun d it in the logical theory of dilators and then transferred it to domain theory (qualitativ e domain, coherence sp ace) to giv e a mo del of p olymorp h ism (system F) [9], thereb y indep endently rein ven ting Berry’s stable functions and stable order, s ee also the textbo ok [10], c hapter 8 and app end ix A. F or a general theory of stabilit y and an extensiv e bibliography see [31]. No w Berry had a m o del (of PC F) of stable functions with the stable order. But this mo del did n ot r esp ect the old (p oin twise) extensional order of th e stand ard mo del and so had new u n w anted elemen ts not conta in ed in the standard mo del. T o get a prop er subset of the stand ard mo del, he in tro duced bicp o mo dels. A bicp o is a set with tw o ord ers, an extensional and a stable one, b oth formin g cp os and b eing connected in some wa y . He augment ed Milner’s fully abstract cp o mod el by the stable order and pro v ed th at it consists of bicp os and its fu nctions are conditionally m u ltiplicativ e. In section 3 w e sho w in addition that its stable order forms stable bifin ite d omains and therefore its f unctions are also stable and can b e represent ed by tr ac es , i.e. sets of tok ens (or eve n ts) lik e in [7]. E.g. the function [ [ λf . if ( zero ( f 0 )) then 0 else ⊥ ] ] can b e represente d by the trace consisting of the tok ens { 0 7→ 0 }7→ 0 and {⊥7→ 0 }7→ 0 . F unctions are in the stable order, f ≤ g , iff the trace of f is a su bset of th e trace of g . In his thesis Berry made the follo wing t wo conjectures that w e r efute: 1) “Extensional and stable order in the fully abstract cp o-mo del of P CF form n ot only a bicp o, but a bidomain.” This w ou ld mean (among other things) that the stable order is b oun ded complete and d istributiv e. W e give counte r-examples in finitary PCF of second-order t yp es to th is conjecture. The idea is that the stable lub of t w o stably b ounded elemen ts a and b m a y ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 3 en tail a new tok en that was not present in a or b . This new tok en m ust b e used in the synta x to separate a subterm denoting a from a subterm denoting b that cannot b e unified in a common term. T herefore distribu tivit y is not fulfilled, stable lu bs are not tak en p oin twise. And w orse: There ma y b e a c h oice b etw een differen t n ew toke n s to b e en tailed, then there is a c hoice b et ween d ifferen t min imal stable upp er b ounds of a and b , but th er e is no stable lub. The min im al stable upp er b ound s are p airw ise stably incompatible, and the extensional lub a ⊔ b is one of them. 2) Th e extensional ord er of the fu lly abstract mo del coincides with the (synt actic) obser- v ational p reorder. This leads to the qu estion: Is there a syntact ic c haracterizatio n also for the stable order? Berry mad e the conjecture: “The stable order of the mo del has the synt actic order as its image: If a ≤ b in the stable order, for finite a and b , then there are normal form terms A and B with [ [ A ] ] = a and [ [ B ] ] = b , such that A ≺ B in the synta ctic ord er .” Berry prov ed the con verse direction: If A ≺ B , then [ [ A ] ] ≤ [ [ B ] ], and pro v ed the conjecture for first-order t yp es. Our s im p lest coun ter-example to this conjecture is a situation of four terms A ≺ B ∼ = C ≺ D , w h ere ∼ = is observ ational equiv alence, so that [ [ A ] ] ≤ [ [ D ] ], but there is no wa y to find terms A ′ ∼ = A , D ′ ∼ = D with A ′ ≺ D ′ . The elimination of some tok en of D dep end s on the prior elimination of some other tok en, so that t wo ≺ -steps are n ecessary to get f r om D do wn to A . W e further give examp les where su c h a c h ain of ≺ -steps (with intermediate ∼ = -steps) of an y length is necessary . This p rop oses an improv ed conjecture, the “c hain conjecture”: Instead of A ≺ B w e demand the existence of a c hain b et wee n A and B . But we also r efute this conjecture. Although stable order and synta ctic ord er are connected, there seems to b e no simple syn tactic c h aracterizati on of the stable order in PCF. All our counte r-examples for b oth conjectures are in finitary PCF of second-order t yp es. Th ey all share a common basic idea: W e h av e a term M : ( ι → ι → ι ) → ι with t wo tok ens (among others) whic h are in th e simplest form lik e the tok ens {⊥⊥7→ 0 }7→ 0 and {⊥ 0 7→ 0 , 11 7→ 1 }7→ 0 . The fun ction call that realiz es ⊥⊥7→ 0 r esp. ⊥ 0 7→ 0 is at the top lev el of M , the function call f or 1 1 7→ 1 is n ested b elo w. W e w an t to eliminate the tok en {⊥⊥7→ 0 }7→ 0 . F or this the fu nction call for 11 7→ 1 must b e “lifted” to the top lev el, b ut th is is not p ossible due to other tok ens of M that h av e to sta y . The necessary in gredien ts for the counter-e xamples are: at least second-order t yp e w ith some functional p arameter of arit y at least 2, at least t wo different groun d v alues 0 and 1 , and the need for nested function calls. If we restrict the calculus to a single groun d v alue 0 , we get u nary PC F, and in th is case b oth of Berry’s conjectures are true: The fully abstract mo del is a bid omain, in fact it is the standard semantica l b idomain construction, prov ed b y Jim Laird in [12]. An d w e p r o ve that the syntacti c order is the image of the stable order, using Laird’s p r o of that ev ery t yp e in unary PCF is a definable retract of some first-order t y p e. The need for nested function calls is the r esult of a “restriction” of PCF: Th ere is no op erator to test if a function demands a certain argument , so that this inf ormation could b e used in an if-then-else. J im Laird h as shown that in a language with suc h control op erators (SPCF) nested fun ction calls can b e eliminated, and also ev ery type of S PCF is a d efi nable retract of a fi rst-order type [13]. Th erefore I am con vinced, though I do not pr ov e it here, that also for SPCF the synta ctic order is the image of the stable order. 4 F. M ¨ ULLER The ab o ve men tioned “restriction” of PCF is generally the r eason for m an y irregulari- ties of the seman tics of PCF and the difficult y of the fu ll abstraction problem. An imp ortant result is the un decidabilit y of fi nitary PCF [14]. Th is means th at the observ ational equiv a- lence of tw o terms of fin itary PCF is und ecidable, and also the question w hether th ere is a term for a fun ctional v alue table. As remark ed in the introdu ction to [7], this result restricts the p ossible fully abstract mo dels of PCF to b e not “finitary” in some sens e. There ha ve b een sev eral s olutions for semanti cal fully abstract mo d els of P C F: A mo del of con tinuous functions restricted b y Kripke logical relations [21], and game seman tics [1, 11 , 18]. In game seman tics a term of PCF is mo deled b y a strategy of a game, i.e. b y a pro cess that p erforms a dialogue of questions and answers with the environmen t, the opp onen t. These strategies are still in tensional; the fully abstract mo del is formed by a quotien t, the exten- sional collapse. The s tr ategies can b e iden tified with P CF B¨ ohm trees of a certain normal form, see also [2, section 6.6]. W e call these B¨ ohm trees “game terms” and prov e that it is sufficien t to formulate all our results in the realm of game terms, esp. th at if t w o terms are synt actical ly ordered, then there are equiv alent game terms so ordered. This simplifies the pr o ofs of the coun ter-examples. W e also introdu ce a graph ical notation for game terms that facilitate s the handlin g of larger examples. It wa s an op en problem wh ether the game mo del is isomorp hic to Milner’s fully abstract cp o-mo del, i.e. wh ether its domains are cp os. This problem w as solved by Dag Normann [19]: I ts domains are not cp os, i.e. th ere are directed sets that hav e n o lub. Then Vladimir Sazono v made a fi rst attempt to b u ild a general theory for these non-cp o d omains [25, 26, 20]. His main ins igh t w as that functions are con tinuous only with r esp ect to certain lub s of directed sets that he calls “natural lubs”; these are the hereditarily p oin twise lub s. W e w ant to place ou r r esults in the cont ext of these new, more general mo dels. F or the seman tic preliminaries we give a simp le defin ition of a set of w ell-b eha ved (not-necessarily complete) partial order fu lly abstract mo dels of PCF: These f-mo dels are sets of ideals of finite elemen ts, suc h that app lication is defined and every PCF-term has a denotation. Sazono v’s natural lub s corresp ond to our f-lubs , which are defined with r esp ect to the fi n ite elemen ts. I f ound th e counter-e xample to Berry’s second conjecture around th e y ear 1990, but did not y et pu b lish it. As far as I kn o w, nob o dy else tac kled Berry’s problems. T h e reason for this seems to b e that they were simply forgotten. T he stable order in th e fully abstract mo del w as nev er explored after Berry; a reason ma y b e that h e n ev er prepared a journ al v ersion of his thesis, which is not easily accessible. The recommended introd uction to our sub ject is the rep ort “F ull abs tr action for sequential languages: T he state of the art” [5], w h ic h conta in s the thesis in conden s ed form, but lac ks most pro ofs. T here is also an article [3 ] pu blished by Berry b efore his thesis, which is not recommended, b ecause section 4.5 (bidomains) is w rong (differen t definition of b idomain, the first conjecture is stated as theorem). An excelle n t general in tr o duction to d omains, stabilit y and PC F (and many other thin gs) is the textb o ok [2]. But for the stable order in the fu lly abstract mo del of PCF the only detailed source remains Berry’s thesis. Here is the structur e of the pap er. Th e coun ter-examples are giv en in the order of their disco ve ry , i.e. in the order of increasing complexit y . 2. Syn tax of PCF. 3. Seman tics of PC F: n on-complete partial order f-mo dels: W e in tr o duce f-mo dels as general (not-necessarily complete) partial ord er fully abstract ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 5 mo dels of PCF and give the prop erties of the stable ord er in this general cont ext. (The order-extensional fully abstract cp o-mod el of PCF is a sp ecial case.) 4. Game terms: W e d escrib e the construction of game terms by the finite pr o jections and giv e a graph ical notation for game terms. The exp ert who is in terested only in th e coun ter-examples ma y skip the int ro ductory sections 2-4; reading only the definition of game terms and their graphical notation at the b eginnin g of section 4. 5. The syn tactic order is not the image of the stable order: W e pro ve Berry’s s econd conjecture for firs t-order types, giv e a coun ter-example in a second-order type (a chain of length 2), and pro ve the existence of c hains of any least length. 6. The stable order is not b ound ed complete: no bidomain: W e pro ve Berry ’s fir st conjecture for fi rst-order t yp es. In a second-order t yp e we giv e an example of a stable lu b th at d o es n ot fulfill distributivity , and an example of t wo stably b ound ed elemen ts without stable lub . 7. Refutation and impro vemen t of th e chain-conject ure: W e refute the improv ed second conjecture that the stable order enta ils a c hain of terms. W e prop ose in turn an impro v ement of the c hain conjecture, b ased on the complemen tary syn tactic relation of strictification. 8. Unary P CF: W e pr o ve Berry’s second conjecture for un ary PCF, with the aid of Jim Laird’s d efi nable retractions from any t yp e to some first-order t yp e [12]. 9. Outlo ok. 2. S ynt ax of PCF In this section w e giv e the syn tactic defin itions of PCF [24, 5, 2 ]. The programming language PCF is a simply typ ed lambd a calculus with arithmetic and fixp oin t op erators. It u sually comes with t wo ground typ es ι (in tegers) and o (b o oleans). W e simplify the language and use only the ground t yp e ι (in tegers); the b o oleans are sup erfluous and can b e co d ed as in tegers, the intensional structure of the terms sta ys the same. The t yp es are formed b y ι and f unction t yp es σ → τ for t yp es σ and τ . The t yp ed constan ts are: 0 , 1 , 2 , . . . : ι , the int egers; suc , p re : ι → ι , successor and pr ed ecessor fu nction; if then else : ι → ι → ι → ι , this conditional tests if the first argument is 0 . (W e write e.g. if x then y for the application of this function to only t w o argum en ts.) The PCF terms comprise the constan ts and the t yp ed constructs by the follo wing rules: ⊥ σ : σ for an y t yp e σ , the und efined term. x σ : σ for an y v ariable x σ . If M : τ , then λx σ .M : σ → τ , lam b da abstraction. If M : σ → τ and N : σ , then M N : τ , f unction application. If M : σ → σ , then Y M : σ , Y is the fixp oint op erator. 6 F. M ¨ ULLER PCF σ is the set of all PCF terms of t yp e σ , and PCF σ c is the set of the closed terms of these. T yp e annotations of ⊥ and of v ariables will often b e omitted. W e use the (seman tic) sym b ol ⊥ also as syn tactic term, instead of the u sual Ω. W e define the syntactic or der ≺ (also called ⊥ -matc h order in th e literature) on terms of the same t yp e: M ≺ N iff N can b e obtained by replacing some o ccurren ces of ⊥ in M b y terms. The reduction rules are (where n is a v ariable for integ er constants): ( λx.M ) N → M [ x := N ], the usual β -r eduction; Y M → M ( Y M ); suc n → ( n + 1); p re n → ( n − 1), for n ≥ 1 ; if 0 then M else N → M ; if n then M else N → N , for n ≥ 1 . The r e duction r elation → is one step of redu ction b y th ese rules in any term con text. It is confluent . → ∗ is the reflexiv e, transitiv e closure of → . A pr o gr am is a closed term of typ e ι . The op er ational (observational) pr e or der ⊑ op on terms of the same t yp e is defined as: M ⊑ op N ( M is op er ational ly less define d than N ) iff P [ M ] → ∗ n implies P [ N ] → ∗ n for all con texts P [ ] s uc h that P [ M ] and P [ N ] are b oth programs. The op er ational e quiv alenc e is defined as: M ∼ = N iff M ⊑ op N and N ⊑ op M . 3. S emantics of PCF: no n-complete p ar tial o rder f-mod els This section giv es an exp osition of the fully abstract semanti cs of PCF with the stable order, as f ar as it is needed to und erstand the resu lts of this p ap er. The pro ofs are omitted, as they are easy and/or already known in some form. The order-extensional fully abstract cp o-mo del of PCF w as fi rst constr u cted b y Robin Milner [16] based on terms of an SKI-com b inator calculus. Later G ´ erard Berry’s thesis [4] constructed this mo del based on the prop er λ -terms. T his mo d el is th e id eal completion of the finite elemen ts; ev ery directed set has a lub. Then came the fully abstract game mo dels of PCF [1, 11, 18]. Th e elemen ts of these mo dels can b e repr esen ted b y th e (infinite) B¨ ohm trees of PCF. It w as an op en p r oblem whether the game mo d el is isomorphic to Milner’s mo del, i.e. whether its domains are cp os. This problem was solved b y Dag Normann [19]: Its domains are n ot cp os, i.e. there are d irected sets that hav e n o lub . Then Vladimir Sazono v made a first attempt to build a general theory for these non-cp o domains [25, 26, 20]. His main insight w as that fu nctions are conti n u ous only w ith resp ect to certain lubs of directed sets that h e calls “natural lub s”; these are the hereditarily p oint wise lubs. W e w ant to place our results in the context of these new, more general mo dels. Th erefore w e giv e a simple d efinition of a set of we ll-b eha v ed (not-necessarily complete) partial ord er fully abstract mo d els of PCF: Th ese f-mo dels are sets of id eals of finite elemen ts, suc h that app lication is defined and ev ery PCF-term has a d enotation. S azono v’s natural lubs corresp ond to our f-lubs , which are defin ed with r esp ect to the finite elemen ts. ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 7 W e state the usual pr op erties f or these f-mo dels; the essence of their pro ofs is already con tained in Berry’s construction. Our aim is the definition of the stable order and of conditionally multiplicativ e (cm) fun ctions. All functions in f-mo d els are cm. W e can further sho w, in add ition to Berry , th at th e d omains h a ve prop ert y I un der the stable order and therefore the functions are stable and we can wo r k with their traces. W e need the follo wing PC F terms, the finite pr oje ctions on t yp e σ of gr ade i , Ψ σ i : σ → σ : Ψ ι i = λx ι . if x then 0 else i f pre 1 x then 1 else . . . i f pre i x then i else ⊥ Ψ σ → τ i = λf σ → τ .λx σ . Ψ τ i ( f (Ψ σ i x )) W e also need the follo wing terms for the glb fu nctions on all typ es, inf σ : σ → σ → σ , h ere in a lib eral syn tax: inf ι = λx ι y ι . if x = y then x else ⊥ = λx ι y ι . if x then i f y then 0 else ⊥ else suc (inf ι ( p re x )( p re y )) inf σ → τ = λf σ → τ g σ → τ .λx σ . inf τ ( f x )( g x ) When applied to a closed term M : σ , the fun ction term Ψ σ i serv es as a “filter” that lets only pass int eger v alues ≤ i as input or outpu t to M . This serves to define the fin ite elemen ts of the in tend ed m o del. Definition 3.1. A term M : σ is a finite term of gr ade i if it is closed and M ∼ = Ψ σ i M . F σ i = { [Ψ σ i M ] op | M ∈ PCF σ c } is the set of finite elements of g r ade i of t yp e σ , where [ X ] op is the equiv alence class of term X under the op erational equ iv alence ∼ = . F σ = S i F σ i is the set of finite elements of typ e σ . The finite elements are partially ordered by the extension of th e op erational preorder ⊑ op to equiv alence classes. An ide al of fi nite elemen ts of t yp e σ is a set S ⊆ F σ suc h th at: S 6 = ∅ and a, b ∈ S = ⇒ ∃ c ∈ S. a ⊑ op c and b ⊑ op c , and a ∈ S, b ∈ F σ and b ⊑ op a = ⇒ b ∈ S . I ( F σ ) is the set of ideals of finite elemen ts of t yp e σ . There is an op eration apply on ideals of fi nite elemen ts. F or f ∈ I ( F σ → τ ), d ∈ I ( F σ ): apply( f , d ) = ↓{ f ′ d ′ | f ′ ∈ f , d ′ ∈ d } ∈ I ( F τ ) , where f ′ d ′ = [ M N ] op for M ∈ f ′ , N ∈ d ′ . apply( f , d ) is simply written f d . F rom n o w on a ∈ F σ is iden tified with the ideal ↓ { a } , the do w nw ard closur e w.r.t. ⊑ op of { a } . So we hav e the em b edd in g F σ ⊆ I ( F σ ). Definition 3.2. An f-mo del of PCF (“f ” means: based on fi nite elemen ts) is a collection of D σ ⊆ I ( F σ ) for ev ery t yp e σ , eac h D σ ordered by inclusion ⊆ written ⊑ , suc h th at for f ∈ D σ → τ , d ∈ D σ : f d ∈ D τ , and suc h that eve r y closed term M : σ has its denotation in D σ : ↓{ [Ψ σ i M ] op | i ≥ 0 } ∈ D σ . The lubs w.r.t. ⊑ will b e written ⊔ and F , the glbs ⊓ and d . All f-mo dels coincide on their part of the finite elemen ts w.r.t. b oth extensional ⊑ and stable ≤ ord er . In the follo w ing sections, pr op ositions will mostly d eal w ith fi nite element s. The prop ositions are v alid for all f-mo dels if not otherwise stated. 8 F. M ¨ ULLER T o ev ery f-mo del we can asso ciate th e semantic map [ [ ] ] : PCF σ → ENV → D σ , where ENV is the set of en vir onmen ts ρ that map every v ariable x σ to some ρ ( x σ ) ∈ D σ . If M : σ is a term with the free v ariables x 1 , . . . , x n , then [ [ M ] ] ρ = ↓{ [Ψ σ i M [ x 1 := N 1 , . . . , x n := N n ]] op | i ≥ 0 , [ N j ] op ∈ ρ ( x j ) } . F or closed terms M we also wr ite [ [ M ] ] for [ [ M ] ] ⊥ . There are thr ee outstanding examples of f-mo dels: T h ere is the least f-mo del that con- sists of just the ideals denoting closed PCF-terms. There is the greatest f-mo del consisting of all ideals; this is Milner’s and Berry’s cp o-mo del. And there is the game mo del con- sisting of all d enotations of (infi nite) PCF-B¨ ohm-trees, i.e. th e sequent ial functionals. By Normann’s result [19] w e kno w th at the game mo d el is pr op erly b et ween the least and the greatest f-mo dels. No w we will collect the most imp ortan t prop erties of f-mo dels. In the follo wing the D σ are the domains of some f-mo del. Lemma 3.3. Every F σ i has finitely many elements. The semantics of the inf σ -terms ar e the glb-functions with r esp e ct to the or der ⊑ ; we write ⊓ f or these func tions. If d, e ∈ F σ i , then d ⊓ e ∈ F σ i . If d, e ∈ F σ i ar e c omp atible (b ounde d), i.e. ther e i s some a ∈ D σ with d ⊑ a and e ⊑ a , then ther e is a lub d ⊔ e ∈ F σ i . With this lemma w e can prov e: Prop osition 3.4. Al l D σ → τ ar e or der-extensional, i.e. : If f , g ∈ D σ → τ , then f ⊑ g ⇐ ⇒ ∀ d ∈ D σ . f d ⊑ g d ⇐ ⇒ ∀ d ∈ F σ . f d ⊑ g d Elemen ts of D σ → τ will b e identified with the corresp ondin g fun ctions. apply and these functions are all monotone. They are con tinuous with resp ect to certain d irected lubs, the f-lubs. Definition 3.5. The d irected s et S ⊆ D σ has the f-lub s ∈ D σ , written S → s , iff s is an upp er b ound of S and for all finite x ⊑ s th ere is some y ∈ S with x ⊑ y . (Th is is equiv alen t to: s is the set-theoretical union of S . s is also the lub of S w .r.t. ⊑ .) A function f : D σ → D τ is f-c ontinuous , iff it is monotone and r esp ects f-lub s of directed sets S ⊆ D σ , i.e. if S → s , then f S → f s . (With f S = { f x | x ∈ S } .) Prop osition 3.6. The apply op er ation is f - c ontinuous on the domain D σ → τ × D σ . (With c omp onent-wise or der and p airs of finite elements as finite elements.) Ther efor e apply is f-c ontinuous in e ach ar gument, and the functions of D σ → τ ar e f-c ontinuous. In [20] it is shown that in the game mo d el there are lubs of d irected sets th at are n ot f-lubs; and that there are finite elemen ts that are not compact in the usual sense with resp ect to general directed lub s. The f-lubs are exactly the directed lubs for w h ic h all functions are con tinuous: If we ha ve a directed lu b that is not an f-lub , th en this lub con tains a finite elemen t that is not con tained in the dir ected set. The PCF-fun ction that “observes” (or “tests”) this finite elemen t is a function that is not con tinuous for the directed set. In the greatest f-mo del all lubs of directed sets are f-lubs. If S → s in the greatest f-mo del, then the same holds in all f-mo dels that con tain s and the elemen ts of S . ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 9 In an f-mo del we can d efine natural lubs in the sense of Sazono v as h ereditarily p oin twise lubs. Then a dir ected set S has the f-lub s iff S has the natural lub s . Side remark: Here we must also men tion the “rational chains” of Escard´ o and Ho [8]. These are ascendin g sequences of PCF terms that can b e defined synt acticall y b y a PCF pro cedur e. The denotations (in any f-mo del) of th e elemen ts of a rational c hain alw a ys form a directed set with an f-lub (natural lub). The conv erse do es n ot hold generally . Prop osition 3.7. The semantic map of an f- mo del fulfil ls the usual e quations, i.e. the c onstants have their intende d me anings, and: [ [ λx.M ] ] ρd = [ [ M ] ] ρ [ x := d ] [ [ M N ] ] ρ = [ [ M ] ] ρ [ [ N ] ] ρ [ [ Y M ] ] ρ = G n ≥ 1 (([ [ M ] ] ρ ) n ⊥ ) Prop osition 3.8 (Berry , 3.6.11 in [4]) . Define the fu nctions ψ σ i = [ [Ψ σ i ] ] ⊥ : D σ → D σ . F or al l σ , ( ψ σ i ) is an i ncr e asing se quenc e of finite pr oje ctions with f-lub the identity id : ψ σ i ⊑ id ψ σ i ◦ ψ σ i = ψ σ i , with ◦ function c omp osition ψ σ i ⊑ ψ σ i +1 { ψ σ i | i ≥ 0 } → id ψ σ i ( D σ ) = F σ i Prop osition 3.9. Every f-mo del is ful ly abstr act for PCF: F or al l terms M , N of the same typ e ( ∀ ρ ∈ ENV . [ [ M ] ] ρ ⊑ [ [ N ] ] ρ ) ⇐ ⇒ M ⊑ op N . In the r est of this section we will defin e the stable order in f-mod els and collect the corresp ondin g prop erties th at will b e needed in this pap er. The definition of the s table ord er ≤ is giv en by Berry [4, 4.8.6, page 4-93] for the f ully abstract cp o-mo del as follo ws: F or d, e ∈ D ι : d ≤ e ⇐ ⇒ d ⊑ e F or f , g ∈ D σ → τ : f ≤ g ⇐ ⇒ ∀ x ∈ D σ . f x ≤ g x and ∀ x, y ∈ D σ . x ↑ ≤ y = ⇒ f x ⊓ g y = f y ⊓ g x (Here ↑ ≤ means compatibilit y w.r.t. ≤ .) This d efinition serves as well for our f-mo dels, but I prefer th e equiv alen t (w.r.t. the full t yp e hierarc hy) form: Definition 3.10 (stable order ≤ ) . F or d, e ∈ D ι : d ≤ e ⇐ ⇒ d ⊑ e F or f , g ∈ D σ → τ : f ≤ g ⇐ ⇒ ∀ x, y ∈ F σ . x ≤ y = ⇒ f x = f y ⊓ g x The order ≤ is extended p oint wise to environmen ts from ENV, here u sed in th e definition of ≤ on denotations: F or f , g ∈ ENV → D σ : f ≤ g ⇐ ⇒ ∀ ρ, ε ∈ ENV . ρ ≤ ε = ⇒ f ρ = f ε ⊓ g ρ 10 F. M ¨ ULLER The lubs w.r.t. ≤ will b e written ∨ and W , the glbs ∧ . Note that ⊓ is by defin ition the glb w.r.t. the extensional order ⊑ . But we can pr o ve the follo wing: Prop osition 3.11. In any actual f- mo del the fol lowing holds: F or f , g ∈ D σ : If f , g ar e ≤ -c omp atible in the gr e atest f -mo del, then f ⊓ g is also the glb w.r.t. ≤ . (Note: If f , g ar e ≤ -c omp atible in the actual f-mo del, then they ar e also c omp atible in the gr e atest f- mo del.) If f ≤ g then f ⊑ g . ≤ is a p artial or der on D σ . F or f , g ∈ D σ → τ : f ≤ g ⇐ ⇒ ∀ x ∈ D σ . f x ≤ g x and ∀ x, y ∈ D σ . x ≤ y = ⇒ f x = f y ⊓ g x The definition of ≤ c an b e given in “uncurrie d” form with ve ctors of ar guments, the or der ≤ e xtende d c omp onentwise: F or f , g ∈ D σ 1 → ... → σ n → ι : f ≤ g ⇐ ⇒ ∀ x 1 , y 1 ∈ D σ 1 , . . . , x n , y n ∈ D σ n . ( x 1 , . . . , x n ) ≤ ( y 1 , . . . , y n ) = ⇒ f x 1 . . . x n = f y 1 . . . y n ⊓ g x 1 . . . x n Pr o of. Th e pr o of that f ⊓ g is the glb w.r.t. ≤ (for ≤ -compatible f , g ) is b y indu ction on the type σ . It uses only the definition of ≤ and that ⊓ is the glb w.r.t. ⊑ , n o stabilit y (or conditional multi plicativit y) is used. Definition 3.12. f ∈ D σ → τ is c onditional ly multiplic ative (cm) if ∀ x, y ∈ F σ . x ↑ ≤ y = ⇒ f ( x ⊓ y ) = f x ⊓ f y Analogously for denotations f ∈ ENV → D σ . This definition can also b e giv en in “uncurr ied” form: f ∈ D σ 1 → ... → σ n → ι is cm iff ∀ x 1 , y 1 ∈ D σ 1 , . . . , x n , y n ∈ D σ n . ( x 1 , . . . , x n ) ↑ ≤ ( y 1 , . . . , y n ) = ⇒ f ( x 1 ⊓ y 1 ) . . . ( x n ⊓ y n ) = f x 1 . . . x n ⊓ f y 1 . . . y n Theorem 3.13 (Berry , 4.8.10 in [4]) . In an f-mo del, al l functions fr om domains D σ → τ ar e cm. Al l denotations [ [ M ] ] ar e cm. Pr o of. Berry fi rst prov es the prop ert y cm for the denotations of normal form terms b y induction on the size of the t yp e. Then it is extended to all functions by con tinuit y . Prop osition 3.14 (Berry [4], synta ctic monoton y w.r.t. ≤ ) . F or every c ontext C [ ] with hole of typ e σ , and terms M , N : σ : If [ [ M ] ] ≤ [ [ N ] ] then [ [ C [ M ]] ] ≤ [ [ C [ N ]] ] . Ther efor e, for terms M , N : σ : If M ≺ N then [ [ M ] ] ≤ [ [ N ] ] . W e will also write M ≤ N for [ [ M ] ] ≤ [ [ N ] ]. No w we sho w p rop erty I of ( D σ , ≤ ) and the representa tion of all fun ctions by traces, whic h is not con tained in Berr y ’s thesis. Prop osition 3.15. F or the finite pr oje c tions we have: ψ σ i ≤ ψ σ i +1 and ψ σ i ≤ id . The F σ i ar e downwar d close d w.r.t. ≤ : If d ∈ F σ i , e ∈ D σ and e ≤ d , then e ∈ F σ i . Ther efor e the domains ( D σ , ≤ ) have the pr op erty I: Ther e ar e only finitely many elements under e ach finite element. ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 11 Pr o of. Th e pro of of ψ σ i ≤ id is b y indu ction on the t yp e σ ; the induction step is in the pro of of prop osition 12.4.4 in the section on stable bifi nite domains of [2, p age 287]. The do wnw ard closedness of F σ i is an easy consequence and can b e found at the same place. Because of prop er ty I, all our f u nctions of D σ → τ (whic h are cm) are also stable, and therefore can b e represente d by traces. W e chose the tr ace of th e uncurr ied form. Definition 3.16. Let f ∈ D σ 1 → ... → σ n → ι , n ≥ 0, x i ∈ D σ i and f x 1 . . . x n = j for some in teger j . Then there are y i ∈ F σ i , y i ≤ x i , with f y 1 . . . y n = j and ( y 1 , . . . , y n ) is the ≤ -least vecto r with this prop erty . (This is the meaning of: f is stable.) In this case w e say th at y 1 7→ . . . 7→ y n 7→ j is a token of f . The set of all tok ens of f is called the tr ac e of f , written T ( f ). The y i in the toke n will b e represen ted b y tr aces again. W e will use a lib eral syntax for tok ens and traces, writing ⊥ for the trace ∅ , 0 for the trace { 0 } of 0 , and also 00 7→ 0 for the token { 0 }7→{ 0 }7→ 0 . If M is a closed term, w e w rite sim p ly T [ [ M ] ] f or the trace of its denotation [ [ M ] ] ⊥ . Prop osition 3.17. F or f , g ∈ D σ : f ≤ g iff T ( f ) ⊆ T ( g ) . If f , g ar e ≤ - c omp atible in the gr e atest f- mo del, then T ( f ⊓ g ) = T ( f ) ∩ T ( g ) . f ∈ D σ is finite of gr ade i , f ∈ F σ i , iff al l numb ers in the tr ac e of f ar e ≤ i . 4. Game Terms Berry’s conjectures demand the existence of certain fi nite PCF-terms. In this section w e sho w that we ma y restrict th ese finite terms to terms in a certain standard n ormal form that w e call game terms . Th is will simplify the pro ofs of the counte r-examples, and is also an int eresting result itself. Game terms firs t app eared in the literature on game semantics as terms r ep resen ting game s trategies; in [1 , section 3.2] th ey were called (fin ite and infi nite) “ev aluation trees”, in [11, section 7.3] “fin ite canonical forms” that corresp ond to compact inno cent strategie s , and in [2, section 6.6 ] “PCF B¨ ohm trees”. T h e textb o ok article on “PCF B¨ ohm tr ees” comes closest to our app roac h, as it introduces a semantics in the form of B¨ ohm trees and h as to solv e similar problems in the needed syntactic transformations. But we do not emplo y a (game or other) semantic s, i.e. we do not in terpret th e PCF- constan ts by infi nite strategies or B¨ ohm trees; our approac h is purely syn tactic. W e tak e a finite PCF-term, apply an op erator that resembles the finite pro jection Ψ σ i and reduce the resulting term to its game term form. W e sho w that the transforming reductions resp ect the synta ctic ord er ≺ (used in the refu tation of Berry’s second conjecture), and this will also enable us to pr o ceed to infin ite game terms. W e also introd uce a graphical r epresen tation of game terms that mak es the b eha viour of terms b etter visible. First w e in tro duce an additional new construct for the PCF language, for ev ery i ≥ 0: If M , N 0 , . . . , N i : ι , then case i M N 0 . . . N i : ι . Please n ote that case i is n ot a constan t, but the whole case-expression is a n ew construct of the language, it is no application. W e call the new terms (PCF-)case-te rms, and a case-term with all case-e xpressions as case i for fix ed i we call case i -term. The r eduction ru le for case i is: case i nN 0 . . . N i → N n , for 0 ≤ n ≤ i 12 F. M ¨ ULLER The case-expression is equiv alen t to a PCF-term: case i M N 0 . . . N i ∼ = if M then N 0 else i f pre 1 M t hen N 1 else . . . i f pre i M t hen N i else ⊥ This is the “filter” as it app ears in the fi nite pr o jection term Ψ ι i . So case i do es not enhance the expressiv eness of PCF. It is m erely a “macro” that is used as short expr ession for the filter term ab o ve, to k eep the unity of the filter term in the transformation to game terms. The synt actic order ≺ is defined on case-terms as follo ws: case i M N 0 . . . N i ≺ case j M ′ N ′ 0 . . . N ′ j iff i ≤ j, M ≺ M ′ and N k ≺ N ′ k for 0 ≤ k ≤ i. This is equiv alent to the syntactic order on the macro expansions of the case-expressions. Definition 4.1. Game terms are the w ell-t yp ed PCF-case-te rms that are fur thermore pro- duced by the follo wing grammar: M , N ::= ⊥ σ , σ any type λx 1 . . . x n .m, m inte ger constan t, n ≥ 0 λx 1 . . . x n . case i ( y M 1 . . . M m ) N 0 . . . N i , y v ariable, n , m, i ≥ 0 Please note that λx 1 . . . x n . v anishes for n = 0, s o n eeded for the N k of t yp e ι . A g ame term of gr ade i , i ≥ 0, is a game term that is a case i -term (every cas e is case i ) with all intege r constants ≤ i . (This en tails that a closed game term of grade i is a finite term of grade i .) A game term of pr e gr ade i , i ≥ 0, is a game term that is f urthermore pro duced by the follo wing grammar for th e non-terminal N : N ::= ⊥ σ , σ any type λx 1 . . . x n .m, m inte ger constan t, n ≥ 0 λx 1 . . . x n . case i ( y M 1 . . . M m ) N 0 . . . N i , y v ariable, all M k game term of grade i , n, m ≥ 0 (A game term of pregrade i is a case i -term.) Informally , w e call th e p ositions in a game term of inte ger constants at the top lev el, i.e. w here this integer serves as outpu t of the term, output p ositions . So a game term of pregrade i is a game term suc h that for all in teger co nstan ts m that are not in output p osition it is m ≤ i . (So the integ ers at outp ut p ositions are not restricted.) W e define a notion for the replacemen t of in tegers in output p ositions of game terms. Definition 4.2. Let P , L b e game terms, L : ι and l ≥ 0. W e defi n e P ⌈ l := L ⌉ by r ecursion on P : ⊥⌈ l := L ⌉ = ⊥ ( λx 1 . . . x n .l ) ⌈ l := L ⌉ = λx 1 . . . x n .L ( λx 1 . . . x n .m ) ⌈ l := L ⌉ = λx 1 . . . x n .m, for m 6 = l ( λx 1 . . . x n . case i ( y M 1 . . . M m ) N 0 . . . N i ) ⌈ l := L ⌉ = λx 1 . . . x n . case i ( y M 1 . . . M m ) N 0 ⌈ l := L ⌉ . . . N i ⌈ l := L ⌉ W e also write multiple r eplacemen ts, e.g. P ⌈ l := L l for l ≥ 0 ⌉ . T h ese multiple r eplacemen ts are done in parallel, the whole replacemen t mo ves d o wn the term. ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 13 W e will use a graphical represen tation of game terms in the next sections: A subterm λx 1 . . . x n . case i ( y M 1 . . . M m ) N 0 . . . N i is represent ed in the graph by a no de of the form: λ x 1 . . . x n . y M 1 . . . M m N 0 . . . N i The upp er parent of this no de is connected to the λ ; if the λ is missing, the up p er or left p aren t is connected to the y . The M 1 , . . . , M m are the le g s of y ; the N 0 , . . . , N i are th e arms of y . A leg or arm that p oints to a ⊥ is mostly rep resen ted s im p ly by a leg or arm p ointi ng to empty space. T his graphical repr esentati on mak es th e b eha viour of game terms m u c h b etter visible. Example: λf g. g g 0 1 f λx. x 0 1 2 2 This is the representa tion of the term: λf g. case 1 [ g ( case 1 ( g 0 ⊥ ) 1 ⊥ ) ⊥ ][ case 1 ( f ( λx. case 1 x 01 )) 22 ] ⊥ of type (( ι → ι ) → ι ) → ( ι → ι → ι ) → ι . It is a game term of pr e gr ade 1. The output p ositions are the t wo p ositions of the num b er 2 . If we r eplace the num b er 2 at the outpu t p ositions b y ⊥ , 0 or 1 , then w e get a game term of gr ade 1. Game terms are the real “medium” in which to inv estigate Berry’s p roblems: First, if one seeks terms M whic h h a ve many seman tically differen t syntac tic parts N ≺ M , according to Berry’s s econd conjecture, then one is naturally led to game terms, b ecause they h av e a v er y fin e syntact ic structure. Second, they simplify the pro ofs of the count er- examples. The cond itional alwa y s app ears together with a v ariable, cutting do wn the cases to b e analysed and simplifying the indu ction hyp otheses considerably . In the next subsection we dev elop a map gt σ i from finite terms to equiv alen t game terms suc h that M ≺ N : σ en tails gt σ i ( M ) ≺ gt σ j ( N ), w here M , N are of grade i resp. j , i ≤ j . This means that the refutation of Berry’s conjectures m ay b e r estricted to game terms. In the follo wing sub s ection we extend our result to infi nite game terms. They are needed for a full form ulation of Berry’s conjectures for first-order types (where they are v alid). 4.1. Finite Game T erm The orem. W e are giv en finite terms M ≺ N and w ant to fin d equiv alent game terms . First we must get r id of the Y s in th e terms. 14 F. M ¨ ULLER The map ω : PCF σ → P C F σ (for all typ es σ ) is tak en from [5, 4] and called the imme diate syntactic v alue : ω ( M ) =          λx 1 . . . x n .u ω ( M 1 ) . . . ω ( M m ) , if M = λx 1 . . . x n .uM 1 . . . M m with u a v ariable or constan t, i.e. M is in head normal form ⊥ else Please note here that a constan t is suc , p re , if , 0 , 1 , 2 , . . . A constan t is not ⊥ or Y . → β Y is the one-step reduction with the β -rule or the rule Y M → M ( Y M ) in any context. As is kno w n from [5, 4], if M → ∗ β Y N , then ω ( M ) ≺ ω ( N ). Lemma 4.3 (Appro ximation Lemma) . F or every finite term M ther e is a term N ′ such that M → ∗ β Y N f or some N , N ′ ≺ ω ( N ) , M ∼ = N ′ and N ′ is the ≺ -le ast term with this pr op erty. This uniqu e N ′ is c al le d app ro x( M ) . Pr o of. F or the fully abstract cp o-mo del (and therefore for all f-mo d els) the approximat ion con tinuit y theorem [5, theorem 4.3.1] is v alid: { [ [ ω ( N )] ] | M → ∗ β Y N } → [ [ M ] ] . The set on the left is d irected and M is fi nite, therefore th ere is N with M → ∗ β Y N and [ [ M ] ] = [ [ ω ( N )] ]. No w assume the t yp e of M , N is σ 1 → . . . → σ n → ι . T ake an y v ector of closed terms A 1 : σ 1 , . . . , A n : σ n with ω ( N ) A 1 . . . A n → ∗ m (in teger constant). By syn tactic stability [4, th eorem 2.8.8] [5, th eorem 3.6.7] there is a ≺ -least term N ∗ ≺ ω ( N ) w ith N ∗ A 1 . . . A n → ∗ m . T ak e as N ′ the ≺ -lub of all these N ∗ . Lemma 4.4. F or al l finite terms M ≺ N it is appr o x( M ) ≺ appr o x( N ) . Pr o of. Let M ′ b e a term with M → ∗ β Y M ′ and M ∼ = ω ( M ′ ). As the β -rule and th e Y -rule do not in volv e ⊥ , all these reductions M → ∗ β Y M ′ can also b e done in N . (If A ≺ B and A → β Y A ′ , th en there is B ′ with B → β Y B ′ and A ′ ≺ B ′ .) So there is N ′ with N → ∗ β Y N ′ and M ′ ≺ N ′ , and of course ω ( M ′ ) ≺ ω ( N ′ ). By confluence of → β Y there is N ′′ with N ′ → ∗ β Y N ′′ and N ∼ = ω ( N ′′ ). It is ω ( N ′ ) ≺ ω ( N ′′ ), ther efore ω ( M ′ ) ≺ ω ( N ′′ ). appro x( M ) is the least term X with X ≺ ω ( N ′′ ) and M ⊑ op X . appro x( N ) f u lfills the t wo cond itions for X , ther efore appro x( M ) ≺ app ro x( N ). No w w e ha v e finite terms app ro x( M ) ≺ appro x( N ) without Y . The n ext step is to apply a Ψ σ i -lik e op erator to the terms and redu ce according to some r eduction rules to game terms. The pr o of can b e done in differen t w ays: In m y fi rst v ersion I prov ed the termination of the reductions, formulated an inv arian t of th e (eta-expanded) term structure, pr ov ed the in v ariance un der the reductions and that they lead to game terms. This resu lted in an induction on the red uction sequence, the induction step done b y indu ction on th e term, causing m uch rewriting bureaucracy . (This ugly pro of is a v ailable as s upplementa ry material from m y home p age.) Here we will see a m ore elegan t half-sized pr o of based on an in duction on the term from th e b eginning, with th e aid of a reducibilit y predicate (see e.g. [24, theorem 3.1]). (Jim Laird also uses a r educibilit y predicate to pro du ce eta-expanded normal forms of a simply t yp ed λ -calculus with lifting (without inconsistent v alues) [12, prop osition 4.2].) ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 15 T o p ro du ce the game terms we define for ev ery i ≥ 0 a big-step reduction r elation M ↓ i N on case i -terms. The mere existence of the game terms could b e p r o ved without ↓ i , but we wan t to give an explicit d eterministic algo rithm. (Determinism is easily built in to b ig-step reduction.) The v alues for ↓ i , i.e. the terms that w e consid er as the results of reductions, are the game terms of pregrade i . Here are the rules for ↓ i . In the h yp othesis of a rule the abbreviation M ↓ i N g i means “ M ↓ i N and N is a game term of grade i ”, M ↓ i N pi means “ M ↓ i N and N is a game term of pregrade i ”. (0) n ↓ i n for all int eger constan ts n (1) M [ y := M 1 ] M 2 . . . M m ↓ i P ( λy .M ) M 1 M 2 . . . M m ↓ i P , for m ≥ 1 (2) ⊥ M 1 . . . M m ↓ i ⊥ , for m ≥ 0 (3) A ↓ i A ′ pi suc A ↓ i A ′ ⌈ m := m + 1 for m ≥ 0 ⌉ (4) A ↓ i A ′ pi p re A ↓ i A ′ ⌈ 0 := ⊥ , m := m − 1 for m ≥ 1 ⌉ (5) A k ↓ i A ′ k pi, for k = 1 , 2 , 3 if A 1 then A 2 else A 3 ↓ i A ′ 1 ⌈ 0 := A ′ 2 , m := A ′ 3 for m ≥ 1 ⌉ (6) A ↓ i A ′ pi, A ′ 6 = ⊥ λx 1 . . . x n . case i A 0 . . . i ↓ i λx 1 . . . x n .A ′ ⌈ k := ⊥ for k > i ⌉ , f or n ≥ 0 (7) A ↓ i ⊥ λx 1 . . . x n . case i A 0 . . . i ↓ i ⊥ , f or n ≥ 0 (8) A k ↓ i A ′ k g i, for 1 ≤ k ≤ m case i ( xA 1 . . . A m ) 0 . . . i ↓ i case i ( xA ′ 1 . . . A ′ m ) 0 . . . i , f or m ≥ 0 Remarks: Not for all case i -terms M : σ there is a v alue V with M ↓ i V , but there will b e a v alue V with Ψ σ i M ↓ i V for Ψ σ i suitably d efined. Th e redu ction relations are complete enough for the p urp oses of the follo wing pro ofs. S o to u n derstand the r eductions at this stage, ju st c heck the soundness of eac h rule separately , according to th e follo wing lemma, and do not b other ab out completeness. When you go th rough the subsequent pro ofs, y ou will see that exactly these rules are needed, no more, no less. Lemma 4.5 (soundn ess of the reduction relations ↓ i ) . F or al l case i -terms M , M ′ : If M ↓ i M ′ , then [ [ M ] ] = [ [ M ′ ] ] and M ′ is a value (i.e. a game term of pr e gr ade i ). Pr o of. T ranslate eac h reduction ru le into a rule with seman tic equiv alence instead of the reduction relation: T rans late statemen ts A ↓ i A ′ in to ([ [ A ] ] = [ [ A ′ ] ] and A ′ is a v alue), and k eep th e statemen ts g i and pi . Then c hec k eac h translated rule for v alidit y . 16 F. M ¨ ULLER No w we come to the redu cibility p r edicate. W e pac k all th at w e wan t to pr ov e in to its definition: the compatibilit y of the transform ation with the order ≺ and ev en the uniqueness of the reduction ↓ i . Definition 4.6 (redu cibilit y predicate) . Let i ≤ j , A a case i -term and B a case j -term of t yp e σ = σ 1 → . . . → σ n → ι , n ≥ 0. A ≺ B : σ are ( i, j )- tr ansformable , w r itten A ≺ B : σ ( i, j ), iff for all A l ≺ B l : σ l ( i, j ), 1 ≤ l ≤ n , there are game terms A ′ , B ′ : ι of pr egrade i resp. j with AA 1 . . . A n ↓ i A ′ and B B 1 . . . B n ↓ j B ′ , A ′ and B ′ are u nique for these reductions, and fur th ermore A ′ ≺ B ′ . Note that this definition do es n ot take care of the free v ariables of A, B . Not e also that it do es not demand the gr ade i, j of A ′ , B ′ , but th e pr e gr ade . So it will b e applicable to general terms that do not restrict the in teger constan ts, in lemma 4.9. Lemma 4.7. If A ≺ B : σ ( i, j ) , then ⊥ ≺ B : σ ( k , j ) for al l k ≤ j . Pr o of. Easy consequence of the definition of the red ucibilit y p redicate and of rule (2) f or ⊥ -application. F or the next lemma w e need a notion of sim u ltaneous su bstitution for PCF-terms that prop erly renames b oun d v ariables. W e tak e Allen Stough ton’s d efinitions [29 ]. A substitution is a function s, t from v ariables to terms (of th e t yp e of the v ariable). The su b stitution s [ x := N ] is d efined b y ( s [ x := N ]) x = N and ( s [ x := N ]) y = sy for y 6 = x . id is the iden tity substitution. If x is a v ariable, M a term, s a sub stitution, then w e define new xM s = { y | y v ariable and for all z ∈ F V ( M ) − { x } . y 6∈ F V ( sz ) } , where F V ( X ) is the set of free v ariables of term X . The simultane ous substitution M s of sx for the free o ccur rences of x in M , for all x , is defined b y stru ctural recursion on M : xs = sx, for ev ery v ariable x cs = c, for ev ery constan t c ( M N ) s = ( M s )( N s ) ( λx.M ) s = λy . ( M ( s [ x := y ])) , w ith y = c h oice(new xM s ) , where c hoice is a fixed f u nction that c ho oses some v ariable y from the argum en t set of v ariables. W e supp ose that the normal substitution (in the β -rule) b eha ves like th is: P [ y := N ] = P (id[ y := N ]) . Lemma 4.8. F or terms M , N , substitution s and variables x, y with y = choi ce(new xM s ) we have: ( M ( s [ x := y ]))[ y := N ] = M ( s [ x := N ]) Pr o of. F ollo ws from theorem 3.2 of [29]. ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 17 Lemma 4.9. L et A ≺ B : σ b e PCF-terms without Y . L et { x τ 1 1 , . . . , x τ m m } b e a sup erset of the fr e e variables of B . F or 1 ≤ k ≤ m let A ′ k ≺ B ′ k : τ k ( i, j ) b e case i - r esp. case j -terms that ar e ( i, j ) - tr ansformable. Define the substitutions s = id[ x 1 := A ′ 1 ] . . . [ x m := A ′ m ] and t = id[ x 1 := B ′ 1 ] . . . [ x m := B ′ m ] . Then As ≺ B t : σ ( i, j ) . Pr o of. By in duction on the term B . (Note: PCF-terms are without case .) Case B = B ∗ B 0 , B ∗ : σ 0 → σ 1 → . . . → σ n → ι , for n ≥ 0: First let A = A ∗ A 0 . By the induction hyp othesis we get A ∗ s ≺ B ∗ t : σ 0 → . . . σ n → ι ( i, j ) and A 0 s ≺ B 0 t : σ 0 ( i, j ). Let A l ≺ B l : σ l ( i, j ) for 1 ≤ l ≤ n . By the reducibilit y predicate there are game terms A ′ ≺ B ′ : ι of pregrade i resp. j with ( A ∗ s )( A 0 s ) A 1 . . . A n ↓ i A ′ ( B ∗ t )( B 0 t ) B 1 . . . B n ↓ j B ′ So As ≺ B t : σ ( i, j ). No w let A = ⊥ . By the same argument w e hav e B t ≺ B t : σ ( j, j ), therefore b y lemma 4.7: ⊥ ≺ B t : σ ( i, j ). Case B = λx.B ∗ : σ 1 → . . . → σ n → ι , n ≥ 1: First let A = λx.A ∗ . Let A l ≺ B l : σ l ( i, j ) for 1 ≤ l ≤ n . By the induction h yp othesis for B ∗ w e get A ∗ ( s [ x := A 1 ]) ≺ B ∗ ( t [ x := B 1 ]) : σ 2 → . . . → σ n → ι ( i, j ) . Therefore there are game terms A ′ , B ′ : ι of pregrade i resp. j with ( A ∗ ( s [ x := A 1 ])) A 2 . . . A n ↓ i A ′ ( B ∗ ( t [ x := B 1 ])) B 2 . . . B n ↓ j B ′ , with A ′ , B ′ unique and A ′ ≺ B ′ . By lemma 4.8 and the definition of substitution we get: A ∗ ( s [ x := A 1 ]) = ( A ∗ ( s [ x := y ]))[ y := A 1 ] , for y = choic e (new xA ∗ s ) B ∗ ( t [ x := B 1 ]) = ( B ∗ ( t [ x := z ]))[ z := B 1 ] , for z = c hoice (new xB ∗ t ) ( λx.A ∗ ) s = λy .A ∗ ( s [ x := y ]) ( λx.B ∗ ) t = λz .B ∗ ( t [ x := z ]) Then it reduces ( A ∗ ( s [ x := y ]))[ y := A 1 ] A 2 . . . A n ↓ i A ′ , and therefore by r u le (1): ( λy .A ∗ ( s [ x := y ])) A 1 A 2 . . . A n ↓ i A ′ , therefore ( λx.A ∗ ) sA 1 A 2 . . . A n ↓ i A ′ . Analogously: ( λx.B ∗ ) tB 1 B 2 . . . B n ↓ j B ′ . These reductions are unique, and A ′ ≺ B ′ . So As ≺ B t : σ ( i, j ). 18 F. M ¨ ULLER No w let A = ⊥ . By the same argument w e hav e B t ≺ B t : σ ( j, j ), therefore b y lemma 4.7: ⊥ ≺ B t : σ ( i, j ). Cases B = x (v ariable), B = n (int eger constan t), B = ⊥ are clear. F or B = n r u le (0) is used, for B = ⊥ ru le (2). F or th e sub cases A = ⊥ lemma 4.7 is used. Case B = if : First let A = i f . Let A l ≺ B l : ι ( i, j ) for 1 ≤ l ≤ 3. Then there are A l ↓ i A ′ l and B l ↓ j B ′ l ( A ′ l , B ′ l unique) with A ′ l ≺ B ′ l , for 1 ≤ l ≤ 3. It reduces b y rule (5): if A 1 then A 2 else A 3 ↓ i A ′ 1 ⌈ 0 := A ′ 2 , m := A ′ 3 for m ≥ 1 ⌉ if B 1 then B 2 else B 3 ↓ j B ′ 1 ⌈ 0 := B ′ 2 , m := B ′ 3 for m ≥ 1 ⌉ Both reductions are unique and the results are in relation ≺ . No w let A = ⊥ . By lemma 4.7 it is ⊥ ≺ if : σ ( i, j ). Cases B = s uc , B = pre : analogous to B = if . F or B = suc ru le (3) is used , for B = pre rule (4). Next we prov e a lemma that in tro duces the terms Ψ σ i in to the trans formation. F or the rest of this section w e redefine the finite pro jection terms Ψ σ i as equiv alen t case i -terms: Ψ σ 1 → ... → σ n → ι i = λf .λx 1 . . . x n . case i [ f (Ψ σ 1 i x 1 ) . . . (Ψ σ n i x n )] 0 . . . i, for n ≥ 0 . Lemma 4.10. F or al l typ es σ = σ 1 → . . . → σ n → ι the fol lowing thr e e pr op ositions ar e valid: (1) F or al l A ≺ B : σ ( i, j ) it is A (Ψ σ 1 i x 1 ) . . . (Ψ σ n i x n ) ≺ B (Ψ σ 1 j x 1 ) . . . (Ψ σ n j x n ) : ι ( i, j ) . (2) F or al l A ≺ B : σ ( i, j ) ther e ar e A ′ , B ′ : σ with Ψ σ i A ↓ i A ′ and Ψ σ j B ↓ j B ′ such that b oth ar e unique for this r e duction, and furthermo r e A ′ ≺ B ′ and they ar e game terms of grade i r esp. j . (3) F or al l v ariables x σ and i ≤ j : Ψ σ i x σ ≺ Ψ σ j x σ : σ ( i, j ) . Pr o of. By s imultaneous induction on the typ e σ . (1) By the induction h yp othesis for (3) we get Ψ σ k i x k ≺ Ψ σ k j x k : σ k ( i, j ), for 1 ≤ k ≤ n , and the prop osition follo w s . (2) The prop osition (1) means that th ere are game terms A ′′ , B ′′ : ι with pregrade i resp. j suc h that A (Ψ σ 1 i x 1 ) . . . (Ψ σ n i x n ) ↓ i A ′′ and B (Ψ σ 1 j x 1 ) . . . (Ψ σ n j x n ) ↓ j B ′′ , with A ′′ , B ′′ unique for this reduction and A ′′ ≺ B ′′ . If A ′′ = ⊥ then it reduces b y rule (7): λx 1 . . . x n . case i [ A (Ψ σ 1 i x 1 ) . . . (Ψ σ n i x n )] 0 . . . i ↓ i ⊥ and therefore by rule (1): Ψ σ i A ↓ i ⊥ . If also B ′′ = ⊥ , then lik ewise Ψ σ j B ↓ j ⊥ and the prop osition follo w s . (W e still ha ve A ′′ = ⊥ .) If B ′′ 6 = ⊥ then it reduces b y rule (6): λx 1 . . . x n . case j [ B (Ψ σ 1 j x 1 ) . . . (Ψ σ n j x n )] 0 . . . j ↓ j λx 1 . . . x n .B ′′ ⌈ k := ⊥ for k > j ⌉ = B ′ and ther efore b y rule (1): Ψ σ j B ↓ j B ′ , B ′ is a game term of grade j , and the prop osition follo ws. ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 19 If A ′′ 6 = ⊥ and B ′′ 6 = ⊥ , then w e get like th e last reduction b y ru les (6) and (1): Ψ σ i A ↓ i λx 1 . . . x n .A ′′ ⌈ k := ⊥ for k > i ⌉ = A ′ Ψ σ j B ↓ j λx 1 . . . x n .B ′′ ⌈ k := ⊥ for k > j ⌉ = B ′ Both reductions are unique, it is A ′ ≺ B ′ and they are game terms of grade i resp. j . (3) W e ha ve to pro ve that for all A l ≺ B l : σ l ( i, j ), 1 ≤ l ≤ n , there are game terms A ′ ≺ B ′ of pregrade i r esp . j with (Ψ σ i x ) A 1 . . . A n ↓ i A ′ and (Ψ σ j x ) B 1 . . . B n ↓ j B ′ (with uniqu eness of the reductions). By the induction h yp othesis of (2) for all l there are game terms A ′ l ≺ B ′ l : σ l of grade i resp. j with Ψ σ l i A l ↓ i A ′ l and Ψ σ l j B l ↓ j B ′ l (with uniqu eness of the redu ctions). It reduces b y rule (8) case i [ x (Ψ σ 1 i A 1 ) . . . (Ψ σ n i A n )] 0 . . . i ↓ i case i [ xA ′ 1 . . . A ′ n ] 0 . . . i = A ′ and therefore by rule (1): (Ψ σ i x ) A 1 . . . A n ↓ i A ′ Lik ewise it r educes b y rules (8) and (1): (Ψ σ j x ) B 1 . . . B n ↓ j case j [ xB ′ 1 . . . B ′ n ] 0 . . . j = B ′ A ′ , B ′ are ev en game terms of gr ade i resp. j . The reductions are unique. It is A ′ ≺ B ′ . Definition 4.11. Let A b e a case i -term without Y with A ≺ A : σ ( i, i ). The unique game term A ′ of grad e i with Ψ σ i A ↓ i A ′ is called pro j σ i ( A ). F or ev ery fin ite term M : σ we get app ro x( M ) without Y with app ro x( M ) ≺ app ro x( M ) : σ ( i, i ) b y lemma 4.9. (Note that finite terms are closed.) W e define the map gt σ i ( M ) = p r o j σ i (appro x( M )), for M : σ finite term of grade i . Theorem 4.12 (Game T erm Theorem) . If i ≤ j and M ≺ N : σ ar e finite PCF-terms of gr ade i r esp. j , then gt σ i ( M ) ≺ gt σ j ( N ) ar e game terms of gr ade i r esp. j with M ∼ = gt σ i ( M ) and N ∼ = gt σ j ( N ) . Pr o of. By lemma 4.3 and 4.4 we get app ro x( M ) ≺ app ro x( N ) without Y . By lemma 4.9 it is appro x( M ) ≺ app ro x( N ) : σ ( i, j ). By lemma 4.10 (2) p ro j σ i (appro x( M )) ≺ p ro j σ j (appro x ( N )) are game terms of grade i resp. j . F urther m ore M ∼ = Ψ σ i (appro x( M )) ∼ = pro j σ i (appro x ( M )) and lik ewise for N . 4.2. Infinite game terms. Definition 4.13. An infinite game term of type σ is an id eal of game terms of typ e σ (of an y grade), under the ord ering ≺ . (Infin ite game terms can b e constru ed as B¨ ohm trees with infi nite case -expressions, wh ic h w e write as case ∞ M N 0 N 1 . . . .) Th e order ≺ on infi nite game terms is the sub set order of the ideals. The semant ics (in some f-mo del) of an infinite game term is the lu b of the semantic s of th e members of its ideal, if the lu b exists in the f-mo del. Definition 4.14. Let M : σ b e a closed PCF-term. Ψ σ 0 M ≺ Ψ σ 1 M ≺ Ψ σ 2 M ≺ . . . is an ascending c hain of fin ite terms with ascending grade. Define gt σ ( M ) as the lub (in the order of infinite game terms) of the ascending c hain of game terms gt σ 0 (Ψ σ 0 M ) ≺ gt σ 1 (Ψ σ 1 M ) ≺ gt σ 2 (Ψ σ 2 M ) ≺ . . . . 20 F. M ¨ ULLER Theorem 4.15 (In finite Game T erm Theorem) . If M ≺ N : σ ar e close d PCF-terms, then gt σ ( M ) ≺ gt σ ( N ) ar e infinite game terms with [ [ M ] ] = [ [gt σ ( M )] ] and [ [ N ] ] = [ [gt σ ( N )] ] in any f - mo del. Pr o of. By p rop osition 3.8 it is [ [Ψ σ i M ] ] → [ [ M ] ], therefore [ [ M ] ] = [ [gt σ ( M )] ], and lik ewise [ [ N ] ] = [ [gt σ ( N )] ]. As gt σ i (Ψ σ i M ) ≺ gt σ i (Ψ σ i N ) for all i , we get gt σ ( M ) ≺ gt σ ( N ). 5. The s ynt actic order is not the image of the s t able order Berry’s s econd conjecture in its finite f orm s a ys that the stable order of the order-extensional fully abstract cp o-mo d el of PCF (our greatest f-mo del) has th e syn tactic order as its image: If a ≤ b f or finite a, b in the mo del, then there are norm al f orm terms A, B with [ [ A ] ] = a , [ [ B ] ] = b and A ≺ B . (The c h oice of the greatest f-mo del is not imp ortant, as all f-mo d els coincide on th eir finite parts.) In th is section w e will fir s t show that Berry’s second conjecture is v alid in first-order t yp es. Then w e give our simp lest coun ter-example in finitary PCF of second-order t yp e, a c hain of length 2. W e also giv e examples of c hains of an y finite length. F or fi rst-order t yp es Berry’s conjecture can b e strengthened to the in fi nite case: Theorem 5.1 (Berry , Theorem 4.1.7 and 4.8.1 4 in [4]) . L et σ b e a first-or der typ e, and b ∈ D σ in the gr e atest f-mo del. Then ther e is an infinite game term B with b = [ [ B ] ] . F urthermor e, f or al l such infinite g ame terms B and every subset t ⊆ T ( b ) ther e is an infinite game term A ≺ B with T [ [ A ] ] = t . (As infinite game term, A has a denotation in the gr e atest f-mo del.) Pr o of. Let σ = ι → ι → . . . → ι with n ≥ 1 arguments. In [4, 4.1.7] Berry shows that b ∈ D σ , as the lub of a growing sequence of fin ite sequent ial f unctions, is itself sequentia l. Ther efore: If b is not some constan t fun ction, then b is strict in some j -th argumen t. So B can b e recursiv ely constructed as infinite game term (with case ∞ the infinite case ) in the form: B = λx 1 . . . x n . case ∞ x j B 1 B 2 . . . , where B i is a term with free v ariables x 1 , . . . x j − 1 x j +1 . . . x n for the residual function b i giv en by b i x 1 . . . x j − 1 x j +1 . . . x n = bx 1 . . . x j − 1 ix j +1 . . . x n . In [4, 4.8.14 ] Berry sho ws th at A can b e constructed in the same manner B w as con- structed, i.e. follo wing th e same choic e of the v ariables for wh ic h the function is s trict. W e can describ e the constru ction of A differentl y by usin g traces: The tok ens of the trace T [ [ B ] ] corresp ond exactly to the branc hes of B that output a resu lt, i.e. do not lead to ⊥ . W e simply choose A ≺ B b y setting those branc h es of B that d o not corresp ond to a tok en in t to the empt y output ⊥ . ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 21 W e conjecture that Berry’s second conjecture is also true for second-order t yp es with parameters of arit y at most one: Conjecture 5.2. Let σ = σ 1 → . . . → σ n → ι with σ i = ι or σ i = ι → ι for all i . Let b ∈ F σ i b e a finite elemen t of grade i . Then there is a game term B of grade i for b , b = [ [ B ] ], such that for ev ery su bset t ⊆ T ( b ) that is secured in the sense of definition 2 of [7] there is A ≺ B with T [ [ A ] ] = t . (The trace of ev ery s emantic element is secured, so Berry’s second conjecture would b e fulfi lled for these t yp es.) The p ro of of this conjecture is in preparation. It needs a n ew theory of (PCF-)terms that w ould exceed the frame of this pap er. 5.1. Refutation of Berry’s second conjecture: A c hain of least length 2. Our simplest counter-example to Berr y’s second conjecture is in finitary PCF of second-order t yp e ( ι → ι → ι ) → ι . W e consider the follo win g game terms A, B , C, D : D = λg . g 0 g 1 1 0 0 B = λg . g g 1 1 0 g 1 1 0 0 C = λg . g g 1 1 0 0 A = λg . g g 1 1 0 g 1 1 0 D = λg . case 1 ( g 0 ( case 1 ( g 1 1 ) ⊥ 0 )) 0 ⊥ C = λg . case 1 ( g ⊥ ( case 1 ( g 1 1 ) ⊥ 0 )) 0 ⊥ B = λg . case 1 ( g ⊥ ( case 1 ( g 1 1 ) ⊥ 0 ))( case 1 ( g 1 1 ) 0 0 ) ⊥ A = λg . case 1 ( g ⊥ ( case 1 ( g 1 1 ) ⊥ 0 ))( case 1 ( g 1 1 ) ⊥ 0 ) ⊥ F or illus tration (not for the pro of ) w e give the trace seman tics of these terms: A  { 1 1 7→ 1 , ⊥ 0 7→ 0 }7→ 0 {⊥ 1 7→ 1 , ⊥ 0 7→ 0 }7→ 0 { ⊥⊥7→ 0 }7→ 0 { 0 ⊥7→ 0 }7→ 0 { 1 1 7→ 1 , 0 0 7→ 0 }7→ 0 { 1 ⊥7→ 1 , 0 0 7→ 0 }7→ 0 {⊥ 1 7→ 1 , 0 0 7→ 0 }7→ 0      B ∼ = C                          D 22 F. M ¨ ULLER W e ha ve A ≺ B ∼ = C ≺ D , therefore [ [ A ] ] ≤ [ [ D ] ]. W e will pr o ve that this chain of t wo steps of ≺ cannot b e replaced b y one single step. Pro of of the equiv alence B ∼ = C : F or an y argumen t g , if C g con verge s (i.e. red uces to an integ er constan t), then the subterm g 11 of C con v erges also. (There are only t w o p ossibilities f or g : either T ( g ) = {⊥⊥7→ 0 } , or g demand s its second argument.) Ther efore it is p ossible to safely replace the result 0 in C by the term case 1 ( g 11 ) 00 , i.e. to “lift” g 11 to the top lev el. It is imp ortant to notice that this tr ansformation cannot b e p erformed with D : Here there are more p ossibilities f or g to make D g con verge . It migh t b e that T ( g ) = { 0 ⊥7→ 0 } , then the subterm g 11 d o es not conv erge. The in tu ition of the example: W e start with term D , working down wa rds step by step to A eliminating tok en s of the trace. First the tok en { 0 ⊥7→ 0 }7→ 0 is eliminated getting C (and the other tok en s with g demand ing its first argument 0 ). T hen it b ecomes p ossible to lift g 11 , we get B ∼ = C . Next we eliminate the tok en {⊥⊥7→ 0 }7→ 0 in B to get A . This is done by “forcing” the ev aluation of the second argument of g , by demandin g that g deliv ers differen t results for differen t argument s. Prop osition 5.3. L e t A, D b e the game terms of gr ade 1 ab ove. Ther e ar e no game terms A ′ , D ′ of gr ade 1 with A ′ ≺ D ′ and A ′ ∼ = A , D ′ ∼ = D . Then by the game term the or em 4.12 ther e ar e no PCF-terms A ′ , D ′ with this pr op erty. Sinc e we have se en that [ [ A ] ] ≤ [ [ D ] ] , the pr op osition r efutes Berry’s se c ond c onje ctur e. Pr o of. As game terms of grade 1, A ′ and D ′ should b e of the form λg .S , where S : ι is a game term p ossibly with the only free v ariable g . W e abbreviate S [ g := M ] as S [ M ]. Let R, P , Q : ι → ι → ι b e the follo wing terms: R = λxy . cas e 1 y 0 ( case 1 x ⊥ 1 ) , T [ [ R ] ] = { 11 7→ 1 , ⊥ 0 7→ 0 } P = λxy . 0 , T [ [ P ] ] = {⊥⊥7→ 0 } Q = λxy . case 1 x 0 ⊥ , T [ [ Q ] ] = { 0 ⊥7→ 0 } W e will pro ve: F or an y terms S, S ′ of th e form ab ov e, if S ′ ≺ S and S [ Q ] → ∗ 0 and S ′ [ R ] → ∗ 0 , then S ′ [ P ] → ∗ 0 . The prop osition follo ws from this claim, as D Q → ∗ 0 and AR → ∗ 0 , but n ot AP → ∗ 0 . The pro of of the claim is b y induction on the term S : The cases S = ⊥ , 0 , 1 are clear. Let S = case 1 ( g S 1 S 2 ) S 3 S 4 and S ′ ≺ S with S ′ = case 1 ( g S ′ 1 S ′ 2 ) S ′ 3 S ′ 4 . (The r emaining case S ′ = ⊥ is clear.) Supp ose S [ Q ] → ∗ 0 and S ′ [ R ] → ∗ 0 . T hen S 1 [ Q ] → ∗ 0 . R and Q are compatible in the Scott mo del of all conti n uous functions, the “parallel or” is an upp er b ound. Exp r essed differentl y , R and Q are compatible in the sense that they pro du ce compatible integ er results for the same argument. Therefore the seman tics of S 1 [ R ] and S 1 [ Q ] m ust b e compatible, so it is not p ossib le that S 1 [ R ] → ∗ 1 . As S ′ 1 ≺ S 1 , it is also not p ossible that S ′ 1 [ R ] → ∗ 1 . Therefore ( g S ′ 1 S ′ 2 )[ R ] → ∗ 0 (it m u st con v erge to get S ′ [ R ] → ∗ 0 ). Hence S ′ [ R ] → ∗ S ′ 3 [ R ] → ∗ 0 . On the other side w e ha ve S [ Q ] → ∗ S 3 [ Q ] → ∗ 0 . T oge ther w e ha ve S 3 [ Q ] → ∗ 0 and S ′ 3 [ R ] → ∗ 0 , and by the induction hypothesis for S 3 ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 23 follo ws: S ′ 3 [ P ] → ∗ 0 . Therefore S ′ [ P ] → ∗ S ′ 3 [ P ] → ∗ 0 . Remark 5.4. As we base our pro of on game terms, we ga v e a sp ecial indu ction hyp othesis for the com bin ation of case 1 and g . The pr o of for general normal form terms is more complicated as it must w ork with if and g separately and use a more general ind uction h y p othesis, i.e. one pro ves by induction on S : If S ′ ≺ S, then [ [ S [ Q ]] ] = [ [ S ′ [ R ]] ] = [ [ S ′ [ P ]] ] or [ [ S [ Q ]] ] = ⊥ or [ [ S ′ [ R ]] ] = ⊥ This has on the surface the form of the Sieb er sequ en tialit y logical relation S 3 { 1 , 2 }{ 1 , 2 , 3 } , see [28]. (It is ( d 1 , d 2 , d 3 ) ∈ S 3 { 1 , 2 }{ 1 , 2 , 3 } iff d 1 = d 2 = d 3 or d 1 = ⊥ or d 2 = ⊥ .) This f orm on the surface is resp onsible for the fact that the ind uction hyp othesis go es up th rough th e case S = if S 1 then S 2 else S 3 . But for the pro of of the case S = g S 1 S 2 the sp ecific semantic s of R, P , Q and th e fact S ′ ≺ S are needed. So a sequential it y r elation alone is not s ufficien t to prov e this counte r-example: a logical relation is a semantic means to pro v e the und efinabilit y of a function. But here w e must pro ve the und efinabilit y of S ′ ≺ S for t wo f unctions [ [ A ] ] ≤ [ [ D ] ], where b oth functions separately are d efinable. At first sight this necessitates a syntactic pr o of. But we could ask th e qu estion: Are there semantic means to p ro ve this? Are there necessary semanti c conditions for the synta ctic order that are stronger than the condition of stable ord er? S ee also the remark in the last section “Outlo ok”. 5.2. Chains of any length. W e h a ve seen an example of a c h ain of t wo ≺ -steps. Generally: Definition 5.5. Let a ≤ b b e finite elemen ts in an f -mo del. A chain of length n ≥ 1 b etwe en a and b is a pair of sequences of terms ( C i ) , ( D i ) with 1 ≤ i ≤ n and a = [ [ C 1 ] ], b = [ [ D n ] ] and C i ≺ D i , D i ∼ = C i +1 . If a = b , then w e say th er e is a c h ain of length 0 b et w een a and b . A chain is of le ast length n if there is no shorter c h ain. By the game term theorem, if there is a c hain of PCF-terms, then there is an equ iv alent c hain of game terms. No w we construct examples of c h ains of least length n + 1 for an y fin ite n ≥ 0, b y a sequen tial comp osition of n copies of our first example, eac h cop y for a different argum ent g i . F or every n ≥ 0 let σ n b e the type ( ι → ι → ι ) → . . . → ( ι → ι → ι ) → ι with n parameters. F or every n w e d efi ne t wo sequences of game terms C i n , D i n : σ n with 0 ≤ i ≤ n . First w e define b y ind uction on n the v ersions ¯ C i n , ¯ D i n without λ -binder: ¯ D 0 0 = 0 ¯ D n +1 n +1 = g n +1 0 g n +1 1 1 0 ¯ D n n ¯ D i n +1 = g n +1 g n +1 1 1 0 g n +1 1 1 ¯ D i n ¯ D n n for i ≤ n 24 F. M ¨ ULLER ¯ C 0 0 = ⊥ ¯ C n +1 n +1 = g n +1 g n +1 1 1 0 ¯ D n n ¯ C i n +1 = g n +1 g n +1 1 1 0 g n +1 1 1 ¯ C i n ¯ D n n for i ≤ n W e define C i n = λg n . . . g 1 . ¯ C i n and D i n = λg n . . . g 1 . ¯ D i n . F or all n ≥ 0, 0 ≤ i ≤ n : C i n ≺ D i n . The p r o of is an easy induction on n . F or all n ≥ 1, i < n : D i n ∼ = C i +1 n . Proof by ind uction on n : F or n = 1, i = 0 we ha ve that D 0 1 is the term B , and C 1 1 the term C of our former example, b oth only with g replaced by g 1 . F or n := n + 1: F or i = n we ha ve D n n +1 ∼ = C n +1 n +1 b y the same argument as in our form er example for B ∼ = C . F or i < n w e get D i n +1 ∼ = C i +1 n +1 b y the induction h yp othesis. All together for an y n ≥ 0 we get a chain of length n + 1 b et ween [ [ C 0 n ] ] and [ [ D n n ] ]: C 0 n ≺ D 0 n ∼ = C 1 n ≺ D 1 n . . . D n − 1 n ∼ = C n n ≺ D n n . W e w ant to p ro ve that this chain h as the least length. First the int uition of the example: W e u se the terms R , P , Q of th e pro of of pr op osition 5.3 and name their traces: r = T [ [ R ] ] = { 11 7→ 1 , ⊥ 0 7→ 0 } , p = T [ [ P ] ] = {⊥⊥7→ 0 } , q = T [ [ Q ] ] = { 0 ⊥7→ 0 } The trace of D n n con tains all tok ens p . . . pq . . . q 7→ 0 , with j argum ents p , 0 ≤ j ≤ n . These tok ens are in the u pp er br anc h of D n n . W e work down from D n n eliminating all these tok ens in n + 1 s teps. In the j -th step (0 ≤ j ≤ n ) the tok en p . . . pq . . . q 7→ 0 , with j arguments p , is eliminated in D n − j n . (In D n − j n all the tok en s of this form with less argumen ts p ha v e already b een eliminated.) If j < n w e pro ceed as f ollo ws: F ollo wing the up p er br anc hes in D n − j n w e come to an o ccurrence of th e v ariable g n − j . It is the ro ot of a subterm ¯ D n − j n − j , its upp er arm is ¯ D n − j − 1 n − j − 1 . T he elimination is by setting the fi rst argument of this g n − j to ⊥ , getting C n − j n . Only then it is p ossible to lift the lo w er g n − j 11 to the top leve l, get ting D n − j − 1 n . There the n ew g n − j 11 at the top lev el gets t wo arm s which are copies of ¯ D n − j − 1 n − j − 1 . The lo w er arm (of these t w o) sta ys the same in the follo wing tr an s formations (it contai ns the tok en p . . . p r q . . . q 7→ 0 with j arguments p ). The u pp er arm undergo es further eliminations of tok ens p . . . pq . . . q 7→ 0 . These further eliminations are only p ossible after the separation of the t wo arms . Finally in the n -th s tep the 0 which stands at th e end of the upp er branc hes of D 0 n is set to ⊥ getting C 0 n , eliminating the tok en p . . . p 7→ 0 . Prop osition 5.6. L et n ≥ 0 and C i n , D i n b e the terms define d ab ove. Then the chain C 0 n ≺ D 0 n ∼ = C 1 n ≺ D 1 n . . . D n − 1 n ∼ = C n n ≺ D n n b etwe en [ [ C 0 n ] ] and [ [ D n n ] ] has the le ast length n + 1 . ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 25 Pr o of. W e assu me n ≥ 1 and su pp ose an y chain b et ween C 0 n and D n n and lo ok at an in termed iate ≺ -step of this c hain, i.e. w e h a ve the situation C 0 n ≤ M ≺ N ≤ D n n . W e assum e th at some tok en of the form p . . . pq . . . q 7→ 0 is eliminated in this step. Let t b e suc h token with the minimal n umber j of argumen ts p , and assume j < n . Then w e h a ve N P . . . P Q . . . Q → ∗ 0 , and M P . . . P RQ . . . Q → ∗ 0 , b ecause C 0 n ≤ M (b oth w ith j argumen ts P ). W e can ab s tract the ( j + 1)st argument in these terms and build the terms N ′ = λg .N P . . . P g Q . . . Q and M ′ = λg .M P . . . P g Q . . . Q. It is M ′ ≺ N ′ . W e can transform M ′ , N ′ to game terms and apply th e argument in the pro of of prop osition 5.3 to dedu ce: M ′ P → ∗ 0 . So M P . . . P P Q . . . Q → ∗ 0 (with j + 1 argumen ts P ). As Q ⊑ op P , we also hav e M P . . . P Q . . . Q → ∗ 0 for all k ≥ j + 1 argumen ts P . All these argument s of M are minimal w.r.t. the stable ord er, b ecause th ey are also minimal for D n n and it is M ≤ D n n . Therefore ev ery token p . . . pq . . . q 7→ 0 with k ≥ j + 1 argumen ts p is in M . This sho ws that from the tok ens of the form p . . . pq . . . q 7→ 0 only the tok en t is eliminated in th e step M ≺ N . (F or j = n this is trivially the case.) As th er e are n + 1 of these tok ens to b e eliminated, the c h ain m ust ha ve at least n + 1 steps. Our example of a chain of least length n + 1 has n f u nctional parameters g i of arity 2 and is of grad e 1. W e could transf orm it in to an “equiv alen t” example with only one functional parameter g of arit y 3 and terms of grade n , by co din g g i M N as g iM N . Our results suggest an improv ement of Berry’s second conjecture: Conjecture 5.7 (Ch ain Conjecture) . If a ≤ b are finite elemen ts in an f-mo del, then th er e is a c hain b et ween a and b . W e will refute also this conjecture in section 7. 6. The s t able order is not bounded complete : no bidom ain G ´ erard Berry sho wed that the fu lly abstract ord er-extensional cp o-mo del of PCF (our great- est f-mo del) together with the s table ord er forms a bicp o, and conjectured that it is also a bidomain (Berry’s fir st conjecture). Here w e rep eat the definitions of b oth str uctures. W e pro ve th e conjecture for fir st-order types. Then we refu te th e general conjecture. Our first example is the stable lub of tw o finite elements for whic h the distribu tiv e la w is n ot v alid. Our second example consists of t wo finite elemen ts with stable upp er b oun d but without stable lub. Bot h examples are in PC F of second-ord er type of grade 2. Definition 6.1 (Berry: 4.7 .2 in [4]) . A bicp o is a structure ( D , ⊑ , ≤ , ⊥ ) suc h that: (1) The stru cture ( D , ⊑ , ⊥ ) is a cp o with least element ⊥ and with a con tinuous glb-function ⊓ . (2) The structure ( D , ≤ , ⊥ ) is a cp o with least element ⊥ su c h th at a ≤ b = ⇒ a ⊑ b and for all ≤ -directed sets S the t wo lubs are equal: W S = F S . (3) The function ⊓ is ≤ -monotonic. (With (1) and (2) it follo ws that it is ≤ -cont in u ous.) 26 F. M ¨ ULLER (4) F or all ≤ -directed sets S and S ′ : If for all a ∈ S , a ′ ∈ S ′ there are b ∈ S , b ′ ∈ S ′ with a ⊑ b , a ′ ⊑ b ′ , b ≤ b ′ , then F S ≤ F S ′ . In a bicp o: F or all a ↑ ≤ b , a ⊓ b is also the glb w.r.t. ≤ . Theorem 6.2 (Berry: 4.8.10 in [4]) . The domains ( D σ , ⊑ , ≤ , ⊥ ) of the ful ly abstr act or der- extensional cp o-mo del of PCF ar e bicp os. Definition 6.3 (Berry: 4.4 .10 in [4]) . A cp o ( D , ≤ , ⊥ ) is distributive if (1) it is b ound ed complete (This means that for a ↑ ≤ b there is a lub a ∨ b . And this entail s with completeness that there is also a glb a ∧ b for all a, b , ev en for ≤ -incompatible ones.) and (2) for all a, b, c ∈ D with b ↑ ≤ c : a ∧ ( b ∨ c ) = ( a ∧ b ) ∨ ( a ∧ c ). Definition 6.4 (Berry: 4.7.9 in [4]) . A b icp o ( D , ⊑ , ≤ , ⊥ ) is distributive if ( D, ≤ , ⊥ ) is distributive and for all a ↑ ≤ b : a ∨ b is also the lub w.r.t. ⊑ . (Please note that in a distribu tive bicp o only for a ↑ ≤ b it m us t b e a ∧ b = a ⊓ b .) Definition 6.5 (Berry: 4.7.12 in [4]) . A d istributiv e b icp o ( D , ⊑ , ≤ , ⊥ ) is a bidomain if there is a ≤ -gro wing sequence ( ψ i ) i ≥ 1 of fin ite pro jections w.r.t. ≤ and with lub W ψ i = id. (This means: ψ i : D → D is con tin u ous w.r.t. ⊑ and ≤ , ψ i ≤ id , ψ i ◦ ψ i = ψ i , ψ i ≤ ψ i +1 , ψ i ( D ) finite, W ψ i = id.) In this definition th e sequen ce ( ψ i ) is also a ⊑ -gro wing sequence of finite pro jections w.r.t. ⊑ and with lub id. T oget her with th e the glb-function ⊓ it follo ws that ( D , ⊑ , ⊥ ) is a Scott domain, a b ound ed complete ω -alge braic cp o. As we ha ve explained in prop osition 3.8 and 3.15, the conditions for ( ψ i ) in the defin ition of bidomain are fulfilled for the fully abstract order-extensional cp o-mod el (and fur thermore for all f-mo d els) by the pr o jections ψ σ i . I n fact the ( D σ , ≤ ) are stable ω -bifinite domains for the cp o-mo del, in the sense of defin ition 12.4.3 of [2 ]. T o b e pr ecise, the condition of distribu tivity of the stable order was n ot conjectured by Berry in his thesis; there he remained agnostic. But in the state-of-t he-art p ap er [5] w e can read: “Unfortun ately we are not able to show th at the domains of the fu lly abstract mo del are bidomains, although w e defin itely b eliev e it; the p roblem is to sho w that the ≤ cm -lubs are tak en p oin twise.” First w e clarify the situation for firs t-order t yp es: Theorem 6.6. L et σ b e a first-or der typ e and ( D σ , ⊑ , ≤ , ⊥ ) b e the c orr esp onding dom ain of any f- mo del. The finite elements of D σ fulfil l distributivity w.r.t. ≤ in D σ in the fol lowing sense: F or a, b ∈ F σ the glb in D σ exists and is gi v en by T ( a ∧ b ) = T ( a ) ∩ T ( b ) . F or a, b ∈ F σ with a ↑ ≤ b the lub in D σ exists and is given by T ( a ∨ b ) = T ( a ) ∪ T ( b ) . It is taken p ointwise and it is also the lu b w.r.t. ⊑ . Then the distributive law is fulfil le d by set the ory on tr ac es. If D σ c ontains a denotation for e very infinite game term of typ e σ (this is the c ase for the game mo del and every gr e ater f-mo del), then D σ is the domain of the gr e atest f-mo del. In this c ase al l elements a, b ∈ D σ fulfil l distributivity in the sense ab ove. Ther efor e D σ is a bidomain i n this c ase. ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 27 Pr o of. Let a, b ∈ F σ . W e can apply theorem 5.1 and get a game term A with a = [ [ A ] ], and a game term C ≺ A with T [ [ C ] ] = T ( a ) ∩ T ( b ). Define a ∧ b = [ [ C ] ]; it is fin ite and th er efore in D σ . No w let a ↑ ≤ b , i.e. there is some d with a ≤ d and b ≤ d . By theorem 5.1 there are an infin ite game term D w ith d = [ [ D ] ], and finite game terms A, B w ith a = [ [ A ] ], b = [ [ B ] ], A ≺ D , B ≺ D . T ak e the synt actical lub E of A and B . It is T [ [ E ] ] = T [ [ A ] ] ∪ T [ [ B ] ], b ecause in fi rst-order game terms bran ches corresp ond to tok en s. Define a ∨ b = [ [ E ] ]; it is fin ite and therefore in D σ . This lub is p oin twise on the uncurried argument and therefore also the lub w.r.t. ⊑ . If D σ con tains a denotation for every in fi nite game term of t yp e σ , then by theorem 5.1 D σ is exactly the domain of the greatest f-mo del. The construction of a ∧ b and a ∨ b for an y a, b ∈ D σ is as ab o ve, only with infinite game terms. Conjecture 6.7. F or all t yp es of the form σ = σ 1 → . . . → σ n → ι , with σ i = ι or σ i = ι → ι , Berry’s first conjecture is v alid, i.e. D σ is a bidomain in the greatest f-mo del. The pro of of this conjecture is in preparation. It relies on the conjecture 5.2. No w w e p ro ve some p r op erties of s table u pp er b ounds (sub) in f-mo d els. (These are prop erties that are also v alid in stable bifin ite domains, see lemma 12.4.7 in [2].) Theorem 6.8. L et D σ b e a domain of an f- mo del, σ = σ 1 → . . . → σ n → ι , n ≥ 0 . L et X b e a finite set of finite elements of D σ that has a stable upp er b ound (su b ) in D σ . L et m b e the maximal gr ade of the elements of X . F or every sub x of X ther e is a unique minimal (w.r.t. ≤ ) sub y of X with y ≤ x . Every minimal sub of X is finite of gr ade m ; they ar e p airwise ≤ - inc omp atible. The extensional lub F X is one of those. Pr o of. Let x b e a sub of X . Then the pro jection ψ σ m x is also a sub of X . Let Z b e the set of all su bs z of X with z ≤ ψ σ m x ; it is a n on-empt y finite set of fi nite elemen ts. Then y = d Z is the d esired unique minimal sub of X with y ≤ x . Let a, b b e t w o minimal subs of X th at are ≤ -compatible. Then a ⊓ b is also a sub of X , therefore a = b . Let g = F X and h some sub of X . W e hav e to show that f ≤ g for every f ∈ X . This is clear for n = 0, in the t yp e ι . No w let n > 0 and ~ x , ~ y b e t wo v ectors of arguments of type σ 1 × . . . × σ n with ~ x ≤ ~ y . W e ha ve to sh o w th at f ~ x = f ~ y ⊓ g ~ x . It is f ~ x = f ~ y ⊓ h~ x ⊒ f ~ y ⊓ g ~ x . And f ~ x ⊑ f ~ y ⊓ g ~ x is clear. This sho ws that g is a sub of X ; of cour se it is also minimal w.r.t. ≤ . 6.1. A st able lub wit hout distributivit y. Ou r first counter-example to Berry’s first conjecture is of typ e ( ι → ι → ι ) → ι and of grade 2. W e consider the follo wing game terms A, B , C , where we u se a case 1 for a case 2 with the third arm ⊥ : ¯ A = g 1 2 g 0 0 ¯ B = g 1 1 g 0 0 C = λg . g ¯ A ¯ B 0 A = λg . ¯ A B = λg . ¯ B Here are the traces of these terms: 28 F. M ¨ ULLER A  B  { 0 ⊥7→ 0 , 1 2 7→ 1 }7→ 0 { 0 ⊥7→ 0 , 1 ⊥ 7→ 1 }7→ 0 {⊥ 0 7→ 0 , 1 1 7→ 1 }7→ 0 {⊥ 0 7→ 0 , ⊥ 1 7→ 1 }7→ 0 {⊥⊥7→ 0 }7→ 0                C It is A ≤ C and B ≤ C . W e w ill sho w that C is the stable lub of A and B . The in tuition of the example: A and B do not con tain the tok en {⊥⊥7→ 0 }7→ 0 , b ecause their t wo o ccur rencies of g are forced to ev aluate their first resp. second argumen t, to get d ifferen t results for d ifferen t argumen ts. (Th is is the same tric k that was used in the preceding section.) C adds to the tok ens of A and B ju st the tok en {⊥⊥ 7→ 0 }7→ 0 , to separate ¯ A and ¯ B . (Note that a g for wh ic h C g conv erges cannot demand b oth its argumen ts 00 .) Therefore this lub d o es not fulfill distribu tivit y . In C it is not p ossible to lift a differing term g M N to th e top lev el that w ould eliminate that tok en, b ecause the fiv e o ccurrences of g in C cann ot b e “unified” to a common term that wo uld alw ays con verge . Prop osition 6.9. L et A, B , C b e the game terms ab ove. [ [ C ] ] i s the stable lub of a = [ [ A ] ] and b = [ [ B ] ] . L et d b e the finite element with the tr ac e {{⊥⊥7→ 0 }7→ 0 } . Then d ∧ ( a ∨ b ) 6 = ( d ∧ a ) ∨ ( d ∧ b ) . This r efu tes B e rry’s first c onje ctur e . Pr o of. By the game term theorem 4.12 and the pr eceding theorem 6.8, ev ery minim al sub of A and B can b e r epresen ted by a game term of grade 2. S uc h a game term is of the form λg .S , w h ere S : ι is a game term p ossibly with the only fr ee v ariable g . W e abb reviate S [ g := M ] as S [ M ]. W e use the follo wing terms as argum en ts: Q = λxy . case 1 x 0 ( case 2 y ⊥⊥ 1 ) T [ [ Q ] ] = { 0 ⊥7→ 0 , 12 7→ 1 } R = λxy . cas e 1 y 0 ( case 1 x ⊥ 1 ) T [ [ R ] ] = {⊥ 0 7→ 0 , 11 7→ 1 } P = λxy . 0 T [ [ P ] ] = {⊥⊥7→ 0 } Q and R are compatible in the sense that they pro du ce compatible results for the same argumen t. W e will pro ve that for an y term S of the form ab o ve: If S [ Q ] → ∗ 0 and S [ R ] → ∗ 0 , then S [ P ] → ∗ 0 . The pro of is by induction on the term S : The cases S = ⊥ , 0 , 1 , 2 are clear. Let S = case 2 ( g S 1 S 2 ) S 3 S 4 S 5 . F or S [ Q ] → ∗ 0 it m u st b e S 1 [ Q ] → ∗ 0 or S 2 [ Q ] → ∗ 2 . (1) case S 1 [ Q ] → ∗ 0 : F or S [ R ] → ∗ 0 it m u st b e S 2 [ R ] → ∗ 0 or S 1 [ R ] → ∗ 1 . (1.1) case S 2 [ R ] → ∗ 0 : W e ha ve S [ Q ] → ∗ S 3 [ Q ] → ∗ 0 and S [ R ] → ∗ S 3 [ R ] → ∗ 0 . By the induction h yp othesis for S 3 w e get S 3 [ P ] → ∗ 0 , therefore S [ P ] → ∗ 0 . (1.2) case S 1 [ R ] → ∗ 1 : This is not p ossib le, as Q and R are compatible in the sense ab o ve . (2) case S 2 [ Q ] → ∗ 2 : F or S [ R ] → ∗ 0 it m u st b e S 2 [ R ] → ∗ 0 or S 2 [ R ] → ∗ 1 . Both cases are not p ossible, as Q and R are compatible in the sense ab ov e. ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 29 So w e ha v e sho wn that for ev ery ⊑ -up p er b ound D of grade 2 of A and B it must b e D P → ∗ 0 . F or a ≤ -upp er b ound it cann ot b e D ⊥ → ∗ 0 . T h erefore P is a ≤ -minimal argumen t to fulfill D P → ∗ 0 . This means: Any minimal stable u p p er b ound of A and B m u st con tain the toke n {⊥⊥7→ 0 }7→ 0 . So C is the s table lub of A and B . (It is also the ⊑ -lub.) Remark 6.10 (alternativ e pro of w ith Sieb er sequen tialit y relation) . Because we work in the pro of ab o v e on game terms, the induction h yp othesis is simpler and the pr o of sh orter than a pro of by indu ction on general terms. A short pu rely seman tic pr o of for general terms is p ossible with a Sieb er sequentiali t y logical relation [28]. W e can sh o w that there is no definable function that fulfills the v alue table [ [ Q ] ] 7→ 0 , [ [ R ] ] 7→ 0 , [ [ P ] ] 7→ n for n 6 = 0 . W e use the sequential it y relation r el = S 3 { 1 , 2 }{ 1 , 2 , 3 } . F or d 1 , d 2 , d 3 : ι it is ( d 1 , d 2 , d 3 ) ∈ r el iff d 1 = ⊥ or d 2 = ⊥ or d 1 = d 2 = d 3 . First, the output column ( 0 , 0 , n ) of the v alue table is n ot in this relation. Then w e h a ve to sh o w that ([ [ Q ] ] , [ [ R ] ] , [ [ P ] ]) ∈ r el (on the type ι → ι → ι ). Supp ose we ha ve [ [ Q ] ] a 1 b 1 = c 1 , [ [ R ] ] a 2 b 2 = c 2 , [ [ P ] ] a 3 b 3 = c 3 and supp ose ( c 1 , c 2 , c 3 ) 6∈ r el . W e hav e to sho w that ( a 1 , a 2 , a 3 ) 6∈ r el or ( b 1 , b 2 , b 3 ) 6∈ r el . It m ust b e c 3 = 0. It cannot b e c 1 = ⊥ , so it m u st b e c 1 = 0 or c 1 = 1: If c 1 = 0, then it cannot b e c 2 = 0, so it must b e c 2 = 1, then a 1 = 0, a 2 = 1, therefore ( a 1 , a 2 , a 3 ) 6∈ r el , end of p ro of f or c 1 = 0. If c 1 = 1, then it is c 2 = 0 or c 2 = 1: If c 2 = 0, then b 1 = 2, b 2 = 0, therefore ( b 1 , b 2 , b 3 ) 6∈ r el . If c 2 = 1, then b 1 = 2, b 2 = 1, therefore ( b 1 , b 2 , b 3 ) 6∈ r el . It is no su rprise that w e ha ve to p erform a case analysis of similar complexit y as in the pro of ab o ve . But it is in teresting that the w hole pro of of this r emark can b e done mec hanically b y the computer program written by Allen Stought on [30]. F or a general system of ground constan ts, th is p rogram tak es a v alue table of a second-order function and returns either a term defin ing suc h a f u nction or a logical relation provi ng its un definabilit y . Our coun ter-example is of grade 2 with g of arity 2. There is an “equiv alent ” example of grade 1 with g of arit y 3: ¯ A = g 1 0 1 g 0 0 ¯ B = g 1 1 1 g 0 0 C = λg . g ¯ A ¯ B 0 A = λg . ¯ A B = λg . ¯ B Conjecture 6.11. In F ( ι → ι → ι ) → ι 1 , the finite elements of grade 1 of the type ( ι → ι → ι ) → ι , Berry’s fi rst conjecture is v alid; this sub domain is a bidomain. (Th is is a finite com binatorial problem and could b e solv ed b y a computer program.) 30 F. M ¨ ULLER 6.2. Two elemen ts wit hout sta ble lub. No w to our counter-example to b ounded com- pleteness of the stable ord er. It is of type ( ι → ι → ι ) → ( ι → ι → ι ) → ι and of grade 2. It emplo ys the tric k of our last example twice to t wo functional parameters. Consider the follo wing game terms A, B , C , D , E , where we use a case 1 for a case 2 with the th ir d arm ⊥ . ¯ A = f 1 2 f 0 g 1 2 g 0 0 A = λf g . ¯ A ¯ B = f 1 1 f 0 g 1 1 g 0 0 B = λf g . ¯ B C = λf g . f ¯ A ¯ B 0 D = λf g. g ¯ A ¯ B 0 E = λf g . f ¯ A ¯ B g ¯ A ¯ B 0 The traces of the terms are: T [ [ A ] ] = { 0 ⊥7→ 0 , 1 2 7→ 1 }7→{ 0 ⊥7→ 0 , 1 2 7→ 1 }7→ 0 ⊥ ⊥ T [ [ B ] ] = {⊥ 0 7→ 0 , 1 1 7→ 1 }7→ {⊥ 0 7→ 0 , 1 1 7→ 1 }7→ 0 ⊥ ⊥ T [ [ C ] ] = T [ [ A ] ] ∪ T [ [ B ] ] ∪ {{⊥⊥7→ 0 }7→⊥ 7→ 0 } T [ [ D ] ] = T [ [ A ] ] ∪ T [ [ B ] ] ∪ {⊥ 7→{⊥⊥7→ 0 }7→ 0 } T [ [ E ] ] = T [ [ A ] ] ∪ T [ [ B ] ] ∪ {{⊥⊥7→ 0 }7→{⊥⊥7→ 0 }7→ 0 } The tok en of T [ [ A ] ] entai ls three more tok ens: (1) with th e first indicated 2 replaced by ⊥ , (2) with the second in dicated 2 replaced by ⊥ , (3) with b oth replaced b y ⊥ . L ikewise for the tok en of T [ [ B ] ]. (These en tailmen ts are du e to secur edness, see th e definition 2 of [7].) C, D , E are three stable u p p er b ounds of A and B ; w e will sho w that they are ju st the minimal stable upp er b ounds. E is the ⊑ -lub of A and B . The intuition of the example: In an upp er b ound of A and B , b oth hav e to b e separated b y some f unction call at the top lev el; b ecause A and B cannot b e “unifi ed”. There are three wa ys to choose the s eparator: f or g or (b oth f and g ), realized by C, D , E r esp. Prop osition 6.12. L et A, B , C , D , E b e the game terms ab ove. [ [ C ] ] , [ [ D ] ] , [ [ E ] ] ar e the min- imal stable upp er b ounds of [ [ A ] ] and [ [ B ] ] . So [ [ A ] ] and [ [ B ] ] have no stable lub. (This again r efutes B e rry’s first c onje ctur e.) Pr o of. By theorem 6.8, ev ery minimal sub of A and B is of grade 2. By the game term theorem, we restrict to game terms of grade 2. Th ese game terms m ust ha ve the form λf g.S . W e use the terms Q, R , P of the pro of of prop osition 6.9. Our claim is: F or ev ery ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 31 term S of the form ab ov e, if S [ f := Q, g := Q ] → ∗ 0 and S [ f := R, g := R ] → ∗ 0 , then S [ f := P , g := P ] → ∗ 0 . The pro of of the claim is b y induction on the term S and follo ws exactly the pro of of prop osition 6.9. There is only one additional case S = case 2 ( f S 1 S 2 ) S 3 S 4 S 5 of the same sc heme. So w e h a ve sho wn that for every ⊑ -upp er b oun d F of grade 2 of A and B it m u st b e F P P → ∗ 0 . F or a ≤ -upp er b ound it cann ot b e F ⊥⊥ → ∗ 0 . Hence the minimal argumen ts to fulfill F P P → ∗ 0 must b e ( P , P ), ( P , ⊥ ) or ( ⊥ , P ). This is fu lfilled by E , C, D resp ectiv ely . 7. Refut a tion a nd impro v ement of the c hain con jecture The c hain conjecture 5.7 said that for finite elemen ts a ≤ b there is a chai n b et wee n a and b , see the defin ition 5.5 of c h ain. W e give here a counte r -example in the typ e ( ι → ι → ι ) → ( ι → ι → ι ) → ι of grade 2. C onsider the follo wing game terms A, B : B = λf g . g g 1 2 f 1 f 0 0 0 g 1 1 f 1 f 0 0 0 0 A = λf g . f g 1 2 g 0 1 g 1 1 g 0 1 f 0 0 0 Here are the traces of these terms: A          { 0 0 7→ 0 , 1 ⊥7→ 1 }7→{ 0 ⊥7→ 0 , 1 2 7→ 1 }7→ 0 ⊥ ⊥ { 0 0 7→ 0 , ⊥ 1 7→ 1 }7→{⊥ 0 7→ 0 , 1 1 7→ 1 }7→ 0 ⊥ ⊥ ⊥ 7→{⊥⊥7→ 0 }7→ 0                B The first tok en entail s three more tok ens: (1) with the indicated 0 replaced by ⊥ , (2) with th e indicated 2 r eplaced by ⊥ , (3) with b oth replaced b y ⊥ . Lik ewise for the second tok en. It is A ≤ B . B con tains just one more tok en t than A . Assu m e that there is a c hain b et w een [ [ A ] ] and [ [ B ] ]. Then t is eliminated in a definite step A ′ ≺ B ′ of the c hain, with A ∼ = A ′ and B ∼ = B ′ . W e will show that su c h A ′ ≺ B ′ do not exist. The intuition of th e example: It is d eriv ed from the example of s ubsection 6.1. A and B are lik e the term C of th at example. F or B : In the left leg of the u p p er g the subterm g 0 ⊥ (of C ) is replaced by the subterm d emanding the fir st argum ent of f . In the righ t leg the subterm g ⊥ 0 (of C ) is replaced by the subterm demanding the s econd argumen t of f . T his ensures that not b oth legs (of the upp er g ) can b e ev aluated. There is again no term with g that could b e lifted to the top leve l and that would eliminate the tok en ⊥7→{⊥⊥7→ 0 }7→ 0 . Therefore there is n o ≺ -step leading from A to B . But the subterm s with f can b e lifted 32 F. M ¨ ULLER to the top replacing th e u pp er g of B (as “separator” of g 1 2 and g 11 ), so w e get A with that toke n eliminated. Here th e su b terms g 0 ⊥ and g ⊥ 0 of the former example C app ear again; they must app ear to ensure that A gets the fir st eight tok ens of B and ensu r e that not b oth legs of the upp er f can b e ev aluated. Prop osition 7.1. L et A, B b e the game terms of gr ade 2 ab ove. Ther e ar e no game terms A ′ , B ′ of gr ade 2 with A ′ ≺ B ′ and A ′ ∼ = A , B ′ ∼ = B . Then by the game term the or em ther e ar e no P CF- terms A ′ , B ′ with this pr op erty. This r e futes the chain c onje ctur e. Pr o of. As game terms of grade 2, A ′ and B ′ should b e of the form λf g.S , wh ere S : ι is a game term p ossibly with the only free v ariables f , g . W e abbreviate S [ f := M , g := N ] as S [ M , N ]. W e use the terms of the pro of of prop osition 6.9 as arguments f or g : Q = λxy . case 1 x 0 ( case 2 y ⊥⊥ 1 ) T [ [ Q ] ] = { 0 ⊥7→ 0 , 1 2 7→ 1 } R = λxy . cas e 1 y 0 ( case 1 x ⊥ 1 ) T [ [ R ] ] = {⊥ 0 7→ 0 , 1 1 7→ 1 } P = λxy . 0 T [ [ P ] ] = {⊥⊥7→ 0 } W e use the follo wing terms as argum en ts for f : Q ′ = λxy . case 1 x ( case 1 y 0 ⊥ ) 1 T [ [ Q ′ ] ] = { 00 7→ 0 , 1 ⊥7→ 1 } R ′ = λxy . case 1 y ( case 1 x 0 ⊥ ) 1 T [ [ R ′ ] ] = { 00 7→ 0 , ⊥ 1 7→ 1 } The p airs ( Q ′ , Q ) and ( R ′ , R ) are compatible in the sense that their replacemen t into the same in teger term leads to compatible results. W e will pro ve that for an y terms S , S ′ of th e form ab ov e: If S ′ ≺ S and S [ ⊥ , P ] → ∗ 0 , S ′ [ Q ′ , Q ] → ∗ 0 , S ′ [ R ′ , R ] → ∗ 0 , then S ′ [ ⊥ , P ] → ∗ 0 . The prop osition follo ws immediately from this claim. The pro of is by induction on the term S : The cases S = ⊥ , 0 , 1 , 2 are clear. Let S = case 2 ( g S 1 S 2 ) S 3 S 4 S 5 and S ′ ≺ S with S ′ = case 2 ( g S ′ 1 S ′ 2 ) S ′ 3 S ′ 4 S ′ 5 . (The case S ′ = ⊥ is clear.) Assume the three conditions of the claim. Let ( g S ′ 1 S ′ 2 )[ Q ′ , Q ] → ∗ q and ( gS ′ 1 S ′ 2 )[ R ′ , R ] → ∗ r , b oth terms must con ve rge to integ er constan ts. F rom th e compatibilit y of ( Q ′ , Q ) and ( R ′ , R ) follo ws the compatibilit y of q and r , so either q = r = 0 or q = r = 1 . As ( Q ′ , Q ) and ( R ′ , R ) are compatible, it cannot b e S ′ 2 [ Q ′ , Q ] → ∗ 2 and S ′ 2 [ R ′ , R ] → ∗ 1 . Therefore q = r = 0 . Then w e get S 3 [ ⊥ , P ] → ∗ 0 , S ′ 3 [ Q ′ , Q ] → ∗ 0 , S ′ 3 [ R ′ , R ] → ∗ 0 . By the induction h yp othesis for S 3 w e conclude S ′ 3 [ ⊥ , P ] → ∗ 0 , h ence S ′ [ ⊥ , P ] → ∗ 0 . This fulfills the claim. No w let S = case 2 ( f S 1 S 2 ) S 3 S 4 S 5 . Then S [ ⊥ , P ] ∼ = ⊥ , so the claim is fulfilled. The refu tation of the c hain conjecture shows th at already for second-order types the corresp onden ce of stable and syn tactic order is d estro yed; there seems to b e no s imple syn tactic charac terization of the stable ord er. But certainly th e t wo ord ers are related, bu t in whic h sen se? A wea ker conjecture that is no w op en is the follo wing: ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 33 Conjecture 7.2 (Maximalit y Conjecture) . Ev ery PCF-term without Y th at is s y ntactic ally maximal (i.e. con tains no ⊥ ) is also stably maximal. The existence of c h ains of any length suggests a kind of “metric” on finite elemen ts a ≤ b : If there is a c hain b et we en a and b of least length n , th en the distance of a and b is n . If there is no c h ain, then the distance is ∞ . But it migh t b e doubted if this is meanin gfu l, or if a transition A ≤ B lik e the example ab o ve (without c hain) sh ould also b e counte d as some kind of elemen tary step of finite distance. The example A ≤ B ab o v e shows us that the syn tactic order ≺ is n ot enough to giv e a syn tactic description of the stable order; there are more “syntacti c” relations needed. W e can imagine that A is pr o duced from B b y “forcing” the u pp er g in B to b e s tr ict in one of its t wo arguments, so that the tok en ⊥ 7→{⊥⊥7→ 0 }7→ 0 is eliminated. W e ten tativ ely pr op ose an impro ved c hain conjecture with such a new syntact ic relation of “strictification”. F or th is we ha ve to extend PCF w ith a new op erator. The theory of this extension h as s till to b e prop erly dev elop ed; so all prop ositions in the rest of this section ha ve the s tatus of conjectures. In [23] L u ca Pa olini extends PCF with t wo new op erators, one of them called stri ct? of t yp e ( ι → ι ) → ι . Supp ose the op erational seman tics is given by an ev aluation p ro cedure ev al. Then strict? ob eys the ru les: If ev al( M 0 ) ↓ and ev al( M ⊥ ) ↑ th en ev al( st rict? M ) = 0 If ev al( M 0 ) ↓ and ev al( M ⊥ ) ↓ th en ev al( st rict? M ) = 1 Here X ↓ means that X ev aluates to some inte ger constan t, X ↑ is the negation. P aolini also giv es an effectiv e ev aluation for strict? . W e use instead a new constan t str : ( ι → ι ) → ι that is the “strict half ” of stri ct? , i.e. w e ha ve the only rule: If ev al( M 0 ) = 0 and ev al( M ⊥ ) ↑ then ev al( str M ) = 0 str can b e expressed by a term with strict? , but st rict? cannot b e expressed by str . Note that our str is finite. An effectiv e ev aluation could also b e giv en for str . ( str M tests if M 0 ev aluates to 0 and in this pro cess c hecks if M demands its argument 0 .) On th e extended language (PCF+ str ) the op erational equiv alence ∼ = is defin ed in the usual wa y b y observ ation through p r ogram cont exts. I t is extensional, i.e. M ∼ = N iff for all M ′ ∼ = N ′ it is M M ′ ∼ = N N ′ . There is a fully abstract semanti cs [ [ ] ] giv en by equiv alence classes of terms; these equ iv alence classes are construed as functions. These fu n ctions are stable; we can define a trace s emantics T [ [ ] ] in the usual wa y , w ith the stable ord er ≤ as the inclusion relation on traces. All d en otations are monotonic w.r.t. the stable order ≤ . str has the trace semantics T [ [ str ] ] = {{ 0 7→ 0 }7→ 0 } Note that the tok en { 0 7→ 0 }7→ 0 expresses th e fact that the argumen t function { 0 7→ 0 } is strict, its argumen t 0 is needed. Note that str is not monotonic w.r.t. the extensional order of PCF; it is [ [ str ] ] { 0 7→ 0 } = 0 , but [ [ str ] ] {⊥7→ 0 } = ⊥ . I t is T [ [ str ] ] ⊆ T [ [ λf . i f f 0 then 0 else ⊥ ] ] = {{ 0 7→ 0 }7→ 0 , {⊥7→ 0 }7→ 0 } All seman tic elemen ts preserv e compatibilit y in the follo wing sense. Let us defin e the relation ↑ h of her e ditary c omp atibility on denotations: for integ ers it is m ↑ h n if m = ⊥ or 34 F. M ¨ ULLER n = ⊥ or m = n . F or fun ctions it is f ↑ h g if for all x ↑ h y : f x ↑ h g y . All our fu n ctions f of (PCF+ str ) hav e the prop ert y that f ↑ h f . P aolini’s op erator strict? do es not ha ve it. With str w e can define fun ctions strictify n : σ n → σ n , where σ n = ( ι → . . . → ι → ι ) with n ≥ 1 argumen ts. E.g. strictify 2 : ( ι → ι → ι ) → ( ι → ι → ι ), strictify 2 = λg xy . i f ( str [ λz . if g ( if z t hen x else ⊥ )( if z then y else ⊥ ) then 0 else 0 ]) then g xy else ⊥ strictify 2 g xy tests if g xy con v erges and g ⊥⊥ dive r ges, and outputs g xy in this case. So strictify 2 g xy “forces” g to b e strict in one of its t wo argum en ts. If it is not, then the outp ut is ⊥ . Let us r eplace in the example term B ab o v e the up p er o ccur r ence of g by (strictify 2 g ) to get a n ew term B ′ . Then [ [ B ′ ] ] = [ [ A ] ], in the seman tics of (PCF+ str ). A is a “strictification” of B . If M is a term of (PCF+ str ), then unstr( M ) is defined as the term M with all o ccurrences of str r eplaced by λf . if f 0 then 0 else ⊥ . So unstr( M ) is a PCF-term and M ≤ u nstr( M ), in the seman tics of the extended language. No w we can define our complementary “syn tactic” relation. Definition 7.3. Let M , N b e P C F-terms of the same t yp e. M is a strictific ation of N , written M ≺ s N , if there is a (PCF+ s tr )-term M ′ with [ [ M ] ] = [ [ M ′ ] ] (in the seman tics of (PCF+ str )) and [ [uns tr( M ′ )] ] = [ [ N ] ] (in the seman tics of PCF). Note that for PCF-terms M , N : ( M ≺ s N = ⇒ [ [ M ] ] ≤ [ [ N ] ]) and ( M ∼ = N = ⇒ M ≺ s N ). Conjecture 7.4 (improv ed c hain conjecture) . In PCF w e ha ve: F or all fin ite elemen ts a ≤ b there is a sequence ( M i ) of terms with 1 ≤ i ≤ n , [ [ M 1 ] ] = a , [ [ M n ] ] = b , and for ev ery i < n it is M i ≺ M i +1 or M i ≺ s M i +1 . A p ro of of this conjecture w ould b e non-trivial and should first b e tried on second-order t yp es. (It might b e that t yp es higher than second-order need new h igher-t yp e strictness op erators that cannot b e defined fr om str .) P erhaps th e situation s h ould firs t b e clarified in the realm of (PCF+ str ) and a conjecture of this kind should b e prov ed there. Our (PCF+ str ) is the “w eak est” s equen tial extension of PCF with a cont rol op erator. It is p rop erly included in (PC F+ strict? ), this in turn is included in (PCF+H), the sequentia lly realizable f unctionals of John Longley [15]; see sectio n 9 in [23] for an o v erview of su c h extensions of PC F. (PCF+H) is included in S P CF (men tioned in the in tro duction), whic h is no more extensional. F or all these extensions of PCF it would b e int eresting to giv e syn tactic c haracterizations of th e stable ord er. First it should b e clarified if all types are definable retracts of some low er order t yp es, as is the case for (PCF+H) and SPCF. This could mak e the p ro ofs easier, as we will see for un ary PCF in the follo wing section. 8. Unar y PCF Here we will pr ov e Berry’s conjectures for unary PCF, with the aid of Jim Laird’s r esults [12]. Unary PC F is the calculus of PCF without Y and w ith the only constan t 0 and case 0 - expressions. Its semant ics is give n by the finite elements of F σ 0 for all σ , w ith the orders ⊑ and ≤ . W e first rep eat the general closure prop erties of the F σ i , s een as em b edded in the D σ of an f-mo del, tak en from lemma 3.3, prop osition 3.15 and theorem 6.8. ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 35 Prop osition 8.1. The F σ i ar e finite and downwar d close d w.r.t. ≤ . F or a, b ∈ F σ i , a ⊓ b ∈ F σ i is the glb w.r.t. ⊑ in D σ and F σ i . F or a ↑ ≤ b it is also the glb w.r.t. ≤ . F or a, b ∈ F σ i that ar e ⊑ -b ounde d in D σ , a ⊔ b ∈ F σ i is the lub w.r.t. ⊑ i n D σ and F σ i . F or a finite set X ⊆ F σ i that has a stable upp er b ound, al l minimal stable upp er b ounds of X ar e in F σ i . The extensional lub F X is one of tho se. If X has a stable lub, then it is F X . T o apply Laird’s results on definable retractions, we au gment unary PC F with pr o duct t yp es σ × τ . The constructs of the whole language are: 0 : ι , ⊥ σ : σ , x σ : σ If M : τ , then λx σ .M : σ → τ . If M : σ → τ and N : σ , then M N : τ . If M , N : ι , then case 0 M N : ι . If M : σ and N : τ , then h M , N i : σ × τ . If M : σ × τ , then π 1 M : σ and π 2 M : τ . The reduction rules are: ( λx.M ) N → M [ x := N ] case 0 0 M → M π 1 h M , N i → M π 2 h M , N i → N This section n eeds the pro ducts only as auxiliary constructions for the fir st-order t yp es that are the targets of Laird’s retractions. In this section the und erlying language is alwa ys the augmen ted unary PCF with pro du cts if pro ducts are not explicitly excluded . Laird defines in [12] a categorica l n otion of standar d mo del of unary PCF together with order-extensionalit y and partial extensional ord er at eac h type. He defin es p ar al lel c omp osition as the fu nction f with f h⊥ , ⊥i = ⊥ , f h⊥ , 0 i = f h 0 , ⊥i = 0 , f h 0 , 0 i = 0 . A mo del is universal at typ e τ if every element of τ is the denotation of a term. Definition 8.2 (Laird, definition 3.4 in [12]) . Giv en t yp es σ, τ , a definable r etr action fr om σ to τ (in a mo del M ) (written I nj : σ E τ : Pro j or jus t σ E τ ) is a pair of (closed) terms Inj : σ → τ and Pro j : τ → σ such that [ [ λx. Pro j(Inj x )] ] = id in M . Lemma 8.3 (Laird, lemma 3.10 in [12]) . F or any typ e τ ther e i s a natur al numb er n such that ther e is a definable r etr action fr om τ to some binary pr o duct f orm of ( ι → ι ) n ; the same r etr action for any standar d or der-extensional mo del without p ar al lel c omp osition. Theorem 8.4 (Laird, theorem 3.11 in [12]) . Any standar d mo del of u nary PCF which is or der-extensional and e xcludes p ar al lel c omp osition is universal. W e can build the stable biorder mo del of un ary PCF as a collection of bicp os ( E σ , ⊑ , ≤ ) for ev ery typ e σ : W e start with E ι = {⊥ , 0 } and ⊥ ⊑ 0 , ⊥ ≤ 0 . E σ × τ = E σ × E τ with the usual ⊑ and ≤ . E σ → τ is the set of stable and monotone functions f : ( E σ , ⊑ , ≤ ) → ( E τ , ⊑ , ≤ ). (If x ⊑ y then f x ⊑ f y . I f x ≤ y then f x ≤ f y . If x ↑ ≤ y then f ( x ⊓ y ) = f x ⊓ f y . Contin uit y conditions are n ot necessary as the domains are fin ite.) E σ → τ is ordered b y th e usual ⊑ and ≤ . ( E σ , ⊑ , ≤ ) is not only a bicp o, but a distribu tiv e bicp o where the stable lub of t w o ≤ -compatible fun ctions is defined p oin twise, b y prop osition 4.7.10 in Berry’s thesis [4]. (If 36 F. M ¨ ULLER f ↑ ≤ f ′ , then ( f ∨ f ′ ) x = f x ∨ f ′ x .) Ther efore th e stable lub of t wo element s is also defin ed b y u nion on traces. The stable b iorder mo del fulfi lls the conditions of theorem 8.4, therefore it is u niv ers al (and fully abstract). T his means that ( E σ , ⊑ , ≤ ) is isomorphic to ( F σ 0 , ⊑ , ≤ ) for t yp es σ without pro ducts. In the follo win g the seman tics of un ary PC F-terms is alwa ys tak en in the mo del ( E σ , ⊑ , ≤ ). All this prov es Berry’s first conjecture for unary PCF: Theorem 8.5 (Laird [12]) . F or every typ e σ without pr o ducts, the structur e ( F σ 0 , ⊑ , ≤ ) is a distributive bicp o (henc e also a bidomain as it is finite). F or a, b ∈ F σ 0 with a ↑ ≤ b , a ∨ b is given by T ( a ∨ b ) = T ( a ) ∪ T ( b ) and this lub is taken p ointwise for functions a, b . With the aid of Laird’s definable retractions we can pr o ve a strong form of Berry’s second conjecture for u nary PCF, based on the fact that it is v alid for first-order t yp es. First w e need t wo lemmas on the reduction. Lemma 8.6. The r e duction → on unary PCF with pr o ducts is c onfluent and str ongly normalizing. Ther e f or e it has unique normal forms. The normal form of a term of a typ e without pr o ducts do es not c ontain any pr o duct subterm. Pr o of. Th e confluence can b e pro ved with the main theorem of [17 ], see also [6, theorem 10.4.1 5, page 576]: The r ules of → without th e β -ru le are conflu en t on the applicativ e terms (i.e. the terms without λ ), as they are orthogo nal; they are left-linear and not v ariable- applying. Therefore th eir com bination with the β -ru le is confluent . F or the pro of of strong normalization there s eems to b e no theorem in the literature that would provide an easy mo du lar c heck for the simply typ ed λ -calculus with algebraic rewrite rules of our form. Therefore w e tak e the pro of of str on g normalization of the simp ly typ ed λ -calculus with pro du cts in the textb o ok [10, c hapter 6] for the only atomic t yp e ι and augment it by the constan t 0 and case 0 -expressions. The pro of sta ys literally the same. The only thing w e ha ve to add is a pro of th at if M , N are strongly normalizable, then case 0 M N is so; in the pro of that all terms are reducible. Lemma 8.7. L et ω b e the fol lowing map on unary PCF-terms (wher e n, m ≥ 0 ): ω ( λx 1 . . . x n . 0 ) = λx 1 . . . x n . 0 ω ( λx 1 . . . x n .y M 1 . . . M m ) = λx 1 . . . x n .y ω ( M 1 ) . . . ω ( M m ) , for y variable ω ( λx 1 . . . x n . case 0 M N ) = λx 1 . . . x n . case 0 ω ( M ) ω ( N ) , if ω ( M ) = case 0 . . . or ω ( M ) = y . . . with y variable ω ( λx 1 . . . x n . h M , N i ) = λx 1 . . . x n . h ω ( M ) , ω ( N ) i ω ( λx 1 . . . x n .π 1 M ) = λx 1 . . . x n .π 1 ω ( M ) , if ω ( M ) = y . . . with y variable ω ( λx 1 . . . x n .π 2 M ) = λx 1 . . . x n .π 2 ω ( M ) , if ω ( M ) = y . . . with y variable ω ( M ) = ⊥ , in al l other c ases ω ( M ) is a normal form pr efix of M , it pushes ⊥ s upwar ds. If M is a normal form, then ω ( M ) ∼ = M . If M → ∗ N , then ω ( M ) ≺ ω ( N ) . If M ≺ N , then ω ( M ) ≺ ω ( N ) . ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 37 We define n f ( M ) = ω ( the normal form of M ) . F or al l M ≺ N it is nf ( M ) ≺ n f ( N ) . Pr o of. Th e fir st four p rop ositions are clear, w e prov e here the last one; the p ro of is similar to the one of lemma 4.4. Let M ′ , N ′ b e the normal forms of M , N . As the redu ction rules for → d o not inv olv e ⊥ , all the redu ctions M → ∗ M ′ can also b e done in N . (If A ≺ B and A → A ′ , then there is B ′ with B → B ′ and A ′ ≺ B ′ .) So there is N ′′ with N → ∗ N ′′ and M ′ ≺ N ′′ . By confluence of → it is N ′′ → ∗ N ′ . Then w e get nf ( M ) = ω ( M ′ ) ≺ ω ( N ′′ ) ≺ ω ( N ′ ) = nf ( N ). Theorem 8.8. F or every typ e σ without pr o ducts, for every a ∈ F σ 0 ther e is a game term A : σ with a = [ [ A ] ] su ch that for ev e ry b ≤ a ther e i s B ≺ A with b = [ [ B ] ] . Pr o of. By Laird’s lemma 8.3 there is a num b er n and a definab le retraction Inj : σ E τ : Pro j, with τ some b inary pro d uct form of ( ι → ι ) n . Let A ′ b e a term for a , [ [ A ′ ] ] = a . Let A ′′ = nf (Pr o j(Inj A ′ )). A ′′ do es not con tain an y su bterm of p ro duct t y p e. By the game term theorem 4.12 we get the desired game term A = gt σ 0 (Ψ σ 0 A ′′ ) with A ∼ = A ′′ , so [ [ A ] ] = a . Let C = nf (Inj A ′ ). C = h C 1 , . . . , C n i in some binary pair form, wh ere C i ∼ = λx. ⊥ or λx. 0 or λx.x . Let b ≤ a . Then [ [In j] ] b ≤ [ [Inj] ] a = [ [ C ] ]. F or ev ery i , if x ≤ [ [ C i ] ] then x = [ [ C i ] ] or x = ⊥ . Th erefore there is B ′ ≺ C with [ [ B ′ ] ] = [ [Inj] ] b . Let B ′′ = nf (Pr o j B ′ ). I t is A ′′ = nf (Pro j C ). Therefore B ′′ ≺ A ′′ . By th e game term theorem 4.12 there is a game term B = gt σ 0 (Ψ σ 0 B ′′ ) w ith B ∼ = B ′′ and B ≺ A . W e ha ve b = [ [Pro j] ]([ [Inj ] ] b ) = [ [Pro j] ][ [ B ′ ] ] = [ [ B ] ]. Remark: Please note that Laird’s r etractions are incredibly inte lligent, b ecause they m u st int ro duce in the term A ′′ = nf (Pro j(Inj A ′ )) some nestings of v ariables that were not present in A ′ , to fulfill the prop osition of the theorem. It is a nice exercise (of three p ages) to compu te an example: T ake σ = ( ι → ι → ι ) → ι and A ′ = λg .g 0 0 : σ . Th e tr ace of A ′ is T [ [ A ′ ] ] = {{⊥⊥7→ 0 }7→ 0 , { 0 ⊥7→ 0 }7→ 0 , {⊥ 0 7→ 0 }7→ 0 , { 00 7→ 0 }7→ 0 } . Going thr ough Laird’s pro of of lemma 8.3, we get complicated terms I nj : σ E τ : Pro j with τ = ((( ι → ι ) × ( ι → ι )) × ( ι → ι )) × (( ι → ι ) × ι ). W e compute the normal forms: Inj A ′ → ∗ C = hhh λx.x, λx.x i , λx.x i , h λx.x, 0 ii Pro j(Inj A ′ ) → ∗ A ′′ = λg . case 0 [ g ( g 0 ( g 0 0 )) 0 ][ g 0 ( g 00 )] This term is m uch more exp anded than needed. If w e replace the underlined 0 in C by ⊥ , w e get a term A ′′ with b oth und erlined 0 replaced by ⊥ . Th e trace of this new term A ′′ is {{⊥⊥7→ 0 }7→ 0 , { 0 ⊥ 7→ 0 }7→ 0 , {⊥ 0 7→ 0 }7→ 0 } . Note that there w as no s y ntactic ally lesser term than A ′ with this trace. 38 F. M ¨ ULLER Remark: Another recommended exercise for the reader is to en co d e our fi rst counte r- example (to Berry’s second conjecture) of su bsection 5.1 in unary PCF. The b o oleans are enco ded by the type β = ι → ι → ι as usu al. The v alue 0 is rep r esen ted b y λxy .x , 1 is represent ed by λxy .y . There are three m ore inhabitan ts of β : ⊥ , λxy . case 0 xy and λxy . 0 . The example is no w of type ( β → β → β ) → β . The term D can b e giv en an expanded form suc h that A ≺ B = C ≺ D . I n D th e top b o olean λxy . 0 is used (in one p osition) as th e lub of λxy .x and λxy .y . 9. Outlo ok W e ha ve seen one tric k to pro duce several examples w hic h sho w that the stable order in PCF is not so r egular as Berry had exp ected. These counter-e xamples h a ve as necessary ingredien ts: at least t wo incompatible v alues and at least a second-order t yp e with at least arit y t wo of s ome fun ctional parameter. T o b e precise, w e s till hav e to sho w that Berry’s conjectures are v alid in all second-order typ es with functional parameters of only arit y on e, see conjectures 6.7 and 5.2. With the refutation of the c hain conjecture in s ection 7 we hav e shown that there is no simple c haracterizatio n of the s table order in terms of the synta ctic ord er . In f act th e coun ter-example shows that there is not only the s yn tactic order that causes th e stable order, b ut that there are other synta ctic r elations needed with this p rop erty . S uc h another relation w as iden tified as the relation of “strictification”, and an im p ro ved c hain conjecture 7.4 w as tenta tiv ely p rop osed. There should b e s ome kind of full syn tactic accoun t of the stable order, at least for second-order t yp es. F or any type th ere sh ould b e synt actic conditions that are necessary for th e relation A ≤ B of terms. These should at least prov e the maximalit y conjecture 7.2: Ev ery PCF-term without Y that is syn tactically m aximal is also stably maximal. It wo uld also b e in teresting to fin d s y ntactic characte rizations of the stable order in extensions of PC F b y sequen tial con tr ol op erators, i.e. in (PCF+ str ), (PCF+ strict? ), (PCF+H) and SPCF, see the remarks at the end of section 7. In this pap er w e h a ve treated the pr oblem of the syntac tic c h aracterization of the stable order, but Berry originally had in mind the semanti c c haracterization of the syn tactic order. In the ligh t of th e results of this p ap er this seems to b e a pr oblem of similar difficulty . On e should first seek necessary conditions for the syntact ic order that are stronger than the stable order. A ck nowledgement I th ank Reinhold Hec kmann for carefully reading drafts of this pap er and many discussions. I thank Reinh ard Wilhelm and the mem b ers of his c h air for their supp ort. I thank the anon ymou s r eferees for their v aluable suggestions. Referen ces [1] Samson Ab ramsky , Radha Jagadeesan, and Pasquale Malaca ria. F ull abstraction for PCF. I nformation and Computation , 163:409– 470, 2000. [2] Rob erto M. Amadio and Pierre-Louis Curien. Dom ains and L amb da-Calculi . Cam b rid ge Universit y Press, 1998. [3] G´ erard Berry . St able mo d els of t y p ed λ -calculi. In 5. ICALP’78, LNCS 62 , pages 72–89. Springer, 1978. ON BERR Y’S CON JECTURES ABOUT THE S T ABLE ORDER IN PCF 39 [4] G´ erard Berry . M o d` eles c ompl` etement ad´ equats et stables des lamb da-c alculs typ´ es . PhD thesis, Universit ´ e P aris VI I, 1979. [5] G´ erard Berry , Pierre-Louis Curien, and Jean-Jacques Levy . F ull abstraction for sequential languages: The state of the art. In Maurice Niv at and John R eynolds, editors, Algeb r aic Metho ds in Semantics , pages 59–132. Cambridge Un ivers ity Press, 1985. [6] Inge Bethke. Lambda calculus. In T erese, editor, T erm R ewri ti ng Systems , p ages 548–587. Cam bridge Universit y Press, 2003. [7] Pierre-Louis Curien, Gordon Plotkin, and Glynn Winskel. Bistructures, b idomains and linear logic. In Gordon Plotkin, Colin St irling, and Mads T ofte, editors, Pr o of, L anguage, and I nter action. Essays in Honour of R obin M ilner . MIT Press, 2000. [8] Martin Escard´ o and W eng Kin Ho. Op erational domain th eory and top ology of sequential programming languages. Information and Computation , 207:411–43 7, 2009. [9] Jean-Yves Girard. The system F of v ariable typ es, fifteen years later. The or etic al Computer Scienc e , 45:159– 192, 1986. [10] Jean-Yves Girard, Paul T aylo r, and Y ves Lafont. Pr o ofs and T yp es . Cambridge Universit y Press, 1989. [11] J. Martin E. Hyland and C.-H . Luke O n g. On full abstraction for PCF. Information and Com putation , 163:285 –408, 2000. [12] Jim Laird. Sequ ential it y in b ounded biorders. F undamenta Inf ormatic ae , 65:173–191 , 2005. [13] Jim Laird. On the expressiveness of affine programs with non-lo cal control: The elimination of nesting in S PCF. F undamenta Inf ormatic ae , 77:511–531 , 2007. [14] Ralph Loader. Finitary PCF is n ot decidable. The or etic al Computer Scienc e , 266:341–36 4, 2001. [15] John Longley . The sequentially realizable functionals. Annals of Pur e and Applie d Lo gic , 117:1–93, 2002. [16] Robin Milner. F u lly abstract mo dels of typed λ -calculi. The or etic al Computer Scienc e , 4:1–22, 1977. [17] F ritz M ¨ uller. Confluence of the lam b da calculus with left-linear a lgebraic rewriting. Information Pr o c essing L etters , 41:293– 299, 1992. Please use the electronic version: http://rw4 .cs.uni- saarland.d e/ ~ mueller/lc onfluence. ps.gz . [18] Hanno N ic k au. Hered itarily sequential functionals. I n L o gi c al F oundations of Computer Scienc e, LNCS 813 , pages 253–264. S p ringer, 1994. [19] Dag N ormann . On sequential functionals of t y p e 3. Mathematic al Stru ctur es in Computer Scienc e , 16:279– 289, 2006. [20] Dag Normann and Vladimir Y u. Sazono v . The extensional ordering of the sequential functionals. Annals of Pur e and Appli e d L o gic , 163:575–603, 2012. [21] Pe ter W. O’Hearn and Jon G. R iec ke. Krip ke logical relations and PCF. Information and Computation , 120:107 –116, 1995. [22] C.-H. Lu ke Ong. Corresp on d ence b etw een op erational and d enotational semantics: the full abstraction problem for PCF. I n S. Abramsky , D. Gabbay , and T.S.E. Maibaum, editors, Handb o ok of L o gic i n Computer Scienc e, V olume 4 , pages 269–356. O xford Universit y Press, 1995. [23] Luca Paol ini. A stable programming language. Information and Computation , 204:339–37 5, 2006. [24] Gordon D. Plotkin. LCF considered as a p rogramming language. The or etic al Computer Scienc e , 5:223– 256, 1977. [25] Vladimir S azono v . A n inductive definition and domain theoretic p rop erties of fully abstract mo dels for PCF and PCF+. L o gic al Metho ds in Computer Sci enc e , 3:1–50, 2007. [26] Vladimir Sazonov. Natural non- dcp o domains and f-spaces. Annals of Pur e and Applie d L o gic , 159:341– 355, 2009. [27] Dana S. Scott. A typ e-theoretical alternativ e to ISWI M, CUCH, OWHY. T he or etic al Computer Scienc e , 121:411 –440, 1993. Originally written and distributed in 1969. [28] Kurt Sieber. Reasoning ab out sequential functions v ia logical relations. In Applic ations of Cate gories in C om puter Scienc e . Cambridge Universit y Press, 1992. [29] Allen Stoughton. Su bstitution revisited. The or etic al Computer Scienc e , 59:317–32 5, 1988. [30] Allen Stoughton. Mechanizing logica l relations. I n Mathematic al F oundations of Pr o gr amming Semantics 1993, LNCS 802 , pages 359–377 . Springer, 1994. [31] Pa ul T a ylor. A n algebraic approac h to stable domains. Journal of Pur e and Applie d A lgebr a , 64:171–2 03, 1990. This w ork is l icensed under the Creative Commo ns A ttribution-NoDerivs License. T o view a cop y of this license, visit htt p://c reati vecommons.org/licenses/by-nd/2.0/ or send a letter to Creative Commons, 171 Second St, Suite 300, San F rancisco, CA 94105, USA, o r Ei senacher Strasse 2, 10777 Berlin, Germany

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment