Abstract
In this birdwatching paper our binoculars are focused upon a particular bird from Smullyan’s enchanted forest of combinatory birds (Smullyan in To Mock a Mockingbird, and other logic puzzles. Alfred A. Knopf, New York, 1985), to wit the Starling. In the feathers of \(\lambda \)-calculus this bird has the plumage \(\lambda abc.ac(bc)\). This term is usually named \(\mathsf {S}\), reminiscent of its inventor Schönfinkel and also the combinatory ornithologist Smullyan. The combinator \(\mathsf {S}\) is important for a variety of reasons. First, it is part of the \(\{\mathsf {S},\mathsf {K}\}\)-basis for Combinatory Logic (CL). Second, there are several interesting questions and observations around \(\mathsf {S}\), mostly referring to termination and word problems. Our paper collects known facts, but poses in addition several new questions. For some of these we provide solutions, but several tough open questions remain.
Notes
- 1.
- 2.
See Klop (1980) or see Appendix, Theorem 45, noting that ‘no head normal form’ implies ‘no normal form’.
- 3.
The observation of this fact was in 1975 by Albert Visser, who included it in his Ph.D.-dissertation (Visser 1981), in the list of Dutch language ‘stellingen’ (statements to be defended). He had at that time devised a proof that unfortunately got lost several years later while changing houses. Vincent van Oostrom, hearing about the lost proof from Albert, solved the problem after work in the train home, from Utrecht to Amsterdam (about 20 km distance, half an hour travel time).
- 4.
Note that \(\mathsf {S}\)-term M is a rnf \(\Leftrightarrow \) M is of the form x, \(\mathsf {S}\), \(\mathsf {S}A\), \(\mathsf {S}AB\) or \(M_1\,M_2\) with \(M_1\) of order 0, i.e. \(M_1\) has an infinite head reduction, i.e. \(M_1\) is accepted by the automaton in Fig. 5.14. So ‘M is rnf’ is decidable with the proviso that the automaton in Fig. 5.14 has yet to be proved correct.
References
Baader, F., & Nipkow, T. (1998). Term rewriting and all that. Cambridge: Cambridge University Press.
Barendregt, H. (1971). Some extensional term models for combinatory logics and \(\lambda \) -calculi. Ph.D. thesis, University Utrecht.
Barendregt, H. (1975). Problem 97 of the RTA List of Open Problem. http://www.win.tue.nl/rtaloop/problems/97.html.
Barendregt, H. (1984). The lambda calculus, its syntax and semantics, Vol. 103 of Studies in Logic and The Foundations of Mathematics. North-Holland, revised edition.
Barendregt, H. (1992a). Representing ‘undefined’ in lambda calculus. Journal of Functional Programming, 2(3), 367–374.
Barendregt, H. (1992b). Lambda calculi with types. In S. Abramsky, D. M. Gabbay, & T. S. E. Maibaum (Eds.), Handbook of logic in computer science (Vol. 2, pp. 117–309). Oxford: Oxford University Press.
Barendregt, H., Bergstra, J., Klop, J. W., & Volken, H. (1976). Degrees, reductions and representability in the lambda calculus. Technical report, Department of Mathematics, Utrecht University, 1976. The report is available via the website http://repository.ubn.ru.nl/handle/2066/20381.
Barendregt, H., Kennaway, R., Klop, J. W., & Sleep, M. R. (1987). Needed reduction and spine strategies for the lambda calculus. Information and Computation, 75(3), 191–231.
Barendregt, H., & Klop, J. W. (2009). Applications of infinitary lambda calculus. Information of Computation, 207(5), 559–582.
Berarducci, A. (1996). Infinite \(\lambda \)-calculus and non-sensible models. Logic and algebra (Pontignano, 1994) (pp. 339–377). New York: Dekker.
Berarducci, A., & Intrigila, B. (1996). Church–Rosser \(\lambda \)-theories, infinite \(\lambda \)-calculus and consistency problems. In Logic: From foundations to applications (pp. 33–58).
Bethke, I., Klop, J. W., & de Vrijer, R. C. (2000). Descendants and origins in term rewriting. Information and Computation, 159(1–2), 59–124.
Bimbó, K. (2011). Combinatory logic: Pure, applied and typed. London: Chapman and Hall.
Cardone, F., & Hindley, R. (2006). History of lambda-calculus and combinatory logic. In D. M. Gabbay & J. Woods (Eds.), Handbook of the history of logic (Vol. 5). Elsevier.
Church, A. (1941). The calculi of lambda conversion. Vol. 6 of Annals of Mathematics Studies. Princeton: Princeton University Press.
Curry, H. B., & Feys, R. (1974). Combinatory logic (Vol. I). Amsterdam: North-Holland.
Curry, H. B., Hindley, R., & Seldin, J. P. (1972). Combinatory logic (Vol. II). Amsterdam: North-Holland.
Dershowitz, N., Kaplan, S., & Plaisted, D. A. (1991). Rewrite, rewrite, rewrite, rewrite, rewrite. Theoretical Computer Science, 83(1), 71–96.
Endrullis, J., de Vrijer, R., & Waldmann, J. (2009a). Local termination. In Proceedings Conference on Rewriting Techniques and Applications (RTA 2009), Vol. 5595 of LNCS (pp. 270–284). Berlin: Springer.
Endrullis, J., de Vrijer, R. C., & Waldmann, J. (2010a). Local termination: Theory and practice. Logical Methods in Computer Science, 6(3).
Endrullis, J., Geuvers, H., Simonsen, J. G., & Zantema, H. (2011a). Levels of undecidability in rewriting. Information and Computation, 209(2), 227–245.
Endrullis, J., Geuvers, H., & Zantema, H. (2009b). Degrees of undecidability in term rewriting. In Proceedings of International Workshop on Computer Science Logic (CSL 2009), Vol. 5771 of LNCS (pp. 255–270). Berlin: Springer.
Endrullis, J., Grabmayer, C., & Hendriks, D. (2008). Data-oblivious stream productivity. In Proceedings Conference (Ed.), on Logic for Programming Artificial Intelligence and Reasoning (LPAR 2008), number 5330 in LNCS (pp. 79–96). Berlin: Springer.
Endrullis, J., Grabmayer, C., & Hendriks, D. (2009c). Complexity of Fractran and productivity. In Proceedings Conference on Automated Deduction (CADE 22), Vol. 5663 of LNCS (pp. 371–387).
Endrullis, J., Grabmayer, C., Hendriks, D., Klop, J. W., & de Vrijer, R. C. (2009d). Proving infinitary normalization. In Postproceedings International Workshop on Types for Proofs and Programs (TYPES 2008), Vol. 5497 of Lecture Notes in Computer Science (pp. 64–82). Berlin: Springer.
Endrullis, J., Grabmayer, C., Hendriks, D., Klop, J. W., & van Oostrom, V. (2010c). Unique normal forms in infinitary weakly orthogonal rewriting. In Proceedings of 21st International Conference on Rewriting Techniques and Applications (RTA 2010), Vol. 6 of Leibniz International Proceedings in Informatics (pp. 85–102). Wadern: Schloss Dagstuhl.
Endrullis, J., Grabmayer, C., Hendriks, D., Isihara, A., & Klop, J. W. (2010b). Productivity of stream definitions. Theoretical Computer Science, 411, 765–782.
Endrullis, J., Hansen, H. H., Hendriks, D., Polonsky, A., & Silva, A. (2013a). A coinductive treatment of infinitary rewriting. CoRR, abs/1306.6224.
Endrullis, J., & Hendriks, D. (2011). Lazy productivity via termination. Theoretical Computer Science, 412(28), 3203–3225.
Endrullis, J., Hendriks, D., & Klop, J. W. (2010d). Modular construction of fixed point combinators and clocked Böhm trees. In Proceedings of Symposium on Logic in Computer Science (LICS 2010) (pp. 111–119). Edinburgh: IEEE Computer Society.
Endrullis, J., Hendriks, D., & Klop, J. W. (2012a). Highlights in infinitary rewriting and lambda calculus. Theoretical Computer Science, 464, 48–71.
Endrullis, J., Hendriks, D., Klop, J. W., & Polonsky, A. (2012b). Discriminating lambda-terms using clocked Böhm trees. In Logical methods in computer science (In print).
Endrullis, J., Hendriks, D., Klop, J. W., & Polonsky, A. (2013b). Clocked lambda calculus. In Mathematical structures in computer science: Accepted for publication.
Endrullis, J., & Polonsky, A. (2013). Infinitary rewriting coinductively. In Proceedings of Types for Proofs and Programs (TYPES 2012), Vol. 19 of Leibniz International Proceedings in Informatics (pp. 16–27). Wadern: Schloss Dagstuhl.
Geser, A., & Zantema, H. (1999). Non-looping string rewriting. ITA, 33(3), 279–302.
Hindley, J. R., & Seldin, P. (2008). Lambda-calculus and combinators. Cambridge: Cambridge University Press.
Jacopini, G. (1975). A condition for identifying two elements of whatever model of combinatory logic. In \(\lambda \) -Calculus and Computer Science Theory, Vol. 37 of Lecture notes in computer science (pp. 213–219). Berlin: Springer.
Kennaway, J. R., & de Vries, F.-J. (2003). Infinitary rewriting, Chap. 12. Cambridge: Cambridge University Press. in Terese (2003).
Kennaway, J. R., Klop, J. W., Sleep, M. R., & de Vries, F.-J. (1995). Transfinite reductions in orthogonal term rewriting systems. Information and Computation, 119(1), 18–38.
Kennaway, J. R., Klop, J. W., Sleep, M. R., & de Vries, F.-J. (1997). Infinitary lambda calculus. Theoretical Computer Science, 175(1), 93–125.
Kennaway, J. R., van Oostrom, V., & de Vries, F.-J. (1999). Meaningless terms in rewriting. The Journal of Functional and Logic Programming, 1.
Ketema, J., Klop, J. W., & van Oostrom, V. (2005). Vicious circles in orthogonal term rewriting systems. In S. Antoy & Y. Toyama (Eds.), Proceedings of 4th International Workshop on Reduction Strategies in Rewriting and Programming (WRS’04), Vol. 124(2) of Electronic Notes in Theoretical Computer Science (pp. 65–77). Elsevier Science.
Klop, J. W. (1980). Combinatory reduction systems, Vol. 127 of Mathematical centre tracts. Amsterdam: Mathematisch Centrum.
Klop, J. W. (1992). Term rewriting systems. In Handbook of logic in computer science (Vol. II, pp. 1–116). Oxford: Oxford University Press.
Klop, J. W., & de Vrijer, R. C. (2005). Infinitary normalization. We will show them: Essays in Honour of Dov Gabbay (2) (pp. 169–192). London: College Publications.
Middeldorp, A. (1997). Call by need computations to root-stable form. In Proceedings of Symposium on Principles of Programming Languages (POPL 1997) (pp. 94–105). New York: ACM.
Schönfinkel, M. (1924). Über die Bausteine der mathematischen Logik. Mathematische Annalen, 92, 305–316.
Scott, D. S. (1975). Open problem. In C. Böhm (Ed.), Lambda calculus and computer science theory, Vol. 37 of LNCS (p. 368).
Smullyan, R. M. (1985). To Mock a Mockingbird, and other logic puzzles. New York: Alfred A. Knopf.
Smullyan, R. M. (1994). Diagonalization and self-reference. Oxford: Clarendon Press.
Terese. (2003). Term rewriting systems, Vol. 55 of Cambridge tracts in theoretical computer science. Cambridge: Cambridge University Press.
van der Poel W. L., approximately 1975. Personal communication.
van der Poel, W. L. (1992). The mechanization of lambda calculus. Reports of the Faculty of Technical Mathematics and Informatics, Delft University of Technology.
van Heijenoort, J. (1967). From Frege to Gödel: A source book in mathematical logic, 1879–1931. Harvard University Press: Source books in the history of the sciences. Cambridge.
Visser, A. (1981). Aspects of diagonalization and probability. Ph.D. thesis, Utrecht University.
Waldmann, J. (1997). Nimm Zwei. Technical Report IR-432, Vrije Universiteit Amsterdam.
Waldmann, J. (1998). The combinator S. Ph.D. thesis, Friedrich-Schiller-Universität Jena.
Waldmann, J. (2000). The combinator S. Information and Computation, 159(1–2), 2–21.
Zachos, E. (1978). Kombinatorische Logik und S-Terme. Ph.D. thesis, Berichte des Instituts für Informatik, Eidgenössische Technische Hochschule Zürich.
Zachos, S., Cheilaris, P., & Ramirez, J. (2011). Checking in linear time if an S-term normalizes. In 8th Panhellenic Logic Symposium.
Zantema, H. (1995). Termination of term rewriting by semantic labelling. Fundamenta Informaticae, 24, 89–105.
Acknowledgements
We thank Hans Zantema for stimulating discussions about \(\mathsf {S}\)-terms during recent years, and in particular for recently suggesting the spiralling graphical rendering of \(\mathsf {S}\)-terms as in our figures. We also thank Jan Bergstra, Vincent van Oostrom, Wim van der Poel, Richard Statman, and Albert Visser for contributing their insights. We also thank the referees for many helpful corrections, comments and suggestions.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
A A Refresher of Finitary and Infinitary Rewriting
A A Refresher of Finitary and Infinitary Rewriting
5.1.1 A.1 Introduction
We will presuppose a modest familiarity with Combinatory Logic and \(\lambda \)-calculus, but even so a quick refresher of the main notions and notations, tailored towards the present walk in Smullyan’s forest, may be useful. The experienced reader, familiar with Barendregt (1984) or Terese (2003) will have little need for these preliminaries, and can quickly glance over the next pages.
5.1.2 A.2 Finitary Combinatory Logic
Combinatory Logic (CL) is based on the basic combinators \(\mathsf {S}\), \(\mathsf {K}\), \(\mathsf {I}\) with reduction rules
Terms are formed from \(\mathsf {S}\), \(\mathsf {K}\), \(\mathsf {I}\) using application, written sometimes as @ but in our paper as \(\cdot \) (in the figures as \(\bullet \)). The \(\cdot \) is usually not written in the term formation, but visible in figures where terms are depicted as labelled trees.
We assume that the reader is familiar with term formation, with its usual bracketing convention called association to the left. Let us stress here that term formation here is governed by induction; later on we will invoke also coinduction to generate possibly infinite terms. The set of terms of CL will be denoted as . Closed terms are just built from \(\mathsf {S}\), \(\mathsf {K}\), \(\mathsf {I}\); open terms may contain variables \(x,y,z, a,b,c,\ldots \). Closed CL-terms are also called combinators. We employ \(\rightarrow \) for one step reduction, which may be performed in a context, a term with a hole in it. E.g. is a context with one hole. We often write \(C[\,\,]\) for a context, and write C[M] for the result of substituting M for the holes in \(C[\,\,]\).
We use \(\mathrel {{\twoheadrightarrow }}\) or \(\rightarrow ^*\) for the transitive reflexive closure of \(\rightarrow \). Another reminder: a redex is an instance of a left-hand side of one of the reduction rules, and a normal form is a term without a redex occurrence.
We use ‘\(=\)’ for the convertibility relation defined by the reduction rules; that is the equivalence generated by \(\rightarrow \). It should be distinguished from ‘\(\equiv \)’, which denotes syntactical equality. We will also use \(\equiv \) for abbreviations (‘definitional equality’), and write e.g. \(A \equiv \mathsf {S}\mathsf {S}\mathsf {S}\), where A abbreviates \(\mathsf {S}\mathsf {S}\mathsf {S}\). Sometimes we write \(M =_{\mathsf {I},\mathsf {K},\mathsf {S}} N\) or \(M =_{\mathsf {S}} N\) if we want to indicate the rules generating the convertibility relation. Later on we will also use \(\equiv \) for syntactical equality of infinite terms. Note that when we use \(\equiv \) for finite or infinite \(\lambda \)-terms, we work modulo \(\alpha \)-conversion. So \(\lambda x.\,x \equiv \lambda y.\,y\), and to give a non-trivial example for infinite \(\lambda \)-terms:
for any permutation \(\pi \) of the natural numbers.
5.1.3 S-terms, CL(S)
In this paper we will mostly be concerned with a ‘subsystem’ of full CL, to be called CL(\(\mathsf {S}\)), where terms are only generated from the basic combinator \(\mathsf {S}\), excluding \(\mathsf {I}\) and \(\mathsf {K}\), and including possibly variables, by means of the binary application. is the set of \(\mathsf {S}\)-terms obtained this way. Thus CL(\(\mathsf {S}\)) with the \(\mathsf {S}\)-reduction rule is just as CL, an example of an orthogonal TRS, term rewriting system. Hence it satisfies the confluence or Church-Rosser property: CL(\(\mathsf {S}\)) \(\models \) \(\mathrm {CR}\).
5.1.4 S-terms are Non-erasing
In contrast with full CL, the sub -TRS CL(\(\mathsf {S}\)) satisfies also the property \(\mathrm {NE}\), non-erasingness: CL(\(\mathsf {S}\)) \(\models \) \(\mathrm {NE}\). This means that there is no erasure of subterms, because the \(\mathsf {S}\)-rule has the same variables in its left-hand side and right-hand side. This has an important consequence, namely that for \(\mathsf {S}\)-terms the properties of \(\mathrm {WN}\) (Weak Normalization, having a normal form) and \(\mathrm {SN}\) (Strong Normalization, there are no infinite reductions, so eventually every reduction must end in a normal form) are equivalent. For \(\lambda \)-calculus there is an analogous situation, in that for \(\lambda \text {I}\)-calculus the Theorem of Church holds, stating that for a \(\lambda \text {I}\)-term the properties \(\mathrm {WN}\) and \(\mathrm {SN}\) coincide.
5.1.5 A.3 Finitary \(\lambda \)-calculus
Again, we will not dwell on the very first notions of \(\lambda \)-calculus, such as term formation, free and bound variables, the \(\beta \)-reduction rule and so on. These can be found in any introduction. As to the notation, we use this similarly to that of CL, so \(\rightarrow \), \(=\), \(\mathrel {{\twoheadrightarrow }}\), \(\equiv \) have meanings analogous to those for CL, except that they now refer to the \(\beta \)-reduction rule. We will in this paper not consider the \(\eta \)-reduction rule. If clarity is served, and we are working in \(\lambda \)-calculus, we will sometimes subscript the reduction symbols with \(\beta \), so \(\rightarrow _{\beta }\), \(=_{\beta }\), \(\mathrel {{\twoheadrightarrow }}_{\beta }\). As before, a normal form is a term without a redex occurrence, in this case without \(\beta \)-redex.
There is an important subcalculus of \(\lambda \)-calculus, called \(\lambda \text {I}\)-calculus, which we just mentioned. Here in an abstraction term \(\lambda x.\,M\), the variable x must occur free in M. So e.g. \(\lambda xy.\,x\) is not a \(\lambda \text {I}\)-term. Abbreviating these calculi by just \(\lambda \) and \(\lambda \text {I}\), we have \(\lambda \models \mathrm {CR}\), also \(\lambda \text {I}\models \mathrm {CR}\), and
for all ; this last assertion is known as Church’s Theorem.
5.1.6 The Order of Terms in CL and \(\lambda \) Calculus
In applicative rewrite systems such as CL and \(\lambda \)-calculus, there is an intuition of arguments being ‘consumed’ or ‘eaten’ by the term of which they are arguments. This gives rise to the notion of the order of a term. In the words of Curry and Feys (1974): Roughly speaking, the order of an ob X is the number of variables in the combination \(Xx_1x_2 \ldots x_n\) which are acted on by X, or the minimum number of arguments to X considered as a function.
For \(\lambda \)-calculus, there are two equivalent definitions, with one of them also pertaining to CL.
Definition 35
Let .
-
(i)
M is of order 0 (also: M has order 0, or: M is a 0-term) if there is no term P such that \(M \mathrel {{\twoheadrightarrow }}_{\beta } \lambda x.\,P\).
-
(ii)
M is of order \(n+1\) if \(M \mathrel {{\twoheadrightarrow }}_{\beta } \lambda x.\,P\) where P is of order n.
-
(iii)
M is of order \(\infty \) (has infinite order), if M does not have a finite order.
Example 36
-
(i)
Variables have order 0; \(\varOmega \equiv \omega \omega \equiv (\lambda x.\,xx)(\lambda x.\,xx)\) has order 0. The term \(Y\mathsf {K}\), where Y is any fixed point combinator and \(\mathsf {K} \equiv \lambda xy.\,x\), has infinite order. It is called sometimes the Ogre (Omnivore) or \(\mathsf {K}^\infty \).
-
(ii)
If M is of order 0, so is MP for any P.
-
(iii)
If M is of order \(\infty \), so is MP for any P.
-
(iv)
If M is of order \(n+1\), Mx is of order n. (Avoid the pitfall: if M is of order n, MN can have a higher order than M.)
-
(v)
(Berarducci 1996) If \(M =_{\beta } MP\) for some P, M is of order 0.
-
(vi)
The order is invariant under \(=_{\beta }\), \(\beta \)-conversion.
-
(vii)
(Curry and Feys 1974, p. 148, Theorem 5). If M has a normal form, then M has a finite order.
-
(viii)
If M has a head normal form, then M has a finite order.
-
(ix)
(Curry and Feys 1974, p. 148, Theorem 6). If M is of order \(\ge m\), and \(x_1,\ldots x_m \) are not free in M, then
$$\lambda x_1,\ldots x_m.\,M x_1,\ldots x_m =_{\beta } M\;.$$ -
(x)
To be read after introduction of infinitary \(\lambda \)-calculus, and Berarducci Trees \(\mathsf {BeT}(M)\): If M has infinite order, then M has the infinite normal form
$$\begin{aligned} \lambda x_0 x_1 x_2 \ldots x_n \ldots \equiv \mathsf {BeT}(M) \end{aligned}$$(Note that there is only one such infinite \(\lambda \)-abstraction, due to \(\alpha \)-conversion.)
Here is an alternative and equivalent definition of the order of a term, this time also applying to CL. It is from Curry and Feys (1974, p. 144).
Definition 37
Let , or let . The order of M is the least m such that every \(\beta \)-reduction of
is obtained by applications of rule \((\nu )\) to a \(\beta \)-reduction of
Here rule \((\nu )\) (see Curry and Feys 1974, p. 59) is the left-monotony rule used in defining the reduction relation \(\mathrel {{\twoheadrightarrow }}_{\beta }\) or \(\mathrel {{\twoheadrightarrow }}_{\text {CL}}\), as follows:
So, the string of variables \(\varvec{y}\) plays a dummy role in the reduction of \(M \varvec{x} \varvec{y}\).
The notion of order, in particular order 0, is also involved in the notion of ‘undefined’, or ‘meaningless’. See also Barendregt (1984), on representing ‘undefined’ in the \(\lambda \)-calculus.
We summarize the various notions of ‘undefined’ appearing in this paper, as follows. The implications as displayed are the only ones valid for these notions, of course apart from those obtained by transitivity of implication. For an axiomatic theory about the notion of ‘undefined’, we refer to Terese (2003), and in particular to Kennaway et al. (1999).
Theorem 38
The following notions of ‘undefined’ Kennaway et al. (1999), Barendregt (1992a) are strictly ordered by implication:
Proof
-
(i)
Note that a weak head normal form (whnf) has the form \(xM_1 \ldots M_n\) or \(\lambda x. M\). Both forms of whnf are also root normal forms (rnf).
-
(ii)
Suppose M is not of order 0. Then M reduces to an abstraction. But that is a whnf. The reverse does not hold: if M is a zero term, it does not follow that M has no whnf; e.g. \(x\varvec{P}\) is of order 0, but also a whnf.
-
(iii)
Suppose M is of order 0. Then it cannot consume any argument. But then it cannot be ‘solved towards’ \(\mathsf {I}\), i.e. there is no \(\varvec{P}\) such that \(M\varvec{P} \mathrel {{\twoheadrightarrow }}_{\beta } \mathsf {I}\). A theorem by Wadsworth (Barendregt 1984, Theorem 8.3.14, p. 175) states that therefore M has no hnf.
-
(iv)
Implications (iv) and (v) are standard theory.
Remark 39
Theorem 38 shows that the notion of undefinedness embodied by mute terms is the strongest one of those featuring in this paper. That mute is ‘more undefined’ than unsolvable, apart from the strict inclusion mute \(\implies \) unsolvable, is witnessed by a theorem of Berarducci (1996), stating that it is consistent to put all mute terms uniformly equal to an arbitrary \(\lambda \)-term Q. This is not the case for unsolvable terms. Even the single equation \(\varOmega _3 = \mathsf {I}\) generates inconsistency when added to \(\lambda \)-calculus Jacopini (1975). It is a simple exercise to find the few deduction steps showing \(x = y\) for different variables x and y.
5.1.7 Translating CL in \(\lambda \)
There are translations in both directions between CL and \(\lambda \), preserving certain properties. Here we will only be concerned with the easy direction, from CL to \(\lambda \). The translation consists of the contextual closure of the replacements
To keep reading light, we allow ourselves the notational liberty of using the same letter for a term in CL and its translation in \(\lambda \). The reader who dislikes that, will have no problem in inserting several \((\ldots )_{\lambda }\) as used in Barendregt (1984) at the right places. The salient property is that reduction is preserved:
and restricted to S-terms:
Of course this translation raises the question whether the properties \(\mathrm {WN}\) and \(\mathrm {SN}\) are also preserved. For full CL, it is well-known that \(\mathrm {WN}\) and \(\mathrm {SN}\) are not preserved. For instance, \(M \equiv \mathsf {S}(\mathsf {K} \omega )(\mathsf {K} \omega )\) where \(\omega \equiv \mathsf {S}\mathsf {I}\mathsf {I}\), is a CL-normal form, but its translation into \(\lambda \) has no \(\beta \)-normal form, as can be easily verified.
It could be thought that this phenomenon is due to the erasing nature of \(\mathsf {K}\), but similar counterexamples exist in the non-erasing version of CL, called \(\text {CL}_\mathsf {I}\), which has atomic combinators \(\mathsf {I}, \mathsf {S}, \mathsf {B}, \mathsf {C}\) with for \(\mathsf {B}, \mathsf {C}\) the rules
Then we have counterexamples \(\mathsf {B}(\mathsf {C}\mathsf {I} \omega )(\mathsf {C} \omega )\) and \(\mathsf {S}(\mathsf {C}\mathsf {I}(\mathsf {C}\mathsf {I} \omega ))(\mathsf {C} \omega )\). Remarkably, just with \(\mathsf {S}\) alone there is already such a counterexample, as we will see in the paper.
From the preservation of reduction we immediately have the preservation of convertibility:
and restricted to \(\mathsf {S}\)-terms:
Also here it is well-known (Barendregt 1984, p. 157) that the reverse does not hold. The classical example is the equation \(\mathsf {S}\mathsf {K} = \mathsf {K}\mathsf {I}\): \(\text {CL} \nvDash \mathsf {S}\mathsf {K} = \mathsf {K}\mathsf {I}\), but \(\lambda \models \mathsf {S}\mathsf {K} =_{\beta } \mathsf {K}\mathsf {I}\).
For the restriction to \(\mathsf {S}\)-terms we have the same non-preservation, but more complicated; abbreviating \(T \equiv \mathsf {S}\mathsf {S}\) and \(A \equiv \mathsf {S}\mathsf {S}\mathsf {S}\) we have, as elaborated in the paper: \(\mathsf {CL} \nvDash \mathsf {S}(\mathsf {S}T\mathsf {S})A = \mathsf {S}(TA)(\mathsf {S}A\mathsf {S})\), but \(\lambda \models \mathsf {S}(\mathsf {S}T\mathsf {S})A =_{\beta } \mathsf {S}(TA)(\mathsf {S}A\mathsf {S})\).
It is an interesting question whether the order of a term is preserved under translation from CL to \(\lambda \)-calculus; indeed we expect so.
Conjecture 40
Let . Then \(\mathsf {order}(M) = \mathsf {order}((M)_{\lambda })\).
Example 41
-
(i)
The CL-term \(\mathsf {S}\mathsf {S}\) has order 3, because \(\mathsf {S}\mathsf {S}xyz \mathrel {{\twoheadrightarrow }}_{\text {CL}} yz(xyz)\), and the last term is of order 0. Also \((\mathsf {S}\mathsf {S})_{\lambda } \mathrel {{\twoheadrightarrow }}_{\beta } \lambda xyz.\,yz(xyz)\), again of order 0, but now in \(\lambda \)-calculus.
-
(ii)
The CL-term \(\mathsf {S}\mathsf {S}\mathsf {S}\) has order 2, because \(\mathsf {S}\mathsf {S}xy \mathrel {{\twoheadrightarrow }}_{\text {CL}} xy(\mathsf {S}xy)\), a term of order 0. Also \(\mathsf {S}(\mathsf {S}\mathsf {S})_{\lambda } \mathrel {{\twoheadrightarrow }}_{\beta } \lambda ab.\,ab(\lambda c.\,ac(bc))\), of order 2.
-
(iii)
\(\mathsf {S}\mathsf {S}\mathsf {S}\mathsf {S}\) has order 2, both in CL and \(\lambda \)-calculus.
-
(iv)
Let \(\omega \equiv \mathsf {S}\mathsf {I}\mathsf {I}\). Then \(\mathsf {S}(\mathsf {K}\omega )(\mathsf {K}\omega )\) has order 1, both in CL and \(\lambda \)-calculus.
-
(v)
\(\mathsf {S}(\mathsf {S}\mathsf {S})(\mathsf {S}\mathsf {S}\mathsf {S})\) has order 2, both in CL and \(\lambda \)-calculus.
Conjecture 42
Let . Then Mxyz normalizes \(\iff (M)_{\lambda }\) normalizes.
Conjecture 43
Let . Then \(M x_1 x_2 \ldots x_{\mathsf {order}(M)}\) normalizes \(\iff (M)_{\lambda }\) normalizes.
5.1.8 A.4 Head Reduction and Root Reduction
The evaluation of \(\lambda \)-terms to their Böhm Trees (BT’s) proceeds from left to right, starting with the head. In this section of the Appendix we will present definitions and the main facts about head reduction. But there is a complementing point of view, where evaluation proceeds top-down, from the root to lower parts of the term. That leads to root reduction, and to a finer kind of semantics, embodied in so-called Berarducci Trees (BeT’s). Here ‘finer’ refers to the semantics as given by Böhm Trees. We will explain this in more detail below. BT’s have more computational significance, whereas BeT’s are a beautiful tool in consistency studies of \(\lambda \)-calculus Berarducci (1996), Berarducci and Intrigila (1996).
5.1.9 Head and Root Reduction in CL
CL-terms can be conveniently drawn as finite term trees, with binary application nodes, and \(\mathsf {S}\)’s as terminal nodes; see the reduction of AAA where \(A \equiv \mathsf {S}\mathsf {S}\mathsf {S}\) in Fig. 5.2. The (left) spine of a CL-term M is the leftmost branch in the term tree of M. The spine length \(\mathsf {sl}(M)\) of M is the length of the spine, defined as the number of steps on the spine. So \(\mathsf {sl}(\mathsf {S}) = 0\), \(\mathsf {sl}(\mathsf {S}X) = 1\), \(\mathsf {sl}(\mathsf {S}XY) = 2\), \(\mathsf {sl}(\mathsf {S}XYZ) = 3\) and so on. Here X, Y, Z are metavariables for CL-terms. Note that an \(\mathsf {S}\)-term is a redex iff its spine has length 3.
A head normal form (hnf) in CL is a term starting with \(\mathsf {I}\), \(\mathsf {K}\), or \(\mathsf {S}\), but without enough arguments to constitute a redex; so \(\mathsf {I},\mathsf {K},\mathsf {S}\) themselves, and also terms of the form \(\mathsf {K}X\), \(\mathsf {S}X\), \(\mathsf {S}XY\). So restricting to terms only containing \(\mathsf {S}\)’s, an \(\mathsf {S}\)-term is a hnf if its spine length is 0, 1 or 2.
A redex R in M is called the head redex if it is in head position, i.e. \(M \equiv R N_1 N_2 \ldots N_k\), for a sequence of \(k \ge 0\) arguments. If \(k = 0\), the redex is called the root redex. If a term is not a hnf, it has a unique head redex. A root redex is also a head redex, but not vice versa. See Fig. 5.2. Note that the head redex if it exists, is located at the end of the spine, containing in the case of \(\mathsf {S}\)-terms the last three steps of the spine.
We can give an equivalent alternative definition of a hnf: this is a term that cannot reduce to a term having a head redex. This definition leads us to the more complicated notion of a root normal form (rnf); this is a term which cannot reduce to a term which has (or equivalently, is) a root redex (see also Middeldorp 1997). So hnf’s are a fortiori rnf’s, because a root redex is also a head redex. Restricting to \(\mathsf {S}\)-terms: an \(\mathsf {S}\)-term is a rnf if it is of the form \(\mathsf {S}\), \(\mathsf {S}X\), \(\mathsf {S}XY\), or XY where X cannot reduce to a term of the form \(\mathsf {S}PQ\). Indeed in all these 4 cases the root node of the term tree can never be active in a reduction. The complication of the notion rnf is its undecidability; by contrast: the property of being a hnf is trivially (syntactically) decidable. Indeed for full CL, this property is undecidable. But remarkably, for the subsystem of CL(\(\mathsf {S}\)), the notion of rnf is decidable!Footnote 4
Example 44
The term \(AAA\mathsf {S}\) is an example of a \(\mathsf {S}\)-term which is in root normal form since the root-application never can be ‘touched’. The term is not in head normal, it does not even reduce to a head normal form, because AAA is of order 0.
5.1.10 Head and Root Reduction in \(\lambda \)-calculus
Remember that every \(\lambda \)-term M is of one of the following forms:
or
In the first case M is said to be a head normal form (hnf); in the second case M has the head redex \((\lambda y.\,P)Q\).
5.1.11 Head and Root Normalization Theorems
We are approaching the fundamental notions of Böhm Trees and Berarducci Trees for CL and \(\lambda \)-calculus. Before we are there, there are two important theorems, one for ‘head’ and one for ‘root’, that must be presented.
Theorem 45
The following are equivalent, for CL and \(\lambda \)-calculus:
-
(i)
M has no hnf.
-
(ii)
M has an infinite reduction of consecutive head steps:
$$\begin{aligned} M \equiv M_0 \rightarrow _h M_1 \rightarrow _h M_2 \rightarrow _h \ldots \end{aligned}$$ -
(iii)
M has an infinite reduction containing infinitely many head steps.
We will now turn to root reduction instead of head reduction. Let us first define the notion of root redex and root normal form (rnf).
Definition 46
-
(i)
Let R be a redex in M. Then R is the root redex of M, if \(M \equiv R\).
-
(ii)
M is a root normal form (rnf), also called root stable, if M cannot reduce to a redex.
-
(iii)
M has a rnf, if it reduces to a rnf.
There is a considerable analogy between these two notions, hnf and rnf, but not all the way. To appreciate the intricacy of the notion rnf, consider the statement ‘M has no rnf’. (Also called: M is root-active.) This means: M does not reduce to a term which cannot reduce to a redex. In a more understandable reformulation: every reduct of M can further reduce to a redex.
Theorem 47
M has no root normal form iff M admits a reduction with infinitely many root steps.
For completeness sake, we mention the following. Note that for orthogonal systems, \(\mathrm {SN}^{\infty }\) is the same as root normalization; see Theorem 29 and the subsequent discussion.
Theorem 48
(Ketema et al. 2005) For orthogonal TRSs, CL, CL(\(\mathsf {S}\)) it holds that: \(\mathrm {SN}^{\infty }\implies \text {there are no reduction cycles}\).
Corollary 49
\(\mathsf {S}\)-terms are acyclic.
5.1.12 A.5 Infinitary Rewriting
We can easily introduce infinite terms in CL and \(\lambda \)-calculus by interpreting the formerly inductive term formation rules in a coinductive way. This is by now a standard definition mechanism that needs no further explanation here; see e.g. Endrullis and Polonsky (2013), Endrullis et al. (2013a).
However, we can also introduce infinite terms by the even more classical mechanism of metric completion, as below.
As to reduction (rewriting) of infinite terms we observe that the rules apply just as well to finite as to infinite terms; their applicability just depends on the presence of a finite ‘redex pattern’. In the following, the signature \(\varGamma \) stands for either \(\lambda \) or CL. Infinite terms arise from the set of finite terms, , by metric completion, using the well-known distance function d such that for terms t, s, \(d(t,s) = 2^{-n}\) if the n-th level of the terms t, s (viewed as labelled trees) is the first level where a difference appears, in case t and s are not identical; furthermore, \(d(t,t) = 0\). It is standard that this construction yields as a metric space. Now infinite terms are obtained by taking the completion of this metric space, and they are represented by infinite trees. We will refer to the complete metric space arising in this way as , where is the set of finite and infinite terms over \(\varGamma \).
A natural consequence of this construction is the emergence of the notion of Cauchy convergence: we say that \(t_0 \rightarrow t_1 \rightarrow t_2 \rightarrow \ldots \) is an infinite reduction sequence with limit t, if t is the limit of the sequence \(t_0,t_1,t_2, \ldots \) in the usual sense of Cauchy convergence. In fact, we will use throughout a stronger notion that has better properties. This is strong convergence, which in addition to the stipulation for Cauchy convergence, requires that the depth of the redexes contracted in the successive steps tends to infinity. So this rules out the possibility that the action of redex contraction stays confined at the top, or stagnates at some finite level of depth.
The notion of normal form, which now may be an infinite term, is unproblematic: it is a term without a redex occurrence.
The most important properties of finite and infinitary rewriting are shown in Table 5.1.
Here the left column states the finitary properties, and the right column states the analogous properties for the infinitary case.
Most of the properties in this table are self-explanatory, but \(\mathrm {SN}^{\infty }\) requires some special explanation. The helpful underlying analogy is stated in the first two rows of the table: infinite reductions in the finite realm (not delivering a resulting finite normal form) are analogous to ‘not strongly convergent’, i.e. divergent reductions in the infinitary realm of rewriting. Here not strongly convergent, divergent, means that there is stagnation at some problematic point in the term being rewritten; the depth of the contracted redex is then not increasing as required for strong convergence. This means that the root of the subterm-tree at that problematic point refuses to ‘stabilize’. Now \(\mathrm {SN}^{\infty }\) states the absence of such divergences, non-stabilizations. Thus we see that \(\mathrm {SN}^{\infty }\) is tantamount to ‘root stabilization’, uniformly for all roots of subterms that are encountered.
In our paper we have used sometimes as synonym for \(\mathrm {SN}^{\infty }\) the phrase ‘root stabilization’. In the terminology of Berarducci Trees (BeT’s) this means that no mute terms occur, or, that the BeT is \(\bot \)-free, total. This is the exceptional situation for finite \(\mathsf {S}\)-terms, they are \(\mathrm {SN}^{\infty }\), infinitary normalizing. Not so for general CL-terms, and also not for infinite \(\mathsf {S}\)-terms.
That \(\mathsf {S}\)-terms are \(\mathrm {SN}^{\infty }\) ‘infinitary normalizing’ means also that whatever reduction we perform, eventually we will reach the unique, possibly infinite normal form. That is, if we apply a fair rewrite strategy, and do not omit a redex forever in our evaluation. This means that even a random infinite reduction of a finite S-term will have a limit, as a partially evaluated tree, one could say, a partially evaluated Berarducci Tree. In our paper we have encountered this in Fig. 5.5, where we have AAA partially evaluated by rewriting the head redex whenever it is present; in the limit there is no head redex anymore – but plenty of other redexes, waiting for their turn. Figure 5.16 displays the general situation of such a partially evaluated infinite term tree.
5.1.13 A.6 Infinite Normal Forms, Böhm Trees and Berarducci Trees
Infinitary lambda-calculus, \(\lambda ^{\infty }_{\beta }\)-calculus and infinitary CL, \(\text {CL}^{\infty }\), are the framework for several notions of infinite normal forms that need to be carefully distinguished. We will give an informal exposition.
-
(i)
The easiest notion is that of infinitary normal forms as elements of \(\lambda ^{\infty }_{\beta }\)-calculus or \(\text {CL}^{\infty }\). These are just possibly infinite (term) trees without \(\beta \)-redex, or in the case of CL, without \(\mathsf {I}\)-,\(\mathsf {K}\)-,\(\mathsf {S}\)-redex.
-
(ii)
Böhm Trees (BT’s). The introduction of BT’s requires a signature extension, with a constant symbol \(\bot \) for undefined terms. The essence of BT’s is that we evaluate a \(\lambda \)-term ad infinitum by recording its head normal forms, as they present themselves in our branching evaluation, see the definition below. We use \(\bot \) where head normalization is not possible. To know that, we need an oracle, as it is not decidable. The well-known definition is:
$$\begin{aligned} \mathsf {BT}(M)&= {\left\{ \begin{array}{ll} \lambda \varvec{x}.\,y \, \mathsf {BT}(M_1) \ldots \mathsf {BT}(M_m) &{} \text {if}\, M \text {has hnf} \lambda \varvec{x}.\,y M_1 \ldots M_m, \\ \bot &{} \text {otherwise.} \end{array}\right. } \end{aligned}$$ -
(iii)
BerarducciTrees (BeT’s). Also here we need \(\bot \), now to designate subterms that have no root normal form, also known as mute or root-active terms. The well-known analogous definition is:
$$\begin{aligned} \mathsf {BeT}(M) = {\left\{ \begin{array}{ll} y &{} \text {if}\, M \mathrel {{\twoheadrightarrow }}y, \\ \lambda x.\,\mathsf {BeT}(N) &{} \text {if} M \mathrel {{\twoheadrightarrow }}\lambda x.\,N, \\ \mathsf {BeT}(M_1) \, \mathsf {BeT}(M_2) &{} \text {if}\, M \mathrel {{\twoheadrightarrow }}M_1 \, M_2 \text {such that}\, M_1 \text {is of order} 0 \\ \bot &{} \text {in all other cases (i.e., when} M \text {is mute.)} \end{array}\right. } \end{aligned}$$BeT’s give finer information than BT’s, in the sense that \(\mathsf {BT}(M) \le \mathsf {BeT}(M)\) where the ordering \(\le \) refers to refinement of \(\bot \)’s; in other words, \(\mathsf {BT}(M)\) can be obtained from \(\mathsf {BeT}(M)\) by chopping off some subtrees and replacing them by \(\bot \). An extreme example is AAA: \(\mathsf {BT}(AAA) \equiv \bot \le \mathsf {BeT}(AAA) \equiv \) the tree in Figs. 5.6 and 5.7. Note that if \(\mathsf {BT}(M)\) is \(\bot \)-free, \(\mathsf {BT}(M) \equiv \mathsf {BeT}(M) \equiv \) the normal form of M in \(\lambda ^{\infty }_{\beta }\)-calculus. An example is the Zachos term in Fig. 5.10. The same is true for BeT’s; when they are \(\bot \)-free, they coincide with the normal form of M in \(\lambda ^{\infty }_{\beta }\)-calculus. An example is \(\mathsf {BeT}(\varOmega _3 \mathsf {I})\), as in Fig. 5.18. Some more examples of BT’s and BeT’s are given in Fig. 5.17.
Rights and permissions
Copyright information
© 2017 Springer International Publishing AG
About this chapter
Cite this chapter
Barendregt, H., Endrullis, J., Klop, J.W., Waldmann, J. (2017). Dance of the Starlings. In: Fitting, M., Rayman, B. (eds) Raymond Smullyan on Self Reference. Outstanding Contributions to Logic, vol 14. Springer, Cham. https://doi.org/10.1007/978-3-319-68732-2_5
Download citation
DOI: https://doi.org/10.1007/978-3-319-68732-2_5
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-68731-5
Online ISBN: 978-3-319-68732-2
eBook Packages: Religion and PhilosophyPhilosophy and Religion (R0)