thys/BitCoded2.thy
author Christian Urban <christian.urban@kcl.ac.uk>
Sun, 10 Oct 2021 09:56:01 +0100
changeset 364 232aa2f19a75
parent 362 e51c9a67a68d
permissions -rw-r--r--
added llncs.cls
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
theory BitCoded2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
  imports "Lexer" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
begin
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
section \<open>Bit-Encodings\<close>
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
datatype bit = Z | S
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
fun 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
  code :: "val \<Rightarrow> bit list"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
  "code Void = []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
| "code (Char c) = []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
| "code (Left v) = Z # (code v)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
| "code (Right v) = S # (code v)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
| "code (Seq v1 v2) = (code v1) @ (code v2)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
| "code (Stars []) = [S]"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
| "code (Stars (v # vs)) =  (Z # code v) @ code (Stars vs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
fun 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
  Stars_add :: "val \<Rightarrow> val \<Rightarrow> val"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
  "Stars_add v (Stars vs) = Stars (v # vs)"
339
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
    26
| "Stars_add v _ = Stars [v]" 
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
function
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
  decode' :: "bit list \<Rightarrow> rexp \<Rightarrow> (val * bit list)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
  "decode' ds ZERO = (Void, [])"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
| "decode' ds ONE = (Void, ds)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
| "decode' ds (CHAR d) = (Char d, ds)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
| "decode' [] (ALT r1 r2) = (Void, [])"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
| "decode' (Z # ds) (ALT r1 r2) = (let (v, ds') = decode' ds r1 in (Left v, ds'))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
| "decode' (S # ds) (ALT r1 r2) = (let (v, ds') = decode' ds r2 in (Right v, ds'))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
| "decode' ds (SEQ r1 r2) = (let (v1, ds') = decode' ds r1 in
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
                             let (v2, ds'') = decode' ds' r2 in (Seq v1 v2, ds''))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
| "decode' [] (STAR r) = (Void, [])"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
| "decode' (S # ds) (STAR r) = (Stars [], ds)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
| "decode' (Z # ds) (STAR r) = (let (v, ds') = decode' ds r in
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
                                    let (vs, ds'') = decode' ds' (STAR r) 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
                                    in (Stars_add v vs, ds''))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
by pat_completeness auto
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
lemma decode'_smaller:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
  assumes "decode'_dom (ds, r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
  shows "length (snd (decode' ds r)) \<le> length ds"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
apply(induct ds r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
apply(auto simp add: decode'.psimps split: prod.split)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
using dual_order.trans apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
by (meson dual_order.trans le_SucI)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
termination "decode'"  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
apply(relation "inv_image (measure(%cs. size cs) <*lex*> measure(%s. size s)) (%(ds,r). (r,ds))") 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
apply(auto dest!: decode'_smaller)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
by (metis less_Suc_eq_le snd_conv)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
definition
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
  decode :: "bit list \<Rightarrow> rexp \<Rightarrow> val option"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
  "decode ds r \<equiv> (let (v, ds') = decode' ds r 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
                  in (if ds' = [] then Some v else None))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
lemma decode'_code_Stars:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
  assumes "\<forall>v\<in>set vs. \<Turnstile> v : r \<and> (\<forall>x. decode' (code v @ x) r = (v, x)) \<and> flat v \<noteq> []" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
  shows "decode' (code (Stars vs) @ ds) (STAR r) = (Stars vs, ds)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
  apply(induct vs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
lemma decode'_code:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
  assumes "\<Turnstile> v : r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
  shows "decode' ((code v) @ ds) r = (v, ds)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
  apply(induct v r arbitrary: ds) 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
  using decode'_code_Stars by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
lemma decode_code:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
  assumes "\<Turnstile> v : r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
  shows "decode (code v) r = Some v"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
  using assms unfolding decode_def
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
  by (smt append_Nil2 decode'_code old.prod.case)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
section {* Annotated Regular Expressions *}
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
datatype arexp = 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
  AZERO
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
| AONE "bit list"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
| ACHAR "bit list" char
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
| ASEQ "bit list" arexp arexp
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
| AALTs "bit list" "arexp list"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
| ASTAR "bit list" arexp
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
abbreviation
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
  "AALT bs r1 r2 \<equiv> AALTs bs [r1, r2]"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
fun asize :: "arexp \<Rightarrow> nat" where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
  "asize AZERO = 1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
| "asize (AONE cs) = 1" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
| "asize (ACHAR cs c) = 1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
| "asize (AALTs cs rs) = Suc (sum_list (map asize rs))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
| "asize (ASEQ cs r1 r2) = Suc (asize r1 + asize r2)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
| "asize (ASTAR cs r) = Suc (asize r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
fun 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
  erase :: "arexp \<Rightarrow> rexp"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
  "erase AZERO = ZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
| "erase (AONE _) = ONE"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
| "erase (ACHAR _ c) = CHAR c"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
| "erase (AALTs _ []) = ZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
| "erase (AALTs _ [r]) = (erase r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
| "erase (AALTs bs (r#rs)) = ALT (erase r) (erase (AALTs bs rs))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
| "erase (ASEQ _ r1 r2) = SEQ (erase r1) (erase r2)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
| "erase (ASTAR _ r) = STAR (erase r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
lemma decode_code_erase:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
  assumes "\<Turnstile> v : (erase  a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
  shows "decode (code v) (erase a) = Some v"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
  by (simp add: decode_code) 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
fun nonalt :: "arexp \<Rightarrow> bool"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
  where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
  "nonalt (AALTs bs2 rs) = False"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
| "nonalt r = True"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
fun good :: "arexp \<Rightarrow> bool" where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
  "good AZERO = False"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
| "good (AONE cs) = True" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
| "good (ACHAR cs c) = True"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
| "good (AALTs cs []) = False"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
| "good (AALTs cs [r]) = False"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
| "good (AALTs cs (r1#r2#rs)) = (\<forall>r' \<in> set (r1#r2#rs). good r' \<and> nonalt r')"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
| "good (ASEQ _ AZERO _) = False"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
| "good (ASEQ _ (AONE _) _) = False"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
| "good (ASEQ _ _ AZERO) = False"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
| "good (ASEQ cs r1 r2) = (good r1 \<and> good r2)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
| "good (ASTAR cs r) = True"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
fun fuse :: "bit list \<Rightarrow> arexp \<Rightarrow> arexp" where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
  "fuse bs AZERO = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
| "fuse bs (AONE cs) = AONE (bs @ cs)" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
| "fuse bs (ACHAR cs c) = ACHAR (bs @ cs) c"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
| "fuse bs (AALTs cs rs) = AALTs (bs @ cs) rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
| "fuse bs (ASEQ cs r1 r2) = ASEQ (bs @ cs) r1 r2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
| "fuse bs (ASTAR cs r) = ASTAR (bs @ cs) r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
lemma fuse_append:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
  shows "fuse (bs1 @ bs2) r = fuse bs1 (fuse bs2 r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
fun intern :: "rexp \<Rightarrow> arexp" where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
  "intern ZERO = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
| "intern ONE = AONE []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
| "intern (CHAR c) = ACHAR [] c"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
| "intern (ALT r1 r2) = AALT [] (fuse [Z] (intern r1)) 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
                                (fuse [S]  (intern r2))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
| "intern (SEQ r1 r2) = ASEQ [] (intern r1) (intern r2)"
359
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   173
| "intern (STAR r) = ASTAR [S] (intern r)"
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
362
e51c9a67a68d updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 359
diff changeset
   176
e51c9a67a68d updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 359
diff changeset
   177
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
fun retrieve :: "arexp \<Rightarrow> val \<Rightarrow> bit list" where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
  "retrieve (AONE bs) Void = bs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
| "retrieve (ACHAR bs c) (Char d) = bs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
| "retrieve (AALTs bs [r]) v = bs @ retrieve r v" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
| "retrieve (AALTs bs (r#rs)) (Left v) = bs @ retrieve r v"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
| "retrieve (AALTs bs (r#rs)) (Right v) = bs @ retrieve (AALTs [] rs) v"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
| "retrieve (ASEQ bs r1 r2) (Seq v1 v2) = bs @ retrieve r1 v1 @ retrieve r2 v2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
| "retrieve (ASTAR bs r) (Stars []) = bs @ [S]"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
| "retrieve (ASTAR bs r) (Stars (v#vs)) = 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
     bs @ [Z] @ retrieve r v @ retrieve (ASTAR [] r) (Stars vs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
fun
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
 bnullable :: "arexp \<Rightarrow> bool"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
  "bnullable (AZERO) = False"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
| "bnullable (AONE bs) = True"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
| "bnullable (ACHAR bs c) = False"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
| "bnullable (AALTs bs rs) = (\<exists>r \<in> set rs. bnullable r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
| "bnullable (ASEQ bs r1 r2) = (bnullable r1 \<and> bnullable r2)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
| "bnullable (ASTAR bs r) = True"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
fun 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
  bmkeps :: "arexp \<Rightarrow> bit list"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
  "bmkeps(AONE bs) = bs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
| "bmkeps(ASEQ bs r1 r2) = bs @ (bmkeps r1) @ (bmkeps r2)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
| "bmkeps(AALTs bs [r]) = bs @ (bmkeps r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
| "bmkeps(AALTs bs (r#rs)) = (if bnullable(r) then bs @ (bmkeps r) else (bmkeps (AALTs bs rs)))"
359
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   208
| "bmkeps(ASTAR bs r) = bs"
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
fun
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   212
 bder :: "char \<Rightarrow> arexp \<Rightarrow> arexp"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
  "bder c (AZERO) = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   215
| "bder c (AONE bs) = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
| "bder c (ACHAR bs d) = (if c = d then AONE bs else AZERO)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
| "bder c (AALTs bs rs) = AALTs bs (map (bder c) rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   218
| "bder c (ASEQ bs r1 r2) = 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
     (if bnullable r1
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   220
      then AALT bs (ASEQ [] (bder c r1) r2) (fuse (bmkeps r1) (bder c r2))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
      else ASEQ bs (bder c r1) r2)"
359
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   222
| "bder c (ASTAR bs r) = ASEQ (butlast bs) (fuse [Z] (bder c r)) (ASTAR [S] r)"
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   223
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   224
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   225
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   226
lemma bder_fuse:
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   227
  "fuse bs (bder c r) = bder c (fuse bs r)"
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   228
  apply(induct r arbitrary: bs)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   229
  apply(simp_all)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   230
  done
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   231
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   233
fun 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   234
  bders :: "arexp \<Rightarrow> string \<Rightarrow> arexp"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235
where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
  "bders r [] = r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   237
| "bders r (c#s) = bders (bder c r) s"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   238
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   239
lemma bders_append:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   240
  "bders r (s1 @ s2) = bders (bders r s1) s2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   241
  apply(induct s1 arbitrary: r s2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   242
  apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   244
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   245
lemma bnullable_correctness:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   246
  shows "nullable (erase r) = bnullable r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   247
  apply(induct r rule: erase.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   248
  apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   249
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   250
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   251
lemma erase_fuse:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   252
  shows "erase (fuse bs r) = erase r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   253
  apply(induct r rule: erase.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   254
  apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   255
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   256
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   257
lemma erase_intern [simp]:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   258
  shows "erase (intern r) = r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   259
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   260
  apply(simp_all add: erase_fuse)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   261
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   262
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   263
lemma erase_bder [simp]:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   264
  shows "erase (bder a r) = der a (erase r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   265
  apply(induct r rule: erase.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   266
  apply(simp_all add: erase_fuse bnullable_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   267
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   268
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   269
lemma erase_bders [simp]:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   270
  shows "erase (bders r s) = ders s (erase r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   271
  apply(induct s arbitrary: r )
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   272
  apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   273
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   274
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   275
lemma retrieve_encode_STARS:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   276
  assumes "\<forall>v\<in>set vs. \<Turnstile> v : r \<and> code v = retrieve (intern r) v"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   277
  shows "code (Stars vs) = retrieve (ASTAR [] (intern r)) (Stars vs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   279
  apply(induct vs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   280
  apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   281
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   282
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   283
lemma retrieve_fuse2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   284
  assumes "\<Turnstile> v : (erase r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   285
  shows "retrieve (fuse bs r) v = bs @ retrieve r v"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   286
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   287
  apply(induct r arbitrary: v bs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   288
         apply(auto elim: Prf_elims)[4]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   289
   defer
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   290
  using retrieve_encode_STARS
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   291
   apply(auto elim!: Prf_elims)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   292
   apply(case_tac vs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   293
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   294
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   295
  (* AALTs  case *)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   296
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   297
  apply(case_tac x2a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   298
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   299
   apply(auto elim!: Prf_elims)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   300
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   301
   apply(case_tac list)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   302
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   303
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   304
  apply(auto elim!: Prf_elims)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   305
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   306
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   307
lemma retrieve_fuse:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   308
  assumes "\<Turnstile> v : r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   309
  shows "retrieve (fuse bs (intern r)) v = bs @ retrieve (intern r) v"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   310
  using assms 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   311
  by (simp_all add: retrieve_fuse2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   312
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   313
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   314
lemma r:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   315
  assumes "bnullable (AALTs bs (a # rs))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   316
  shows "bnullable a \<or> (\<not> bnullable a \<and> bnullable (AALTs bs rs))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   317
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   318
  apply(induct rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   319
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   320
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   321
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   322
lemma r0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   323
  assumes "bnullable a" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   324
  shows  "bmkeps (AALTs bs (a # rs)) = bs @ (bmkeps a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   325
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   326
  by (metis bmkeps.simps(3) bmkeps.simps(4) list.exhaust)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   327
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   328
lemma r1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   329
  assumes "\<not> bnullable a" "bnullable (AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   330
  shows  "bmkeps (AALTs bs (a # rs)) = bmkeps (AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   331
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   332
  apply(induct rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   333
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   334
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   335
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   336
lemma r2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   337
  assumes "x \<in> set rs" "bnullable x"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   338
  shows "bnullable (AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   339
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   340
  apply(induct rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   341
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   342
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   343
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   344
lemma  r3:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   345
  assumes "\<not> bnullable r" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   346
          " \<exists> x \<in> set rs. bnullable x"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   347
  shows "retrieve (AALTs bs rs) (mkeps (erase (AALTs bs rs))) =
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   348
         retrieve (AALTs bs (r # rs)) (mkeps (erase (AALTs bs (r # rs))))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   349
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   350
  apply(induct rs arbitrary: r bs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   351
   apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   352
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   353
  using bnullable_correctness apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   354
    apply(auto simp add: bnullable_correctness mkeps_nullable retrieve_fuse2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   355
   apply(subst retrieve_fuse2[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   356
  apply (smt bnullable.simps(4) bnullable_correctness erase.simps(5) erase.simps(6) insert_iff list.exhaust list.set(2) mkeps.simps(3) mkeps_nullable)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   357
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   358
  apply(case_tac "bnullable a")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   359
  apply (smt append_Nil2 bnullable.simps(4) bnullable_correctness erase.simps(5) erase.simps(6) fuse.simps(4) insert_iff list.exhaust list.set(2) mkeps.simps(3) mkeps_nullable retrieve_fuse2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   360
  apply(drule_tac x="a" in meta_spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   361
  apply(drule_tac x="bs" in meta_spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   362
  apply(drule meta_mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   363
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   364
  apply(drule meta_mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   365
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   366
  apply(subst retrieve_fuse2[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   367
  apply(case_tac rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   368
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   369
   apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   370
      apply (simp add: bnullable_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   371
  apply (metis append_Nil2 bnullable_correctness erase_fuse fuse.simps(4) list.set_intros(1) mkeps.simps(3) mkeps_nullable nullable.simps(4) r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   372
    apply (simp add: bnullable_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   373
  apply (metis append_Nil2 bnullable_correctness erase.simps(6) erase_fuse fuse.simps(4) list.set_intros(2) mkeps.simps(3) mkeps_nullable r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   374
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   375
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   376
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   377
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   378
lemma t: 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   379
  assumes "\<forall>r \<in> set rs. nullable (erase r) \<longrightarrow> bmkeps r = retrieve r (mkeps (erase r))" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   380
          "nullable (erase (AALTs bs rs))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   381
  shows " bmkeps (AALTs bs rs) = retrieve (AALTs bs rs) (mkeps (erase (AALTs bs rs)))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   382
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   383
  apply(induct rs arbitrary: bs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   384
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   385
  apply(auto simp add: bnullable_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   386
   apply(case_tac rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   387
     apply(auto simp add: bnullable_correctness)[2]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   388
   apply(subst r1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   389
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   390
    apply(rule r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   391
     apply(assumption)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   392
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   393
   apply(drule_tac x="bs" in meta_spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   394
   apply(drule meta_mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   395
    apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   396
   prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   397
  apply(case_tac "bnullable a")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   398
    apply(subst r0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   399
     apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   400
    apply(subgoal_tac "nullable (erase a)")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   401
  prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   402
  using bnullable_correctness apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   403
  apply (metis (no_types, lifting) erase.simps(5) erase.simps(6) list.exhaust mkeps.simps(3) retrieve.simps(3) retrieve.simps(4))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   404
  apply(subst r1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   405
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   406
  using r2 apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   407
  apply(drule_tac x="bs" in meta_spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   408
   apply(drule meta_mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   409
    apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   410
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   411
  using r3 apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   412
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   413
  using r3 by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   414
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   415
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   416
lemma asize0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   417
  shows "0 < asize r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   418
  apply(induct  r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   419
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   420
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   421
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   422
lemma asize_fuse:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   423
  shows "asize (fuse bs r) = asize r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   424
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   425
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   426
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   427
359
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   428
lemma TESTTEST:
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   429
  shows "bder c (intern r) = intern (der c r)"
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   430
  apply(induct r)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   431
       apply(simp)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   432
      apply(simp)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   433
     apply(simp)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   434
    prefer 2
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   435
    apply(simp)  
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   436
    apply (simp add: bder_fuse[symmetric])
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   437
  prefer 3
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   438
   apply(simp only: intern.simps)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   439
   apply(simp only: der.simps)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   440
   apply(simp only: intern.simps)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   441
    apply(simp only: bder.simps)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   442
  apply(simp)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   443
   apply(simp only: intern.simps)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   444
   prefer 2
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   445
   apply(simp)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   446
   prefer 2
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   447
   apply(simp)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   448
  apply(auto)
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   449
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   450
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   451
fun nonnested :: "arexp \<Rightarrow> bool"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   452
  where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   453
  "nonnested (AALTs bs2 []) = True"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   454
| "nonnested (AALTs bs2 ((AALTs bs1 rs1) # rs2)) = False"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   455
| "nonnested (AALTs bs2 (r # rs2)) = nonnested (AALTs bs2 rs2)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   456
| "nonnested r = True"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   457
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   458
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   459
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   460
fun distinctBy :: "'a list \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b set \<Rightarrow> 'a list"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   461
  where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   462
  "distinctBy [] f acc = []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   463
| "distinctBy (x#xs) f acc = 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   464
     (if (f x) \<in> acc then distinctBy xs f acc 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   465
      else x # (distinctBy xs f ({f x} \<union> acc)))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   466
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   467
fun flts :: "arexp list \<Rightarrow> arexp list"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   468
  where 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   469
  "flts [] = []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   470
| "flts (AZERO # rs) = flts rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   471
| "flts ((AALTs bs  rs1) # rs) = (map (fuse bs) rs1) @ flts rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   472
| "flts (r1 # rs) = r1 # flts rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   473
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   474
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   475
fun spill :: "arexp list \<Rightarrow> arexp list"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   476
  where 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   477
  "spill [] = []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   478
| "spill ((AALTs bs rs1) # rs) = (map (fuse bs) rs1) @ spill rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   479
| "spill (r1 # rs) = r1 # spill rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   480
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   481
lemma  spill_Cons:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   482
  shows "spill (r # rs1) = spill [r] @ spill rs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   483
  apply(induct r arbitrary: rs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   484
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   485
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   486
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   487
lemma  spill_append:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   488
  shows "spill (rs1 @ rs2) = spill rs1 @ spill rs2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   489
  apply(induct rs1 arbitrary: rs2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   490
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   491
  by (metis append.assoc spill_Cons)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   492
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   493
fun bsimp_ASEQ :: "bit list \<Rightarrow> arexp \<Rightarrow> arexp \<Rightarrow> arexp"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   494
  where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   495
  "bsimp_ASEQ _ AZERO _ = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   496
| "bsimp_ASEQ _ _ AZERO = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   497
| "bsimp_ASEQ bs1 (AONE bs2) r2 = fuse (bs1 @ bs2) r2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   498
| "bsimp_ASEQ bs1 r1 r2 = ASEQ  bs1 r1 r2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   499
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   500
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   501
fun bsimp_AALTs :: "bit list \<Rightarrow> arexp list \<Rightarrow> arexp"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   502
  where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   503
  "bsimp_AALTs _ [] = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   504
| "bsimp_AALTs bs1 [r] = fuse bs1 r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   505
| "bsimp_AALTs bs1 rs = AALTs bs1 rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   506
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   507
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   508
fun bsimp :: "arexp \<Rightarrow> arexp" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   509
  where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   510
  "bsimp (ASEQ bs1 r1 r2) = bsimp_ASEQ bs1 (bsimp r1) (bsimp r2)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   511
| "bsimp (AALTs bs1 rs) = bsimp_AALTs bs1 (flts (map bsimp rs))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   512
| "bsimp r = r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   513
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   514
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   515
inductive contains2 :: "arexp \<Rightarrow> bit list \<Rightarrow> bool" ("_ >>2 _" [51, 50] 50)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   516
  where
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   517
  "AONE bs >>2 bs"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   518
| "ACHAR bs c >>2 bs"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   519
| "\<lbrakk>a1 >>2 bs1; a2 >>2 bs2\<rbrakk> \<Longrightarrow> ASEQ bs a1 a2 >>2 bs @ bs1 @ bs2"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   520
| "r >>2 bs1 \<Longrightarrow> AALTs bs (r#rs) >>2 bs @ bs1"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   521
| "AALTs bs rs >>2 bs @ bs1 \<Longrightarrow> AALTs bs (r#rs) >>2 bs @ bs1"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   522
| "ASTAR bs r >>2 bs @ [S]"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   523
| "\<lbrakk>r >>2 bs1; ASTAR [] r >>2 bs2\<rbrakk> \<Longrightarrow> ASTAR bs r >>2 bs @ Z # bs1 @ bs2"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   524
| "r >>2 bs \<Longrightarrow> (bsimp r) >>2 bs"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   525
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   526
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   527
inductive contains :: "arexp \<Rightarrow> bit list \<Rightarrow> bool" ("_ >> _" [51, 50] 50)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   528
  where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   529
  "AONE bs >> bs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   530
| "ACHAR bs c >> bs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   531
| "\<lbrakk>a1 >> bs1; a2 >> bs2\<rbrakk> \<Longrightarrow> ASEQ bs a1 a2 >> bs @ bs1 @ bs2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   532
| "r >> bs1 \<Longrightarrow> AALTs bs (r#rs) >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   533
| "AALTs bs rs >> bs @ bs1 \<Longrightarrow> AALTs bs (r#rs) >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   534
| "ASTAR bs r >> bs @ [S]"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   535
| "\<lbrakk>r >> bs1; ASTAR [] r >> bs2\<rbrakk> \<Longrightarrow> ASTAR bs r >> bs @ Z # bs1 @ bs2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   536
359
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   537
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   538
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   539
lemma contains0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   540
  assumes "a >> bs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   541
  shows "(fuse bs1 a) >> bs1 @ bs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   542
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   543
  apply(induct arbitrary: bs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   544
  apply(auto intro: contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   545
       apply (metis append.assoc contains.intros(3))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   546
     apply (metis append.assoc contains.intros(4))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   547
  apply (metis append.assoc contains.intros(5))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   548
    apply (metis append.assoc contains.intros(6))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   549
   apply (metis append_assoc contains.intros(7))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   550
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   551
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   552
lemma contains1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   553
  assumes "\<forall>v\<in>set vs. \<Turnstile> v : r \<and> intern r >> code v"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   554
  shows "ASTAR [] (intern r) >> code (Stars vs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   555
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   556
  apply(induct vs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   557
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   558
  using contains.simps apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   559
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   560
   apply(subst (2) append_Nil[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   561
  apply(rule contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   562
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   563
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   564
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   565
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   566
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   567
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   568
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   569
lemma contains2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   570
  assumes "\<Turnstile> v : r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   571
  shows "(intern r) >> code v"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   572
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   573
  apply(induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   574
       prefer 4
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   575
       apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   576
       apply(rule contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   577
   prefer 4
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   578
       apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   579
      apply(rule contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   580
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   581
  apply(subst (3) append_Nil[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   582
  apply(rule contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   583
      apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   584
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   585
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   586
  apply(subst (9) append_Nil[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   587
    apply(rule contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   588
    apply (metis append_Cons append_self_conv2 contains0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   589
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   590
     apply(subst (9) append_Nil[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   591
   apply(rule contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   592
   back
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   593
   apply(rule contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   594
  apply(drule_tac ?bs1.0="[S]" in contains0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   595
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   596
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   597
  apply(case_tac vs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   598
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   599
  apply (metis append_Nil contains.intros(6))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   600
  using contains1 by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   601
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   602
lemma qq1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   603
  assumes "\<exists>r \<in> set rs. bnullable r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   604
  shows "bmkeps (AALTs bs (rs @ rs1)) = bmkeps (AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   605
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   606
  apply(induct rs arbitrary: rs1 bs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   607
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   608
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   609
  by (metis Nil_is_append_conv bmkeps.simps(4) neq_Nil_conv r0 split_list_last)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   610
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   611
lemma qq2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   612
  assumes "\<forall>r \<in> set rs. \<not> bnullable r" "\<exists>r \<in> set rs1. bnullable r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   613
  shows "bmkeps (AALTs bs (rs @ rs1)) = bmkeps (AALTs bs rs1)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   614
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   615
  apply(induct rs arbitrary: rs1 bs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   616
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   617
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   618
  by (metis append_assoc in_set_conv_decomp r1 r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   619
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   620
lemma qq2a:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   621
  assumes "\<not> bnullable r" "\<exists>r \<in> set rs1. bnullable r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   622
  shows "bmkeps (AALTs bs (r # rs1)) = bmkeps (AALTs bs rs1)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   623
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   624
  by (simp add: r1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   625
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   626
lemma qq3:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   627
  shows "bnullable (AALTs bs rs) = (\<exists>r \<in> set rs. bnullable r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   628
  apply(induct rs arbitrary: bs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   629
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   630
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   631
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   632
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   633
lemma qq4:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   634
  assumes "bnullable (AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   635
  shows "bmkeps (AALTs bs rs) = bs @ bmkeps (AALTs [] rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   636
  by (metis append_Nil2 assms bmkeps_retrieve bnullable_correctness erase_fuse fuse.simps(4) mkeps_nullable retrieve_fuse2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   637
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   638
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   639
lemma contains3a:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   640
  assumes "AALTs bs lst >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   641
  shows "AALTs bs (a # lst) >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   642
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   643
  apply -
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   644
  by (simp add: contains.intros(5))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   645
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   646
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   647
lemma contains3b:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   648
  assumes "a >> bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   649
  shows "AALTs bs (a # lst) >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   650
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   651
  apply -
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   652
  apply(rule contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   653
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   654
  done   
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   655
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   656
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   657
lemma contains3:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   658
  assumes "\<And>x. \<lbrakk>x \<in> set rs; bnullable x\<rbrakk> \<Longrightarrow> x >> bmkeps x" "x \<in> set rs" "bnullable x"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   659
  shows "AALTs bs rs >> bmkeps (AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   660
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   661
  apply(induct rs arbitrary: bs x)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   662
   apply simp
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   663
  by (metis contains.intros(4) contains.intros(5) list.set_intros(1) list.set_intros(2) qq3 qq4 r r0 r1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   664
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   665
lemma cont1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   666
  assumes "\<And>v. \<Turnstile> v : erase r \<Longrightarrow> r >> retrieve r v" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   667
          "\<forall>v\<in>set vs. \<Turnstile> v : erase r \<and> flat v \<noteq> []" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   668
  shows "ASTAR bs r >> retrieve (ASTAR bs r) (Stars vs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   669
  using assms 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   670
  apply(induct vs arbitrary: bs r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   671
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   672
  using contains.intros(6) apply auto[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   673
  by (simp add: contains.intros(7))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   674
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   675
lemma contains4:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   676
  assumes "bnullable a"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   677
  shows "a >> bmkeps a"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   678
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   679
  apply(induct a rule: bnullable.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   680
       apply(auto intro: contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   681
  using contains3 by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   682
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   683
lemma contains5:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   684
  assumes "\<Turnstile> v : r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   685
  shows "(intern r) >> retrieve (intern r) v"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   686
  using contains2[OF assms] retrieve_code[OF assms]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   687
  by (simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   688
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   689
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   690
lemma contains6:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   691
  assumes "\<Turnstile> v : (erase r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   692
  shows "r >> retrieve r v"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   693
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   694
  apply(induct r arbitrary: v rule: erase.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   695
  apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   696
  using Prf_elims(1) apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   697
  using Prf_elims(4) contains.intros(1) apply force
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   698
  using Prf_elims(5) contains.intros(2) apply force
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   699
  apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   700
  using Prf_elims(1) apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   701
  apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   702
  using contains3b contains3a apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   703
    prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   704
  apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   705
    apply (metis Prf_elims(2) contains.intros(3) retrieve.simps(6))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   706
   prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   707
  apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   708
   apply (metis Prf_elims(6) cont1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   709
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   710
  apply(erule Prf_elims)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   711
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   712
   apply (simp add: contains3b)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   713
  using retrieve_fuse2 contains3b contains3a
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   714
  apply(subst retrieve_fuse2[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   715
  apply (metis append_Nil2 erase_fuse fuse.simps(4))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   716
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   717
  by (metis append_Nil2 erase_fuse fuse.simps(4))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   718
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   719
lemma contains7:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   720
  assumes "\<Turnstile> v : der c (erase r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   721
  shows "(bder c r) >> retrieve r (injval (erase r) c v)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   722
  using bder_retrieve[OF assms(1)] retrieve_code[OF assms(1)]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   723
  by (metis assms contains6 erase_bder)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   724
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   725
338
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
   726
lemma contains7a:
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
   727
  assumes "\<Turnstile> v : der c (erase r)"
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
   728
  shows "r >> retrieve r (injval (erase r) c v)"
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
   729
  using assms
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
   730
  apply -
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
   731
  apply(drule Prf_injval)
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
   732
  apply(drule contains6)
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
   733
  apply(simp)
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
   734
  done
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
   735
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   736
lemma contains7b:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   737
  assumes "\<Turnstile> v : ders s (erase r)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   738
  shows "(bders r s) >> retrieve r (flex (erase r) id s v)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   739
  using assms
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   740
  apply(induct s arbitrary: r v)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   741
   apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   742
   apply (simp add: contains6)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   743
  apply(simp add: bders_append flex_append ders_append)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   744
  apply(drule_tac x="bder a r" in meta_spec)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   745
  apply(drule meta_spec)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   746
  apply(drule meta_mp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   747
   apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   748
  apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   749
  apply(subst (asm) bder_retrieve)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   750
   defer
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   751
  apply (simp add: flex_injval)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   752
  by (simp add: Prf_flex)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   753
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   754
lemma contains7_iff:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   755
  assumes "\<Turnstile> v : der c (erase r)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   756
  shows "(bder c r) >> retrieve r (injval (erase r) c v) \<longleftrightarrow>
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   757
                  r >> retrieve r (injval (erase r) c v)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   758
  by (simp add: assms contains7 contains7a)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   759
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   760
lemma contains8_iff:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   761
  assumes "\<Turnstile> v : ders s (erase r)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   762
  shows "(bders r s) >> retrieve r (flex (erase r) id s v) \<longleftrightarrow>
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   763
                  r >> retrieve r (flex (erase r) id s v)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   764
  using Prf_flex assms contains6 contains7b by blast
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   765
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
   766
359
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   767
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
   768
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   769
fun 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   770
  bders_simp :: "arexp \<Rightarrow> string \<Rightarrow> arexp"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   771
where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   772
  "bders_simp r [] = r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   773
| "bders_simp r (c # s) = bders_simp (bsimp (bder c r)) s"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   774
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   775
definition blexer_simp where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   776
 "blexer_simp r s \<equiv> if bnullable (bders_simp (intern r) s) then 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   777
                decode (bmkeps (bders_simp (intern r) s)) r else None"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   778
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   779
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   780
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   781
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   782
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   783
lemma bders_simp_append:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   784
  shows "bders_simp r (s1 @ s2) = bders_simp (bders_simp r s1) s2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   785
  apply(induct s1 arbitrary: r s2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   786
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   787
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   788
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   789
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   790
lemma bsimp_ASEQ_size:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   791
  shows "asize (bsimp_ASEQ bs r1 r2) \<le> Suc (asize r1 + asize r2)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   792
  apply(induct bs r1 r2 rule: bsimp_ASEQ.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   793
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   794
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   795
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   796
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   797
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   798
lemma flts_size:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   799
  shows "sum_list (map asize (flts rs)) \<le> sum_list (map asize rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   800
  apply(induct rs rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   801
        apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   802
  by (simp add: asize_fuse comp_def)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   803
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   804
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   805
lemma bsimp_AALTs_size:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   806
  shows "asize (bsimp_AALTs bs rs) \<le> Suc (sum_list (map asize rs))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   807
  apply(induct rs rule: bsimp_AALTs.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   808
  apply(auto simp add: asize_fuse)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   809
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   810
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   811
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   812
lemma bsimp_size:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   813
  shows "asize (bsimp r) \<le> asize r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   814
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   815
       apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   816
   apply (meson Suc_le_mono add_mono_thms_linordered_semiring(1) bsimp_ASEQ_size le_trans)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   817
  apply(rule le_trans)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   818
   apply(rule bsimp_AALTs_size)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   819
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   820
   apply(rule le_trans)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   821
   apply(rule flts_size)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   822
  by (simp add: sum_list_mono)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   823
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   824
lemma bsimp_asize0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   825
  shows "(\<Sum>x\<leftarrow>rs. asize (bsimp x)) \<le> sum_list (map asize rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   826
  apply(induct rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   827
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   828
  by (simp add: add_mono bsimp_size)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   829
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   830
lemma bsimp_AALTs_size2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   831
  assumes "\<forall>r \<in> set  rs. nonalt r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   832
  shows "asize (bsimp_AALTs bs rs) \<ge> sum_list (map asize rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   833
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   834
  apply(induct rs rule: bsimp_AALTs.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   835
    apply(simp_all add: asize_fuse)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   836
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   837
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   838
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   839
lemma qq:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   840
  shows "map (asize \<circ> fuse bs) rs = map asize rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   841
  apply(induct rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   842
   apply(auto simp add: asize_fuse)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   843
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   844
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   845
lemma flts_size2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   846
  assumes "\<exists>bs rs'. AALTs bs  rs' \<in> set rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   847
  shows "sum_list (map asize (flts rs)) < sum_list (map asize rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   848
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   849
  apply(induct rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   850
   apply(auto simp add: qq)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   851
   apply (simp add: flts_size less_Suc_eq_le)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   852
  apply(case_tac a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   853
       apply(auto simp add: qq)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   854
   prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   855
   apply (simp add: flts_size le_imp_less_Suc)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   856
  using less_Suc_eq by auto
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   857
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   858
lemma bsimp_AALTs_size3:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   859
  assumes "\<exists>r \<in> set  (map bsimp rs). \<not>nonalt r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   860
  shows "asize (bsimp (AALTs bs rs)) < asize (AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   861
  using assms flts_size2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   862
  apply  -
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   863
  apply(clarify)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   864
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   865
  apply(drule_tac x="map bsimp rs" in meta_spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   866
  apply(drule meta_mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   867
  apply (metis list.set_map nonalt.elims(3))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   868
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   869
  apply(rule order_class.order.strict_trans1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   870
   apply(rule bsimp_AALTs_size)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   871
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   872
  by (smt Suc_leI bsimp_asize0 comp_def le_imp_less_Suc le_trans map_eq_conv not_less_eq)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   873
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   874
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   875
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   876
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   877
lemma L_bsimp_ASEQ:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   878
  "L (SEQ (erase r1) (erase r2)) = L (erase (bsimp_ASEQ bs r1 r2))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   879
  apply(induct bs r1 r2 rule: bsimp_ASEQ.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   880
  apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   881
  by (metis erase_fuse fuse.simps(4))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   882
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   883
lemma L_bsimp_AALTs:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   884
  "L (erase (AALTs bs rs)) = L (erase (bsimp_AALTs bs rs))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   885
  apply(induct bs rs rule: bsimp_AALTs.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   886
  apply(simp_all add: erase_fuse)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   887
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   888
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   889
lemma L_erase_AALTs:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   890
  shows "L (erase (AALTs bs rs)) = \<Union> (L ` erase ` (set rs))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   891
  apply(induct rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   892
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   893
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   894
  apply(case_tac rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   895
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   896
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   897
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   898
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   899
lemma L_erase_flts:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   900
  shows "\<Union> (L ` erase ` (set (flts rs))) = \<Union> (L ` erase ` (set rs))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   901
  apply(induct rs rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   902
        apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   903
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   904
  using L_erase_AALTs erase_fuse apply auto[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   905
  by (simp add: L_erase_AALTs erase_fuse)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   906
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   907
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   908
lemma L_bsimp_erase:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   909
  shows "L (erase r) = L (erase (bsimp r))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   910
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   911
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   912
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   913
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   914
  apply(auto simp add: Sequ_def)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   915
  apply(subst L_bsimp_ASEQ[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   916
  apply(auto simp add: Sequ_def)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   917
  apply(subst (asm)  L_bsimp_ASEQ[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   918
  apply(auto simp add: Sequ_def)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   919
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   920
   apply(subst L_bsimp_AALTs[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   921
   defer
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   922
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   923
  apply(subst (2)L_erase_AALTs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   924
  apply(subst L_erase_flts)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   925
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   926
   apply (simp add: L_erase_AALTs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   927
  using L_erase_AALTs by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   928
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   929
lemma bsimp_ASEQ0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   930
  shows "bsimp_ASEQ bs r1 AZERO = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   931
  apply(induct r1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   932
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   933
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   934
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   935
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   936
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   937
lemma bsimp_ASEQ1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   938
  assumes "r1 \<noteq> AZERO" "r2 \<noteq> AZERO" "\<forall>bs. r1 \<noteq> AONE bs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   939
  shows "bsimp_ASEQ bs r1 r2 = ASEQ bs r1 r2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   940
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   941
  apply(induct bs r1 r2 rule: bsimp_ASEQ.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   942
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   943
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   944
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   945
lemma bsimp_ASEQ2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   946
  shows "bsimp_ASEQ bs (AONE bs1) r2 = fuse (bs @ bs1) r2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   947
  apply(induct r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   948
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   949
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   950
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   951
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   952
lemma L_bders_simp:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   953
  shows "L (erase (bders_simp r s)) = L (erase (bders r s))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   954
  apply(induct s arbitrary: r rule: rev_induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   955
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   956
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   957
  apply(simp add: ders_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   958
  apply(simp add: bders_simp_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   959
  apply(simp add: L_bsimp_erase[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   960
  by (simp add: der_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   961
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   962
lemma b1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   963
  "bsimp_ASEQ bs1 (AONE bs) r =  fuse (bs1 @ bs) r" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   964
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   965
       apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   966
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   967
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   968
lemma b2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   969
  assumes "bnullable r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   970
  shows "bmkeps (fuse bs r) = bs @ bmkeps r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   971
  by (simp add: assms bmkeps_retrieve bnullable_correctness erase_fuse mkeps_nullable retrieve_fuse2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   972
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   973
lemma b3:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   974
  shows "bnullable r = bnullable (bsimp r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   975
  using L_bsimp_erase bnullable_correctness nullable_correctness by auto
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   976
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   977
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   978
lemma b4:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   979
  shows "bnullable (bders_simp r s) = bnullable (bders r s)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   980
  by (metis L_bders_simp bnullable_correctness lexer.simps(1) lexer_correct_None option.distinct(1))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   981
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   982
lemma q1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   983
  assumes "\<forall>r \<in> set rs. bmkeps(bsimp r) = bmkeps r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   984
  shows "map (\<lambda>r. bmkeps(bsimp r)) rs = map bmkeps rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   985
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   986
  apply(induct rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   987
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   988
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   989
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   990
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   991
lemma q3:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   992
  assumes "\<exists>r \<in> set rs. bnullable r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   993
  shows "bmkeps (AALTs bs rs) = bmkeps (bsimp_AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   994
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   995
  apply(induct bs rs rule: bsimp_AALTs.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   996
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   997
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   998
  apply (simp add: b2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   999
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1000
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1001
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1002
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1003
lemma fuse_empty:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1004
  shows "fuse [] r = r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1005
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1006
       apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1007
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1008
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1009
lemma flts_fuse:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1010
  shows "map (fuse bs) (flts rs) = flts (map (fuse bs) rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1011
  apply(induct rs arbitrary: bs rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1012
        apply(auto simp add: fuse_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1013
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1014
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1015
lemma bsimp_ASEQ_fuse:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1016
  shows "fuse bs1 (bsimp_ASEQ bs2 r1 r2) = bsimp_ASEQ (bs1 @ bs2) r1 r2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1017
  apply(induct r1 r2 arbitrary: bs1 bs2 rule: bsimp_ASEQ.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1018
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1019
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1020
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1021
lemma bsimp_AALTs_fuse:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1022
  assumes "\<forall>r \<in> set rs. fuse bs1 (fuse bs2 r) = fuse (bs1 @ bs2) r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1023
  shows "fuse bs1 (bsimp_AALTs bs2 rs) = bsimp_AALTs (bs1 @ bs2) rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1024
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1025
  apply(induct bs2 rs arbitrary: bs1 rule: bsimp_AALTs.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1026
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1027
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1028
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1029
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1030
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1031
lemma bsimp_fuse:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1032
  shows "fuse bs (bsimp r) = bsimp (fuse bs r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1033
apply(induct r arbitrary: bs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1034
       apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1035
      apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1036
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1037
    prefer 3
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1038
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1039
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1040
   apply (simp add: bsimp_ASEQ_fuse)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1041
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1042
  by (simp add: bsimp_AALTs_fuse fuse_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1043
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1044
lemma bsimp_fuse_AALTs:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1045
  shows "fuse bs (bsimp (AALTs [] rs)) = bsimp (AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1046
  apply(subst bsimp_fuse) 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1047
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1048
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1049
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1050
lemma bsimp_fuse_AALTs2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1051
  shows "fuse bs (bsimp_AALTs [] rs) = bsimp_AALTs bs rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1052
  using bsimp_AALTs_fuse fuse_append by auto
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1053
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1054
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1055
lemma bsimp_ASEQ_idem:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1056
  assumes "bsimp (bsimp r1) = bsimp r1" "bsimp (bsimp r2) = bsimp r2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1057
  shows "bsimp (bsimp_ASEQ x1 (bsimp r1) (bsimp r2)) = bsimp_ASEQ x1 (bsimp r1) (bsimp r2)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1058
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1059
  apply(case_tac "bsimp r1 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1060
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1061
 apply(case_tac "bsimp r2 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1062
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1063
  apply (metis bnullable.elims(2) bnullable.elims(3) bsimp.simps(3) bsimp_ASEQ.simps(2) bsimp_ASEQ.simps(3) bsimp_ASEQ.simps(4) bsimp_ASEQ.simps(5) bsimp_ASEQ.simps(6))  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1064
  apply(case_tac "\<exists>bs. bsimp r1 = AONE bs")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1065
    apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1066
    apply(subst bsimp_ASEQ2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1067
   apply(subst bsimp_ASEQ2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1068
  apply (metis assms(2) bsimp_fuse)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1069
      apply(subst bsimp_ASEQ1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1070
      apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1071
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1072
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1073
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1074
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1075
lemma  k0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1076
  shows "flts (r # rs1) = flts [r] @ flts rs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1077
  apply(induct r arbitrary: rs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1078
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1079
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1080
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1081
lemma  k00:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1082
  shows "flts (rs1 @ rs2) = flts rs1 @ flts rs2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1083
  apply(induct rs1 arbitrary: rs2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1084
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1085
  by (metis append.assoc k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1086
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1087
lemma  k0a:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1088
  shows "flts [AALTs bs rs] = map (fuse bs)  rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1089
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1090
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1091
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1092
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1093
lemma  k0b:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1094
  assumes "nonalt r" "r \<noteq> AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1095
  shows "flts [r] = [r]"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1096
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1097
  apply(case_tac  r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1098
  apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1099
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1100
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1101
lemma nn1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1102
  assumes "nonnested (AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1103
  shows "\<nexists>bs1 rs1. flts rs = [AALTs bs1 rs1]"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1104
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1105
  apply(induct rs rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1106
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1107
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1108
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1109
lemma nn1q:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1110
  assumes "nonnested (AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1111
  shows "\<nexists>bs1 rs1. AALTs bs1 rs1 \<in> set (flts rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1112
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1113
  apply(induct rs rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1114
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1115
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1116
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1117
lemma nn1qq:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1118
  assumes "nonnested (AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1119
  shows "\<nexists>bs1 rs1. AALTs bs1 rs1 \<in> set rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1120
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1121
  apply(induct rs rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1122
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1123
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1124
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1125
lemma nn10:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1126
  assumes "nonnested (AALTs cs rs)" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1127
  shows "nonnested (AALTs (bs @ cs) rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1128
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1129
  apply(induct rs arbitrary: cs bs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1130
   apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1131
  apply(case_tac a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1132
       apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1133
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1134
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1135
lemma nn11a:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1136
  assumes "nonalt r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1137
  shows "nonalt (fuse bs r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1138
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1139
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1140
       apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1141
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1142
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1143
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1144
lemma nn1a:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1145
  assumes "nonnested r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1146
  shows "nonnested (fuse bs r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1147
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1148
  apply(induct bs r arbitrary: rule: fuse.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1149
       apply(simp_all add: nn10)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1150
  done  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1151
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1152
lemma n0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1153
  shows "nonnested (AALTs bs rs) \<longleftrightarrow> (\<forall>r \<in> set rs. nonalt r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1154
  apply(induct rs  arbitrary: bs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1155
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1156
    apply (metis list.set_intros(1) nn1qq nonalt.elims(3))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1157
   apply (metis list.set_intros(2) nn1qq nonalt.elims(3))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1158
  by (metis nonalt.elims(2) nonnested.simps(3) nonnested.simps(4) nonnested.simps(5) nonnested.simps(6) nonnested.simps(7))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1159
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1160
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1161
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1162
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1163
lemma nn1c:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1164
  assumes "\<forall>r \<in> set rs. nonnested r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1165
  shows "\<forall>r \<in> set (flts rs). nonalt r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1166
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1167
  apply(induct rs rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1168
        apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1169
  apply(rule nn11a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1170
  by (metis nn1qq nonalt.elims(3))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1171
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1172
lemma nn1bb:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1173
  assumes "\<forall>r \<in> set rs. nonalt r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1174
  shows "nonnested (bsimp_AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1175
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1176
  apply(induct bs rs rule: bsimp_AALTs.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1177
    apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1178
   apply (metis nn11a nonalt.simps(1) nonnested.elims(3))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1179
  using n0 by auto
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1180
    
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1181
lemma nn1b:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1182
  shows "nonnested (bsimp r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1183
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1184
       apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1185
  apply(case_tac "bsimp r1 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1186
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1187
 apply(case_tac "bsimp r2 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1188
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1189
    apply(subst bsimp_ASEQ0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1190
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1191
  apply(case_tac "\<exists>bs. bsimp r1 = AONE bs")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1192
    apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1193
    apply(subst bsimp_ASEQ2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1194
  apply (simp add: nn1a)    
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1195
   apply(subst bsimp_ASEQ1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1196
      apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1197
  apply(rule nn1bb)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1198
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1199
  by (metis (mono_tags, hide_lams) imageE nn1c set_map)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1200
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1201
lemma nn1d:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1202
  assumes "bsimp r = AALTs bs rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1203
  shows "\<forall>r1 \<in> set rs. \<forall>  bs. r1 \<noteq> AALTs bs  rs2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1204
  using nn1b assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1205
  by (metis nn1qq)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1206
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1207
lemma nn_flts:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1208
  assumes "nonnested (AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1209
  shows "\<forall>r \<in>  set (flts rs). nonalt r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1210
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1211
  apply(induct rs arbitrary: bs rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1212
        apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1213
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1214
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1215
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1216
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1217
lemma rt:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1218
  shows "sum_list (map asize (flts (map bsimp rs))) \<le> sum_list (map asize rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1219
  apply(induct rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1220
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1221
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1222
  apply(subst  k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1223
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1224
  by (smt add_le_cancel_right add_mono bsimp_size flts.simps(1) flts_size k0 le_iff_add list.simps(9) map_append sum_list.Cons sum_list.append trans_le_add1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1225
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1226
lemma bsimp_AALTs_qq:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1227
  assumes "1 < length rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1228
  shows "bsimp_AALTs bs rs = AALTs bs  rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1229
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1230
  apply(case_tac rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1231
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1232
  apply(case_tac list)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1233
   apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1234
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1235
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1236
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1237
lemma bsimp_AALTs1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1238
  assumes "nonalt r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1239
  shows "bsimp_AALTs bs (flts [r]) = fuse bs r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1240
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1241
  apply(case_tac r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1242
   apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1243
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1244
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1245
lemma bbbbs:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1246
  assumes "good r" "r = AALTs bs1 rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1247
  shows "bsimp_AALTs bs (flts [r]) = AALTs bs (map (fuse bs1) rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1248
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1249
  by (metis (no_types, lifting) Nil_is_map_conv append.left_neutral append_butlast_last_id bsimp_AALTs.elims butlast.simps(2) good.simps(4) good.simps(5) k0a map_butlast)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1250
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1251
lemma bbbbs1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1252
  shows "nonalt r \<or> (\<exists>bs rs. r  = AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1253
  using nonalt.elims(3) by auto
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1254
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1255
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1256
lemma good_fuse:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1257
  shows "good (fuse bs r) = good r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1258
  apply(induct r arbitrary: bs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1259
       apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1260
     apply(case_tac r1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1261
          apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1262
  apply(case_tac r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1263
          apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1264
  apply(case_tac r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1265
            apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1266
  apply(case_tac r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1267
           apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1268
  apply(case_tac r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1269
          apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1270
  apply(case_tac r1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1271
          apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1272
  apply(case_tac r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1273
           apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1274
  apply(case_tac r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1275
           apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1276
  apply(case_tac r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1277
           apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1278
  apply(case_tac r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1279
         apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1280
  apply(case_tac x2a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1281
    apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1282
  apply(case_tac list)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1283
    apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1284
  apply(case_tac x2a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1285
    apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1286
  apply(case_tac list)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1287
    apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1288
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1289
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1290
lemma good0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1291
  assumes "rs \<noteq> Nil" "\<forall>r \<in> set rs. nonalt r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1292
  shows "good (bsimp_AALTs bs rs) \<longleftrightarrow> (\<forall>r \<in> set rs. good r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1293
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1294
  apply(induct bs rs rule: bsimp_AALTs.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1295
  apply(auto simp add: good_fuse)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1296
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1297
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1298
lemma good0a:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1299
  assumes "flts (map bsimp rs) \<noteq> Nil" "\<forall>r \<in> set (flts (map bsimp rs)). nonalt r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1300
  shows "good (bsimp (AALTs bs rs)) \<longleftrightarrow> (\<forall>r \<in> set (flts (map bsimp rs)). good r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1301
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1302
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1303
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1304
  apply(subst (asm) good0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1305
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1306
    apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1307
   apply(subst good0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1308
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1309
    apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1310
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1311
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1312
lemma flts0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1313
  assumes "r \<noteq> AZERO" "nonalt r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1314
  shows "flts [r] \<noteq> []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1315
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1316
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1317
       apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1318
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1319
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1320
lemma flts1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1321
  assumes "good r" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1322
  shows "flts [r] \<noteq> []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1323
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1324
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1325
       apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1326
  apply(case_tac x2a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1327
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1328
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1329
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1330
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1331
lemma flts2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1332
  assumes "good r" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1333
  shows "\<forall>r' \<in> set (flts [r]). good r' \<and> nonalt r'"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1334
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1335
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1336
       apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1337
      apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1338
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1339
    prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1340
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1341
    apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1342
     apply (metis bsimp_AALTs.elims good.simps(4) good.simps(5) good.simps(6) good_fuse)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1343
  apply (metis bsimp_AALTs.elims good.simps(4) good.simps(5) good.simps(6) nn11a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1344
   apply fastforce
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1345
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1346
  done  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1347
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1348
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1349
lemma flts3:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1350
  assumes "\<forall>r \<in> set rs. good r \<or> r = AZERO" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1351
  shows "\<forall>r \<in> set (flts rs). good r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1352
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1353
  apply(induct rs arbitrary: rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1354
        apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1355
  by (metis UnE flts2 k0a set_map)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1356
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1357
lemma flts3b:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1358
  assumes "\<exists>r\<in>set rs. good r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1359
  shows "flts rs \<noteq> []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1360
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1361
  apply(induct rs arbitrary: rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1362
        apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1363
       apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1364
      apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1365
      apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1366
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1367
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1368
lemma flts4:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1369
  assumes "bsimp_AALTs bs (flts rs) = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1370
  shows "\<forall>r \<in> set rs. \<not> good r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1371
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1372
  apply(induct rs arbitrary: bs rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1373
        apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1374
        defer
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1375
  apply (metis (no_types, lifting) Nil_is_append_conv append_self_conv2 bsimp_AALTs.elims butlast.simps(2) butlast_append flts3b nonalt.simps(1) nonalt.simps(2))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1376
  apply (metis arexp.distinct(7) bsimp_AALTs.elims flts2 good.simps(1) good.simps(2) good0 k0b list.distinct(1) list.inject nonalt.simps(3))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1377
  apply (metis arexp.distinct(3) arexp.distinct(7) bsimp_AALTs.elims fuse.simps(3) list.distinct(1) list.inject)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1378
  apply (metis arexp.distinct(7) bsimp_AALTs.elims good.simps(1) good_fuse list.distinct(1) list.inject)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1379
    apply (metis arexp.distinct(7) bsimp_AALTs.elims list.distinct(1) list.inject)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1380
  apply (metis arexp.distinct(7) bsimp_AALTs.elims flts2 good.simps(1) good.simps(33) good0 k0b list.distinct(1) list.inject nonalt.simps(6))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1381
  by (metis (no_types, lifting) Nil_is_append_conv append_Nil2 arexp.distinct(7) bsimp_AALTs.elims butlast.simps(2) butlast_append flts1 flts2 good.simps(1) good0 k0a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1382
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1383
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1384
lemma flts_nil:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1385
  assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow>
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1386
            good (bsimp y) \<or> bsimp y = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1387
  and "\<forall>r\<in>set rs. \<not> good (bsimp r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1388
  shows "flts (map bsimp rs) = []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1389
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1390
  apply(induct rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1391
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1392
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1393
  apply(subst k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1394
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1395
  by force
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1396
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1397
lemma flts_nil2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1398
  assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow>
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1399
            good (bsimp y) \<or> bsimp y = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1400
  and "bsimp_AALTs bs (flts (map bsimp rs)) = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1401
  shows "flts (map bsimp rs) = []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1402
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1403
  apply(induct rs arbitrary: bs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1404
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1405
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1406
  apply(subst k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1407
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1408
  apply(subst (asm) k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1409
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1410
  apply (metis flts.simps(1) flts.simps(2) flts4 k0 less_add_Suc1 list.set_intros(1))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1411
  by (metis flts.simps(2) flts4 k0 less_add_Suc1 list.set_intros(1))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1412
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1413
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1414
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1415
lemma good_SEQ:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1416
  assumes "r1 \<noteq> AZERO" "r2 \<noteq> AZERO" "\<forall>bs. r1 \<noteq> AONE bs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1417
  shows "good (ASEQ bs r1 r2) = (good r1 \<and> good r2)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1418
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1419
  apply(case_tac r1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1420
       apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1421
  apply(case_tac r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1422
          apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1423
  apply(case_tac r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1424
         apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1425
  apply(case_tac r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1426
        apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1427
  apply(case_tac r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1428
       apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1429
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1430
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1431
lemma good1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1432
  shows "good (bsimp a) \<or> bsimp a = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1433
  apply(induct a taking: asize rule: measure_induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1434
  apply(case_tac x)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1435
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1436
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1437
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1438
  prefer 3
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1439
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1440
   prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1441
  (*  AALTs case  *)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1442
  apply(simp only:)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1443
   apply(case_tac "x52")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1444
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1445
  thm good0a
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1446
   (*  AALTs list at least one - case *)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1447
   apply(simp only: )
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1448
  apply(frule_tac x="a" in spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1449
   apply(drule mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1450
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1451
   (* either first element is good, or AZERO *)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1452
    apply(erule disjE)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1453
     prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1454
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1455
   (* in  the AZERO case, the size  is smaller *)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1456
   apply(drule_tac x="AALTs x51 list" in spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1457
   apply(drule mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1458
     apply(simp add: asize0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1459
    apply(subst (asm) bsimp.simps)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1460
  apply(subst (asm) bsimp.simps)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1461
    apply(assumption)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1462
   (* in the good case *)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1463
  apply(frule_tac x="AALTs x51 list" in spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1464
   apply(drule mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1465
    apply(simp add: asize0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1466
   apply(erule disjE)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1467
    apply(rule disjI1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1468
  apply(simp add: good0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1469
    apply(subst good0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1470
      apply (metis Nil_is_append_conv flts1 k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1471
  apply (metis ex_map_conv list.simps(9) nn1b nn1c)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1472
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1473
    apply(subst k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1474
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1475
    apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1476
  using flts2 apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1477
    apply(subst  (asm) good0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1478
      prefer 3
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1479
      apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1480
     apply auto[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1481
    apply (metis ex_map_conv nn1b nn1c)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1482
  (* in  the AZERO case *)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1483
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1484
   apply(frule_tac x="a" in spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1485
   apply(drule mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1486
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1487
   apply(erule disjE)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1488
    apply(rule disjI1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1489
    apply(subst good0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1490
  apply(subst k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1491
  using flts1 apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1492
     apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1493
  apply (metis (no_types, hide_lams) ex_map_conv list.simps(9) nn1b nn1c)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1494
    apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1495
  apply(subst (asm) k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1496
  apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1497
  using flts2 apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1498
  apply(frule_tac x="AALTs x51 list" in spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1499
   apply(drule mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1500
     apply(simp add: asize0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1501
    apply(erule disjE)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1502
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1503
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1504
  apply (metis add.left_commute flts_nil2 less_add_Suc1 less_imp_Suc_add list.distinct(1) list.set_cases nat.inject)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1505
   apply(subst (2) k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1506
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1507
  (* SEQ case *)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1508
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1509
  apply(case_tac "bsimp x42 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1510
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1511
 apply(case_tac "bsimp x43 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1512
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1513
    apply(subst (2) bsimp_ASEQ0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1514
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1515
  apply(case_tac "\<exists>bs. bsimp x42 = AONE bs")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1516
    apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1517
   apply(subst bsimp_ASEQ2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1518
  using good_fuse apply force
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1519
   apply(subst bsimp_ASEQ1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1520
     apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1521
  apply(subst  good_SEQ)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1522
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1523
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1524
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1525
  using less_add_Suc1 less_add_Suc2 by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1526
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1527
lemma good1a:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1528
  assumes "L(erase a) \<noteq> {}"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1529
  shows "good (bsimp a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1530
  using good1 assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1531
  using L_bsimp_erase by force
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1532
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1533
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1534
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1535
lemma flts_append:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1536
  "flts (xs1 @ xs2) = flts xs1 @ flts xs2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1537
  apply(induct xs1  arbitrary: xs2  rule: rev_induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1538
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1539
  apply(case_tac xs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1540
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1541
   apply(case_tac x)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1542
        apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1543
  apply(case_tac x)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1544
        apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1545
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1546
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1547
lemma g1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1548
  assumes "good (bsimp_AALTs bs rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1549
  shows "bsimp_AALTs bs rs = AALTs bs rs \<or> (\<exists>r. rs = [r] \<and> bsimp_AALTs bs [r] = fuse bs r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1550
using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1551
    apply(induct rs arbitrary: bs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1552
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1553
  apply(case_tac rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1554
  apply(simp only:)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1555
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1556
  apply(case_tac  list)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1557
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1558
  by simp
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1559
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1560
lemma flts_0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1561
  assumes "nonnested (AALTs bs  rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1562
  shows "\<forall>r \<in> set (flts rs). r \<noteq> AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1563
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1564
  apply(induct rs arbitrary: bs rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1565
        apply(simp) 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1566
       apply(simp) 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1567
      defer
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1568
      apply(simp) 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1569
     apply(simp) 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1570
    apply(simp) 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1571
apply(simp) 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1572
  apply(rule ballI)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1573
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1574
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1575
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1576
lemma flts_0a:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1577
  assumes "nonnested (AALTs bs  rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1578
  shows "AZERO \<notin> set (flts rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1579
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1580
  using flts_0 by blast 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1581
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1582
lemma qqq1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1583
  shows "AZERO \<notin> set (flts (map bsimp rs))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1584
  by (metis ex_map_conv flts3 good.simps(1) good1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1585
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1586
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1587
fun nonazero :: "arexp \<Rightarrow> bool"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1588
  where
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1589
  "nonazero AZERO = False"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1590
| "nonazero r = True"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1591
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1592
lemma flts_concat:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1593
  shows "flts rs = concat (map (\<lambda>r. flts [r]) rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1594
  apply(induct rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1595
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1596
  apply(subst k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1597
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1598
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1599
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1600
lemma flts_single1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1601
  assumes "nonalt r" "nonazero r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1602
  shows "flts [r] = [r]"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1603
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1604
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1605
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1606
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1607
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1608
lemma flts_qq:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1609
  assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow> good y \<longrightarrow> bsimp y = y" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1610
          "\<forall>r'\<in>set rs. good r' \<and> nonalt r'"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1611
  shows "flts (map bsimp rs) = rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1612
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1613
  apply(induct rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1614
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1615
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1616
  apply(subst k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1617
  apply(subgoal_tac "flts [bsimp a] =  [a]")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1618
   prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1619
   apply(drule_tac x="a" in spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1620
   apply(drule mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1621
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1622
   apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1623
  using good.simps(1) k0b apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1624
  apply(auto)[1]  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1625
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1626
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1627
lemma test:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1628
  assumes "good r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1629
  shows "bsimp r = r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1630
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1631
  apply(induct r taking: "asize" rule: measure_induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1632
  apply(erule good.elims)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1633
  apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1634
  apply(subst k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1635
  apply(subst (2) k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1636
                apply(subst flts_qq)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1637
                  apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1638
                 apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1639
                apply (metis append_Cons append_Nil bsimp_AALTs.simps(3) good.simps(1) k0b)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1640
               apply force+
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1641
  apply (metis (no_types, lifting) add_Suc add_Suc_right asize.simps(5) bsimp.simps(1) bsimp_ASEQ.simps(19) less_add_Suc1 less_add_Suc2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1642
  apply (metis add_Suc add_Suc_right arexp.distinct(5) arexp.distinct(7) asize.simps(4) asize.simps(5) bsimp.simps(1) bsimp.simps(2) bsimp_ASEQ1 good.simps(21) good.simps(8) less_add_Suc1 less_add_Suc2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1643
         apply force+
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1644
  apply (metis (no_types, lifting) add_Suc add_Suc_right arexp.distinct(5) arexp.distinct(7) asize.simps(4) asize.simps(5) bsimp.simps(1) bsimp.simps(2) bsimp_ASEQ1 good.simps(25) good.simps(8) less_add_Suc1 less_add_Suc2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1645
  apply (metis add_Suc add_Suc_right arexp.distinct(7) asize.simps(4) bsimp.simps(2) bsimp_ASEQ1 good.simps(26) good.simps(8) less_add_Suc1 less_add_Suc2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1646
    apply force+
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1647
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1648
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1649
lemma test2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1650
  assumes "good r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1651
  shows "bsimp r = r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1652
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1653
  apply(induct r taking: "asize" rule: measure_induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1654
  apply(case_tac x)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1655
       apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1656
   defer  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1657
  (* AALT case *)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1658
   apply(subgoal_tac "1 < length x52")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1659
    prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1660
    apply(case_tac x52)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1661
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1662
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1663
    apply(case_tac list)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1664
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1665
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1666
    apply(subst bsimp_AALTs_qq)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1667
    prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1668
    apply(subst flts_qq)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1669
      apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1670
     apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1671
   apply(case_tac x52)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1672
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1673
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1674
    apply(case_tac list)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1675
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1676
      apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1677
      apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1678
  apply (metis (no_types, lifting) bsimp_AALTs.elims good.simps(6) length_Cons length_pos_if_in_set list.size(3) nat_neq_iff)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1679
  apply(simp)  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1680
  apply(case_tac x52)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1681
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1682
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1683
    apply(case_tac list)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1684
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1685
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1686
   apply(subst k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1687
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1688
   apply(subst (2) k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1689
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1690
  apply (simp add: Suc_lessI flts1 one_is_add)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1691
  (* SEQ case *)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1692
  apply(case_tac "bsimp x42 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1693
   apply simp
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1694
  apply (metis asize.elims good.simps(10) good.simps(11) good.simps(12) good.simps(2) good.simps(7) good.simps(9) good_SEQ less_add_Suc1)  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1695
   apply(case_tac "\<exists>bs'. bsimp x42 = AONE bs'")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1696
   apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1697
  defer
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1698
  apply(case_tac "bsimp x43 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1699
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1700
  apply (metis bsimp.elims bsimp.simps(3) good.simps(10) good.simps(11) good.simps(12) good.simps(8) good.simps(9) good_SEQ less_add_Suc2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1701
  apply(auto)  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1702
   apply (subst bsimp_ASEQ1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1703
      apply(auto)[3]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1704
   apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1705
    apply (metis bsimp.simps(3) good.simps(2) good_SEQ less_add_Suc1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1706
   apply (metis bsimp.simps(3) good.simps(2) good_SEQ less_add_Suc1 less_add_Suc2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1707
  apply (subst bsimp_ASEQ2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1708
  apply(drule_tac x="x42" in spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1709
  apply(drule mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1710
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1711
  apply(drule mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1712
   apply (metis bsimp.elims bsimp.simps(3) good.simps(10) good.simps(11) good.simps(2) good_SEQ)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1713
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1714
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1715
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1716
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1717
lemma bsimp_idem:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1718
  shows "bsimp (bsimp r) = bsimp r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1719
  using test good1
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1720
  by force
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1721
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1722
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1723
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1724
lemma contains48:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1725
  assumes "\<And>x2aa bs bs1. \<lbrakk>x2aa \<in> set x2a; fuse bs x2aa >> bs @ bs1\<rbrakk> \<Longrightarrow> x2aa >> bs1" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1726
          "AALTs (bs @ x1) x2a >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1727
        shows "AALTs x1 x2a >> bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1728
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1729
  apply(induct x2a arbitrary: bs x1 bs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1730
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1731
   apply(erule contains.cases)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1732
         apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1733
  apply(erule contains.cases)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1734
        apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1735
  apply (simp add: contains.intros(4))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1736
  using contains.intros(5) by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1737
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1738
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1739
lemma contains49:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1740
  assumes "fuse bs a >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1741
  shows "a >> bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1742
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1743
  apply(induct a arbitrary: bs bs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1744
       apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1745
  using contains.simps apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1746
      apply(erule contains.cases)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1747
            apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1748
  apply(rule contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1749
    apply(erule contains.cases)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1750
            apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1751
     apply(rule contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1752
  apply(erule contains.cases)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1753
            apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1754
  apply(rule contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1755
     apply(auto)[2]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1756
  prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1757
  apply(erule contains.cases)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1758
         apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1759
  apply (simp add: contains.intros(6))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1760
  using contains.intros(7) apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1761
  using contains48 by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1762
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1763
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1764
lemma contains50_IFF2:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1765
  shows "bsimp_AALTs bs [a] >> bs @ bs1 \<longleftrightarrow> fuse bs a >> bs @ bs1"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1766
  by simp
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1767
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1768
lemma contains50_IFF3:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1769
  shows "bsimp_AALTs bs as >> bs @ bs1  \<longleftrightarrow> (\<exists>a \<in> set as. fuse bs a >> bs @ bs1)"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1770
apply(induct as arbitrary: bs bs1)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1771
   apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1772
   apply(auto elim: contains.cases simp add: contains0)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1773
   apply(case_tac as)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1774
     apply(auto)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1775
  apply(case_tac list)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1776
     apply(auto)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1777
  apply(erule contains.cases)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1778
            apply(auto)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1779
      apply (simp add: contains0)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1780
apply(erule contains.cases)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1781
            apply(auto)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1782
  using contains0 apply auto[1]
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1783
  apply(erule contains.cases)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1784
           apply(auto)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1785
 apply(erule contains.cases)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1786
          apply(auto)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1787
  using contains0 apply blast
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1788
  apply (metis bsimp_AALTs.simps(2) bsimp_AALTs.simps(3) contains.intros(4) contains49 list.exhaust)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1789
  by (smt bsimp_AALTs.simps(3) contains.intros(4) contains.intros(5) contains49 list.set_cases)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1790
  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1791
lemma contains50_IFF4:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1792
  shows "bsimp_AALTs bs as >> bs @ bs1  \<longleftrightarrow> (\<exists>a \<in> set as. a >> bs1)"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1793
  by (meson contains0 contains49 contains50_IFF3)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1794
  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  1795
  
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1796
lemma contains50:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1797
  assumes "bsimp_AALTs bs rs2 >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1798
  shows "bsimp_AALTs bs (rs1 @ rs2) >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1799
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1800
  apply(induct rs1 arbitrary: bs rs2 bs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1801
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1802
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1803
  apply(case_tac rs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1804
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1805
   apply(case_tac rs2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1806
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1807
  using contains.simps apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1808
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1809
  apply(case_tac list)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1810
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1811
    apply(rule contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1812
    back
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1813
    apply(rule contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1814
  using contains49 apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1815
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1816
  using contains.intros(5) apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1817
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1818
  by (metis bsimp_AALTs.elims contains.intros(4) contains.intros(5) contains49 list.distinct(1))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1819
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1820
lemma contains51:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1821
  assumes "bsimp_AALTs bs [r] >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1822
  shows "bsimp_AALTs bs ([r] @ rs2) >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1823
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1824
  apply(induct rs2 arbitrary: bs r bs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1825
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1826
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1827
  using contains.intros(4) contains49 by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1828
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1829
lemma contains51a:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1830
  assumes "bsimp_AALTs bs rs2 >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1831
  shows "bsimp_AALTs bs (rs2 @ [r]) >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1832
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1833
  apply(induct rs2 arbitrary: bs r bs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1834
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1835
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1836
  using contains.simps apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1837
  apply(case_tac rs2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1838
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1839
  using contains3b contains49 apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1840
  apply(case_tac list)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1841
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1842
  apply(erule contains.cases)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1843
         apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1844
  using contains.intros(4) apply auto[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1845
   apply(erule contains.cases)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1846
         apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1847
    apply (simp add: contains.intros(4) contains.intros(5))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1848
   apply (simp add: contains.intros(5))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1849
  apply(erule contains.cases)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1850
        apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1851
   apply (simp add: contains.intros(4))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1852
   apply(erule contains.cases)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1853
        apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1854
  using contains.intros(4) contains.intros(5) apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1855
  using contains.intros(5) by blast  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1856
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1857
lemma contains51b:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1858
  assumes "bsimp_AALTs bs rs >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1859
  shows "bsimp_AALTs bs (rs @ rs2) >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1860
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1861
  apply(induct rs2 arbitrary: bs rs bs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1862
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1863
  using contains51a by fastforce
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1864
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1865
lemma contains51c:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1866
  assumes "AALTs (bs @ bs2) rs >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1867
  shows "bsimp_AALTs bs (map (fuse bs2) rs) >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1868
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1869
  apply(induct rs arbitrary: bs bs1 bs2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1870
       apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1871
  apply(erule contains.cases)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1872
        apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1873
  apply(erule contains.cases)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1874
        apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1875
  using contains0 contains51 apply auto[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1876
  by (metis append.left_neutral append_Cons contains50 list.simps(9))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1877
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1878
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1879
lemma contains51d:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1880
  assumes "fuse bs r >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1881
  shows "bsimp_AALTs bs (flts [r]) >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1882
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1883
  apply(induct r arbitrary: bs bs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1884
       apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1885
  by (simp add: contains51c)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1886
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1887
lemma contains52:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1888
  assumes "\<exists>r \<in> set rs. (fuse bs r) >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1889
  shows "bsimp_AALTs bs (flts rs) >> bs @ bs1"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1890
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1891
  apply(induct rs arbitrary: bs bs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1892
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1893
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1894
   defer
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1895
   apply (metis contains50 k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1896
  apply(subst k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1897
  apply(rule contains51b)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1898
  using contains51d by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1899
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1900
lemma contains55:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1901
  assumes "a >> bs" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1902
  shows "bsimp a >> bs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1903
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1904
  apply(induct a bs arbitrary:)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1905
        apply(auto intro: contains.intros)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1906
    apply(case_tac "bsimp a1 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1907
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1908
  using contains.simps apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1909
  apply(case_tac "bsimp a2 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1910
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1911
  using contains.simps apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1912
  apply(case_tac "\<exists>bs. bsimp a1 = AONE bs")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1913
     apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1914
     apply(rotate_tac 1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1915
     apply(erule contains.cases)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1916
           apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1917
     apply (simp add: b1 contains0 fuse_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1918
    apply (simp add: bsimp_ASEQ1 contains.intros(3))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1919
   prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1920
   apply(case_tac rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1921
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1922
  using contains.simps apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1923
   apply (metis contains50 k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1924
  (* AALTS case *)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1925
  apply(rule contains52)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1926
  apply(rule_tac x="bsimp r" in bexI)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1927
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1928
  using contains0 by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1929
359
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  1930
lemma test1:
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  1931
  shows "AALT [] (ACHAR [Z] c) (ACHAR [S] c) >> [S]"
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  1932
  by (metis contains.intros(2) contains.intros(4) contains.intros(5) self_append_conv2)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  1933
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  1934
lemma test1a:
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  1935
  shows "bsimp (AALT [] (ACHAR [Z] c) (ACHAR [S] c)) = AALT [] (ACHAR [Z] c) (ACHAR [S] c)"
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  1936
  apply(simp)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  1937
  done
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1938
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1939
lemma q3a:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1940
  assumes "\<exists>r \<in> set rs. bnullable r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1941
  shows "bmkeps (AALTs bs (map (fuse bs1) rs)) = bmkeps (AALTs (bs@bs1) rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1942
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1943
  apply(induct rs arbitrary: bs bs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1944
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1945
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1946
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1947
   apply (metis append_assoc b2 bnullable_correctness erase_fuse r0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1948
  apply(case_tac "bnullable a")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1949
   apply (metis append.assoc b2 bnullable_correctness erase_fuse r0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1950
  apply(case_tac rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1951
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1952
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1953
  apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1954
   apply (metis bnullable_correctness erase_fuse)+
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1955
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1956
338
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
  1957
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
  1958
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
  1959
lemma qq4a:
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1960
  assumes "\<exists>x\<in>set list. bnullable x"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1961
  shows "\<exists>x\<in>set (flts list). bnullable x"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1962
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1963
  apply(induct list rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1964
        apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1965
  by (metis UnCI bnullable_correctness erase_fuse imageI)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1966
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1967
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1968
lemma qs3:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1969
  assumes "\<exists>r \<in> set rs. bnullable r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1970
  shows "bmkeps (AALTs bs rs) = bmkeps (AALTs bs (flts rs))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1971
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1972
  apply(induct rs arbitrary: bs taking: size rule: measure_induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1973
  apply(case_tac x)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1974
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1975
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1976
  apply(case_tac a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1977
       apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1978
       apply (simp add: r1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1979
      apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1980
      apply (simp add: r0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1981
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1982
     apply(case_tac "flts list")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1983
      apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1984
  apply (metis L_erase_AALTs L_erase_flts L_flat_Prf1 L_flat_Prf2 Prf_elims(1) bnullable_correctness erase.simps(4) mkeps_nullable r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1985
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1986
     apply (simp add: r1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1987
    prefer 3
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1988
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1989
    apply (simp add: r0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1990
   prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1991
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1992
  apply(case_tac "\<exists>x\<in>set x52. bnullable x")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1993
  apply(case_tac "list")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1994
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1995
    apply (metis b2 fuse.simps(4) q3a r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1996
   apply(erule disjE)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1997
    apply(subst qq1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1998
     apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1999
     apply (metis bnullable_correctness erase_fuse)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2000
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2001
     apply (metis b2 fuse.simps(4) q3a r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2002
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2003
    apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2004
     apply(subst qq1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2005
      apply (metis bnullable_correctness erase_fuse image_eqI set_map)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2006
     apply (metis b2 fuse.simps(4) q3a r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2007
  apply(subst qq1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2008
      apply (metis bnullable_correctness erase_fuse image_eqI set_map)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2009
    apply (metis b2 fuse.simps(4) q3a r2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2010
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2011
   apply(subst qq2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2012
     apply (metis bnullable_correctness erase_fuse imageE set_map)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2013
  prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2014
  apply(case_tac "list")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2015
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2016
    apply(simp)
338
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
  2017
   apply (simp add: qq4a)
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2018
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2019
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2020
   apply(case_tac list)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2021
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2022
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2023
   apply (simp add: r0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2024
  apply(case_tac "bnullable (ASEQ x41 x42 x43)")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2025
   apply(case_tac list)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2026
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2027
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2028
   apply (simp add: r0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2029
  apply(simp)
338
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
  2030
  using qq4a r1 r2 by auto
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2031
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2032
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2033
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2034
lemma k1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2035
  assumes "\<And>x2aa. \<lbrakk>x2aa \<in> set x2a; bnullable x2aa\<rbrakk> \<Longrightarrow> bmkeps x2aa = bmkeps (bsimp x2aa)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2036
          "\<exists>x\<in>set x2a. bnullable x"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2037
        shows "bmkeps (AALTs x1 (flts x2a)) = bmkeps (AALTs x1 (flts (map bsimp x2a)))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2038
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2039
  apply(induct x2a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2040
  apply fastforce
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2041
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2042
  apply(subst k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2043
  apply(subst (2) k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2044
  apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2045
  apply (metis b3 k0 list.set_intros(1) qs3 r0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2046
  by (smt b3 imageI insert_iff k0 list.set(2) qq3 qs3 r0 r1 set_map)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2047
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2048
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2049
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2050
lemma bmkeps_simp:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2051
  assumes "bnullable r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2052
  shows "bmkeps r = bmkeps (bsimp r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2053
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2054
  apply(induct r)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2055
       apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2056
      apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2057
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2058
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2059
    prefer 3
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2060
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2061
   apply(case_tac "bsimp r1 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2062
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2063
    apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2064
  apply (metis L_bsimp_erase L_flat_Prf1 L_flat_Prf2 Prf_elims(1) bnullable_correctness erase.simps(1) mkeps_nullable)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2065
 apply(case_tac "bsimp r2 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2066
    apply(simp)  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2067
    apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2068
  apply (metis L_bsimp_erase L_flat_Prf1 L_flat_Prf2 Prf_elims(1) bnullable_correctness erase.simps(1) mkeps_nullable)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2069
  apply(case_tac "\<exists>bs. bsimp r1 = AONE bs")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2070
    apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2071
    apply(subst b1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2072
    apply(subst b2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2073
  apply(simp add: b3[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2074
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2075
   apply(subgoal_tac "bsimp_ASEQ x1 (bsimp r1) (bsimp r2) = ASEQ x1 (bsimp r1) (bsimp r2)")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2076
    prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2077
  apply (smt b3 bnullable.elims(2) bsimp_ASEQ.simps(17) bsimp_ASEQ.simps(19) bsimp_ASEQ.simps(20) bsimp_ASEQ.simps(21) bsimp_ASEQ.simps(22) bsimp_ASEQ.simps(24) bsimp_ASEQ.simps(25) bsimp_ASEQ.simps(26) bsimp_ASEQ.simps(27) bsimp_ASEQ.simps(29) bsimp_ASEQ.simps(30) bsimp_ASEQ.simps(31))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2078
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2079
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2080
  thm q3
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2081
  apply(subst q3[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2082
   apply simp
338
c40348a77318 updated
Christian Urban <urbanc@in.tum.de>
parents: 337
diff changeset
  2083
  using b3 qq4a apply auto[1]
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2084
  apply(subst qs3)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2085
   apply simp
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2086
  using k1 by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2087
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2088
thm bmkeps_retrieve bmkeps_simp bder_retrieve
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2089
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2090
lemma bmkeps_bder_AALTs:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2091
  assumes "\<exists>r \<in> set rs. bnullable (bder c r)" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2092
  shows "bmkeps (bder c (bsimp_AALTs bs rs)) = bmkeps (bsimp_AALTs bs (map (bder c) rs))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2093
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2094
  apply(induct rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2095
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2096
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2097
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2098
  apply(case_tac rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2099
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2100
  apply (metis (full_types) Prf_injval bder_retrieve bmkeps_retrieve bnullable_correctness erase_bder erase_fuse mkeps_nullable retrieve_fuse2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2101
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2102
  apply(case_tac  rs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2103
   apply(simp_all)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2104
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2105
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2106
lemma bbs0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2107
  shows "blexer_simp r [] = blexer r []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2108
  apply(simp add: blexer_def blexer_simp_def)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2109
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2110
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2111
lemma bbs1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2112
  shows "blexer_simp r [c] = blexer r [c]"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2113
  apply(simp add: blexer_def blexer_simp_def)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2114
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2115
    defer
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2116
  using b3 apply auto[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2117
  using b3 apply auto[1]  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2118
  apply(subst bmkeps_simp[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2119
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2120
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2121
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2122
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2123
lemma oo:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2124
  shows "(case (blexer (der c r) s) of None \<Rightarrow> None | Some v \<Rightarrow> Some (injval r c v)) = blexer r (c # s)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2125
  apply(simp add: blexer_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2126
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2127
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2128
lemma XXX2_helper:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2129
  assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow> good y \<longrightarrow> bsimp y = y" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2130
          "\<forall>r'\<in>set rs. good r' \<and> nonalt r'"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2131
  shows "flts (map (bsimp \<circ> bder c) (flts (map bsimp rs))) = flts (map (bsimp \<circ> bder c) rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2132
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2133
  apply(induct rs arbitrary: c)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2134
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2135
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2136
  apply(subst k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2137
  apply(simp add: flts_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2138
  apply(subst (2) k0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2139
  apply(simp add: flts_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2140
  apply(subgoal_tac "flts [a] =  [a]")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2141
   prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2142
  using good.simps(1) k0b apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2143
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2144
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2145
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2146
lemma bmkeps_good:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2147
  assumes "good a"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2148
  shows "bmkeps (bsimp a) = bmkeps a"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2149
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2150
  using test2 by auto
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2151
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2152
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2153
lemma xxx_bder:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2154
  assumes "good r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2155
  shows "L (erase r) \<noteq> {}"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2156
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2157
  apply(induct r rule: good.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2158
  apply(auto simp add: Sequ_def)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2159
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2160
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2161
lemma xxx_bder2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2162
  assumes "L (erase (bsimp r)) = {}"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2163
  shows "bsimp r = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2164
  using assms xxx_bder test2 good1
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2165
  by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2166
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2167
lemma XXX2aa:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2168
  assumes "good a"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2169
  shows "bsimp (bder c (bsimp a)) = bsimp (bder c a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2170
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2171
  by (simp add: test2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2172
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2173
lemma XXX2aa_ders:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2174
  assumes "good a"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2175
  shows "bsimp (bders (bsimp a) s) = bsimp (bders a s)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2176
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2177
  by (simp add: test2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2178
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2179
lemma XXX4a:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2180
  shows "good (bders_simp (bsimp r) s)  \<or> bders_simp (bsimp r) s = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2181
  apply(induct s arbitrary: r rule:  rev_induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2182
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2183
  apply (simp add: good1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2184
  apply(simp add: bders_simp_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2185
  apply (simp add: good1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2186
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2187
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2188
lemma XXX4a_good:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2189
  assumes "good a"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2190
  shows "good (bders_simp a s) \<or> bders_simp a s = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2191
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2192
  apply(induct s arbitrary: a rule:  rev_induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2193
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2194
  apply(simp add: bders_simp_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2195
  apply (simp add: good1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2196
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2197
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2198
lemma XXX4a_good_cons:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2199
  assumes "s \<noteq> []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2200
  shows "good (bders_simp a s) \<or> bders_simp a s = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2201
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2202
  apply(case_tac s)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2203
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2204
  using XXX4a by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2205
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2206
lemma XXX4b:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2207
  assumes "good a" "L (erase (bders_simp a s)) \<noteq> {}"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2208
  shows "good (bders_simp a s)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2209
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2210
  apply(induct s arbitrary: a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2211
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2212
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2213
  apply(subgoal_tac "L (erase (bder a aa)) = {} \<or> L (erase (bder a aa)) \<noteq> {}")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2214
   prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2215
   apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2216
  apply(erule disjE)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2217
   apply(subgoal_tac "bsimp (bder a aa) = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2218
    prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2219
  using L_bsimp_erase xxx_bder2 apply auto[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2220
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2221
  apply (metis L.simps(1) XXX4a erase.simps(1))  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2222
  apply(drule_tac x="bsimp (bder a aa)" in meta_spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2223
  apply(drule meta_mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2224
  apply simp
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2225
  apply(rule good1a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2226
  apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2227
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2228
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2229
lemma bders_AZERO:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2230
  shows "bders AZERO s = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2231
  and   "bders_simp AZERO s = AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2232
   apply (induct s)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2233
     apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2234
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2235
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2236
lemma LA:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2237
  assumes "\<Turnstile> v : ders s (erase r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2238
  shows "retrieve (bders r s) v = retrieve r (flex (erase r) id s v)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2239
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2240
  apply(induct s arbitrary: r v rule: rev_induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2241
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2242
  apply(simp add: bders_append ders_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2243
  apply(subst bder_retrieve)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2244
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2245
  apply(drule Prf_injval)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2246
  by (simp add: flex_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2247
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2248
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2249
lemma LB:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2250
  assumes "s \<in> (erase r) \<rightarrow> v" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2251
  shows "retrieve r v = retrieve r (flex (erase r) id s (mkeps (ders s (erase r))))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2252
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2253
  apply(induct s arbitrary: r v rule: rev_induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2254
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2255
   apply(subgoal_tac "v = mkeps (erase r)")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2256
    prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2257
  apply (simp add: Posix1(1) Posix_determ Posix_mkeps nullable_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2258
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2259
  apply(simp add: flex_append ders_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2260
  by (metis Posix_determ Posix_flex Posix_injval Posix_mkeps ders_snoc lexer_correctness(2) lexer_flex)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2261
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2262
lemma LB_sym:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2263
  assumes "s \<in> (erase r) \<rightarrow> v" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2264
  shows "retrieve r v = retrieve r (flex (erase r) id s (mkeps (erase (bders r s))))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2265
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2266
  by (simp add: LB)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2267
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2268
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2269
lemma LC:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2270
  assumes "s \<in> (erase r) \<rightarrow> v" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2271
  shows "retrieve r v = retrieve (bders r s) (mkeps (erase (bders r s)))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2272
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2273
  by (metis LA LB Posix1(1) assms lexer_correct_None lexer_flex mkeps_nullable)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2274
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2275
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2276
lemma L0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2277
  assumes "bnullable a"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2278
  shows "retrieve (bsimp a) (mkeps (erase (bsimp a))) = retrieve a (mkeps (erase a))"
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2279
  using assms b3 bmkeps_retrieve bmkeps_simp bnullable_correctness
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2280
  by (metis b3 bmkeps_retrieve bmkeps_simp bnullable_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2281
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2282
thm bmkeps_retrieve
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2283
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2284
lemma L0a:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2285
  assumes "s \<in> L(erase a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2286
  shows "retrieve (bsimp (bders a s)) (mkeps (erase (bsimp (bders a s)))) = 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2287
         retrieve (bders a s) (mkeps (erase (bders a s)))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2288
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2289
  by (metis L0 bnullable_correctness erase_bders lexer_correct_None lexer_flex)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2290
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2291
lemma L0aa:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2292
  assumes "s \<in> L (erase a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2293
  shows "[] \<in> erase (bsimp (bders a s)) \<rightarrow> mkeps (erase (bsimp (bders a s)))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2294
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2295
  by (metis Posix_mkeps b3 bnullable_correctness erase_bders lexer_correct_None lexer_flex)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2296
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2297
lemma L0aaa:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2298
  assumes "[c] \<in> L (erase a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2299
  shows "[c] \<in> (erase a) \<rightarrow> flex (erase a) id [c] (mkeps (erase (bder c a)))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2300
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2301
  by (metis bders.simps(1) bders.simps(2) erase_bders lexer_correct_None lexer_correct_Some lexer_flex option.inject)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2302
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2303
lemma L0aaaa:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2304
  assumes "[c] \<in> L (erase a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2305
  shows "[c] \<in> (erase a) \<rightarrow> flex (erase a) id [c] (mkeps (erase (bders a [c])))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2306
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2307
  using L0aaa by auto
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2308
    
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2309
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2310
lemma L02:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2311
  assumes "bnullable (bder c a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2312
  shows "retrieve (bsimp a) (flex (erase (bsimp a)) id [c] (mkeps (erase (bder c (bsimp a))))) = 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2313
         retrieve (bder c (bsimp a)) (mkeps (erase (bder c (bsimp a))))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2314
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2315
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2316
  using bder_retrieve L0 bmkeps_simp bmkeps_retrieve L0  LA LB
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2317
  apply(subst bder_retrieve[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2318
  apply (metis L_bsimp_erase bnullable_correctness der_correctness erase_bder mkeps_nullable nullable_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2319
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2320
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2321
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2322
lemma L02_bders:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2323
  assumes "bnullable (bders a s)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2324
  shows "retrieve (bsimp a) (flex (erase (bsimp a)) id s (mkeps (erase (bders (bsimp a) s)))) = 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2325
         retrieve (bders (bsimp a) s) (mkeps (erase (bders (bsimp a) s)))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2326
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2327
  by (metis LA L_bsimp_erase bnullable_correctness ders_correctness erase_bders mkeps_nullable nullable_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2328
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2329
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2330
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2331
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2332
lemma L03:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2333
  assumes "bnullable (bder c a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2334
  shows "retrieve (bder c (bsimp a)) (mkeps (erase (bder c (bsimp a)))) =
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2335
         bmkeps (bsimp (bder c (bsimp a)))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2336
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2337
  by (metis L0 L_bsimp_erase bmkeps_retrieve bnullable_correctness der_correctness erase_bder nullable_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2338
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2339
lemma L04:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2340
  assumes "bnullable (bder c a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2341
  shows "retrieve (bder c (bsimp a)) (mkeps (erase (bder c (bsimp a)))) =
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2342
         retrieve (bsimp (bder c (bsimp a))) (mkeps (erase (bsimp (bder c (bsimp a)))))"     
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2343
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2344
  by (metis L0 L_bsimp_erase bnullable_correctness der_correctness erase_bder nullable_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2345
    
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2346
lemma L05:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2347
  assumes "bnullable (bder c a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2348
  shows "retrieve (bder c (bsimp a)) (mkeps (erase (bder c (bsimp a)))) =
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2349
         retrieve (bsimp (bder c (bsimp a))) (mkeps (erase (bsimp (bder c (bsimp a)))))" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2350
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2351
  using L04 by auto 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2352
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2353
lemma L06:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2354
  assumes "bnullable (bder c a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2355
  shows "bmkeps (bder c (bsimp a)) = bmkeps (bsimp (bder c (bsimp a)))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2356
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2357
  by (metis L03 L_bsimp_erase bmkeps_retrieve bnullable_correctness der_correctness erase_bder nullable_correctness) 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2358
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2359
lemma L07:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2360
  assumes "s \<in> L (erase r)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2361
  shows "retrieve r (flex (erase r) id s (mkeps (ders s (erase r)))) 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2362
            = retrieve (bders r s) (mkeps (erase (bders r s)))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2363
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2364
  using LB LC lexer_correct_Some by auto
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2365
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2366
lemma L06_2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2367
  assumes "bnullable (bders a [c,d])"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2368
  shows "bmkeps (bders (bsimp a) [c,d]) = bmkeps (bsimp (bders (bsimp a) [c,d]))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2369
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2370
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2371
  by (metis L_bsimp_erase bmkeps_simp bnullable_correctness der_correctness erase_bder nullable_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2372
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2373
lemma L06_bders:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2374
  assumes "bnullable (bders a s)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2375
  shows "bmkeps (bders (bsimp a) s) = bmkeps (bsimp (bders (bsimp a) s))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2376
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2377
  by (metis L_bsimp_erase bmkeps_simp bnullable_correctness ders_correctness erase_bders nullable_correctness)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2378
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2379
lemma LLLL:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2380
  shows "L (erase a) =  L (erase (bsimp a))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2381
  and "L (erase a) = {flat v | v. \<Turnstile> v: (erase a)}"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2382
  and "L (erase a) = {flat v | v. \<Turnstile> v: (erase (bsimp a))}"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2383
  using L_bsimp_erase apply(blast)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2384
  apply (simp add: L_flat_Prf)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2385
  using L_bsimp_erase L_flat_Prf apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2386
  done  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2387
    
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2388
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2389
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2390
lemma L07XX:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2391
  assumes "s \<in> L (erase a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2392
  shows "s \<in> erase a \<rightarrow> flex (erase a) id s (mkeps (ders s (erase a)))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2393
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2394
  by (meson lexer_correct_None lexer_correctness(1) lexer_flex)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2395
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2396
lemma LX0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2397
  assumes "s \<in> L r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2398
  shows "decode (bmkeps (bders (intern r) s)) r = Some(flex r id s (mkeps (ders s r)))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2399
  by (metis assms blexer_correctness blexer_def lexer_correct_None lexer_flex)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2400
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2401
lemma L1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2402
  assumes "s \<in> r \<rightarrow> v" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2403
  shows "decode (bmkeps (bders (intern r) s)) r = Some v"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2404
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2405
  by (metis blexer_correctness blexer_def lexer_correctness(1) option.distinct(1))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2406
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2407
lemma L2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2408
  assumes "s \<in> (der c r) \<rightarrow> v" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2409
  shows "decode (bmkeps (bders (intern r) (c # s))) r = Some (injval r c v)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2410
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2411
  apply(subst bmkeps_retrieve)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2412
  using Posix1(1) lexer_correct_None lexer_flex apply fastforce
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2413
  using MAIN_decode
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2414
  apply(subst MAIN_decode[symmetric])
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2415
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2416
   apply (meson Posix1(1) lexer_correct_None lexer_flex mkeps_nullable)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2417
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2418
  apply(subgoal_tac "v = flex (der c r) id s (mkeps (ders s (der c r)))")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2419
   prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2420
   apply (metis Posix_determ lexer_correctness(1) lexer_flex option.distinct(1))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2421
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2422
  apply(subgoal_tac "injval r c (flex (der c r) id s (mkeps (ders s (der c r)))) =
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2423
    (flex (der c r) ((\<lambda>v. injval r c v) o id) s (mkeps (ders s (der c r))))")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2424
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2425
  using flex_fun_apply by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2426
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2427
lemma L3:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2428
  assumes "s2 \<in> (ders s1 r) \<rightarrow> v" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2429
  shows "decode (bmkeps (bders (intern r) (s1 @ s2))) r = Some (flex r id s1 v)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2430
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2431
  apply(induct s1 arbitrary: r s2 v rule: rev_induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2432
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2433
  using L1 apply blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2434
  apply(simp add: ders_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2435
  apply(drule_tac x="r" in meta_spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2436
  apply(drule_tac x="x # s2" in meta_spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2437
  apply(drule_tac x="injval (ders xs r) x v" in meta_spec)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2438
  apply(drule meta_mp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2439
   defer
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2440
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2441
   apply(simp add:  flex_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2442
  by (simp add: Posix_injval)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2443
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2444
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2445
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2446
lemma bders_snoc:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2447
  "bder c (bders a s) = bders a (s @ [c])"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2448
  apply(simp add: bders_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2449
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2450
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2451
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2452
lemma QQ1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2453
  shows "bsimp (bders (bsimp a) []) = bders_simp (bsimp a) []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2454
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2455
  apply(simp add: bsimp_idem)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2456
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2457
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2458
lemma QQ2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2459
  shows "bsimp (bders (bsimp a) [c]) = bders_simp (bsimp a) [c]"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2460
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2461
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2462
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2463
lemma XXX2a_long:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2464
  assumes "good a"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2465
  shows "bsimp (bder c (bsimp a)) = bsimp (bder c a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2466
  using  assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2467
  apply(induct a arbitrary: c taking: asize rule: measure_induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2468
  apply(case_tac x)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2469
       apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2470
      apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2471
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2472
  prefer 3
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2473
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2474
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2475
   apply(auto)[1]
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2476
apply(case_tac "x42 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2477
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2478
   apply(case_tac "x43 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2479
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2480
  using test2 apply force  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2481
  apply(case_tac "\<exists>bs. x42 = AONE bs")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2482
     apply(clarify)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2483
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2484
    apply(subst bsimp_ASEQ1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2485
       apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2486
  using b3 apply force
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2487
  using bsimp_ASEQ0 test2 apply force
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2488
  thm good_SEQ test2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2489
     apply (simp add: good_SEQ test2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2490
    apply (simp add: good_SEQ test2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2491
  apply(case_tac "x42 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2492
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2493
   apply(case_tac "x43 = AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2494
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2495
  apply (simp add: bsimp_ASEQ0)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2496
  apply(case_tac "\<exists>bs. x42 = AONE bs")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2497
     apply(clarify)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2498
     apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2499
    apply(subst bsimp_ASEQ1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2500
      apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2501
  using bsimp_ASEQ0 test2 apply force
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2502
     apply (simp add: good_SEQ test2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2503
    apply (simp add: good_SEQ test2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2504
  apply (simp add: good_SEQ test2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2505
  (* AALTs case *)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2506
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2507
  using test2 by fastforce
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2508
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2509
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2510
lemma bder_bsimp_AALTs:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2511
  shows "bder c (bsimp_AALTs bs rs) = bsimp_AALTs bs (map (bder c) rs)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2512
  apply(induct bs rs rule: bsimp_AALTs.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2513
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2514
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2515
   apply (simp add: bder_fuse)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2516
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2517
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2518
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  2519
lemma bders_bsimp_AALTs:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  2520
  shows "bders (bsimp_AALTs bs rs) s = bsimp_AALTs bs (map (\<lambda>a. bders a s) rs)"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  2521
  apply(induct s arbitrary: bs rs rule: rev_induct)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  2522
    apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  2523
  apply(simp add: bders_append)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  2524
  apply(simp add: bder_bsimp_AALTs)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  2525
  apply(simp add: comp_def)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  2526
  done
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  2527
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2528
lemma flts_nothing:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2529
  assumes "\<forall>r \<in> set rs. r \<noteq> AZERO" "\<forall>r \<in> set rs. nonalt r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2530
  shows "flts rs = rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2531
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2532
  apply(induct rs rule: flts.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2533
        apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2534
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2535
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2536
lemma flts_flts:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2537
  assumes "\<forall>r \<in> set rs. good r"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2538
  shows "flts (flts rs) = flts rs"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2539
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2540
  apply(induct rs taking: "\<lambda>rs. sum_list  (map asize rs)" rule: measure_induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2541
  apply(case_tac x)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2542
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2543
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2544
  apply(case_tac a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2545
       apply(simp_all  add: bder_fuse flts_append)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2546
  apply(subgoal_tac "\<forall>r \<in> set x52. r \<noteq> AZERO")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2547
   prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2548
  apply (metis Nil_is_append_conv bsimp_AALTs.elims good.simps(1) good.simps(5) good0 list.distinct(1) n0 nn1b split_list_last test2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2549
  apply(subgoal_tac "\<forall>r \<in> set x52. nonalt r")
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2550
   prefer 2
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2551
   apply (metis n0 nn1b test2)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2552
  by (metis flts_fuse flts_nothing)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2553
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2554
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2555
lemma iii:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2556
  assumes "bsimp_AALTs bs rs \<noteq> AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2557
  shows "rs \<noteq> []"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2558
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2559
  apply(induct bs  rs rule: bsimp_AALTs.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2560
    apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2561
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2562
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2563
lemma CT1_SEQ:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2564
  shows "bsimp (ASEQ bs a1 a2) = bsimp (ASEQ bs (bsimp a1) (bsimp a2))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2565
  apply(simp add: bsimp_idem)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2566
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2567
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2568
lemma CT1:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2569
  shows "bsimp (AALTs bs as) = bsimp (AALTs bs (map  bsimp as))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2570
  apply(induct as arbitrary: bs)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2571
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2572
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2573
  by (simp add: bsimp_idem comp_def)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2574
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2575
lemma CT1a:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2576
  shows "bsimp (AALT bs a1 a2) = bsimp(AALT bs (bsimp a1) (bsimp a2))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2577
  by (metis CT1 list.simps(8) list.simps(9))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2578
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2579
lemma WWW2:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2580
  shows "bsimp (bsimp_AALTs bs1 (flts (map bsimp as1))) =
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2581
         bsimp_AALTs bs1 (flts (map bsimp as1))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2582
  by (metis bsimp.simps(2) bsimp_idem)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2583
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2584
lemma CT1b:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2585
  shows "bsimp (bsimp_AALTs bs as) = bsimp (bsimp_AALTs bs (map bsimp as))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2586
  apply(induct bs as rule: bsimp_AALTs.induct)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2587
    apply(auto simp add: bsimp_idem)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2588
  apply (simp add: bsimp_fuse bsimp_idem)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2589
  by (metis bsimp_idem comp_apply)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2590
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2591
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2592
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2593
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2594
(* CT *)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2595
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2596
lemma CTa:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2597
  assumes "\<forall>r \<in> set as. nonalt r \<and> r \<noteq> AZERO"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2598
  shows  "flts as = as"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2599
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2600
  apply(induct as)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2601
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2602
  apply(case_tac as)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2603
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2604
  apply (simp add: k0b)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2605
  using flts_nothing by auto
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2606
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2607
lemma CT0:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2608
  assumes "\<forall>r \<in> set as1. nonalt r \<and> r \<noteq> AZERO" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2609
  shows "flts [bsimp_AALTs bs1 as1] =  flts (map (fuse bs1) as1)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2610
  using assms CTa
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2611
  apply(induct as1 arbitrary: bs1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2612
    apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2613
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2614
  apply(case_tac as1)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2615
   apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2616
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2617
proof -
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2618
fix a :: arexp and as1a :: "arexp list" and bs1a :: "bit list" and aa :: arexp and list :: "arexp list"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2619
  assume a1: "nonalt a \<and> a \<noteq> AZERO \<and> nonalt aa \<and> aa \<noteq> AZERO \<and> (\<forall>r\<in>set list. nonalt r \<and> r \<noteq> AZERO)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2620
  assume a2: "\<And>as. \<forall>r\<in>set as. nonalt r \<and> r \<noteq> AZERO \<Longrightarrow> flts as = as"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2621
  assume a3: "as1a = aa # list"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2622
  have "flts [a] = [a]"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2623
using a1 k0b by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2624
then show "fuse bs1a a # fuse bs1a aa # map (fuse bs1a) list = flts (fuse bs1a a # fuse bs1a aa # map (fuse bs1a) list)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2625
  using a3 a2 a1 by (metis (no_types) append.left_neutral append_Cons flts_fuse k00 k0b list.simps(9))
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2626
qed
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2627
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2628
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2629
lemma CT01:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2630
  assumes "\<forall>r \<in> set as1. nonalt r \<and> r \<noteq> AZERO" "\<forall>r \<in> set as2. nonalt r \<and> r \<noteq> AZERO" 
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2631
  shows "flts [bsimp_AALTs bs1 as1, bsimp_AALTs bs2 as2] =  flts ((map (fuse bs1) as1) @ (map (fuse bs2) as2))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2632
  using assms CT0
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2633
  by (metis k0 k00)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2634
  
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2635
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2636
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2637
lemma CT_exp:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2638
  assumes "\<forall>a \<in> set as. bsimp (bder c (bsimp a)) = bsimp (bder c a)"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2639
  shows "map bsimp (map (bder c) as) = map bsimp (map (bder c) (map bsimp as))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2640
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2641
  apply(induct as)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2642
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2643
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2644
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2645
lemma asize_set:
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2646
  assumes "a \<in> set as"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2647
  shows "asize a < Suc (sum_list (map asize as))"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2648
  using assms
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2649
  apply(induct as arbitrary: a)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2650
   apply(auto)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2651
  using le_add2 le_less_trans not_less_eq by blast
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2652
339
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2653
lemma L_erase_bder_simp:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2654
  shows "L (erase (bsimp (bder a r))) = L (der a (erase (bsimp r)))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2655
  using L_bsimp_erase der_correctness by auto
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2656
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2657
lemma PPP0: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2658
  assumes "s \<in> r \<rightarrow> v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2659
  shows "(bders (intern r) s) >> code v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2660
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2661
  by (smt L07 L1 LX0 Posix1(1) Posix_Prf contains6 erase_bders erase_intern lexer_correct_None lexer_flex mkeps_nullable option.inject retrieve_code)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2662
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2663
thm L07 L1 LX0 Posix1(1) Posix_Prf contains6 erase_bders erase_intern lexer_correct_None lexer_flex mkeps_nullable option.inject retrieve_code
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2664
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2665
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2666
lemma PPP0_isar: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2667
  assumes "s \<in> r \<rightarrow> v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2668
  shows "(bders (intern r) s) >> code v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2669
proof -
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2670
  from assms have a1: "\<Turnstile> v : r" using Posix_Prf by simp
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2671
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2672
  from assms have "s \<in> L r" using Posix1(1) by auto
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2673
  then have "[] \<in> L (ders s r)" by (simp add: ders_correctness Ders_def)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2674
  then have a2: "\<Turnstile> mkeps (ders s r) : ders s r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2675
    by (simp add: mkeps_nullable nullable_correctness) 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2676
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2677
  have "retrieve (bders (intern r) s) (mkeps (ders s r)) =  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2678
        retrieve (intern r) (flex r id s (mkeps (ders s r)))" using a2 LA LB bder_retrieve  by simp
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2679
  also have "... = retrieve (intern r) v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2680
    using LB assms by auto 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2681
  also have "... = code v" using a1 by (simp add: retrieve_code) 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2682
  finally have "retrieve (bders (intern r) s) (mkeps (ders s r)) = code v" by simp
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2683
  moreover
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2684
  have "\<Turnstile> mkeps (ders s r) : erase (bders (intern r) s)" using a2 by simp 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2685
  then have "bders (intern r) s >> retrieve (bders (intern r) s) (mkeps (ders s r))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2686
    by (rule contains6)  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2687
  ultimately
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2688
  show "(bders (intern r) s) >> code v" by simp
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2689
qed
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2690
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2691
lemma PPP0b: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2692
  assumes "s \<in> r \<rightarrow> v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2693
  shows "(intern r) >> code v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2694
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2695
  using Posix_Prf contains2 by auto
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2696
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2697
lemma PPP0_eq:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2698
  assumes "s \<in> r \<rightarrow> v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2699
  shows "(intern r >> code v) = (bders (intern r) s >> code v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2700
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2701
  using PPP0_isar PPP0b by blast
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2702
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2703
lemma f_cont1:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2704
  assumes "fuse bs1 a >> bs"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2705
  shows "\<exists>bs2. bs = bs1 @ bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2706
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2707
  apply(induct a arbitrary: bs1 bs)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2708
       apply(auto elim: contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2709
  done
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2710
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2711
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2712
lemma f_cont2:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2713
  assumes "bsimp_AALTs bs1 as >> bs"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2714
  shows "\<exists>bs2. bs = bs1 @ bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2715
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2716
  apply(induct bs1 as arbitrary: bs rule: bsimp_AALTs.induct)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2717
    apply(auto elim: contains.cases f_cont1)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2718
  done
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2719
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2720
lemma contains_SEQ1:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2721
  assumes "bsimp_ASEQ bs r1 r2 >> bsX"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2722
  shows "\<exists>bs1 bs2. r1 >> bs1 \<and> r2 >> bs2 \<and> bsX = bs @ bs1 @ bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2723
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2724
  apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2725
  apply(case_tac "r1 = AZERO")
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2726
   apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2727
  using contains.simps apply blast
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2728
  apply(case_tac "r2 = AZERO")
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2729
   apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2730
   apply(simp add: bsimp_ASEQ0)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2731
  using contains.simps apply blast
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2732
  apply(case_tac "\<exists>bsX. r1 = AONE bsX")
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2733
   apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2734
   apply(simp add: bsimp_ASEQ2)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2735
   apply (metis append_assoc contains.intros(1) contains49 f_cont1)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2736
  apply(simp add: bsimp_ASEQ1)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2737
  apply(erule contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2738
        apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2739
  done
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2740
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2741
lemma contains59:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2742
  assumes "AALTs bs rs >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2743
  shows "\<exists>r \<in> set rs. (fuse bs r) >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2744
 using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2745
  apply(induct rs arbitrary: bs bs2)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2746
  apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2747
   apply(erule contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2748
        apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2749
  apply(erule contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2750
       apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2751
  using contains0 by blast
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2752
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2753
lemma contains60:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2754
  assumes "\<exists>r \<in> set rs. fuse bs r >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2755
  shows "AALTs bs rs >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2756
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2757
  apply(induct rs arbitrary: bs bs2)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2758
   apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2759
  apply (metis contains3b contains49 f_cont1)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2760
  using contains.intros(5) f_cont1 by blast
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2761
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2762
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2763
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2764
lemma contains61:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2765
  assumes "bsimp_AALTs bs rs >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2766
  shows "\<exists>r \<in> set rs. (fuse bs r) >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2767
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2768
  apply(induct arbitrary: bs2 rule: bsimp_AALTs.induct)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2769
    apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2770
  using contains.simps apply blast
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2771
  using contains59 by fastforce
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2772
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2773
lemma contains61b:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2774
  assumes "bsimp_AALTs bs rs >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2775
  shows "\<exists>r \<in> set (flts rs). (fuse bs r) >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2776
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2777
  apply(induct bs rs arbitrary: bs2 rule: bsimp_AALTs.induct)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2778
    apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2779
  using contains.simps apply blast
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2780
  using contains51d contains61 f_cont1 apply blast
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2781
  by (metis bsimp_AALTs.simps(3) contains52 contains61 f_cont2)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2782
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2783
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2784
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2785
lemma contains61a:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2786
  assumes "\<exists>r \<in> set rs. (fuse bs r) >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2787
  shows "bsimp_AALTs bs rs >> bs2" 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2788
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2789
  apply(induct rs arbitrary: bs2 bs)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2790
   apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2791
   apply (metis bsimp_AALTs.elims contains60 list.distinct(1) list.inject list.set_intros(1))
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2792
  by (metis append_Cons append_Nil contains50 f_cont2)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2793
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2794
lemma contains62:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2795
  assumes "bsimp_AALTs bs (rs1 @ rs2) >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2796
  shows "bsimp_AALTs bs rs1 >> bs2 \<or> bsimp_AALTs bs rs2 >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2797
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2798
  apply -
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2799
  apply(drule contains61)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2800
  apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2801
   apply(case_tac rs1)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2802
    apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2803
  apply(case_tac list)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2804
     apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2805
  apply (simp add: contains60)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2806
   apply(case_tac list)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2807
    apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2808
  apply (simp add: contains60)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2809
  apply (meson contains60 list.set_intros(2))
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2810
   apply(case_tac rs2)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2811
    apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2812
  apply(case_tac list)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2813
     apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2814
  apply (simp add: contains60)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2815
   apply(case_tac list)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2816
    apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2817
  apply (simp add: contains60)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2818
  apply (meson contains60 list.set_intros(2))
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2819
  done
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2820
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2821
lemma contains63:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2822
  assumes "AALTs bs (map (fuse bs1) rs) >> bs3"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2823
  shows "AALTs (bs @ bs1) rs >> bs3"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2824
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2825
  apply(induct rs arbitrary: bs bs1 bs3)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2826
   apply(auto elim: contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2827
    apply(erule contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2828
        apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2829
  apply (simp add: contains0 contains60 fuse_append)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2830
  by (metis contains.intros(5) contains59 f_cont1)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2831
    
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2832
lemma contains64:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2833
  assumes "bsimp_AALTs bs (flts rs1 @ flts rs2) >> bs2" "\<forall>r \<in> set rs2. \<not> fuse bs r >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2834
  shows "bsimp_AALTs bs (flts rs1) >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2835
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2836
  apply(induct rs2 arbitrary: rs1 bs bs2)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2837
   apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2838
  apply(drule_tac x="rs1" in meta_spec)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2839
    apply(drule_tac x="bs" in meta_spec)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2840
  apply(drule_tac x="bs2" in meta_spec)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2841
  apply(drule meta_mp)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2842
   apply(drule contains61)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2843
   apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2844
  using contains51b contains61a f_cont1 apply blast
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2845
  apply(subst (asm) k0)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2846
  apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2847
   prefer 2
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2848
  using contains50 contains61a f_cont1 apply blast
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2849
  apply(case_tac a)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2850
       apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2851
  by (metis contains60 fuse_append)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2852
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2853
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2854
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2855
lemma contains65:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2856
  assumes "bsimp_AALTs bs (flts rs) >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2857
  shows "\<exists>r \<in> set rs. (fuse bs r) >> bs2"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2858
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2859
  apply(induct rs arbitrary: bs bs2 taking: "\<lambda>rs. sum_list (map asize rs)" rule: measure_induct)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2860
  apply(case_tac x)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2861
        apply(auto elim: contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2862
  apply(case_tac list)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2863
   apply(auto elim: contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2864
   apply(case_tac a)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2865
        apply(auto elim: contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2866
   apply(drule contains61)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2867
   apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2868
   apply (metis contains60 fuse_append)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2869
  apply(case_tac lista)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2870
   apply(auto elim: contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2871
   apply(subst (asm) k0)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2872
   apply(drule contains62)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2873
   apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2874
   apply(case_tac a)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2875
         apply(auto elim: contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2876
   apply(case_tac x52)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2877
   apply(auto elim: contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2878
  apply(case_tac list)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2879
   apply(auto elim: contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2880
  apply (simp add: contains60 fuse_append)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2881
   apply(erule contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2882
          apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2883
     apply (metis append.left_neutral contains0 contains60 fuse.simps(4) in_set_conv_decomp)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2884
  apply(erule contains.cases)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2885
          apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2886
     apply (metis contains0 contains60 fuse.simps(4) list.set_intros(1) list.set_intros(2))
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2887
  apply (simp add: contains.intros(5) contains63)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2888
   apply(case_tac aa)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2889
        apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2890
  apply (meson contains60 contains61 contains63)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2891
  apply(subst (asm) k0)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2892
  apply(drule contains64)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2893
   apply(auto)[1]
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2894
  by (metis append_Nil2 bsimp_AALTs.simps(2) contains50 contains61a contains64 f_cont2 flts.simps(1))
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2895
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2896
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2897
lemma contains55a:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2898
  assumes "bsimp r >> bs"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2899
  shows "r >> bs"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2900
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2901
  apply(induct r arbitrary: bs)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2902
       apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2903
   apply(frule contains_SEQ1)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2904
  apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2905
   apply (simp add: contains.intros(3))
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2906
  apply(frule f_cont2)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2907
  apply(auto) 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2908
  apply(drule contains65)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2909
  apply(auto)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2910
  using contains0 contains49 contains60 by blast
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2911
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2912
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2913
lemma PPP1_eq:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2914
  shows "bsimp r >> bs \<longleftrightarrow> r >> bs"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2915
  using contains55 contains55a by blast
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2916
359
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2917
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2918
definition "SET a \<equiv> {bs . a >> bs}"
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2919
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2920
lemma "SET(bsimp a) \<subseteq> SET(a)"
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2921
  unfolding SET_def
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2922
  apply(auto simp add: PPP1_eq)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2923
  done
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2924
339
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2925
lemma retrieve_code_bder:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2926
  assumes "\<Turnstile> v : der c r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2927
  shows "code (injval r c v) = retrieve (bder c (intern r)) v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2928
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2929
  by (simp add: Prf_injval bder_retrieve retrieve_code)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2930
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2931
lemma Etrans:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2932
  assumes "a >> s" "s = t" 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2933
  shows "a >> t"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2934
  using assms by simp
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2935
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2936
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2937
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2938
lemma retrieve_code_bders:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2939
  assumes "\<Turnstile> v : ders s r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2940
  shows "code (flex r id s v) = retrieve (bders (intern r) s) v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2941
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2942
  apply(induct s arbitrary: v r rule: rev_induct)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2943
   apply(auto simp add: ders_append flex_append bders_append)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2944
  apply (simp add: retrieve_code)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2945
  apply(frule Prf_injval)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2946
  apply(drule_tac meta_spec)+
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2947
  apply(drule meta_mp)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2948
   apply(assumption)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2949
  apply(simp)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2950
  apply(subst bder_retrieve)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2951
   apply(simp)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2952
  apply(simp)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2953
  done
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2954
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2955
lemma contains70:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2956
 assumes "s \<in> L(r)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2957
 shows "bders (intern r) s >> code (flex r id s (mkeps (ders s r)))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2958
  apply(subst PPP0_eq[symmetric])
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2959
   apply (meson assms lexer_correct_None lexer_correctness(1) lexer_flex)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2960
  by (metis L07XX PPP0b assms erase_intern)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2961
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2962
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2963
359
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2964
lemma PPP:
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2965
  assumes "\<Turnstile> v : r"
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2966
  shows "intern r >> (retrieve (intern r) v)"
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2967
  using assms
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2968
  using contains5 by blast
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2969
  
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2970
  
359
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2971
 
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  2972
  
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2973
  
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2974
  
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2975
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2976
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2977
definition FC where
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2978
 "FC a s v = retrieve a (flex (erase a) id s v)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2979
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2980
definition FE where
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2981
 "FE a s = retrieve a (flex (erase a) id s (mkeps (ders s (erase a))))"
339
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2982
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2983
definition PV where
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2984
  "PV r s v = flex r id s v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2985
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2986
definition PX where
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2987
  "PX r s = PV r s (mkeps (ders s r))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  2988
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  2989
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2990
lemma FE_PX:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2991
  shows "FE r s = retrieve r (PX (erase r) s)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2992
  unfolding FE_def PX_def PV_def by(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2993
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2994
lemma FE_PX_code:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2995
  assumes "s \<in> L r"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2996
  shows "FE (intern r) s = code (PX r s)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2997
  unfolding FE_def PX_def PV_def 
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2998
  using assms
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  2999
  by (metis L07XX Posix_Prf erase_intern retrieve_code)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3000
  
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3001
339
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3002
lemma PV_id[simp]:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3003
  shows "PV r [] v = v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3004
  by (simp add: PV_def)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3005
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3006
lemma PX_id[simp]:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3007
  shows "PX r [] = mkeps r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3008
  by (simp add: PX_def)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3009
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3010
lemma PV_cons:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3011
  shows "PV r (c # s) v = injval r c (PV (der c r) s v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3012
  apply(simp add: PV_def flex_fun_apply)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3013
  done
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3014
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3015
lemma PX_cons:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3016
  shows "PX r (c # s) = injval r c (PX (der c r) s)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3017
  apply(simp add: PX_def PV_cons)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3018
  done
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3019
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3020
lemma PV_append:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3021
  shows "PV r (s1 @ s2) v = PV r s1 (PV (ders s1 r) s2 v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3022
  apply(simp add: PV_def flex_append)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3023
  by (simp add: flex_fun_apply2)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3024
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3025
lemma PX_append:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3026
  shows "PX r (s1 @ s2) = PV r s1 (PX (ders s1 r) s2)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3027
  by (simp add: PV_append PX_def ders_append)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3028
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3029
lemma code_PV0: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3030
  shows "PV r (c # s) v = injval r c (PV (der c r) s v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3031
  unfolding PX_def PV_def
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3032
  apply(simp)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3033
  by (simp add: flex_injval)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3034
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3035
lemma code_PX0: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3036
  shows "PX r (c # s) = injval r c (PX (der c r) s)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3037
  unfolding PX_def
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3038
  apply(simp add: code_PV0)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3039
  done  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3040
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3041
lemma Prf_PV:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3042
  assumes "\<Turnstile> v : ders s r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3043
  shows "\<Turnstile> PV r s v : r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3044
  using assms unfolding PX_def PV_def
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3045
  apply(induct s arbitrary: v r)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3046
   apply(simp)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3047
  apply(simp)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3048
  by (simp add: Prf_injval flex_injval)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3049
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3050
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3051
lemma Prf_PX:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3052
  assumes "s \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3053
  shows "\<Turnstile> PX r s : r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3054
  using assms unfolding PX_def PV_def
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3055
  using L1 LX0 Posix_Prf lexer_correct_Some by fastforce
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3056
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3057
lemma PV1: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3058
  assumes "\<Turnstile> v : ders s r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3059
  shows "(intern r) >> code (PV r s v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3060
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3061
  by (simp add: Prf_PV contains2)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3062
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3063
lemma PX1: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3064
  assumes "s \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3065
  shows "(intern r) >> code (PX r s)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3066
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3067
  by (simp add: Prf_PX contains2)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3068
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3069
lemma PX2: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3070
  assumes "s \<in> L (der c r)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3071
  shows "bder c (intern r) >> code (injval r c (PX (der c r) s))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3072
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3073
  by (simp add: Prf_PX contains6 retrieve_code_bder)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3074
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3075
lemma PX2a: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3076
  assumes "c # s \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3077
  shows "bder c (intern r) >> code (injval r c (PX (der c r) s))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3078
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3079
  using PX2 lexer_correct_None by force
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3080
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3081
lemma PX2b: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3082
  assumes "c # s \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3083
  shows "bder c (intern r) >> code (PX r (c # s))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3084
  using assms unfolding PX_def PV_def
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3085
  by (metis Der_def L07XX PV_def PX2a PX_def Posix_determ Posix_injval der_correctness erase_intern mem_Collect_eq)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3086
    
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3087
lemma PV3: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3088
  assumes "\<Turnstile> v : ders s r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3089
  shows "bders (intern r) s >> code (PV r s v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3090
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3091
  using PX_def PV_def contains70
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3092
  by (simp add: contains6 retrieve_code_bders)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3093
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3094
lemma PX3: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3095
  assumes "s \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3096
  shows "bders (intern r) s >> code (PX r s)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3097
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3098
  using PX_def PV_def contains70 by auto
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3099
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3100
339
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3101
lemma PV_bders_iff:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3102
  assumes "\<Turnstile> v : ders s r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3103
  shows "bders (intern r) s >> code (PV r s v) \<longleftrightarrow> (intern r) >> code (PV r s v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3104
  by (simp add: PV1 PV3 assms)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3105
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3106
lemma PX_bders_iff:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3107
  assumes "s \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3108
  shows "bders (intern r) s >> code (PX r s) \<longleftrightarrow> (intern r) >> code (PX r s)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3109
  by (simp add: PX1 PX3 assms)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3110
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3111
lemma PX4: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3112
  assumes "(s1 @ s2) \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3113
  shows "bders (intern r) (s1 @ s2) >> code (PX r (s1 @ s2))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3114
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3115
  by (simp add: PX3)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3116
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3117
lemma PX_bders_iff2: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3118
  assumes "(s1 @ s2) \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3119
  shows "bders (intern r) (s1 @ s2) >> code (PX r (s1 @ s2)) \<longleftrightarrow>
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3120
         (intern r) >> code (PX r (s1 @ s2))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3121
  by (simp add: PX1 PX3 assms)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3122
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3123
lemma PV_bders_iff3: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3124
  assumes "\<Turnstile> v : ders (s1 @ s2) r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3125
  shows "bders (intern r) (s1 @ s2) >> code (PV r (s1 @ s2) v) \<longleftrightarrow>
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3126
         bders (intern r) s1 >> code (PV r (s1 @ s2) v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3127
  by (metis PV3 PV_append Prf_PV assms ders_append)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3128
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3129
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3130
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3131
lemma PX_bders_iff3: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3132
  assumes "(s1 @ s2) \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3133
  shows "bders (intern r) (s1 @ s2) >> code (PX r (s1 @ s2)) \<longleftrightarrow>
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3134
         bders (intern r) s1 >> code (PX r (s1 @ s2))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3135
  by (metis Ders_def L07XX PV_append PV_def PX4 PX_def Posix_Prf assms contains6 ders_append ders_correctness erase_bders erase_intern mem_Collect_eq retrieve_code_bders)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3136
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3137
lemma PV_bder_iff: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3138
  assumes "\<Turnstile> v : ders (s1 @ [c]) r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3139
  shows "bder c (bders (intern r) s1) >> code (PV r (s1 @ [c]) v) \<longleftrightarrow>
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3140
         bders (intern r) s1 >> code (PV r (s1 @ [c]) v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3141
  by (simp add: PV_bders_iff3 assms bders_snoc)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3142
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3143
lemma PV_bder_IFF: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3144
  assumes "\<Turnstile> v : ders (s1 @ c # s2) r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3145
  shows "bder c (bders (intern r) s1) >> code (PV r (s1 @ c # s2) v) \<longleftrightarrow>
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3146
         bders (intern r) s1 >> code (PV r (s1 @ c # s2) v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3147
  by (metis LA PV3 PV_def Prf_PV assms bders_append code_PV0 contains7 ders.simps(2) erase_bders erase_intern retrieve_code_bders)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3148
    
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3149
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3150
lemma PX_bder_iff: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3151
  assumes "(s1 @ [c]) \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3152
  shows "bder c (bders (intern r) s1) >> code (PX r (s1 @ [c])) \<longleftrightarrow>
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3153
         bders (intern r) s1 >> code (PX r (s1 @ [c]))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3154
  by (simp add: PX_bders_iff3 assms bders_snoc)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3155
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3156
lemma PV_bder_iff2: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3157
  assumes "\<Turnstile> v : ders (c # s1) r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3158
  shows "bders (bder c (intern r)) s1 >> code (PV r (c # s1) v) \<longleftrightarrow>
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3159
         bder c (intern r) >> code (PV r (c # s1) v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3160
  by (metis PV3 Prf_PV assms bders.simps(2) code_PV0 contains7 ders.simps(2) erase_intern retrieve_code)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3161
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3162
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3163
lemma PX_bder_iff2: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3164
  assumes "(c # s1) \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3165
  shows "bders (bder c (intern r)) s1 >> code (PX r (c # s1)) \<longleftrightarrow>
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3166
         bder c (intern r) >> code (PX r (c # s1))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3167
  using PX2b PX3 assms by force
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3168
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3169
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3170
lemma FC_id:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3171
  shows "FC r [] v = retrieve r v"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3172
  by (simp add: FC_def)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3173
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3174
lemma FC_char:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3175
  shows "FC r [c] v = retrieve r (injval (erase r) c v)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3176
  by (simp add: FC_def)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3177
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3178
lemma FC_char2:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3179
  assumes "\<Turnstile> v : der c (erase r)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3180
  shows "FC r [c] v = FC (bder c r) [] v"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3181
  using assms
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3182
  by (simp add: FC_char FC_id bder_retrieve)
339
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3183
  
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3184
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3185
lemma FC_bders_iff:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3186
  assumes "\<Turnstile> v : ders s (erase r)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3187
  shows "bders r s >> FC r s v \<longleftrightarrow> r >> FC r s v"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3188
  unfolding FC_def
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3189
  by (simp add: assms contains8_iff)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3190
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3191
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3192
lemma FC_bder_iff:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3193
  assumes "\<Turnstile> v : der c (erase r)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3194
  shows "bder c r >> FC r [c] v \<longleftrightarrow> r >> FC r [c] v"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3195
  apply(subst FC_bders_iff[symmetric])
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3196
   apply(simp add: assms)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3197
  apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3198
  done
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3199
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3200
lemma FC_bders_iff2:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3201
  assumes "\<Turnstile> v : ders (c # s) (erase r)"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3202
  shows "bders r (c # s) >> FC r (c # s) v \<longleftrightarrow> bders (bder c r) s >> FC (bder c r) s v"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3203
  apply(subst FC_bders_iff)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3204
  using assms apply simp
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3205
  by (metis FC_def assms contains7b contains8_iff ders.simps(2) erase_bder)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3206
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3207
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3208
lemma FC_bnullable0:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3209
  assumes "bnullable r"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3210
  shows "FC r [] (mkeps (erase r)) = FC (bsimp r) [] (mkeps (erase (bsimp r)))"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3211
  unfolding FC_def 
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3212
  by (simp add: L0 assms)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3213
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3214
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3215
lemma FC_nullable2:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3216
  assumes "bnullable (bders a s)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3217
  shows "FC (bsimp a) s (mkeps (erase (bders (bsimp a) s))) = 
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3218
         FC (bders (bsimp a) s) [] (mkeps (erase (bders (bsimp a) s)))"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3219
  unfolding FC_def
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3220
  using L02_bders assms by auto
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3221
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3222
lemma FC_nullable3:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3223
  assumes "bnullable (bders a s)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3224
  shows "FC a s (mkeps (erase (bders a s))) = 
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3225
         FC (bders a s) [] (mkeps (erase (bders a s)))"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3226
  unfolding FC_def
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3227
  using LA assms bnullable_correctness mkeps_nullable by fastforce
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3228
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3229
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3230
lemma FE_contains0:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3231
  assumes "bnullable r"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3232
  shows "r >> FE r []"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3233
  by (simp add: FE_def assms bnullable_correctness contains6 mkeps_nullable)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3234
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3235
lemma FE_contains1:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3236
  assumes "bnullable (bders r s)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3237
  shows "r >> FE r s"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3238
  by (metis FE_def Prf_flex assms bnullable_correctness contains6 erase_bders mkeps_nullable)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3239
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3240
lemma FE_bnullable0:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3241
  assumes "bnullable r"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3242
  shows "FE r [] = FE (bsimp r) []"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3243
  unfolding FE_def 
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3244
  by (simp add: L0 assms)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3245
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3246
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3247
lemma FE_nullable1:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3248
  assumes "bnullable (bders r s)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3249
  shows "FE r s = FE (bders r s) []"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3250
  unfolding FE_def
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3251
  using LA assms bnullable_correctness mkeps_nullable by fastforce
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3252
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3253
lemma FE_contains2:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3254
  assumes "bnullable (bders r s)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3255
  shows "r >> FE (bders r s) []"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3256
  by (metis FE_contains1 FE_nullable1 assms)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3257
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3258
lemma FE_contains3:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3259
  assumes "bnullable (bder c r)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3260
  shows "r >> FE (bsimp (bder c r)) []"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3261
  by (metis FE_def L0 assms bder_retrieve bders.simps(1) bnullable_correctness contains7a erase_bder erase_bders flex.simps(1) id_apply mkeps_nullable)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3262
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3263
lemma FE_contains4:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3264
  assumes "bnullable (bders r s)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3265
  shows "r >> FE (bsimp (bders r s)) []"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3266
  using FE_bnullable0 FE_contains2 assms by auto
339
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3267
  
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3268
lemma FC4:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3269
  assumes "\<Turnstile> v : ders s (erase a)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3270
  shows "FC a s v = FC (bders a s) [] v"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3271
  unfolding FC_def by (simp add: LA assms)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3272
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3273
lemma FC5:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3274
  assumes "nullable (erase a)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3275
  shows "FC a [] (mkeps (erase a)) = FC (bsimp a) [] (mkeps (erase (bsimp a)))"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3276
  unfolding FC_def
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3277
  using L0 assms bnullable_correctness by auto 
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3278
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3279
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3280
lemma in1:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3281
  assumes "AALTs bsX rsX \<in> set rs"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3282
  shows "\<forall>r \<in> set rsX. fuse bsX r \<in> set (flts rs)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3283
  using assms
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3284
  apply(induct rs arbitrary: bsX rsX)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3285
   apply(auto)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3286
  by (metis append_assoc in_set_conv_decomp k0)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3287
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3288
lemma in2a:
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3289
  assumes "nonnested (bsimp r)" "\<not>nonalt(bsimp r)" 
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3290
  shows "(\<exists>bsX rsX. r = AALTs bsX rsX) \<or> (\<exists>bsX rX1 rX2. r = ASEQ bsX rX1 rX2 \<and> bnullable rX1)"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3291
  using assms
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3292
  apply(induct r)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3293
       apply(auto)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3294
  by (metis arexp.distinct(25) b3 bnullable.simps(2) bsimp_ASEQ.simps(1) bsimp_ASEQ0 bsimp_ASEQ1 nonalt.elims(3) nonalt.simps(2))
356
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3295
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3296
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3297
lemma [simp]:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3298
  shows "size (fuse bs r) = size r"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3299
  by (induct r) (auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3300
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3301
fun AALTs_subs where
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3302
  "AALTs_subs (AZERO) = {}"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3303
| "AALTs_subs (AONE bs) = {AONE bs}"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3304
| "AALTs_subs (ACHAR bs c) = {ACHAR bs c}"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3305
| "AALTs_subs (ASEQ bs r1 r2) = {ASEQ bs r1 r2}"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3306
| "AALTs_subs (ASTAR bs r) = {ASTAR bs r}"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3307
| "AALTs_subs (AALTs bs []) = {}"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3308
| "AALTs_subs (AALTs bs (r#rs)) = AALTs_subs (fuse bs r) \<union> AALTs_subs (AALTs bs rs)"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3309
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3310
lemma nonalt_10:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3311
  assumes "nonalt r" "r \<noteq> AZERO"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3312
  shows "r \<in> AALTs_subs r"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3313
  using assms
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3314
  apply(induct r)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3315
       apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3316
  done
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3317
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3318
lemma flt_fuse:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3319
  shows "flts (map (fuse bs) rs) = map (fuse bs) (flts rs)"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3320
  apply(induct rs arbitrary: bs rule: flts.induct)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3321
        apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3322
  by (simp add: fuse_append)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3323
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3324
lemma AALTs_subs_fuse: 
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3325
  shows "AALTs_subs (fuse bs r) = (fuse bs) ` (AALTs_subs r)"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3326
  apply(induct r arbitrary: bs rule: AALTs_subs.induct)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3327
       apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3328
   apply (simp add: fuse_append)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3329
  apply blast
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3330
  by (simp add: fuse_append)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3331
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3332
lemma AALTs_subs_fuse2: 
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3333
  shows "AALTs_subs (AALTs bs rs) = AALTs_subs (AALTs [] (map (fuse bs) rs))"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3334
  apply(induct rs arbitrary: bs)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3335
   apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3336
   apply (auto simp add: fuse_empty)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3337
  done
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3338
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3339
lemma fuse_map:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3340
  shows "map (fuse (bs1 @ bs2)) rs = map (fuse bs1) (map (fuse bs2) rs)"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3341
  apply(induct rs)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3342
   apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3343
  using fuse_append by blast
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3344
  
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3345
356
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3346
 
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3347
lemma contains59_2:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3348
  assumes "AALTs bs rs >> bs2" 
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3349
  shows "\<exists>r\<in>AALTs_subs (AALTs bs rs). r >> bs2"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3350
  using assms
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3351
  apply(induct rs arbitrary: bs bs2 taking: "\<lambda>rs. sum_list  (map asize rs)" rule: measure_induct)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3352
  apply(case_tac x)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3353
  apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3354
  using contains59 apply force
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3355
  apply(erule contains.cases)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3356
        apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3357
   apply(case_tac "r = AZERO")
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3358
    apply(simp)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3359
    apply (metis bsimp_AALTs.simps(1) contains61 empty_iff empty_set)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3360
   apply(case_tac "nonalt r")
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3361
  apply (metis UnCI bsimp_AALTs.simps(1) contains0 contains61 empty_iff empty_set nn11a nonalt_10)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3362
   apply(subgoal_tac "\<exists>bsX rsX. r = AALTs bsX rsX")
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3363
    prefer 2
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3364
  using bbbbs1 apply blast
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3365
   apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3366
   apply (metis UnCI contains0 fuse.simps(4) less_add_Suc1)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3367
  apply(drule_tac x="rs" in spec)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3368
  apply(drule mp)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3369
   apply(simp add: asize0)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3370
  apply(drule_tac x="bsa" in spec)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3371
  apply(drule_tac x="bsa @ bs1" in spec)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3372
  apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3373
  done
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3374
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3375
lemma TEMPLATE_contains61a:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3376
  assumes "\<exists>r \<in> set rs. (fuse bs r) >> bs2"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3377
  shows "bsimp_AALTs bs rs >> bs2" 
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3378
  using assms
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3379
  apply(induct rs arbitrary: bs2 bs)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3380
   apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3381
   apply (metis bsimp_AALTs.elims contains60 list.distinct(1) list.inject list.set_intros(1))
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3382
  by (metis append_Cons append_Nil contains50 f_cont2)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3383
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3384
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3385
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3386
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3387
lemma H1:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3388
  assumes "r >> bs2" "r \<in> AALTs_subs a" 
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3389
  shows "a >> bs2"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3390
  using assms
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3391
  apply(induct a arbitrary: r bs2 rule: AALTs_subs.induct)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3392
        apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3393
   apply (simp add: contains60)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3394
  by (simp add: contains59 contains60)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3395
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3396
lemma H3:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3397
  assumes "a >> bs"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3398
  shows "\<exists>r \<in> AALTs_subs a. r >> bs"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3399
  using assms
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3400
  apply(induct a bs)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3401
        apply(auto intro: contains.intros)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3402
  using contains.intros(4) contains59_2 by fastforce
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3403
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3404
lemma H4:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3405
  shows "AALTs_subs (AALTs bs rs1) \<subseteq> AALTs_subs (AALTs bs (rs1 @ rs2))"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3406
  apply(induct rs1)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3407
   apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3408
  done
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3409
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3410
lemma H5:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3411
  shows "AALTs_subs (AALTs bs rs2) \<subseteq> AALTs_subs (AALTs bs (rs1 @ rs2))"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3412
  apply(induct rs1)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3413
   apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3414
  done
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3415
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3416
lemma H7:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3417
  shows "AALTs_subs (AALTs bs (rs1 @ rs2)) = AALTs_subs (AALTs bs rs1) \<union> AALTs_subs (AALTs bs rs2)"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3418
  apply(induct rs1)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3419
   apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3420
  done
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3421
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3422
lemma H10:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3423
  shows "AALTs_subs (AALTs bs rs) = (\<Union>r \<in> set rs. AALTs_subs (fuse bs r))"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3424
  apply(induct rs arbitrary: bs)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3425
   apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3426
  done
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3427
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3428
lemma H6:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3429
  shows "AALTs_subs (AALTs bs (flts rs)) = AALTs_subs (AALTs bs rs)"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3430
  apply(induct rs arbitrary: bs rule: flts.induct)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3431
        apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3432
  apply (metis AALTs_subs_fuse2 H7 Un_iff fuse_map)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3433
  apply (metis AALTs_subs_fuse2 H7 UnCI fuse_map)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3434
  by (simp add: H7)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3435
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3436
356
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3437
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3438
lemma H2:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3439
  assumes "r >> bs2" "r \<in> AALTs_subs (AALTs bs rs)" 
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3440
  shows "r \<in> AALTs_subs (AALTs bs (flts rs))"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3441
  using assms
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3442
  apply(induct rs arbitrary: r bs bs2 rule: flts.induct)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3443
        apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3444
   apply (metis AALTs_subs_fuse2 H4 fuse_map in_mono)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3445
  using H7 by blast
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3446
  
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3447
lemma HH1:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3448
  assumes "r \<in> AALTs_subs (fuse bs a)" "r >> bs2"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3449
  shows "\<exists>bs3. bs2 = bs @ bs3"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3450
  using assms
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3451
  using H1 f_cont1 by blast
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3452
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3453
lemma fuse_inj:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3454
  assumes "fuse bs a = fuse bs b"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3455
  shows "a = b"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3456
  using assms
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3457
  apply(induct a arbitrary: bs b)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3458
       apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3459
       apply(case_tac b)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3460
            apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3461
         apply(case_tac b)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3462
           apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3463
       apply(case_tac b)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3464
          apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3465
       apply(case_tac b)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3466
         apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3467
       apply(case_tac b)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3468
        apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3469
         apply(case_tac b)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3470
       apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3471
  done
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3472
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3473
lemma HH11:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3474
  assumes "r \<in> AALTs_subs (fuse bs1 a)"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3475
  shows "fuse bs r \<in> AALTs_subs (fuse (bs @ bs1) a)"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3476
  using assms
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3477
  apply(induct a arbitrary: r bs bs1)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3478
       apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3479
  apply(subst (asm) H10)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3480
  apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3481
  apply(drule_tac x="x" in meta_spec)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3482
  apply(simp)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3483
  apply(drule_tac x="r" in meta_spec)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3484
  apply(drule_tac x="bs" in meta_spec)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3485
  apply(drule_tac x="bs1 @ x1" in meta_spec)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3486
  apply(simp)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3487
  apply(subst H10)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3488
  apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3489
  done
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3490
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3491
lemma HH12:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3492
  assumes "r \<in> AALTs_subs a"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3493
  shows "fuse bs r \<in> AALTs_subs (fuse bs a)"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3494
  using AALTs_subs_fuse assms by blast
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3495
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3496
lemma HH13:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3497
  assumes "r \<in> (\<Union>r \<in> set rs. AALTs_subs r)"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3498
  shows "fuse bs r \<in> AALTs_subs (AALTs bs rs)"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3499
  using assms
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3500
  using H10 HH12 by blast
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3501
  
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3502
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3503
lemma contains61a_2:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3504
  assumes "\<exists>r\<in>AALTs_subs (AALTs bs rs). r >> bs2" 
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3505
  shows "bsimp_AALTs bs rs >> bs2" 
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3506
  using assms
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3507
 apply(induct rs arbitrary: bs2 bs)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3508
   apply(auto)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3509
  apply (simp add: H1 TEMPLATE_contains61a)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3510
  by (metis append_Cons append_Nil contains50 f_cont2)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3511
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3512
lemma contains_equiv_def2:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3513
  shows " (AALTs bs as >> bs@bs1) \<longleftrightarrow> (\<exists>a\<in>(\<Union> (AALTs_subs ` set as)). a >> bs1)"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3514
  by (metis H1 H3 UN_E UN_I contains0 contains49 contains59 contains60)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3515
    
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3516
lemma contains_equiv_def:
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3517
  shows "(AALTs bs as >> bs@bs1) \<longleftrightarrow> (\<exists>a\<in>set as. a >> bs1)"
356
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3518
  by (meson contains0 contains49 contains59 contains60)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3519
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3520
lemma map_fuse2:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3521
  shows "map (bder c) (map (fuse bs) as) = map (fuse bs) (map (bder c) as)"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3522
  by (simp add: map_bder_fuse)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3523
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3524
lemma map_fuse3:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3525
  shows "map (\<lambda>a. bders a s) (map (fuse bs) as) = map (fuse bs) (map (\<lambda>a. bders a s) as)"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3526
  apply(induct s arbitrary: bs as rule: rev_induct)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3527
   apply(auto simp add: bders_append map_fuse2)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3528
  using bder_fuse by blast
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3529
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3530
lemma bders_AALTs:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3531
  shows "bders (AALTs bs2 as) s = AALTs bs2 (map (\<lambda>a. bders a s) as)"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3532
  apply(induct s arbitrary: bs2 as rule: rev_induct)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3533
  apply(auto simp add: bders_append)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3534
  done
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3535
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3536
lemma bders_AALTs_contains:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3537
  shows "bders (AALTs bs2 as) s >> bs2 @ bs \<longleftrightarrow> 
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3538
         AALTs bs2 (map (\<lambda>a. bders a s) as) >> bs2 @ bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3539
  apply(induct s arbitrary: bs bs2 as)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3540
   apply(auto)[1]
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3541
  apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3542
  by (smt comp_apply map_eq_conv)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3543
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3544
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3545
lemma derc_alt00_Urb:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3546
  shows "bder c (bsimp_AALTs bs2 (flts [bsimp a])) >> bs2 @ bs \<longleftrightarrow>
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3547
         fuse bs2 (bder c (bsimp a)) >> bs2 @ bs"
356
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3548
  apply(case_tac "bsimp a")
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3549
  apply(auto)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3550
  apply(subst (asm) bder_bsimp_AALTs)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3551
   apply(subst (asm) map_fuse2)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3552
  using contains60 contains61 contains63 apply blast
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3553
  by (metis bder_bsimp_AALTs contains51c map_bder_fuse map_map)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3554
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3555
lemma ders_alt00_Urb:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3556
  shows "bders (bsimp_AALTs bs2 (flts [bsimp a])) s >> bs2 @ bs \<longleftrightarrow>
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3557
         fuse bs2 (bders (bsimp a) s) >> bs2 @ bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3558
      apply(case_tac "bsimp a")
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3559
             apply (simp add: bders_AZERO(1))
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3560
  using bders_fuse bsimp_AALTs.simps(2) flts.simps(1) flts.simps(4) apply presburger
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3561
  using bders_fuse bsimp_AALTs.simps(2) flts.simps(1) flts.simps(5) apply presburger
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3562
  using bders_fuse bsimp_AALTs.simps(2) flts.simps(1) flts.simps(6) apply presburger
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3563
   prefer 2
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3564
  using bders_fuse bsimp_AALTs.simps(2) flts.simps(1) flts.simps(7) apply presburger
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3565
  apply(auto simp add: bders_bsimp_AALTs)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3566
   apply(drule contains61)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3567
   apply(auto simp add: bders_AALTs) 
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3568
   apply(rule contains63)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3569
   apply(rule contains60)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3570
   apply(auto)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3571
  using bders_fuse apply auto[1]
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3572
  by (metis contains51c map_fuse3 map_map)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3573
    
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3574
lemma derc_alt00_Urb2a:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3575
  shows "bder c (bsimp_AALTs bs2 (flts [bsimp a])) >> bs2 @ bs \<longleftrightarrow>
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3576
         bder c (bsimp a) >> bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3577
  using contains0 contains49 derc_alt00_Urb by blast
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3578
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3579
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3580
lemma derc_alt00_Urb2:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3581
  assumes "fuse bs2 (bder c (bsimp a)) >> bs2 @ bs" "a \<in> set as"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3582
  shows "bder c (bsimp_AALTs bs2 (flts (map bsimp as))) >> bs2 @ bs"
356
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3583
  using assms
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3584
  apply(subgoal_tac "\<exists>list1 list2. as = list1 @ [a] @ list2")
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3585
   prefer 2
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3586
  using split_list_last apply fastforce
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3587
  apply(erule exE)+
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3588
  apply(simp add: flts_append del: append.simps)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3589
  using bder_bsimp_AALTs contains50 contains51b derc_alt00_Urb by auto
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3590
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3591
lemma ders_alt00_Urb2:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3592
  assumes "fuse bs2 (bders (bsimp a) s) >> bs2 @ bs" "a \<in> set as"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3593
  shows "bders (bsimp_AALTs bs2 (flts (map bsimp as))) s >> bs2 @ bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3594
  using assms
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3595
  apply(subgoal_tac "\<exists>list1 list2. as = list1 @ [a] @ list2")
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3596
   prefer 2
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3597
  using split_list_last apply fastforce
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3598
  apply(erule exE)+
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3599
  apply(simp add: flts_append del: append.simps)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3600
  apply(simp add: bders_bsimp_AALTs)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3601
  apply(rule contains50)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3602
  apply(rule contains51b)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3603
  using bders_bsimp_AALTs ders_alt00_Urb by auto
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3604
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3605
356
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3606
lemma derc_alt2:
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3607
  assumes "bder c (AALTs bs2 as) >> bs2 @ bs" 
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3608
   and "\<forall>a \<in> set as. ((bder c a >> bs) \<longrightarrow> (bder c (bsimp a) >> bs))"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3609
 shows "bder c (bsimp (AALTs bs2 as)) >> bs2 @ bs"
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3610
  using assms
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3611
  apply -
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3612
  apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3613
  apply(subst (asm) contains_equiv_def)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3614
  apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3615
  apply(erule bexE)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3616
  using contains0 derc_alt00_Urb2 by blast
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3617
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3618
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3619
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3620
lemma ders_alt2:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3621
  assumes "bders (AALTs bs2 as) s >> bs2 @ bs" 
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3622
   and "\<forall>a \<in> set as. ((bders a s >> bs) \<longrightarrow> (bders (bsimp a) s >> bs))"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3623
 shows "bders (bsimp (AALTs bs2 as)) s >> bs2 @ bs"
356
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3624
  using assms
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3625
  apply -
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3626
  apply(simp add: bders_AALTs)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3627
  thm contains_equiv_def
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3628
  apply(subst (asm) contains_equiv_def)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3629
  apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3630
  apply(erule bexE)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3631
  using contains0 ders_alt00_Urb2 by blast
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3632
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3633
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3634
356
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3635
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3636
lemma bder_simp_contains:
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3637
  assumes "bder c a >> bs"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3638
  shows "bder c (bsimp a) >> bs"
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3639
  using assms
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3640
  apply(induct a arbitrary: c bs)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3641
       apply(auto elim: contains.cases)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3642
   apply(case_tac "bnullable a1")
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3643
    apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3644
  prefer 2
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3645
    apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3646
    apply(erule contains.cases)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3647
          apply(auto)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3648
    apply(case_tac "(bsimp a1) = AZERO")
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3649
     apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3650
     apply (metis append_Nil2 contains0 contains49 fuse.simps(1))
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3651
   apply(case_tac "(bsimp a2a) = AZERO")
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3652
     apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3653
  apply (metis bder.simps(1) bsimp.simps(1) bsimp_ASEQ0 contains.intros(3) contains55)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3654
    apply(case_tac "\<exists>bsX. (bsimp a1) = AONE bsX")
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3655
     apply(auto)[1]
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3656
  using b3 apply fastforce
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3657
    apply(subst bsimp_ASEQ1)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3658
  apply(auto)[3]
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3659
    apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3660
    apply(subgoal_tac  "\<not> bnullable (bsimp a1)")
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3661
     prefer 2
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3662
  using b3 apply blast
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3663
    apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3664
    apply (simp add: contains.intros(3) contains55)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3665
  (* SEQ nullable case *)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3666
   apply(erule contains.cases)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3667
         apply(auto)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3668
   apply(erule contains.cases)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3669
          apply(auto)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3670
   apply(case_tac "(bsimp a1) = AZERO")
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3671
     apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3672
     apply (metis append_Nil2 contains0 contains49 fuse.simps(1))
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3673
   apply(case_tac "(bsimp a2a) = AZERO")
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3674
     apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3675
  apply (metis bder.simps(1) bsimp.simps(1) bsimp_ASEQ0 contains.intros(3) contains55)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3676
    apply(case_tac "\<exists>bsX. (bsimp a1) = AONE bsX")
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3677
     apply(auto)[1]
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3678
  using contains.simps apply blast
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3679
    apply(subst bsimp_ASEQ1)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3680
  apply(auto)[3]
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3681
    apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3682
  apply(subgoal_tac  "bnullable (bsimp a1)")
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3683
     prefer 2
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3684
  using b3 apply blast
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3685
    apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3686
  apply (metis contains.intros(3) contains.intros(4) contains55 self_append_conv2)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3687
   apply(erule contains.cases)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3688
         apply(auto)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3689
  apply(case_tac "(bsimp a1) = AZERO")
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3690
     apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3691
  using b3 apply force
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3692
   apply(case_tac "(bsimp a2) = AZERO")
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3693
     apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3694
  apply (metis bder.simps(1) bsimp_ASEQ0 bsimp_ASEQ_fuse contains0 contains49 f_cont1)    
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3695
  apply(case_tac "\<exists>bsX. (bsimp a1) = AONE bsX")
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3696
     apply(auto)[1]
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3697
  apply (metis append_assoc bder_fuse bmkeps.simps(1) bmkeps_simp bsimp_ASEQ2 contains0 contains49 f_cont1)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3698
   apply(subst bsimp_ASEQ1)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3699
       apply(auto)[3]
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3700
    apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3701
   apply(subgoal_tac  "bnullable (bsimp a1)")
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3702
     prefer 2
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3703
  using b3 apply blast
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3704
    apply(simp)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3705
  apply (metis bmkeps_simp contains.intros(4) contains.intros(5) contains0 contains49 f_cont1)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3706
       apply(erule contains.cases)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3707
         apply(auto)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3708
  (* ALT case *)
356
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3709
  apply(subgoal_tac "\<exists>bsX. bs = x1 @ bsX")
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3710
  prefer 2
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3711
  using contains59 f_cont1 apply blast
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3712
  apply(auto)
356
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3713
  apply(rule derc_alt2[simplified])
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3714
   apply(simp)
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3715
  by blast
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3716
356
8f9ea6453ba2 added "big" lemma
Christian Urban <urbanc@in.tum.de>
parents: 350
diff changeset
  3717
  
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3718
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3719
lemma bder_simp_containsA:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3720
  assumes "bder c a >> bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3721
  shows "bsimp (bder c (bsimp a)) >> bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3722
  using assms
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3723
  by (simp add: bder_simp_contains contains55)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3724
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3725
lemma bder_simp_containsB:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3726
  assumes "bsimp (bder c a) >> bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3727
  shows "bder c (bsimp a) >> bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3728
  using assms
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3729
  by (simp add: PPP1_eq bder_simp_contains)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3730
    
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3731
lemma bder_simp_contains_IFF:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3732
  assumes "good a"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3733
  shows "bsimp (bder c a) >> bs \<longleftrightarrow> bder c (bsimp a) >> bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3734
  using assms
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3735
  by (simp add: PPP1_eq test2)  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3736
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3737
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3738
lemma ders_seq:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3739
  assumes "bders (ASEQ bs a1 a2) s >> bs @ bs2"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3740
  and "\<And>s bs. bders a1 s >> bs \<Longrightarrow> bders (bsimp a1) s >> bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3741
      "\<And>s bs. bders a2 s >> bs \<Longrightarrow> bders (bsimp a2) s >> bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3742
    shows "bders (ASEQ bs (bsimp a1) (bsimp a2)) s >> bs @ bs2"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3743
  using assms(1)  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3744
  apply(induct s arbitrary: a1 a2 bs bs2 rule: rev_induct)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3745
   apply(auto)[1]
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3746
  thm CT1_SEQ PPP1_eq
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3747
  apply (metis CT1_SEQ PPP1_eq)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3748
  apply(auto simp add: bders_append)  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3749
  apply(drule bder_simp_contains)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3750
  oops
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3751
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3752
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3753
lemma bders_simp_contains:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3754
  assumes "bders a s >> bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3755
  shows "bders (bsimp a) s >> bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3756
 using assms
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3757
  apply(induct a arbitrary: s bs)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3758
       apply(auto elim: contains.cases)[4]
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3759
   prefer 2  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3760
   apply(subgoal_tac "\<exists>bsX. bs = x1 @ bsX")
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3761
    prefer 2
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3762
  apply (metis bders_AALTs contains59 f_cont1)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3763
  apply(clarify)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3764
  apply(rule ders_alt2)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3765
    apply(assumption)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3766
   apply(auto)[1]
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3767
  prefer 2
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3768
  apply simp
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3769
  (* SEQ case *)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3770
  apply(case_tac "bsimp a1 = AZERO")
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3771
  apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3772
  apply (metis LLLL(1) bders_AZERO(1) bsimp.simps(1) bsimp.simps(3) bsimp_ASEQ.simps(1) contains55 ders_correctness erase_bders good.simps(1) good1a xxx_bder2)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3773
    apply(case_tac "bsimp a2 = AZERO")
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3774
  apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3775
  apply (metis LLLL(1) bders_AZERO(1) bsimp.simps(1) bsimp.simps(3) bsimp_ASEQ0 contains55 ders_correctness erase_bders good.simps(1) good1a xxx_bder2)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3776
  apply(case_tac "\<exists>bsX. bsimp a1 = AONE bsX")
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3777
  apply(auto)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3778
  apply(subst bsimp_ASEQ2)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3779
  apply(case_tac s)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3780
   apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3781
   apply (metis b1 bsimp.simps(1) contains55)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3782
  apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3783
   apply(subgoal_tac "bnullable a1")
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3784
    prefer 2
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3785
  using b3 apply fastforce
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3786
  apply(auto)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3787
   apply(subst (asm) bders_AALTs)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3788
  apply(erule contains.cases)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3789
             apply(auto)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3790
  prefer 2
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3791
  apply(erule contains.cases)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3792
          apply(auto)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3793
  apply(simp add: fuse_append)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3794
     apply(simp add: bder_fuse bders_fuse)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3795
apply (metis bders.simps(2) bmkeps.simps(1) bmkeps_simp contains0 contains49 f_cont1)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3796
  using contains_equiv_def apply auto[1]
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3797
   apply(simp add: bder_fuse bders_fuse fuse_append)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3798
   apply(rule contains0)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3799
  oops
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3800
  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3801
  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3802
lemma T0:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3803
  assumes "s = []"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3804
  shows "bders (bsimp r) s >> bs \<longleftrightarrow> bders r s >> bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3805
  using assms
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3806
  by (simp add: PPP1_eq test2)  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3807
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3808
lemma T1:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3809
  assumes "s = [a]" "bders r s >> bs"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3810
  shows "bders (bsimp r) s >> bs"
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3811
  using assms
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3812
  apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3813
  by (simp add: bder_simp_contains)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3814
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3815
lemma TX:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3816
  assumes "\<Turnstile> v : ders s (erase r)" "\<Turnstile> v : ders s (erase (bsimp r))"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3817
  shows "bders r s >>  FC r s v \<longleftrightarrow> bders (bsimp r) s >> FC (bsimp r) s v"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3818
  using FC_def contains7b 
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3819
  using assms by metis
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3820
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3821
lemma mkeps1:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3822
  assumes "s \<in> L (erase r)"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3823
  shows "\<Turnstile> mkeps (ders s (erase r)) : ders s (erase r)"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3824
  using assms
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3825
  by (meson lexer_correct_None lexer_flex mkeps_nullable)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3826
  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3827
lemma mkeps2:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3828
  assumes "s \<in> L (erase r)"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3829
  shows "\<Turnstile> mkeps (ders s (erase (bsimp r))) : ders s (erase (bsimp r))"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3830
  using assms
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3831
  by (metis LLLL(1) lexer_correct_None lexer_flex mkeps_nullable)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3832
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3833
thm FC_def FE_def PX_def PV_def
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3834
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3835
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3836
lemma TX2:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3837
  assumes "s \<in> L (erase r)"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3838
  shows "bders r s >>  FE r s \<longleftrightarrow> bders (bsimp r) s >> FE (bsimp r) s"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3839
  using assms
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3840
  by (simp add: FE_def contains7b mkeps1 mkeps2)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3841
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3842
lemma TX3:
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3843
  assumes "s \<in> L (erase r)"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3844
  shows "bders r s >>  FE r s \<longleftrightarrow> bders (bsimp r) s >> FE (bders (bsimp r) s) []"
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3845
  using assms
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3846
  by (metis FE_PX FE_def L07 LLLL(1) PX_id TX2)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3847
  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3848
find_theorems "FE _ _ = _"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3849
find_theorems "FC _ _ _ = _"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3850
find_theorems "(bder _ _ >> _ _ _ _) = _"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3851
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3852
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3853
(* HERE *)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3854
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3855
lemma PX:
359
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  3856
  assumes "s \<in> L r" "bders (intern r) s >> code (PX r s)"
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  3857
  shows "bders (bsimp (intern r)) s >> code (PX r s)"
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  3858
  using assms
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  3859
  apply(induct s arbitrary: r rule: rev_induct)
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3860
   apply(simp)
359
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  3861
   apply (simp add: PPP1_eq)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  3862
  apply (simp add: bders_append bders_simp_append)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  3863
  thm PX_bder_iff PX_bders_iff
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  3864
  apply(subst (asm) PX_bder_iff)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  3865
   apply(assumption)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  3866
  apply(subst (asm) (2) PX_bders_iff)
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  3867
  find_theorems "_ >> code (PX _ _)"
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  3868
  find_theorems "PX _ _ = _"
fedc16924b76 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 358
diff changeset
  3869
  find_theorems "(intern _) >> _"
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3870
  apply (simp add: contains55)  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3871
  apply (simp add: bders_append bders_simp_append)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3872
   apply (simp add: PPP1_eq)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3873
  find_theorems "(bder _ _ >> _) = _"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3874
  apply(rule contains50)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3875
  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3876
  apply(case_tac "bders a xs = AZERO")
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3877
   apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3878
   apply(subgoal_tac "bders_simp a xs = AZERO")
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3879
    prefer 2
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3880
  apply (metis L_bders_simp XXX4a_good_cons bders.simps(1) bders_simp.simps(1) bsimp.simps(3) good.simps(1) good1a test2 xxx_bder2)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3881
   apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3882
  apply(case_tac xs)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3883
  apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3884
  apply (simp add: PPP1_eq)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3885
  apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3886
  apply(subgoal_tac "good (bders_simp a (aa # list)) \<or> (bders_simp a (aa # list) = AZERO)")
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3887
  apply(auto)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3888
      apply(subst (asm) bder_simp_contains_IFF)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3889
       apply(simp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3890
  
358
06aa99b54423 updated
Christian Urban <urbanc@in.tum.de>
parents: 357
diff changeset
  3891
(* TOBE PROVED *)
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3892
lemma
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3893
  assumes "s \<in> L (erase r)"
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3894
  shows "bders_simp r s >> bs \<longleftrightarrow> bders r s >> bs"
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3895
  using assms
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3896
  apply(induct s arbitrary: r bs)
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3897
   apply(simp)
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3898
  apply(simp add: bders_append bders_simp_append)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3899
  apply(rule iffI)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3900
   apply(drule_tac x="bsimp (bder a r)" in meta_spec)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3901
  apply(drule_tac x="bs" in meta_spec)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3902
   apply(drule meta_mp)
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3903
  using L_bsimp_erase lexer_correct_None apply fastforce
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3904
  apply(simp)
357
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3905
    
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3906
  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3907
   prefer 2
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3908
  
533765dc71cc a bit more cleaning up
Christian Urban <urbanc@in.tum.de>
parents: 356
diff changeset
  3909
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3910
  oops
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3911
339
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3912
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3913
lemma
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3914
  assumes "s \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3915
  shows "(bders_simp (intern r) s >> code (PX r s)) \<longleftrightarrow> ((intern r) >> code (PX r s))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3916
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3917
  apply(induct s arbitrary: r rule: rev_induct)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3918
   apply(simp)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3919
  apply(simp add: bders_simp_append)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3920
  apply(simp add: PPP1_eq)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3921
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3922
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3923
find_theorems "retrieve (bders _ _) _"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3924
find_theorems "_ >> retrieve _ _"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3925
find_theorems "bsimp _ >> _"
343
f139bdc0dcd5 updated contains
Christian Urban <urbanc@in.tum.de>
parents: 339
diff changeset
  3926
  oops
339
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3927
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3928
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3929
lemma PX4a: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3930
  assumes "(s1 @ s2) \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3931
  shows "bders (intern r) (s1 @ s2) >> code (PV r s1 (PX (ders s1 r) s2))"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3932
  using PX4[OF assms]
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3933
  apply(simp add: PX_append)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3934
  done
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3935
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3936
lemma PV5: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3937
  assumes "s2 \<in> (ders s1 r) \<rightarrow> v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3938
  shows "bders (intern r) (s1 @ s2) >> code (PV r s1 v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3939
  by (simp add: PPP0_isar PV_def Posix_flex assms)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3940
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3941
lemma PV6: 
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3942
  assumes "s2 \<in> (ders s1 r) \<rightarrow> v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3943
  shows "bders (bders (intern r) s1) s2 >> code (PV r s1 v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3944
  using PV5 assms bders_append by auto
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3945
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3946
find_theorems "retrieve (bders _ _) _"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3947
find_theorems "_ >> retrieve _ _"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3948
find_theorems "bder _ _ >> _"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3949
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3950
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3951
lemma OO0_PX:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3952
  assumes "s \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3953
  shows "bders (intern r) s >> code (PX r s)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3954
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3955
  by (simp add: PX3)
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3956
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3957
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3958
lemma OO1:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3959
  assumes "[c] \<in> r \<rightarrow> v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3960
  shows "bder c (intern r) >> code v"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3961
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3962
  using PPP0_isar by force
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3963
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3964
lemma OO1a:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3965
  assumes "[c] \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3966
  shows "bder c (intern r) >> code (PX r [c])"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3967
  using assms unfolding PX_def PV_def
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3968
  using contains70 by fastforce
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3969
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3970
lemma OO12:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3971
  assumes "[c1, c2] \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3972
  shows "bders (intern r) [c1, c2] >> code (PX r [c1, c2])"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3973
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3974
  using PX_def PV_def contains70 by presburger
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3975
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3976
lemma OO2:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3977
  assumes "[c] \<in> L r"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3978
  shows "bders_simp (intern r) [c] >> code (PX r [c])"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3979
  using assms
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3980
  using OO1a Posix1(1) contains55 by auto
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3981
  
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3982
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3983
thm L07XX PPP0b erase_intern
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3984
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3985
find_theorems "retrieve (bders _ _) _"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3986
find_theorems "_ >> retrieve _ _"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3987
find_theorems "bder _ _ >> _"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3988
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3989
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3990
lemma PPP3:
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3991
  assumes "\<Turnstile> v : ders s (erase a)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3992
  shows "bders a s >> retrieve a (flex (erase a) id s v)"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3993
  using LA[OF assms] contains6 erase_bders assms by metis
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3994
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3995
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3996
find_theorems "bder _ _ >> _"
9d466b27b054 added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents: 338
diff changeset
  3997
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  3998
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  3999
lemma
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  4000
  fixes n :: nat
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  4001
  shows "(\<Sum>i \<in> {0..n}. i) = n * (n + 1) div 2"
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  4002
  apply(induct n)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  4003
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  4004
  apply(simp)
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  4005
  done
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  4006
344
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4007
lemma COUNTEREXAMPLE:
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4008
  assumes "r = AALTs [S] [ASEQ [S] (AALTs [S] [AONE [S], ACHAR [S] c]) (ACHAR [S] c)]"
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4009
  shows "bsimp (bder c (bsimp r)) = bsimp (bder c r)"
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4010
  apply(simp_all add: assms)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4011
  oops
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4012
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4013
lemma COUNTEREXAMPLE:
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4014
  assumes "r = AALTs [S] [ASEQ [S] (AALTs [S] [AONE [S], ACHAR [S] c]) (ACHAR [S] c)]"
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4015
  shows "bsimp r = r"
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4016
  apply(simp_all add: assms)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4017
  oops
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4018
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4019
lemma COUNTEREXAMPLE:
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4020
  assumes "r = AALTs [S] [ASEQ [S] (AALTs [S] [AONE [S], ACHAR [S] c]) (ACHAR [S] c)]"
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4021
  shows "bsimp r = XXX"
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4022
  and   "bder c r = XXX"
345
c7fd85daa1d7 updated with the proof of bder
Christian Urban <urbanc@in.tum.de>
parents: 344
diff changeset
  4023
  and   "bder c (bsimp r) = XXX"
344
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4024
  and   "bsimp (bder c (bsimp r)) = XXX"
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4025
  and   "bsimp (bder c r) = XXX"
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4026
  apply(simp_all add: assms)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4027
  oops
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4028
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4029
lemma COUNTEREXAMPLE_contains1:
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4030
  assumes "r = AALTs [S] [ASEQ [S] (AALTs [S] [AONE [S], ACHAR [S] c]) (ACHAR [S] c)]"
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4031
  and   "bsimp (bder c r) >> bs"
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4032
  shows "bsimp (bder c (bsimp r)) >> bs"
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4033
  using assms 
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4034
  apply(auto elim!: contains.cases)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4035
   apply(rule Etrans)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4036
    apply(rule contains.intros)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4037
    apply(rule contains.intros)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4038
   apply(simp)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4039
  apply(rule Etrans)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4040
    apply(rule contains.intros)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4041
    apply(rule contains.intros)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4042
  apply(simp)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4043
  done
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4044
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4045
lemma COUNTEREXAMPLE_contains2:
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4046
  assumes "r = AALTs [S] [ASEQ [S] (AALTs [S] [AONE [S], ACHAR [S] c]) (ACHAR [S] c)]"
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4047
  and   "bsimp (bder c (bsimp r)) >> bs"
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4048
  shows "bsimp (bder c r) >> bs" 
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4049
  using assms 
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4050
  apply(auto elim!: contains.cases)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4051
   apply(rule Etrans)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4052
    apply(rule contains.intros)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4053
    apply(rule contains.intros)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4054
   apply(simp)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4055
  apply(rule Etrans)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4056
    apply(rule contains.intros)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4057
    apply(rule contains.intros)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4058
  apply(simp)
4e73568b9cf6 added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents: 343
diff changeset
  4059
  done
337
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  4060
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  4061
50bb2c83eeb1 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  4062
end