]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/assembly/string/string.ma
a) update with upstream version
[helm.git] / helm / software / matita / contribs / assembly / string / string.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 (* ********************************************************************** *)
16 (*                                                                        *)
17 (* Sviluppato da:                                                         *)
18 (*   Cosimo Oliboni, oliboni@cs.unibo.it                                  *)
19 (*                                                                        *)
20 (* ********************************************************************** *)
21
22 include "string/ascii_min.ma".
23 include "compiler/utility.ma".
24
25 (* ************************ *)
26 (* MANIPOLAZIONE DI STRINGA *)
27 (* ************************ *)
28
29 (* tipo pubblico *)
30 definition aux_str_type ≝ list ascii_min.
31
32 (* empty string *)
33 definition empty_str ≝ nil ascii_min.
34
35 (* is empty ? *)
36 definition isNull_str ≝
37 λstr:aux_str_type.match str with
38  [ nil ⇒ true | cons _ _ ⇒ false ].
39
40 (* strcmp *)
41 let rec strCmp_str (str,str':aux_str_type) ≝
42  match str with
43   [ nil ⇒ match str' with
44    [ nil ⇒ true | cons _ _ ⇒ false ]
45   | cons h t ⇒ match str' with
46    [ nil ⇒ false
47    | cons h' t' ⇒ match eqAsciiMin h h' with
48     [ true ⇒ strCmp_str t t' | false ⇒ false ]
49   ]].
50
51 (* strcat *)
52 definition strCat_str ≝
53 λstr,str':aux_str_type.str@str'.
54
55 (* strlen *)
56 definition strLen_str ≝ λstr:aux_str_type.len_list ? str.