Skip to content

Instantly share code, notes, and snippets.

@LeifW
Forked from edwinb/plus_comm.idr
Created January 24, 2016 02:48
Show Gist options
  • Save LeifW/4f31fb1eb53fb7822100 to your computer and use it in GitHub Desktop.
Save LeifW/4f31fb1eb53fb7822100 to your computer and use it in GitHub Desktop.
plus commutes
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