author | aspinall |
Fri, 30 Sep 2005 18:18:34 +0200 | |
changeset 17740 | fc385ce6187d |
parent 17233 | 41eee2e7b465 |
child 19551 | 4103954f3668 |
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. |
17233 | 6 |
*) |
3071 | 7 |
|
17233 | 8 |
theory Sequence |
9 |
imports Seq |
|
10 |
begin |
|
3071 | 11 |
|
17233 | 12 |
defaultsort type |
13 |
||
14 |
types 'a Seq = "'a::type lift seq" |
|
3071 | 15 |
|
3952 | 16 |
consts |
3071 | 17 |
|
7229
6773ba0c36d5
renamed Cons to Consq in order to avoid clash with List.Cons;
wenzelm
parents:
4559
diff
changeset
|
18 |
Consq ::"'a => 'a Seq -> 'a Seq" |
3071 | 19 |
Filter ::"('a => bool) => 'a Seq -> 'a Seq" |
20 |
Map ::"('a => 'b) => 'a Seq -> 'b Seq" |
|
21 |
Forall ::"('a => bool) => 'a Seq => bool" |
|
22 |
Last ::"'a Seq -> 'a lift" |
|
17233 | 23 |
Dropwhile ::"('a => bool) => 'a Seq -> 'a Seq" |
24 |
Takewhile ::"('a => bool) => 'a Seq -> 'a Seq" |
|
3071 | 25 |
Zip ::"'a Seq -> 'b Seq -> ('a * 'b) Seq" |
26 |
Flat ::"('a Seq) seq -> 'a Seq" |
|
27 |
||
28 |
Filter2 ::"('a => bool) => 'a Seq -> 'a Seq" |
|
29 |
||
30 |
syntax |
|
31 |
||
7229
6773ba0c36d5
renamed Cons to Consq in order to avoid clash with List.Cons;
wenzelm
parents:
4559
diff
changeset
|
32 |
"@Consq" ::"'a => 'a Seq => 'a Seq" ("(_/>>_)" [66,65] 65) |
4283 | 33 |
(* list Enumeration *) |
17233 | 34 |
"_totlist" :: "args => 'a Seq" ("[(_)!]") |
35 |
"_partlist" :: "args => 'a Seq" ("[(_)?]") |
|
4283 | 36 |
|
3071 | 37 |
|
12114
a8e860c86252
eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents:
12028
diff
changeset
|
38 |
syntax (xsymbols) |
17233 | 39 |
"@Consq" ::"'a => 'a Seq => 'a Seq" ("(_\<leadsto>_)" [66,65] 65) |
3071 | 40 |
|
41 |
||
42 |
translations |
|
10835 | 43 |
"a>>s" == "Consq a$s" |
4283 | 44 |
"[x, xs!]" == "x>>[xs!]" |
45 |
"[x!]" == "x>>nil" |
|
46 |
"[x, xs?]" == "x>>[xs?]" |
|
17233 | 47 |
"[x?]" == "x>>UU" |
3071 | 48 |
|
49 |
defs |
|
50 |
||
17233 | 51 |
Consq_def: "Consq a == LAM s. Def a ## s" |
3071 | 52 |
|
17233 | 53 |
Filter_def: "Filter P == sfilter$(flift2 P)" |
3071 | 54 |
|
17233 | 55 |
Map_def: "Map f == smap$(flift2 f)" |
3071 | 56 |
|
17233 | 57 |
Forall_def: "Forall P == sforall (flift2 P)" |
3071 | 58 |
|
17233 | 59 |
Last_def: "Last == slast" |
3071 | 60 |
|
17233 | 61 |
Dropwhile_def: "Dropwhile P == sdropwhile$(flift2 P)" |
3071 | 62 |
|
17233 | 63 |
Takewhile_def: "Takewhile P == stakewhile$(flift2 P)" |
3071 | 64 |
|
17233 | 65 |
Flat_def: "Flat == sflat" |
3071 | 66 |
|
17233 | 67 |
Zip_def: |
68 |
"Zip == (fix$(LAM h t1 t2. case t1 of |
|
3071 | 69 |
nil => nil |
17233 | 70 |
| x##xs => (case t2 of |
71 |
nil => UU |
|
72 |
| y##ys => (case x of |
|
12028 | 73 |
UU => UU |
17233 | 74 |
| Def a => (case y of |
12028 | 75 |
UU => UU |
10835 | 76 |
| Def b => Def (a,b)##(h$xs$ys))))))" |
3071 | 77 |
|
17233 | 78 |
Filter2_def: "Filter2 P == (fix$(LAM h t. case t of |
3071 | 79 |
nil => nil |
17233 | 80 |
| x##xs => (case x of UU => UU | Def y => (if P y |
10835 | 81 |
then x##(h$xs) |
17233 | 82 |
else h$xs))))" |
3071 | 83 |
|
17233 | 84 |
axioms -- {* for test purposes should be deleted FIX !! *} (* FIXME *) |
85 |
adm_all: "adm f" |
|
3071 | 86 |
|
17233 | 87 |
ML {* use_legacy_bindings (the_context ()) *} |
3071 | 88 |
|
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12218
diff
changeset
|
89 |
end |