thys/BitCoded.thy
author Chengsong
Mon, 19 Aug 2019 16:22:58 +0100
changeset 341 abf178a5db58
parent 340 6c71db65bdec
child 343 f139bdc0dcd5
permissions -rw-r--r--
hope it works
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
     1
341
abf178a5db58 hope it works
Chengsong
parents: 340
diff changeset
     2
theory BitCodedCT
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
     3
  imports "Lexer" 
148
702ed601349b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
begin
702ed601349b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
     6
section \<open>Bit-Encodings\<close>
154
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
     7
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
     8
datatype bit = Z | S
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
     9
154
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    10
fun 
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    11
  code :: "val \<Rightarrow> bit list"
154
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    12
where
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    13
  "code Void = []"
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    14
| "code (Char c) = []"
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    15
| "code (Left v) = Z # (code v)"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    16
| "code (Right v) = S # (code v)"
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    17
| "code (Seq v1 v2) = (code v1) @ (code v2)"
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    18
| "code (Stars []) = [S]"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    19
| "code (Stars (v # vs)) =  (Z # code v) @ code (Stars vs)"
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    20
154
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    21
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    22
fun 
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    23
  Stars_add :: "val \<Rightarrow> val \<Rightarrow> val"
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    24
where
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    25
  "Stars_add v (Stars vs) = Stars (v # vs)"
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    26
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    27
function
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    28
  decode' :: "bit list \<Rightarrow> rexp \<Rightarrow> (val * bit list)"
154
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    29
where
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    30
  "decode' ds ZERO = (Void, [])"
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    31
| "decode' ds ONE = (Void, ds)"
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    32
| "decode' ds (CHAR d) = (Char d, ds)"
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    33
| "decode' [] (ALT r1 r2) = (Void, [])"
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    34
| "decode' (Z # ds) (ALT r1 r2) = (let (v, ds') = decode' ds r1 in (Left v, ds'))"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    35
| "decode' (S # ds) (ALT r1 r2) = (let (v, ds') = decode' ds r2 in (Right v, ds'))"
154
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    36
| "decode' ds (SEQ r1 r2) = (let (v1, ds') = decode' ds r1 in
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    37
                             let (v2, ds'') = decode' ds' r2 in (Seq v1 v2, ds''))"
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    38
| "decode' [] (STAR r) = (Void, [])"
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    39
| "decode' (S # ds) (STAR r) = (Stars [], ds)"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    40
| "decode' (Z # ds) (STAR r) = (let (v, ds') = decode' ds r in
154
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    41
                                    let (vs, ds'') = decode' ds' (STAR r) 
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    42
                                    in (Stars_add v vs, ds''))"
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    43
by pat_completeness auto
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    44
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    45
lemma decode'_smaller:
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    46
  assumes "decode'_dom (ds, r)"
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    47
  shows "length (snd (decode' ds r)) \<le> length ds"
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    48
using assms
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    49
apply(induct ds r)
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    50
apply(auto simp add: decode'.psimps split: prod.split)
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    51
using dual_order.trans apply blast
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    52
by (meson dual_order.trans le_SucI)
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    53
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    54
termination "decode'"  
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    55
apply(relation "inv_image (measure(%cs. size cs) <*lex*> measure(%s. size s)) (%(ds,r). (r,ds))") 
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    56
apply(auto dest!: decode'_smaller)
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    57
by (metis less_Suc_eq_le snd_conv)
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    58
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    59
definition
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    60
  decode :: "bit list \<Rightarrow> rexp \<Rightarrow> val option"
154
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    61
where
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    62
  "decode ds r \<equiv> (let (v, ds') = decode' ds r 
154
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    63
                  in (if ds' = [] then Some v else None))"
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    64
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    65
lemma decode'_code_Stars:
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    66
  assumes "\<forall>v\<in>set vs. \<Turnstile> v : r \<and> (\<forall>x. decode' (code v @ x) r = (v, x)) \<and> flat v \<noteq> []" 
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    67
  shows "decode' (code (Stars vs) @ ds) (STAR r) = (Stars vs, ds)"
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    68
  using assms
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    69
  apply(induct vs)
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    70
  apply(auto)
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    71
  done
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    72
154
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    73
lemma decode'_code:
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    74
  assumes "\<Turnstile> v : r"
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    75
  shows "decode' ((code v) @ ds) r = (v, ds)"
154
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    76
using assms
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    77
  apply(induct v r arbitrary: ds) 
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    78
  apply(auto)
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    79
  using decode'_code_Stars by blast
154
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    80
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    81
lemma decode_code:
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    82
  assumes "\<Turnstile> v : r"
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    83
  shows "decode (code v) r = Some v"
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    84
  using assms unfolding decode_def
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    85
  by (smt append_Nil2 decode'_code old.prod.case)
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
    86
154
2de3cf684ba0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
    87
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
    88
section {* Annotated Regular Expressions *}
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
    89
314
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
    90
datatype arexp = 
159
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
    91
  AZERO
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    92
| AONE "bit list"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    93
| ACHAR "bit list" char
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    94
| ASEQ "bit list" arexp arexp
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
    95
| AALTs "bit list" "arexp list"
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    96
| ASTAR "bit list" arexp
159
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
    97
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
    98
abbreviation
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
    99
  "AALT bs r1 r2 \<equiv> AALTs bs [r1, r2]"
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   100
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   101
fun asize :: "arexp \<Rightarrow> nat" where
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   102
  "asize AZERO = 1"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   103
| "asize (AONE cs) = 1" 
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   104
| "asize (ACHAR cs c) = 1"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   105
| "asize (AALTs cs rs) = Suc (sum_list (map asize rs))"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   106
| "asize (ASEQ cs r1 r2) = Suc (asize r1 + asize r2)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   107
| "asize (ASTAR cs r) = Suc (asize r)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   108
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   109
fun 
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   110
  erase :: "arexp \<Rightarrow> rexp"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   111
where
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   112
  "erase AZERO = ZERO"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   113
| "erase (AONE _) = ONE"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   114
| "erase (ACHAR _ c) = CHAR c"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   115
| "erase (AALTs _ []) = ZERO"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   116
| "erase (AALTs _ [r]) = (erase r)"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   117
| "erase (AALTs bs (r#rs)) = ALT (erase r) (erase (AALTs bs rs))"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   118
| "erase (ASEQ _ r1 r2) = SEQ (erase r1) (erase r2)"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   119
| "erase (ASTAR _ r) = STAR (erase r)"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   120
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   121
lemma decode_code_erase:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   122
  assumes "\<Turnstile> v : (erase  a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   123
  shows "decode (code v) (erase a) = Some v"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   124
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   125
  by (simp add: decode_code) 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   126
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   127
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   128
fun nonalt :: "arexp \<Rightarrow> bool"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   129
  where
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   130
  "nonalt (AALTs bs2 rs) = False"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   131
| "nonalt r = True"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   132
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   133
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   134
fun good :: "arexp \<Rightarrow> bool" where
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   135
  "good AZERO = False"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   136
| "good (AONE cs) = True" 
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   137
| "good (ACHAR cs c) = True"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   138
| "good (AALTs cs []) = False"
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
   139
| "good (AALTs cs [r]) = False"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
   140
| "good (AALTs cs (r1#r2#rs)) = (\<forall>r' \<in> set (r1#r2#rs). good r' \<and> nonalt r')"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
   141
| "good (ASEQ _ AZERO _) = False"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
   142
| "good (ASEQ _ (AONE _) _) = False"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
   143
| "good (ASEQ _ _ AZERO) = False"
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   144
| "good (ASEQ cs r1 r2) = (good r1 \<and> good r2)"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   145
| "good (ASTAR cs r) = True"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   146
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   147
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   148
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   149
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   150
fun fuse :: "bit list \<Rightarrow> arexp \<Rightarrow> arexp" where
159
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   151
  "fuse bs AZERO = AZERO"
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   152
| "fuse bs (AONE cs) = AONE (bs @ cs)" 
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   153
| "fuse bs (ACHAR cs c) = ACHAR (bs @ cs) c"
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   154
| "fuse bs (AALTs cs rs) = AALTs (bs @ cs) rs"
159
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   155
| "fuse bs (ASEQ cs r1 r2) = ASEQ (bs @ cs) r1 r2"
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   156
| "fuse bs (ASTAR cs r) = ASTAR (bs @ cs) r"
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   157
314
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   158
lemma fuse_append:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   159
  shows "fuse (bs1 @ bs2) r = fuse bs1 (fuse bs2 r)"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   160
  apply(induct r)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   161
  apply(auto)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   162
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   163
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   164
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   165
fun intern :: "rexp \<Rightarrow> arexp" where
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   166
  "intern ZERO = AZERO"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   167
| "intern ONE = AONE []"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   168
| "intern (CHAR c) = ACHAR [] c"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   169
| "intern (ALT r1 r2) = AALT [] (fuse [Z] (intern r1)) 
295
c6ec5f369037 updated
Christian Urban <urbanc@in.tum.de>
parents: 293
diff changeset
   170
                                (fuse [S]  (intern r2))"
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   171
| "intern (SEQ r1 r2) = ASEQ [] (intern r1) (intern r2)"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   172
| "intern (STAR r) = ASTAR [] (intern r)"
159
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   173
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   174
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   175
fun retrieve :: "arexp \<Rightarrow> val \<Rightarrow> bit list" where
159
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   176
  "retrieve (AONE bs) Void = bs"
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   177
| "retrieve (ACHAR bs c) (Char d) = bs"
313
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   178
| "retrieve (AALTs bs [r]) v = bs @ retrieve r v" 
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   179
| "retrieve (AALTs bs (r#rs)) (Left v) = bs @ retrieve r v"
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   180
| "retrieve (AALTs bs (r#rs)) (Right v) = bs @ retrieve (AALTs [] rs) v"
159
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   181
| "retrieve (ASEQ bs r1 r2) (Seq v1 v2) = bs @ retrieve r1 v1 @ retrieve r2 v2"
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   182
| "retrieve (ASTAR bs r) (Stars []) = bs @ [S]"
159
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   183
| "retrieve (ASTAR bs r) (Stars (v#vs)) = 
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   184
     bs @ [Z] @ retrieve r v @ retrieve (ASTAR [] r) (Stars vs)"
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   185
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   186
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   187
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   188
fun
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   189
 bnullable :: "arexp \<Rightarrow> bool"
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   190
where
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   191
  "bnullable (AZERO) = False"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   192
| "bnullable (AONE bs) = True"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   193
| "bnullable (ACHAR bs c) = False"
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   194
| "bnullable (AALTs bs rs) = (\<exists>r \<in> set rs. bnullable r)"
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   195
| "bnullable (ASEQ bs r1 r2) = (bnullable r1 \<and> bnullable r2)"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   196
| "bnullable (ASTAR bs r) = True"
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   197
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   198
fun 
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   199
  bmkeps :: "arexp \<Rightarrow> bit list"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   200
where
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   201
  "bmkeps(AONE bs) = bs"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   202
| "bmkeps(ASEQ bs r1 r2) = bs @ (bmkeps r1) @ (bmkeps r2)"
313
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   203
| "bmkeps(AALTs bs [r]) = bs @ (bmkeps r)"
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   204
| "bmkeps(AALTs bs (r#rs)) = (if bnullable(r) then bs @ (bmkeps r) else (bmkeps (AALTs bs rs)))"
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   205
| "bmkeps(ASTAR bs r) = bs @ [S]"
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   206
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   207
159
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   208
fun
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   209
 bder :: "char \<Rightarrow> arexp \<Rightarrow> arexp"
159
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   210
where
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   211
  "bder c (AZERO) = AZERO"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   212
| "bder c (AONE bs) = AZERO"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   213
| "bder c (ACHAR bs d) = (if c = d then AONE bs else AZERO)"
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   214
| "bder c (AALTs bs rs) = AALTs bs (map (bder c) rs)"
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   215
| "bder c (ASEQ bs r1 r2) = 
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   216
     (if bnullable r1
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   217
      then AALT bs (ASEQ [] (bder c r1) r2) (fuse (bmkeps r1) (bder c r2))
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   218
      else ASEQ bs (bder c r1) r2)"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   219
| "bder c (ASTAR bs r) = ASEQ bs (fuse [Z] (bder c r)) (ASTAR [] r)"
159
940530087f30 updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 154
diff changeset
   220
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   221
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   222
fun 
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   223
  bders :: "arexp \<Rightarrow> string \<Rightarrow> arexp"
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   224
where
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   225
  "bders r [] = r"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   226
| "bders r (c#s) = bders (bder c r) s"
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   227
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   228
lemma bders_append:
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   229
  "bders r (s1 @ s2) = bders (bders r s1) s2"
287
95b3880d428f updated
Christian Urban <urbanc@in.tum.de>
parents: 286
diff changeset
   230
  apply(induct s1 arbitrary: r s2)
95b3880d428f updated
Christian Urban <urbanc@in.tum.de>
parents: 286
diff changeset
   231
  apply(simp_all)
95b3880d428f updated
Christian Urban <urbanc@in.tum.de>
parents: 286
diff changeset
   232
  done
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   233
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   234
lemma bnullable_correctness:
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   235
  shows "nullable (erase r) = bnullable r"
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   236
  apply(induct r rule: erase.induct)
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   237
  apply(simp_all)
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   238
  done
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   239
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   240
lemma erase_fuse:
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   241
  shows "erase (fuse bs r) = erase r"
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   242
  apply(induct r rule: erase.induct)
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   243
  apply(simp_all)
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   244
  done
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   245
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   246
lemma erase_intern [simp]:
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   247
  shows "erase (intern r) = r"
287
95b3880d428f updated
Christian Urban <urbanc@in.tum.de>
parents: 286
diff changeset
   248
  apply(induct r)
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   249
  apply(simp_all add: erase_fuse)
287
95b3880d428f updated
Christian Urban <urbanc@in.tum.de>
parents: 286
diff changeset
   250
  done
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   251
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   252
lemma erase_bder [simp]:
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   253
  shows "erase (bder a r) = der a (erase r)"
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   254
  apply(induct r rule: erase.induct)
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   255
  apply(simp_all add: erase_fuse bnullable_correctness)
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   256
  done
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   257
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   258
lemma erase_bders [simp]:
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   259
  shows "erase (bders r s) = ders s (erase r)"
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   260
  apply(induct s arbitrary: r )
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   261
  apply(simp_all)
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   262
  done
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   263
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   264
lemma retrieve_encode_STARS:
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   265
  assumes "\<forall>v\<in>set vs. \<Turnstile> v : r \<and> code v = retrieve (intern r) v"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   266
  shows "code (Stars vs) = retrieve (ASTAR [] (intern r)) (Stars vs)"
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   267
  using assms
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   268
  apply(induct vs)
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   269
  apply(simp_all)
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   270
  done
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   271
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   272
lemma retrieve_fuse2:
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   273
  assumes "\<Turnstile> v : (erase r)"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   274
  shows "retrieve (fuse bs r) v = bs @ retrieve r v"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   275
  using assms
313
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   276
  apply(induct r arbitrary: v bs)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   277
         apply(auto elim: Prf_elims)[4]
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   278
   defer
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   279
  using retrieve_encode_STARS
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   280
   apply(auto elim!: Prf_elims)[1]
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   281
   apply(case_tac vs)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   282
    apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   283
   apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   284
  (* AALTs  case *)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   285
  apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   286
  apply(case_tac x2a)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   287
   apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   288
   apply(auto elim!: Prf_elims)[1]
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   289
  apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   290
   apply(case_tac list)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   291
   apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   292
  apply(auto)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   293
  apply(auto elim!: Prf_elims)[1]
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   294
  done
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   295
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   296
lemma retrieve_fuse:
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   297
  assumes "\<Turnstile> v : r"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   298
  shows "retrieve (fuse bs (intern r)) v = bs @ retrieve (intern r) v"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   299
  using assms 
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   300
  by (simp_all add: retrieve_fuse2)
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   301
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   302
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   303
lemma retrieve_code:
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   304
  assumes "\<Turnstile> v : r"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   305
  shows "code v = retrieve (intern r) v"
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   306
  using assms
311
8b8db9558ecf updated
Christian Urban <urbanc@in.tum.de>
parents: 307
diff changeset
   307
  apply(induct v r )
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   308
  apply(simp_all add: retrieve_fuse retrieve_encode_STARS)
313
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   309
  done
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   310
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   311
lemma r:
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   312
  assumes "bnullable (AALTs bs (a # rs))"
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   313
  shows "bnullable a \<or> (\<not> bnullable a \<and> bnullable (AALTs bs rs))"
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   314
  using assms
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   315
  apply(induct rs)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   316
   apply(auto)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   317
  done
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   318
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   319
lemma r0:
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   320
  assumes "bnullable a" 
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   321
  shows  "bmkeps (AALTs bs (a # rs)) = bs @ (bmkeps a)"
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   322
  using assms
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   323
  by (metis bmkeps.simps(3) bmkeps.simps(4) list.exhaust)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   324
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   325
lemma r1:
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   326
  assumes "\<not> bnullable a" "bnullable (AALTs bs rs)"
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   327
  shows  "bmkeps (AALTs bs (a # rs)) = bmkeps (AALTs bs rs)"
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   328
  using assms
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   329
  apply(induct rs)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   330
   apply(auto)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   331
  done
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   332
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   333
lemma r2:
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   334
  assumes "x \<in> set rs" "bnullable x"
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   335
  shows "bnullable (AALTs bs rs)"
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   336
  using assms
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   337
  apply(induct rs)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   338
   apply(auto)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   339
  done
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   340
313
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   341
lemma  r3:
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   342
  assumes "\<not> bnullable r" 
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   343
          " \<exists> x \<in> set rs. bnullable x"
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   344
  shows "retrieve (AALTs bs rs) (mkeps (erase (AALTs bs rs))) =
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   345
         retrieve (AALTs bs (r # rs)) (mkeps (erase (AALTs bs (r # rs))))"
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   346
  using assms
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   347
  apply(induct rs arbitrary: r bs)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   348
   apply(auto)[1]
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   349
  apply(auto)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   350
  using bnullable_correctness apply blast
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   351
    apply(auto simp add: bnullable_correctness mkeps_nullable retrieve_fuse2)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   352
   apply(subst retrieve_fuse2[symmetric])
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   353
  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)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   354
   apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   355
  apply(case_tac "bnullable a")
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   356
  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)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   357
  apply(drule_tac x="a" in meta_spec)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   358
  apply(drule_tac x="bs" in meta_spec)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   359
  apply(drule meta_mp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   360
   apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   361
  apply(drule meta_mp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   362
   apply(auto)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   363
  apply(subst retrieve_fuse2[symmetric])
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   364
  apply(case_tac rs)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   365
    apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   366
   apply(auto)[1]
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   367
      apply (simp add: bnullable_correctness)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   368
  apply (metis append_Nil2 bnullable_correctness erase_fuse fuse.simps(4) list.set_intros(1) mkeps.simps(3) mkeps_nullable nullable.simps(4) r2)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   369
    apply (simp add: bnullable_correctness)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   370
  apply (metis append_Nil2 bnullable_correctness erase.simps(6) erase_fuse fuse.simps(4) list.set_intros(2) mkeps.simps(3) mkeps_nullable r2)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   371
  apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   372
  done
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   373
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   374
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   375
lemma t: 
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   376
  assumes "\<forall>r \<in> set rs. nullable (erase r) \<longrightarrow> bmkeps r = retrieve r (mkeps (erase r))" 
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   377
          "nullable (erase (AALTs bs rs))"
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   378
  shows " bmkeps (AALTs bs rs) = retrieve (AALTs bs rs) (mkeps (erase (AALTs bs rs)))"
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   379
  using assms
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   380
  apply(induct rs arbitrary: bs)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   381
   apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   382
  apply(auto simp add: bnullable_correctness)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   383
   apply(case_tac rs)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   384
     apply(auto simp add: bnullable_correctness)[2]
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   385
   apply(subst r1)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   386
     apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   387
    apply(rule r2)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   388
     apply(assumption)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   389
    apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   390
   apply(drule_tac x="bs" in meta_spec)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   391
   apply(drule meta_mp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   392
    apply(auto)[1]
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   393
   prefer 2
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   394
  apply(case_tac "bnullable a")
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   395
    apply(subst r0)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   396
     apply blast
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   397
    apply(subgoal_tac "nullable (erase a)")
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   398
  prefer 2
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   399
  using bnullable_correctness apply blast
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   400
  apply (metis (no_types, lifting) erase.simps(5) erase.simps(6) list.exhaust mkeps.simps(3) retrieve.simps(3) retrieve.simps(4))
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   401
  apply(subst r1)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   402
     apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   403
  using r2 apply blast
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   404
  apply(drule_tac x="bs" in meta_spec)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   405
   apply(drule meta_mp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   406
    apply(auto)[1]
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   407
   apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   408
  using r3 apply blast
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   409
  apply(auto)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   410
  using r3 by blast
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   411
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   412
lemma bmkeps_retrieve:
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   413
  assumes "nullable (erase r)"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   414
  shows "bmkeps r = retrieve r (mkeps (erase r))"
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   415
  using assms
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   416
  apply(induct r)
313
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   417
         apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   418
        apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   419
       apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   420
    apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   421
   defer
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   422
   apply(simp)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   423
  apply(rule t)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   424
   apply(auto)
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   425
  done
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   426
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   427
lemma bder_retrieve:
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   428
  assumes "\<Turnstile> v : der c (erase r)"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   429
  shows "retrieve (bder c r) v = retrieve r (injval (erase r) c v)"
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   430
  using assms
313
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   431
  apply(induct r arbitrary: v rule: erase.induct)
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   432
         apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   433
         apply(erule Prf_elims)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   434
        apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   435
        apply(erule Prf_elims) 
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   436
        apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   437
      apply(case_tac "c = ca")
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   438
       apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   439
       apply(erule Prf_elims)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   440
       apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   441
      apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   442
       apply(erule Prf_elims)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   443
  apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   444
      apply(erule Prf_elims)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   445
     apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   446
    apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   447
  apply(rename_tac "r\<^sub>1" "r\<^sub>2" rs v)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   448
    apply(erule Prf_elims)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   449
     apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   450
    apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   451
    apply(case_tac rs)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   452
     apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   453
    apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   454
  apply (smt Prf_elims(3) injval.simps(2) injval.simps(3) retrieve.simps(4) retrieve.simps(5) same_append_eq)
313
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   455
   apply(simp)
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   456
   apply(case_tac "nullable (erase r1)")
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   457
    apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   458
  apply(erule Prf_elims)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   459
     apply(subgoal_tac "bnullable r1")
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   460
  prefer 2
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   461
  using bnullable_correctness apply blast
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   462
    apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   463
     apply(erule Prf_elims)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   464
     apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   465
   apply(subgoal_tac "bnullable r1")
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   466
  prefer 2
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   467
  using bnullable_correctness apply blast
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   468
    apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   469
    apply(simp add: retrieve_fuse2)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   470
    apply(simp add: bmkeps_retrieve)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   471
   apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   472
   apply(erule Prf_elims)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   473
   apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   474
  using bnullable_correctness apply blast
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   475
  apply(rename_tac bs r v)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   476
  apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   477
  apply(erule Prf_elims)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   478
     apply(clarify)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   479
  apply(erule Prf_elims)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   480
  apply(clarify)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   481
  apply(subst injval.simps)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   482
  apply(simp del: retrieve.simps)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   483
  apply(subst retrieve.simps)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   484
  apply(subst retrieve.simps)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   485
  apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   486
  apply(simp add: retrieve_fuse2)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   487
  done
313
3b8e3a156200 adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents: 311
diff changeset
   488
  
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   489
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   490
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   491
lemma MAIN_decode:
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   492
  assumes "\<Turnstile> v : ders s r"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   493
  shows "Some (flex r id s v) = decode (retrieve (bders (intern r) s) v) r"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   494
  using assms
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   495
proof (induct s arbitrary: v rule: rev_induct)
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   496
  case Nil
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   497
  have "\<Turnstile> v : ders [] r" by fact
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   498
  then have "\<Turnstile> v : r" by simp
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   499
  then have "Some v = decode (retrieve (intern r) v) r"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   500
    using decode_code retrieve_code by auto
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   501
  then show "Some (flex r id [] v) = decode (retrieve (bders (intern r) []) v) r"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   502
    by simp
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   503
next
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   504
  case (snoc c s v)
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   505
  have IH: "\<And>v. \<Turnstile> v : ders s r \<Longrightarrow> 
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   506
     Some (flex r id s v) = decode (retrieve (bders (intern r) s) v) r" by fact
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   507
  have asm: "\<Turnstile> v : ders (s @ [c]) r" by fact
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   508
  then have asm2: "\<Turnstile> injval (ders s r) c v : ders s r" 
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   509
    by (simp add: Prf_injval ders_append)
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   510
  have "Some (flex r id (s @ [c]) v) = Some (flex r id s (injval (ders s r) c v))"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   511
    by (simp add: flex_append)
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   512
  also have "... = decode (retrieve (bders (intern r) s) (injval (ders s r) c v)) r"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   513
    using asm2 IH by simp
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   514
  also have "... = decode (retrieve (bder c (bders (intern r) s)) v) r"
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   515
    using asm by (simp_all add: bder_retrieve ders_append)
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   516
  finally show "Some (flex r id (s @ [c]) v) = 
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   517
                 decode (retrieve (bders (intern r) (s @ [c])) v) r" by (simp add: bders_append)
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   518
qed
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   519
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   520
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   521
definition blex where
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   522
 "blex a s \<equiv> if bnullable (bders a s) then Some (bmkeps (bders a s)) else None"
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   523
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   524
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   525
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   526
definition blexer where
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   527
 "blexer r s \<equiv> if bnullable (bders (intern r) s) then 
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   528
                decode (bmkeps (bders (intern r) s)) r else None"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   529
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   530
lemma blexer_correctness:
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   531
  shows "blexer r s = lexer r s"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   532
proof -
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   533
  { define bds where "bds \<equiv> bders (intern r) s"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   534
    define ds  where "ds \<equiv> ders s r"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   535
    assume asm: "nullable ds"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   536
    have era: "erase bds = ds" 
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   537
      unfolding ds_def bds_def by simp
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   538
    have mke: "\<Turnstile> mkeps ds : ds"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   539
      using asm by (simp add: mkeps_nullable)
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   540
    have "decode (bmkeps bds) r = decode (retrieve bds (mkeps ds)) r"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   541
      using bmkeps_retrieve
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   542
      using asm era by (simp add: bmkeps_retrieve)
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   543
    also have "... =  Some (flex r id s (mkeps ds))"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   544
      using mke by (simp_all add: MAIN_decode ds_def bds_def)
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   545
    finally have "decode (bmkeps bds) r = Some (flex r id s (mkeps ds))" 
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   546
      unfolding bds_def ds_def .
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   547
  }
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   548
  then show "blexer r s = lexer r s"
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   549
    unfolding blexer_def lexer_flex
293
1a4e5b94293b updated
Christian Urban <urbanc@in.tum.de>
parents: 289
diff changeset
   550
    apply(subst bnullable_correctness[symmetric])
1a4e5b94293b updated
Christian Urban <urbanc@in.tum.de>
parents: 289
diff changeset
   551
    apply(simp)
1a4e5b94293b updated
Christian Urban <urbanc@in.tum.de>
parents: 289
diff changeset
   552
    done
289
807acaf7f599 updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   553
qed
286
804fbb227568 added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents: 256
diff changeset
   554
295
c6ec5f369037 updated
Christian Urban <urbanc@in.tum.de>
parents: 293
diff changeset
   555
314
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   556
fun distinctBy :: "'a list \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b set \<Rightarrow> 'a list"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   557
  where
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   558
  "distinctBy [] f acc = []"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   559
| "distinctBy (x#xs) f acc = 
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   560
     (if (f x) \<in> acc then distinctBy xs f acc 
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   561
      else x # (distinctBy xs f ({f x} \<union> acc)))"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   562
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   563
fun flts :: "arexp list \<Rightarrow> arexp list"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   564
  where 
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   565
  "flts [] = []"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   566
| "flts (AZERO # rs) = flts rs"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   567
| "flts ((AALTs bs  rs1) # rs) = (map (fuse bs) rs1) @ flts rs"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   568
| "flts (r1 # rs) = r1 # flts rs"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   569
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   570
fun li :: "bit list \<Rightarrow> arexp list \<Rightarrow> arexp"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   571
  where
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   572
  "li _ [] = AZERO"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   573
| "li bs [a] = fuse bs a"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   574
| "li bs as = AALTs bs as"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   575
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   576
314
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   577
fun bsimp_ASEQ :: "bit list \<Rightarrow> arexp \<Rightarrow> arexp \<Rightarrow> arexp"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   578
  where
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   579
  "bsimp_ASEQ _ AZERO _ = AZERO"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   580
| "bsimp_ASEQ _ _ AZERO = AZERO"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   581
| "bsimp_ASEQ bs1 (AONE bs2) r2 = fuse (bs1 @ bs2) r2"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   582
| "bsimp_ASEQ bs1 r1 r2 = ASEQ  bs1 r1 r2"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   583
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   584
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   585
fun bsimp_AALTs :: "bit list \<Rightarrow> arexp list \<Rightarrow> arexp"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   586
  where
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   587
  "bsimp_AALTs _ [] = AZERO"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   588
| "bsimp_AALTs bs1 [r] = fuse bs1 r"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   589
| "bsimp_AALTs bs1 rs = AALTs bs1 rs"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   590
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   591
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   592
fun bsimp :: "arexp \<Rightarrow> arexp" 
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   593
  where
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   594
  "bsimp (ASEQ bs1 r1 r2) = bsimp_ASEQ bs1 (bsimp r1) (bsimp r2)"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   595
| "bsimp (AALTs bs1 rs) = bsimp_AALTs bs1 (flts (map bsimp rs))"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   596
| "bsimp r = r"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   597
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   598
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   599
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
   600
314
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   601
fun 
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   602
  bders_simp :: "arexp \<Rightarrow> string \<Rightarrow> arexp"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   603
where
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   604
  "bders_simp r [] = r"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   605
| "bders_simp r (c # s) = bders_simp (bsimp (bder c r)) s"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   606
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   607
definition blexer_simp where
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   608
 "blexer_simp r s \<equiv> if bnullable (bders_simp (intern r) s) then 
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   609
                decode (bmkeps (bders_simp (intern r) s)) r else None"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   610
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   611
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   612
lemma asize0:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   613
  shows "0 < asize r"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   614
  apply(induct  r)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   615
       apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   616
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   617
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   618
314
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   619
lemma bders_simp_append:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   620
  shows "bders_simp r (s1 @ s2) = bders_simp (bders_simp r s1) s2"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   621
  apply(induct s1 arbitrary: r s2)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   622
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   623
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   624
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   625
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   626
lemma bsimp_ASEQ_size:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   627
  shows "asize (bsimp_ASEQ bs r1 r2) \<le> Suc (asize r1 + asize r2)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   628
  apply(induct bs r1 r2 rule: bsimp_ASEQ.induct)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   629
  apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   630
  done
314
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   631
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   632
lemma fuse_size:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   633
  shows "asize (fuse bs r) = asize r"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   634
  apply(induct r)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   635
  apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   636
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   637
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   638
lemma flts_size:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   639
  shows "sum_list (map asize (flts rs)) \<le> sum_list (map asize rs)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   640
  apply(induct rs rule: flts.induct)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   641
        apply(simp_all)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   642
  by (metis (mono_tags, lifting) add_mono comp_apply eq_imp_le fuse_size le_SucI map_eq_conv)
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   643
  
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   644
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   645
lemma bsimp_AALTs_size:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   646
  shows "asize (bsimp_AALTs bs rs) \<le> Suc (sum_list (map asize rs))"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   647
  apply(induct rs rule: bsimp_AALTs.induct)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   648
  apply(auto simp add: fuse_size)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   649
  done
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   650
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   651
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   652
lemma bsimp_size:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   653
  shows "asize (bsimp r) \<le> asize r"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   654
  apply(induct r)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   655
       apply(simp_all)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   656
   apply (meson Suc_le_mono add_mono_thms_linordered_semiring(1) bsimp_ASEQ_size le_trans)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   657
  apply(rule le_trans)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   658
   apply(rule bsimp_AALTs_size)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   659
  apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   660
   apply(rule le_trans)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   661
   apply(rule flts_size)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   662
  by (simp add: sum_list_mono)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   663
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   664
lemma bsimp_asize0:
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   665
  shows "(\<Sum>x\<leftarrow>rs. asize (bsimp x)) \<le> sum_list (map asize rs)"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   666
  apply(induct rs)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   667
   apply(auto)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
   668
  by (simp add: add_mono bsimp_size)
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   669
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   670
lemma bsimp_AALTs_size2:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   671
  assumes "\<forall>r \<in> set  rs. nonalt r"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   672
  shows "asize (bsimp_AALTs bs rs) \<ge> sum_list (map asize rs)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   673
  using assms
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   674
  apply(induct rs rule: bsimp_AALTs.induct)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   675
    apply(simp_all add: fuse_size)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   676
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   677
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   678
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   679
lemma qq:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   680
  shows "map (asize \<circ> fuse bs) rs = map asize rs"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   681
  apply(induct rs)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   682
   apply(auto simp add: fuse_size)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   683
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   684
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   685
lemma flts_size2:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   686
  assumes "\<exists>bs rs'. AALTs bs  rs' \<in> set rs"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   687
  shows "sum_list (map asize (flts rs)) < sum_list (map asize rs)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   688
  using assms
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   689
  apply(induct rs)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   690
   apply(auto simp add: qq)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   691
   apply (simp add: flts_size less_Suc_eq_le)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   692
  apply(case_tac a)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   693
       apply(auto simp add: qq)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   694
   prefer 2
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   695
   apply (simp add: flts_size le_imp_less_Suc)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   696
  using less_Suc_eq by auto
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   697
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   698
lemma bsimp_AALTs_size3:
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   699
  assumes "\<exists>r \<in> set  (map bsimp rs). \<not>nonalt r"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   700
  shows "asize (bsimp (AALTs bs rs)) < asize (AALTs bs rs)"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   701
  using assms flts_size2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   702
  apply  -
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   703
  apply(clarify)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   704
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   705
  apply(drule_tac x="map bsimp rs" in meta_spec)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   706
  apply(drule meta_mp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   707
  apply (metis list.set_map nonalt.elims(3))
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   708
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   709
  apply(rule order_class.order.strict_trans1)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   710
   apply(rule bsimp_AALTs_size)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   711
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   712
  by (smt Suc_leI bsimp_asize0 comp_def le_imp_less_Suc le_trans map_eq_conv not_less_eq)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   713
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   714
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   715
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
   716
314
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   717
lemma L_bsimp_ASEQ:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   718
  "L (SEQ (erase r1) (erase r2)) = L (erase (bsimp_ASEQ bs r1 r2))"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   719
  apply(induct bs r1 r2 rule: bsimp_ASEQ.induct)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   720
  apply(simp_all)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   721
  by (metis erase_fuse fuse.simps(4))
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   722
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   723
lemma L_bsimp_AALTs:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   724
  "L (erase (AALTs bs rs)) = L (erase (bsimp_AALTs bs rs))"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   725
  apply(induct bs rs rule: bsimp_AALTs.induct)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   726
  apply(simp_all add: erase_fuse)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   727
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   728
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   729
lemma L_erase_AALTs:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   730
  shows "L (erase (AALTs bs rs)) = \<Union> (L ` erase ` (set rs))"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   731
  apply(induct rs)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   732
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   733
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   734
  apply(case_tac rs)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   735
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   736
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   737
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   738
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   739
lemma L_erase_flts:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   740
  shows "\<Union> (L ` erase ` (set (flts rs))) = \<Union> (L ` erase ` (set rs))"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   741
  apply(induct rs rule: flts.induct)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   742
        apply(simp_all)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   743
  apply(auto)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   744
  using L_erase_AALTs erase_fuse apply auto[1]
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   745
  by (simp add: L_erase_AALTs erase_fuse)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   746
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   747
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   748
lemma L_bsimp_erase:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   749
  shows "L (erase r) = L (erase (bsimp r))"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   750
  apply(induct r)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   751
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   752
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   753
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   754
  apply(auto simp add: Sequ_def)[1]
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   755
  apply(subst L_bsimp_ASEQ[symmetric])
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   756
  apply(auto simp add: Sequ_def)[1]
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   757
  apply(subst (asm)  L_bsimp_ASEQ[symmetric])
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   758
  apply(auto simp add: Sequ_def)[1]
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   759
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   760
   apply(subst L_bsimp_AALTs[symmetric])
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   761
   defer
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   762
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   763
  apply(subst (2)L_erase_AALTs)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   764
  apply(subst L_erase_flts)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   765
  apply(auto)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   766
   apply (simp add: L_erase_AALTs)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   767
  using L_erase_AALTs by blast
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   768
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   769
lemma bsimp_ASEQ0:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   770
  shows "bsimp_ASEQ bs r1 AZERO = AZERO"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   771
  apply(induct r1)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   772
  apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   773
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   774
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   775
314
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   776
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   777
lemma bsimp_ASEQ1:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   778
  assumes "r1 \<noteq> AZERO" "r2 \<noteq> AZERO" "\<forall>bs. r1 \<noteq> AONE bs"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   779
  shows "bsimp_ASEQ bs r1 r2 = ASEQ bs r1 r2"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   780
  using assms
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   781
  apply(induct bs r1 r2 rule: bsimp_ASEQ.induct)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   782
  apply(auto)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   783
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   784
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   785
lemma bsimp_ASEQ2:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   786
  shows "bsimp_ASEQ bs (AONE bs1) r2 = fuse (bs @ bs1) r2"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   787
  apply(induct r2)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   788
  apply(auto)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   789
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   790
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   791
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   792
lemma L_bders_simp:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   793
  shows "L (erase (bders_simp r s)) = L (erase (bders r s))"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   794
  apply(induct s arbitrary: r rule: rev_induct)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   795
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   796
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   797
  apply(simp add: ders_append)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   798
  apply(simp add: bders_simp_append)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   799
  apply(simp add: L_bsimp_erase[symmetric])
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   800
  by (simp add: der_correctness)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   801
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   802
lemma b1:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   803
  "bsimp_ASEQ bs1 (AONE bs) r =  fuse (bs1 @ bs) r" 
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   804
  apply(induct r)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   805
       apply(auto)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   806
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   807
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   808
lemma b2:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   809
  assumes "bnullable r"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   810
  shows "bmkeps (fuse bs r) = bs @ bmkeps r"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   811
  by (simp add: assms bmkeps_retrieve bnullable_correctness erase_fuse mkeps_nullable retrieve_fuse2)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   812
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   813
lemma b3:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   814
  shows "bnullable r = bnullable (bsimp r)"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   815
  using L_bsimp_erase bnullable_correctness nullable_correctness by auto
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   816
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   817
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   818
lemma b4:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   819
  shows "bnullable (bders_simp r s) = bnullable (bders r s)"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   820
  by (metis L_bders_simp bnullable_correctness lexer.simps(1) lexer_correct_None option.distinct(1))
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   821
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   822
lemma q1:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   823
  assumes "\<forall>r \<in> set rs. bmkeps(bsimp r) = bmkeps r"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   824
  shows "map (\<lambda>r. bmkeps(bsimp r)) rs = map bmkeps rs"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   825
  using assms
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   826
  apply(induct rs)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   827
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   828
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   829
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   830
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   831
lemma q3:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   832
  assumes "\<exists>r \<in> set rs. bnullable r"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   833
  shows "bmkeps (AALTs bs rs) = bmkeps (bsimp_AALTs bs rs)"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   834
  using assms
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   835
  apply(induct bs rs rule: bsimp_AALTs.induct)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   836
    apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   837
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   838
  apply (simp add: b2)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   839
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   840
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   841
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   842
lemma qq1:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   843
  assumes "\<exists>r \<in> set rs. bnullable r"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   844
  shows "bmkeps (AALTs bs (rs @ rs1)) = bmkeps (AALTs bs rs)"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   845
  using assms
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   846
  apply(induct rs arbitrary: rs1 bs)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   847
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   848
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   849
  by (metis Nil_is_append_conv bmkeps.simps(4) neq_Nil_conv r0 split_list_last)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   850
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   851
lemma qq2:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   852
  assumes "\<forall>r \<in> set rs. \<not> bnullable r" "\<exists>r \<in> set rs1. bnullable r"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   853
  shows "bmkeps (AALTs bs (rs @ rs1)) = bmkeps (AALTs bs rs1)"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   854
  using assms
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   855
  apply(induct rs arbitrary: rs1 bs)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   856
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   857
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   858
  by (metis append_assoc in_set_conv_decomp r1 r2)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   859
  
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   860
lemma qq3:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   861
  shows "bnullable (AALTs bs rs) = (\<exists>r \<in> set rs. bnullable r)"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   862
  apply(induct rs arbitrary: bs)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   863
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   864
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   865
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
   866
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   867
lemma fuse_empty:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   868
  shows "fuse [] r = r"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   869
  apply(induct r)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   870
       apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   871
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   872
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   873
lemma flts_fuse:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   874
  shows "map (fuse bs) (flts rs) = flts (map (fuse bs) rs)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   875
  apply(induct rs arbitrary: bs rule: flts.induct)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   876
        apply(auto simp add: fuse_append)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   877
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   878
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   879
lemma bsimp_ASEQ_fuse:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   880
  shows "fuse bs1 (bsimp_ASEQ bs2 r1 r2) = bsimp_ASEQ (bs1 @ bs2) r1 r2"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   881
  apply(induct r1 r2 arbitrary: bs1 bs2 rule: bsimp_ASEQ.induct)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   882
  apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   883
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   884
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   885
lemma bsimp_AALTs_fuse:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   886
  assumes "\<forall>r \<in> set rs. fuse bs1 (fuse bs2 r) = fuse (bs1 @ bs2) r"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   887
  shows "fuse bs1 (bsimp_AALTs bs2 rs) = bsimp_AALTs (bs1 @ bs2) rs"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   888
  using assms
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   889
  apply(induct bs2 rs arbitrary: bs1 rule: bsimp_AALTs.induct)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   890
  apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   891
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   892
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   893
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   894
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   895
lemma bsimp_fuse:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   896
  shows "fuse bs (bsimp r) = bsimp (fuse bs r)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   897
apply(induct r arbitrary: bs)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   898
       apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   899
      apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   900
     apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   901
    prefer 3
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   902
    apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   903
   apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   904
   apply (simp add: bsimp_ASEQ_fuse)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   905
  apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   906
  by (simp add: bsimp_AALTs_fuse fuse_append)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   907
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   908
lemma bsimp_fuse_AALTs:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   909
  shows "fuse bs (bsimp (AALTs [] rs)) = bsimp (AALTs bs rs)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   910
  apply(subst bsimp_fuse) 
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   911
  apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   912
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   913
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   914
lemma bsimp_fuse_AALTs2:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   915
  shows "fuse bs (bsimp_AALTs [] rs) = bsimp_AALTs bs rs"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   916
  using bsimp_AALTs_fuse fuse_append by auto
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   917
  
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   918
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   919
lemma bsimp_ASEQ_idem:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   920
  assumes "bsimp (bsimp r1) = bsimp r1" "bsimp (bsimp r2) = bsimp r2"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   921
  shows "bsimp (bsimp_ASEQ x1 (bsimp r1) (bsimp r2)) = bsimp_ASEQ x1 (bsimp r1) (bsimp r2)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   922
  using assms
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   923
  apply(case_tac "bsimp r1 = AZERO")
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   924
    apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   925
 apply(case_tac "bsimp r2 = AZERO")
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   926
    apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   927
  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))  
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   928
  apply(case_tac "\<exists>bs. bsimp r1 = AONE bs")
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   929
    apply(auto)[1]
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   930
    apply(subst bsimp_ASEQ2)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   931
   apply(subst bsimp_ASEQ2)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   932
  apply (metis assms(2) bsimp_fuse)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   933
      apply(subst bsimp_ASEQ1)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   934
      apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   935
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   936
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   937
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   938
fun nonnested :: "arexp \<Rightarrow> bool"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   939
  where
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   940
  "nonnested (AALTs bs2 []) = True"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   941
| "nonnested (AALTs bs2 ((AALTs bs1 rs1) # rs2)) = False"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   942
| "nonnested (AALTs bs2 (r # rs2)) = nonnested (AALTs bs2 rs2)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   943
| "nonnested r = True"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   944
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   945
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   946
lemma  k0:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   947
  shows "flts (r # rs1) = flts [r] @ flts rs1"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   948
  apply(induct r arbitrary: rs1)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   949
   apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   950
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   951
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   952
lemma  k00:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   953
  shows "flts (rs1 @ rs2) = flts rs1 @ flts rs2"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   954
  apply(induct rs1 arbitrary: rs2)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   955
   apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   956
  by (metis append.assoc k0)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   957
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   958
lemma  k0a:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   959
  shows "flts [AALTs bs rs] = map (fuse bs)  rs"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   960
  apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   961
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   962
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   963
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   964
lemma  k0b:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   965
  assumes "nonalt r" "r \<noteq> AZERO"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   966
  shows "flts [r] = [r]"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   967
  using assms
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   968
  apply(case_tac  r)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   969
  apply(simp_all)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   970
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   971
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   972
lemma nn1:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   973
  assumes "nonnested (AALTs bs rs)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   974
  shows "\<nexists>bs1 rs1. flts rs = [AALTs bs1 rs1]"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   975
  using assms
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   976
  apply(induct rs rule: flts.induct)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   977
  apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   978
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   979
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   980
lemma nn1q:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   981
  assumes "nonnested (AALTs bs rs)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   982
  shows "\<nexists>bs1 rs1. AALTs bs1 rs1 \<in> set (flts rs)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   983
  using assms
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   984
  apply(induct rs rule: flts.induct)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   985
  apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   986
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   987
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   988
lemma nn1qq:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   989
  assumes "nonnested (AALTs bs rs)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   990
  shows "\<nexists>bs1 rs1. AALTs bs1 rs1 \<in> set rs"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   991
  using assms
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   992
  apply(induct rs rule: flts.induct)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   993
  apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   994
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   995
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   996
lemma nn10:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   997
  assumes "nonnested (AALTs cs rs)" 
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   998
  shows "nonnested (AALTs (bs @ cs) rs)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   999
  using assms
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1000
  apply(induct rs arbitrary: cs bs)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1001
   apply(simp_all)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1002
  apply(case_tac a)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1003
       apply(simp_all)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1004
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1005
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1006
lemma nn11a:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1007
  assumes "nonalt r"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1008
  shows "nonalt (fuse bs r)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1009
  using assms
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1010
  apply(induct r)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1011
       apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1012
  done
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1013
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1014
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1015
lemma nn1a:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1016
  assumes "nonnested r"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1017
  shows "nonnested (fuse bs r)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1018
  using assms
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1019
  apply(induct bs r arbitrary: rule: fuse.induct)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1020
       apply(simp_all add: nn10)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1021
  done  
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1022
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1023
lemma n0:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1024
  shows "nonnested (AALTs bs rs) \<longleftrightarrow> (\<forall>r \<in> set rs. nonalt r)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1025
  apply(induct rs  arbitrary: bs)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1026
   apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1027
    apply (metis list.set_intros(1) nn1qq nonalt.elims(3))
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1028
   apply (metis list.set_intros(2) nn1qq nonalt.elims(3))
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1029
  by (metis nonalt.elims(2) nonnested.simps(3) nonnested.simps(4) nonnested.simps(5) nonnested.simps(6) nonnested.simps(7))
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1030
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1031
  
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1032
  
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1033
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1034
lemma nn1c:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1035
  assumes "\<forall>r \<in> set rs. nonnested r"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1036
  shows "\<forall>r \<in> set (flts rs). nonalt r"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1037
  using assms
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1038
  apply(induct rs rule: flts.induct)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1039
        apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1040
  apply(rule nn11a)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1041
  by (metis nn1qq nonalt.elims(3))
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1042
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1043
lemma nn1bb:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1044
  assumes "\<forall>r \<in> set rs. nonalt r"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1045
  shows "nonnested (bsimp_AALTs bs rs)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1046
  using assms
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1047
  apply(induct bs rs rule: bsimp_AALTs.induct)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1048
    apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1049
   apply (metis nn11a nonalt.simps(1) nonnested.elims(3))
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1050
  using n0 by auto
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1051
    
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1052
lemma nn1b:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1053
  shows "nonnested (bsimp r)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1054
  apply(induct r)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1055
       apply(simp_all)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1056
  apply(case_tac "bsimp r1 = AZERO")
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1057
    apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1058
 apply(case_tac "bsimp r2 = AZERO")
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1059
   apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1060
    apply(subst bsimp_ASEQ0)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1061
  apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1062
  apply(case_tac "\<exists>bs. bsimp r1 = AONE bs")
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1063
    apply(auto)[1]
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1064
    apply(subst bsimp_ASEQ2)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1065
  apply (simp add: nn1a)    
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1066
   apply(subst bsimp_ASEQ1)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1067
      apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1068
  apply(rule nn1bb)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1069
  apply(auto)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1070
  by (metis (mono_tags, hide_lams) imageE nn1c set_map)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1071
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1072
lemma nn1d:
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1073
  assumes "bsimp r = AALTs bs rs"
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1074
  shows "\<forall>r1 \<in> set rs. \<forall>  bs. r1 \<noteq> AALTs bs  rs2"
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1075
  using nn1b assms
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1076
  by (metis nn1qq)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1077
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1078
lemma nn_flts:
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1079
  assumes "nonnested (AALTs bs rs)"
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1080
  shows "\<forall>r \<in>  set (flts rs). nonalt r"
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1081
  using assms
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1082
  apply(induct rs arbitrary: bs rule: flts.induct)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1083
        apply(auto)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1084
  done
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1085
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1086
lemma rt:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1087
  shows "sum_list (map asize (flts (map bsimp rs))) \<le> sum_list (map asize rs)"
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1088
  apply(induct rs)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1089
   apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1090
  apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1091
  apply(subst  k0)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1092
  apply(simp)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1093
  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)
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1094
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1095
lemma bsimp_AALTs_qq:
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1096
  assumes "1 < length rs"
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1097
  shows "bsimp_AALTs bs rs = AALTs bs  rs"
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1098
  using  assms
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1099
  apply(case_tac rs)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1100
   apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1101
  apply(case_tac list)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1102
   apply(simp_all)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1103
  done
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1104
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1105
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1106
lemma bsimp_AALTs1:
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1107
  assumes "nonalt r"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1108
  shows "bsimp_AALTs bs (flts [r]) = fuse bs r"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1109
  using  assms
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1110
  apply(case_tac r)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1111
   apply(simp_all)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1112
  done
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1113
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1114
lemma bbbbs:
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1115
  assumes "good r" "r = AALTs bs1 rs"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1116
  shows "bsimp_AALTs bs (flts [r]) = AALTs bs (map (fuse bs1) rs)"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1117
  using  assms
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1118
  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)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1119
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1120
lemma bbbbs1:
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1121
  shows "nonalt r \<or> (\<exists>bs rs. r  = AALTs bs rs)"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1122
  using nonalt.elims(3) by auto
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1123
  
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1124
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1125
lemma good_fuse:
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1126
  shows "good (fuse bs r) = good r"
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1127
  apply(induct r arbitrary: bs)
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1128
       apply(auto)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1129
     apply(case_tac r1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1130
          apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1131
  apply(case_tac r2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1132
          apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1133
  apply(case_tac r2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1134
            apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1135
  apply(case_tac r2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1136
           apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1137
  apply(case_tac r2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1138
          apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1139
  apply(case_tac r1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1140
          apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1141
  apply(case_tac r2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1142
           apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1143
  apply(case_tac r2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1144
           apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1145
  apply(case_tac r2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1146
           apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1147
  apply(case_tac r2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1148
         apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1149
  apply(case_tac x2a)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1150
    apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1151
  apply(case_tac list)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1152
    apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1153
  apply(case_tac x2a)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1154
    apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1155
  apply(case_tac list)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1156
    apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1157
  done
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1158
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1159
lemma good0:
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1160
  assumes "rs \<noteq> Nil" "\<forall>r \<in> set rs. nonalt r"
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1161
  shows "good (bsimp_AALTs bs rs) \<longleftrightarrow> (\<forall>r \<in> set rs. good r)"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1162
  using  assms
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1163
  apply(induct bs rs rule: bsimp_AALTs.induct)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1164
  apply(auto simp add: good_fuse)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1165
  done
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1166
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1167
lemma good0a:
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1168
  assumes "flts (map bsimp rs) \<noteq> Nil" "\<forall>r \<in> set (flts (map bsimp rs)). nonalt r"
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1169
  shows "good (bsimp (AALTs bs rs)) \<longleftrightarrow> (\<forall>r \<in> set (flts (map bsimp rs)). good r)"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1170
  using  assms
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1171
  apply(simp)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1172
  apply(auto)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1173
  apply(subst (asm) good0)
323
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1174
   apply(simp)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1175
    apply(auto)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1176
   apply(subst good0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1177
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1178
    apply(auto)
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1179
  done
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1180
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1181
lemma flts0:
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1182
  assumes "r \<noteq> AZERO" "nonalt r"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1183
  shows "flts [r] \<noteq> []"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1184
  using  assms
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1185
  apply(induct r)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1186
       apply(simp_all)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1187
  done
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1188
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1189
lemma flts1:
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1190
  assumes "good r" 
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1191
  shows "flts [r] \<noteq> []"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1192
  using  assms
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1193
  apply(induct r)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1194
       apply(simp_all)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1195
  apply(case_tac x2a)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1196
   apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1197
  apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1198
  done
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1199
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1200
lemma flts2:
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1201
  assumes "good r" 
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1202
  shows "\<forall>r' \<in> set (flts [r]). good r' \<and> nonalt r'"
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1203
  using  assms
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1204
  apply(induct r)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1205
       apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1206
      apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1207
     apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1208
    prefer 2
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1209
    apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1210
    apply(auto)[1]
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1211
     apply (metis bsimp_AALTs.elims good.simps(4) good.simps(5) good.simps(6) good_fuse)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1212
  apply (metis bsimp_AALTs.elims good.simps(4) good.simps(5) good.simps(6) nn11a)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1213
   apply fastforce
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1214
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1215
  done  
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1216
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1217
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1218
lemma flts3:
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1219
  assumes "\<forall>r \<in> set rs. good r \<or> r = AZERO" 
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1220
  shows "\<forall>r \<in> set (flts rs). good r"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1221
  using  assms
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1222
  apply(induct rs arbitrary: rule: flts.induct)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1223
        apply(simp_all)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1224
  by (metis UnE flts2 k0a set_map)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1225
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1226
lemma flts3b:
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1227
  assumes "\<exists>r\<in>set rs. good r"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1228
  shows "flts rs \<noteq> []"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1229
  using  assms
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1230
  apply(induct rs arbitrary: rule: flts.induct)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1231
        apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1232
       apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1233
      apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1234
      apply(auto)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1235
  done
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1236
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1237
lemma flts4:
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1238
  assumes "bsimp_AALTs bs (flts rs) = AZERO"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1239
  shows "\<forall>r \<in> set rs. \<not> good r"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1240
  using assms
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1241
  apply(induct rs arbitrary: bs rule: flts.induct)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1242
        apply(auto)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1243
        defer
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1244
  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))
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1245
  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))
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1246
  apply (metis arexp.distinct(3) arexp.distinct(7) bsimp_AALTs.elims fuse.simps(3) list.distinct(1) list.inject)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1247
  apply (metis arexp.distinct(7) bsimp_AALTs.elims good.simps(1) good_fuse list.distinct(1) list.inject)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1248
    apply (metis arexp.distinct(7) bsimp_AALTs.elims list.distinct(1) list.inject)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1249
  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))
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1250
  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)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1251
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1252
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1253
lemma flts_nil:
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1254
  assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow>
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1255
            good (bsimp y) \<or> bsimp y = AZERO"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1256
  and "\<forall>r\<in>set rs. \<not> good (bsimp r)"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1257
  shows "flts (map bsimp rs) = []"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1258
  using assms
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1259
  apply(induct rs)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1260
   apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1261
  apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1262
  apply(subst k0)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1263
  apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1264
  by force
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1265
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1266
lemma flts_nil2:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1267
  assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow>
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1268
            good (bsimp y) \<or> bsimp y = AZERO"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1269
  and "bsimp_AALTs bs (flts (map bsimp rs)) = AZERO"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1270
  shows "flts (map bsimp rs) = []"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1271
  using assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1272
  apply(induct rs arbitrary: bs)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1273
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1274
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1275
  apply(subst k0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1276
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1277
  apply(subst (asm) k0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1278
  apply(auto)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1279
  apply (metis flts.simps(1) flts.simps(2) flts4 k0 less_add_Suc1 list.set_intros(1))
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1280
  by (metis flts.simps(2) flts4 k0 less_add_Suc1 list.set_intros(1))
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1281
  
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1282
  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1283
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1284
lemma good_SEQ:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1285
  assumes "r1 \<noteq> AZERO" "r2 \<noteq> AZERO" "\<forall>bs. r1 \<noteq> AONE bs"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1286
  shows "good (ASEQ bs r1 r2) = (good r1 \<and> good r2)"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1287
  using assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1288
  apply(case_tac r1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1289
       apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1290
  apply(case_tac r2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1291
          apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1292
  apply(case_tac r2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1293
         apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1294
  apply(case_tac r2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1295
        apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1296
  apply(case_tac r2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1297
       apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1298
  done
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1299
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1300
lemma good1:
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1301
  shows "good (bsimp a) \<or> bsimp a = AZERO"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1302
  apply(induct a taking: asize rule: measure_induct)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1303
  apply(case_tac x)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1304
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1305
  apply(simp)
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1306
  apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1307
  prefer 3
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1308
    apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1309
   prefer 2
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1310
  (*  AALTs case  *)
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1311
  apply(simp only:)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1312
   apply(case_tac "x52")
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1313
    apply(simp)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1314
  thm good0a
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1315
   (*  AALTs list at least one - case *)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1316
   apply(simp only: )
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1317
  apply(frule_tac x="a" in spec)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1318
   apply(drule mp)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1319
    apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1320
   (* either first element is good, or AZERO *)
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1321
    apply(erule disjE)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1322
     prefer 2
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1323
    apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1324
   (* in  the AZERO case, the size  is smaller *)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1325
   apply(drule_tac x="AALTs x51 list" in spec)
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1326
   apply(drule mp)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1327
     apply(simp add: asize0)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1328
    apply(subst (asm) bsimp.simps)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1329
  apply(subst (asm) bsimp.simps)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1330
    apply(assumption)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1331
   (* in the good case *)
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1332
  apply(frule_tac x="AALTs x51 list" in spec)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1333
   apply(drule mp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1334
    apply(simp add: asize0)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1335
   apply(erule disjE)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1336
    apply(rule disjI1)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1337
  apply(simp add: good0)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1338
    apply(subst good0)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1339
      apply (metis Nil_is_append_conv flts1 k0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1340
  apply (metis ex_map_conv list.simps(9) nn1b nn1c)
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1341
  apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1342
    apply(subst k0)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1343
    apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1344
    apply(auto)[1]
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1345
  using flts2 apply blast
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1346
    apply(subst  (asm) good0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1347
      prefer 3
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1348
      apply(auto)[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1349
     apply auto[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1350
    apply (metis ex_map_conv nn1b nn1c)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1351
  (* in  the AZERO case *)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1352
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1353
   apply(frule_tac x="a" in spec)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1354
   apply(drule mp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1355
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1356
   apply(erule disjE)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1357
    apply(rule disjI1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1358
    apply(subst good0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1359
  apply(subst k0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1360
  using flts1 apply blast
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1361
     apply(auto)[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1362
  apply (metis (no_types, hide_lams) ex_map_conv list.simps(9) nn1b nn1c)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1363
    apply(auto)[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1364
  apply(subst (asm) k0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1365
  apply(auto)[1]
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1366
  using flts2 apply blast
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1367
  apply(frule_tac x="AALTs x51 list" in spec)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1368
   apply(drule mp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1369
     apply(simp add: asize0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1370
    apply(erule disjE)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1371
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1372
    apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1373
  apply (metis add.left_commute flts_nil2 less_add_Suc1 less_imp_Suc_add list.distinct(1) list.set_cases nat.inject)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1374
   apply(subst (2) k0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1375
  apply(simp)
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1376
  (* SEQ case *)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1377
  apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1378
  apply(case_tac "bsimp x42 = AZERO")
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1379
    apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1380
 apply(case_tac "bsimp x43 = AZERO")
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1381
   apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1382
    apply(subst (2) bsimp_ASEQ0)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1383
  apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1384
  apply(case_tac "\<exists>bs. bsimp x42 = AONE bs")
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1385
    apply(auto)[1]
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1386
   apply(subst bsimp_ASEQ2)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1387
  using good_fuse apply force
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1388
   apply(subst bsimp_ASEQ1)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1389
     apply(auto)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1390
  apply(subst  good_SEQ)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1391
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1392
    apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1393
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1394
  using less_add_Suc1 less_add_Suc2 by blast
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1395
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1396
lemma good1a:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1397
  assumes "L(erase a) \<noteq> {}"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1398
  shows "good (bsimp a)"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1399
  using good1 assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1400
  using L_bsimp_erase by force
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1401
  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1402
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1403
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1404
lemma flts_append:
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1405
  "flts (xs1 @ xs2) = flts xs1 @ flts xs2"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1406
  apply(induct xs1  arbitrary: xs2  rule: rev_induct)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1407
   apply(auto)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1408
  apply(case_tac xs)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1409
   apply(auto)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1410
   apply(case_tac x)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1411
        apply(auto)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1412
  apply(case_tac x)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1413
        apply(auto)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1414
  done
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1415
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1416
lemma g1:
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1417
  assumes "good (bsimp_AALTs bs rs)"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1418
  shows "bsimp_AALTs bs rs = AALTs bs rs \<or> (\<exists>r. rs = [r] \<and> bsimp_AALTs bs [r] = fuse bs r)"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1419
using assms
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1420
    apply(induct rs arbitrary: bs)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1421
  apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1422
  apply(case_tac rs)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1423
  apply(simp only:)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1424
  apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1425
  apply(case_tac  list)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1426
  apply(simp)
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1427
  by simp
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1428
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1429
lemma flts_0:
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1430
  assumes "nonnested (AALTs bs  rs)"
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1431
  shows "\<forall>r \<in> set (flts rs). r \<noteq> AZERO"
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1432
  using assms
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1433
  apply(induct rs arbitrary: bs rule: flts.induct)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1434
        apply(simp) 
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1435
       apply(simp) 
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1436
      defer
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1437
      apply(simp) 
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1438
     apply(simp) 
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1439
    apply(simp) 
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1440
apply(simp) 
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1441
  apply(rule ballI)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1442
  apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1443
  done
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1444
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1445
lemma flts_0a:
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1446
  assumes "nonnested (AALTs bs  rs)"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1447
  shows "AZERO \<notin> set (flts rs)"
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1448
  using assms
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1449
  using flts_0 by blast 
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1450
  
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1451
lemma qqq1:
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1452
  shows "AZERO \<notin> set (flts (map bsimp rs))"
322
22e34f93cd5d updaed good
Christian Urban <urbanc@in.tum.de>
parents: 318
diff changeset
  1453
  by (metis ex_map_conv flts3 good.simps(1) good1)
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1454
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1455
323
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1456
fun nonazero :: "arexp \<Rightarrow> bool"
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1457
  where
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1458
  "nonazero AZERO = False"
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1459
| "nonazero r = True"
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1460
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1461
lemma flts_concat:
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1462
  shows "flts rs = concat (map (\<lambda>r. flts [r]) rs)"
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1463
  apply(induct rs)
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1464
   apply(auto)
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1465
  apply(subst k0)
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1466
  apply(simp)
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1467
  done
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1468
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1469
lemma flts_single1:
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1470
  assumes "nonalt r" "nonazero r"
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1471
  shows "flts [r] = [r]"
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1472
  using assms
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1473
  apply(induct r)
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1474
  apply(auto)
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1475
  done
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1476
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1477
lemma flts_qq:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1478
  assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow> good y \<longrightarrow> bsimp y = y" 
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1479
          "\<forall>r'\<in>set rs. good r' \<and> nonalt r'"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1480
  shows "flts (map bsimp rs) = rs"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1481
  using assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1482
  apply(induct rs)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1483
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1484
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1485
  apply(subst k0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1486
  apply(subgoal_tac "flts [bsimp a] =  [a]")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1487
   prefer 2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1488
   apply(drule_tac x="a" in spec)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1489
   apply(drule mp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1490
    apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1491
   apply(auto)[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1492
  using good.simps(1) k0b apply blast
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1493
  apply(auto)[1]  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1494
  done
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1495
  
323
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1496
lemma test:
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1497
  assumes "good r"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1498
  shows "bsimp r = r"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1499
  using assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1500
  apply(induct r taking: "asize" rule: measure_induct)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1501
  apply(erule good.elims)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1502
  apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1503
  apply(subst k0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1504
  apply(subst (2) k0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1505
                apply(subst flts_qq)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1506
                  apply(auto)[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1507
                 apply(auto)[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1508
                apply (metis append_Cons append_Nil bsimp_AALTs.simps(3) good.simps(1) k0b)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1509
               apply force+
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1510
  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)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1511
  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)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1512
         apply force+
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1513
  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)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1514
  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)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1515
    apply force+
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1516
  done
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1517
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1518
lemma test2:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1519
  assumes "good r"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1520
  shows "bsimp r = r"
323
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1521
  using assms
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1522
  apply(induct r taking: "asize" rule: measure_induct)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1523
  apply(case_tac x)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1524
       apply(simp_all)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1525
   defer  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1526
  (* AALT case *)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1527
   apply(subgoal_tac "1 < length x52")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1528
    prefer 2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1529
    apply(case_tac x52)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1530
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1531
    apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1532
    apply(case_tac list)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1533
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1534
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1535
    apply(subst bsimp_AALTs_qq)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1536
    prefer 2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1537
    apply(subst flts_qq)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1538
      apply(auto)[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1539
     apply(auto)[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1540
   apply(case_tac x52)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1541
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1542
    apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1543
    apply(case_tac list)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1544
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1545
      apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1546
      apply(auto)[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1547
  apply (metis (no_types, lifting) bsimp_AALTs.elims good.simps(6) length_Cons length_pos_if_in_set list.size(3) nat_neq_iff)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1548
  apply(simp)  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1549
  apply(case_tac x52)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1550
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1551
    apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1552
    apply(case_tac list)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1553
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1554
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1555
   apply(subst k0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1556
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1557
   apply(subst (2) k0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1558
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1559
  apply (simp add: Suc_lessI flts1 one_is_add)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1560
  (* SEQ case *)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1561
  apply(case_tac "bsimp x42 = AZERO")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1562
   apply simp
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1563
  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)  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1564
   apply(case_tac "\<exists>bs'. bsimp x42 = AONE bs'")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1565
   apply(auto)[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1566
  defer
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1567
  apply(case_tac "bsimp x43 = AZERO")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1568
    apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1569
  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)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1570
  apply(auto)  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1571
   apply (subst bsimp_ASEQ1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1572
      apply(auto)[3]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1573
   apply(auto)[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1574
    apply (metis bsimp.simps(3) good.simps(2) good_SEQ less_add_Suc1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1575
   apply (metis bsimp.simps(3) good.simps(2) good_SEQ less_add_Suc1 less_add_Suc2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1576
  apply (subst bsimp_ASEQ2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1577
  apply(drule_tac x="x42" in spec)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1578
  apply(drule mp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1579
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1580
  apply(drule mp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1581
   apply (metis bsimp.elims bsimp.simps(3) good.simps(10) good.simps(11) good.simps(2) good_SEQ)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1582
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1583
  done
323
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1584
09ce1cdb70ab updated
Christian Urban <urbanc@in.tum.de>
parents: 322
diff changeset
  1585
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1586
lemma bsimp_idem:
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1587
  shows "bsimp (bsimp r) = bsimp r"
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1588
  using test good1
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1589
  by force
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1590
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1591
314
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1592
lemma q3a:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1593
  assumes "\<exists>r \<in> set rs. bnullable r"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1594
  shows "bmkeps (AALTs bs (map (fuse bs1) rs)) = bmkeps (AALTs (bs@bs1) rs)"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1595
  using assms
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1596
  apply(induct rs arbitrary: bs bs1)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1597
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1598
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1599
  apply(auto)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1600
   apply (metis append_assoc b2 bnullable_correctness erase_fuse r0)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1601
  apply(case_tac "bnullable a")
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1602
   apply (metis append.assoc b2 bnullable_correctness erase_fuse r0)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1603
  apply(case_tac rs)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1604
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1605
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1606
  apply(auto)[1]
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1607
   apply (metis bnullable_correctness erase_fuse)+
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1608
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1609
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1610
lemma qq4:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1611
  assumes "\<exists>x\<in>set list. bnullable x"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1612
  shows "\<exists>x\<in>set (flts list). bnullable x"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1613
  using assms
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1614
  apply(induct list rule: flts.induct)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1615
        apply(auto)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1616
  by (metis UnCI bnullable_correctness erase_fuse imageI)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1617
  
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1618
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1619
lemma qs3:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1620
  assumes "\<exists>r \<in> set rs. bnullable r"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1621
  shows "bmkeps (AALTs bs rs) = bmkeps (AALTs bs (flts rs))"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1622
  using assms
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1623
  apply(induct rs arbitrary: bs taking: size rule: measure_induct)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1624
  apply(case_tac x)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1625
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1626
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1627
  apply(case_tac a)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1628
       apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1629
       apply (simp add: r1)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1630
      apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1631
      apply (simp add: r0)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1632
     apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1633
     apply(case_tac "flts list")
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1634
      apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1635
  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)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1636
     apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1637
     apply (simp add: r1)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1638
    prefer 3
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1639
    apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1640
    apply (simp add: r0)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1641
   prefer 2
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1642
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1643
  apply(case_tac "\<exists>x\<in>set x52. bnullable x")
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1644
  apply(case_tac "list")
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1645
    apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1646
    apply (metis b2 fuse.simps(4) q3a r2)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1647
   apply(erule disjE)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1648
    apply(subst qq1)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1649
     apply(auto)[1]
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1650
     apply (metis bnullable_correctness erase_fuse)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1651
    apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1652
     apply (metis b2 fuse.simps(4) q3a r2)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1653
    apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1654
    apply(auto)[1]
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1655
     apply(subst qq1)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1656
      apply (metis bnullable_correctness erase_fuse image_eqI set_map)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1657
     apply (metis b2 fuse.simps(4) q3a r2)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1658
  apply(subst qq1)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1659
      apply (metis bnullable_correctness erase_fuse image_eqI set_map)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1660
    apply (metis b2 fuse.simps(4) q3a r2)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1661
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1662
   apply(subst qq2)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1663
     apply (metis bnullable_correctness erase_fuse imageE set_map)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1664
  prefer 2
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1665
  apply(case_tac "list")
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1666
     apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1667
    apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1668
   apply (simp add: qq4)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1669
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1670
  apply(auto)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1671
   apply(case_tac list)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1672
    apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1673
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1674
   apply (simp add: r0)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1675
  apply(case_tac "bnullable (ASEQ x41 x42 x43)")
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1676
   apply(case_tac list)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1677
    apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1678
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1679
   apply (simp add: r0)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1680
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1681
  using qq4 r1 r2 by auto
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1682
317
db0ff630bbb7 updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
  1683
314
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1684
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1685
lemma k1:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1686
  assumes "\<And>x2aa. \<lbrakk>x2aa \<in> set x2a; bnullable x2aa\<rbrakk> \<Longrightarrow> bmkeps x2aa = bmkeps (bsimp x2aa)"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1687
          "\<exists>x\<in>set x2a. bnullable x"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1688
        shows "bmkeps (AALTs x1 (flts x2a)) = bmkeps (AALTs x1 (flts (map bsimp x2a)))"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1689
  using assms
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1690
  apply(induct x2a)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1691
  apply fastforce
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1692
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1693
  apply(subst k0)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1694
  apply(subst (2) k0)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1695
  apply(auto)[1]
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1696
  apply (metis b3 k0 list.set_intros(1) qs3 r0)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1697
  by (smt b3 imageI insert_iff k0 list.set(2) qq3 qs3 r0 r1 set_map)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1698
  
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1699
  
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1700
  
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1701
lemma bmkeps_simp:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1702
  assumes "bnullable r"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1703
  shows "bmkeps r = bmkeps (bsimp r)"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1704
  using  assms
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1705
  apply(induct r)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1706
       apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1707
      apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1708
     apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1709
    apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1710
    prefer 3
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1711
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1712
   apply(case_tac "bsimp r1 = AZERO")
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1713
    apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1714
    apply(auto)[1]
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1715
  apply (metis L_bsimp_erase L_flat_Prf1 L_flat_Prf2 Prf_elims(1) bnullable_correctness erase.simps(1) mkeps_nullable)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1716
 apply(case_tac "bsimp r2 = AZERO")
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1717
    apply(simp)  
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1718
    apply(auto)[1]
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1719
  apply (metis L_bsimp_erase L_flat_Prf1 L_flat_Prf2 Prf_elims(1) bnullable_correctness erase.simps(1) mkeps_nullable)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1720
  apply(case_tac "\<exists>bs. bsimp r1 = AONE bs")
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1721
    apply(auto)[1]
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1722
    apply(subst b1)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1723
    apply(subst b2)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1724
  apply(simp add: b3[symmetric])
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1725
    apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1726
   apply(subgoal_tac "bsimp_ASEQ x1 (bsimp r1) (bsimp r2) = ASEQ x1 (bsimp r1) (bsimp r2)")
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1727
    prefer 2
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1728
  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))
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1729
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1730
  apply(simp)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  1731
  thm q3
314
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1732
  apply(subst q3[symmetric])
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1733
   apply simp
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1734
  using b3 qq4 apply auto[1]
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1735
  apply(subst qs3)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1736
   apply simp
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1737
  using k1 by blast
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1738
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1739
thm bmkeps_retrieve bmkeps_simp bder_retrieve
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1740
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1741
lemma bmkeps_bder_AALTs:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1742
  assumes "\<exists>r \<in> set rs. bnullable (bder c r)" 
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1743
  shows "bmkeps (bder c (bsimp_AALTs bs rs)) = bmkeps (bsimp_AALTs bs (map (bder c) rs))"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1744
  using assms
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1745
  apply(induct rs)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1746
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1747
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1748
  apply(auto)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1749
  apply(case_tac rs)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1750
    apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1751
  apply (metis (full_types) Prf_injval bder_retrieve bmkeps_retrieve bnullable_correctness erase_bder erase_fuse mkeps_nullable retrieve_fuse2)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1752
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1753
  apply(case_tac  rs)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1754
   apply(simp_all)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1755
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1756
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1757
lemma bbs0:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1758
  shows "blexer_simp r [] = blexer r []"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1759
  apply(simp add: blexer_def blexer_simp_def)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1760
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1761
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1762
lemma bbs1:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1763
  shows "blexer_simp r [c] = blexer r [c]"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1764
  apply(simp add: blexer_def blexer_simp_def)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1765
  apply(auto)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1766
    defer
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1767
  using b3 apply auto[1]
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1768
  using b3 apply auto[1]  
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1769
  apply(subst bmkeps_simp[symmetric])
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1770
   apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1771
  apply(simp)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1772
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1773
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1774
lemma oo:
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1775
  shows "(case (blexer (der c r) s) of None \<Rightarrow> None | Some v \<Rightarrow> Some (injval r c v)) = blexer r (c # s)"
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1776
  apply(simp add: blexer_correctness)
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1777
  done
20a57552d722 updated
Christian Urban <urbanc@in.tum.de>
parents: 313
diff changeset
  1778
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1779
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1780
lemma bder_fuse:
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1781
  shows "bder c (fuse bs a) = fuse bs  (bder c a)"
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1782
  apply(induct a arbitrary: bs c)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1783
       apply(simp_all)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1784
  done
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1785
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1786
lemma XXX2_helper:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1787
  assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow> good y \<longrightarrow> bsimp y = y" 
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1788
          "\<forall>r'\<in>set rs. good r' \<and> nonalt r'"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1789
  shows "flts (map (bsimp \<circ> bder c) (flts (map bsimp rs))) = flts (map (bsimp \<circ> bder c) rs)"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1790
  using assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1791
  apply(induct rs arbitrary: c)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1792
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1793
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1794
  apply(subst k0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1795
  apply(simp add: flts_append)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1796
  apply(subst (2) k0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1797
  apply(simp add: flts_append)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1798
  apply(subgoal_tac "flts [a] =  [a]")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1799
   prefer 2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1800
  using good.simps(1) k0b apply blast
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1801
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1802
  done
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1803
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1804
lemma bmkeps_good:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1805
  assumes "good a"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1806
  shows "bmkeps (bsimp a) = bmkeps a"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1807
  using assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1808
  using test2 by auto
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1809
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1810
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1811
lemma xxx_bder:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1812
  assumes "good r"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1813
  shows "L (erase r) \<noteq> {}"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1814
  using assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1815
  apply(induct r rule: good.induct)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1816
  apply(auto simp add: Sequ_def)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1817
  done
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1818
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1819
lemma xxx_bder2:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1820
  assumes "L (erase (bsimp r)) = {}"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1821
  shows "bsimp r = AZERO"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1822
  using assms xxx_bder test2 good1
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1823
  by blast
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1824
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1825
lemma XXX2aa:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1826
  assumes "good a"
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  1827
  shows "bsimp (bder c (bsimp a)) = bsimp (bder c a)"
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1828
  using  assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1829
  by (simp add: test2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1830
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1831
lemma XXX2aa_ders:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1832
  assumes "good a"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1833
  shows "bsimp (bders (bsimp a) s) = bsimp (bders a s)"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1834
  using  assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1835
  by (simp add: test2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1836
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1837
lemma XXX4a:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1838
  shows "good (bders_simp (bsimp r) s)  \<or> bders_simp (bsimp r) s = AZERO"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1839
  apply(induct s arbitrary: r rule:  rev_induct)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1840
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1841
  apply (simp add: good1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1842
  apply(simp add: bders_simp_append)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1843
  apply (simp add: good1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1844
  done
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1845
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1846
lemma XXX4a_good:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1847
  assumes "good a"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1848
  shows "good (bders_simp a s) \<or> bders_simp a s = AZERO"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1849
  using assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1850
  apply(induct s arbitrary: a rule:  rev_induct)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1851
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1852
  apply(simp add: bders_simp_append)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1853
  apply (simp add: good1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1854
  done
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1855
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1856
lemma XXX4a_good_cons:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1857
  assumes "s \<noteq> []"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1858
  shows "good (bders_simp a s) \<or> bders_simp a s = AZERO"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1859
  using assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1860
  apply(case_tac s)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1861
   apply(auto)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1862
  using XXX4a by blast
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1863
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1864
lemma XXX4b:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1865
  assumes "good a" "L (erase (bders_simp a s)) \<noteq> {}"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1866
  shows "good (bders_simp a s)"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1867
  using assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1868
  apply(induct s arbitrary: a)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1869
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1870
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1871
  apply(subgoal_tac "L (erase (bder a aa)) = {} \<or> L (erase (bder a aa)) \<noteq> {}")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1872
   prefer 2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1873
   apply(auto)[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1874
  apply(erule disjE)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1875
   apply(subgoal_tac "bsimp (bder a aa) = AZERO")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1876
    prefer 2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1877
  using L_bsimp_erase xxx_bder2 apply auto[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1878
   apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1879
  apply (metis L.simps(1) XXX4a erase.simps(1))  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1880
  apply(drule_tac x="bsimp (bder a aa)" in meta_spec)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1881
  apply(drule meta_mp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1882
  apply simp
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1883
  apply(rule good1a)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1884
  apply(auto)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1885
  done
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1886
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1887
lemma bders_AZERO:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1888
  shows "bders AZERO s = AZERO"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1889
  and   "bders_simp AZERO s = AZERO"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1890
   apply (induct s)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1891
     apply(auto)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1892
  done
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  1893
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1894
lemma LA:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1895
  assumes "\<Turnstile> v : ders s (erase r)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1896
  shows "retrieve (bders r s) v = retrieve r (flex (erase r) id s v)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1897
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1898
  apply(induct s arbitrary: r v rule: rev_induct)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1899
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1900
  apply(simp add: bders_append ders_append)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1901
  apply(subst bder_retrieve)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1902
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1903
  apply(drule Prf_injval)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1904
  by (simp add: flex_append)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1905
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1906
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1907
lemma LB:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1908
  assumes "s \<in> (erase r) \<rightarrow> v" 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1909
  shows "retrieve r v = retrieve r (flex (erase r) id s (mkeps (ders s (erase r))))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1910
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1911
  apply(induct s arbitrary: r v rule: rev_induct)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1912
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1913
   apply(subgoal_tac "v = mkeps (erase r)")
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1914
    prefer 2
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1915
  apply (simp add: Posix1(1) Posix_determ Posix_mkeps nullable_correctness)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1916
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1917
  apply(simp add: flex_append ders_append)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1918
  by (metis Posix_determ Posix_flex Posix_injval Posix_mkeps ders_snoc lexer_correctness(2) lexer_flex)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1919
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1920
lemma LB_sym:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1921
  assumes "s \<in> (erase r) \<rightarrow> v" 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1922
  shows "retrieve r v = retrieve r (flex (erase r) id s (mkeps (erase (bders r s))))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1923
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1924
  by (simp add: LB)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1925
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1926
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1927
lemma LC:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1928
  assumes "s \<in> (erase r) \<rightarrow> v" 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1929
  shows "retrieve r v = retrieve (bders r s) (mkeps (erase (bders r s)))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1930
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1931
  by (metis LA LB Posix1(1) assms lexer_correct_None lexer_flex mkeps_nullable)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1932
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1933
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1934
lemma L0:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1935
  assumes "bnullable a"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1936
  shows "retrieve (bsimp a) (mkeps (erase (bsimp a))) = retrieve a (mkeps (erase a))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1937
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1938
  by (metis b3 bmkeps_retrieve bmkeps_simp bnullable_correctness)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1939
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1940
thm bmkeps_retrieve
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1941
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1942
lemma L0a:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1943
  assumes "s \<in> L(erase a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1944
  shows "retrieve (bsimp (bders a s)) (mkeps (erase (bsimp (bders a s)))) = 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1945
         retrieve (bders a s) (mkeps (erase (bders a s)))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1946
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1947
  by (metis L0 bnullable_correctness erase_bders lexer_correct_None lexer_flex)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1948
  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1949
lemma L0aa:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1950
  assumes "s \<in> L (erase a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1951
  shows "[] \<in> erase (bsimp (bders a s)) \<rightarrow> mkeps (erase (bsimp (bders a s)))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1952
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1953
  by (metis Posix_mkeps b3 bnullable_correctness erase_bders lexer_correct_None lexer_flex)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1954
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1955
lemma L0aaa:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1956
  assumes "[c] \<in> L (erase a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1957
  shows "[c] \<in> (erase a) \<rightarrow> flex (erase a) id [c] (mkeps (erase (bder c a)))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1958
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1959
  by (metis bders.simps(1) bders.simps(2) erase_bders lexer_correct_None lexer_correct_Some lexer_flex option.inject)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1960
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1961
lemma L0aaaa:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1962
  assumes "[c] \<in> L (erase a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1963
  shows "[c] \<in> (erase a) \<rightarrow> flex (erase a) id [c] (mkeps (erase (bders a [c])))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1964
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1965
  using L0aaa by auto
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1966
    
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1967
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1968
lemma L02:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1969
  assumes "bnullable (bder c a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1970
  shows "retrieve (bsimp a) (flex (erase (bsimp a)) id [c] (mkeps (erase (bder c (bsimp a))))) = 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1971
         retrieve (bder c (bsimp a)) (mkeps (erase (bder c (bsimp a))))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1972
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1973
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1974
  using bder_retrieve L0 bmkeps_simp bmkeps_retrieve L0  LA LB
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1975
  apply(subst bder_retrieve[symmetric])
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1976
  apply (metis L_bsimp_erase bnullable_correctness der_correctness erase_bder mkeps_nullable nullable_correctness)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1977
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1978
  done
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1979
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1980
lemma L02_bders:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1981
  assumes "bnullable (bders a s)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1982
  shows "retrieve (bsimp a) (flex (erase (bsimp a)) id s (mkeps (erase (bders (bsimp a) s)))) = 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1983
         retrieve (bders (bsimp a) s) (mkeps (erase (bders (bsimp a) s)))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1984
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1985
  by (metis LA L_bsimp_erase bnullable_correctness ders_correctness erase_bders mkeps_nullable nullable_correctness)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1986
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1987
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1988
  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1989
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1990
lemma L03:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1991
  assumes "bnullable (bder c a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1992
  shows "retrieve (bder c (bsimp a)) (mkeps (erase (bder c (bsimp a)))) =
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1993
         bmkeps (bsimp (bder c (bsimp a)))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1994
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1995
  by (metis L0 L_bsimp_erase bmkeps_retrieve bnullable_correctness der_correctness erase_bder nullable_correctness)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1996
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1997
lemma L04:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1998
  assumes "bnullable (bder c a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  1999
  shows "retrieve (bder c (bsimp a)) (mkeps (erase (bder c (bsimp a)))) =
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2000
         retrieve (bsimp (bder c (bsimp a))) (mkeps (erase (bsimp (bder c (bsimp a)))))"     
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2001
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2002
  by (metis L0 L_bsimp_erase bnullable_correctness der_correctness erase_bder nullable_correctness)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2003
    
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2004
lemma L05:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2005
  assumes "bnullable (bder c a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2006
  shows "retrieve (bder c (bsimp a)) (mkeps (erase (bder c (bsimp a)))) =
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2007
         retrieve (bsimp (bder c (bsimp a))) (mkeps (erase (bsimp (bder c (bsimp a)))))" 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2008
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2009
  using L04 by auto 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2010
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2011
lemma L06:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2012
  assumes "bnullable (bder c a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2013
  shows "bmkeps (bder c (bsimp a)) = bmkeps (bsimp (bder c (bsimp a)))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2014
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2015
  by (metis L03 L_bsimp_erase bmkeps_retrieve bnullable_correctness der_correctness erase_bder nullable_correctness) 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2016
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2017
lemma L07:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2018
  assumes "s \<in> L (erase r)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2019
  shows "retrieve r (flex (erase r) id s (mkeps (ders s (erase r)))) 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2020
            = retrieve (bders r s) (mkeps (erase (bders r s)))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2021
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2022
  using LB LC lexer_correct_Some by auto
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2023
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2024
lemma LXXX:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2025
  assumes "s \<in> (erase r) \<rightarrow> v" "s \<in> (erase (bsimp r)) \<rightarrow> v'"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2026
  shows "retrieve r v = retrieve (bsimp r) v'"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2027
  using  assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2028
  apply -
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2029
  thm LC
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2030
  apply(subst LC)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2031
   apply(assumption)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2032
  apply(subst  L0[symmetric])
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2033
  using bnullable_correctness lexer_correctness(2) lexer_flex apply fastforce
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2034
  apply(subst (2) LC)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2035
   apply(assumption)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2036
  apply(subst (2)  L0[symmetric])
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2037
  using bnullable_correctness lexer_correctness(2) lexer_flex apply fastforce
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2038
   
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2039
  oops  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2040
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2041
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2042
lemma L07a:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2043
  assumes "s \<in> L (erase r)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2044
  shows "retrieve (bsimp r) (flex (erase (bsimp r)) id s (mkeps (ders s (erase (bsimp r))))) 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2045
         = retrieve r (flex (erase r) id s (mkeps (ders s (erase r))))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2046
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2047
  apply(induct s arbitrary: r)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2048
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2049
  using L0a apply force
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2050
  apply(drule_tac x="(bder a r)" in meta_spec)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2051
  apply(drule meta_mp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2052
  apply (metis L_bsimp_erase erase_bder lexer.simps(2) lexer_correct_None option.case(1))
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2053
  apply(drule sym)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2054
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2055
  apply(subst (asm) bder_retrieve)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2056
   apply (metis Posix_Prf Posix_flex Posix_mkeps ders.simps(2) lexer_correct_None lexer_flex)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2057
  apply(simp only: flex_fun_apply)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2058
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2059
  using L0[no_vars] bder_retrieve[no_vars] LA[no_vars] LC[no_vars] L07[no_vars]
331
c470f792022b checkpoint
Christian Urban <urbanc@in.tum.de>
parents: 330
diff changeset
  2060
  oops
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2061
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2062
lemma L08:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2063
  assumes "s \<in> L (erase r)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2064
  shows "retrieve (bders (bsimp r) s) (mkeps (erase (bders (bsimp r) s)))
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2065
         = retrieve (bders r s) (mkeps (erase (bders r s)))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2066
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2067
  apply(induct s arbitrary: r)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2068
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2069
  using L0 bnullable_correctness nullable_correctness apply blast
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2070
  apply(simp add: bders_append)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2071
  apply(drule_tac x="(bder a (bsimp r))" in meta_spec)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2072
  apply(drule meta_mp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2073
  apply (metis L_bsimp_erase erase_bder lexer.simps(2) lexer_correct_None option.case(1))
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2074
  apply(drule sym)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2075
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2076
  apply(subst LA)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2077
  apply (metis L0aa L_bsimp_erase Posix1(1) ders.simps(2) ders_correctness erase_bder erase_bders mkeps_nullable nullable_correctness)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2078
  apply(subst LA)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2079
  using lexer_correct_None lexer_flex mkeps_nullable apply force
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2080
  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2081
  using L0[no_vars] bder_retrieve[no_vars] LA[no_vars] LC[no_vars] L07[no_vars]
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2082
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2083
thm L0[no_vars] bder_retrieve[no_vars] LA[no_vars] LC[no_vars] L07[no_vars]
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2084
  oops
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2085
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2086
lemma test:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2087
  assumes "s = [c]"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2088
  shows "retrieve (bders r s) v = XXX" and "YYY = retrieve r (flex (erase r) id s v)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2089
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2090
   apply(simp only: bders.simps)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2091
   defer
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2092
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2093
   apply(simp only: flex.simps id_simps)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2094
  using  L0[no_vars] bder_retrieve[no_vars] LA[no_vars] LC[no_vars] 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2095
  find_theorems "retrieve (bders _ _) _"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2096
  find_theorems "retrieve _ (mkeps _)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2097
  oops
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2098
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2099
lemma L06X:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2100
  assumes "bnullable (bder c a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2101
  shows "bmkeps (bder c (bsimp a)) = bmkeps (bder c a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2102
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2103
  apply(induct a arbitrary: c)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2104
       apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2105
      apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2106
     apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2107
    prefer 3
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2108
    apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2109
   prefer 2
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2110
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2111
  
331
c470f792022b checkpoint
Christian Urban <urbanc@in.tum.de>
parents: 330
diff changeset
  2112
   defer
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2113
  oops
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2114
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2115
lemma L06_2:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2116
  assumes "bnullable (bders a [c,d])"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2117
  shows "bmkeps (bders (bsimp a) [c,d]) = bmkeps (bsimp (bders (bsimp a) [c,d]))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2118
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2119
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2120
  by (metis L_bsimp_erase bmkeps_simp bnullable_correctness der_correctness erase_bder nullable_correctness)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2121
  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2122
lemma L06_bders:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2123
  assumes "bnullable (bders a s)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2124
  shows "bmkeps (bders (bsimp a) s) = bmkeps (bsimp (bders (bsimp a) s))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2125
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2126
  by (metis L_bsimp_erase bmkeps_simp bnullable_correctness ders_correctness erase_bders nullable_correctness)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2127
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2128
lemma LLLL:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2129
  shows "L (erase a) =  L (erase (bsimp a))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2130
  and "L (erase a) = {flat v | v. \<Turnstile> v: (erase a)}"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2131
  and "L (erase a) = {flat v | v. \<Turnstile> v: (erase (bsimp a))}"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2132
  using L_bsimp_erase apply(blast)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2133
  apply (simp add: L_flat_Prf)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2134
  using L_bsimp_erase L_flat_Prf apply(auto)[1]
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2135
  done  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2136
    
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2137
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2138
331
c470f792022b checkpoint
Christian Urban <urbanc@in.tum.de>
parents: 330
diff changeset
  2139
lemma L07XX:
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2140
  assumes "s \<in> L (erase a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2141
  shows "s \<in> erase a \<rightarrow> flex (erase a) id s (mkeps (ders s (erase a)))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2142
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2143
  by (meson lexer_correct_None lexer_correctness(1) lexer_flex)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2144
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2145
lemma LX0:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2146
  assumes "s \<in> L r"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2147
  shows "decode (bmkeps (bders (intern r) s)) r = Some(flex r id s (mkeps (ders s r)))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2148
  by (metis assms blexer_correctness blexer_def lexer_correct_None lexer_flex)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2149
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2150
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2151
lemma L02_bders2:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2152
  assumes "bnullable (bders a s)" "s = [c]"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2153
  shows "retrieve (bders (bsimp a) s) (mkeps (erase (bders (bsimp a) s)))  =
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2154
         retrieve (bders a s) (mkeps (erase (bders a s)))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2155
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2156
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2157
  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2158
  apply(induct s arbitrary: a)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2159
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2160
  using L0 apply auto[1]
331
c470f792022b checkpoint
Christian Urban <urbanc@in.tum.de>
parents: 330
diff changeset
  2161
  oops
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2162
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2163
thm bmkeps_retrieve bmkeps_simp Posix_mkeps
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2164
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2165
lemma WQ1:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2166
  assumes "s \<in> L (der c r)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2167
  shows "s \<in> der c r \<rightarrow> mkeps (ders s (der c r))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2168
  using assms
331
c470f792022b checkpoint
Christian Urban <urbanc@in.tum.de>
parents: 330
diff changeset
  2169
  oops
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2170
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2171
lemma L02_bsimp:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2172
  assumes "bnullable (bders a s)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2173
  shows "retrieve (bsimp a) (flex (erase (bsimp a)) id s (mkeps (erase (bders (bsimp a) s)))) =
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2174
         retrieve a (flex (erase a) id s (mkeps (erase (bders a s))))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2175
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2176
  apply(induct s arbitrary: a)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2177
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2178
   apply (simp add: L0)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2179
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2180
  apply(drule_tac x="bder a aa" in meta_spec)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2181
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2182
  apply(subst (asm) bder_retrieve)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2183
  using Posix_Prf Posix_flex Posix_mkeps bnullable_correctness apply fastforce
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2184
  apply(simp add: flex_fun_apply)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2185
  apply(drule sym)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2186
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2187
  apply(subst flex_injval)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2188
  apply(subst bder_retrieve[symmetric])
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2189
  apply (metis L_bsimp_erase Posix_Prf Posix_flex Posix_mkeps bders.simps(2) bnullable_correctness ders.simps(2) erase_bders lexer_correct_None lexer_flex option.distinct(1))
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2190
  apply(simp only: erase_bder[symmetric] erase_bders[symmetric])  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2191
  apply(subst LB_sym[symmetric])
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2192
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2193
  oops
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2194
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2195
lemma L1:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2196
  assumes "s \<in> r \<rightarrow> v" 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2197
  shows "decode (bmkeps (bders (intern r) s)) r = Some v"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2198
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2199
  by (metis blexer_correctness blexer_def lexer_correctness(1) option.distinct(1))
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2200
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2201
lemma L2:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2202
  assumes "s \<in> (der c r) \<rightarrow> v" 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2203
  shows "decode (bmkeps (bders (intern r) (c # s))) r = Some (injval r c v)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2204
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2205
  apply(subst bmkeps_retrieve)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2206
  using Posix1(1) lexer_correct_None lexer_flex apply fastforce
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2207
  using MAIN_decode
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2208
  apply(subst MAIN_decode[symmetric])
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2209
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2210
   apply (meson Posix1(1) lexer_correct_None lexer_flex mkeps_nullable)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2211
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2212
  apply(subgoal_tac "v = flex (der c r) id s (mkeps (ders s (der c r)))")
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2213
   prefer 2
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2214
   apply (metis Posix_determ lexer_correctness(1) lexer_flex option.distinct(1))
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2215
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2216
  apply(subgoal_tac "injval r c (flex (der c r) id s (mkeps (ders s (der c r)))) =
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2217
    (flex (der c r) ((\<lambda>v. injval r c v) o id) s (mkeps (ders s (der c r))))")
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2218
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2219
  using flex_fun_apply by blast
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2220
  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2221
lemma L3:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2222
  assumes "s2 \<in> (ders s1 r) \<rightarrow> v" 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2223
  shows "decode (bmkeps (bders (intern r) (s1 @ s2))) r = Some (flex r id s1 v)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2224
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2225
  apply(induct s1 arbitrary: r s2 v rule: rev_induct)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2226
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2227
  using L1 apply blast
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2228
  apply(simp add: ders_append)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2229
  apply(drule_tac x="r" in meta_spec)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2230
  apply(drule_tac x="x # s2" in meta_spec)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2231
  apply(drule_tac x="injval (ders xs r) x v" in meta_spec)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2232
  apply(drule meta_mp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2233
   defer
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2234
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2235
   apply(simp add:  flex_append)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2236
  by (simp add: Posix_injval)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2237
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2238
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2239
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2240
lemma bders_snoc:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2241
  "bder c (bders a s) = bders a (s @ [c])"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2242
  apply(simp add: bders_append)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2243
  done
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2244
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2245
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2246
lemma QQ1:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2247
  shows "bsimp (bders (bsimp a) []) = bders_simp (bsimp a) []"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2248
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2249
  apply(simp add: bsimp_idem)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2250
  done
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2251
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2252
lemma QQ2:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2253
  shows "bsimp (bders (bsimp a) [c]) = bders_simp (bsimp a) [c]"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2254
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2255
  done
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2256
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2257
lemma XXX2a_long:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2258
  assumes "good a"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2259
  shows "bsimp (bder c (bsimp a)) = bsimp (bder c a)"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2260
  using  assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2261
  apply(induct a arbitrary: c taking: asize rule: measure_induct)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2262
  apply(case_tac x)
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  2263
       apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  2264
      apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  2265
     apply(simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  2266
  prefer 3
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  2267
    apply(simp)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2268
   apply(simp)
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  2269
   apply(auto)[1]
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2270
apply(case_tac "x42 = AZERO")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2271
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2272
   apply(case_tac "x43 = AZERO")
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  2273
     apply(simp)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2274
  using test2 apply force  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2275
  apply(case_tac "\<exists>bs. x42 = AONE bs")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2276
     apply(clarify)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2277
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2278
    apply(subst bsimp_ASEQ1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2279
       apply(simp)
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  2280
  using b3 apply force
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2281
  using bsimp_ASEQ0 test2 apply force
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2282
  thm good_SEQ test2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2283
     apply (simp add: good_SEQ test2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2284
    apply (simp add: good_SEQ test2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2285
  apply(case_tac "x42 = AZERO")
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  2286
     apply(simp)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2287
   apply(case_tac "x43 = AZERO")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2288
    apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2289
  apply (simp add: bsimp_ASEQ0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2290
  apply(case_tac "\<exists>bs. x42 = AONE bs")
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  2291
     apply(clarify)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  2292
     apply(simp)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2293
    apply(subst bsimp_ASEQ1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2294
      apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2295
  using bsimp_ASEQ0 test2 apply force
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2296
     apply (simp add: good_SEQ test2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2297
    apply (simp add: good_SEQ test2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2298
  apply (simp add: good_SEQ test2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2299
  (* AALTs case *)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2300
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2301
  using test2 by fastforce
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2302
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2303
lemma XXX2a_long_without_good:
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2304
  assumes "a = AALTs bs0  [AALTs bs1 [AALTs bs2 [ASTAR [] (AONE bs7), AONE bs6, ASEQ bs3 (ACHAR bs4 d) (AONE bs5)]]]" 
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2305
  shows "bsimp (bder c (bsimp a)) = bsimp (bder c a)"
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2306
        "bsimp (bder c (bsimp a)) = XXX"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2307
        "bsimp (bder c a) = YYY"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2308
  using  assms
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2309
    apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2310
  using  assms
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2311
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2312
   prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2313
  using  assms
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2314
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2315
  oops
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2316
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2317
lemma bder_bsimp_AALTs:
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2318
  shows "bder c (bsimp_AALTs bs rs) = bsimp_AALTs bs (map (bder c) rs)"
340
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2319
  apply(induct bs rs rule: bsimp_AALTs.induct)  
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2320
    apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2321
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2322
   apply (simp add: bder_fuse)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2323
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2324
  done
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2326
lemma flts_nothing:
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2327
  assumes "\<forall>r \<in> set rs. r \<noteq> AZERO" "\<forall>r \<in> set rs. nonalt r"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2328
  shows "flts rs = rs"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2329
  using assms
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2330
  apply(induct rs rule: flts.induct)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2331
        apply(auto)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2332
  done
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2333
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2334
lemma flts_flts:
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2335
  assumes "\<forall>r \<in> set rs. good r"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2336
  shows "flts (flts rs) = flts rs"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2337
  using assms
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2338
  apply(induct rs taking: "\<lambda>rs. sum_list  (map asize rs)" rule: measure_induct)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2339
  apply(case_tac x)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2340
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2341
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2342
  apply(case_tac a)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2343
       apply(simp_all  add: bder_fuse flts_append)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2344
  apply(subgoal_tac "\<forall>r \<in> set x52. r \<noteq> AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2345
   prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2346
  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)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2347
  apply(subgoal_tac "\<forall>r \<in> set x52. nonalt r")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2348
   prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2349
   apply (metis n0 nn1b test2)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2350
  by (metis flts_fuse flts_nothing)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2351
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2352
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2353
lemma PP:
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2354
  assumes "bnullable (bders r s)" 
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2355
  shows "bmkeps (bders (bsimp r) s) = bmkeps (bders r s)"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2356
  using assms
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2357
  apply(induct s arbitrary: r)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2358
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2359
  using bmkeps_simp apply auto[1]
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2360
  apply(simp add: bders_append bders_simp_append)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2361
  oops
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2362
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2363
lemma PP:
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2364
  assumes "bnullable (bders r s)"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2365
  shows "bmkeps (bders_simp (bsimp r) s) = bmkeps (bders r s)"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2366
  using assms
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2367
  apply(induct s arbitrary: r rule: rev_induct)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2368
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2369
  using bmkeps_simp apply auto[1]
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2370
  apply(simp add: bders_append bders_simp_append)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2371
  apply(drule_tac x="bder a (bsimp r)" in meta_spec)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2372
  apply(drule_tac meta_mp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2373
   defer
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2374
  oops
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2375
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2376
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2377
lemma
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2378
  assumes "asize (bsimp a) = asize a"  "a = AALTs bs [AALTs bs2 [], AZERO, AONE bs3]"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2379
  shows "bsimp a = a"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2380
  using assms
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2381
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2382
  oops
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2383
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2384
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2385
lemma iii:
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2386
  assumes "bsimp_AALTs bs rs \<noteq> AZERO"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2387
  shows "rs \<noteq> []"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2388
  using assms
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2389
  apply(induct bs  rs rule: bsimp_AALTs.induct)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2390
    apply(auto)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2391
  done
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2392
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2393
lemma
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2394
  assumes "\<forall>y. asize y < Suc (sum_list (map asize x52)) \<longrightarrow> asize (bsimp y) = asize y \<longrightarrow> bsimp y \<noteq> AZERO \<longrightarrow> bsimp y = y"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2395
   "asize (bsimp_AALTs x51 (flts (map bsimp x52))) = Suc (sum_list (map asize x52))" 
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2396
          "bsimp_AALTs x51 (flts (map bsimp x52)) \<noteq> AZERO"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2397
   shows "bsimp_AALTs x51 (flts (map bsimp x52)) = AALTs x51 x52"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2398
  using assms
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2399
  apply(induct x52 arbitrary: x51)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2400
   apply(simp)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2401
  oops
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2402
  
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2403
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2404
lemma
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2405
  assumes "asize (bsimp a) = asize a" "bsimp a \<noteq> AZERO"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2406
  shows "bsimp a = a"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2407
  using assms
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2408
  apply(induct a taking: asize rule: measure_induct)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2409
  apply(case_tac x)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2410
       apply(simp_all)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2411
   apply(case_tac "(bsimp x42) = AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2412
    apply(simp add: asize0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2413
  apply(case_tac "(bsimp x43) = AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2414
    apply(simp add: asize0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2415
    apply (metis bsimp_ASEQ0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2416
   apply(case_tac "\<exists>bs. (bsimp x42) = AONE bs")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2417
    apply(auto)[1]
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2418
    apply (metis b1 bsimp_size fuse_size less_add_Suc2 not_less)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2419
  apply (metis Suc_inject add.commute asize.simps(5) bsimp_ASEQ1 bsimp_size leD le_neq_implies_less less_add_Suc2 less_add_eq_less)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2420
  (* ALT case *)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2421
  apply(frule iii)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2422
  apply(case_tac x52)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2423
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2424
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2425
  apply(subst k0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2426
  apply(subst (asm) k0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2427
  apply(subst (asm) (2) k0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2428
  apply(subst (asm) (3) k0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2429
  apply(case_tac "(bsimp a) = AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2430
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2431
  apply (metis (no_types, lifting) Suc_le_lessD asize0 bsimp_AALTs_size le_less_trans less_add_same_cancel2 not_less_eq rt)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2432
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2433
  apply(case_tac "nonalt  (bsimp a)")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2434
   prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2435
  apply(drule_tac  x="AALTs x51 (bsimp a # list)" in  spec)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2436
   apply(drule mp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2437
  apply (metis asize.simps(4) bsimp.simps(2) bsimp_AALTs_size3 k0 less_not_refl list.set_intros(1) list.simps(9) sum_list.Cons)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2438
   apply(drule mp)  
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2439
    apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2440
  apply (metis asize.simps(4) bsimp.simps(2) bsimp_AALTs_size3 k0 lessI list.set_intros(1) list.simps(9) not_less_eq sum_list.Cons)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2441
   apply(drule mp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2442
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2443
  using bsimp_idem apply auto[1]
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2444
    apply(simp add: bsimp_idem)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2445
  apply (metis append.left_neutral append_Cons asize.simps(4) bsimp.simps(2) bsimp_AALTs_size3 k00 less_not_refl list.set_intros(1) list.simps(9) sum_list.Cons)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2446
  apply (metis bsimp.simps(2) bsimp_idem k0 list.simps(9) nn1b nonalt.elims(3) nonnested.simps(2))
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2447
  apply(subgoal_tac "flts [bsimp a] = [bsimp a]")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2448
  prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2449
  using k0b apply blast
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2450
  apply(clarify)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2451
  apply(simp only:)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2452
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2453
  apply(case_tac "flts (map bsimp list) = Nil")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2454
   apply (metis bsimp_AALTs1 bsimp_size fuse_size less_add_Suc1 not_less) 
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2455
  apply (subgoal_tac "bsimp_AALTs x51 (bsimp a # flts (map bsimp list)) =  AALTs x51 (bsimp a # flts (map bsimp list))")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2456
   prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2457
   apply (metis bsimp_AALTs.simps(3) neq_Nil_conv)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2458
  apply(auto)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2459
   apply (metis add.commute bsimp_size leD le_neq_implies_less less_add_Suc1 less_add_eq_less rt)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2460
  oops
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2461
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2462
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2463
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2464
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2465
lemma OOO:
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2466
  shows "bsimp (bsimp_AALTs bs rs) = bsimp_AALTs bs (flts (map bsimp rs))"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2467
  apply(induct rs arbitrary: bs taking: "\<lambda>rs. sum_list (map asize rs)" rule: measure_induct)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2468
  apply(case_tac x)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2469
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2470
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2471
  apply(case_tac "a = AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2472
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2473
  apply(case_tac "list")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2474
    apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2475
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2476
  apply(case_tac "bsimp a = AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2477
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2478
  apply(case_tac "list")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2479
    apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2480
    apply(simp add: bsimp_fuse[symmetric])
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2481
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2482
  apply(case_tac "nonalt (bsimp a)")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2483
  apply(case_tac list)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2484
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2485
    apply(subst k0b)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2486
      apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2487
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2488
    apply(simp add: bsimp_fuse)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2489
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2490
  apply(subgoal_tac "asize (bsimp a) < asize a \<or> asize (bsimp a) = asize a")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2491
   prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2492
  using bsimp_size le_neq_implies_less apply blast
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2493
   apply(erule disjE)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2494
  apply(drule_tac x="(bsimp a) # list" in spec)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2495
  apply(drule mp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2496
    apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2497
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2498
  apply (metis bsimp.simps(2) bsimp_AALTs.elims bsimp_AALTs.simps(2) bsimp_fuse bsimp_idem list.distinct(1) list.inject list.simps(9))
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2499
    apply(subgoal_tac "\<exists>bs rs. bsimp a = AALTs bs rs  \<and> rs \<noteq> Nil \<and> length rs > 1")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2500
   prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2501
  apply (metis bbbbs1 bsimp.simps(2) bsimp_AALTs.simps(1) bsimp_idem flts.simps(1) good.simps(5) good1 length_0_conv length_Suc_conv less_one list.simps(8) nat_neq_iff not_less_eq)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2502
  apply(auto)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2503
  oops
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2504
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2505
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2506
lemma  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2507
  assumes "rs = [AALTs bsa [AONE bsb, AONE bsb]]"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2508
  shows "bsimp (bsimp_AALTs bs rs) = bsimp_AALTs bs (flts (map bsimp rs))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2509
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2510
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2511
  oops
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2512
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2513
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2514
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2515
lemma CT1:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2516
  shows "bsimp (AALTs bs as) = bsimp(AALTs bs (map  bsimp as))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2517
  apply(induct as arbitrary: bs)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2518
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2519
  apply(simp)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2520
  by (simp add: bsimp_idem comp_def)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2521
  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2522
lemma CT1a:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2523
  shows "bsimp (AALT bs a1 a2) = bsimp(AALT bs (bsimp a1) (bsimp a2))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2524
  by (metis CT1 list.simps(8) list.simps(9))
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2525
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2526
(* CT *)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2527
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2528
lemma CTU:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2529
  shows "bsimp_AALTs bs as = li bs as"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2530
  apply(induct bs as rule: li.induct)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2531
    apply(auto)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2532
  done
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2533
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2534
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2535
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2536
lemma CTa:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2537
  assumes "\<forall>r \<in> set as. nonalt r \<and> r \<noteq> AZERO"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2538
  shows  "flts as = as"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2539
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2540
  apply(induct as)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2541
   apply(simp)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2542
  apply(case_tac as)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2543
   apply(simp)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2544
  apply (simp add: k0b)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2545
  using flts_nothing by auto
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2546
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2547
lemma CT0:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2548
  assumes "\<forall>r \<in> set as1. nonalt r \<and> r \<noteq> AZERO" 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2549
  shows "flts [bsimp_AALTs bs1 as1] =  flts (map (fuse bs1) as1)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2550
  using assms CTa
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2551
  apply(induct as1 arbitrary: bs1)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2552
    apply(simp)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2553
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2554
  apply(case_tac as1)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2555
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2556
  apply(simp)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2557
proof -
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2558
fix a :: arexp and as1a :: "arexp list" and bs1a :: "bit list" and aa :: arexp and list :: "arexp list"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2559
  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)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2560
  assume a2: "\<And>as. \<forall>r\<in>set as. nonalt r \<and> r \<noteq> AZERO \<Longrightarrow> flts as = as"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2561
  assume a3: "as1a = aa # list"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2562
  have "flts [a] = [a]"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2563
using a1 k0b by blast
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2564
then show "fuse bs1a a # fuse bs1a aa # map (fuse bs1a) list = flts (fuse bs1a a # fuse bs1a aa # map (fuse bs1a) list)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2565
  using a3 a2 a1 by (metis (no_types) append.left_neutral append_Cons flts_fuse k00 k0b list.simps(9))
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2566
qed
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2567
  
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2568
  
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2569
lemma CT01:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2570
  assumes "\<forall>r \<in> set as1. nonalt r \<and> r \<noteq> AZERO" "\<forall>r \<in> set as2. nonalt r \<and> r \<noteq> AZERO" 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2571
  shows "flts [bsimp_AALTs bs1 as1, bsimp_AALTs bs2 as2] =  flts ((map (fuse bs1) as1) @ (map (fuse bs2) as2))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2572
  using assms CT0
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2573
  by (metis k0 k00)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2574
  
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2575
331
c470f792022b checkpoint
Christian Urban <urbanc@in.tum.de>
parents: 330
diff changeset
  2576
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2577
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2578
lemma 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2579
  shows "bsimp (AALT bs (AALTs bs1 (map (bder c) as1)) (AALTs bs2 (map (bder c) as2)))
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2580
          = bsimp (AALTs bs ((map (fuse bs1) (map (bder c) as1)) @
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2581
                             (map (fuse bs2) (map (bder c) as2))))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2582
  apply(subst  bsimp_idem[symmetric])
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2583
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2584
  oops
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2585
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2586
lemma CT_exp:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2587
  assumes "\<forall>a \<in> set as. bsimp (bder c (bsimp a)) = bsimp (bder c a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2588
  shows "map bsimp (map (bder c) as) = map bsimp (map (bder c) (map bsimp as))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2589
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2590
  apply(induct as)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2591
   apply(auto)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2592
  done
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2593
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2594
lemma asize_set:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2595
  assumes "a \<in> set as"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2596
  shows "asize a < Suc (sum_list (map asize as))"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2597
  using assms
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2598
  apply(induct as arbitrary: a)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2599
   apply(auto)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2600
  using le_add2 le_less_trans not_less_eq by blast
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2601
  
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2602
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2603
lemma XXX2a_long_without_good:
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2604
  shows "bsimp (bder c (bsimp a)) = bsimp (bder c a)"
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2605
  apply(induct a arbitrary: c taking: "\<lambda>a. asize a" rule: measure_induct)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2606
  apply(case_tac x)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2607
       apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2608
      apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2609
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2610
  prefer 3
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  2611
    apply(simp)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  2612
  (* AALT case *)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2613
   prefer 2
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2614
   apply(simp del: bsimp.simps)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2615
   apply(subst (2) CT1)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2616
   apply(subst CT_exp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2617
    apply(auto)[1]
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2618
  using asize_set apply blast
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2619
   apply(subst CT1[symmetric])
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2620
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2621
  oops
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  2622
332
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  2623
lemma YY:
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  2624
  assumes "flts (map bsimp as1) = xs"
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  2625
  shows "flts (map bsimp (map (fuse bs1) as1)) = map (fuse bs1) xs"
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  2626
  using assms
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  2627
  apply(induct as1 arbitrary: bs1 xs)
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  2628
   apply(simp)
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  2629
  apply(auto)
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  2630
  by (metis bsimp_fuse flts_fuse k0 list.simps(9))
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  2631
  
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  2632
333
e0903f6fb4f7 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 332
diff changeset
  2633
lemma flts_nonalt:
e0903f6fb4f7 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 332
diff changeset
  2634
  assumes "flts (map bsimp xs) = ys"
e0903f6fb4f7 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 332
diff changeset
  2635
  shows "\<forall>y \<in> set ys. nonalt y"
e0903f6fb4f7 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 332
diff changeset
  2636
  using assms
e0903f6fb4f7 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 332
diff changeset
  2637
  apply(induct xs arbitrary: ys)
e0903f6fb4f7 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 332
diff changeset
  2638
   apply(auto)
e0903f6fb4f7 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 332
diff changeset
  2639
  apply(case_tac xs)
e0903f6fb4f7 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 332
diff changeset
  2640
   apply(auto)
e0903f6fb4f7 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 332
diff changeset
  2641
  using flts2 good1 apply fastforce
e0903f6fb4f7 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 332
diff changeset
  2642
  by (smt ex_map_conv list.simps(9) nn1b nn1c)
332
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  2643
334
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2644
lemma WWW2:
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2645
  shows "bsimp (bsimp_AALTs bs1 (flts (map bsimp as1))) =
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2646
         bsimp_AALTs bs1 (flts (map bsimp as1))"
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2647
  by (metis bsimp.simps(2) bsimp_idem)
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2648
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2649
lemma WWW3:
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2650
  shows "flts [bsimp_AALTs bs1 (flts (map bsimp as1))] =
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2651
         flts (map bsimp (map (fuse bs1) as1))"
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2652
  by (metis CT0 YY flts_nonalt flts_nothing qqq1)
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2653
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2654
lemma WWW4:
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2655
  shows "map (bder c \<circ> fuse bs1) as1 = map (fuse bs1) (map (bder c) as1)"
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2656
  apply(induct as1)
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2657
   apply(auto)
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2658
  using bder_fuse by blast
335
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  2659
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  2660
lemma WWW5:
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  2661
  shows "map (bsimp \<circ> bder c) as1 = map bsimp (map (bder c) as1)"
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  2662
  apply(induct as1)
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  2663
   apply(auto)
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  2664
  done
334
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  2665
340
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2666
lemma WWW6:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2667
  shows "bsimp (bder c (bsimp_AALTs x51 (flts [bsimp a1, bsimp a2]) ) )  = 
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2668
 bsimp(bsimp_AALTs x51 (map (bder c) (flts [bsimp a1, bsimp a2]))) "
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2669
  using bder_bsimp_AALTs by auto
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2670
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2671
lemma WWW7:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2672
  shows "bsimp (bsimp_AALTs x51 (map (bder c) (flts [bsimp a1, bsimp a2]))) =
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2673
  bsimp(bsimp_AALTs x51 (flts (map (bder c) [bsimp a1, bsimp a2])))"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2674
  sorry
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2675
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2676
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2677
lemma stupid:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2678
  assumes "a = b"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2679
  shows "bsimp(a) = bsimp(b)"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2680
  using assms
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2681
  apply(auto)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2682
  done
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2683
(*
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2684
proving idea:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2685
bsimp_AALTs x51  (map (bder c) (flts [a1, a2])) = bsimp_AALTs x51 (map (bder c) (flts [a1]++[a2]))
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2686
= bsimp_AALTs x51  (map (bder c) ((flts [a1])++(flts [a2]))) =  
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2687
bsimp_AALTs x51 (map (bder c) (flts [a1]))++(map (bder c) (flts [a2])) = A
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2688
and then want to prove that
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2689
map (bder c) (flts [a]) = flts [bder c a] under the condition 
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2690
that a is either a seq with the first elem being not nullable, or a character equal to c,
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2691
or an AALTs, or a star
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2692
Then, A = bsimp_AALTs x51 (flts [bder c a]) ++ (map (bder c) (flts [a2])) = A1
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2693
Using the same condition for a2, we get
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2694
A1 = bsimp_AALTs x51 (flts [bder c a1]) ++ (flts [bder c a2])
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2695
=bsimp_AALTs x51 flts ([bder c a1] ++ [bder c a2])
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2696
=bsimp_AALTs x51 flts ([bder c a1, bder c a2])
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2697
 *)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2698
lemma manipulate_flts:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2699
  shows "bsimp_AALTs x51  (map (bder c) (flts [a1, a2])) = 
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2700
bsimp_AALTs x51 ((map (bder c) (flts [a1])) @ (map (bder c) (flts [a2])))"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2701
  by (metis k0 map_append)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2702
  
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2703
lemma go_inside_flts:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2704
  assumes " (bder c a1 \<noteq> AZERO) "
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2705
 "\<not>(\<exists> a01 a02 x02. (  (a1 = ASEQ x02 a01 a02) \<and> bnullable(a01) )      )"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2706
shows "map (bder c) (flts [a1]) = flts [bder c a1]"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2707
  using assms
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2708
  apply -
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2709
  apply(case_tac a1)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2710
  apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2711
  apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2712
     apply(case_tac "x32 = c")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2713
  prefer 2
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2714
      apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2715
     apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2716
    apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2717
  apply (simp add: WWW4)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2718
   apply(simp add: bder_fuse)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2719
  done
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2720
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2721
lemma medium010:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2722
  assumes " (bder c a1 = AZERO) "
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2723
  shows "map (bder c) (flts [a1]) = [AZERO] \<or> map (bder c) (flts [a1]) = []"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2724
  using assms
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2725
  apply -
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2726
  apply(case_tac a1)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2727
       apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2728
      apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2729
  apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2730
    apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2731
  apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2732
  apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2733
  done
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2734
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2735
lemma medium011:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2736
  assumes " (bder c a1 = AZERO) "
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2737
  shows "flts (map (bder c)  [a1, a2]) = flts [bder c a2]"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2738
  using assms
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2739
  apply -
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2740
  apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2741
  done
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2742
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2743
lemma medium01central:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2744
  shows "bsimp(bsimp_AALTs x51 (map (bder c) (flts [a2])) ) = bsimp(bsimp_AALTs x51 (flts [bder c a2]))"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2745
  sorry
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2746
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2747
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2748
lemma plus_bsimp:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2749
  assumes "bsimp( bsimp a) = bsimp (bsimp b)"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2750
  shows "bsimp a = bsimp b"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2751
  using assms
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2752
  apply -
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2753
  by (simp add: bsimp_idem)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2754
lemma patience_good5:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2755
  assumes "bsimp r = AALTs x y"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2756
  shows " \<exists> a aa list. y = a#aa#list"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2757
  by (metis Nil_is_map_conv arexp.simps(13) assms bsimp_AALTs.elims flts1 good.simps(5) good1 k0a)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2758
341
abf178a5db58 hope it works
Chengsong
parents: 340
diff changeset
  2759
(*SAD*)
340
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2760
(*this does not hold actually
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2761
lemma bsimp_equiv0:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2762
  shows "bsimp(bsimp r) = bsimp(bsimp (AALTs []  [r]))"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2763
  apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2764
  apply(case_tac "bsimp r")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2765
       apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2766
      apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2767
     apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2768
    apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2769
 thm good1
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2770
  using good1
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2771
   apply -
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2772
   apply(drule_tac x="r" in meta_spec)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2773
   apply(erule disjE)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2774
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2775
    apply(simp only: bsimp_AALTs.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2776
    apply(simp only:flts.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2777
    apply(drule patience_good5)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2778
    apply(clarify)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2779
    apply(subst  bsimp_AALTs_qq)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2780
     apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2781
    prefer 2
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2782
  sorry*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2783
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2784
(*exercise: try multiple ways of proving this*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2785
(*this lemma does not hold.........
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2786
lemma bsimp_equiv1:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2787
  shows "bsimp r = bsimp (AALTs []  [r])"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2788
  using plus_bsimp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2789
  apply -
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2790
  using bsimp_equiv0 by blast
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2791
  (*apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2792
  apply(case_tac "bsimp r")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2793
       apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2794
      apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2795
     apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2796
    apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2797
(*use lemma good1*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2798
  thm good1
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2799
  using good1
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2800
   apply -
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2801
   apply(drule_tac x="r" in meta_spec)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2802
   apply(erule disjE)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2803
  
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2804
  apply(subst flts_single1)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2805
  apply(simp only: bsimp_AALTs.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2806
    prefer 2
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2807
  
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2808
  thm flts_single1
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2809
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2810
  find_theorems "flts _ = _"*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2811
*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2812
lemma bsimp_equiv2:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2813
  shows "bsimp (AALTs x51 [r])  =  bsimp (AALT x51 AZERO r)"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2814
  sorry
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2815
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2816
lemma medium_stupid_isabelle:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2817
  assumes "rs = a # list"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2818
  shows  "bsimp_AALTs x51 (AZERO # rs) = AALTs x51 (AZERO#rs)"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2819
  using assms
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2820
  apply -
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2821
  apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2822
  done 
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2823
(*
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2824
lemma mediumlittle:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2825
  shows "bsimp(bsimp_AALTs x51 rs) = bsimp(bsimp_AALTs x51 (AZERO # rs))"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2826
  apply(case_tac rs)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2827
   apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2828
  apply(case_tac list)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2829
   apply(subst medium_stupid_isabelle)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2830
    apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2831
   prefer 2
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2832
   apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2833
  apply(rule_tac s="a#list" and t="rs" in subst)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2834
   apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2835
  apply(rule_tac t="list" and s= "[]" in subst)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2836
   apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2837
 (*dunno what is the rule for x#nil = x*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2838
   apply(case_tac a)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2839
        apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2840
       apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2841
     apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2842
    prefer 3
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2843
    apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2844
   apply(simp only:bsimp_AALTs.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2845
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2846
  apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2847
     apply(case_tac "bsimp x42")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2848
        apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2849
       apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2850
       apply(case_tac "bsimp x43")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2851
            apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2852
           apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2853
  apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2854
         apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2855
        apply(simp only:bsimp_ASEQ.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2856
  using good1
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2857
        apply -
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2858
        apply(drule_tac x="x43" in meta_spec)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2859
  apply(erule disjE)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2860
        apply(subst bsimp_AALTs_qq)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2861
  using patience_good5 apply force
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2862
         apply(simp only:bsimp_AALTs.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2863
  apply(simp only:fuse.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2864
         apply(simp only:flts.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2865
(*OK from here you actually realize this lemma doesnt hold*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2866
  apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2867
        apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2868
       apply(rule_tac t="rs" and s="a#list" in subst)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2869
        apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2870
   apply(rule_tac t="list" and s="[]" in subst)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2871
        apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2872
       (*apply(simp only:bsimp_AALTs.simps)*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2873
       (*apply(simp only:fuse.simps)*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2874
  sorry
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2875
*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2876
lemma singleton_list_map:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2877
  shows"map f [a] = [f a]"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2878
  apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2879
  done
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2880
lemma map_application2:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2881
  shows"map f [a,b] = [f a, f b]"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2882
  apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2883
  done
341
abf178a5db58 hope it works
Chengsong
parents: 340
diff changeset
  2884
(*SAD*)
340
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2885
(* bsimp (bder c (bsimp_AALTs x51 (flts [bsimp a1, bsimp a2]))) =
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2886
       bsimp (AALT x51 (bder c (bsimp a1)) (bder c (bsimp a2)))*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2887
(*This equality does not hold*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2888
lemma medium01:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2889
  assumes " (bder c a1 = AZERO) "
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2890
  shows "bsimp(bsimp_AALTs x51 (map (bder c) (flts [ a1, a2]))) =
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2891
         bsimp(bsimp_AALTs x51 (flts (map (bder c) [ a1, a2])))"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2892
  apply(subst manipulate_flts)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2893
  using assms
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2894
  apply -
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2895
  apply(subst medium011)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2896
   apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2897
  apply(case_tac "map (bder c) (flts [a1]) = []")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2898
   apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2899
  using medium01central apply blast
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2900
apply(frule medium010)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2901
  apply(erule disjE)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2902
  prefer 2
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2903
   apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2904
  apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2905
  apply(case_tac a2)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2906
       apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2907
      apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2908
     apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2909
    apply(simp only:flts.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2910
(*HOW do i say here to replace ASEQ ..... back into a2*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2911
(*how do i say here to use the definition of map function
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2912
without lemma, of course*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2913
(*how do i say here that AZERO#map (bder c) [ASEQ x41 x42 x43]'s list.len >1
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2914
without a lemma, of course*)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2915
    apply(subst singleton_list_map)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2916
    apply(simp only: bsimp_AALTs.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2917
    apply(case_tac "bder c (ASEQ x41 x42 x43)")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2918
         apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2919
        apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2920
       apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2921
      prefer 3
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2922
      apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2923
     apply(rule_tac t="bder c (ASEQ x41 x42 x43)" 
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2924
and s="ASEQ x41a x42a x43a" in subst)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2925
      apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2926
     apply(simp only: flts.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2927
     apply(simp only: bsimp_AALTs.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2928
     apply(simp only: fuse.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2929
     apply(subst (2) bsimp_idem[symmetric])
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2930
     apply(subst (1) bsimp_idem[symmetric])
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2931
     apply(simp only:bsimp.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2932
     apply(subst map_application2)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2933
     apply(simp only: bsimp.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2934
     apply(simp only:flts.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2935
(*want to happily change between a2 and ASEQ x41 42 43, and eliminate now 
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2936
redundant conditions such as  map (bder c) (flts [a1]) = [AZERO] *)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2937
     apply(case_tac "bsimp x42a")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2938
          apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2939
         apply(case_tac "bsimp x43a")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2940
              apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2941
             apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2942
            apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2943
           apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2944
          prefer 2
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2945
          apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2946
     apply(rule_tac t="bsimp x43a" 
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2947
and s="AALTs x51a x52" in subst)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2948
          apply simp
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2949
         apply(simp only:bsimp_ASEQ.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2950
         apply(simp only:fuse.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2951
         apply(simp only:flts.simps)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2952
         
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2953
  using medium01central mediumlittle by auto
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2954
 
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2955
  
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2956
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2957
lemma medium1:
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2958
  assumes " (bder c a1 \<noteq> AZERO) "
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2959
 "\<not>(\<exists> a01 a02 x02. (  (a1 = ASEQ x02 a01 a02) \<and> bnullable(a01) )      )"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2960
" (bder c a2 \<noteq> AZERO)"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2961
 "\<not>(\<exists> a11 a12 x12. (  (a2 = ASEQ x12 a11 a12) \<and> bnullable(a11) )      )"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2962
  shows "bsimp_AALTs x51 (map (bder c) (flts [ a1, a2])) =
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2963
         bsimp_AALTs x51 (flts (map (bder c) [ a1, a2]))"
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2964
  using assms
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2965
  apply -
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2966
  apply(subst manipulate_flts)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2967
  apply(case_tac "a1")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2968
       apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2969
      apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2970
     apply(case_tac "x32 = c")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2971
      prefer 2
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2972
  apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2973
     prefer 2
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2974
     apply(case_tac "bnullable x42")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2975
      apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2976
       apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2977
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2978
  apply(case_tac "a2")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2979
            apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2980
         apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2981
        apply(case_tac "x32 = c")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2982
         prefer 2 
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2983
  apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2984
        apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2985
       apply(case_tac "bnullable x42a")
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2986
        apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2987
       apply(subst go_inside_flts)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2988
  apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2989
        apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2990
       apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2991
      apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2992
      apply (simp add: WWW4)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2993
      apply(simp)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2994
      apply (simp add: WWW4)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2995
  apply (simp add: go_inside_flts)
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2996
  apply (metis (no_types, lifting) go_inside_flts k0 list.simps(8) list.simps(9))
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2997
  by (smt bder.simps(6) flts.simps(1) flts.simps(6) flts.simps(7) go_inside_flts k0 list.inject list.simps(9))
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  2998
  
332
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  2999
lemma big0:
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3000
  shows "bsimp (AALT x51 (AALTs bs1 as1) (AALTs bs2 as2)) =
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3001
         bsimp (AALTs x51 ((map (fuse bs1) as1) @ (map (fuse bs2) as2)))"
334
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  3002
  by (smt WWW3 bsimp.simps(2) k0 k00 list.simps(8) list.simps(9) map_append)
332
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  3003
335
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  3004
lemma bignA:
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  3005
  shows "bsimp (AALTs x51 (AALTs bs1 as1 # as2)) =
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  3006
         bsimp (AALTs x51 ((map (fuse bs1) as1) @ as2))"
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  3007
  apply(simp)
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  3008
  apply(subst k0)
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  3009
  apply(subst WWW3)
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  3010
  apply(simp add: flts_append)
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  3011
  done
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3012
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3013
lemma XXX2a_long_without_good:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3014
  shows "bsimp (bder c (bsimp a)) = bsimp (bder c a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3015
  apply(induct a arbitrary: c taking: "\<lambda>a. asize a" rule: measure_induct)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3016
  apply(case_tac x)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3017
       apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3018
      apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3019
     apply(simp)
340
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  3020
    prefer 3
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3021
    apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3022
  (* AALT case *)
335
f5ab2f02d148 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 334
diff changeset
  3023
   prefer 2
336
44914e2724b7 snapshot
Christian Urban <urbanc@in.tum.de>
parents: 335
diff changeset
  3024
   apply(simp only:)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3025
   apply(case_tac "\<exists>a1 a2. x52 = [a1, a2]")
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3026
    apply(clarify)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3027
  apply(simp del: bsimp.simps)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3028
  apply(subst (2) CT1) 
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3029
    apply(simp del: bsimp.simps)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3030
  apply(rule_tac t="bsimp (bder c a1)" and  s="bsimp (bder c (bsimp a1))" in subst)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3031
  apply(simp del: bsimp.simps)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3032
  apply(rule_tac t="bsimp (bder c a2)" and  s="bsimp (bder c (bsimp a2))" in subst)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3033
     apply(simp del: bsimp.simps)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3034
    apply(subst  CT1a[symmetric])
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3035
    apply(subst bsimp.simps)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3036
    apply(simp del: bsimp.simps)
340
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  3037
(*bsimp_AALTs x51 (map (bder c) (flts [a1, a2])) =
6c71db65bdec bad news
Chengsong
parents: 336
diff changeset
  3038
    bsimp_AALTs x51 (flts (map (bder c) [a1, a2]))*)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3039
  apply(case_tac "\<exists>bs1 as1. bsimp a1 = AALTs bs1 as1")
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3040
  apply(case_tac "\<exists>bs2 as2. bsimp a2 = AALTs bs2 as2")
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3041
      apply(clarify)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3042
  apply(simp only:)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3043
      apply(simp del: bsimp.simps bder.simps)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3044
      apply(subst bsimp_AALTs_qq)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3045
       prefer 2
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3046
       apply(simp del: bsimp.simps)
332
76397aa190dc snapshot
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
  3047
       apply(subst big0)
334
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  3048
       apply(simp add: WWW4)
cc26b029a866 a simple proof of big0
Christian Urban <urbanc@in.tum.de>
parents: 333
diff changeset
  3049
  apply (metis One_nat_def Suc_eq_plus1 Suc_lessI arexp.distinct(7) bsimp.simps(2) bsimp_AALTs.simps(1) bsimp_idem flts.simps(1) length_append length_greater_0_conv length_map not_add_less2 not_less_eq)
331
c470f792022b checkpoint
Christian Urban <urbanc@in.tum.de>
parents: 330
diff changeset
  3050
  oops
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3051
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3052
lemma XXX2a_long_without_good:
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3053
  shows "bsimp (bder c (bsimp a)) = bsimp (bder c a)"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3054
  apply(induct a arbitrary: c taking: "\<lambda>a. asize a" rule: measure_induct)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3055
  apply(case_tac x)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3056
       apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3057
      apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3058
     apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3059
  prefer 3
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3060
    apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3061
  (* AALT case *)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3062
   prefer 2
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3063
   apply(subgoal_tac "nonnested (bsimp x)")
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3064
    prefer 2
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3065
  using nn1b apply blast
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3066
   apply(simp only:)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3067
  apply(drule_tac x="AALTs x51 (flts x52)" in spec)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3068
   apply(drule mp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3069
    defer
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3070
    apply(drule_tac x="c" in spec)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3071
    apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3072
    apply(rotate_tac 2)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3073
  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3074
    apply(drule sym)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3075
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3076
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3077
   apply(simp only: bder.simps)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3078
   apply(simp only: bsimp.simps)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3079
   apply(subst bder_bsimp_AALTs)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3080
   apply(case_tac x52)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3081
    apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3082
   apply(simp)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3083
  apply(case_tac list)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3084
    apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3085
    apply(case_tac a)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3086
         apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3087
        apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3088
       apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3089
      defer
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3090
      apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3091
  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3092
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3093
   (* case AALTs list is not empty *)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3094
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3095
   apply(subst k0)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3096
   apply(subst (2) k0)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3097
   apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3098
   apply(case_tac "bsimp a = AZERO")
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3099
    apply(subgoal_tac "bsimp (bder c a) = AZERO")
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3100
     prefer 2
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3101
  using less_iff_Suc_add apply auto[1]
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3102
    apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3103
  apply(drule_tac x="AALTs x51 list" in  spec)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3104
   apply(drule mp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3105
    apply(simp add: asize0)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3106
   apply(drule_tac x="c" in spec)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3107
    apply(simp add: bder_bsimp_AALTs)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3108
   apply(case_tac  "nonalt (bsimp a)")
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3109
    prefer 2
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3110
  apply(drule_tac x="bsimp (AALTs x51 (a#list))" in  spec)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3111
    apply(drule mp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3112
     apply(rule order_class.order.strict_trans2)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3113
      apply(rule bsimp_AALTs_size3)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3114
      apply(auto)[1]
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3115
     apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3116
    apply(subst (asm) bsimp_idem)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3117
  apply(drule_tac x="c" in spec)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3118
  apply(simp)  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3119
  find_theorems "_ < _ \<Longrightarrow> _ \<le> _ \<Longrightarrow>_ < _"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3120
  apply(rule le_trans)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3121
  apply(subgoal_tac "flts [bsimp a] = [bsimp a]")
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3122
     prefer 2
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3123
  using k0b apply blast
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3124
    apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3125
  find_theorems "asize _ < asize _"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3126
  
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3127
  using bder_bsimp_AALTs
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3128
   apply(case_tac list)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3129
    apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3130
   sledgeha mmer [timeout=6000]  
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3131
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3132
   apply(case_tac "\<exists>r \<in> set (map bsimp x52). \<not>nonalt r")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3133
    apply(drule_tac x="bsimp (AALTs x51 x52)" in spec)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3134
    apply(drule mp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3135
  using bsimp_AALTs_size3 apply blast
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3136
    apply(drule_tac x="c" in spec)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3137
  apply(subst (asm) (2) test)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3138
  
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3139
   apply(case_tac x52)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3140
    apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3141
   apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3142
  apply(case_tac "bsimp a = AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3143
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3144
     apply(subgoal_tac "bsimp (bder c a) = AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3145
      prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3146
     apply auto[1]
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3147
  apply (metis L.simps(1) L_bsimp_erase der.simps(1) der_correctness erase.simps(1) erase_bder xxx_bder2)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3148
    apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3149
    apply(drule_tac x="AALTs x51 list" in spec)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3150
    apply(drule mp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3151
     apply(simp add: asize0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3152
  apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3153
   apply(case_tac list)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3154
    prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3155
    apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3156
  apply(case_tac "bsimp aa = AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3157
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3158
     apply(subgoal_tac "bsimp (bder c aa) = AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3159
      prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3160
      apply auto[1]
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3161
      apply (metis add.left_commute bder.simps(1) bsimp.simps(3) less_add_Suc1)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3162
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3163
  apply(drule_tac x="AALTs x51 (a#lista)" in spec)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3164
    apply(drule mp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3165
     apply(simp  add: asize0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3166
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3167
     apply (metis flts.simps(2) k0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3168
    apply(subst k0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3169
  apply(subst (2) k0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3170
  
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3171
  
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3172
  using less_add_Suc1 apply fastforce
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3173
    apply(subst k0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3174
  
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3175
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3176
    apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3177
    apply(case_tac "bsimp a = AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3178
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3179
     apply(subgoal_tac "bsimp (bder c a) = AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3180
      prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3181
  apply auto[1]
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3182
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3183
  apply(case_tac "nonalt (bsimp a)")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3184
     apply(subst bsimp_AALTs1)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3185
      apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3186
  using less_add_Suc1 apply fastforce
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3187
  
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3188
     apply(subst bsimp_AALTs1)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3189
  
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3190
  using nn11a apply b last
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3191
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3192
  (* SEQ case *)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3193
   apply(clarify)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3194
  apply(subst  bsimp.simps)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3195
   apply(simp del: bsimp.simps)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3196
   apply(auto simp del: bsimp.simps)[1]
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3197
    apply(subgoal_tac "bsimp x42 \<noteq> AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3198
  prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3199
  using b3 apply force
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3200
  apply(case_tac "bsimp x43 = AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3201
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3202
     apply (simp add: bsimp_ASEQ0)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3203
  apply (metis bder.simps(1) bsimp.simps(3) bsimp_AALTs.simps(1) bsimp_fuse flts.simps(1) flts.simps(2) fuse.simps(1) less_add_Suc2)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3204
    apply(case_tac "\<exists>bs. bsimp x42 = AONE bs")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3205
     apply(clarify)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3206
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3207
     apply(subst bsimp_ASEQ2)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3208
     apply(subgoal_tac "bsimp (bder c x42) = AZERO")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3209
      prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3210
  using less_add_Suc1 apply fastforce
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3211
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3212
     apply(frule_tac x="x43" in spec)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3213
  apply(drule mp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3214
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3215
  apply(drule_tac x="c" in spec)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3216
     apply(subst bder_fuse)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3217
  apply(subst bsimp_fuse[symmetric])
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3218
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3219
  apply(subgoal_tac "bmkeps x42 = bs")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3220
      prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3221
      apply (simp add: bmkeps_simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3222
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3223
     apply(subst bsimp_fuse[symmetric])
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3224
  apply(case_tac "nonalt (bsimp (bder c x43))")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3225
      apply(subst bsimp_AALTs1)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3226
  using nn11a apply blast
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3227
  using fuse_append apply blast
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3228
     apply(subgoal_tac "\<exists>bs rs. bsimp (bder c x43) = AALTs bs rs")
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3229
      prefer 2
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3230
  using bbbbs1 apply blast
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3231
  apply(clarify)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3232
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3233
     apply(case_tac rs)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3234
      apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3235
      apply (metis arexp.distinct(7) good.simps(4) good1)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3236
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3237
     apply(case_tac list)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3238
      apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3239
      apply (metis arexp.distinct(7) good.simps(5) good1)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3240
  apply(simp del: bsimp_AALTs.simps)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3241
  apply(simp only: bsimp_AALTs.simps)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3242
     apply(simp)
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3243
  
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3244
  
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3245
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3246
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3247
(* HERE *)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3248
apply(case_tac "x42 = AZERO")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3249
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3250
   apply(case_tac "bsimp x43 = AZERO")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3251
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3252
     apply (simp add: bsimp_ASEQ0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3253
     apply(subgoal_tac "bsimp (fuse (bmkeps x42) (bder c x43)) = AZERO")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3254
      apply(simp)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3255
  apply (met is bder.simps(1) bsimp.simps(3) bsimp_fuse fuse.simps(1) less_add_Suc2)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3256
  apply(case_tac "\<exists>bs. bsimp x42 = AONE bs")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3257
     apply(clarify)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3258
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3259
     apply(subst bsimp_ASEQ2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3260
     apply(subgoal_tac "bsimp (bder c x42) = AZERO")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3261
      apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3262
  prefer 2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3263
  using less_add_Suc1 apply fastforce
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3264
     apply(subgoal_tac "bmkeps x42 = bs")
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3265
      prefer 2
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3266
      apply (simp add: bmkeps_simp)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3267
     apply(simp)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3268
     apply(case_tac "nonalt (bsimp (bder c x43))")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3269
  apply (metis bder_fuse bsimp_AALTs.simps(1) bsimp_AALTs.simps(2) bsimp_fuse flts.simps(1) flts.simps(2) fuse.simps(1) fuse_append k0b less_add_Suc2 nn11a)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3270
     apply(subgoal_tac "nonnested (bsimp (bder c x43))")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3271
      prefer 2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3272
  using nn1b apply blast
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3273
     apply(case_tac x43)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3274
          apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3275
         apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3276
        apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3277
       prefer 3
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3278
       apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3279
       apply (metis arexp.distinct(25) arexp.distinct(7) arexp.distinct(9) bsimp_ASEQ.simps(1) bsimp_ASEQ.simps(11) bsimp_ASEQ1 nn11a nonalt.elims(3) nonalt.simps(6)) 
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3280
      apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3281
      apply(auto)[1]
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3282
       apply(case_tac "(bsimp (bder c x42a)) = AZERO")
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3283
        apply(simp)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3284
  
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3285
       apply(simp)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3286
  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3287
  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3288
  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3289
     apply(subgoal_tac "(\<exists>bs1 rs1. 1 < length rs1 \<and> bsimp (bder c x43) =  AALTs bs1 rs1 ) \<or>
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3290
                        (\<exists>bs1 r. bsimp (bder c x43) =  fuse bs1 r)")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3291
      prefer 2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3292
  apply (metis fuse_empty)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3293
     apply(erule disjE)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3294
  prefer 2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3295
     apply(clarify)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3296
     apply(simp only:)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3297
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3298
     apply(simp add: fuse_append)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3299
     apply(subst bder_fuse)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3300
     apply(subst bsimp_fuse[symmetric])
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3301
     apply(subst bder_fuse)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3302
     apply(subst bsimp_fuse[symmetric])
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3303
     apply(subgoal_tac "bsimp (bder c (bsimp x43)) = bsimp (bder c x43)")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3304
      prefer 2
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3305
  using less_add_Suc2 apply bl ast
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3306
     apply(simp only: )
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3307
     apply(subst bsimp_fuse[symmetric])
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3308
      apply(simp only: )
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3309
  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3310
     apply(simp only: fuse.simps)
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3311
  apply(simp)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3312
      apply(case_tac rs1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3313
      apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3314
      apply (me tis arexp.distinct(7) fuse.simps(1) good.simps(4) good1 good_fuse)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3315
  apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3316
  apply(case_tac list)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3317
      apply(simp)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3318
      apply (me tis arexp.distinct(7) fuse.simps(1) good.simps(5) good1 good_fuse)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3319
     apply(simp only: bsimp_AALTs.simps map_cons.simps)
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3320
     apply(auto)[1]
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3321
  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3322
  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3323
      
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3324
      apply(subst bsimp_fuse[symmetric])
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3325
  apply(subgoal_tac "bmkeps x42 = bs")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3326
      prefer 2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3327
      apply (simp add: bmkeps_simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3328
  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3329
  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3330
        apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3331
  
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3332
  using b3 apply force
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3333
  using bsimp_ASEQ0 test2 apply fo rce
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3334
  thm good_SEQ test2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3335
     apply (simp add: good_SEQ test2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3336
    apply (simp add: good_SEQ test2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3337
  apply(case_tac "x42 = AZERO")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3338
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3339
   apply(case_tac "x43 = AZERO")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3340
    apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3341
  apply (simp add: bsimp_ASEQ0)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3342
  apply(case_tac "\<exists>bs. x42 = AONE bs")
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3343
     apply(clarify)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3344
     apply(simp)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3345
    apply(subst bsimp_ASEQ1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3346
      apply(simp)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3347
  using bsimp_ASEQ0 test2 apply fo rce
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3348
     apply (simp add: good_SEQ test2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3349
    apply (simp add: good_SEQ test2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3350
  apply (simp add: good_SEQ test2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3351
  (* AALTs case *)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3352
  apply(simp)
325
2a128087215f updated
Christian Urban <urbanc@in.tum.de>
parents: 324
diff changeset
  3353
  using test2 by fa st force
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3354
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3355
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3356
lemma XXX4ab:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3357
  shows "good (bders_simp (bsimp r) s)  \<or> bders_simp (bsimp r) s = AZERO"
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3358
  apply(induct s arbitrary: r rule:  rev_induct)
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3359
   apply(simp)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3360
  apply (simp add: good1)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3361
  apply(simp add: bders_simp_append)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3362
  apply (simp add: good1)
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3363
  done
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3364
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3365
lemma XXX4:
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3366
  assumes "good a"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3367
  shows "bders_simp a s = bsimp (bders a s)"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3368
  using  assms
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3369
  apply(induct s arbitrary: a rule: rev_induct)
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3370
   apply(simp)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3371
   apply (simp add: test2)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3372
  apply(simp add: bders_append bders_simp_append)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3373
  oops
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3374
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3375
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3376
lemma MAINMAIN:
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3377
  "blexer r s = blexer_simp r s"
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3378
  apply(induct s arbitrary: r)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3379
  apply(simp add: blexer_def blexer_simp_def)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3380
  apply(simp add: blexer_def blexer_simp_def del: bders.simps bders_simp.simps)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3381
  apply(auto simp del: bders.simps bders_simp.simps)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3382
    prefer 2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3383
  apply (metis b4 bders.simps(2) bders_simp.simps(2))
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3384
   prefer 2
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3385
  apply (metis b4 bders.simps(2))
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3386
  apply(subst bmkeps_simp)
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3387
   apply(simp)
324
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3388
  apply(case_tac s)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3389
   apply(simp only: bders.simps)
d9d4146325d9 added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents: 323
diff changeset
  3390
   apply(subst bders_simp.simps)
318
43e070803c1c updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
  3391
  apply(simp)
330
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3392
  oops   
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3393
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3394
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3395
lemma
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3396
  fixes n :: nat
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3397
  shows "(\<Sum>i \<in> {0..n}. i) = n * (n + 1) div 2"
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3398
  apply(induct n)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3399
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3400
  apply(simp)
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3401
  done
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3402
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3403
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3404
89e6605c4ca4 updated
Christian Urban <urbanc@in.tum.de>
parents: 325
diff changeset
  3405
295
c6ec5f369037 updated
Christian Urban <urbanc@in.tum.de>
parents: 293
diff changeset
  3406
148
702ed601349b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3407
end