]> matita.cs.unibo.it Git - helm.git/commitdiff
arithmetics for λδ
authorFerruccio Guidi <ferruccio.guidi@unibo.it>
Mon, 28 Dec 2020 18:43:58 +0000 (19:43 +0100)
committerFerruccio Guidi <ferruccio.guidi@unibo.it>
Mon, 28 Dec 2020 18:43:58 +0000 (19:43 +0100)
+ subtraction for non-negative integers
+ web site update
+ apps_2/examples: minor update

25 files changed:
helm/www/lambdadelta/images/bronze-03B4.png
helm/www/lambdadelta/images/bronze-03BB.png
matita/matita/contribs/lambdadelta/apps_2/examples/ex_fpbg_refl.ma
matita/matita/contribs/lambdadelta/ground/arith/nat.txt
matita/matita/contribs/lambdadelta/ground/arith/nat_iter.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_le.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_le_minus.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/arith/nat_le_minus_plus.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/arith/nat_le_plus.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_le_pred.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_lt.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_lt_minus.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/arith/nat_lt_plus.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_lt_pred.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_minus.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/arith/nat_minus_plus.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/arith/nat_plus.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_pred.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_pred_succ.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_succ.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_succ_iter.ma
matita/matita/contribs/lambdadelta/ground/arith/pnat_dis.ma
matita/matita/contribs/lambdadelta/ground/arith/pnat_iter.ma
matita/matita/contribs/lambdadelta/ground/arith/pnat_plus.ma
matita/matita/contribs/lambdadelta/ground/web/ground_src.tbl

index d65392f095c4f0cd434dfb640805ee6d0db1cf78..98b99d5b39ea4b6da214cb6ee72c340980802d8c 100644 (file)
Binary files a/helm/www/lambdadelta/images/bronze-03B4.png and b/helm/www/lambdadelta/images/bronze-03B4.png differ
index 3cf5900001a4aa5db28039ca442cb3001866cfb0..801644b0f97aedb02aae695d377bfa99e4a70056 100644 (file)
Binary files a/helm/www/lambdadelta/images/bronze-03BB.png and b/helm/www/lambdadelta/images/bronze-03BB.png differ
index 0cd18e341195fd3a2d7e1869610c9aaf0119ffab..f95df96fdb76eb7f09e00af12a643a459a7bdb6c 100644 (file)
@@ -12,9 +12,8 @@
 (*                                                                        *)
 (**************************************************************************)
 
-include "basic_2/rt_computation/fpbg_fqus.ma".
 include "basic_2/rt_computation/fpbs_cpxs.ma".
-include "basic_2/rt_computation/fpbg_fpbs.ma".
+include "basic_2/rt_computation/fpbg_fqus.ma".
 
 (* EXAMPLES *****************************************************************)
 
index 7fbb2d7b798271efe48d066fe5819df06b23b9b3..fc8e9e241fdf0538f9560c1336f1a93ebb497f42 100644 (file)
 "cic:/matita/arithmetics/nat/monotonic_pred.con"
 #
 "cic:/matita/arithmetics/nat/S_pred.con"
-
-####################################
-
-"cic:/matita/arithmetics/nat/discr_minus_x_xy.con"
-"cic:/matita/arithmetics/nat/discr_plus_xy_minus_xz.con"
-"cic:/matita/arithmetics/nat/eq_minus_O.con"
+#
+"cic:/matita/arithmetics/nat/minus.con"
+"cic:/matita/arithmetics/nat/minus_n_O.con"
 "cic:/matita/arithmetics/nat/eq_minus_S_pred.con"
+"cic:/matita/arithmetics/nat/minus_O_n.con"
+"cic:/matita/arithmetics/nat/minus_S_S.con"
+"cic:/matita/arithmetics/nat/minus_n_n.con"
+"cic:/matita/arithmetics/nat/minus_Sn_n.con"
+"cic:/matita/arithmetics/nat/minus_minus_comm.con"
+#
+"cic:/matita/arithmetics/nat/minus_plus_m_m.con"
+"cic:/matita/arithmetics/nat/minus_plus.con"
+"cic:/matita/arithmetics/nat/minus_plus_plus_l.con"
+"cic:/matita/arithmetics/nat/plus_minus_plus_plus_l.con"
+"cic:/matita/arithmetics/nat/plus_to_minus.con"
+"cic:/matita/arithmetics/nat/discr_plus_xy_minus_xz.con"
+"cic:/matita/arithmetics/nat/discr_minus_x_xy.con"
+#
+"cic:/matita/arithmetics/nat/minus_le.con"
 "cic:/matita/arithmetics/nat/inv_eq_minus_O.con"
-"cic:/matita/arithmetics/nat/le_minus_to_plus.con"
-"cic:/matita/arithmetics/nat/le_minus_to_plus_r.con"
+"cic:/matita/arithmetics/nat/monotonic_le_minus_l.con"
+"cic:/matita/arithmetics/nat/monotonic_le_minus_r.con"
+"cic:/matita/arithmetics/nat/eq_minus_O.con"
+"cic:/matita/arithmetics/nat/minus_Sn_m.con"
+"cic:/matita/arithmetics/nat/minus_minus_m_m.con"
+#
 "cic:/matita/arithmetics/nat/le_plus_minus_m_m.con"
 "cic:/matita/arithmetics/nat/le_plus_to_minus.con"
 "cic:/matita/arithmetics/nat/le_plus_to_minus_r.con"
-"cic:/matita/arithmetics/nat/lt_minus_to_plus.con"
-"cic:/matita/arithmetics/nat/lt_minus_to_plus_r.con"
-"cic:/matita/arithmetics/nat/lt_plus_to_minus.con"
-"cic:/matita/arithmetics/nat/lt_plus_to_minus_r.con"
-"cic:/matita/arithmetics/nat/minus.con"
-"cic:/matita/arithmetics/nat/minus_le.con"
-"cic:/matita/arithmetics/nat/minus_le_minus_minus_comm.con"
+"cic:/matita/arithmetics/nat/le_inv_plus_l.con"
+"cic:/matita/arithmetics/nat/plus_minus_m_m.con"
+"cic:/matita/arithmetics/nat/le_minus_to_plus.con"
+"cic:/matita/arithmetics/nat/le_minus_to_plus_r.con"
+"cic:/matita/arithmetics/nat/plus_minus.con"
+"cic:/matita/arithmetics/nat/plus_minus_associative.con"
 "cic:/matita/arithmetics/nat/minus_minus_associative.con"
-"cic:/matita/arithmetics/nat/minus_minus_comm.con"
 "cic:/matita/arithmetics/nat/minus_minus.con"
-"cic:/matita/arithmetics/nat/minus_minus_m_m.con"
-"cic:/matita/arithmetics/nat/minus_n_n.con"
-"cic:/matita/arithmetics/nat/minus_n_O.con"
-"cic:/matita/arithmetics/nat/minus_O_n.con"
-"cic:/matita/arithmetics/nat/minus_plus.con"
-"cic:/matita/arithmetics/nat/minus_plus_m_m.con"
-"cic:/matita/arithmetics/nat/minus_plus_plus_l.con"
+"cic:/matita/arithmetics/nat/minus_le_minus_minus_comm.con"
+#
 "cic:/matita/arithmetics/nat/minus_pred_pred.con"
-"cic:/matita/arithmetics/nat/minus_Sn_m.con"
-"cic:/matita/arithmetics/nat/minus_Sn_n.con"
-"cic:/matita/arithmetics/nat/minus_S_S.con"
-"cic:/matita/arithmetics/nat/monotonic_le_minus_l.con"
-"cic:/matita/arithmetics/nat/monotonic_le_minus_r.con"
 "cic:/matita/arithmetics/nat/monotonic_lt_minus_l.con"
-"cic:/matita/arithmetics/nat/plus_minus_associative.con"
-"cic:/matita/arithmetics/nat/plus_minus.con"
-"cic:/matita/arithmetics/nat/plus_minus_m_m.con"
-"cic:/matita/arithmetics/nat/plus_minus_plus_plus_l.con"
-"cic:/matita/arithmetics/nat/plus_to_minus.con"
-"cic:/matita/arithmetics/nat/le_inv_plus_l.con"
+
+"cic:/matita/arithmetics/nat/lt_minus_to_plus.con"
+"cic:/matita/arithmetics/nat/lt_minus_to_plus_r.con"
+"cic:/matita/arithmetics/nat/lt_plus_to_minus.con"
+"cic:/matita/arithmetics/nat/lt_plus_to_minus_r.con"
 "cic:/matita/arithmetics/nat/lt_inv_plus_l.con"
 
+####################################
+
 "cic:/matita/arithmetics/nat/to_max.con"
 "cic:/matita/arithmetics/nat/commutative_max.con"
 "cic:/matita/arithmetics/nat/leb.con"
index 89c464804225a25d65e3d3ac5f00c1ac76dae44c..94875efc1c29013a7722751aea53338ede59c428 100644 (file)
@@ -15,7 +15,7 @@
 include "ground/arith/pnat_iter.ma".
 include "ground/arith/nat.ma".
 
-(* NON-NEGATIVE INTEGERS ****************************************************)
+(* ITERATED FUNCTION FOR NON-NEGATIVE INTEGERS ******************************)
 
 definition niter (n:nat) (A:Type[0]) (f:A→A) (a:A) ≝
 match n with
index 82d285e8ec7bf2bdd310ef18f718ca01192a9781..73c14396423e316aea768fe307e290c4108abb85 100644 (file)
@@ -15,7 +15,7 @@
 include "ground/insert_eq/insert_eq_0.ma".
 include "ground/arith/nat_succ.ma".
 
-(* NON-NEGATIVE INTEGERS ****************************************************)
+(* ORDER FOR NON-NEGATIVE INTEGERS ******************************************)
 
 (*** le *)
 (*** le_ind *)
@@ -75,6 +75,11 @@ lemma nle_inv_zero_dx (m): m ≤ 𝟎 → 𝟎 = m.
 ]
 qed-.
 
+(* Advanced inversions ******************************************************)
+
+lemma nle_inv_succ_zero (m): ↑m ≤ 𝟎 → ⊥.
+/3 width=2 by nle_inv_zero_dx, eq_inv_nzero_succ/ qed-.
+
 lemma nle_inv_succ_sn_refl (m): ↑m ≤ m → ⊥.
 #m @(nat_ind … m) -m [| #m #IH ] #H
 [ /3 width=2 by nle_inv_zero_dx, eq_inv_nzero_succ/
@@ -82,8 +87,6 @@ lemma nle_inv_succ_sn_refl (m): ↑m ≤ m → ⊥.
 ]
 qed-.
 
-(* Order properties *********************************************************)
-
 (*** le_to_le_to_eq *)
 theorem nle_antisym (m) (n): m ≤ n → n ≤ m → m = n.
 #m #n #H elim H -n //
@@ -93,13 +96,25 @@ lapply (IH H) -IH -H #H destruct
 elim (nle_inv_succ_sn_refl … Hn)
 qed-.
 
+(* Advanced eliminations ****************************************************)
+
+lemma nle_ind_alt (Q: relation2 nat nat):
+      (∀n. Q (𝟎) (n)) →
+      (∀m,n. m ≤ n → Q m n → Q (↑m) (↑n)) →
+      ∀m,n. m ≤ n → Q m n.
+#Q #IH1 #IH2 #m #n @(nat_ind_2 … m n) -m -n //
+[ #m #H elim (nle_inv_succ_zero … H)
+| /4 width=1 by nle_inv_succ_bi/
+]
+qed-.
+
+(* Advanced constructions ***************************************************)
+
 (*** transitive_le *)
 theorem nle_trans: Transitive … nle.
 #m #n #H elim H -n /3 width=1 by nle_inv_succ_sn/
 qed-.
 
-(* Advanced constructions ***************************************************)
-
 (*** decidable_le *)
 lemma nle_dec (m) (n): Decidable … (m ≤ n).
 #m #n elim (nle_ge_e m n) [ /2 width=1 by or_introl/ ]
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/nat_le_minus.ma b/matita/matita/contribs/lambdadelta/ground/arith/nat_le_minus.ma
new file mode 100644 (file)
index 0000000..e3da0c9
--- /dev/null
@@ -0,0 +1,64 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||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_minus.ma".
+include "ground/arith/nat_le_pred.ma".
+
+(* ORDER FOR NON-NEGATIVE INTEGERS ******************************************)
+
+(* Constructions with nminus ************************************************)
+
+(*** minus_le *)
+lemma nle_minus_sn_refl_sn (m) (n): m - n ≤ m.
+#m #n elim n -n //
+#n #IH /2 width=3 by nle_trans/
+qed.
+
+(*** inv_eq_minus_O *)
+lemma nle_eq_minus_O (m) (n): 𝟎 = m - n → m ≤ n.
+#m #n @(nat_ind_2 … m n) //
+/3 width=1 by nle_succ_bi/
+qed.
+
+(*** monotonic_le_minus_l *)
+lemma nle_minus_sn_bi (m) (n) (o): m ≤ n → m-o ≤ n-o.
+#m #n #o elim o -o //
+#o #IH #Hmn /3 width=1 by nle_pred_bi/
+qed.
+
+(*** monotonic_le_minus_r *)
+lemma nle_minus_dx_bi (m) (n) (o): m ≤ n → o-n ≤ o-m.
+#m #n #o #H elim H -n //
+#n #_ #IH /2 width=3 by nle_trans/
+qed.
+
+(* Inversions with nminus ***************************************************)
+
+(*** eq_minus_O *)
+lemma nle_inv_eq_minus_O (m) (n): m ≤ n → 𝟎 = m - n.
+#m #n #H elim H -n //
+qed-.
+
+(* Destructions with nminus *************************************************)
+
+(*** minus_Sn_m *)
+lemma nminus_succ_sn (m) (n): m ≤ n → ↑(n-m) = ↑n - m.
+#m #n #H @(nle_ind_alt … H) -m -n //
+qed-.
+
+(*** minus_minus_m_m *)
+lemma nminus_minus_dx_refl_sn (m) (n): m ≤ n → m = n - (n - m).
+#m #n #H elim H -n //
+#n #Hmn #IH <(nminus_succ_sn … Hmn) -Hmn //
+qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/nat_le_minus_plus.ma b/matita/matita/contribs/lambdadelta/ground/arith/nat_le_minus_plus.ma
new file mode 100644 (file)
index 0000000..d569e0c
--- /dev/null
@@ -0,0 +1,109 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||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_minus_plus.ma".
+include "ground/arith/nat_le_plus.ma".
+include "ground/arith/nat_le_minus.ma".
+
+(* ORDER FOR NON-NEGATIVE INTEGERS ******************************************)
+
+(* Constructions with nminus and nplus **************************************)
+
+(*** le_plus_minus_m_m *)
+lemma nle_plus_minus_sn_refl_sn (n) (m): m ≤ m - n + n.
+#n elim n -n //
+#n #IH #m <nminus_succ_dx_pred_sn <nplus_succ_dx
+/2 width=1 by nle_inv_pred_sn/
+qed.
+
+lemma plus_minus_sn_refl_sn_nle (m) (n): n = n - m + m → m ≤ n.
+// qed.
+
+(*** le_plus_to_minus *)
+lemma nle_minus_sn (o) (m) (n): m ≤ n + o → m - o ≤ n.
+/2 width=1 by nle_minus_sn_bi/ qed.
+
+(*** le_plus_to_minus_r *)
+lemma nle_minus_dx (o) (m) (n): m + o ≤ n → m ≤ n - o.
+#o #m #n #H >(nminus_plus_sn_refl_sn m o)
+/2 width=1 by nle_minus_sn_bi/
+qed.
+
+(*** le_inv_plus_l *)
+lemma nle_minus_dx_full (o) (m) (n): m + o ≤ n → ∧∧ m ≤ n - o & o ≤ n.
+/3 width=3 by nle_minus_dx, nle_trans, conj/ qed-.
+
+(* Inversions with nminus and nplus *****************************************)
+
+(*** plus_minus_m_m *)
+lemma nplus_minus_sn_refl_sn (m) (n): m ≤ n → n = n - m + m.
+#m #n #H elim H -n //
+#n #Hn #IH <(nminus_succ_sn … Hn) -Hn
+<nplus_succ_sn //
+qed-.
+
+lemma nplus_minus_dx_refl_sn (m) (n): m ≤ n → n = m + (n - m).
+#m #n <nplus_comm
+/2 width=1 by nplus_minus_sn_refl_sn/
+qed-.
+
+(*** le_minus_to_plus *)
+lemma nle_inv_minus_sn (o) (m) (n): m - o ≤ n → m ≤ n + o.
+/3 width=3 by nle_plus_bi_dx, nle_trans/ qed-.
+
+(*** le_minus_to_plus_r *)
+lemma nle_inv_minus_dx (o) (m) (n): o ≤ n → m ≤ n - o → m + o ≤ n.
+#o #m #n #Hon #Hm
+>(nplus_minus_sn_refl_sn … Hon)
+/2 width=1 by nle_plus_bi_dx/
+qed-.
+
+(* Destructions with nminus and nplus ***************************************)
+
+(*** plus_minus *)
+lemma nminus_plus_comm_23 (o) (m) (n):
+      m ≤ n → n - m + o = n + o - m.
+#o #m #n #H elim H -n //
+#n #Hn #IH <(nminus_succ_sn … Hn)
+<nplus_succ_sn <nplus_succ_sn <nminus_succ_sn //
+/2 width=3 by nle_trans/
+qed-.
+
+(*** plus_minus_associative *)
+lemma nplus_minus_assoc (m1) (m2) (n):
+      n ≤ m2 → m1 + m2 - n = m1 + (m2 - n).
+/2 width=1 by nminus_plus_comm_23/ qed-.
+
+(*** minus_minus_associative *)
+theorem nminus_assoc (m1) (m2) (m3):
+        m3 ≤ m2 → m2 ≤ m1 → m1 - m2 + m3 = m1 - (m2 - m3).
+#m1 #m2 #m3 #Hm32 #Hm21
+@nminus_plus_sn >nplus_assoc
+<nplus_minus_dx_refl_sn //
+/2 width=1 by nplus_minus_sn_refl_sn/
+qed-.
+
+(*** minus_minus *)
+theorem nminus_assoc_comm (m1) (m2) (m3):
+        m3 ≤ m2 → m2 ≤ m1 → m3 + (m1 - m2) = m1 - (m2 - m3).
+#m1 #m2 #m3 #Hm32 #Hm21 <nplus_comm
+/2 width=1 by nminus_assoc/
+qed-.
+
+(*** minus_le_minus_minus_comm *)
+theorem minus_assoc_comm_23 (m1) (m2) (m3):
+        m3 ≤ m2 → m1 + m3 - m2 = m1 - (m2 - m3).
+#m1 #m2 #m3 #Hm
+>(nplus_minus_sn_refl_sn … Hm) in ⊢ (??%?); //
+qed-.
index 513ea525701c2ca2e2c24e219c73ec0854acf202..37a0efbb26fce546a71865277c72153b6c7e893e 100644 (file)
@@ -15,9 +15,9 @@
 include "ground/arith/nat_plus.ma".
 include "ground/arith/nat_le.ma".
 
-(* NON-NEGATIVE INTEGERS ****************************************************)
+(* ORDER FOR NON-NEGATIVE INTEGERS ****************************************************)
 
-(* Basic constructions with plus ********************************************)
+(* Constructions with nplus ***********************************************************)
 
 (*** monotonic_le_plus_l *)
 lemma nle_plus_bi_dx (m) (n1) (n2): n1 ≤ n2 → n1 + m ≤ n2 + m.
@@ -46,14 +46,14 @@ lemma nle_plus_dx_dx (m) (n) (o): n + o ≤ m → n ≤ m.
 lemma nle_plus_dx_sn (m) (n) (o): n ≤ m → n ≤ o + m.
 /2 width=3 by nle_trans/ qed.
 
-(* Main constructions with plus *********************************************)
+(* Main constructions with nplus ********************************************)
 
 (*** le_plus *)
 theorem nle_plus_bi (m1) (m2) (n1) (n2):
         m1 ≤ m2 → n1 ≤ n2 → m1 + n1 ≤ m2 + n2.
 /3 width=3 by nle_plus_bi_dx, nle_plus_bi_sn, nle_trans/ qed.
 
-(* Basic inversions with plus ***********************************************)
+(* Inversions with nplus ****************************************************)
 
 (*** plus_le_0 *)
 lemma nle_inv_plus_zero (m) (n): m + n ≤ 𝟎 → ∧∧ 𝟎 = m & 𝟎 = n.
@@ -67,4 +67,3 @@ qed-.
 (*** le_plus_to_le *)
 lemma nle_inv_plus_bi_sn (o) (m) (n): o + n ≤ o + m → n ≤ m.
 /2 width=2 by nle_inv_plus_bi_dx/ qed-.
-
index f1824e22eb0dcfd5ad2f73702a23f0e098a6bf53..da1de97f5574a6b0d0741850097451eace80609c 100644 (file)
@@ -15,9 +15,9 @@
 include "ground/arith/nat_pred_succ.ma".
 include "ground/arith/nat_le.ma".
 
-(* NON-NEGATIVE INTEGERS ****************************************************)
+(* ORDER FOR NON-NEGATIVE INTEGERS ******************************************)
 
-(* Basic constructions with pred ********************************************)
+(* Constructions with npred *************************************************)
 
 (*** le_pred_n *)
 lemma nle_pred_sn_refl (m): ↓m ≤ m.
@@ -26,6 +26,18 @@ qed.
 
 (*** monotonic_pred *)
 lemma nle_pred_bi (m) (n): m ≤ n → ↓m ≤ ↓n.
-#m #n #H elim H -n
+#m #n #H elim H -n //
 /2 width=3 by nle_trans/
 qed.
+
+lemma nle_pred_sn (m) (n): m ≤ ↑n → ↓m ≤ n.
+#m #n elim m -m //
+/2 width=1 by nle_pred_bi/
+qed-.
+
+(* Destructions with npred **************************************************)
+
+lemma nle_inv_pred_sn (m) (n): ↓m ≤ n → m ≤ ↑n.
+#m #n elim m -m
+/2 width=1 by nle_succ_bi/
+qed-.
index 1df0f857d54d9edc95a70ec09e9cee1e2ddd5298..f7a868b534a17de122ff7aa4f6a4f4b49a667bcd 100644 (file)
@@ -14,7 +14,7 @@
 
 include "ground/arith/nat_le.ma".
 
-(* NON-NEGATIVE INTEGERS ****************************************************)
+(* STRICT ORDER FOR NON-NEGATIVE INTEGERS ***********************************)
 
 (*** lt *)
 definition nlt: relation2 nat nat ≝
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/nat_lt_minus.ma b/matita/matita/contribs/lambdadelta/ground/arith/nat_lt_minus.ma
new file mode 100644 (file)
index 0000000..34a16e0
--- /dev/null
@@ -0,0 +1,37 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||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_le_minus.ma".
+include "ground/arith/nat_lt_pred.ma".
+
+(* STRICT ORDER FOR NON-NEGATIVE INTEGERS ***********************************)
+
+(* Rewrites with nminus *****************************************************)
+
+(*** minus_pred_pred *)
+lemma nminus_pred_bi (m) (n): 𝟎 < m → 𝟎 < n → n - m = ↓n - ↓m.
+#m #n #Hm #Hn
+>(nlt_inv_zero_sn … Hm) in ⊢ (??%?); -Hm
+>(nlt_inv_zero_sn … Hn) in ⊢ (??%?); -Hn
+//
+qed-.
+
+(* Constructions with nminus ************************************************)
+
+(*** monotonic_lt_minus_l *)
+lemma nlt_minus_sn_bi (o) (m) (n): o ≤ m → m < n → m - o < n - o.
+#o #m #n #Hom #Hmn
+lapply (nle_minus_sn_bi … o Hmn) -Hmn
+<(nminus_succ_sn … Hom) //
+qed.
index e9920e928dc2941d58e48f4a359f548d94023296..05776ef200767e8371a9721435b19cd8683ee7ea 100644 (file)
@@ -15,9 +15,9 @@
 include "ground/arith/nat_le_plus.ma".
 include "ground/arith/nat_lt.ma".
 
-(* NON-NEGATIVE INTEGERS ****************************************************)
+(* STRICT ORDER FOR NON-NEGATIVE INTEGERS ***********************************)
 
-(* Basic constructions with plus ********************************************)
+(* Constructions with nplus *************************************************)
 
 (*** monotonic_lt_plus_l *)
 lemma nlt_plus_bi_dx (m) (n1) (n2): n1 < n2 → n1 + m < n2 + m.
@@ -35,7 +35,7 @@ qed.
 lemma lt_plus_Sn_r: ∀a,x,n. a < a + x + ↑n.
 /2 width=1/ qed-.
 
-(* Basic inversions with plus ***********************************************)
+(* Inversions with nplus ****************************************************)
 
 (*** lt_plus_to_lt_l *)
 lemma nlt_inv_plus_bi_dx (m) (n1) (n2): n1 + m < n2 + m → n1 < n2.
index 16e5bb239708419fbef4c0d6b9574325052a221f..2b3502259f796845194b82ee7d94f64ecca9112a 100644 (file)
 include "ground/arith/nat_pred_succ.ma".
 include "ground/arith/nat_lt.ma".
 
-(* NON-NEGATIVE INTEGERS ****************************************************)
+(* STRICT ORDER FOR NON-NEGATIVE INTEGERS ***********************************)
 
-(* Basic constructions with pred ********************************************)
+(* Constructions with npred *************************************************)
 
 lemma nlt_zero_sn (m): m = ↑↓m → 𝟎 < m.
 // qed.
 
-(* Basic inversions with pred ***********************************************)
+(* Inversions with npred ****************************************************)
 
 (*** S_pred *)
 lemma nlt_inv_zero_sn (m): 𝟎 < m → m = ↑↓m.
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-.
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/nat_minus_plus.ma b/matita/matita/contribs/lambdadelta/ground/arith/nat_minus_plus.ma
new file mode 100644 (file)
index 0000000..47e88de
--- /dev/null
@@ -0,0 +1,84 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||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_plus.ma".
+include "ground/arith/nat_minus.ma".
+
+(* SUBTRACTION FOR NON-NEGATIVE INTEGERS ************************************)
+
+(* Rewrites with nplus ******************************************************)
+
+(*** minus_plus_m_m *)
+lemma nminus_plus_sn_refl_sn (m) (n): m = m + n - n.
+#m #n elim n -n //
+#n #IH <nplus_succ_dx <nminus_succ_bi //
+qed.
+
+lemma nminus_plus_sn_refl_dx (m) (n): m = n + m - n.
+#m #n <nplus_comm //
+qed.
+
+(*** minus_plus *)
+theorem nminus_assoc (o) (m) (n): o-m-n = o-(m+n).
+#o #m #n elim n -n //
+#n #IH <nplus_succ_dx <nminus_succ_dx <nminus_succ_dx //
+qed-.
+
+(*** minus_plus_plus_l *)
+lemma nminus_plus_dx_bi (m) (n) (o): m - n = (m + o) - (n + o).
+#m #n #o <nminus_assoc <nminus_minus_comm //
+qed.
+
+(*** plus_minus_plus_plus_l *) (**)
+lemma plus_minus_plus_plus_l: ∀z,x,y,h. z + (x + h) - (y + h) = z + x - y.
+// qed-.
+
+(* Helper constructions with nplus ******************************************)
+
+(*** plus_to_minus *)
+lemma nminus_plus_dx (o) (m) (n): o = m+n → n = o-m.
+#o #m #n #H destruct //
+qed-.
+
+lemma nminus_plus_sn (o) (m) (n): o = m+n → m = o-n.
+#o #m #n #H destruct //
+qed-.
+
+(* Inversions with nplus ****************************************************)
+
+(*** discr_plus_xy_minus_xz *)
+lemma eq_inv_plus_nminus_refl_sn (m) (n) (o):
+      m + o = m - n →
+      ∨∨ ∧∧ 𝟎 = m & 𝟎 = o
+       | ∧∧ 𝟎 = n & 𝟎 = o.
+#m elim m -m
+[ /3 width=1 by or_introl, conj/
+| #m #IH #n @(nat_ind … n) -n
+  [ #o #Ho
+    lapply (eq_inv_nplus_bi_sn … (𝟎) Ho) -Ho
+    /3 width=1 by or_intror, conj/
+  | #n #_ #o
+    <nminus_succ_bi >nplus_succ_shift #Ho
+    elim (IH … Ho) -IH -Ho * #_ #H
+    elim (eq_inv_nzero_succ … H)
+  ]
+]
+qed-.
+
+(*** discr_minus_x_xy *)
+lemma eq_inv_nminus_refl_sn (m) (n): m = m - n → ∨∨ 𝟎 = m | 𝟎 = n.
+#m #n #Hmn
+elim (eq_inv_plus_nminus_refl_sn … (𝟎) Hmn) -Hmn * #H1 #H2
+/2 width=1 by or_introl, or_intror/
+qed-.
index e7702b80d6ca656b5987b6290d1e549b8f3bc1c6..75349d2da6281f130d0e2a0b3ea8930e379267f0 100644 (file)
@@ -14,7 +14,7 @@
 
 include "ground/arith/nat_succ_iter.ma".
 
-(* NON-NEGATIVE INTEGERS ****************************************************)
+(* ADDITION FOR NON-NEGATIVE INTEGERS ***************************************)
 
 (*** plus *)
 definition nplus: nat → nat → nat ≝
@@ -33,7 +33,7 @@ lemma nplus_zero_dx (m): m = m + 𝟎.
 lemma nplus_one_dx (n): ↑n = n + 𝟏.
 // qed.
 
-(* Semigroup properties *****************************************************)
+(* Advanved rewrites (semigroup properties) *********************************)
 
 (*** plus_n_Sm *)
 lemma nplus_succ_dx (m) (n): ↑(m+n) = m + ↑n.
@@ -54,15 +54,20 @@ lemma nplus_comm: commutative … nplus.
 #m @(nat_ind … m) -m //
 qed-.
 
-lemma nplus_one_sn (n): ↑n = 𝟏 + n.
-#n <nplus_comm // qed.
-
 (*** associative_plus *)
 lemma nplus_assoc: associative … nplus.
 #m #n #o @(nat_ind … o) -o //
 #o #IH <nplus_succ_dx <nplus_succ_dx <nplus_succ_dx <IH -IH //
 qed.
 
+(* Advanced constructions ***************************************************)
+
+lemma nplus_one_sn (n): ↑n = 𝟏 + n.
+#n <nplus_comm // qed.
+
+lemma nplus_succ_shift (m) (n): ↑m + n = m + ↑n.
+// qed-.
+
 (*** assoc_plus1 *)
 lemma nplus_plus_comm_12 (o) (m) (n): m + n + o = n + (m + o).
 #o #m #n <nplus_comm in ⊢ (??(?%?)?); // qed.
@@ -88,7 +93,8 @@ qed-.
 (*** injective_plus_r *)
 lemma eq_inv_nplus_bi_sn (o) (m) (n): o + m = o + n → m = n.
 #o #m #n <nplus_comm <nplus_comm in ⊢ (???%→?);
-/2 width=2 by eq_inv_nplus_bi_dx/ qed-.
+/2 width=2 by eq_inv_nplus_bi_dx/
+qed-.
 
 (* Advanced eliminations ****************************************************)
 
index 7c5d8a5ac5b6cf93c890880fafd4d6e28816dc7d..4fcab387d0bd8d5248fef6c98e41d0abc2a78f9e 100644 (file)
@@ -16,7 +16,7 @@ include "ground/notation/functions/downarrow_1.ma".
 include "ground/arith/pnat_dis.ma".
 include "ground/arith/nat.ma".
 
-(* NON-NEGATIVE INTEGERS ****************************************************)
+(* PREDECESSOR FOR NON-NEGATIVE INTEGERS ************************************)
 
 (*** pred *)
 definition npred (m): nat ≝ match m with
index 71e5e921fd48558b7f890ba5b3bdfdddeabafcc2..26f5f9152dc5db2c9cf860c9a2116d4b91b24b44 100644 (file)
@@ -15,9 +15,9 @@
 include "ground/arith/nat_succ.ma".
 include "ground/arith/nat_pred.ma".
 
-(* NON-NEGATIVE INTEGERS ****************************************************)
+(* PREDECESSOR FOR NON-NEGATIVE INTEGERS ************************************)
 
-(* Basic rewrites with succ *************************************************)
+(* Rewrites with nsucc ******************************************************)
 
 (*** pred_Sn *)
 lemma npred_succ (n): n = ↓↑n.
index c93a75d42fc4b9a35b4a93a812633a6291f6f23e..a1532adebd035c9ca1ff67af2105d54cc4226ee7 100644 (file)
@@ -14,7 +14,7 @@
 
 include "ground/arith/nat.ma".
 
-(* NON-NEGATIVE INTEGERS ****************************************************)
+(* SUCCESSOR FOR NON-NEGATIVE INTEGERS **************************************)
 
 definition nsucc: nat → nat ≝ λm. match m with
 [ nzero  ⇒ ninj (𝟏)
@@ -52,7 +52,7 @@ lemma nat_ind_2 (Q:relation2 …):
 #m #IH #n elim n -n /2 width=1 by/
 qed-.
 
-(* Basic inversions *********************************************************)
+(* Basic inversions ***************************************************************)
 
 (*** injective_S *)
 lemma eq_inv_nsucc_bi: injective … nsucc.
index 640e84d6de811ccc7af314610e8414711e8150ca..b3eee20682dded54198b27b5036c1a0d1003f12d 100644 (file)
@@ -15,7 +15,7 @@
 include "ground/arith/nat_iter.ma".
 include "ground/arith/nat_succ.ma".
 
-(* NON-NEGATIVE INTEGERS ****************************************************)
+(* SUCCESSOR FOR NON-NEGATIVE INTEGERS **************************************)
 
 (* Rewrites with niter ******************************************************)
 
index cc226c94a682447f85becfd10a262808414f41d3..8c42f6f281cd8567ee8011f26c414e375a54da31 100644 (file)
@@ -14,7 +14,7 @@
 
 include "ground/arith/pnat.ma".
 
-(* POSITIVE INTEGERS ********************************************************)
+(* DISCRIMINATOR FOR POSITIVE INTEGERS **************************************)
 
 definition pdis (A:Type[0]) (a) (f) (p): A ≝
 match p with
index a749c5339d0a653b3027025b3f957e5e9966b556..9e806cfe2cf5d91612027727dfc57cc79d70405c 100644 (file)
@@ -15,7 +15,7 @@
 include "ground/notation/functions/exp_3.ma".
 include "ground/arith/pnat.ma".
 
-(* POSITIVE INTEGERS ********************************************************)
+(* ITERATED FUNCTION FOR POSITIVE INTEGERS **********************************)
 
 rec definition piter (p:pnat) (A:Type[0]) (f:A→A) (a:A) ≝
 match p with
index eead7943bb2a50d4859b90c3cb6ff2aad0719f63..53d5236f340fa4d455dcb2fa7eda3c904b00f390 100644 (file)
@@ -14,7 +14,7 @@
 
 include "ground/arith/pnat_iter.ma".
 
-(* POSITIVE INTEGERS ********************************************************)
+(* ADDITION FOR POSITIVE INTEGERS *******************************************)
 
 definition pplus: pnat → pnat → pnat ≝
            λp,q. psucc^q p.
@@ -31,7 +31,7 @@ lemma pplus_one_dx (p): ↑p = p + 𝟏.
 lemma pplus_succ_dx (p) (q): ↑(p+q) = p + ↑q.
 // qed.
 
-(* Semigroup properties *****************************************************)
+(* Advanced reweites (semigroup properties) *********************************)
 
 lemma pplus_succ_sn (p) (q): ↑(p+q) = ↑p + q.
 #p #q @(piter_appl … psucc)
index 686fcb84f36c2929a9815dac9b2459358558af44..0cf803bce9e5c4cefe7e7c30b831f69eec11c6c2 100644 (file)
@@ -59,8 +59,9 @@ table {
   class "grass"
   [ { "arithmetics" * } {
       [ { "non-negative integers" * } {
-          [ "nat_lt ( ?&lt;? )" "nat_lt_pred" "nat_lt_plus" * ]
-          [ "nat_le ( ?≤? )" "nat_le_pred" "nat_le_plus" * ]
+          [ "nat_lt ( ?&lt;? )" "nat_lt_pred" "nat_lt_plus" "nat_lt_minus" "nat_lt_minus_plus" * ]
+          [ "nat_le ( ?≤? )" "nat_le_pred" "nat_le_plus" "nat_le_minus" "nat_le_minus_plus" * ]
+          [ "nat_minus ( ?-? )" "nat_minus_plus" * ]
           [ "nat_plus ( ?+? )" * ]
           [ "nat_pred ( ↓? )" "nat_pred_succ" * ]
           [ "nat_succ ( ↑? )" "nat_succ_iter" * ]
@@ -88,6 +89,10 @@ table {
   ]
   class "orange"
   [ { "generated library" * } {
+      [ { "well-founded induction" * } {
+          [ "wf1_ind_nlt" "wf2_ind_nlt" "wf3_ind_nlt.ma" * ]
+        }
+      ]
       [ { "generalization with equality" * } {
           [ "insert_eq" * ]
         }