<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Effectful applicative similarity for call-by-name lambda calculi</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Ugo Dal Lago</string-name>
          <email>ugo.dallago@unibo.it</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Francesco Gavazzo</string-name>
          <email>francesco.gavazzo2@unibo.it</email>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ryo Tanaka</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>The University of Tokyo</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Università di Bologna &amp; INRIA Sophia Antipolis</institution>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Università di Bologna &amp; INRIA Sophia Antipolis</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>ion result for such a generic, coinductive methodology for program equivalence.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Program equivalence is a crucial notion in the theory of programming languages,
and its study is at the heart of programming language semantics. When
higherorder functions are available, programs have a non-trivial interactive behaviour,
and giving a satisfactory and at the same time handy definition of program
equivalence becomes complicated. The problem has been approached, in many
different ways, e.g. by denotational semantics or by contextual equivalence. These
two approaches have their drawbacks, the first one relying on the existence of
a denotational model, the latter quantifying over all contexts, thus making the
task of proving programs equivalent quite hard. Handier methodologies for
proving programs equivalent have been introduced along the years based on logical
relations and applicative bisimilarity. Logical relations were originally devised
for typed, normalising languages, but later generalised to more expressive
formalisms, e.g., through step-indexing [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] and biorthogonality [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Starting from
Abramsky’s pioneering work on applicative bisimilarity [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], coinduction has also
been proved to be a useful methodology for program equivalence, and has been
applied to a variety of calculi and language features [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ].
      </p>
      <p>
        The just described scenario also holds when the underlying calculus is
not pure, but effectful. There have been many attempts to study effectful
calculi [
        <xref ref-type="bibr" rid="ref16 ref19">19,16</xref>
        ] by way of denotational semantics [
        <xref ref-type="bibr" rid="ref8 ref9">9,8</xref>
        ], logical relations [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], and
applicative bisimilarity [
        <xref ref-type="bibr" rid="ref14 ref5 ref7">14,7,5</xref>
        ]. But while the denotational and logical relation
semantics of effectful calculi have been studied in the abstract [
        <xref ref-type="bibr" rid="ref11 ref13">11,13</xref>
        ], the same
cannot be said about applicative bisimilarity and related coinductive techniques.
There is a growing body of literature on applicative bisimilarity for calculi with,
e.g., nondeterministic [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ], and probabilistic effects [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], but each notion of an
effect has been studied independently, often getting different results. Distinct
proofs of congruence for applicative bisimilarity, even if done through a common
methodology, namely the so-called Howe’s method [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ], do not at all have the
same difficulty in each of the cases cited above.
      </p>
      <p>The observations above naturally lead to some questions. Is there any way to
factor out the common part of the congruence proof for applicative bisimilarity in
effectful calculi? Where do the limits on the correctness of applicative bisimilarity
lie, in presence of effects?</p>
      <p>
        This paper is part of a longstanding research effort directed to giving answers
to the questions above. The first two authors, together with Paul Blain Levy,
have recently introduced a general notion of applicative bisimilarity for
lambdacalculi based on monads and relators [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. This provides, under mild conditions, a
sound methodology for checking contextual equivalence of programs. The central
idea is to take simulations as relations on terms and to use a relator to lift a
(candidate) simulation to a relation on the monadic images of values. There is
however little hope to prove a generic full-abstraction result in such a setting,
although for certain notions of an effect, full abstraction is already known to
hold [
        <xref ref-type="bibr" rid="ref1 ref5">1,5</xref>
        ].
      </p>
      <p>In this paper, we study a different notion of simulation, which puts in relation
not terms but their semantics. This way, interaction between terms and the
environment can be modeled by an ordinary, deterministic, transition system
and, with minimal side conditions, similarity can be proved to be not only a
sound, but also to coincide with the contextual preorder. This, however, only
holds when terms are call-by-name evaluated.</p>
      <p>We first of all introduce a computational -calculus in which general
algebraic effects can be represented, and give a monadic call-by-name operational
semantics for it, showing how the latter coincides with the expected one in many
distinct concrete examples. We then show how applicative bisimilarity can be
defined for any instance of such a monadic -calculus, and that in all cases it is
also fully-abstract. Along the lines, we also prove a CIU Theorem.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Mathematical Preliminaries</title>
      <p>
        In this section, we recall some basic definitions and results on complete partial
orders, categories, and monads. Due to space constraints, there is no hope to be
comprehensive. The reader can refer to [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] for details and further references.
      </p>
      <p>
        We assume basic familiarity with domain theory. In particular, we do not
define the notions of directed complete partial order (dcpo for short), and of
pointed dcpo (dcppo for short). Similarly, we do not give the notions of
monotone, continuous, and strict functions, which are standard. Following [
        <xref ref-type="bibr" rid="ref19 ref20">19,20</xref>
        ],
we consider operations producing effects coming from a signature. Semantically,
dealing with operation symbols requires the introduction of appropriate algebraic
structures interpreting such operation symbols as suitable functions. Combining
the algebraic and the order theoretic structures just described, leads to consider
algebras carrying a domain structure (dcppo, in this paper), and with all
function symbols interpreted as continuous functions. The formal notion capturing
all these desiderata is the one of a continuous -algebra [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. Recall that a
signature = (F ; ) consists of a set F of operation symbols and a map : F ! N,
assigning to each operation symbol a (finite) arity.
      </p>
      <sec id="sec-2-1">
        <title>Definition 1. Given a signature , a continuous -algebra is a dcppo (D; v; ?)</title>
        <p>such that for any function symbol in there is an associated continuous
function D : D ( ) ! D.</p>
        <p>
          Example 1. Let X be a set: the following are examples of dcppo (see [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ] for
further examples).
1. The flat lifting Xundef of X, defined as X + fundefg, ordered as follows: x v y
iff x = undef or x = y.
2. The set (X +E)undef (think to E as a set of exceptions), ordered as in previous
example. We can consider the signature = fraise(e) j e 2 Eg, where each
operation symbol raise(e) is interpreted as the constant inl(inr(e)).
3. The powerset PX, ordered by inclusion. The least upper bound of a chain of
sets is their union, whereas the bottom is the empty set. We can consider the
signature = f g containing a binary operation symbol for
nondeterministic choice. The latter can be interpreted as (binary) union, which is indeed
continuous.
4. The set of discrete subdistributions DX = f : X ! [0; 1] j Px2X (x) 1g
over X, ordered pointwise: v iff 8x 2 X: (x) (x). The dcppo
structure is pointwise induced by the one of [0; 1] with the natural ordering.
The least element is the always zero distribution x 7! 0 (note that the latter
is a subdistribution, and not a distribution). We can consider the signature
= f p j p 2 [0; 1]g with a family of probabilistic choice operations indexed
by real numbers in [0; 1]. We can interpret p as the binary operation (x; y) 7!
p x + (1 p) y, which is indeed continuous.
        </p>
        <p>
          Since we are interested in effectul calculi, we rely on monads hT; ; i [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ]
(on the category of sets and functions) to model the kind of effects we are
interested in. For a function f : X ! T Y we denote by f y its Kleisli lifting
        </p>
        <p>
          Y T f : T X ! T Y . We are interested in monads carrying a continuous
algebra structure. That is, for a fixed signature , we require a monad T to
come with a map associating to any set X an order vX on T X and an element
?X 2 T X such that (T X; vX ; ?X ) is a continuous -algebra wrt the order
vX . We also require Kleisli lifting to satisfy specific continuity conditions4. The
reader can consult [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ] for details.
        </p>
        <p>Example 2. It is easy to see that all the constructions in Example 1 carry a
monad structure.
4 For all sets X; Y we require (notice that T Y being a dcppo, so is X ! T Y ) both
sup F y = supf2F f y and f y(sup T ) = supt2T f y(t) to hold, where F X ! T Y
and T T X are directed.</p>
        <p>
          Finally, following [
          <xref ref-type="bibr" rid="ref19">19</xref>
          ] we require monads to properly interact with algebraic
operations.
        </p>
        <sec id="sec-2-1-1">
          <title>Definition 2. Let T be a monad carrying a continuous -algebra structure.</title>
        </sec>
      </sec>
      <sec id="sec-2-2">
        <title>We say that T is algebraic if for any function f : X ! T Y , f y is -algebra</title>
        <p>homomorphism. That is,
f y( X (t1; : : : ; tn)) =</p>
        <p>Y (f y(t1); : : : ; f y(tn)):
We treat ?X as an algebraic constant, so that the above definition implies
f y(?X ) = ?Y , for any f : X ! T Y .
3</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Syntax and Operational Semantics</title>
      <p>
        In this section we introduce a computational -calculus and give it call-by-name
monadic operational semantics following [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ]. We fix a signature and a monad
hT; ; i satisfying the conditions of previous section.
      </p>
      <sec id="sec-3-1">
        <title>Definition 3. For a fixed signature</title>
        <p>are defined as follows:
the sets
and V
of terms and values
M; N ::= V j M N j
(M; : : : ; M )
V ::= x j
x:M:</p>
      </sec>
      <sec id="sec-3-2">
        <title>We let letters M; N : : : and V; W; : : : to range over terms and values, respectively.</title>
      </sec>
      <sec id="sec-3-3">
        <title>We denote by (x) the set of terms with free variables from x and write for</title>
        <p>the set (;). Similar conventions apply to the set of values.</p>
        <p>
          We give operational semantics to our calculus as in [
          <xref ref-type="bibr" rid="ref19">19</xref>
          ] (which we refer to
for details). An indexed function symbol i consists of a function symbol 2
together with an index i 2 f0; : : : ; ( ) 1g. Evaluation contexts are defined
by the simple grammar: E ::= [ ] j EM . Small-step semantics is defined by
means of a binary relation ! on closed terms and of a ternary relation ! on
closed terms and indexed function symbols, according to the rules in Figure 1.
        </p>
        <p>( x:M )N ! M [N=x]
(M0; : : : ; Mn 1) !i Mi</p>
        <p>M ! N
E[M ] ! E[N ]</p>
        <p>M !i N</p>
        <p>E[M ] !i E[N ]</p>
        <p>We now give a monadic multi-step operational semantics to the above
calculus. Multi-step operational semantics relates a closed term M to a set of elements
in T V, representing finite approximations of its evaluation. We refer to elements
in T V as monadic values.</p>
        <sec id="sec-3-3-1">
          <title>Definition 4. Define the relation ) between closed terms and monadic values by the rules in Figure 2, where ? is the bottom element of T V and V is the interpretation of in T V.</title>
          <p>V )</p>
          <p>M ) ?
(V )</p>
          <p>M ! N</p>
          <p>N ) t
M ) t</p>
          <p>M !i Ni
M )</p>
          <p>Ni ) ti</p>
          <p>V (t1; : : : ; tn)
supM)t t.</p>
          <p>It is easy to prove that the set ft 2 T V j M ) tg of finite approximations of
(the execution of) M is directed, meaning that it has a least upper bound.
Definition 5. Define the evaluation function J K :
0 !</p>
          <p>T (V) by JM K =
4</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Observational Equivalence</title>
      <p>In this section we give a general notion of observation on top of which we define
several behavioural preorders. We rely on the basic assumption that we can only
observe side effects.</p>
      <p>Intuitively, an observation is a function that takes an element in T V
representing the computation of a term and returns what we can observe about it.
Since we assume that the observable part of a computation consists only of the
side effects that could occur during such computation, such observable part is
uniquely determined by the semantics of the operations considered.</p>
      <p>Since we are working with an untyped calculus, it is customary not to observe
values5.</p>
      <p>Definition 6. Let 1 = f g be the one element set and !X : X ! 1 be the
unique function mapping each element in X to . Define the observation function</p>
      <sec id="sec-4-1">
        <title>Obs : T V ! T 1 as T (!V ). Observations trivially extends to terms by defining</title>
        <p>Obs(M ) as Obs(JM K).</p>
        <p>Note that by very definition of monad we have T (!V ) = ( 1 !)y. As a
consequence, since T is algebraic an easy calculation shows that we have the following
equalities:</p>
        <p>Obs(?) = ?T (1);</p>
        <p>Obs( V (V )) = 1( );
Obs( V (t1; : : : ; tn) =</p>
        <p>1(Obs(t1); : : : ; Obs(tn)):
5 One is usually more concerned with different notions of convergence, such as may
convergence or the probability of convergence.</p>
        <p>Remark 1. Notice that the function Obs is uniquely determined by the effect
signature. That is because of our choice of not distinguishing between values.
Nevertheless, it is easy to see that our definition of Obs can be extended to
any function f : V ! X, where the set X represents a set of observables and
f encodes a ground observation on values. In fact, we would have Obs(V ) =
( f )(V ).</p>
        <p>We can now give a general notion of contextual preorder.</p>
        <sec id="sec-4-1-1">
          <title>Definition 7. Define contexts by the following two grammars</title>
          <p>In this section we define the notion of applicative simulation and prove full
abstraction of applicative similarity wrt the CIU preorder. First of all, we lift
the notion of application from terms to monadic values.
define the application t</p>
          <p>M 2 T V of M
Definition 8. For t 2 T V and M 2
to t as6: (( x:L) 7! JL[M=x]K)y(t):</p>
          <p>It is easy to see that we have:</p>
          <p>?
( x:N )
V (t1; : : : ; tn)</p>
          <p>M = ?;
M = JN [M=x]K;
M = V (t1 M; : : : ; tn</p>
          <p>M );
and that for terms M; N we have JM N K = JM K N:
6 Note that with a similar strategy it is possible to extend application to T V .</p>
        </sec>
      </sec>
      <sec id="sec-4-2">
        <title>Definition 9. A relation R T V T V is an applicative simulation if whenever (t; u) 2 R we have</title>
        <p>1. Obs(t) v Obs(u);
2. For any term M , (t M; u M ) 2 R.</p>
        <sec id="sec-4-2-1">
          <title>Applicative similarity . is defined as the largest applicative simulation. We ex</title>
          <p>tend applicative similarity to terms as follows (we overload the notation): M . N
iff JM K . JN K.</p>
          <p>
            Our main result is a full abstraction theorem stating that applicative
similarity and the contextual preorder coincide. The proof of such result relies on a
CIU Theorem [
            <xref ref-type="bibr" rid="ref18">18</xref>
            ].
          </p>
        </sec>
        <sec id="sec-4-2-2">
          <title>Definition 10. The CIU preorder</title>
          <p>ciu is defined by</p>
          <p>M ciu N () 8E: Obs(JE[M ]K) v Obs(JE[N ]K)
where E ranges over the set of evaluation contexts.</p>
          <p>Theorem 1 (CIU Equivalence). The following holds:
ciu =
ctx :</p>
          <p>We postpone the proof of Theorem 1 to the next section. We spend the rest
of this section showing that applicative similarity is fully abstract with respect
to the CIU preorder.</p>
          <p>Proposition 1 (Soundness). The following holds: .
ciu :
Proof. Clearly M . N implies M L . N L, for any term L. It is then
straightforward to prove that for any evaluation context E, M . N implies E[M ] . E[N ],
meaning, in particular, Obs(E[M ]) v Obs(E[N ]). tu</p>
          <p>To prove that . is fully abstract wrt ciu we have to prove
so we define a grammar for monadic values as follows:
ciu</p>
          <p>.. To do
T ::= t j T</p>
          <p>M:
We refer to terms generated by the above grammar as monadic terms. We can
give semantics to monadic terms as monadic values via the mapping:
t = t;</p>
          <p>H I</p>
          <p>HT M I = HT I M:
Monadic term contexts (mt-contexts, for shorts) are defined by:
Therefore a mt-context is an expression of the form M1 Mn (where we
assume to be left associative). The lifting 4ciu of the CIU preorder to monadic
terms is then defined by</p>
          <p>T 4ciu U () 8C: Obs(HC[T ]I) v Obs(HC[U ]I):</p>
          <p>It is easy to see that there is a bijective correspondence between evaluation
contexts and mt-contexts from which it follows the equation ciu = 4ciu.</p>
        </sec>
      </sec>
      <sec id="sec-4-3">
        <title>Proposition 2. The following holds: 4ciu</title>
        <p>. :
Proof. We prove that 4ciu is an applicative simulation. Suppose t 4ciu u.
Obviously Obs(t) v Obs(u) since t = t (and similarly for u). Let now M be a term.
We have to prove that t MH4Iciu u M holds. Let C = M1 Mn be a
mt-context. Then we have to prove: Obs(HC[t M ]I) = Obs(HC[u M ]I): That
immediatly follows from t 4ciu u once one observes that H( M1 Mn)[t M ]I =
H( M M1 Mn)[t]I holds. tu</p>
      </sec>
      <sec id="sec-4-4">
        <title>Corollary 1. The following holds: ciu . :</title>
        <p>Together with Proposition 1, the above corollary gives a proof of the
following:</p>
        <sec id="sec-4-4-1">
          <title>Proposition 3. Applicative similarity is fully abstract wrt the CIU preorder.</title>
          <p>That is: . = ciu :</p>
          <p>What remains to be done in order to prove that applicative similarity is fully
abstract wrt to the contextual preorder is to prove Theorem 1.
6</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>A CIU Theorem</title>
      <p>
        In this section we prove Theorem 1. The proof closely follows [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ], and the reader
can consult the latter for further details.
      </p>
      <p>We use the notion of frame stack.</p>
      <sec id="sec-5-1">
        <title>Definition 11. The set of frame stacks is defined by the following grammar:</title>
        <p>s ::= nil j [ ]M :: s:</p>
        <p>A configuration is a pair of the form (s; M ), where s is a stack and M a
term. To a stack s = [ ]N1 :: :: [ ]Nn, we can associate the evaluation context
Es = N1 Nn (where to nil we associate the empty context). Vice versa, we
can associate to any evaluation context E a stack sE such that E = EsE .</p>
        <p>We now give operational semantics to configurations. Small step semantics is
defined via a relation 7! between configurations, whereas multi-step semantics is
defined via a relation Z) between configurations and monadic values. Both these
relations are described in Figure 3.</p>
        <p>Notice that the set ft 2 T V j (s; M ) Z) tg is directed. As a consequence, we
can define the (operational) semantics L(s; M )M of a configuration (s; M ) as</p>
      </sec>
      <sec id="sec-5-2">
        <title>Proposition 4. For any term M , evaluation context E and stack s, we have:</title>
        <p>L(s; M )M =</p>
        <p>sup t:
(s;M)Z)t
JE[M ]K = L(sE ; M )M;</p>
        <p>L(s; M )M = JEs(M )K:
In particular, we have L(nil; M )M = JM K.</p>
        <p>(s; M N ) 7! ([ ]N :: s; M )
([ ]N :: s; x:M ) 7! (s; M [N=x])
(s; (M1; : : : ; Mn)) 7!i (s; Mi)
(s; M ) Z) ?
(nil; V ) Z) V</p>
        <p>(s; M ) Z) t
(s; M ) 7! (r; N )</p>
        <p>(r; N ) Z) t
(s; M ) 7!i (si; Mi)</p>
        <p>(si; Mi) Z) ti
(s; M ) Z) V (t1; : : : ; tn)</p>
        <p>
          We can now build up a proof of Theorem 1. The proof is based on an
adaptation oh Howe’s technique for pure -calculus and thus we only sketch its main
part. The reader can consult [
          <xref ref-type="bibr" rid="ref18">18</xref>
          ] for details. First of all, in light of previous
proposition let us characterise the CIU preorder in terms of stacks and
configurations.
        </p>
      </sec>
      <sec id="sec-5-3">
        <title>Definition 12. Define the CIU order</title>
        <p>ciu on terms:
M
ciu N</p>
      </sec>
      <sec id="sec-5-4">
        <title>Proposition 5. The following hold:</title>
        <p>() 8s: Obs(L(s; M )M) v Obs(L(s; N )M):</p>
        <p>ciu = ciu :</p>
        <p>Dealing with Howe’s technique, it is convenient to work with generalisations
of relations on closed terms called -term relations.</p>
        <sec id="sec-5-4-1">
          <title>Definition 13. An open relation over terms is a set R of triples (x; M; N ) where M; N 2 (x). A closed -term relation is closed if R .</title>
          <p>We will use infix notation and write x ` M R N to indicate that (x; M; N ) 2
R. Finally, we will use the notations ; ` M R N and M R N interchangeably.
There is a canonical way to extend a closed relation to an open one.</p>
        </sec>
      </sec>
      <sec id="sec-5-5">
        <title>Definition 14. Define the open extension operator mapping a closed relation</title>
        <p>over terms R to the open relation R over terms as follows: (x; M; N ) 2 R iff
M; N 2 (x), and for all L, M [L=x] R N [L=x] holds.</p>
        <p>
          The notions of reflexivity, symmetry and transitivity straightforwardly
extend to open -term relation (see e.g. [
          <xref ref-type="bibr" rid="ref18">18</xref>
          ]).
        </p>
        <p>We say that a relation is compatible if it is closed under the term constructors
of the language. The idea of Howe’s technique is to extend a relation R to a
relation RH that is compatible by construction. As a consequence, if M RH N
holds, then C[M ]RH C[N ] holds as well. That means that in order to prove
that a relation R is compatible it is sufficient to prove that R = RH holds.
Proving the inclusion R RH is often immediate (provided that R satisfies
minimal properties, e.g. reflexivity and transitivity in our case), whereas the
other inclusion requires more effort.</p>
        <p>Definition 15. Given a -term relation R the Howe’s lifting RH of R is
inductively defined by the rules in Figure 4.</p>
        <p>x ` xRM
x ` xRH M</p>
        <p>How1
x ` M RH P
x ` MiRH Ni
x [ fxg ` M RH L</p>
        <p>x ` LRH
x ` M LRH N</p>
        <p>x ` x:LRN
x ` x:M RH N</p>
        <p>x ` P RN
x ` (N1; : : : ; Nn)RL</p>
        <p>How3</p>
        <p>How4
x ` (M1; : : : ; Mn)RH L</p>
      </sec>
      <sec id="sec-5-6">
        <title>Lemma 2 (Key Lemma). For all closed stacks s; r and closed terms M; N , if</title>
        <p>s( ciu)H r, M ( ciu)H N , then Obs(L(s; M )M) v Obs(L(r; N )M).</p>
        <p>
          Proof (Sketch.). Since Obs is continuous and L(s; M )M) = sup(s;M)Z)t t it is
sufficient to prove that for every monadic value t, if (s; M ) Z) t the Obs(t) v L(r; N )M.
The latter statement can be proved by induction on the derivation of (s; M ) Z) t
as in [
          <xref ref-type="bibr" rid="ref18">18</xref>
          ]. tu
7 We are actually working with ( ciu) .
        </p>
        <p>Corollary 2. The following holds: ( ciu)H =
ciu :
Proof. We already know that ciu ( ciu)H holds. To prove the other inclusion
we have to prove M ( ciu)H N =) M ciu N , for all terms M; N . Suppose
M ( ciu)H N . Then, for any stack s, we have s( ciu)H s. By previous lemma we
have Obs(L(s; M )M) v Obs(L(s; N )M), meaning that M ciu N . tu
We can finally prove Theorem 1.</p>
        <p>Theorem 1 (CIU Equivalence). The following holds:
ctx =
ciu :
Proof. It is immediate to see that ctx ciu. For the other inclusion, suppose
M ciu N and let C be a context. We prove that C[M ] ciu C[N ] (this will
give the thesis simply aplying the definition of ciu with the empty context).
Since ciu = ciu = ( ciu)H , we have M ciu N and thus C[M ] ciu C[N ]. It
follows C[M ] ciu C[N ].
tu
7</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>Conclusions</title>
      <p>
        We have shown how a notion of applicative similarity on call-by-name effectful
lambda-calculi can be defined and proved fully-abstract. This is very much in line
with logical relations as introduced in [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ], but simpler and applicable to untyped
-calculi. The underlying transition system has monadic values as states, and
is essentially deterministic. This is indeed the reason the framework is only
applicable to call-by-name (and not to call-by-value) calculi, in contrast with [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
In fact, in the probabilistic call-by-value case our notion of applicative similarity
on monadic values is unsound for the contextual preorder, as witnessed by the
terms x:(x p ), ( x:x) p ( x: ), and the context ( x:x(x( y:y)))[ ].
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>Samson</given-names>
            <surname>Abramsky</surname>
          </string-name>
          .
          <article-title>The lazy lambda calculus</article-title>
          . In D. Turner, editor,
          <source>Research Topics in Functional Programming</source>
          , pages
          <fpage>65</fpage>
          -
          <lpage>117</lpage>
          . Addison Wesley,
          <year>1990</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Andrew</surname>
            <given-names>W.</given-names>
          </string-name>
          <string-name>
            <surname>Appel</surname>
            and
            <given-names>David A.</given-names>
          </string-name>
          <string-name>
            <surname>McAllester</surname>
          </string-name>
          .
          <article-title>An indexed model of recursive types for foundational proof-carrying code</article-title>
          .
          <source>ACM Trans. Program. Lang. Syst.</source>
          ,
          <volume>23</volume>
          (
          <issue>5</issue>
          ):
          <fpage>657</fpage>
          -
          <lpage>683</lpage>
          ,
          <year>2001</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>Nick</given-names>
            <surname>Benton</surname>
          </string-name>
          , Andrew Kennedy, Lennart Beringer, and
          <string-name>
            <given-names>Martin</given-names>
            <surname>Hofmann</surname>
          </string-name>
          .
          <article-title>Relational semantics for effect-based program transformations: higher-order store</article-title>
          .
          <source>In Proc. of PPDP</source>
          <year>2009</year>
          , pages
          <fpage>301</fpage>
          -
          <lpage>312</lpage>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Ales</given-names>
            <surname>Bizjak</surname>
          </string-name>
          and
          <string-name>
            <given-names>Lars</given-names>
            <surname>Birkedal</surname>
          </string-name>
          .
          <article-title>Step-indexed logical relations for probability</article-title>
          .
          <source>In Proc. of FOSSACS</source>
          <year>2015</year>
          , pages
          <fpage>279</fpage>
          -
          <lpage>294</lpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>Raphaëlle</given-names>
            <surname>Crubillé</surname>
          </string-name>
          and Ugo Dal Lago.
          <article-title>On probabilistic applicative bisimulation and call-by-value -calculi</article-title>
          .
          <source>In Proc. of ESOP</source>
          <year>2014</year>
          , volume
          <volume>8410</volume>
          <source>of LNCS</source>
          , pages
          <fpage>209</fpage>
          -
          <lpage>228</lpage>
          . Springer,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>Ugo</given-names>
            <surname>Dal</surname>
          </string-name>
          <string-name>
            <surname>Lago</surname>
          </string-name>
          , Francesco Gavazzo, and
          <string-name>
            <surname>Paul Levy.</surname>
          </string-name>
          <article-title>Effectful applicative bisimilarity: Monads, relators, and Howe's method (long version)</article-title>
          . Available at https://arxiv. org/abs/1704.04647,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>Ugo</given-names>
            <surname>Dal</surname>
          </string-name>
          <string-name>
            <surname>Lago</surname>
          </string-name>
          , Davide Sangiorgi, and
          <string-name>
            <given-names>Michele</given-names>
            <surname>Alberti</surname>
          </string-name>
          .
          <article-title>On coinductive equivalences for higher-order probabilistic functional programs</article-title>
          .
          <source>In Proc. of POPL</source>
          <year>2014</year>
          , pages
          <fpage>297</fpage>
          -
          <lpage>308</lpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>Vincent</given-names>
            <surname>Danos</surname>
          </string-name>
          and
          <string-name>
            <given-names>Russell</given-names>
            <surname>Harmer</surname>
          </string-name>
          .
          <article-title>Probabilistic game semantics</article-title>
          .
          <source>ACM Transactions on Computational Logic</source>
          ,
          <volume>3</volume>
          (
          <issue>3</issue>
          ):
          <fpage>359</fpage>
          -
          <lpage>382</lpage>
          ,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Ugo de'Liguoro</surname>
            and
            <given-names>Adolfo</given-names>
          </string-name>
          <string-name>
            <surname>Piperno</surname>
          </string-name>
          .
          <article-title>Non deterministic extensions of untyped lambda-calculus</article-title>
          .
          <source>Inf. Comput.</source>
          ,
          <volume>122</volume>
          (
          <issue>2</issue>
          ):
          <fpage>149</fpage>
          -
          <lpage>177</lpage>
          ,
          <year>1995</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Joseph</surname>
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Goguen</surname>
          </string-name>
          , James W. Thatcher, Eric G. Wagner, and
          <string-name>
            <surname>Jesse</surname>
            <given-names>B.</given-names>
          </string-name>
          <string-name>
            <surname>Wright</surname>
          </string-name>
          .
          <article-title>Initial algebra semantics and continuous algebras</article-title>
          .
          <source>J. ACM</source>
          ,
          <volume>24</volume>
          (
          <issue>1</issue>
          ):
          <fpage>68</fpage>
          -
          <lpage>95</lpage>
          ,
          <year>1977</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Jean</surname>
            Goubault-Larrecq,
            <given-names>Slawomir</given-names>
          </string-name>
          <string-name>
            <surname>Lasota</surname>
          </string-name>
          , and David Nowak.
          <article-title>Logical relations for monadic types</article-title>
          .
          <source>Mathematical Structures in Computer Science</source>
          ,
          <volume>18</volume>
          (
          <issue>6</issue>
          ):
          <fpage>1169</fpage>
          -
          <lpage>1217</lpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Douglas</surname>
            <given-names>J.</given-names>
          </string-name>
          <string-name>
            <surname>Howe</surname>
          </string-name>
          .
          <article-title>Proving congruence of bisimulation in functional programming languages</article-title>
          .
          <source>Inf. Comput.</source>
          ,
          <volume>124</volume>
          (
          <issue>2</issue>
          ):
          <fpage>103</fpage>
          -
          <lpage>112</lpage>
          ,
          <year>1996</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Patricia</surname>
            <given-names>Johann</given-names>
          </string-name>
          , Alex Simpson, and
          <string-name>
            <given-names>Janis</given-names>
            <surname>Voigtländer</surname>
          </string-name>
          .
          <article-title>A generic operational metatheory for algebraic effects</article-title>
          .
          <source>In Proc. of LICS</source>
          <year>2010</year>
          , pages
          <fpage>209</fpage>
          -
          <lpage>218</lpage>
          . IEEE Computer Society,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Søren</surname>
            <given-names>B.</given-names>
          </string-name>
          <string-name>
            <surname>Lassen</surname>
          </string-name>
          .
          <article-title>Relational Reasoning about Functions and Nondeterminism</article-title>
          .
          <source>PhD thesis</source>
          , Dept. of Computer Science, University of Aarhus, May
          <year>1998</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15. Saunders MacLane.
          <source>Categories for the Working Mathematician</source>
          . Springer-Verlag,
          <year>1971</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <given-names>Eugenio</given-names>
            <surname>Moggi</surname>
          </string-name>
          .
          <article-title>Computational lambda-calculus and monads</article-title>
          .
          <source>In Proc. of (LICS</source>
          <year>1989</year>
          , pages
          <fpage>14</fpage>
          -
          <lpage>23</lpage>
          . IEEE Computer Society,
          <year>1989</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <surname>A. M. Pitts</surname>
          </string-name>
          .
          <article-title>Operationally-based theories of program equivalence</article-title>
          . In P. Dybjer and A. M. Pitts, editors,
          <source>Semantics and Logics of Computation, Publications of the Newton Institute</source>
          , pages
          <fpage>241</fpage>
          -
          <lpage>298</lpage>
          . Cambridge University Press,
          <year>1997</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <surname>Andrew</surname>
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Pitts</surname>
          </string-name>
          .
          <article-title>Howe's method for higher-order languages</article-title>
          . In D. Sangiorgi and J. Rutten, editors,
          <source>Advanced Topics in Bisimulation and Coinduction</source>
          , volume
          <volume>52</volume>
          of Cambridge Tracts in Theoretical Computer Science, chapter
          <volume>5</volume>
          , pages
          <fpage>197</fpage>
          -
          <lpage>232</lpage>
          . Cambridge University Press,
          <year>November 2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <surname>Gordon</surname>
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Plotkin</surname>
          </string-name>
          and John Power.
          <article-title>Adequacy for algebraic effects</article-title>
          .
          <source>In Proc. of FOSSACS</source>
          <year>2001</year>
          , pages
          <fpage>1</fpage>
          -
          <lpage>24</lpage>
          ,
          <year>2001</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20.
          <string-name>
            <surname>Gordon</surname>
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Plotkin</surname>
          </string-name>
          and John Power.
          <article-title>Algebraic operations and generic effects</article-title>
          .
          <source>Applied Categorical Structures</source>
          ,
          <volume>11</volume>
          (
          <issue>1</issue>
          ):
          <fpage>69</fpage>
          -
          <lpage>94</lpage>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>