ABSTRACT
The environment is the relationship between variables and their bound values during program execution and is a notion in program semantics. A first-class environment is a mechanism that allows the environment to be treated like data, such as integer values or Boolean values, and can be passed to a function as an argument or received as a return value. The environment calculus is a formal computational system proposed by Nishizaki and is a lambda calculus that extends the first-class environment mechanism. The formulation of the environment was based on explicit substitution by Curien et al., who viewed the environment as a substitution. The operational semantics of the environmental calculus, or the reduction, is based on the reduction of the lambda-sigma calculus. In the calculus, there are two constructs for first-class environments: one is the identity environment to reify the current environment, that is, to transfer a meta-level environment to object-level data; the other is the environment composition to reflect the object-level environment data, that is, to transfer object-level environment data back to a meta-level environment. In this paper, instead of the environment composition, we propose a new interface with a first-class environment, a functionally referable environment. If object-level environment data is given as an argument for a function application, the functional reflection brings the environment back to the meta-level and makes the lambda term evaluable under that environment. Using the functionally referable environment, one can unify the environment composition with the function application. We define the untyped lambda calculus with functionally referable environments: we give the syntax of the calculus and its reduction. Then we provide the semantics for the reduction using a translation of the environment calculus into the record calculus. We prove the soundness of the translation semantics. Finally, we discuss the evaluation strategy, especially the call-by-value reduction.
- M. Abadi, L. Cardelli, P-.L. Curien, and J.-J. Lévy. 1991. Explicit Substitutions. Journal of Functional Programming 1, 4 (October 1991), 375–416.Google ScholarCross Ref
- Yuta Aoyagi and Shin-ya Nishizaki. 2018. Untyped Call-by-Value Calculus with First-Class Continuations and Environments. In Theory and Practice of Computation. World Scientific, 101–117. doi:10.1142/9789813279674_0008.Google Scholar
- H. P. Barendregt. 2013. The Lambda Calculus: Its Sytax and Semantics Revised Edition. North Holland.Google Scholar
- Carl A. Gunter. 1992. Semantics of Programming Lanuages: Structures and Techniques. The MIT Press.Google Scholar
- Oliver Laumann. [n.d.]. Elk – The Extension Language Kit Scheme Reference. http://www-rn.informatik.uni-bremen.de/software/elk/doc.html.Google Scholar
- S. Nishizaki. 1995. Simply Typed Lambda Calculus with First-class Environments. Publications of Research Institute for Mathematical Sciences Kyoto University 30, 6 (1995), 1055–1121.Google ScholarCross Ref
- Shin-ya Nishizaki. 2000. A Polymorphic Environment Calculus and its Type Inference Algorithm. Higher-Order and Symbolic Computation 13 (2000), 239–278.Google ScholarDigital Library
- Shin-ya Nishizaki. 2013. Evaluation Strategy and Translation of Environment Calculus. In Information Computing and Applications. Springer Berlin Heidelberg, 232–242.Google Scholar
- Shin-ya Nishizaki. 2019. Simple type system for call-by-value calculus with first-class continuations and ennvironments. In Theory and Practice of Computation. CRC Press, 119–130.Google Scholar
- S. Nishizaki and Mizuki Fujii. 2012. Strong reduction for typed lambda calculus with first-class environments. In Lecture Notes in Computer Science, Vol. 7473. Springer-Verlag Berlin Heidelberg, 632–639.Google Scholar
- Masahiko Sato, Takafumi Sakurai, and Yukiyoshi Kameyama. 2002. A Simply Typed Context Calculus with First-Class Environments. The Journal of Functional and Logic Programming 2002, 3(2002), 1–41.Google Scholar
Recommendations
Transplanting of Environments between Closures in the lambda calculus
ICSCA '23: Proceedings of the 2023 12th International Conference on Software and Computer ApplicationsIn programming languages, a function closure is a function whose body includes possibly free variables and that is accompanied by association with their values. The association of variables with their values is called an environment. If a programming ...
Extracting Environments from Function Closures
ICSCA '22: Proceedings of the 2022 11th International Conference on Software and Computer ApplicationsIn this paper, we study the mechanism for extracting the environment from a function closure in the framework of the lambda calculus. We propose the lambda calculus with environment extraction, which extends environment calculus. We define the untyped ...
Linear lambda calculus with non-linear first-class continuations
ICSCA '17: Proceedings of the 6th International Conference on Software and Computer ApplicationsThe Curry-Howard isomorphism is the correspondence between propositions and types, proofs and lambda-terms, and proof normalization and evaluation. In Curry-Howard isomorphism, we find a duality between values and continuations in pure functional ...
Comments