[stack] Flat sublanguages of concatenative languages
Michael Nedzelsky <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
It is very interesting that Joy have a flat sublanguage which is represent the
same set of functions.
I have thought a little about it, below the result of my attempt to better
understand the notion of flatness in concatenative languages.
Summary (Joy language).
Joy programs denote unary functions from stacks to stacks.
The stack is a finite object, so the set X of all stacks is a denumerable set.
We can choose some effective enumeration of this set and define as usual the
set P(X) of all partial computable function from X into X.
Every Joy program denote some partial computable function from the set of all
stacks into itself.
Every partial computable function from P(X) which can be represented by some
Joy program, can also be represented by some program from a flat subset of
Joy language.
Now consider this situation in more general case.
Let L be a (syntactically) concatenative language, X be a denumerable set.
Assume that we have some fixed effective enumeration of X.
Let also P(X) be a set of all partial computable functions from X into X.
We assume that the semantics of L is given by some mapping
s: L -> P(X), i.e. the meaning of a program p \in L is the partial computable
function s(p) \in P(X).
Theorem.
If s(L) = P(X), i.e. every partial computable function on X can be
represented by some program in language L, then there exists three programs
a, b, c \in L such that every partial computable function on X can be
represented by concatenation of programs a, b and c. In other words, for
every program p \in L there exists a program
x1 x2 ... xN, where each xi \in {a, b, c}
which represent the same partial computable function.
The proof is more or less straightforward (we must use the existence of the
universal partial recursive function).
Michael Nedzelsky