| author | huffman |
| Fri, 27 May 2005 00:16:18 +0200 | |
| changeset 16093 | cdcbf5a7f38d |
| parent 14981 | e73f8140af78 |
| child 17233 | 41eee2e7b465 |
| permissions | -rw-r--r-- |
| 3071 | 1 |
(* Title: HOLCF/IOA/meta_theory/Sequence.thy |
| 3275 | 2 |
ID: $Id$ |
| 12218 | 3 |
Author: Olaf Müller |
| 3071 | 4 |
|
| 12218 | 5 |
Sequences over flat domains with lifted elements. |
| 3071 | 6 |
*) |
7 |
||
8 |
Sequence = Seq + |
|
9 |
||
|
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12218
diff
changeset
|
10 |
default type |
| 3071 | 11 |
|
|
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12218
diff
changeset
|
12 |
types 'a Seq = ('a::type lift)seq
|
| 3071 | 13 |
|
| 3952 | 14 |
consts |
| 3071 | 15 |
|
|
7229
6773ba0c36d5
renamed Cons to Consq in order to avoid clash with List.Cons;
wenzelm
parents:
4559
diff
changeset
|
16 |
Consq ::"'a => 'a Seq -> 'a Seq" |
| 3071 | 17 |
Filter ::"('a => bool) => 'a Seq -> 'a Seq"
|
18 |
Map ::"('a => 'b) => 'a Seq -> 'b Seq"
|
|
19 |
Forall ::"('a => bool) => 'a Seq => bool"
|
|
20 |
Last ::"'a Seq -> 'a lift" |
|
21 |
Dropwhile, |
|
22 |
Takewhile ::"('a => bool) => 'a Seq -> 'a Seq"
|
|
23 |
Zip ::"'a Seq -> 'b Seq -> ('a * 'b) Seq"
|
|
24 |
Flat ::"('a Seq) seq -> 'a Seq"
|
|
25 |
||
26 |
Filter2 ::"('a => bool) => 'a Seq -> 'a Seq"
|
|
27 |
||
28 |
syntax |
|
29 |
||
|
7229
6773ba0c36d5
renamed Cons to Consq in order to avoid clash with List.Cons;
wenzelm
parents:
4559
diff
changeset
|
30 |
"@Consq" ::"'a => 'a Seq => 'a Seq" ("(_/>>_)" [66,65] 65)
|
| 4283 | 31 |
(* list Enumeration *) |
32 |
"_totlist" :: args => 'a Seq ("[(_)!]")
|
|
33 |
"_partlist" :: args => 'a Seq ("[(_)?]")
|
|
34 |
||
| 3071 | 35 |
|
|
12114
a8e860c86252
eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents:
12028
diff
changeset
|
36 |
syntax (xsymbols) |
| 3071 | 37 |
|
|
7229
6773ba0c36d5
renamed Cons to Consq in order to avoid clash with List.Cons;
wenzelm
parents:
4559
diff
changeset
|
38 |
"@Consq" ::"'a => 'a Seq => 'a Seq" ("(_\\<leadsto>_)" [66,65] 65)
|
| 4283 | 39 |
|
| 3071 | 40 |
|
41 |
translations |
|
42 |
||
| 10835 | 43 |
"a>>s" == "Consq a$s" |
| 4283 | 44 |
"[x, xs!]" == "x>>[xs!]" |
45 |
"[x!]" == "x>>nil" |
|
46 |
"[x, xs?]" == "x>>[xs?]" |
|
47 |
"[x?]" == "x>>UU" |
|
| 3071 | 48 |
|
49 |
defs |
|
50 |
||
51 |
||
|
7229
6773ba0c36d5
renamed Cons to Consq in order to avoid clash with List.Cons;
wenzelm
parents:
4559
diff
changeset
|
52 |
Consq_def "Consq a == LAM s. Def a ## s" |
| 3071 | 53 |
|
| 10835 | 54 |
Filter_def "Filter P == sfilter$(flift2 P)" |
| 3071 | 55 |
|
| 10835 | 56 |
Map_def "Map f == smap$(flift2 f)" |
| 3071 | 57 |
|
58 |
Forall_def "Forall P == sforall (flift2 P)" |
|
59 |
||
60 |
Last_def "Last == slast" |
|
61 |
||
| 10835 | 62 |
Dropwhile_def "Dropwhile P == sdropwhile$(flift2 P)" |
| 3071 | 63 |
|
| 10835 | 64 |
Takewhile_def "Takewhile P == stakewhile$(flift2 P)" |
| 3071 | 65 |
|
66 |
Flat_def "Flat == sflat" |
|
67 |
||
68 |
Zip_def |
|
| 10835 | 69 |
"Zip == (fix$(LAM h t1 t2. case t1 of |
| 3071 | 70 |
nil => nil |
71 |
| x##xs => (case t2 of |
|
72 |
nil => UU |
|
73 |
| y##ys => (case x of |
|
| 12028 | 74 |
UU => UU |
| 3071 | 75 |
| Def a => (case y of |
| 12028 | 76 |
UU => UU |
| 10835 | 77 |
| Def b => Def (a,b)##(h$xs$ys))))))" |
| 3071 | 78 |
|
| 10835 | 79 |
Filter2_def "Filter2 P == (fix$(LAM h t. case t of |
| 3071 | 80 |
nil => nil |
| 12028 | 81 |
| x##xs => (case x of UU => UU | Def y => (if P y |
| 10835 | 82 |
then x##(h$xs) |
83 |
else h$xs))))" |
|
| 3071 | 84 |
|
85 |
rules |
|
86 |
||
87 |
||
88 |
(* for test purposes should be deleted FIX !! *) |
|
89 |
adm_all "adm f" |
|
90 |
||
|
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12218
diff
changeset
|
91 |
end |