Last active
October 25, 2019 01:02
-
-
Save Kazark/089896e622cbb900d0fd084fa32342b7 to your computer and use it in GitHub Desktop.
Who needs constructivism? Make types out of Boolean predicates! (Encoded constructively...)
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 Guard | |
%default total | |
%access public export | |
data Guarded : (a -> Bool) -> a -> Type where | |
Guard : (pred : a -> Bool) -> (subject : a) -> (prf : pred subject = True) | |
-> Guarded pred subject | |
data GuardedIsBogus : Type where | |
BogusIf : (pred : a -> Bool) -> (subject : a) | |
-> (counter : pred subject = False) -> Guarded pred subject | |
-> GuardedIsBogus | |
Uninhabited GuardedIsBogus where | |
uninhabited (BogusIf pred subject counter (Guard pred subject prf)) = | |
trueNotFalse $ trans (sym prf) counter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment