]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/contribs/lambdadelta/ground/arith/nat_minus.ma
arithmetics for λδ
[helm.git] / matita / matita / contribs / lambdadelta / ground / arith / nat_minus.ma
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/nat_minus.ma b/matita/matita/contribs/lambdadelta/ground/arith/nat_minus.ma
new file mode 100644 (file)
index 0000000..8129ad5
--- /dev/null
@@ -0,0 +1,71 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/arith/nat_succ_iter.ma".
+include "ground/arith/nat_pred_succ.ma".
+
+(* SUBTRACTION FOR NON-NEGATIVE INTEGERS ************************************)
+
+(*** minus *)
+definition nminus: nat → nat → nat ≝
+           λm,n. npred^n m.
+
+interpretation
+  "minus (positive integers"
+  'minus m n = (nminus m n).
+
+(* Basic rewrites ***********************************************************)
+
+(*** minus_n_O *)
+lemma nminus_zero_dx (m): m = m - 𝟎.
+// qed.
+
+lemma nminus_pred_sn (m) (n): ↓(m - n) = ↓m - n.
+#m #n @(niter_appl … npred)
+qed.
+
+(*** eq_minus_S_pred *)
+lemma nminus_succ_dx (m) (n): ↓(m - n) = m - ↑n.
+#m #n @(niter_succ … npred)
+qed.
+
+(*** minus_O_n *)
+lemma nminus_zero_sn (n): 𝟎 = 𝟎 - n.
+#n elim n -n //
+qed.
+
+(*** minus_S_S *)
+lemma nminus_succ_bi (m) (n): m - n = ↑m - ↑n.
+#m #n elim n -n //
+qed.
+
+(* Advanced rewrites ********************************************************)
+
+lemma nminus_succ_dx_pred_sn (m) (n): ↓m - n = m - ↑n.
+// qed-.
+
+(*** minus_n_n *)
+lemma nminus_refl (m): 𝟎 = m - m.
+#m elim m -m //
+qed.
+
+(*** minus_Sn_n *)
+lemma nminus_succ_sn_refl (m): ninj (𝟏) = ↑m - m.
+#m elim m -m //
+qed.
+
+(*** minus_minus_comm *)
+lemma nminus_minus_comm (o) (m) (n): o - m - n = o - n - m.
+#o #m #n elim n -n //
+qed-.