Last active
January 4, 2016 01:59
-
-
Save edwinb/8551794 to your computer and use it in GitHub Desktop.
minus, with erasue
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
module erase | |
data LessThan : Nat -> Nat -> Type where | |
LtO : LessThan Z (S k) | |
LtS : LessThan x y -> LessThan (S x) (S y) | |
minus : (x : Nat) -> (y : Nat) -> LessThan y x -> Nat | |
minus (S k) Z LtO = S k | |
minus (S k) (S j) (LtS z) = minus k j | |
And minus at run time look a bit like... | |
[{e0},{e1},{e2}] case {e1} of | |
0 => prim__addBigInt {e0}!-1 1 | |
{e4}+1 => erase.minus {e0}!-1 {e4} [__] | |
(Sorry for the ugly syntax, that's just how Idris prints it... but, no proof! At least, not one the machine ever looks at.) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment