Zum Inhalt
Erschienen in:

Open Access 2025 | OriginalPaper | Buchkapitel

An abstract, certified account of operational game semantics

verfasst von : Peio Borthelle, Tom Hirschowitz, Guilhem Jaber, Yannick Zakowski

Erschienen in: Programming Languages and Systems

Verlag: Springer Nature Switzerland

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

Abstract

Das Kapitel präsentiert eine abstrakte, zertifizierte Darstellung der operativen Spielsemantik, wobei der Schwerpunkt auf normaler Form-Bisimulation als Technik zum Nachweis der kontextuellen Äquivalenz von Programmen liegt. Es stellt das Konzept der Substitutionsäquivalenz vor, ein abstraktes Analogon der kontextuellen Äquivalenz, und demonstriert, wie es verwendet werden kann, um Soliditätsnachweise für Normalform-Bisimulation zu erbringen. Das Kapitel bietet einen detaillierten Überblick über die technische Entwicklung, einschließlich der Erstellung eines funktionsfähigen Spielsemantikmodells für jede Sprachmaschine und den Nachweis ihrer Solidität. Sie diskutiert auch die Mechanisierung der Ergebnisse in Coq, betont ihre rechnerischen Aspekte und begründet das Modell in einer konstruktiven Meta-Theorie. Das Kapitel schließt mit einem Vergleich bestehender Literatur und einer Diskussion zukünftiger Perspektiven ab, wobei das Potenzial für die Einbeziehung weiterer sprachlicher Merkmale und die Untersuchung der Vollständigkeit in den abstrakten Rahmen hervorgehoben wird.

1 Introduction

Normal form bisimulation is a technique for proving contextual equivalence of programs in various https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figc_HTML.gif -calculi. Although it is generally finer than contextual equivalence, its practical value resides in the fact that it is often easier to establish on concrete examples than other such techniques, such as applicative or environmental bisimulation.
Let us briefly explain why. All three techniques proceed by defining a notion of label, an interpretation of programs as labelled transition systems (LTSs), and then comparing the interpretations of programs w.r.t. weak bisimilarity. However, the involved labels are very different. Indeed, applicative or environmental labels may contain arbitrary values, while normal form labels are restricted to so-called ultimate patterns. This means that they may be, e.g., tuples or elements of sum types, but cannot contain https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figd_HTML.gif -abstractions. In a typed setting, in particular, all terms of functional type contained in any ultimate pattern must be variables. Normal form labels thus contain a very limited class of terms.
In order for it to be useful, normal form bisimulation should be sound, i.e., at least as fine as contextual equivalence. One standard method for proving soundness goes through an intermediate LTS model, with labels similar to the normal form ones, but a different interpretation, called operational game semantics [20, 22] (OGS). This induces a different equivalence, say operational game bisimulation. One then proves that normal form bisimulation is at least as fine as operational game bisimulation, which is in turn at least as fine as contextual equivalence. Although the first step is mostly straightforward, the second one is difficult, notably because it involves
  • extending the OGS interpretation to suitable contexts, and
  • soundly reflecting the syntactic operation of context application at the level of LTSs.
Because such soundness proofs are highly non-trivial, it seems useful to design an abstract version, covering as many existing cases as possible, and hopefully also future ones.
A few authors have started to explore this direction. Notably, Levy and Staton [23] offer a high-level categorical framework. More recently, Laird [21] proposes a unifying framework for OGS, in which he proves that operational game bisimilarity is a congruence w.r.t. composition, a standard lemma towards soundness.
Contribution In this work, we go further, and prove a generic soundness result for OGS, mechanised in Coq. We thus contribute to both unification and mechanisation of normal form bisimulation. Our contributions to unification are as follows.
  • We introduce an abstract notion of language with evaluator, called a language machine, which notably covers several variants of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fige_HTML.gif -calculus [5, 6].
  • For any language machine, we construct an OGS model.
  • We prove that this model is sound w.r.t. some abstract analogue of contextual equivalence called substitution equivalence, under suitable hypotheses.
We furthermore provide a complete Coq mechanisation of our results [2], to emphasise their computational aspects and firmly ground our model in a constructive meta-theory. We favour a traditional, code-less exposition along the paper for clarity. For the interested reader, we however systematically use hyperlinks represented by ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figf_HTML.gif ) to link definitions and theorems to their mechanised counterpart. The Coq development is inspired by Levy and Staton’s transition systems over games [23], and includes notably the following main contributions.
  • We present OGS using the well-scoped approach ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figg_HTML.gif ), in the sense that everything is indexed by typing contexts, and variables are accessed as de Bruijn indices. This contrasts with previous work, which uses nominal style.
  • We instantiate our abstract notion of language on several concrete examples: a simply-typed call-by-value https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figh_HTML.gif -calculus with recursion ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figi_HTML.gif ), a pure untyped call-by-value https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figj_HTML.gif -calculus ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figk_HTML.gif ), the https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figl_HTML.gif -calculus [5] ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figm_HTML.gif ) and the polarised System D ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fign_HTML.gif ) from Downen and Ariola [6].
  • We implement ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figo_HTML.gif ) an indexed variant of the interaction trees library [29], which we use to define LTSs coinductively — as opposed to the more traditional, relational definition. However, in this extended abstract, we focus more on the math than on the Coq implementation, so interaction trees do not appear (see Remark 9).
  • We introduce ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figp_HTML.gif ) a new fixed-point combinator over a system of so-called eventually guarded equations, whose solution is unique w.r.t. strong bisimilarity. We use this combinator to define composition of OGS LTSs, which is a crucial ingredient to the soundness proof.
Plan Before diving into the details, let us provide a high-level overview of the technical development in §2. In §3, we explain substitution equivalence, our abstract approach to contextual equivalence, on a concrete example language. In §4, we then introduce abstract language machines, construct the OGS model of any language machine, and state our soundness result. Finally, we provide a comparison with the existing literature in §5, and conclude and give some perspectives in §6.

2 Overview

2.1 Axiomatising contextual equivalence as substitution equivalence

Soundness proofs for normal form bisimulation can be established by the following chain of inclusions
Compared to contextual equivalence, CIU (Closed Instantiation of Use) equivalence restricts the shape of contexts that are considered. This idea of restricting contexts while keeping the same discriminating power was first explored by Milner [27]. This idea was then systematized by Mason and Talcott, who introduced CIU equivalence and proved that it coincides with contextual equivalence [24].
In this work, we focus on the middle inclusion:
In order to propose an abstract version of it, we start by streamlining the usual concrete presentation of languages and CIU equivalence.
Standard CIU equivalence checks that two programs, say https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figs_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figt_HTML.gif , behave the same under any closed instantiation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figu_HTML.gif of their free variables, in any closed evaluation context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figv_HTML.gif of some fixed, basic type like the booleans1:
for some sensible notion https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figz_HTML.gif of observation of closed boolean programs, usually cotermination on the same boolean.
This involves both substitution and context application, which is a bit clumsy. In order to avoid having two distinct operations in the abstract setting, we switch to a presentation that unifies them. This presentation is based on abstract machines: one evaluates configurations rather than programs, where a configuration consists of a pair https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaa_HTML.gif of a program https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figab_HTML.gif and an evaluation context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figac_HTML.gif . In particular, instead of comparing programs https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figad_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figae_HTML.gif as before, we now compare configurations https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaf_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figag_HTML.gif , where https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figah_HTML.gif denotes a fresh context variable. And now CIU equivalence is merely a matter of substitution: combining any substitution https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figai_HTML.gif with https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaj_HTML.gif , we get
and similarly for https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figal_HTML.gif .
This is presented in detail in §3, but, briefly, it involves a change of typing paradigm: evaluation contexts are typed like continuations, with “negated” types. E.g., if https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figam_HTML.gif has type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figan_HTML.gif , then https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figao_HTML.gif has type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figap_HTML.gif . And in a configuration https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaq_HTML.gif , https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figar_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figas_HTML.gif have opposite types, e.g., https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figat_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figau_HTML.gif . We tend to use https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figav_HTML.gif to range over simple types, and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaw_HTML.gif to range over the disjoint union of simple types and formally negated simple types.
In this presentation style, evaluation contexts are written inside-out in a stack-like manner, and reduction rules “push” the evaluation context from https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figax_HTML.gif to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figay_HTML.gif , and “pop” it when needed, e.g.,
https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Equ1_HTML.png
(1)
https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Equ2_HTML.png
(2)
Here, https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figba_HTML.gif is the inside-out analogue of the evaluation context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbb_HTML.gif . Thus:
  • the first rule is “searching” for the next redex in the function part of the application https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbc_HTML.gif , storing the argument part in the evaluation context, while
  • in the second rule, the configuration https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbd_HTML.gif represents https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbe_HTML.gif , so the rule is like a https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbf_HTML.gif -reduction in context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbg_HTML.gif .
In conclusion: in the presentation based on abstract machines, CIU equivalence becomes substitution equivalence, which equates configurations https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbh_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbi_HTML.gif when https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbj_HTML.gif for all closed substitutions https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbk_HTML.gif , where https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbl_HTML.gif denotes some suitable, yet straightforward notion of equivalence on closed configurations.

2.2 Axiomatising evaluation, a.k.a. normal forms as triples

Our next step is to analyse how OGS exploits evaluation, and then abstract over it.
To start with, let us consider a configuration https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbm_HTML.gif that gets stuck on a function call https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbn_HTML.gif , where https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbo_HTML.gif is a variable and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbp_HTML.gif is some value, say of the form https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbq_HTML.gif . In the abstract machine presentation, this means https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbr_HTML.gif reduces to
https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Equ3_HTML.png
(3)
for some evaluation context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbs_HTML.gif . The compound evaluation context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbt_HTML.gif means that, once https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbu_HTML.gif is evaluated, it should be applied to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbv_HTML.gif , the result of which should be fed to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbw_HTML.gif .
In such a situation, OGS splits the stuck configuration (3) into
  • a head variable, here https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbx_HTML.gif ,
  • a first-order approximation of the evaluation context, which we will call the observation2, and
  • a substitution called a filling.
In this case, assuming https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figby_HTML.gif has some functional type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figbz_HTML.gif , the observation, say https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figca_HTML.gif , is https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcb_HTML.gif , for fresh variables https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcc_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcd_HTML.gif , and the filling, say https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figce_HTML.gif , is the assignment
In particular, the stuck configuration https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcg_HTML.gif may be recovered as https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figch_HTML.gif , where
  • https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figci_HTML.gif denotes the result of filling the hole in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcj_HTML.gif with https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figck_HTML.gif , i.e., https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcl_HTML.gif , and
  • https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcm_HTML.gif denotes capture-avoiding substitution of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcn_HTML.gif in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figco_HTML.gif .
Terminology 1
For clarity, we will now explicitly distinguish between the two meanings of “substitution”: we continue calling the operation substitution, while we call the sequence of values passed as arguments to the operation assignments.
To fix intuition, here is a table displaying a few examples of normal forms, including the one presented previously. They are given both using standard syntax and in the abstract machine presentation. We also present how they may be split into head variable, observation, and filling:
  • A particular case of a normal form is indeed any value https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcq_HTML.gif . In the abstract machine presentation, https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcr_HTML.gif must be fed to some context variable https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcs_HTML.gif , which we view as the head variable. The observation, here denoted by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figct_HTML.gif , means that the observed variable https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcu_HTML.gif is fed with some value https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcv_HTML.gif , while the filling associates https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcw_HTML.gif to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcx_HTML.gif .
  • The second row is the previous example.
  • In the third row, https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcy_HTML.gif is an evaluation context that takes the https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figcz_HTML.gif th component of the running program and continues with https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figda_HTML.gif . The corresponding reduction rule is https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdb_HTML.gif .
  • In the fourth example, https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdc_HTML.gif is an evaluation context that executes https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdd_HTML.gif or https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figde_HTML.gif according to whether the running (boolean) program evaluates to true or false. The reduction rules are
    https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Equ4_HTML.png
    (4)
Since our axiomatisation of evaluation is devoted to OGS, it inlines this splitting process. It goes in two steps:
  • A language on a given, fixed set of types consists of suitably indexed sets of values, configurations, and observations. Fillings are then defined as suitable assignments from variables to values, and they are assumed to act on values, configurations, and observations – this axiomatises substitution.
  • An evaluator consists of a suitably indexed family of partial maps from configurations to triples of a (head) variable, an observation, and a filling. Intuitively, any configuration either diverges (which is modelled by partiality), or converges to some triple https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdf_HTML.gif . In other words, we model normal forms as triples https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdg_HTML.gif .
  • Conversely, a refolding is a map sending such normal forms back to configurations. Intuitively, this merely maps https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdh_HTML.gif to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdi_HTML.gif .
A language machine is a language equipped with an evaluator and a refolding, satisfying a few coherence axioms (Definition 13). Notably, in order to ensure soundness of OGS, we need to require that evaluation respect substitution, which roughly means that evaluating a substituted configuration https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdj_HTML.gif amounts to evaluating https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdk_HTML.gif , and, if this converges to some normal form https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdl_HTML.gif , evaluating the substituted refolding of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdm_HTML.gif .
Remark 1
Of course, this definition is informal, notably w.r.t. substitution. In particular, Definition 13 relies on the well-known machinery of substitution monoids and modules over them [911, 14, 15].
Remark 2
Indexing here refers to the fact that our axiomatisation is intrinsically typed and scoped. Thus, e.g., configurations are indexed over lists of types, values are indexed over sequents, i.e., pairs of a list of types and a type, and so on.

2.3 Substitution equivalence

The notion of language machine lets us define substitution equivalence, abstractly. In the usual presentation of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdn_HTML.gif -calculus, we were observing closed programs of some fixed, basic type like the booleans https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdo_HTML.gif . Transposed to the abstract machine presentation, this amounts to observing configurations with a single free variable of type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdp_HTML.gif , which models the final continuation to which the closed context returns. There are only two observations at that type, namely https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdq_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdr_HTML.gif , for true and false, which correspond to the two expected observations.
In the abstract setting, i.e., in any given language machine, we postulate a fixed, “final” typing context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figds_HTML.gif , and think of configurations with free variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdt_HTML.gif as closed programs. The obvious way to observe them is to check whether they diverge, and otherwise record which observation they perform on which free variable of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdu_HTML.gif .
Thus, two configurations https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdv_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdw_HTML.gif with free variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdx_HTML.gif are substitution equivalent iff, for all assignments https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdy_HTML.gif from variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figdz_HTML.gif to values of the same type over https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figea_HTML.gif , https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figeb_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figec_HTML.gif coterminate, and, if they do terminate, perform the same observation on the same variable of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figed_HTML.gif .

2.4 Games and strategies

We now would like to construct the OGS of any language machine, but before that we need to define what we mean by games and strategies. For this, we follow Levy and Staton [23], up to slight reformulation.
We first introduce half-games from https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figee_HTML.gif to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figef_HTML.gif , for any sets https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figeg_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figeh_HTML.gif of Player and Opponent positions, respectively. Intuitively, a half-game describes the moves available in each Player position, and the Opponent positions they lead to.
A game over https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figei_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figej_HTML.gif then consists of a Player half-game from https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figek_HTML.gif to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figel_HTML.gif , and an Opponent half-game from https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figem_HTML.gif to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figen_HTML.gif .
A strategy then consists of
  • an https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figeo_HTML.gif -indexed family of active states, where Player is to play,
  • a https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figep_HTML.gif -indexed family of waiting states, where Opponent is to play,
  • an action partial map, which, to any active state over a position https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figeq_HTML.gif , either diverges, or picks a move from https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figer_HTML.gif and a “next” waiting state, and
  • a reaction map, which, to any waiting state and Opponent move over a position https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figes_HTML.gif , associates a “next” active state.

2.5 Constructing the game

We saw that evaluators are viewed as either diverging, or splitting configurations into a head variable https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/648518_1_En_7_Figet_HTML.gif , an observation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figeu_HTML.gif , and a filling https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figev_HTML.gif . This splitting is used to interpret the considered configuration https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figew_HTML.gif as a strategy in a two-player game, where the program plays as Player and the context plays as Opponent. Let us briefly describe this game, which we call the OGS game.
As a first approximation, the game in question has the same Player and Opponent positions, which consist of pairs https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figex_HTML.gif of typing contexts:
(i)
variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figey_HTML.gif are thought of as defined by the currently waiting player, say https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figez_HTML.gif , hence unknown to the currently active player, say https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfa_HTML.gif ,
(ii)
conversely, variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfb_HTML.gif are defined by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfc_HTML.gif , hence unknown to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfd_HTML.gif .
Accordingly, a move (by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfe_HTML.gif ) consists of an observation on some variable in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figff_HTML.gif . Such an observation may introduce some fresh variables, which are modelled as a typing context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfg_HTML.gif that we call the context increment. Intuitively, https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfh_HTML.gif holds the definitions of variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfi_HTML.gif , and the next position is
This is consistent with (i)(ii) above:
  • the definition of variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfk_HTML.gif are held by the now waiting player https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfl_HTML.gif , while
  • those of variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfm_HTML.gif are held by the now active player https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfn_HTML.gif .
Example 1
If https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfo_HTML.gif , then a possible move is https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfp_HTML.gif , with context increment https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfq_HTML.gif .
Weak bisimilarity https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfr_HTML.gif of strategies is then defined straightforwardly: either both diverge, or they both converge, play the same move, and reach weakly bisimilar strategies, coinductively.

2.6 Constructing the OGS

The crux of OGS is then to interpret the language machine as a strategy in the OGS game. This strategy, which we call the machine strategy, is essentially straightforward:
  • an active state over https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfs_HTML.gif consists of a configuration https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figft_HTML.gif with free variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfu_HTML.gif , and, for each https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfv_HTML.gif , a value of type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfw_HTML.gif with free variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfx_HTML.gif , which we (continue to) call an assignment https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfy_HTML.gif ;
  • waiting states over https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figfz_HTML.gif are assignments https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figga_HTML.gif ;
  • the action of any configuration https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgb_HTML.gif and assignment https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgc_HTML.gif consists in evaluating https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgd_HTML.gif , and diverging if it does; otherwise, it evaluates to some normal form https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figge_HTML.gif , for some filling https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgf_HTML.gif of the context increment https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgg_HTML.gif of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgh_HTML.gif ; the machine strategy then
    • plays the move https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgi_HTML.gif , and
    • picks as its next waiting state the compound assignment https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgj_HTML.gif , over the position https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgk_HTML.gif ;
  • the reaction of an assignment https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgl_HTML.gif to any move https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgm_HTML.gif with context increment https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgn_HTML.gif is the configuration obtained by refolding https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgo_HTML.gif , up to some technicalities that we hide under the rug for the moment. In particular, variables in the context increment https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgp_HTML.gif remain fresh for this player.
At this point, we may state the soundness property: any two configurations which give weakly bisimilar strategies are substitution equivalent.
In order to prove it, it remains to work around a few technical glitches, which we briefly describe in the coming subsections. The first amounts to taking the final typing context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgq_HTML.gif into account at the level of games: this is easy. The second is well known to the experts: it is the “infinite chattering” problem. We deal with it in a novel way, by building acyclicity into the model. The final difficulty is new and surprising. It has to do with the fact that, in all sensible languages, repeated, non-trivial instantiation of the head variable eventually leads to some redex. In the abstract setting, we need an additional hypothesis to ensure this is indeed the case.

2.7 Final moves

It might be tempting to treat the “final” typing context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgr_HTML.gif normally, i.e., to make it part of positions https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgs_HTML.gif . But it would not work. Indeed, once a player makes a final move, the game must stop, in order to reflect the notion of observation that was fixed for substitution equivalence.
We thus tweak the naive definitions of games and strategies given above to incorporate this idea:
(1)
A game comes with a set of final moves.
(2)
The action map of a strategy may either play a proper move as before, or play a final move.
(3)
The final moves of the OGS game are observations on variables in the final typing context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgt_HTML.gif .
(4)
States of the machine strategy are modified similarly: active states over https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgu_HTML.gif comprise a configuration with free variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgv_HTML.gif and an assignment https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgw_HTML.gif , while waiting states are assignments https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgx_HTML.gif .
(5)
The action map of the machine strategy discriminates against the head variable: if it is in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgy_HTML.gif , then a proper move is played; if it is in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figgz_HTML.gif , a final move is played.
(6)
Finally, we adjust weak bisimilarity accordingly: if one strategy plays a final move, then the other should play the same, and conversely.
At the cost of some moderate additional verbosity, this builds the protocol of substitution equivalence into weak bisimilarity of OGS strategies.

2.8 Infinite chattering

Let us now deal with the second announced technical glitch: the infinite chattering problem. A symptom of it is already visible in our description of OGS. Indeed, from a pair of an active and a passive states on a given position https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figha_HTML.gif , we would like to be able to recover a corresponding configuration with free variables in the final typing context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighb_HTML.gif . Such a pair of states amounts to a configuration with free variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighc_HTML.gif , and assignments
so one might hope that substituting https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighe_HTML.gif with https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighf_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighg_HTML.gif in turn would converge to some configuration with free variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighh_HTML.gif . This in fact holds for pairs of states arising from the game, but not for all pairs.
Example 2
For a silly example, consider a case where some free variable https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighi_HTML.gif of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighj_HTML.gif is mapped by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighk_HTML.gif to some variable https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighl_HTML.gif in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighm_HTML.gif , which is in turn mapped to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighn_HTML.gif in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figho_HTML.gif by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighp_HTML.gif .
Such cyclic configurations do not arise during the game, though. Crucially, in the above description, when we form the new waiting state https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighq_HTML.gif , we know that the other assignment https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighr_HTML.gif does not depend on the new variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighs_HTML.gif .
This leads us to introduce a refined version of the game, in which positions record the sequence of context increments, and states of the machine strategy take them into account to build acyclicity into the model. Positions are thus sequences https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fight_HTML.gif of typing contexts.
The idea is that, if the current position is a sequence https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighu_HTML.gif of context increments, then https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighv_HTML.gif was introduced by the previously active, now waiting player https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighw_HTML.gif . Accordingly:
  • A (non-final) move consists of a variable introduced by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighx_HTML.gif , i.e., one in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighy_HTML.gif , together with an observation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fighz_HTML.gif on it – the first index in the sequence depending on the parity of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figia_HTML.gif . The next position is of course https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figib_HTML.gif , where https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figic_HTML.gif denotes the context increment of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figid_HTML.gif .
  • An active state of the machine strategy is a configuration with free variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figie_HTML.gif , equipped with assignments https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figif_HTML.gif as on the left below.
    https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Equ5_HTML.png
    (5)
  • A passive state consists of complementary assignments https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figig_HTML.gif as on the right above.
This time, it is easy to recover a well-defined configuration with free variables in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figih_HTML.gif from an active-passive pair of states, as
https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Equ6_HTML.png
(6)

2.9 Focused redexes and eventual guardedness

Let us now come to the last technical glitch that we had to face. It surprised us, as it is rather theoretical: we know of no concrete, sensible language machine in which it arises. It may be viewed as a form of infinite chattering. Let us briefly explain it. A key lemma in virtually any OGS soundness proof roughly states the following: given any compatible pair of an active state https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figii_HTML.gif and a waiting state https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figij_HTML.gif , the configuration (6), obtained by iterated substitution, behaves the same as letting the strategies associated to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figik_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figil_HTML.gif play against one another. This lemma is simply wrong in general, so we need an additional hypothesis.
A bit more formally, one defines a composition operation. The result of composition may either diverge or play a final move in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figim_HTML.gif . And the key lemma states that the refolded configuration (6) diverges iff the composition does, and, if not, both play the same final move in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figin_HTML.gif .
The difficulty lies in the definition of composition. In principle, it should work as follows. An invariant is that one of the two given strategies is active while the other is waiting. The composition, say https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figio_HTML.gif , is then computed like so:
  • If the active strategy diverges or performs a final move, then so does the composition.
  • If the active strategy performs a non-final move, then the waiting strategy reacts to it, the roles are switched, and we start over.
As a first step towards making this precise, we must give a bit more detail on how we handle partiality. For us, a partial map https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figip_HTML.gif is a map https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figiq_HTML.gif , where https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figir_HTML.gif is Capretta’s delay monad [3], which we briefly recall in §4.2. This is a rather intensional description of partiality, in the sense that an element of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figis_HTML.gif consists of a sequence of “silent computation steps”, denoted by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figit_HTML.gif , which is either infinite or followed by some “result” in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figiu_HTML.gif .
This suggests interpreting the above description as a Coq cofixpoint definition. However, the second clause does not satisfy Coq’s guardedness criterion! Let us illustrate this:
Example 3
Consider https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figiv_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figiw_HTML.gif , for some program https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figix_HTML.gif and evaluation context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figiy_HTML.gif . Since https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figiz_HTML.gif is a normal form, https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figja_HTML.gif plays without any computation step the non-final move https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjb_HTML.gif on https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjc_HTML.gif , and the second recursive clause above says that the composition https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjd_HTML.gif equals the composition
thus making an unguarded corecursive call.
Remark 3
At this point, it is tempting to insert a dummy computation step to make the definition guarded. This does give the expected definition up to weak bisimilarity, but makes the proof break later on, as explained in §4.7.
To justify further, in the above example, semantically, the unguarded call seems right, because it matches the behaviour of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjf_HTML.gif as a whole, our stated goal for composition. Indeed, the second clause models communication between https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjg_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjh_HTML.gif , which is invisible in the behaviour of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figji_HTML.gif .
In order to solve the issue, we need to make sure that no two strategies get stuck in a loop involving only the second clause. This is really subtle: if both players keep on exchanging non-final moves, interleaved with computation steps, then composition is well defined (and diverges); so the only problematic case is when both players exchange non-final moves indefinitely without performing any computation step.
How could this happen? In the machine strategy, when both players exchange a non-final move, the head variable gets instantiated. So the question becomes: in concrete cases, how could repeated instantiation of the head variable not lead to a redex? A first possibility is if the head variable always gets replaced by another variable. But this is ruled out by the refinement introduced in the previous subsection to deal with infinite chattering. Indeed, if some non-final move leads to a head variable https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjj_HTML.gif being instantiated by another variable https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjk_HTML.gif , then acyclicity tells us that https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjl_HTML.gif must have been introduced before https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjm_HTML.gif . Since this is a well-founded ordering, we are safe on this front.
However, this does not suffice in all languages!
Example 4
Consider a language involving https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjn_HTML.gif -abstraction, with an exotic redex of the form
Then, starting from a situation with
  • active state given by the configuration https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjp_HTML.gif and empty assignment,
  • and passive state given by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjq_HTML.gif ,
the first move consists of the observation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjr_HTML.gif on https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjs_HTML.gif , leading to
  • as active state https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjt_HTML.gif and
  • as passive state https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figju_HTML.gif .
We are then stuck in a loop between situations of the following forms
where we ignore the fine layering of assignments for readability.
In order to rule out languages in which this issue arises, we state our main result under the hypothesis that a suitable binary relation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjw_HTML.gif on observations should be well-founded. Explicitly, we have https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjx_HTML.gif iff there exist https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjy_HTML.gif , https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figjz_HTML.gif , https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figka_HTML.gif , and a non-variable https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkb_HTML.gif such that substituting https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkc_HTML.gif for https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkd_HTML.gif in the refolding https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figke_HTML.gif yields some normal form (without evaluating!) of the shape https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkf_HTML.gif , i.e.,
When https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkh_HTML.gif is well-founded, we say that the considered language machine has focused redexes.
Assuming that the considered language machine has focused redexes, we should be able to define composition. However, Coq does not readily accept the definition sketched above, because it does not know that it is productive. In order to proceed cleanly, we introduce a relaxed fixed point operator which contents with a proof that, even though the given equations are not directly guarded in the usual sense, unfolding the definition of each unknown will reach a guard eventually. This enables us to define composition, and at last prove our main result (Theorem 8), which states that any language machine with focused redexes has a sound OGS.

3 ciu equivalence through substitution equivalence

In this section, we explain the idea of substitution equivalence, and the necessary pre-processing step that comes with it, on a simple example, namely simply-typed, call-by-value https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figki_HTML.gif -calculus with a boolean type and recursive functions. Terms are generated by the following grammar
where https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkk_HTML.gif binds https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkl_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkm_HTML.gif in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkn_HTML.gif , as usual. The language is typed. Types and typing contexts are generated by the following grammar,
with the following, standard typing rules.
From now on, all terms are implicitly considered as coming with a typing derivation. Capture-avoiding substitution is defined as usual, and evaluation contexts are defined by the following grammar, with straightforward typing rules.
Context application is defined accordingly. Finally, evaluation is defined by the following inference rules.
As explained in the introduction, ciu equivalence of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figks_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkt_HTML.gif is defined to mean https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figku_HTML.gif , for all closing substitutions https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkv_HTML.gif and boolean contexts https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkw_HTML.gif , for some fixed equivalence relation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkx_HTML.gif between boolean closed programs. More precisely,
Notation 2
We write https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figky_HTML.gif for assignments to each variable https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figkz_HTML.gif of a value of type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figla_HTML.gif in typing context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlb_HTML.gif .
Definition 1
Two programs https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlc_HTML.gif of type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figld_HTML.gif are deemed observably equivalent whenever we have https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figle_HTML.gif iff https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlf_HTML.gif , and similarly with https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlg_HTML.gif .
Definition 2
For any context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlh_HTML.gif and type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figli_HTML.gif , two programs https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlj_HTML.gif are ciu-equivalent, which we denote by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlk_HTML.gif , iff for all assignments https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figll_HTML.gif , and closed evaluation contexts https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlm_HTML.gif of type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figln_HTML.gif with a hole of type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlo_HTML.gif , https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlp_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlq_HTML.gif are observably equivalent.
With the main purpose of unifying notions, and hence simplifying the abstract framework, we want to put context application https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlr_HTML.gif and substitution https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figls_HTML.gif on an equal footing in this definition. The overall idea is to compile our simply-typed, call-by-value https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlt_HTML.gif -calculus down to a slightly lower-level language, as explained in §2.1.
Fig. 1.
Typing and evaluation rules for the lower-level variant of call-by-value https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlu_HTML.gif -calculus
Let us now introduce the low-level language. Low-level types https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlv_HTML.gif are either simple types https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlw_HTML.gif , or negated simple types https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlx_HTML.gif . Programs have simple types https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figly_HTML.gif , while evaluation contexts have negated types https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figlz_HTML.gif . We have syntactic categories for programs and evaluation contexts, and a configuration is a pair of a program of some type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figma_HTML.gif and of an evaluation context of type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmb_HTML.gif . Values and programs are defined and typed exactly as before. Evaluation contexts and configurations are specified by the following grammar.
The typing rules for values and programs are again exactly as before (except that typing contexts may now comprise evaluation context variables). Furthermore, the variable typing rule now covers the fact that any evaluation context variable https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmd_HTML.gif is an evaluation context of type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figme_HTML.gif . Additional typing rules, for evaluation contexts and configurations, are shown in the first part of Figure 1. Capture-avoiding substitution is defined straightforwardly, and evaluation rules are displayed in the second part of Figure 1. We may now introduce substitution equivalence.
Definition 3
For any typing context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmf_HTML.gif , two configurations https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmg_HTML.gif are substitution equivalent, which we denote by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmh_HTML.gif , iff for all assignments https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmi_HTML.gif , https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmj_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmk_HTML.gif are observably equivalent, in the sense that we have https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figml_HTML.gif iff https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmm_HTML.gif , and similarly with https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmn_HTML.gif .
The main point of this section is:
Proposition 1
For any typing context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmo_HTML.gif and type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmp_HTML.gif of the source language, two programs https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmq_HTML.gif are ciu-equivalent iff, in the typing context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmr_HTML.gif (with https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figms_HTML.gif fresh w.r.t. https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmt_HTML.gif ), https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmu_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmv_HTML.gif are substitution equivalent.
Proof
There is a bijection between assignments https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmw_HTML.gif in the lower-level language and pairs of an assignment https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmx_HTML.gif and an evaluation context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmy_HTML.gif of type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figmz_HTML.gif with a hole of type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figna_HTML.gif in the source language. Furthermore, for such assignments and evaluation contexts, https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignb_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignc_HTML.gif are observably equivalent in the obvious sense, hence the result follows.

4 Abstract OGS

In this section, we fill the gaps left by the informal overview of §2.

4.1 An abstract account of substitution

Let us first recall (one presentation of) a standard way of abstracting over capture-avoiding substitution.
Notation 3
We fix a set https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignd_HTML.gif of types for the whole section, and let https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figne_HTML.gif denote the set of sequences of types.
The ambient setting for axiomatising substitution is that of families:
Definition 4
For any sequence https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignf_HTML.gif of sets, we extend the set
to a category, by taking
as hom-set https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figni_HTML.gif , for any https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignj_HTML.gif . In particular, we call the objects of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignk_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignl_HTML.gif , unsorted and sorted families, respectively.
Example 5
A sorted family of particular interest is the one of variables ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignm_HTML.gif ), given by the proof-relevant https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignn_HTML.gif predicate: https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figno_HTML.gif denotes the set of indices at which https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignp_HTML.gif occurs in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignq_HTML.gif .
Let us now explain what it means for sorted and unsorted families to be equipped with substitution. As is standard in the well-scoped approach, we mean substitution in the parallel sense. The basic ingredient for this is the following standard notion, which we call assignment.
Definition 5
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignr_HTML.gif ). For any typing contexts https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figns_HTML.gif and sorted family https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignt_HTML.gif , an https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignu_HTML.gif https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignv_HTML.gif , or assignment when https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignw_HTML.gif is clear from context, consists of an element of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Fignx_HTML.gif , for all https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figny_HTML.gif . In other words, we have
In order to axiomatise substitution for both kinds of families, we introduce the following notion of power families:
Definition 6
Fixing a sorted family https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figoa_HTML.gif , for any sorted family https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figob_HTML.gif and unsorted family https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figoc_HTML.gif , we define the power objects
by        https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figoe_HTML.gif
We may now axiomatise substitution, for both kinds of families:
Definition 7
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figof_HTML.gif ). A substitution monoid is a sorted family https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figog_HTML.gif , equipped with morphisms
subject to associativity and unitality laws.
Definition 8
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figoi_HTML.gif ). A substitution module over a substitution monoid https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figoj_HTML.gif , or substitution https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figok_HTML.gif -module for short, is an unsorted family https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figol_HTML.gif , equipped with a morphism
subject to assocativity and unitality laws.
In both cases, the substitution morphism takes elements over any context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figon_HTML.gif (and type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figoo_HTML.gif , if relevant) and assignments https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figop_HTML.gif , to elements over https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figoq_HTML.gif : this is indeed the expected type for substitution.

4.2 Modelling divergence: the delay monad

Now that we have recalled the standard axiomatisation of substitution, let us explain more precisely how we handle divergence in Coq, which is very simple and standard: we use Capretta’s delay monad [3].
Definition 9
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figor_HTML.gif ). The delay endomap on https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figos_HTML.gif is defined coinductively by the following inference rules.
We also denote by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figou_HTML.gif the pointwise liftings of delay to categories of families https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figov_HTML.gif , e.g., https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figow_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figox_HTML.gif .
Remark 4
The notation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figoy_HTML.gif is meant to suggest a silent computation step. Such https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figoz_HTML.gif s should not be confused with types, which hopefully will be easy from context.
Elements of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpa_HTML.gif are thought of as potentially diverging computations of type https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpb_HTML.gif : divergence is modelled by the infinite chain of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpc_HTML.gif s; converging computations have the shape https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpd_HTML.gif .
Depending on context, we will consider elements of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpe_HTML.gif equivalent up to strong or weak bisimilarity, which we now recall.
Definition 10
For any relation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpf_HTML.gif between sets (or families) https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpg_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figph_HTML.gif , we let https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpi_HTML.gif be such that https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpj_HTML.gif iff https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpk_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpl_HTML.gif either both diverge, or evaluate to some https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpm_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpn_HTML.gif with https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpo_HTML.gif . We write https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpp_HTML.gif for weak bisimilarity ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpq_HTML.gif ), which we define as https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpr_HTML.gif .
We write https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figps_HTML.gif for strong bisimilarity ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpt_HTML.gif ), the canonical lifting of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpu_HTML.gif to the delay coinductive type: either both sides loop or both converge to the same element in the same number of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpv_HTML.gif steps.
Notation 4
We write interchangeably https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpw_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpx_HTML.gif for the bind ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpy_HTML.gif ) operator of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figpz_HTML.gif —evaluate https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqa_HTML.gif , and if it returns some https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqb_HTML.gif , then evaluate https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqc_HTML.gif .

4.3 Language machines and substitution equivalence

Let us now introduce our axiomatisation of evaluation and observation more formally than in the overview. We will then wrap this all up into the definition of language machines, and define substitution equivalence.
Definition 11
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqd_HTML.gif ). An evaluation structure on any unsorted families https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqe_HTML.gif consists of maps: https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqf_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqg_HTML.gif such that https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqh_HTML.gif .
Remark 5
By Definition 10, the equation says that evaluating the embedding https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqi_HTML.gif of some normal form https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqj_HTML.gif yields https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqk_HTML.gif in zero computation steps.
Definition 12
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figql_HTML.gif ). An observation structure https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqm_HTML.gif is a type-indexed set https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqn_HTML.gif together with a map https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqo_HTML.gif .
For any observation structure https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqp_HTML.gif , we define the unsorted family https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqq_HTML.gif of pointed observations by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqr_HTML.gif We extend the map https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqs_HTML.gif to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqt_HTML.gif , defining https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqu_HTML.gif by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqv_HTML.gif
Thus, a pointed observation over https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqw_HTML.gif consists of a variable, together with an observation at its type.
Remark 6
In the literature, observations are sometimes called ultimate patterns [22], continuation patterns [30], atomic values [20], or abstract values [18].
Definition 13
A language machine consists of
  • a substitution monoid https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqx_HTML.gif of values,
  • a substitution https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqy_HTML.gif -module https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figqz_HTML.gif of configurations,
  • an observation structure https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figra_HTML.gif ,
  • an evaluation structure on https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrb_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrc_HTML.gif ,
where https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrd_HTML.gif .
Evaluation and refolding are furthermore required to respect substitution ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figre_HTML.gif ), in the sense that, for all https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrf_HTML.gif , https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrg_HTML.gif , https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrh_HTML.gif , with https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figri_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrj_HTML.gif , the following hold
where we denote
  • both substitution maps and pointwise substitution by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrl_HTML.gif , and
  • the refolding https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrm_HTML.gif of any normal form https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrn_HTML.gif by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figro_HTML.gif .
Remark 7
By pointwise substitution, we mean that https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrp_HTML.gif .
Notation 5
In the sequel, we often treat refolding https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrq_HTML.gif as an implicit coercion. We also extend the notation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrr_HTML.gif to arbitrary values, writing https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrs_HTML.gif for https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrt_HTML.gif , for fresh https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figru_HTML.gif .
Example 6
The lower-level language of §3 forms a language machine. We take https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrv_HTML.gif to consist of types https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrw_HTML.gif and negated types https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrx_HTML.gif (i.e., it is the disjoint union of two copies of simple types); https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figry_HTML.gif consists of configurations https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figrz_HTML.gif ; https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsa_HTML.gif consists of values https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsb_HTML.gif , and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsc_HTML.gif consists of all contexts https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsd_HTML.gif . Before defining https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figse_HTML.gif , we introduce the family https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsf_HTML.gif of ultimate values, which is the subfamily https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsg_HTML.gif defined inductively by the following linear type system,
where we write https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsi_HTML.gif for https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsj_HTML.gif . In words, at each https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsk_HTML.gif (a simple or negated simple type), https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsl_HTML.gif is an ultimate value; we have https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsm_HTML.gif , and so on. We then define https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsn_HTML.gif with similar notation:
Let us now define substitution equivalence, for any language machine https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsp_HTML.gif .
Definition 14
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsq_HTML.gif ). We define https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsr_HTML.gif at any https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figss_HTML.gif to be the composite
Definition 15
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsu_HTML.gif ). For any fixed final typing context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsv_HTML.gif , two configurations https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsw_HTML.gif are substitution equivalent at https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsx_HTML.gif , written https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figsy_HTML.gif , iff:

4.4 Games and strategies

We now turn to making precise the contents of §2.4. Levy and Staton’s notion of game is parameterised by sets https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figta_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtb_HTML.gif of client and server positions, respectively. The definition then proceeds to postulate families of client moves from https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtc_HTML.gif to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtd_HTML.gif , and server moves from https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figte_HTML.gif to https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtf_HTML.gif . As this is symmetric, we start by introducing a notion of “half-game”, and then define games as pairs thereof.
Definition 16
A half-game ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtg_HTML.gif ) over sets https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figth_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figti_HTML.gif consists of an https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtj_HTML.gif -indexed family of moves https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtk_HTML.gif , and a next map in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtl_HTML.gif . We denote by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtm_HTML.gif the set of half-games over https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtn_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figto_HTML.gif .
A game ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtp_HTML.gif ) over sets https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtq_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtr_HTML.gif consists of a client half-game in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figts_HTML.gif , a server half-game in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtt_HTML.gif , and a set of final moves. We denote by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtu_HTML.gif the set of games over https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtv_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtw_HTML.gif .
Notation 6
We denote by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtx_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figty_HTML.gif the components of any half-game https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figtz_HTML.gif , and by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figua_HTML.gif , https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figub_HTML.gif , and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figuc_HTML.gif the components of any game https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figud_HTML.gif .
We will need the following notion of dual game.
Definition 17
The dual https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figue_HTML.gif of a game https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figuf_HTML.gif is defined by swapping the client and server: https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figug_HTML.gif , https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figuh_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figui_HTML.gif .
Now that games are defined, we turn to defining strategies in a game. We proceed coalgebraically, for which we need the following “derived” functors.
Definition 18
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figuj_HTML.gif ). Given any half-game https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figuk_HTML.gif , we define two functors https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figul_HTML.gif , the action functor https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figum_HTML.gif and the reaction functor https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figun_HTML.gif :
We may now define strategies.
Definition 19
Given a game https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figup_HTML.gif , a strategy for https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figuq_HTML.gif consists of families https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figur_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figus_HTML.gif of active and waiting states, respectively, together with
which we respectively call the action and reaction morphisms.
We denote by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figuu_HTML.gif the set of strategies for https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figuv_HTML.gif .
Notation 7
We denote by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figuw_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figux_HTML.gif the action and reaction morphisms of any strategy https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figuy_HTML.gif .
Remark 8
The occurrence of the (family lifting of the) delay monad in the action morphism means that we allow Proponent to “think forever” and never actually play. This is crucial for interpreting languages with general recursion.
Remark 9
In the code, this is where indexed interaction trees come in. We define strategies ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figuz_HTML.gif ) not as coalgebras, as here, but as interaction trees, i.e., elements of the final coalgebra https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figva_HTML.gif
The main point of OGS consists in interpreting configurations as strategies in some game, in the hope that weak bisimilarity between induced strategies entails substitution equivalence. Let us define weak bisimilarity.
Definition 20
Given two strategies https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvb_HTML.gif , a weak bisimulation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvc_HTML.gif is a pair of an https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvd_HTML.gif -indexed relation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figve_HTML.gif between active states and a https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvf_HTML.gif -indexed relation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvg_HTML.gif between waiting states, such that
where https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvi_HTML.gif is shorthand for https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvj_HTML.gif , and we lift functors to relations in the straightforward way. Let weak bisimilarity, denoted by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvk_HTML.gif , be the largest weak bisimulation.

4.5 The OGS game

Let us now define the OGS game corresponding to any language machine. For §4.54.7, we fix a set https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvl_HTML.gif of types, a language machine https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvm_HTML.gif , and a typing context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvn_HTML.gif .
Definition 21
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvo_HTML.gif ). An interleaved context is a list of contexts. We denote by https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvp_HTML.gif the set of interleaved contexts.
Of course, we may extract from any interleaved context the variables introduced by the currently active, resp. waiting player:
Definition 22
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvq_HTML.gif ). We define two collapsing functions https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvr_HTML.gif https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvs_HTML.gif as follows:        https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvt_HTML.gif        https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvu_HTML.gif
Remark 10
Intuitively, https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvv_HTML.gif retains from an interleaved context the variables that are unknown to the currently active player, starting with the last introduced context. Symmetrically, https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvw_HTML.gif retains those that are unknown to the waiting player, which does not include the last introduced context.
Let us now define the OGS game, as expected. This only depends on the fixed context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvx_HTML.gif and the observation structure of the considered language machine.
Definition 23
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvy_HTML.gif ). We define the OGS half-game https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figvz_HTML.gif by:
Furthermore, the OGS game https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwb_HTML.gif is defined by

4.6 The machine strategy

Let us now define the machine strategy for the given language machine https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwd_HTML.gif and final typing context https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwe_HTML.gif , fixed at the beginning of §4.5.
Definition 24
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwf_HTML.gif ). Let https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwg_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwh_HTML.gif denote the https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwi_HTML.gif -indexed families of active, resp. waiting, interleaved assignments defined inductively as follows.
Remark 11
This is merely a formal version of (5). Beware, though, that the active player in an even interleaved context is Proponent, while the active player in an odd interleaved context is Opponent.
Like the interleaved contexts by which they are indexed, interleaved assignments can be collapsed into basic assignments.
Definition 25
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwk_HTML.gif ). The collapsing functions for interleaved assignments are defined by mutual induction as follows, for all https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwl_HTML.gif ,
where https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwn_HTML.gif denotes the obvious weakening: we have https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwo_HTML.gif for some https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwp_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwq_HTML.gif , and the result is https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwr_HTML.gif
We now have everything in place to define the machine strategy.
Definition 26
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figws_HTML.gif ). The machine strategy https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwt_HTML.gif is defined as follows:
  • the family of active states is https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwu_HTML.gif
  • the family of waiting states is https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwv_HTML.gif
  • the action morphism is defined by
  • the reaction morphism is defined by
where https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwy_HTML.gif denotes the obvious assignment https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figwz_HTML.gif .
To finish up, we define two functions injecting configurations (resp. assignments) into active (resp. waiting) machine strategy states ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxa_HTML.gif ),
where https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxc_HTML.gif is the obvious weakening https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxd_HTML.gif , and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxe_HTML.gif is the singleton sequence.

4.7 Soundness

We may now state the main result, recalling Notation 5. We introduce the following technical, yet mild conditions on the considered language machine:
Definition 27
A substitution monoid https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxf_HTML.gif is clear-cut iff its unit https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxg_HTML.gif is injective (where https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxh_HTML.gif denotes the variables family of Example 5), and has decidable image whose complement is furthermore stable under renaming. For a clear-cut https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxi_HTML.gif , we let https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxj_HTML.gif denote the subfamily of non-variable elements.
Definition 28
Assuming https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxk_HTML.gif is clear-cut, we define the binary relation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxl_HTML.gif on https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxm_HTML.gif by
A language machine has focused redexes iff https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxo_HTML.gif is well-founded.
Theorem 8
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxp_HTML.gif ). For any language machine with focused redexes and clear-cut values, weak bisimilarity of induced OGS strategies is sound w.r.t. substitution equivalence, i.e., for any pair of configurations https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxq_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxr_HTML.gif , weak bisimilarity of induced strategies entails substitution equivalence:
Remark 12
Let us unfold notations a bit: https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxt_HTML.gif denotes the positive component of weak bisimilarity between strategies (Definition 20) in the OGS game (Definition 23), and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxu_HTML.gif denotes substitution equivalence (Definition 15).
The rest of this section is devoted to sketching the proof. We first describe the overall structure, and then focus on the main difficulty.
We start by defining a composition operation
We expect this operation to satisfy the following properties.
Definition 29
1.
Composition is adequate ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxw_HTML.gif ) iff, for all https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxx_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxy_HTML.gif , we have https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figxz_HTML.gif .
 
2.
Weak bisimilarity is a congruence ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figya_HTML.gif ) for composition iff, for any https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyb_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyc_HTML.gif , we have https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyd_HTML.gif .
 
Remark 13
The adequacy equation lives in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figye_HTML.gif (recalling Definition 14).
Let us readily show that soundness follows from congruence and adequacy.
Proposition 2
If any adequate composition for which weak bisimilarity is a congruence exists, then OGS is sound.
Proof
For any configurations https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyf_HTML.gif with weakly bisimilar interpretations https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyg_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyh_HTML.gif , and any assignment https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyi_HTML.gif , we have
hence https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyk_HTML.gif , as desired.
It thus remains to define a congruent and adequate composition. The plan for this is to take the fixed point of an equation, in the following sense.
Definition 30
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyl_HTML.gif ). An equation consists of a set https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figym_HTML.gif of variables, a set https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyn_HTML.gif of constants, and a definition function https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyo_HTML.gif .
Since we are interested in weak bisimilarity, it seems easier to try and construct weak fixed points of equations https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyp_HTML.gif , that is, maps https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyq_HTML.gif such that https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyr_HTML.gif for all https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figys_HTML.gif . This may be done by safely guarding all occurrences of “variables” in https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyt_HTML.gif by a https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyu_HTML.gif :
Definition 31
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyv_HTML.gif ). Given an equation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyw_HTML.gif , the iteration of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyx_HTML.gif is a map https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figyy_HTML.gif given coinductively by:
Proposition 3
The iteration of any equation is a weak fixed point.
Using this technique, we may define a composition operation for which weak bisimilarity is a congruence. We will see that adequacy is more problematic.
Definition 32
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figza_HTML.gif ). The composition equation is:
Let naive composition be the iteration of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzc_HTML.gif .
Proposition 4
Weak bisimilarity is a congruence for naive composition.
Proof
By coinduction: the binary relation on https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzd_HTML.gif given by all pairs https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figze_HTML.gif such that https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzf_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzg_HTML.gif , is a weak bisimulation.
In order to prove adequacy, we have to give a weak bisimulation between https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzh_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzi_HTML.gif . When facing such an equational proof, where one of the members is defined as a fixed point (here composition), the prime reasoning scheme is uniqueness of fixed points. Indeed, assuming the composition equation has a unique fixed point, and that substituting-then-evaluating-then-observing is one, then both must agree. However, general equations do not have unique weak fixed points, so we have to apply uniqueness of strong fixed points, i.e., fixed points w.r.t. strong bisimilarity. But there is a further complication: while all equations admit weak fixed points, given by iteration as we saw, this is not the case for strong fixed points. Coq’s basic cofixpoint feature enables the construction of strong fixed points for guarded equations, in the following sense.
Definition 33
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzj_HTML.gif ). An element https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzk_HTML.gif is guarded if it is not of the form https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzl_HTML.gif . An equation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzm_HTML.gif is guarded if for all https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzn_HTML.gif , https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzo_HTML.gif is guarded.
However, https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzp_HTML.gif is not guarded in general, as explained in Example 3, which may lead the definition to be ill-founded in some languages, as sketched in Example 4. This is where the focused redexes hypothesis comes in: it allows us to show that https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzq_HTML.gif is eventually guarded, in the following sense.
Definition 34
An equation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzr_HTML.gif is eventually guarded if for all https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzs_HTML.gif , there exists an https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzt_HTML.gif such that https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzu_HTML.gif is guarded, where by definition
Proposition 5
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzw_HTML.gif , https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzx_HTML.gif ). All eventually guarded equations admit a unique strong fixed point, which is pointwise weakly bisimilar to any weak fixed point.
Proof
(sketch). Since, for all https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzy_HTML.gif , an eventually guarded equation https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figzz_HTML.gif can be pointwise unrolled a finite number https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaaa_HTML.gif of times into a guarded element, https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaab_HTML.gif , we construct the fixed point of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaac_HTML.gif as the guarded fixed point of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaad_HTML.gif .
Proposition 6
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaae_HTML.gif ). If https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaaf_HTML.gif has focused redexes and clear-cut values, then https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaag_HTML.gif is eventually guarded, and thus admits a strong fixed point, say https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaah_HTML.gif .
We may now conclude our soundness proof.
Proposition 7
( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaai_HTML.gif ). If the language machine https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaaj_HTML.gif has focused redexes, then composition is adequate.
Proof
(sketch). The idea is to show that the map https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaak_HTML.gif is something like a strong fixed point of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaal_HTML.gif . This does not quite type check, however, so we need to generalize the two arguments https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaam_HTML.gif to pairs of active and passive machine strategy states. Following (6), we define https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaan_HTML.gif by:
We have https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaap_HTML.gif , and, as desired, https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaaq_HTML.gif is a strong fixed point of https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaar_HTML.gif ( https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaas_HTML.gif ). At last, we have, for any https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaat_HTML.gif and https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaau_HTML.gif :
Beyond the already discussed, closely related work [21, 23, 29], let us mention recent work on the structure needed to collapse the composition of an active and a waiting state into a language machine configuration [19, 21]. Unlike in our work is that acyclicity is not built into the OGS game, but proved after the fact.
The issue of infinite chattering was also studied in game semantics [1, 4, 17] for showing that total strategies are closed under composition. This notion of infinite chattering thus differs from the one studied here, which allows programs to have infinite reduction paths. In our setting, an infinite chattering would be an artifact of the composition looping without even creating a reduction step.
Finally, there is a lot of work on unique solutions of (co)recursive equations. Deducing bisimilarity of two LTSs from the fact that they satisfy the same recursive equation, and that this equation admits a unique solution (up-to bisimilarity), is a standard technique in process calculi, introduced by Hoare [16] and Milner [28], which is still explored today [7]. Let us also mention the category-theoretic work on monads with iteration operators [8, 12, 25, 26], which recently culminated in a widely unifying approach [13], that features an abstract notion of guardedness. Links with the interaction trees library [29] have been established, showing that the itree datatype, considered up to weak bisimilarity, forms a coinductive resumption monad, i.e., it computes cofree coalgebras for a functor of the form https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaaw_HTML.gif . The resulting monad is furthermore complete Elgot (i.e., it admits potentially non-unique solutions of all equations), and iterative (i.e., it admits unique solutions of “guarded” equations).

6 Conclusion and perspectives

We have proposed an abstract notion of language with evaluator, for which we have constructed a generic OGS interpretation, which we have proved sound, in Coq [2]. We have demonstrated the expressiveness of our framework by instantiating it on a variety of simply-typed https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figaax_HTML.gif -calculi with control effects – although only one is treated here for lack of space.
An important direction for future work is to incorporate more language features into the framework. Notably, we plan to cover effectful evaluators by generalising from the delay monad to richer, well-behaved monads. It would also be useful to handle more sophisticated type systems, including, e.g., polymorphism or subtyping.
Another direction consists in investigating completeness in the abstract framework, be it by restricting attention to sufficiently effectful languages, or by refining the OGS model to make it fully abstract, i.e., by enforcing conditions like well-bracketing or visibility.
Finally, it might be fruitful to investigate the link between OGS and other models in the abstract framework, including denotational game semantics and Lassen’s normal form bisimilarity.
Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://​creativecommons.​org/​licenses/​by/​4.​0/​), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.
The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.
Fußnoten
1
It is a bit unfortunate that substitution https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figw_HTML.gif and context application https://static-content.springer.com/image/chp%3A10.1007%2F978-3-031-91118-7_7/MediaObjects/648518_1_En_7_Figx_HTML.gif have the same notation. It is, however, so common, that we stick to the usual notation.
 
2
This is sometimes called an ultimate pattern.
 
Literatur
1.
Zurück zum Zitat Abramsky, S., et al.: Semantics of interaction: an introduction to game semantics. Semantics and Logics of Computation 14(1) (1997) Abramsky, S., et al.: Semantics of interaction: an introduction to game semantics. Semantics and Logics of Computation 14(1) (1997)
16.
Zurück zum Zitat Hoare, C.A.R.: Communicating Sequential Processes. Prentice-Hall (1985) Hoare, C.A.R.: Communicating Sequential Processes. Prentice-Hall (1985)
17.
Zurück zum Zitat Hyland, M.: Game semantics. Semantics and logics of computation 14, 131 (1997) Hyland, M.: Game semantics. Semantics and logics of computation 14,  131 (1997)
28.
Zurück zum Zitat Milner, R.: Communication and concurrency. PHI Series in computer science, Prentice Hall (1989) Milner, R.: Communication and concurrency. PHI Series in computer science, Prentice Hall (1989)
29.
Zurück zum Zitat Xia, L., Zakowski, Y., He, P., Hur, C., Malecha, G., Pierce, B.C., Zdancewic, S.: Interaction trees: representing recursive and impure programs in coq. Proc. ACM Program. Lang. 4(POPL), 51:1–51:32 (2020). https://doi.org/10.1145/3371119 Xia, L., Zakowski, Y., He, P., Hur, C., Malecha, G., Pierce, B.C., Zdancewic, S.: Interaction trees: representing recursive and impure programs in coq. Proc. ACM Program. Lang. 4(POPL), 51:1–51:32 (2020). https://​doi.​org/​10.​1145/​3371119
30.
Zurück zum Zitat Zeilberger, N.: The Logical Basis of Evaluation Order and Pattern-Matching. Ph.D. thesis, USA (2009), aAI3358066 Zeilberger, N.: The Logical Basis of Evaluation Order and Pattern-Matching. Ph.D. thesis, USA (2009), aAI3358066
Metadaten
Titel
An abstract, certified account of operational game semantics
verfasst von
Peio Borthelle
Tom Hirschowitz
Guilhem Jaber
Yannick Zakowski
Copyright-Jahr
2025
DOI
https://doi.org/10.1007/978-3-031-91118-7_7