Interaction Equivalence

Beniamino Accattoli,Adrienne Lancelot,Giulio Manzonetto,Gabriele Vanoni
2024-09-27
Abstract:Contextual equivalence is the de facto standard notion of program equivalence. A key theorem is that contextual equivalence is an equational theory. Making contextual equivalence more intensional, for example taking into account the time cost of the computation, seems a natural refinement. Such a change, however, does not induce an equational theory, for an apparently essential reason: cost is not invariant under reduction. In the paradigmatic case of the untyped $\lambda$-calculus, we introduce interaction equivalence. Inspired by game semantics, we observe the number of interaction steps between terms and contexts but -- crucially -- ignore their own internal steps. We prove that interaction equivalence is an equational theory and we characterize it as $B$, the well-known theory induced by Böhm tree equality. Ours is the first observational characterization of $B$ obtained without enriching the discriminating power of contexts with extra features such as non-determinism. To prove our results, we develop interaction-based refinements of the Böhm-out technique and of intersection types.
Logic in Computer Science,Programming Languages
What problem does this paper attempt to address?
### The problems the paper attempts to solve This paper attempts to solve the problem of how to extend the concept of contextual equivalence in programming language theory to consider the cost of computation time. Specifically, the author introduces a new equivalence concept - interaction equivalence, aiming to solve the following two main problems: 1. **Limitations of contextual equivalence**: - Contextual equivalence is a widely - accepted standard for program equivalence, but its definition only focuses on the termination behavior of programs and ignores the time cost during the computation process. - Although the equivalence concepts that introduce time cost (such as cost equivalence) can describe the behavior of programs more precisely, these concepts no longer meet the requirements of equivalence theory, especially the invariance property. 2. **Contradiction between quantitative internal properties and semantic concepts**: - Quantitative internal properties such as time cost cannot be invariant during the computation process in essence, while equivalence theory expects to hide the computation process. - This contradiction leads to the fact that concepts such as cost equivalence cannot be regarded as a semantics, that is, they are not equivalence theories. ### Solutions To overcome the above problems, the author proposes a new concept - interaction equivalence. Specifically: - **Definition of interaction equivalence**: - Interaction equivalence is based on a new computational model - checkers calculus. In this model, the abstraction and application constructors are divided into two forms: white and black. - Interaction equivalence measures whether the behaviors of two terms in different contexts are consistent by counting interaction steps, while ignoring the number of silent steps. - **Key properties**: - The author proves that interaction equivalence is an equivalence theory, that is, it satisfies the compatibility and invariance properties. - Interaction equivalence can be described as an equivalence theory \( B \) induced by Böhm - tree equivalence, which provides an explicit description. ### Main contributions 1. **Definition and properties of interaction equivalence**: - The author introduces the concept of interaction equivalence and proves that it is an equivalence theory. - Through the multi - type system and Böhm - out technique, the author provides a strict proof of interaction equivalence. 2. **Relationship with Böhm - tree equivalence**: - The author proves that interaction equivalence exactly corresponds to Böhm - tree equivalence, which is a known equivalence theory. - This result solves an unsolved theoretical problem, that is, finding a satisfactory observational equivalence description of non - extensional Böhm - tree equivalence. 3. **Technical development**: - The author develops new interaction - based techniques, such as the multi - type system and Böhm - out technique. These techniques are not only used to prove the properties of interaction equivalence but also provide tools for further research. ### Conclusion By introducing interaction equivalence, the author successfully extends the concept of contextual equivalence to the scenario considering time cost while maintaining the properties of equivalence theory. This work not only enriches programming language theory but also provides a new perspective for understanding and analyzing program behavior.