Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You're totally correct that double-negation elimination is a specialization of the CPS transform which is a specialized form of Yoneda. Yoneda is more general and exists more often than CPS transforms do, though.

    cps : a -> (forall r . (a -> r) -> r)
    cps a = \f -> a f

    cps' : (forall r . (a -> r) -> r) -> a
    cps' f = f id
It's interesting to examine double negation elimination in constructivist logic since it doesn't hold there. In particular, we can easily write the backward direction

    bck : a -> ((a -> Void) -> Void)
    bck = cps a
but since we've now specialized `forall r` to `Void` we can no longer come back. This demonstrates (1) that the pure CPS'd version is more general than DNE and (2) proof by contradiction is non-constructive.


Typo: `bck` should obviously be

   bck = cps




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: