Last active
November 18, 2015 16:57
-
-
Save enolan/38f742f81bd60784f600 to your computer and use it in GitHub Desktop.
This file contains 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
import Decidable.Equality | |
%default total | |
AtLeastTwo : Type -> Type | |
AtLeastTwo ty = Sigma (ty,ty) (\(a,b) => Not (a = b)) | |
atLeastTwoNats : AtLeastTwo Nat | |
atLeastTwoNats = ((0,1) ** absurd) | |
atLeastTwoBools : AtLeastTwo Bool | |
atLeastTwoBools = ((True,False) ** trueNotFalse) | |
notAtLeastTwoUnits : Not (AtLeastTwo ()) | |
notAtLeastTwoUnits (((),()) ** prf) = prf Refl | |
notAtLeastTwoVoids : Not (AtLeastTwo Void) | |
notAtLeastTwoVoids ((a, _) ** prf) = a | |
foo : AtLeastTwo ty -> Not ((a : ty) -> (b : ty) -> a = b) | |
foo ((a, b) ** distinct) prf = distinct $ prf a b | |
-- AFAIK this is impossible. We have a proof that not all inhabitants are equal, | |
-- but no way to get any inhabitants. | |
bar : Not ((a : ty) -> (b : ty) -> a = b) -> AtLeastTwo ty | |
bar x = ?bar_rhs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment