src/HOLCF/IOA/meta_theory/Seq.thy
author wenzelm
Tue, 19 Sep 2006 23:12:21 +0200
changeset 20619 02e9b54b18fd
parent 19804 d0318ae1141c
child 22808 a7daa74e2980
permissions -rw-r--r--
tuned;
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/Seq.thy
3275
3f53f2c876f4 changes for release 94-8
mueller
parents: 3071
diff changeset
     2
    ID:         $Id$
12218
wenzelm
parents: 10835
diff changeset
     3
    Author:     Olaf Müller
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
     4
*)
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
     5
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
     6
header {* Partial, Finite and Infinite Sequences (lazy lists), modeled as domain *}
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 Seq
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
     9
imports HOLCF
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
domain 'a seq = nil | "##" (HD :: 'a) (lazy TL :: "'a seq")  (infixr 65)
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    13
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    14
consts
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    15
   sfilter       :: "('a -> tr) -> 'a seq -> 'a seq"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    16
   smap          :: "('a -> 'b) -> 'a seq -> 'b seq"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    17
   sforall       :: "('a -> tr) => 'a seq => bool"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    18
   sforall2      :: "('a -> tr) -> 'a seq -> tr"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    19
   slast         :: "'a seq     -> 'a"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    20
   sconc         :: "'a seq     -> 'a seq -> 'a seq"
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    21
   sdropwhile    ::"('a -> tr)  -> 'a seq -> 'a seq"
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    22
   stakewhile    ::"('a -> tr)  -> 'a seq -> 'a seq"
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    23
   szip          ::"'a seq      -> 'b seq -> ('a*'b) seq"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    24
   sflat        :: "('a seq) seq  -> 'a seq"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    25
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    26
   sfinite       :: "'a seq set"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    27
   Partial       ::"'a seq => bool"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    28
   Infinite      ::"'a seq => bool"
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
   nproj        :: "nat => 'a seq => 'a"
4282
d30fbe129683 resolved merge conflict;
mueller
parents: 4122
diff changeset
    31
   sproj        :: "nat => 'a seq => 'a seq"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    32
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    33
syntax
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    34
   "@@"         :: "'a seq => 'a seq => 'a seq" (infixr 65)
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    35
   "Finite"     :: "'a seq => bool"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    36
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    37
translations
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    38
   "xs @@ ys" == "sconc $ xs $ ys"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    39
   "Finite x" == "x:sfinite"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    40
   "~(Finite x)" =="x~:sfinite"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    41
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    42
defs
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    43
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    44
(* f not possible at lhs, as "pattern matching" only for % x arguments,
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    45
   f cannot be written at rhs in front, as fix_eq3 does not apply later *)
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    46
smap_def:
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    47
  "smap == (fix$(LAM h f tr. case tr of
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    48
      nil   => nil
10835
nipkow
parents: 5976
diff changeset
    49
    | x##xs => f$x ## h$f$xs))"
3071
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
sfilter_def:
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    52
  "sfilter == (fix$(LAM h P t. case t of
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    53
           nil => nil
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    54
         | x##xs => If P$x
10835
nipkow
parents: 5976
diff changeset
    55
                    then x##(h$P$xs)
nipkow
parents: 5976
diff changeset
    56
                    else     h$P$xs
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    57
                    fi))"
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    58
sforall_def:
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    59
  "sforall P t == (sforall2$P$t ~=FF)"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    60
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    61
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    62
sforall2_def:
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    63
  "sforall2 == (fix$(LAM h P t. case t of
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    64
           nil => TT
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    65
         | x##xs => P$x andalso h$P$xs))"
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    66
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    67
sconc_def:
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    68
  "sconc == (fix$(LAM h t1 t2. case t1 of
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    69
               nil       => t2
10835
nipkow
parents: 5976
diff changeset
    70
             | x##xs => x##(h$xs$t2)))"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    71
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    72
slast_def:
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    73
  "slast == (fix$(LAM h t. case t of
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    74
           nil => UU
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    75
         | x##xs => (If is_nil$xs
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    76
                          then x
10835
nipkow
parents: 5976
diff changeset
    77
                         else h$xs fi)))"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    78
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    79
stakewhile_def:
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    80
  "stakewhile == (fix$(LAM h P t. case t of
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    81
           nil => nil
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    82
         | x##xs => If P$x
10835
nipkow
parents: 5976
diff changeset
    83
                    then x##(h$P$xs)
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    84
                    else nil
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    85
                    fi))"
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    86
sdropwhile_def:
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    87
  "sdropwhile == (fix$(LAM h P t. case t of
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    88
           nil => nil
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    89
         | x##xs => If P$x
10835
nipkow
parents: 5976
diff changeset
    90
                    then h$P$xs
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    91
                    else t
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    92
                    fi))"
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    93
sflat_def:
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    94
  "sflat == (fix$(LAM h t. case t of
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    95
           nil => nil
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    96
         | x##xs => x @@ (h$xs)))"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    97
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    98
szip_def:
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    99
  "szip == (fix$(LAM h t1 t2. case t1 of
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
   100
               nil   => nil
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
   101
             | x##xs => (case t2 of
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
   102
                          nil => UU
10835
nipkow
parents: 5976
diff changeset
   103
                        | y##ys => <x,y>##(h$xs$ys))))"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
   104
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
   105
Partial_def:
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
   106
  "Partial x  == (seq_finite x) & ~(Finite x)"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
   107
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
   108
Infinite_def:
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
   109
  "Infinite x == ~(seq_finite x)"
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
   110
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
   111
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
   112
inductive "sfinite"
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
   113
   intros
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
   114
    sfinite_0:  "nil:sfinite"
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
   115
    sfinite_n:  "[|tr:sfinite;a~=UU|] ==> (a##tr) : sfinite"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
   116
19550
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   117
declare sfinite.intros [simp]
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   118
declare seq.rews [simp]
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   119
19804
wenzelm
parents: 19550
diff changeset
   120
19550
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   121
subsection {* recursive equations of operators *}
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   122
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   123
subsubsection {* smap *}
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   124
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   125
lemma smap_unfold:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   126
  "smap = (LAM f tr. case tr of nil  => nil | x##xs => f$x ## smap$f$xs)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   127
by (subst fix_eq2 [OF smap_def], simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   128
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   129
lemma smap_nil [simp]: "smap$f$nil=nil"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   130
by (subst smap_unfold, simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   131
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   132
lemma smap_UU [simp]: "smap$f$UU=UU"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   133
by (subst smap_unfold, simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   134
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   135
lemma smap_cons [simp]: "[|x~=UU|] ==> smap$f$(x##xs)= (f$x)##smap$f$xs"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   136
apply (rule trans)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   137
apply (subst smap_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   138
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   139
apply (rule refl)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   140
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   141
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   142
subsubsection {* sfilter *}
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   143
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   144
lemma sfilter_unfold:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   145
  "sfilter = (LAM P tr. case tr of
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   146
           nil   => nil
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   147
         | x##xs => If P$x then x##(sfilter$P$xs) else sfilter$P$xs fi)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   148
by (subst fix_eq2 [OF sfilter_def], simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   149
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   150
lemma sfilter_nil [simp]: "sfilter$P$nil=nil"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   151
by (subst sfilter_unfold, simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   152
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   153
lemma sfilter_UU [simp]: "sfilter$P$UU=UU"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   154
by (subst sfilter_unfold, simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   155
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   156
lemma sfilter_cons [simp]:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   157
"x~=UU ==> sfilter$P$(x##xs)=
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   158
              (If P$x then x##(sfilter$P$xs) else sfilter$P$xs fi)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   159
apply (rule trans)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   160
apply (subst sfilter_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   161
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   162
apply (rule refl)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   163
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   164
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   165
subsubsection {* sforall2 *}
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   166
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   167
lemma sforall2_unfold:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   168
   "sforall2 = (LAM P tr. case tr of
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   169
                           nil   => TT
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   170
                         | x##xs => (P$x andalso sforall2$P$xs))"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   171
by (subst fix_eq2 [OF sforall2_def], simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   172
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   173
lemma sforall2_nil [simp]: "sforall2$P$nil=TT"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   174
by (subst sforall2_unfold, simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   175
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   176
lemma sforall2_UU [simp]: "sforall2$P$UU=UU"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   177
by (subst sforall2_unfold, simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   178
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   179
lemma sforall2_cons [simp]:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   180
"x~=UU ==> sforall2$P$(x##xs)= ((P$x) andalso sforall2$P$xs)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   181
apply (rule trans)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   182
apply (subst sforall2_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   183
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   184
apply (rule refl)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   185
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   186
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   187
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   188
subsubsection {* stakewhile *}
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   189
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   190
lemma stakewhile_unfold:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   191
  "stakewhile = (LAM P tr. case tr of
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   192
     nil   => nil
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   193
   | x##xs => (If P$x then x##(stakewhile$P$xs) else nil fi))"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   194
by (subst fix_eq2 [OF stakewhile_def], simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   195
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   196
lemma stakewhile_nil [simp]: "stakewhile$P$nil=nil"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   197
apply (subst stakewhile_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   198
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   199
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   200
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   201
lemma stakewhile_UU [simp]: "stakewhile$P$UU=UU"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   202
apply (subst stakewhile_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   203
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   204
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   205
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   206
lemma stakewhile_cons [simp]:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   207
"x~=UU ==> stakewhile$P$(x##xs) =
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   208
              (If P$x then x##(stakewhile$P$xs) else nil fi)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   209
apply (rule trans)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   210
apply (subst stakewhile_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   211
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   212
apply (rule refl)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   213
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   214
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   215
subsubsection {* sdropwhile *}
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   216
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   217
lemma sdropwhile_unfold:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   218
   "sdropwhile = (LAM P tr. case tr of
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   219
                           nil   => nil
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   220
                         | x##xs => (If P$x then sdropwhile$P$xs else tr fi))"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   221
by (subst fix_eq2 [OF sdropwhile_def], simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   222
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   223
lemma sdropwhile_nil [simp]: "sdropwhile$P$nil=nil"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   224
apply (subst sdropwhile_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   225
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   226
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   227
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   228
lemma sdropwhile_UU [simp]: "sdropwhile$P$UU=UU"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   229
apply (subst sdropwhile_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   230
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   231
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   232
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   233
lemma sdropwhile_cons [simp]:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   234
"x~=UU ==> sdropwhile$P$(x##xs) =
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   235
              (If P$x then sdropwhile$P$xs else x##xs fi)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   236
apply (rule trans)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   237
apply (subst sdropwhile_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   238
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   239
apply (rule refl)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   240
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   241
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   242
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   243
subsubsection {* slast *}
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   244
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   245
lemma slast_unfold:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   246
   "slast = (LAM tr. case tr of
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   247
                           nil   => UU
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   248
                         | x##xs => (If is_nil$xs then x else slast$xs fi))"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   249
by (subst fix_eq2 [OF slast_def], simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   250
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   251
lemma slast_nil [simp]: "slast$nil=UU"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   252
apply (subst slast_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   253
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   254
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   255
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   256
lemma slast_UU [simp]: "slast$UU=UU"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   257
apply (subst slast_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   258
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   259
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   260
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   261
lemma slast_cons [simp]:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   262
"x~=UU ==> slast$(x##xs)= (If is_nil$xs then x else slast$xs fi)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   263
apply (rule trans)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   264
apply (subst slast_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   265
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   266
apply (rule refl)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   267
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   268
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   269
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   270
subsubsection {* sconc *}
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   271
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   272
lemma sconc_unfold:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   273
   "sconc = (LAM t1 t2. case t1 of
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   274
                           nil   => t2
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   275
                         | x##xs => x ## (xs @@ t2))"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   276
by (subst fix_eq2 [OF sconc_def], simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   277
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   278
lemma sconc_nil [simp]: "nil @@ y = y"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   279
apply (subst sconc_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   280
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   281
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   282
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   283
lemma sconc_UU [simp]: "UU @@ y=UU"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   284
apply (subst sconc_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   285
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   286
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   287
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   288
lemma sconc_cons [simp]: "(x##xs) @@ y=x##(xs @@ y)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   289
apply (rule trans)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   290
apply (subst sconc_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   291
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   292
apply (case_tac "x=UU")
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   293
apply simp_all
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   294
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   295
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   296
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   297
subsubsection {* sflat *}
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   298
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   299
lemma sflat_unfold:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   300
   "sflat = (LAM tr. case tr of
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   301
                           nil   => nil
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   302
                         | x##xs => x @@ sflat$xs)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   303
by (subst fix_eq2 [OF sflat_def], simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   304
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   305
lemma sflat_nil [simp]: "sflat$nil=nil"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   306
apply (subst sflat_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   307
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   308
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   309
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   310
lemma sflat_UU [simp]: "sflat$UU=UU"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   311
apply (subst sflat_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   312
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   313
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   314
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   315
lemma sflat_cons [simp]: "sflat$(x##xs)= x@@(sflat$xs)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   316
apply (rule trans)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   317
apply (subst sflat_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   318
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   319
apply (case_tac "x=UU")
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   320
apply simp_all
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   321
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   322
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   323
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   324
subsubsection {* szip *}
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   325
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   326
lemma szip_unfold:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   327
   "szip = (LAM t1 t2. case t1 of
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   328
                nil   => nil
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   329
              | x##xs => (case t2 of
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   330
                           nil => UU
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   331
                         | y##ys => <x,y>##(szip$xs$ys)))"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   332
by (subst fix_eq2 [OF szip_def], simp)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   333
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   334
lemma szip_nil [simp]: "szip$nil$y=nil"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   335
apply (subst szip_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   336
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   337
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   338
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   339
lemma szip_UU1 [simp]: "szip$UU$y=UU"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   340
apply (subst szip_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   341
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   342
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   343
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   344
lemma szip_UU2 [simp]: "x~=nil ==> szip$x$UU=UU"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   345
apply (subst szip_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   346
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   347
apply (rule_tac x="x" in seq.casedist)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   348
apply simp_all
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   349
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   350
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   351
lemma szip_cons_nil [simp]: "x~=UU ==> szip$(x##xs)$nil=UU"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   352
apply (rule trans)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   353
apply (subst szip_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   354
apply simp_all
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   355
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   356
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   357
lemma szip_cons [simp]:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   358
"[| x~=UU; y~=UU|] ==> szip$(x##xs)$(y##ys) = <x,y>##szip$xs$ys"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   359
apply (rule trans)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   360
apply (subst szip_unfold)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   361
apply simp_all
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   362
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   363
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   364
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   365
subsection "scons, nil"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   366
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   367
lemma scons_inject_eq:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   368
 "[|x~=UU;y~=UU|]==> (x##xs=y##ys) = (x=y & xs=ys)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   369
by (simp add: seq.injects)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   370
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   371
lemma nil_less_is_nil: "nil<<x ==> nil=x"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   372
apply (rule_tac x="x" in seq.casedist)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   373
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   374
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   375
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   376
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   377
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   378
subsection "sfilter, sforall, sconc"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   379
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   380
lemma if_and_sconc [simp]: "(if b then tr1 else tr2) @@ tr
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   381
        = (if b then tr1 @@ tr else tr2 @@ tr)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   382
by simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   383
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   384
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   385
lemma sfiltersconc: "sfilter$P$(x @@ y) = (sfilter$P$x @@ sfilter$P$y)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   386
apply (rule_tac x="x" in seq.ind)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   387
(* adm *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   388
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   389
(* base cases *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   390
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   391
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   392
(* main case *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   393
apply (rule_tac p="P$a" in trE)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   394
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   395
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   396
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   397
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   398
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   399
lemma sforallPstakewhileP: "sforall P (stakewhile$P$x)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   400
apply (simp add: sforall_def)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   401
apply (rule_tac x="x" in seq.ind)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   402
(* adm *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   403
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   404
(* base cases *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   405
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   406
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   407
(* main case *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   408
apply (rule_tac p="P$a" in trE)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   409
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   410
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   411
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   412
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   413
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   414
lemma forallPsfilterP: "sforall P (sfilter$P$x)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   415
apply (simp add: sforall_def)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   416
apply (rule_tac x="x" in seq.ind)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   417
(* adm *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   418
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   419
(* base cases *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   420
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   421
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   422
(* main case *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   423
apply (rule_tac p="P$a" in trE)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   424
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   425
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   426
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   427
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   428
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   429
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   430
subsection "Finite"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   431
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   432
(* ----------------------------------------------------  *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   433
(* Proofs of rewrite rules for Finite:                  *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   434
(* 1. Finite(nil),   (by definition)                    *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   435
(* 2. ~Finite(UU),                                      *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   436
(* 3. a~=UU==> Finite(a##x)=Finite(x)                  *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   437
(* ----------------------------------------------------  *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   438
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   439
lemma Finite_UU_a: "Finite x --> x~=UU"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   440
apply (rule impI)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   441
apply (erule sfinite.induct)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   442
 apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   443
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   444
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   445
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   446
lemma Finite_UU [simp]: "~(Finite UU)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   447
apply (cut_tac x="UU" in Finite_UU_a)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   448
apply fast
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   449
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   450
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   451
lemma Finite_cons_a: "Finite x --> a~=UU --> x=a##xs --> Finite xs"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   452
apply (intro strip)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   453
apply (erule sfinite.elims)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   454
apply fastsimp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   455
apply (simp add: seq.injects)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   456
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   457
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   458
lemma Finite_cons: "a~=UU ==>(Finite (a##x)) = (Finite x)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   459
apply (rule iffI)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   460
apply (erule (1) Finite_cons_a [rule_format])
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   461
apply fast
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   462
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   463
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   464
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   465
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   466
subsection "induction"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   467
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   468
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   469
(*--------------------------------   *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   470
(* Extensions to Induction Theorems  *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   471
(*--------------------------------   *)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   472
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   473
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   474
lemma seq_finite_ind_lemma:
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   475
  assumes "(!!n. P(seq_take n$s))"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   476
  shows "seq_finite(s) -->P(s)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   477
apply (unfold seq.finite_def)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   478
apply (intro strip)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   479
apply (erule exE)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   480
apply (erule subst)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   481
apply (rule prems)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   482
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   483
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   484
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   485
lemma seq_finite_ind: "!!P.[|P(UU);P(nil);
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   486
   !! x s1.[|x~=UU;P(s1)|] ==> P(x##s1)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   487
   |] ==> seq_finite(s) --> P(s)"
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   488
apply (rule seq_finite_ind_lemma)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   489
apply (erule seq.finite_ind)
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   490
 apply assumption
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   491
apply simp
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   492
done
ae77a20f6995 update to reflect changes in inverts/injects lemmas
huffman
parents: 17233
diff changeset
   493
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
   494
end