doc-src/TutorialI/ToyList2/ToyList1
author nipkow
Mon, 16 Aug 2004 19:47:01 +0200
changeset 15136 1275417e3930
parent 9541 d17c0b34d5c8
child 15141 a95c2ff210ba
permissions -rw-r--r--
Adapted text to new theory header syntax.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15136
1275417e3930 Adapted text to new theory header syntax.
nipkow
parents: 9541
diff changeset
     1
theory ToyList
1275417e3930 Adapted text to new theory header syntax.
nipkow
parents: 9541
diff changeset
     2
import PreList
1275417e3930 Adapted text to new theory header syntax.
nipkow
parents: 9541
diff changeset
     3
begin
8751
9ed0548177fb *** empty log message ***
nipkow
parents:
diff changeset
     4
9ed0548177fb *** empty log message ***
nipkow
parents:
diff changeset
     5
datatype 'a list = Nil                          ("[]")
9541
d17c0b34d5c8 *** empty log message ***
nipkow
parents: 8846
diff changeset
     6
                 | Cons 'a "'a list"            (infixr "#" 65)
8751
9ed0548177fb *** empty log message ***
nipkow
parents:
diff changeset
     7
9ed0548177fb *** empty log message ***
nipkow
parents:
diff changeset
     8
consts app :: "'a list => 'a list => 'a list"   (infixr "@" 65)
9541
d17c0b34d5c8 *** empty log message ***
nipkow
parents: 8846
diff changeset
     9
       rev :: "'a list => 'a list"
8751
9ed0548177fb *** empty log message ***
nipkow
parents:
diff changeset
    10
9ed0548177fb *** empty log message ***
nipkow
parents:
diff changeset
    11
primrec
9ed0548177fb *** empty log message ***
nipkow
parents:
diff changeset
    12
"[] @ ys       = ys"
9541
d17c0b34d5c8 *** empty log message ***
nipkow
parents: 8846
diff changeset
    13
"(x # xs) @ ys = x # (xs @ ys)"
8751
9ed0548177fb *** empty log message ***
nipkow
parents:
diff changeset
    14
9ed0548177fb *** empty log message ***
nipkow
parents:
diff changeset
    15
primrec
9ed0548177fb *** empty log message ***
nipkow
parents:
diff changeset
    16
"rev []        = []"
9541
d17c0b34d5c8 *** empty log message ***
nipkow
parents: 8846
diff changeset
    17
"rev (x # xs)  = (rev xs) @ (x # [])"