De Morgan's Laws in Haskell via the Curry-Howard Correspondence

此生再无相见时 提交于 2019-12-04 18:06:50
ErikR

One thing that stands out to me is that you don't seem to be using the definition or any property of negation anywhere.

After reading the Haskell Wikibooks article on the CHI here is a proof assuming that you have a law of the excluded middle as a theorem:

exc_middle :: Either a (a -> Void)

and the proof of the notAandB de Morgan law would go like:

notAandB' :: Either a (a -> Void) -> ((a,b) -> Void) -> Either (a -> Void) (b -> Void)
notAandB' (Right notA) _ = Left notA
notAandB' (Left a)     f = Right (\b -> f (a,b))

notAandB = notAandB' exc_middle
Cactus

The fourth law is not intuitionistic. You'll need the axiom of excluded middle:

lem :: Either a (a -> c)

or Pierce's law:

pierce :: ((a -> c) -> c) -> a

to prove it.

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