feat(library/data/nat/sub): add calculation facts for sub

This commit is contained in:
Jeremy Avigad 2015-06-27 18:41:57 +10:00
parent 68785b8bed
commit 7c118f40fe

View file

@ -256,6 +256,12 @@ have H2 : k - n + n = m + n, from
... = m + n : !add.comm,
add.cancel_right H2
theorem eq_sub_of_add_eq {a b c : } (H : a + c = b) : a = b - c :=
(sub_eq_of_add_eq (!add.comm ▸ H))⁻¹
theorem sub_eq_of_eq_add {a b c : } (H : a = c + b) : a - b = c :=
sub_eq_of_add_eq (!add.comm ▸ H⁻¹)
theorem sub_le_sub_right {n m : } (H : n ≤ m) (k : ) : n - k ≤ m - k :=
obtain (l : ) (Hl : n + l = m), from le.elim H,
or.elim !le.total