Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I suspect there's a good chance the answer to this is unknown and hard (or at least extremely tedious), but I figured it would be worth asking.

It's well known that the functions $K:=\lambda x.\lambda y.x$ and $S:=\lambda x.\lambda y.\lambda z.xz(yz)$ together generate all functions of lambda calculus.

It's also possible to do it with just a single function, as mentioned here: If we define $U=\lambda x.xSK$, then we can obtain $K=U(U(UU))$, and $S=U(U(U(UU))$, and thus everything.

It's also possible to do this with $V:=\lambda x.xKS$, since $S=VVV$, and $K=V(VVVVV)$.

What I want to know is, picking a reasonable notion of "length", is there any way that is shorter than $U$ or $V$? Let's say for now that the length is the number of occurrences of a variable, including when they're introduced, so e.g., $K$ has a length of 3, $S$ has a length of 7, and $U$ and $V$ each have length 12. (Or is there a usual notion of "length" that's been studied?) Is it possible to do better than 12, and what's the shortest way?

What if we allow for more than one generator and total the lengths? Then the usual set $\{S,K\}$ does it with 10. (Should we add a penalty for using more than one? Well, I guess you could, but I'm not going to define it that way here. I mean, unless people have studied this problem and already doing it that way...). Can this variant be done in fewer than 10, and what's the shortest?

I don't expect there's any easy way to answer the "what's the shortest" question, but I'm hoping maybe that at least if there is a shorter way that someone will know it or find it.

share|improve this question

2 Answers 2

I like $W = \lambda x.x K S K$ since it makes $K = W W W$ and $S = W (W W)$, although it is longer than either $U$ or $V$.

share|improve this answer

I believe this is related to finding a single axiom base for intuitionistic propositional calculus. There is a web page by Ted Ulrich on the subject, which discusses many such axioms. However, trying to find the shortest single axiom corresponds to trying to find a combinator with the shortest type (as opposed to your goal finding a combinator with the shortest λ-calculus expression).

Edit: You can take those single axioms and ask Djinn (a Haskell theorem prover) to find functions with corresponding types. For example, taking one of the first axioms in Ted Ulrich's web page, you can ask Djinn:

Djinn> ? x :: ((p -> q) -> r) -> (s -> ((q -> (r ->  t)) -> (q -> t)))

and it answers

x :: ((p -> q) -> r) -> s -> (q -> r -> t) -> q -> t
x a _ b c = b c (a (\ _ -> c))

So expression λazbc.bc(a(λy.c)) has the given type, and it is a candidate for a single combinator you're looking for.

(It is not obvious how to express S and K from such a combinator, but it can be recovered from the proof that forumlas (p→(q→r))→((p→q)→(p→r)) and p→(q→p) can be derived from the single axiom.)

This way, you could generate many possible combinators and see how long they are. Most likely you won't find the shortest one, but you might find some that are shorter than the ones you described. If you do, let us know!

share|improve this answer
    
Interesting! So this gets us one of length 9, then. In fact, looking over these examples, I suspect there is a connection between these two notions of length. HI-1 through HI-10 all yield ones of length 9 (by my measure); observe that each of these, being 17 symbols long if you include the C's, are only 9 symbols long if you don't (in general, number of C's has to be 1 less than number of non-C's). HI-11 and HI-12, however, yield ones of length 11. So perhaps (L+1)/2 is a lower bound on the length I'm looking at, where L is the length of the axiom? This seems plausible. –  Harry Altman Aug 8 '12 at 16:11
1  
Furthermore, checking his open problems page, I see there are only 4 possible single axioms of length shorter than 17 that have not been ruled out; all have length 15. Three of them yield functions of length 8, while C2 yields one of length 10. So if my hypothesis above is correct, and if every single-lambda-generator must come from a single axiom (I don't know this area much at all so it's not clear to me whether this is so), then the answer is either 8 or 9. –  Harry Altman Aug 8 '12 at 16:34
    
@HarryAltman The length of propositional formula and the length of a lambda expression that proves it under Curry-Howard isomorphism can be very different. For example, all formulas of the form τ→τ are proved by λx.x, no matter how long τ is. On the other hand, it is known that the Pigeon-hole principle expressed in propositional logic has an exponentially long proof (in our case, an exponentially long λ-term proving it) but only a polynomially long formula. –  Petr Pudlák Aug 8 '12 at 17:14
    
But is it possible that the length of the formula yields a lower bound on the length of the lambda expression, as I suggested? –  Harry Altman Aug 8 '12 at 17:36
    
@HarryAltman I think I was wrong about that Pigeon-hole principle. It is not known if there are short formulas with only long proofs, but it is assumed that there are. -- The example τ→τ shows that the length of a formula doesn't give a lower bound (at least in a general case): all formulas of this type, no matter how long, are proved by term 'λx.x', which has a constant length. (Also, if Djinn finds an expression of a given type, it doesn't guarantee it's the shortest one.) –  Petr Pudlák Aug 8 '12 at 18:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.