Proof of the Futamura projections in Haskell

前端 未结 1 1830
执笔经年
执笔经年 2021-02-04 02:56

I read Dan Piponi\'s excellent blog post on The Three Projections of Doctor Futamura. Towards the end of the article he has an appendix with a proof of the Futamura projections

相关标签:
1条回答
  • 2021-02-04 02:59

    Yes, the Futamura projections will work if and only if the source and object languages of the specializer are the same. This is because the specializer can only be applied to itself if it's written in the same language that it can read. However, the target language of the specializer is independent of the other two. This has important consequences which I'll discuss later in this answer.

    To prove my hypothesis I'll introduce a new notation to describe programs loosely based on tombstone diagrams. A tombstone diagram (or T-diagram) is a pictorial representation of compilers and other related metaprograms. They are used to illustrate and reason about the transformation of a program from a source language (left of T) to a target language (right of T) as implemented in an object language (bottom of T). Let's extend the idea of T-diagrams to work for all programs:

    α → β : ℒ -- A program is a function from α to β as implemented in language ℒ.
    

    In the case of metaprograms α and β are themselves programs:

    (α → β :                                                                     
    0 讨论(0)
提交回复
热议问题