convert flip lambda into SKI terms

情到浓时终转凉″ 提交于 2019-12-05 19:37:08

Once the answer being accepted I revised it and I figured out it is actually wrong.

Your final result is correct, although it is not the "official" answer in the text book, but it is possible that different SKI terms are actually equivalent to the same lambda expression.

S [S (K S) (S (S (K S) (S (K K) (K S))) K)] [K K] f x y
-> S (K S) (S (S (K S) (S (K K) (K S))) K) f (K K f) x y
-> K S f (S (S (K S) (S (K K) (K S))) K f) (K K f) x y
-> S [S (S (K S) (S (K K) (K S))) K f] (K K f) x y
-> S [S (K S) (S (K K) (K S))] K f x (K K f x) y
-> S [K S] [S (K K) (K S)] f (K f) x (K K f x) y
-> K S f (S (K K) (K S) f) (K f) x (K K f x) y
-> S [S (K K) (K S) f] [K f] x (K K f x) y
-> S [K K] [K S] f x (K f x) (K K f x) y
-> K K f (K S f) x (K f x) (K K f x) y
-> K (K S f) x (K f x) (K K f x) y
-> K S f (K f x) (K K f x) y
-> S [K f x] [K K f x] y
-> K f x y (K K f x y)
-> f y (K K f x y)
-> f y (K x y)
-> f y x

The above derive, based on left most reduction order, proves that your final term is equivalent to the C combinator.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!