]> matita.cs.unibo.it Git - helm.git/commitdiff
addition for natural numbers with infinity
authorFerruccio Guidi <ferruccio.guidi@unibo.it>
Fri, 29 Nov 2013 16:33:57 +0000 (16:33 +0000)
committerFerruccio Guidi <ferruccio.guidi@unibo.it>
Fri, 29 Nov 2013 16:33:57 +0000 (16:33 +0000)
matita/matita/contribs/lambdadelta/ground_2/lib/arith.ma
matita/matita/contribs/lambdadelta/ground_2/web/ground_2_src.tbl
matita/matita/contribs/lambdadelta/ground_2/ynat/ynat_plus.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground_2/ynat/ynat_succ.ma

index 732c1b64ca426f9c15c80f2375cd0efb293873ec..0cbcff85e6ce1daec44d6f56fe0f3b32ed52a322 100644 (file)
@@ -134,6 +134,10 @@ lemma iter_n_Sm: ∀B:Type[0]. ∀f:B→B. ∀b,l. f^l (f b) = f (f^l b).
 #B #f #b #l elim l -l normalize //
 qed.
 
+lemma iter_plus: ∀B:Type[0]. ∀f:B→B. ∀b,l1,l2. f^(l1+l2) b = f^l1 (f^l2 b).
+#B #f #b #l1 elim l1 -l1 normalize //
+qed.
+
 (* Trichotomy operator ******************************************************)
 
 (* Note: this is "if eqb n1 n2 then a2 else if leb n1 n2 then a1 else a3" *)
index 8bc1e8538b38992b56fa42f75b8bcde81b53181d..827a8fcf809e72d51393c1dfa853962f46ed60c3 100644 (file)
@@ -8,7 +8,7 @@ table {
    ]
    class "yellow"
    [ { "natural numbers with infinity" * } {
-        [ "ynat ( ∞ )" "ynat_pred ( ⫰? )" "ynat_succ ( ⫯? )" "ynat_le ( ?≤? )" "ynat_lt ( ?&lt;? )" * ]
+        [ "ynat ( ∞ )" "ynat_pred ( ⫰? )" "ynat_succ ( ⫯? )" "ynat_le ( ?≤? )" "ynat_lt ( ?&lt;? )" "ynat_plus ( ? + ? )" * ]
      }
    ]
    class "orange"
diff --git a/matita/matita/contribs/lambdadelta/ground_2/ynat/ynat_plus.ma b/matita/matita/contribs/lambdadelta/ground_2/ynat/ynat_plus.ma
new file mode 100644 (file)
index 0000000..8f34873
--- /dev/null
@@ -0,0 +1,57 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||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_2/ynat/ynat_lt.ma".
+
+(* NATURAL NUMBERS WITH INFINITY ********************************************)
+
+(* addition *)
+definition yplus: ynat → ynat → ynat ≝ λx,y. match x with
+[ yinj m ⇒ ysucc^m y
+| Y      ⇒ Y
+].
+
+interpretation "ynat plus" 'plus x y = (yplus x y).
+
+(* Properties on successor **************************************************)
+
+lemma yplus_succ1: ∀m,n. (⫯m) + n = ⫯(m + n).
+* //
+qed.
+
+lemma yplus_SO1: ∀m. 1 + m = ⫯m.
+* //
+qed. 
+
+(* Basic properties *********************************************************)
+
+lemma yplus_inj: ∀m,n. yinj m + yinj n = yinj (m + n).
+#m elim m -m //
+#m #IHm #n >(yplus_succ1 m) >IHm -IHm //
+qed.
+
+lemma yplus_Y2: ∀m. (m + ∞) = ∞.
+* normalize //
+qed.
+
+lemma yplus_comm: commutative … yplus.
+* [ #m ] * [1,3: #n ] //
+normalize >ysucc_iter_Y //
+qed.
+
+lemma yplus_assoc: associative … yplus.
+* // #x * //
+#y #z >yplus_inj whd in ⊢ (??%%); >iter_plus //
+qed.
+
index c244b9caed637c9567846f7515f054511f3a57f4..a8d1946bea235170f6405cdcc962f660c1e789ae 100644 (file)
@@ -38,6 +38,11 @@ lemma ynat_cases: ∀n:ynat. n = 0 ∨ ∃m. n = ⫯m.
 ]
 qed-.
 
+lemma ysucc_iter_Y: ∀m. ysucc^m (∞) = ∞.
+#m elim m -m //
+#m #IHm whd in ⊢ (??%?); >IHm //
+qed.
+
 (* Inversion lemmas *********************************************************)
 
 lemma ysucc_inj: ∀m,n. ⫯m = ⫯n → m = n.