CH = PH
Here is a Haskell program giving both encodings, and showing they are interconvertible. (The CH representation is called `finally tagless' by Carette, Kiselyov, and Shan, which is not the most perspicuous name; Atkey, Lindley, and Yallop point out the idea goes back to Coquand and Huet; PH was introduced by Chlipala.)
I proved that the 'CH' and 'PH' presentations are isomorphic in my TLCA2009 paper: Syntax for Free: Representing Syntax with Binding Using Parametricity, building on the well-known result that inductive types can be encoded via polymorphism in System F.
I thought that Geoff Washburn and Stephanie Weirich proposed the PHOAS representation of lambda terms in their Boxes Go Bananas paper, and Bob gave the first proof that it was an adequate encoding?Post a Comment