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