src/HOLCF/IOA/meta_theory/Sequence.thy
author aspinall
Fri, 30 Sep 2005 18:18:34 +0200
changeset 17740 fc385ce6187d
parent 17233 41eee2e7b465
child 19551 4103954f3668
permissions -rw-r--r--
Add icon for interface.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
     1
(*  Title:      HOLCF/IOA/meta_theory/Sequence.thy
3275
3f53f2c876f4 changes for release 94-8
mueller
parents: 3071
diff changeset
     2
    ID:         $Id$
12218
wenzelm
parents: 12114
diff changeset
     3
    Author:     Olaf Müller
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
     4
12218
wenzelm
parents: 12114
diff changeset
     5
Sequences over flat domains with lifted elements.
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
     6
*)
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
     7
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
     8
theory Sequence
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
     9
imports Seq
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    10
begin
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    11
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    12
defaultsort type
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    13
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    14
types 'a Seq = "'a::type lift seq"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    15
3952
dca1bce88ec8 replaced ops by consts;
wenzelm
parents: 3275
diff changeset
    16
consts
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    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
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    19
  Filter           ::"('a => bool)  => 'a Seq -> 'a Seq"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    20
  Map              ::"('a => 'b)    => 'a Seq -> 'b Seq"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    21
  Forall           ::"('a => bool)  => 'a Seq => bool"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    22
  Last             ::"'a Seq        -> 'a lift"
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    23
  Dropwhile        ::"('a => bool)  => 'a Seq -> 'a Seq"
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    24
  Takewhile        ::"('a => bool)  => 'a Seq -> 'a Seq"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    25
  Zip              ::"'a Seq        -> 'b Seq -> ('a * 'b) Seq"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    26
  Flat             ::"('a Seq) seq   -> 'a Seq"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    27
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    28
  Filter2          ::"('a => bool)  => 'a Seq -> 'a Seq"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    29
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    30
syntax
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    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
92707e24b62b managed merge details;
mueller
parents: 3952
diff changeset
    33
 (* list Enumeration *)
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    34
  "_totlist"      :: "args => 'a Seq"              ("[(_)!]")
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    35
  "_partlist"     :: "args => 'a Seq"              ("[(_)?]")
4283
92707e24b62b managed merge details;
mueller
parents: 3952
diff changeset
    36
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    37
12114
a8e860c86252 eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents: 12028
diff changeset
    38
syntax (xsymbols)
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    39
  "@Consq"     ::"'a => 'a Seq => 'a Seq"       ("(_\<leadsto>_)"  [66,65] 65)
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    40
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    41
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    42
translations
10835
nipkow
parents: 7229
diff changeset
    43
  "a>>s"         == "Consq a$s"
4283
92707e24b62b managed merge details;
mueller
parents: 3952
diff changeset
    44
  "[x, xs!]"     == "x>>[xs!]"
92707e24b62b managed merge details;
mueller
parents: 3952
diff changeset
    45
  "[x!]"         == "x>>nil"
92707e24b62b managed merge details;
mueller
parents: 3952
diff changeset
    46
  "[x, xs?]"     == "x>>[xs?]"
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    47
  "[x?]"         == "x>>UU"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    48
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    49
defs
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    50
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    51
Consq_def:     "Consq a == LAM s. Def a ## s"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    52
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    53
Filter_def:    "Filter P == sfilter$(flift2 P)"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    54
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    55
Map_def:       "Map f  == smap$(flift2 f)"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    56
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    57
Forall_def:    "Forall P == sforall (flift2 P)"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    58
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    59
Last_def:      "Last == slast"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    60
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    61
Dropwhile_def: "Dropwhile P == sdropwhile$(flift2 P)"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    62
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    63
Takewhile_def: "Takewhile P == stakewhile$(flift2 P)"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    64
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    65
Flat_def:      "Flat == sflat"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    66
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    67
Zip_def:
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    68
  "Zip == (fix$(LAM h t1 t2. case t1 of
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    69
               nil   => nil
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    70
             | x##xs => (case t2 of
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    71
                          nil => UU
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    72
                        | y##ys => (case x of
12028
52aa183c15bb replaced Undef by UU;
wenzelm
parents: 10835
diff changeset
    73
                                      UU  => UU
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    74
                                    | Def a => (case y of
12028
52aa183c15bb replaced Undef by UU;
wenzelm
parents: 10835
diff changeset
    75
                                                  UU => UU
10835
nipkow
parents: 7229
diff changeset
    76
                                                | Def b => Def (a,b)##(h$xs$ys))))))"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    77
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    78
Filter2_def:    "Filter2 P == (fix$(LAM h t. case t of
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    79
            nil => nil
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    80
          | x##xs => (case x of UU => UU | Def y => (if P y
10835
nipkow
parents: 7229
diff changeset
    81
                     then x##(h$xs)
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    82
                     else     h$xs))))"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    83
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    84
axioms  -- {* for test purposes should be deleted FIX !! *}  (* FIXME *)
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    85
  adm_all: "adm f"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    86
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    87
ML {* use_legacy_bindings (the_context ()) *}
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    88
12338
de0f4a63baa5 renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents: 12218
diff changeset
    89
end