1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "ground/arith/nat_succ_iter.ma".
16 include "ground/arith/nat_pred_succ.ma".
18 (* SUBTRACTION FOR NON-NEGATIVE INTEGERS ************************************)
21 definition nminus: nat → nat → nat ≝
25 "minus (non-negative integers)"
26 'minus m n = (nminus m n).
28 (* Basic constructions ******************************************************)
31 lemma nminus_zero_dx (m): m = m - 𝟎.
35 lemma nminus_unit_dx (m): ↓m = m - 𝟏 .
38 (*** eq_minus_S_pred *)
39 lemma nminus_succ_dx (m) (n): ↓(m - n) = m - ↑n.
40 #m #n @(niter_succ … npred)
43 (* Advanced constructions ***************************************************)
45 lemma nminus_pred_sn (m) (n): ↓(m - n) = ↓m - n.
46 #m #n @(niter_appl … npred)
50 lemma nminus_zero_sn (n): 𝟎 = 𝟎 - n.
51 #n @(nat_ind_succ … n) -n //
55 lemma nminus_succ_bi (m) (n): m - n = ↑m - ↑n.
56 #m #n @(nat_ind_succ … n) -n //
59 lemma nminus_succ_dx_pred_sn (m) (n): ↓m - n = m - ↑n.
63 lemma nminus_refl (m): 𝟎 = m - m.
64 #m @(nat_ind_succ … m) -m //
68 lemma nminus_succ_sn_refl (m): ninj (𝟏) = ↑m - m.
69 #m @(nat_ind_succ … m) -m //
72 (*** minus_minus_comm *)
73 lemma nminus_comm_21 (m) (n1) (n2): m - n1 - n2 = m - n2 - n1.
74 #m #n1 #n2 @(nat_ind_succ … n2) -n2 //
77 (*** minus_minus_comm3 *)
78 lemma nminus_comm_231 (m) (n1) (n2) (n3):
79 m-n1-n2-n3 = m-n2-n3-n1.