Introduction. Basics. Relative clauses. Abstraction elimination. See also: Plefande (a conlang) Unlambda reference |
IntroductionI've been thinking that relative clauses are just
like functions in lambda calculus, and that abstraction
could be eliminated using the S, K and I combinators.
I thought about this when reading about the obfuscated
programming language Unlambda: BasicsTopSuppose we have a language where roots are isolated and the only thing one can do is "applying" a root to another root. The functor would be the modifier and the arguments modified. BNF syntaxSyntax would be quite simple (in a kind of BNF): construct ::= root | ` construct construct
Where ` is the apply operator. ` A B reads "apply A to B". And every other construction would be delegated on semantics. Some simple examplesLet's work with English words as roots for some examples (I'll also assume English semantics, but it is not the point): Intransitive verbs are just applied to nouns:
` write man
Adjectives are simply intransitive verbs (just like in many natural languages):
` white book
Of course, application is recursive:
` write ` tall ` red man
Adverbs could be applied to adjectives or verbs:
` ` quickly write ` ` amazingly tall man
Transitive verbs are (in currying fashion) verbs that when applied to a nominal construction (the object, maybe?) yields an intransitive verb that, when applied to a second nominal construction (the subject), yields the expected result:
` ` write* book man
Where: Notice that in the language, intransitive write and transitive write* should be different words (probably regularly related). Oblique constructions should be applied to the verb, too:
` ` ` in sky fly plane
Many ambiguities dissapear:
` ` see ` ` with telescope man I
Relative clausesTopNow let's analyse relative clauses. Just like adjectives can be interpreted like intransitive verbs or adjectives, when translated:
` red book
We could do the same with verbs:
` ` eat cheese man
Non-trivial relative clausesWhen the order is the expected, there are no problems. But what if we want to express, say:
the book [the man writes] is red
We cannot say:
` red ` ` write man book
And neither:
` red ` ` write book man
Lambda notationWe need more expressive constructions. Adopting lambda notation for functions (where \ pretends to be the ASCII version of a greek lowercase lambda):
(\ x : ` ` write x man)
Is a construction that, when applied to an argument x, means "the man writes x". For instance:
` (\ x : ` ` write x man) book
Therefore:
the book [the man writes] is red
Notice that if we reduce it:
` red ` ` write book man
It yields the previously discarded construction. Expressions with lambdas are not necessarily equivalent when reduced. Here, lambdas are precisely used to show that the modified root is "book" and not "man". TopAbstraction eliminationTopWe could invent a way of directly translating lambda expressions into our conlang. But there is an ugly problem: the name x. In math, its said of x that it is a mute variable, as changing its name does not change the meaning of the expression. Fortunately, this problem has already been solved with the S, K and I combinators. Definition of the S, K and I combinatorsI is the identity function:
I = (\ x : x)
K is the constant function generator:
K = (\ x : (\ y : x))
And S is the substituted application function:
S = (\ x : (\ y : (\ z : ` ` x z ` y z)))
Lambda eliminationBy induction, it's not hard to prove that any lambda expression can be reduced to an expression using these combinators, and without any mute variable. A lambda expression (\ x : e) falls into one of these three cases:
Rules for eliminating abstractionA rule for mechanically eliminating abstraction in lambda expressions (\ x : e): Reading e from left to right, replace:
` with ` ` S
If more than one lambda need to be eliminated, start with the innermost ones first. Examples
(\ x : ` red x)
=> ` ` S ` K red I
Now let's eliminate the abstraction from:
(\ x : ` ` write x man)
ConclusionThe power of lambda expressions guarantees that every possible relative clause is expressable in this language, and that no ambiguities can appear in nested clauses. An example of a relative clause impossible in English from the Language Construction Kit:
This is the man [my girlfriend's father is a friend of John and him]
First, let's define f (with definition as abbreviation only):
f = (\ x : ` ` be ` ` of ` ` and John x friend ` ` <POSS>
` ` <POSS> i girlfriend father)
(Notice I write the first person pronoun as "i" to avoid confusion with "I", the identity function! <POSS> is a root for possessive, where ` ` <POSS> X Y = X's Y).
The sentence using f:
Which is a bit quite long. Some tricks could be used to make it shorter. There's much more about it in the Unlambda reference. These kilometric expressions make me believe this is probably violating a language universal, in the sense that it is counter-intuitive. Anyway, at least for me, it is an interesting theoretical exercise. To create a real conlang, the apply operator should be grammaticalized somehow (as an inflection, syntactically, etc.). I leave the rest as an exercise to the conlang world. Top |