Created
August 4, 2019 13:27
-
-
Save XiaohuWang0921/01c182125b7e74d2af513d0a7d18e5c2 to your computer and use it in GitHub Desktop.
Russell's paradox implemented in Idris, translated from https://gist.github.com/scott-fleischman/8ace399d19b30f0875daa443629d6176
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module RussellsParadox | |
| data Set : Type where | |
| MkSet : (a -> Set) -> Set | |
| elem : Set -> Set -> Type | |
| elem e (MkSet supp) = Exists (\ x => e = supp x) | |
| notElem : Set -> Set -> Type | |
| notElem e s = elem e s -> Void | |
| R : Set | |
| R = MkSet evidence where | |
| evidence : Exists (\ x => notElem x x) -> Set | |
| evidence (Evidence x _) = x | |
| inRNotInSelf : (x : Set) -> elem x R -> notElem x x | |
| inRNotInSelf x (Evidence (Evidence x pfXNotInX) Refl) = pfXNotInX | |
| notInSelfInR : (x : Set) -> notElem x x -> elem x R | |
| notInSelfInR x pfXNotInX = Evidence (Evidence x pfXNotInX) Refl | |
| rNotInR : notElem R R | |
| rNotInR pfRinR = inRNotInSelf R pfRinR pfRinR | |
| contradiction : Void | |
| contradiction = rNotInR (notInSelfInR R rNotInR) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment