]> matita.cs.unibo.it Git - helm.git/commitdiff
update in basic_2
authorFerruccio Guidi <ferruccio.guidi@unibo.it>
Sat, 5 May 2018 10:20:33 +0000 (12:20 +0200)
committerFerruccio Guidi <ferruccio.guidi@unibo.it>
Sat, 5 May 2018 10:20:33 +0000 (12:20 +0200)
+ list length is now in a separate file

matita/matita/contribs/lambdadelta/ground_2/lib/list.ma
matita/matita/contribs/lambdadelta/ground_2/lib/list_length.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground_2/web/ground_2_src.tbl

index 0ea6ae2856d4f3c128a59af277b3674002280315..07e13ea8f8fb361746b45b600cd02e5c0291f556 100644 (file)
@@ -14,7 +14,7 @@
 
 include "ground_2/notation/constructors/circledE_1.ma".
 include "ground_2/notation/constructors/oplusright_3.ma".
-include "ground_2/lib/arith.ma".
+include "ground_2/lib/relations.ma".
 
 (* LISTS ********************************************************************)
 
@@ -26,43 +26,8 @@ interpretation "nil (list)" 'CircledE A = (nil A).
 
 interpretation "cons (list)" 'OPlusRight A hd tl = (cons A hd tl).
 
-rec definition length A (l:list A) on l ≝ match l with
-[ nil      ⇒ 0
-| cons _ l ⇒ ↑(length A l)
-].
-
-interpretation "length (list)"
-   'card l = (length ? l).
-
 rec definition all A (R:predicate A) (l:list A) on l ≝
   match l with
   [ nil        ⇒ ⊤
-  | cons hd tl ⇒ R hd ∧ all A R tl
+  | cons hd tl ⇒ ∧∧ R hd & all A R tl
   ].
-
-(* Basic properties on length ***********************************************)
-
-lemma length_nil (A:Type[0]): |nil A| = 0.
-// qed.
-
-lemma length_cons (A:Type[0]) (l:list A) (a:A): |a⨮l| = ↑|l|.
-// qed.
-
-(* Basic inversion lemmas on length *****************************************)
-
-lemma length_inv_zero_dx (A:Type[0]) (l:list A): |l| = 0 → l = Ⓔ.
-#A * // #a #l >length_cons #H destruct
-qed-.
-
-lemma length_inv_zero_sn (A:Type[0]) (l:list A): 0 = |l| → l = Ⓔ.
-/2 width=1 by length_inv_zero_dx/ qed-.
-
-lemma length_inv_succ_dx (A:Type[0]) (l:list A) (x): |l| = ↑x →
-                         ∃∃tl,a. x = |tl| & l = a ⨮ tl.
-#A * /2 width=4 by ex2_2_intro/
->length_nil #x #H destruct
-qed-.
-
-lemma length_inv_succ_sn (A:Type[0]) (l:list A) (x): ↑x = |l| →
-                         ∃∃tl,a. x = |tl| & l = a ⨮ tl.
-/2 width=1 by length_inv_succ_dx/ qed.
diff --git a/matita/matita/contribs/lambdadelta/ground_2/lib/list_length.ma b/matita/matita/contribs/lambdadelta/ground_2/lib/list_length.ma
new file mode 100644 (file)
index 0000000..64aaac3
--- /dev/null
@@ -0,0 +1,53 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||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/lib/arith.ma".
+include "ground_2/lib/list.ma".
+
+(* LENGTH OF A LIST *********************************************************)
+
+rec definition length A (l:list A) on l ≝ match l with
+[ nil      ⇒ 0
+| cons _ l ⇒ ↑(length A l)
+].
+
+interpretation "length (list)"
+   'card l = (length ? l).
+
+(* Basic properties *********************************************************)
+
+lemma length_nil (A:Type[0]): |nil A| = 0.
+// qed.
+
+lemma length_cons (A:Type[0]) (l:list A) (a:A): |a⨮l| = ↑|l|.
+// qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma length_inv_zero_dx (A:Type[0]) (l:list A): |l| = 0 → l = Ⓔ.
+#A * // #a #l >length_cons #H destruct
+qed-.
+
+lemma length_inv_zero_sn (A:Type[0]) (l:list A): 0 = |l| → l = Ⓔ.
+/2 width=1 by length_inv_zero_dx/ qed-.
+
+lemma length_inv_succ_dx (A:Type[0]) (l:list A) (x): |l| = ↑x →
+                         ∃∃tl,a. x = |tl| & l = a ⨮ tl.
+#A * /2 width=4 by ex2_2_intro/
+>length_nil #x #H destruct
+qed-.
+
+lemma length_inv_succ_sn (A:Type[0]) (l:list A) (x): ↑x = |l| →
+                         ∃∃tl,a. x = |tl| & l = a ⨮ tl.
+/2 width=1 by length_inv_succ_dx/ qed.
index 4fc221673cbd4c257175d96a1117615ed5e5845b..5d0f40bd8d62304fc2b2a76b18412c8da93c77ab 100644 (file)
@@ -53,7 +53,7 @@ table {
    [ { "extensions to the library" * } {
         [ { "" * } {
              [ "stream ( ? ⨮{?} ? )" "stream_eq ( ? ≗{?} ? )" "stream_hdtl ( ⫰{?}? )" "stream_tls ( ⫰*{?}[?]? )" * ]
-             [ "list ( Ⓔ{?} ) ( ? ⨮{?} ? ) ( |?| )" * ]
+             [ "list ( Ⓔ{?} ) ( ? ⨮{?} ? )" "list_length ( |?| )" * ]
              [ "bool ( Ⓕ ) ( Ⓣ )" "arith ( ?^? ) ( ↑? ) ( ↓? ) ( ? ∨ ? ) ( ? ∧ ? )" * ]
              [ "logic ( ⊥ ) ( ⊤ )" "relations ( ? ⊆ ? )" "functions" "exteq ( ? ≐{?,?} ? )" "star" "ltc" * ]
           }