| author | haftmann |
| Wed, 23 Apr 2008 19:36:18 +0200 | |
| changeset 26743 | f4cf7d36c63a |
| parent 26729 | 43a72d892594 |
| child 27015 | f8537d69f514 |
| permissions | -rw-r--r-- |
| 15136 | 1 |
theory ToyList |
| 26729 | 2 |
imports Datatype |
| 15136 | 3 |
begin |
| 8751 | 4 |
|
5 |
datatype 'a list = Nil ("[]")
|
|
| 9541 | 6 |
| Cons 'a "'a list" (infixr "#" 65) |
| 8751 | 7 |
|
8 |
consts app :: "'a list => 'a list => 'a list" (infixr "@" 65) |
|
| 9541 | 9 |
rev :: "'a list => 'a list" |
| 8751 | 10 |
|
11 |
primrec |
|
12 |
"[] @ ys = ys" |
|
| 9541 | 13 |
"(x # xs) @ ys = x # (xs @ ys)" |
| 8751 | 14 |
|
15 |
primrec |
|
16 |
"rev [] = []" |
|
| 9541 | 17 |
"rev (x # xs) = (rev xs) @ (x # [])" |