feat(library/data/nat/sub): add two extra theorems

This commit is contained in:
Leonardo de Moura 2015-04-14 06:20:06 -07:00
parent 11c9bb4626
commit c73c1dbb63

View file

@ -148,6 +148,13 @@ calc
... = n * m - k * n : {!mul.comm}
... = n * m - n * k : {!mul.comm}
theorem mul_self_sub_mul_self_eq (a b : nat) : a * a - b * b = (a + b) * (a - b) :=
by rewrite [mul_sub_left_distrib, *mul.right_distrib, mul.comm b a, add.comm (a*a) (a*b), add_sub_add_left]
theorem succ_mul_succ_eq (a : nat) : succ a * succ a = a*a + a + a + 1 :=
calc succ a * succ a = (a+1)*(a+1) : by rewrite [add_one]
... = a*a + a + a + 1 : by rewrite [mul.right_distrib, mul.left_distrib, one_mul, mul_one]
/- interaction with inequalities -/
theorem succ_sub {m n : } : m ≥ n → succ m - n = succ (m - n) :=