Created
July 31, 2013 20:10
-
-
Save edwinb/6125697 to your computer and use it in GitHub Desktop.
plus commutes
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
plus_comm : (n : Nat) -> (m : Nat) -> (n + m = m + n) | |
-- Base case | |
(O + m = m + O) <== plus_comm = | |
rewrite ((m + O = m) <== plusZeroRightNeutral) ==> | |
(O + m = m) in refl | |
-- Step case | |
(S k + m = m + S k) <== plus_comm = | |
rewrite ((k + m = m + k) <== plus_comm) in | |
rewrite ((S (m + k) = m + S k) <== plusSuccRightSucc) in | |
refl | |
-- QED |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is linked as a syntax example from release notes (http://www.idris-lang.org/idris-0-9-9-released/), but has bitrotted. A up-to-date example version of this can be found in the tests: https://github.com/idris-lang/Idris-dev/blob/master/test/proof001/test029.idr