scm 老師的寓言

When I just started my postdoc in Japan, people there were talking about the 3rd homo. theorem. The theorem says that if f can be expressed both as a foldr and a foldl, there exists some ⊙ such that

f (x ++ y) = f x ⊙ f y.

The aim then was to automatically, or semi-automatically, derive the ⊙ operator, given the left-fold and the right-fold.

They were discussing three examples,

f = sum, where ⊙ can simply be +.

f = sort, ⊙ can be merge.

f = scan. It is actually possible to compute f in parallel!

Being just graduated from Oxford, I was not very keen about automation (being too proud of saying "I don't use a computer!"). Instead I felt that all the instances they talked about can be expressed better in a relational setting. So I gave a small presentation with 17 slides, attached below.

The conclusion was "it's difficult, and we have not improved too much since Gibbons." Deep inside I considered these ugly, ad-hoc approaches to automation inferior to our beautiful relational theory.

Last year, however, my colleagues and I met somewhere else. I was told that they eventually published a paper on this subject: