thys2/BasicIdentities.thy
author Chengsong
Wed, 13 Apr 2022 09:18:29 +0100
changeset 486 f5b96a532c85
parent 481 feacb89b784c
child 488 370dae790b30
permissions -rw-r--r--
starclosed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
     1
theory BasicIdentities imports 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
     2
"Lexer"  "PDerivs"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
     3
begin
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
     4
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
     5
datatype rrexp = 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
     6
  RZERO
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
     7
| RONE 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
     8
| RCHAR char
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
     9
| RSEQ rrexp rrexp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    10
| RALTS "rrexp list"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    11
| RSTAR rrexp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    12
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    13
abbreviation
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    14
  "RALT r1 r2 \<equiv> RALTS [r1, r2]"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    15
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    16
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    17
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    18
fun
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    19
 rnullable :: "rrexp \<Rightarrow> bool"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    20
where
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    21
  "rnullable (RZERO) = False"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    22
| "rnullable (RONE  ) = True"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    23
| "rnullable (RCHAR   c) = False"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    24
| "rnullable (RALTS   rs) = (\<exists>r \<in> set rs. rnullable r)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    25
| "rnullable (RSEQ  r1 r2) = (rnullable r1 \<and> rnullable r2)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    26
| "rnullable (RSTAR   r) = True"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    27
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    28
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    29
fun
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    30
 rder :: "char \<Rightarrow> rrexp \<Rightarrow> rrexp"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    31
where
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    32
  "rder c (RZERO) = RZERO"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    33
| "rder c (RONE) = RZERO"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    34
| "rder c (RCHAR d) = (if c = d then RONE else RZERO)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    35
| "rder c (RALTS rs) = RALTS (map (rder c) rs)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    36
| "rder c (RSEQ r1 r2) = 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    37
     (if rnullable r1
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    38
      then RALT   (RSEQ (rder c r1) r2) (rder c r2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    39
      else RSEQ   (rder c r1) r2)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    40
| "rder c (RSTAR r) = RSEQ  (rder c r) (RSTAR r)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    41
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    42
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    43
fun 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    44
  rders :: "rrexp \<Rightarrow> string \<Rightarrow> rrexp"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    45
where
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    46
  "rders r [] = r"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    47
| "rders r (c#s) = rders (rder c r) s"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    48
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    49
fun rdistinct :: "'a list \<Rightarrow>'a set \<Rightarrow> 'a list"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    50
  where
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    51
  "rdistinct [] acc = []"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    52
| "rdistinct (x#xs)  acc = 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    53
     (if x \<in> acc then rdistinct xs  acc 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    54
      else x # (rdistinct xs  ({x} \<union> acc)))"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    55
478
Chengsong
parents: 476
diff changeset
    56
lemma rdistinct_does_the_job:
Chengsong
parents: 476
diff changeset
    57
  shows "distinct (rdistinct rs s)"
Chengsong
parents: 476
diff changeset
    58
  apply(induct rs arbitrary: s)
Chengsong
parents: 476
diff changeset
    59
   apply simp
Chengsong
parents: 476
diff changeset
    60
  apply simp
Chengsong
parents: 476
diff changeset
    61
  sorry
Chengsong
parents: 476
diff changeset
    62
Chengsong
parents: 476
diff changeset
    63
475
10fd25fba2ba identities
Chengsong
parents: 467
diff changeset
    64
lemma rdistinct_concat:
10fd25fba2ba identities
Chengsong
parents: 467
diff changeset
    65
  shows "set rs \<subseteq> rset \<Longrightarrow> rdistinct (rs @ rsa) rset = rdistinct rsa rset"
10fd25fba2ba identities
Chengsong
parents: 467
diff changeset
    66
  apply(induct rs)
10fd25fba2ba identities
Chengsong
parents: 467
diff changeset
    67
   apply simp+
10fd25fba2ba identities
Chengsong
parents: 467
diff changeset
    68
  done
10fd25fba2ba identities
Chengsong
parents: 467
diff changeset
    69
10fd25fba2ba identities
Chengsong
parents: 467
diff changeset
    70
lemma rdistinct_concat2:
10fd25fba2ba identities
Chengsong
parents: 467
diff changeset
    71
  shows "\<forall>r \<in> set rs. r \<in> rset \<Longrightarrow> rdistinct (rs @ rsa) rset = rdistinct rsa rset"
10fd25fba2ba identities
Chengsong
parents: 467
diff changeset
    72
  by (simp add: rdistinct_concat subsetI)
10fd25fba2ba identities
Chengsong
parents: 467
diff changeset
    73
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    74
467
Chengsong
parents: 465
diff changeset
    75
lemma distinct_not_exist:
Chengsong
parents: 465
diff changeset
    76
  shows "a \<notin> set rs \<Longrightarrow> rdistinct rs rset = rdistinct rs (insert a rset)"
Chengsong
parents: 465
diff changeset
    77
  apply(induct rs arbitrary: rset)
Chengsong
parents: 465
diff changeset
    78
   apply simp
Chengsong
parents: 465
diff changeset
    79
  apply(case_tac "aa \<in> rset")
Chengsong
parents: 465
diff changeset
    80
   apply simp
Chengsong
parents: 465
diff changeset
    81
  apply(subgoal_tac "a \<noteq> aa")
Chengsong
parents: 465
diff changeset
    82
   prefer 2
Chengsong
parents: 465
diff changeset
    83
  apply simp
Chengsong
parents: 465
diff changeset
    84
  apply simp
Chengsong
parents: 465
diff changeset
    85
  done
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
    86
478
Chengsong
parents: 476
diff changeset
    87
lemma rdistinct_on_distinct:
Chengsong
parents: 476
diff changeset
    88
  shows "distinct rs \<Longrightarrow> rdistinct rs {} = rs"
Chengsong
parents: 476
diff changeset
    89
  apply(induct rs)
Chengsong
parents: 476
diff changeset
    90
   apply simp
Chengsong
parents: 476
diff changeset
    91
  apply(subgoal_tac "rdistinct rs {} = rs")
Chengsong
parents: 476
diff changeset
    92
   prefer 2
Chengsong
parents: 476
diff changeset
    93
  apply simp
Chengsong
parents: 476
diff changeset
    94
  using distinct_not_exist by fastforce
Chengsong
parents: 476
diff changeset
    95
481
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
    96
478
Chengsong
parents: 476
diff changeset
    97
lemma distinct_rdistinct_append:
481
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
    98
  assumes "distinct rs1" "\<forall>r \<in> set rs1. r \<notin> acc"
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
    99
  shows "rdistinct (rs1 @ rsa) acc = rs1 @ (rdistinct rsa (acc \<union> set rs1))"
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
   100
  using assms
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
   101
  apply(induct rs1 arbitrary: rsa acc)
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
   102
   apply(auto)[1]
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
   103
  apply(auto)[1]
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
   104
  apply(drule_tac x="rsa" in meta_spec)
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
   105
  apply(drule_tac x="{a} \<union> acc" in meta_spec)
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
   106
  apply(simp)
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
   107
  apply(drule meta_mp)
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
   108
   apply(auto)[1]
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
   109
  apply(simp)
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
   110
  done
feacb89b784c christian's
Chengsong
parents: 480
diff changeset
   111
  
478
Chengsong
parents: 476
diff changeset
   112
Chengsong
parents: 476
diff changeset
   113
lemma rdistinct_concat_general:
Chengsong
parents: 476
diff changeset
   114
  shows "rdistinct (rs1 @ rs2) {} = (rdistinct rs1 {}) @ (rdistinct rs2 (set rs1))"
Chengsong
parents: 476
diff changeset
   115
  sorry
Chengsong
parents: 476
diff changeset
   116
Chengsong
parents: 476
diff changeset
   117
lemma rdistinct_set_equality:
Chengsong
parents: 476
diff changeset
   118
  shows "set (rdistinct rs {}) = set rs"
Chengsong
parents: 476
diff changeset
   119
  sorry
Chengsong
parents: 476
diff changeset
   120
Chengsong
parents: 476
diff changeset
   121
lemma distinct_once_enough:
Chengsong
parents: 476
diff changeset
   122
  shows "rdistinct (rs @ rsa) {} = rdistinct (rdistinct rs {} @ rsa) {}"
Chengsong
parents: 476
diff changeset
   123
  apply(subgoal_tac "distinct (rdistinct rs {})")
Chengsong
parents: 476
diff changeset
   124
   apply(subgoal_tac 
Chengsong
parents: 476
diff changeset
   125
" rdistinct (rdistinct rs {} @ rsa) {} = rdistinct rs {} @ (rdistinct rsa (set rs))")
Chengsong
parents: 476
diff changeset
   126
  apply(simp only:)
Chengsong
parents: 476
diff changeset
   127
  using rdistinct_concat_general apply blast
Chengsong
parents: 476
diff changeset
   128
  apply (simp add: distinct_rdistinct_append rdistinct_set_equality)
Chengsong
parents: 476
diff changeset
   129
  by (simp add: rdistinct_does_the_job)
Chengsong
parents: 476
diff changeset
   130
  
Chengsong
parents: 476
diff changeset
   131
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   132
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   133
fun rflts :: "rrexp list \<Rightarrow> rrexp list"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   134
  where 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   135
  "rflts [] = []"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   136
| "rflts (RZERO # rs) = rflts rs"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   137
| "rflts ((RALTS rs1) # rs) = rs1 @ rflts rs"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   138
| "rflts (r1 # rs) = r1 # rflts rs"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   139
478
Chengsong
parents: 476
diff changeset
   140
lemma rflts_def_idiot:
Chengsong
parents: 476
diff changeset
   141
  shows "\<lbrakk> a \<noteq> RZERO; \<nexists>rs1. a = RALTS rs1\<rbrakk>
Chengsong
parents: 476
diff changeset
   142
       \<Longrightarrow> rflts (a # rs) = a # rflts rs"
Chengsong
parents: 476
diff changeset
   143
  apply(case_tac a)
Chengsong
parents: 476
diff changeset
   144
       apply simp_all
Chengsong
parents: 476
diff changeset
   145
  done
Chengsong
parents: 476
diff changeset
   146
Chengsong
parents: 476
diff changeset
   147
lemma rflts_def_idiot2:
Chengsong
parents: 476
diff changeset
   148
  shows "\<lbrakk>a \<noteq> RZERO; \<nexists>rs1. a = RALTS rs1; a \<in> set rs\<rbrakk> \<Longrightarrow> a \<in> set (rflts rs)"
Chengsong
parents: 476
diff changeset
   149
  apply(induct rs)
Chengsong
parents: 476
diff changeset
   150
   apply simp
Chengsong
parents: 476
diff changeset
   151
  by (metis append.assoc in_set_conv_decomp insert_iff list.simps(15) rflts.simps(2) rflts.simps(3) rflts_def_idiot)
Chengsong
parents: 476
diff changeset
   152
Chengsong
parents: 476
diff changeset
   153
Chengsong
parents: 476
diff changeset
   154
Chengsong
parents: 476
diff changeset
   155
lemma flts_append:
Chengsong
parents: 476
diff changeset
   156
  shows "rflts (rs1 @ rs2) = rflts rs1 @ rflts rs2"
Chengsong
parents: 476
diff changeset
   157
  apply(induct rs1)
Chengsong
parents: 476
diff changeset
   158
   apply simp
Chengsong
parents: 476
diff changeset
   159
  apply(case_tac a)
Chengsong
parents: 476
diff changeset
   160
       apply simp+
Chengsong
parents: 476
diff changeset
   161
  done
Chengsong
parents: 476
diff changeset
   162
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   163
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   164
fun rsimp_ALTs :: " rrexp list \<Rightarrow> rrexp"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   165
  where
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   166
  "rsimp_ALTs  [] = RZERO"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   167
| "rsimp_ALTs [r] =  r"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   168
| "rsimp_ALTs rs = RALTS rs"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   169
465
Chengsong
parents: 444
diff changeset
   170
lemma rsimpalts_gte2elems:
Chengsong
parents: 444
diff changeset
   171
  shows "size rlist \<ge> 2 \<Longrightarrow> rsimp_ALTs rlist = RALTS rlist"
Chengsong
parents: 444
diff changeset
   172
  apply(induct rlist)
Chengsong
parents: 444
diff changeset
   173
   apply simp
Chengsong
parents: 444
diff changeset
   174
  apply(induct rlist)
Chengsong
parents: 444
diff changeset
   175
   apply simp
Chengsong
parents: 444
diff changeset
   176
  apply (metis Suc_le_length_iff rsimp_ALTs.simps(3))
Chengsong
parents: 444
diff changeset
   177
  by blast
Chengsong
parents: 444
diff changeset
   178
Chengsong
parents: 444
diff changeset
   179
lemma rsimpalts_conscons:
Chengsong
parents: 444
diff changeset
   180
  shows "rsimp_ALTs (r1 # rsa @ r2 # rsb) = RALTS (r1 # rsa @ r2 # rsb)"
Chengsong
parents: 444
diff changeset
   181
  by (metis Nil_is_append_conv list.exhaust rsimp_ALTs.simps(3))
Chengsong
parents: 444
diff changeset
   182
476
Chengsong
parents: 475
diff changeset
   183
lemma rsimp_alts_equal:
Chengsong
parents: 475
diff changeset
   184
  shows "rsimp_ALTs (rsa @ a # rsb @ a # rsc) = RALTS (rsa @ a # rsb @ a # rsc) "
Chengsong
parents: 475
diff changeset
   185
  by (metis append_Cons append_Nil neq_Nil_conv rsimpalts_conscons)
Chengsong
parents: 475
diff changeset
   186
465
Chengsong
parents: 444
diff changeset
   187
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   188
fun rsimp_SEQ :: " rrexp \<Rightarrow> rrexp \<Rightarrow> rrexp"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   189
  where
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   190
  "rsimp_SEQ  RZERO _ = RZERO"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   191
| "rsimp_SEQ  _ RZERO = RZERO"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   192
| "rsimp_SEQ RONE r2 = r2"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   193
| "rsimp_SEQ r1 r2 = RSEQ r1 r2"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   194
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   195
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   196
fun rsimp :: "rrexp \<Rightarrow> rrexp" 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   197
  where
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   198
  "rsimp (RSEQ r1 r2) = rsimp_SEQ  (rsimp r1) (rsimp r2)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   199
| "rsimp (RALTS rs) = rsimp_ALTs  (rdistinct (rflts (map rsimp rs))  {}) "
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   200
| "rsimp r = r"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   201
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   202
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   203
fun 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   204
  rders_simp :: "rrexp \<Rightarrow> string \<Rightarrow> rrexp"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   205
where
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   206
  "rders_simp r [] = r"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   207
| "rders_simp r (c#s) = rders_simp (rsimp (rder c r)) s"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   208
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   209
fun rsize :: "rrexp \<Rightarrow> nat" where
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   210
  "rsize RZERO = 1"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   211
| "rsize (RONE) = 1" 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   212
| "rsize (RCHAR  c) = 1"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   213
| "rsize (RALTS  rs) = Suc (sum_list (map rsize rs))"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   214
| "rsize (RSEQ  r1 r2) = Suc (rsize r1 + rsize r2)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   215
| "rsize (RSTAR  r) = Suc (rsize r)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   216
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   217
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   218
lemma rder_rsimp_ALTs_commute:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   219
  shows "  (rder x (rsimp_ALTs rs)) = rsimp_ALTs (map (rder x) rs)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   220
  apply(induct rs)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   221
   apply simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   222
  apply(case_tac rs)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   223
   apply simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   224
  apply auto
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   225
  done
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   226
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   227
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   228
lemma rsimp_aalts_smaller:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   229
  shows "rsize (rsimp_ALTs  rs) \<le> rsize (RALTS rs)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   230
  apply(induct rs)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   231
   apply simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   232
  apply simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   233
  apply(case_tac "rs = []")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   234
   apply simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   235
  apply(subgoal_tac "\<exists>rsp ap. rs = ap # rsp")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   236
   apply(erule exE)+
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   237
   apply simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   238
  apply simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   239
  by(meson neq_Nil_conv)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   240
  
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   241
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   242
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   243
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   244
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   245
lemma rSEQ_mono:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   246
  shows "rsize (rsimp_SEQ r1 r2) \<le>rsize ( RSEQ r1 r2)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   247
  apply auto
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   248
  apply(induct r1)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   249
       apply auto
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   250
      apply(case_tac "r2")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   251
       apply simp_all
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   252
     apply(case_tac r2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   253
          apply simp_all
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   254
     apply(case_tac r2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   255
         apply simp_all
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   256
     apply(case_tac r2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   257
        apply simp_all
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   258
     apply(case_tac r2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   259
  apply simp_all
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   260
  done
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   261
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   262
lemma ralts_cap_mono:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   263
  shows "rsize (RALTS rs) \<le> Suc ( sum_list (map rsize rs)) "
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   264
  by simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   265
478
Chengsong
parents: 476
diff changeset
   266
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   267
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   268
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   269
lemma rflts_mono:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   270
  shows "sum_list (map rsize (rflts rs))\<le> sum_list (map rsize rs)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   271
  apply(induct rs)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   272
  apply simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   273
  apply(case_tac "a = RZERO")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   274
   apply simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   275
  apply(case_tac "\<exists>rs1. a = RALTS rs1")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   276
  apply(erule exE)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   277
   apply simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   278
  apply(subgoal_tac "rflts (a # rs) = a # (rflts rs)")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   279
  prefer 2
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   280
  using rflts_def_idiot apply blast
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   281
  apply simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   282
  done
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   283
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   284
lemma rdistinct_smaller: shows "sum_list (map rsize (rdistinct rs ss)) \<le>
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   285
sum_list (map rsize rs )"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   286
  apply (induct rs arbitrary: ss)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   287
   apply simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   288
  by (simp add: trans_le_add2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   289
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   290
lemma rdistinct_phi_smaller: "sum_list (map rsize (rdistinct rs {})) \<le> sum_list (map rsize rs)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   291
  by (simp add: rdistinct_smaller)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   292
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   293
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   294
lemma rsimp_alts_mono :
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   295
  shows "\<And>x. (\<And>xa. xa \<in> set x \<Longrightarrow> rsize (rsimp xa) \<le> rsize xa)  \<Longrightarrow>
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   296
rsize (rsimp_ALTs (rdistinct (rflts (map rsimp x)) {})) \<le> Suc (sum_list (map rsize x))"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   297
  apply(subgoal_tac "rsize (rsimp_ALTs (rdistinct (rflts (map rsimp x)) {} )) 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   298
                    \<le> rsize (RALTS (rdistinct (rflts (map rsimp x)) {} ))")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   299
  prefer 2
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   300
  using rsimp_aalts_smaller apply auto[1]
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   301
  apply(subgoal_tac "rsize (RALTS (rdistinct (rflts (map rsimp x)) {})) \<le>Suc( sum_list (map rsize (rdistinct (rflts (map rsimp x)) {})))")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   302
  prefer 2
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   303
  using ralts_cap_mono apply blast
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   304
  apply(subgoal_tac "sum_list (map rsize (rdistinct (rflts (map rsimp x)) {})) \<le>
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   305
                     sum_list (map rsize ( (rflts (map rsimp x))))")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   306
  prefer 2
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   307
  using rdistinct_smaller apply presburger
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   308
  apply(subgoal_tac "sum_list (map rsize (rflts (map rsimp x))) \<le> 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   309
                     sum_list (map rsize (map rsimp x))")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   310
  prefer 2
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   311
  using rflts_mono apply blast
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   312
  apply(subgoal_tac "sum_list (map rsize (map rsimp x)) \<le> sum_list (map rsize x)")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   313
  prefer 2
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   314
  
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   315
  apply (simp add: sum_list_mono)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   316
  by linarith
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   317
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   318
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   319
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   320
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   321
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   322
lemma rsimp_mono:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   323
  shows "rsize (rsimp r) \<le> rsize r"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   324
  apply(induct r)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   325
  apply simp_all
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   326
  apply(subgoal_tac "rsize (rsimp_SEQ (rsimp r1) (rsimp r2)) \<le> rsize (RSEQ (rsimp r1) (rsimp r2))")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   327
    apply force
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   328
  using rSEQ_mono
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   329
   apply presburger
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   330
  using rsimp_alts_mono by auto
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   331
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   332
lemma idiot:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   333
  shows "rsimp_SEQ RONE r = r"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   334
  apply(case_tac r)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   335
       apply simp_all
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   336
  done
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   337
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   338
lemma no_alt_short_list_after_simp:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   339
  shows "RALTS rs = rsimp r \<Longrightarrow> rsimp_ALTs rs = RALTS rs"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   340
  sorry
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   341
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   342
lemma no_further_dB_after_simp:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   343
  shows "RALTS rs = rsimp r \<Longrightarrow> rdistinct rs {} = rs"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   344
  sorry
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   345
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   346
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   347
lemma idiot2:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   348
  shows " \<lbrakk>r1 \<noteq> RZERO; r1 \<noteq> RONE;r2 \<noteq> RZERO\<rbrakk>
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   349
    \<Longrightarrow> rsimp_SEQ r1 r2 = RSEQ r1 r2"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   350
  apply(case_tac r1)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   351
       apply(case_tac r2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   352
  apply simp_all
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   353
     apply(case_tac r2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   354
  apply simp_all
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   355
     apply(case_tac r2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   356
  apply simp_all
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   357
   apply(case_tac r2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   358
  apply simp_all
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   359
  apply(case_tac r2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   360
       apply simp_all
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   361
  done
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   362
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   363
lemma rders__onechar:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   364
  shows " (rders_simp r [c]) =  (rsimp (rders r [c]))"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   365
  by simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   366
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   367
lemma rders_append:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   368
  "rders c (s1 @ s2) = rders (rders c s1) s2"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   369
  apply(induct s1 arbitrary: c s2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   370
  apply(simp_all)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   371
  done
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   372
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   373
lemma rders_simp_append:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   374
  "rders_simp c (s1 @ s2) = rders_simp (rders_simp c s1) s2"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   375
  apply(induct s1 arbitrary: c s2)
465
Chengsong
parents: 444
diff changeset
   376
   apply(simp_all)
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   377
  done
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   378
480
574749f5190b a few more
Chengsong
parents: 478
diff changeset
   379
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   380
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   381
lemma set_related_list:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   382
  shows "distinct rs  \<Longrightarrow> length rs = card (set rs)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   383
  by (simp add: distinct_card)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   384
(*this section deals with the property of distinctBy: creates a list without duplicates*)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   385
lemma rdistinct_never_added_twice:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   386
  shows "rdistinct (a # rs) {a} = rdistinct rs {a}"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   387
  by force
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   388
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   389
478
Chengsong
parents: 476
diff changeset
   390
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   391
476
Chengsong
parents: 475
diff changeset
   392
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   393
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   394
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   395
lemma rders_simp_one_char:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   396
  shows "rders_simp r [c] = rsimp (rder c r)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   397
  apply auto
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   398
  done
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   399
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   400
lemma rsimp_idem:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   401
  shows "rsimp (rsimp r) = rsimp r"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   402
  sorry
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   403
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   404
corollary rsimp_inner_idem1:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   405
  shows "rsimp r = RSEQ r1 r2 \<Longrightarrow> rsimp r1 = r1 \<and> rsimp r2 = r2"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   406
  
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   407
  sorry
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   408
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   409
corollary rsimp_inner_idem2:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   410
  shows "rsimp r = RALTS rs \<Longrightarrow> \<forall>r' \<in> (set rs). rsimp r' = r'"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   411
  sorry
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   412
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   413
corollary rsimp_inner_idem3:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   414
  shows "rsimp r = RALTS rs \<Longrightarrow> map rsimp rs = rs"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   415
  by (meson map_idI rsimp_inner_idem2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   416
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   417
corollary rsimp_inner_idem4:
465
Chengsong
parents: 444
diff changeset
   418
  shows "rsimp r = RALTS rs \<Longrightarrow> rflts rs = rs"
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   419
  sorry
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   420
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   421
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   422
lemma head_one_more_simp:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   423
  shows "map rsimp (r # rs) = map rsimp (( rsimp r) # rs)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   424
  by (simp add: rsimp_idem)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   425
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   426
lemma head_one_more_dersimp:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   427
  shows "map rsimp ((rder x (rders_simp r s) # rs)) = map rsimp ((rders_simp r (s@[x]) ) # rs)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   428
  using head_one_more_simp rders_simp_append rders_simp_one_char by presburger
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   429
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   430
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   431
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   432
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   433
lemma ders_simp_nullability:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   434
  shows "rnullable (rders r s) = rnullable (rders_simp r s)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   435
  sorry
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   436
480
574749f5190b a few more
Chengsong
parents: 478
diff changeset
   437
lemma der_simp_nullability:
574749f5190b a few more
Chengsong
parents: 478
diff changeset
   438
  shows "rnullable r = rnullable (rsimp r)"
574749f5190b a few more
Chengsong
parents: 478
diff changeset
   439
  sorry
574749f5190b a few more
Chengsong
parents: 478
diff changeset
   440
574749f5190b a few more
Chengsong
parents: 478
diff changeset
   441
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   442
lemma  first_elem_seqder:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   443
  shows "\<not>rnullable r1p \<Longrightarrow> map rsimp (rder x (RSEQ r1p r2)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   444
                   # rs) = map rsimp ((RSEQ (rder x r1p) r2) # rs) "
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   445
  by auto
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   446
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   447
lemma first_elem_seqder1:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   448
  shows  "\<not>rnullable (rders_simp r xs) \<Longrightarrow> map rsimp ( (rder x (RSEQ (rders_simp r xs) r2)) # rs) = 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   449
                                          map rsimp ( (RSEQ (rsimp (rder x (rders_simp r xs))) r2) # rs)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   450
  by (simp add: rsimp_idem)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   451
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   452
lemma first_elem_seqdersimps:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   453
  shows "\<not>rnullable (rders_simp r xs) \<Longrightarrow> map rsimp ( (rder x (RSEQ (rders_simp r xs) r2)) # rs) = 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   454
                                          map rsimp ( (RSEQ (rders_simp r (xs @ [x])) r2) # rs)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   455
  using first_elem_seqder1 rders_simp_append by auto
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   456
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   457
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   458
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   459
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   460
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   461
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   462
lemma seq_ders_closed_form1:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   463
  shows "\<exists>Ss. rders_simp (RSEQ r1 r2) [c] = rsimp (RALTS ((RSEQ (rders_simp r1 [c]) r2) # 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   464
(map ( rders_simp r2 ) Ss)))"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   465
  apply(case_tac "rnullable r1")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   466
   apply(subgoal_tac " rders_simp (RSEQ r1 r2) [c] = 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   467
rsimp (RALTS ((RSEQ (rders_simp r1 [c]) r2) # (map (rders_simp r2) [[c]])))")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   468
    prefer 2
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   469
    apply (simp add: rsimp_idem)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   470
   apply(rule_tac x = "[[c]]" in exI)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   471
   apply simp
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   472
  apply(subgoal_tac  " rders_simp (RSEQ r1 r2) [c] = 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   473
rsimp (RALTS ((RSEQ (rders_simp r1 [c]) r2) # (map (rders_simp r2) [])))")
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   474
   apply blast
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   475
  apply(simp add: rsimp_idem)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   476
  sorry
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   477
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   478
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   479
478
Chengsong
parents: 476
diff changeset
   480
lemma idem_after_simp1:
Chengsong
parents: 476
diff changeset
   481
  shows "rsimp_ALTs (rdistinct (rflts [rsimp aa]) {}) = rsimp aa"
Chengsong
parents: 476
diff changeset
   482
  apply(case_tac "rsimp aa")
Chengsong
parents: 476
diff changeset
   483
  apply simp+
Chengsong
parents: 476
diff changeset
   484
  apply (metis no_alt_short_list_after_simp no_further_dB_after_simp)
Chengsong
parents: 476
diff changeset
   485
  by simp
Chengsong
parents: 476
diff changeset
   486
Chengsong
parents: 476
diff changeset
   487
lemma identity_wwo0:
Chengsong
parents: 476
diff changeset
   488
  shows "rsimp (rsimp_ALTs (RZERO # rs)) = rsimp (rsimp_ALTs rs)"
Chengsong
parents: 476
diff changeset
   489
  by (metis idem_after_simp1 list.exhaust list.simps(8) list.simps(9) rflts.simps(2) rsimp.simps(2) rsimp.simps(3) rsimp_ALTs.simps(1) rsimp_ALTs.simps(2) rsimp_ALTs.simps(3))
Chengsong
parents: 476
diff changeset
   490
Chengsong
parents: 476
diff changeset
   491
Chengsong
parents: 476
diff changeset
   492
lemma distinct_removes_last:
Chengsong
parents: 476
diff changeset
   493
  shows "\<lbrakk>a \<in> set as\<rbrakk>
Chengsong
parents: 476
diff changeset
   494
    \<Longrightarrow> rdistinct as rset = rdistinct (as @ [a]) rset"
Chengsong
parents: 476
diff changeset
   495
and "rdistinct (ab # as @ [ab]) rset1 = rdistinct (ab # as) rset1"
Chengsong
parents: 476
diff changeset
   496
  apply(induct as arbitrary: rset ab rset1 a)
Chengsong
parents: 476
diff changeset
   497
     apply simp
Chengsong
parents: 476
diff changeset
   498
    apply simp
Chengsong
parents: 476
diff changeset
   499
  apply(case_tac "aa \<in> rset")
Chengsong
parents: 476
diff changeset
   500
   apply(case_tac "a = aa")
Chengsong
parents: 476
diff changeset
   501
  apply (metis append_Cons)
Chengsong
parents: 476
diff changeset
   502
    apply simp
Chengsong
parents: 476
diff changeset
   503
   apply(case_tac "a \<in> set as")
Chengsong
parents: 476
diff changeset
   504
  apply (metis append_Cons rdistinct.simps(2) set_ConsD)
Chengsong
parents: 476
diff changeset
   505
   apply(case_tac "a = aa")
Chengsong
parents: 476
diff changeset
   506
    prefer 2
Chengsong
parents: 476
diff changeset
   507
    apply simp
Chengsong
parents: 476
diff changeset
   508
   apply (metis append_Cons)
Chengsong
parents: 476
diff changeset
   509
  apply(case_tac "ab \<in> rset1")
Chengsong
parents: 476
diff changeset
   510
  prefer 2
Chengsong
parents: 476
diff changeset
   511
   apply(subgoal_tac "rdistinct (ab # (a # as) @ [ab]) rset1 = 
Chengsong
parents: 476
diff changeset
   512
               ab # (rdistinct ((a # as) @ [ab]) (insert ab rset1))")
Chengsong
parents: 476
diff changeset
   513
  prefer 2
Chengsong
parents: 476
diff changeset
   514
  apply force
Chengsong
parents: 476
diff changeset
   515
  apply(simp only:)
Chengsong
parents: 476
diff changeset
   516
     apply(subgoal_tac "rdistinct (ab # a # as) rset1 = ab # (rdistinct (a # as) (insert ab rset1))")
Chengsong
parents: 476
diff changeset
   517
    apply(simp only:)
Chengsong
parents: 476
diff changeset
   518
    apply(subgoal_tac "rdistinct ((a # as) @ [ab]) (insert ab rset1) = rdistinct (a # as) (insert ab rset1)")
Chengsong
parents: 476
diff changeset
   519
     apply blast
Chengsong
parents: 476
diff changeset
   520
    apply(case_tac "a \<in> insert ab rset1")
Chengsong
parents: 476
diff changeset
   521
     apply simp
Chengsong
parents: 476
diff changeset
   522
     apply (metis insertI1)
Chengsong
parents: 476
diff changeset
   523
    apply simp
Chengsong
parents: 476
diff changeset
   524
    apply (meson insertI1)
Chengsong
parents: 476
diff changeset
   525
   apply simp
Chengsong
parents: 476
diff changeset
   526
  apply(subgoal_tac "rdistinct ((a # as) @ [ab]) rset1 = rdistinct (a # as) rset1")
Chengsong
parents: 476
diff changeset
   527
   apply simp
Chengsong
parents: 476
diff changeset
   528
  by (metis append_Cons insert_iff insert_is_Un rdistinct.simps(2))
Chengsong
parents: 476
diff changeset
   529
Chengsong
parents: 476
diff changeset
   530
Chengsong
parents: 476
diff changeset
   531
lemma distinct_removes_middle:
Chengsong
parents: 476
diff changeset
   532
  shows  "\<lbrakk>a \<in> set as\<rbrakk>
Chengsong
parents: 476
diff changeset
   533
    \<Longrightarrow> rdistinct (as @ as2) rset = rdistinct (as @ [a] @ as2) rset"
Chengsong
parents: 476
diff changeset
   534
and "rdistinct (ab # as @ [ab] @ as3) rset1 = rdistinct (ab # as @ as3) rset1"
Chengsong
parents: 476
diff changeset
   535
   apply(induct as arbitrary: rset rset1 ab as2 as3 a)
Chengsong
parents: 476
diff changeset
   536
     apply simp
Chengsong
parents: 476
diff changeset
   537
    apply simp
Chengsong
parents: 476
diff changeset
   538
   apply(case_tac "a \<in> rset")
Chengsong
parents: 476
diff changeset
   539
    apply simp
Chengsong
parents: 476
diff changeset
   540
    apply metis
Chengsong
parents: 476
diff changeset
   541
   apply simp
Chengsong
parents: 476
diff changeset
   542
   apply (metis insertI1)
Chengsong
parents: 476
diff changeset
   543
  apply(case_tac "a = ab")
Chengsong
parents: 476
diff changeset
   544
   apply simp
Chengsong
parents: 476
diff changeset
   545
   apply(case_tac "ab \<in> rset")
Chengsong
parents: 476
diff changeset
   546
    apply simp
Chengsong
parents: 476
diff changeset
   547
    apply presburger
Chengsong
parents: 476
diff changeset
   548
   apply (meson insertI1)
Chengsong
parents: 476
diff changeset
   549
  apply(case_tac "a \<in> rset")
Chengsong
parents: 476
diff changeset
   550
  apply (metis (no_types, opaque_lifting) Un_insert_left append_Cons insert_iff rdistinct.simps(2) sup_bot_left)
Chengsong
parents: 476
diff changeset
   551
  apply(case_tac "ab \<in> rset")
Chengsong
parents: 476
diff changeset
   552
  apply simp
Chengsong
parents: 476
diff changeset
   553
   apply (meson insert_iff)
Chengsong
parents: 476
diff changeset
   554
  apply simp
Chengsong
parents: 476
diff changeset
   555
  by (metis insertI1)
Chengsong
parents: 476
diff changeset
   556
Chengsong
parents: 476
diff changeset
   557
Chengsong
parents: 476
diff changeset
   558
lemma distinct_removes_middle3:
Chengsong
parents: 476
diff changeset
   559
  shows  "\<lbrakk>a \<in> set as\<rbrakk>
Chengsong
parents: 476
diff changeset
   560
    \<Longrightarrow> rdistinct (as @ a #as2) rset = rdistinct (as @ as2) rset"
Chengsong
parents: 476
diff changeset
   561
  using distinct_removes_middle(1) by fastforce
Chengsong
parents: 476
diff changeset
   562
Chengsong
parents: 476
diff changeset
   563
lemma distinct_removes_last2:
Chengsong
parents: 476
diff changeset
   564
  shows "\<lbrakk>a \<in> set as\<rbrakk>
Chengsong
parents: 476
diff changeset
   565
    \<Longrightarrow> rdistinct as rset = rdistinct (as @ [a]) rset"
Chengsong
parents: 476
diff changeset
   566
  by (simp add: distinct_removes_last(1))
Chengsong
parents: 476
diff changeset
   567
Chengsong
parents: 476
diff changeset
   568
lemma distinct_removes_middle2:
Chengsong
parents: 476
diff changeset
   569
  shows "a \<in> set as \<Longrightarrow> rdistinct (as @ [a] @ rs) {} = rdistinct (as @ rs) {}"
Chengsong
parents: 476
diff changeset
   570
  by (metis distinct_removes_middle(1))
Chengsong
parents: 476
diff changeset
   571
Chengsong
parents: 476
diff changeset
   572
lemma distinct_removes_list:
Chengsong
parents: 476
diff changeset
   573
  shows "\<lbrakk> \<forall>r \<in> set rs. r \<in> set as\<rbrakk> \<Longrightarrow> rdistinct (as @ rs) {} = rdistinct as {}"
Chengsong
parents: 476
diff changeset
   574
  apply(induct rs)
Chengsong
parents: 476
diff changeset
   575
   apply simp+
Chengsong
parents: 476
diff changeset
   576
  apply(subgoal_tac "rdistinct (as @ a # rs) {} = rdistinct (as @ rs) {}")
Chengsong
parents: 476
diff changeset
   577
   prefer 2
Chengsong
parents: 476
diff changeset
   578
  apply (metis append_Cons append_Nil distinct_removes_middle(1))
Chengsong
parents: 476
diff changeset
   579
  by presburger
Chengsong
parents: 476
diff changeset
   580
Chengsong
parents: 476
diff changeset
   581
Chengsong
parents: 476
diff changeset
   582
lemma spawn_simp_rsimpalts:
Chengsong
parents: 476
diff changeset
   583
  shows "rsimp (rsimp_ALTs rs) = rsimp (rsimp_ALTs (map rsimp rs))"
Chengsong
parents: 476
diff changeset
   584
  apply(cases rs)
Chengsong
parents: 476
diff changeset
   585
   apply simp
Chengsong
parents: 476
diff changeset
   586
  apply(case_tac list)
Chengsong
parents: 476
diff changeset
   587
   apply simp
Chengsong
parents: 476
diff changeset
   588
   apply(subst rsimp_idem[symmetric])
Chengsong
parents: 476
diff changeset
   589
   apply simp
Chengsong
parents: 476
diff changeset
   590
  apply(subgoal_tac "rsimp_ALTs rs = RALTS rs")
Chengsong
parents: 476
diff changeset
   591
   apply(simp only:)
Chengsong
parents: 476
diff changeset
   592
   apply(subgoal_tac "rsimp_ALTs (map rsimp rs) = RALTS (map rsimp rs)")
Chengsong
parents: 476
diff changeset
   593
    apply(simp only:)
Chengsong
parents: 476
diff changeset
   594
  prefer 2
Chengsong
parents: 476
diff changeset
   595
  apply simp
Chengsong
parents: 476
diff changeset
   596
   prefer 2
Chengsong
parents: 476
diff changeset
   597
  using rsimp_ALTs.simps(3) apply presburger
Chengsong
parents: 476
diff changeset
   598
  apply auto
Chengsong
parents: 476
diff changeset
   599
  apply(subst rsimp_idem)+
Chengsong
parents: 476
diff changeset
   600
  by (metis comp_apply rsimp_idem)
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   601
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   602
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   603
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   604
478
Chengsong
parents: 476
diff changeset
   605
inductive good1 :: "rrexp \<Rightarrow> bool"
Chengsong
parents: 476
diff changeset
   606
  where
Chengsong
parents: 476
diff changeset
   607
"\<lbrakk>RZERO \<notin> set rs; \<nexists>rs1. RALTS rs1 \<in> set rs\<rbrakk> \<Longrightarrow> good1 (RALTS rs)"
Chengsong
parents: 476
diff changeset
   608
|"good1 RZERO"
Chengsong
parents: 476
diff changeset
   609
|"good1 RONE"
Chengsong
parents: 476
diff changeset
   610
|"good1 (RCHAR c)"
Chengsong
parents: 476
diff changeset
   611
|"good1 (RSEQ r1 r2)"
Chengsong
parents: 476
diff changeset
   612
|"good1 (RSTAR r0)"
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   613
478
Chengsong
parents: 476
diff changeset
   614
inductive goods :: "rrexp list \<Rightarrow> bool"
Chengsong
parents: 476
diff changeset
   615
  where
Chengsong
parents: 476
diff changeset
   616
 "goods []"
Chengsong
parents: 476
diff changeset
   617
|"\<lbrakk>goods rs; r \<noteq> RZERO; \<nexists>rs1. RALTS rs1 = r\<rbrakk> \<Longrightarrow> goods (r # rs)"
Chengsong
parents: 476
diff changeset
   618
Chengsong
parents: 476
diff changeset
   619
lemma goods_good1:
Chengsong
parents: 476
diff changeset
   620
  shows "goods rs = good1 (RALTS rs)"
Chengsong
parents: 476
diff changeset
   621
  apply(induct rs)
Chengsong
parents: 476
diff changeset
   622
  apply (simp add: good1.intros(1) goods.intros(1))
Chengsong
parents: 476
diff changeset
   623
  apply(case_tac "goods rs")
Chengsong
parents: 476
diff changeset
   624
   apply(case_tac a)
Chengsong
parents: 476
diff changeset
   625
        apply simp
Chengsong
parents: 476
diff changeset
   626
  using good1.simps goods.cases apply auto[1]
Chengsong
parents: 476
diff changeset
   627
  apply (simp add: good1.simps goods.intros(2))
Chengsong
parents: 476
diff changeset
   628
  apply (simp add: good1.simps goods.intros(2))
Chengsong
parents: 476
diff changeset
   629
     apply (simp add: good1.simps goods.intros(2))
Chengsong
parents: 476
diff changeset
   630
  using good1.simps goods.cases apply auto[1]
Chengsong
parents: 476
diff changeset
   631
  apply (metis good1.cases good1.intros(1) goods.intros(2) rrexp.distinct(15) rrexp.distinct(21) rrexp.distinct(25) rrexp.distinct(29) rrexp.distinct(7) rrexp.distinct(9) rrexp.inject(3) set_ConsD)
Chengsong
parents: 476
diff changeset
   632
  apply simp
Chengsong
parents: 476
diff changeset
   633
  by (metis good1.cases good1.intros(1) goods.cases list.distinct(1) list.inject list.set_intros(2) rrexp.distinct(15) rrexp.distinct(29) rrexp.distinct(7) rrexp.inject(3) rrexp.simps(26) rrexp.simps(30))
Chengsong
parents: 476
diff changeset
   634
Chengsong
parents: 476
diff changeset
   635
lemma rsimp_good1:
Chengsong
parents: 476
diff changeset
   636
  shows "rsimp r = r1 \<Longrightarrow> good1 r1"
Chengsong
parents: 476
diff changeset
   637
Chengsong
parents: 476
diff changeset
   638
  sorry
Chengsong
parents: 476
diff changeset
   639
Chengsong
parents: 476
diff changeset
   640
lemma rsimp_no_dup:
Chengsong
parents: 476
diff changeset
   641
  shows "rsimp r = RALTS rs \<Longrightarrow> distinct rs"
Chengsong
parents: 476
diff changeset
   642
  sorry
Chengsong
parents: 476
diff changeset
   643
Chengsong
parents: 476
diff changeset
   644
Chengsong
parents: 476
diff changeset
   645
lemma rsimp_good1_2:
Chengsong
parents: 476
diff changeset
   646
  shows "map rsimp rsa = [RALTS rs] \<Longrightarrow> good1 (RALTS rs)"
Chengsong
parents: 476
diff changeset
   647
  by (metis Cons_eq_map_D rsimp_good1)
Chengsong
parents: 476
diff changeset
   648
  
Chengsong
parents: 476
diff changeset
   649
Chengsong
parents: 476
diff changeset
   650
Chengsong
parents: 476
diff changeset
   651
lemma simp_singlealt_flatten:
Chengsong
parents: 476
diff changeset
   652
  shows "rsimp (RALTS [RALTS rsa]) = rsimp (RALTS (rsa @ []))"
Chengsong
parents: 476
diff changeset
   653
  apply(induct rsa)
Chengsong
parents: 476
diff changeset
   654
   apply simp
Chengsong
parents: 476
diff changeset
   655
  apply simp
Chengsong
parents: 476
diff changeset
   656
  by (metis idem_after_simp1 list.simps(9) rsimp.simps(2))
Chengsong
parents: 476
diff changeset
   657
Chengsong
parents: 476
diff changeset
   658
Chengsong
parents: 476
diff changeset
   659
lemma good1_rsimpalts:
Chengsong
parents: 476
diff changeset
   660
  shows "rsimp r = RALTS rs \<Longrightarrow> rsimp_ALTs rs = RALTS rs"
Chengsong
parents: 476
diff changeset
   661
  by (metis no_alt_short_list_after_simp) 
Chengsong
parents: 476
diff changeset
   662
  
Chengsong
parents: 476
diff changeset
   663
Chengsong
parents: 476
diff changeset
   664
lemma good1_flts:
Chengsong
parents: 476
diff changeset
   665
  shows "good1 (RALTS rs1) \<Longrightarrow> rflts rs1 = rs1"
Chengsong
parents: 476
diff changeset
   666
  apply(induct rs1)
Chengsong
parents: 476
diff changeset
   667
   apply simp 
Chengsong
parents: 476
diff changeset
   668
  by (metis good1.cases good1.intros(1) list.set_intros(1) rflts_def_idiot rrexp.distinct(21) rrexp.distinct(25) rrexp.distinct(29) rrexp.inject(3) rsimp.simps(3) rsimp.simps(4) rsimp_inner_idem4 set_subset_Cons subsetD)
Chengsong
parents: 476
diff changeset
   669
 
Chengsong
parents: 476
diff changeset
   670
Chengsong
parents: 476
diff changeset
   671
Chengsong
parents: 476
diff changeset
   672
lemma good1_flatten:
Chengsong
parents: 476
diff changeset
   673
  shows "\<lbrakk> rsimp r =  (RALTS rs1)\<rbrakk>
Chengsong
parents: 476
diff changeset
   674
       \<Longrightarrow> rflts (rsimp_ALTs rs1 # map rsimp rsb) = rflts (rs1 @ map rsimp rsb)"
Chengsong
parents: 476
diff changeset
   675
  apply(subst good1_rsimpalts)
Chengsong
parents: 476
diff changeset
   676
   apply simp+
Chengsong
parents: 476
diff changeset
   677
  apply(subgoal_tac "rflts (rs1 @ map rsimp rsb) = rs1 @ rflts (map rsimp rsb)")
Chengsong
parents: 476
diff changeset
   678
   apply simp
Chengsong
parents: 476
diff changeset
   679
  apply(subgoal_tac "good1 (RALTS rs1)")
Chengsong
parents: 476
diff changeset
   680
  prefer 2
Chengsong
parents: 476
diff changeset
   681
  using rsimp_good1 apply blast
Chengsong
parents: 476
diff changeset
   682
  using flts_append good1_flts by presburger
Chengsong
parents: 476
diff changeset
   683
Chengsong
parents: 476
diff changeset
   684
lemma flatten_rsimpalts:
Chengsong
parents: 476
diff changeset
   685
  shows "rflts (rsimp_ALTs (rdistinct (rflts (map rsimp rsa)) {}) # map rsimp rsb) = 
Chengsong
parents: 476
diff changeset
   686
         rflts ( (rdistinct (rflts (map rsimp rsa)) {}) @ map rsimp rsb)"
Chengsong
parents: 476
diff changeset
   687
  apply(case_tac "map rsimp rsa")
Chengsong
parents: 476
diff changeset
   688
   apply simp
Chengsong
parents: 476
diff changeset
   689
  apply(case_tac "list")
Chengsong
parents: 476
diff changeset
   690
   apply simp
Chengsong
parents: 476
diff changeset
   691
   apply(case_tac a)
Chengsong
parents: 476
diff changeset
   692
        apply simp+
Chengsong
parents: 476
diff changeset
   693
    apply(rename_tac rs1)
Chengsong
parents: 476
diff changeset
   694
    apply(subgoal_tac "good1 (RALTS rs1)")
Chengsong
parents: 476
diff changeset
   695
     apply(subgoal_tac "distinct rs1")
Chengsong
parents: 476
diff changeset
   696
  apply(subst rdistinct_on_distinct)
Chengsong
parents: 476
diff changeset
   697
  apply blast
Chengsong
parents: 476
diff changeset
   698
  apply(subst rdistinct_on_distinct)
Chengsong
parents: 476
diff changeset
   699
       apply blast
Chengsong
parents: 476
diff changeset
   700
  using good1_flatten apply blast
Chengsong
parents: 476
diff changeset
   701
 
Chengsong
parents: 476
diff changeset
   702
  using rsimp_no_dup apply force
Chengsong
parents: 476
diff changeset
   703
  
Chengsong
parents: 476
diff changeset
   704
  using rsimp_good1_2 apply presburger
Chengsong
parents: 476
diff changeset
   705
Chengsong
parents: 476
diff changeset
   706
   apply simp+
Chengsong
parents: 476
diff changeset
   707
  apply(case_tac "rflts (a # aa # lista)")
Chengsong
parents: 476
diff changeset
   708
   apply simp
Chengsong
parents: 476
diff changeset
   709
  by (smt (verit) append_Cons append_Nil empty_iff good1_flatten list.distinct(1) rdistinct.simps(2) rsimp.simps(2) rsimp_ALTs.elims rsimp_good1)
Chengsong
parents: 476
diff changeset
   710
Chengsong
parents: 476
diff changeset
   711
Chengsong
parents: 476
diff changeset
   712
lemma flts_good_good:
Chengsong
parents: 476
diff changeset
   713
  shows "\<forall>r \<in> set rs. good1 r \<Longrightarrow> good1 (RALTS (rflts rs ))"
Chengsong
parents: 476
diff changeset
   714
  apply(induct rs)
Chengsong
parents: 476
diff changeset
   715
   apply simp
Chengsong
parents: 476
diff changeset
   716
  using goods.intros(1) goods_good1 apply auto[1]
Chengsong
parents: 476
diff changeset
   717
  apply(case_tac  "a")
Chengsong
parents: 476
diff changeset
   718
  apply simp
Chengsong
parents: 476
diff changeset
   719
  apply (metis goods.intros(2) goods_good1 list.set_intros(2) rflts.simps(4) rrexp.distinct(1) rrexp.distinct(15))
Chengsong
parents: 476
diff changeset
   720
     apply simp
Chengsong
parents: 476
diff changeset
   721
  using goods.intros(2) goods_good1 apply blast
Chengsong
parents: 476
diff changeset
   722
  using goods.intros(2) goods_good1 apply auto[1]
Chengsong
parents: 476
diff changeset
   723
   apply(subgoal_tac "good1 a")
Chengsong
parents: 476
diff changeset
   724
  apply (metis Un_iff good1.cases good1.intros(1) list.set_intros(2) rflts.simps(3) rrexp.distinct(15) rrexp.distinct(21) rrexp.distinct(25) rrexp.distinct(29) rrexp.distinct(7) rrexp.inject(3) set_append)
Chengsong
parents: 476
diff changeset
   725
  apply simp
Chengsong
parents: 476
diff changeset
   726
  by (metis goods.intros(2) goods_good1 list.set_intros(2) rflts.simps(7) rrexp.distinct(29) rrexp.distinct(9))
Chengsong
parents: 476
diff changeset
   727
Chengsong
parents: 476
diff changeset
   728
Chengsong
parents: 476
diff changeset
   729
lemma simp_flatten_aux1:
Chengsong
parents: 476
diff changeset
   730
  shows "\<forall>r \<in> set (map rsimp rsa). good1 r"
Chengsong
parents: 476
diff changeset
   731
  apply(induct rsa)
Chengsong
parents: 476
diff changeset
   732
   apply(simp add: goods.intros)
Chengsong
parents: 476
diff changeset
   733
  using rsimp_good1 by auto
Chengsong
parents: 476
diff changeset
   734
Chengsong
parents: 476
diff changeset
   735
Chengsong
parents: 476
diff changeset
   736
Chengsong
parents: 476
diff changeset
   737
lemma simp_flatten_aux:
Chengsong
parents: 476
diff changeset
   738
  shows "\<forall>r \<in> set rs. good1 r \<Longrightarrow> rflts (rdistinct (rflts rs) {}) = (rdistinct (rflts rs) {})"
Chengsong
parents: 476
diff changeset
   739
  sorry
476
Chengsong
parents: 475
diff changeset
   740
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   741
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   742
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   743
lemma simp_flatten:
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   744
  shows "rsimp (RALTS ((RALTS rsa) # rsb)) = rsimp (RALTS (rsa @ rsb))"
478
Chengsong
parents: 476
diff changeset
   745
  apply simp
Chengsong
parents: 476
diff changeset
   746
  apply(subst flatten_rsimpalts)
Chengsong
parents: 476
diff changeset
   747
  apply(simp add: flts_append)
Chengsong
parents: 476
diff changeset
   748
  apply(subgoal_tac "\<forall>r \<in> set (map rsimp rsa). good1 r")
Chengsong
parents: 476
diff changeset
   749
  apply (metis distinct_once_enough simp_flatten_aux)
Chengsong
parents: 476
diff changeset
   750
  using simp_flatten_aux1 by blast
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   751
478
Chengsong
parents: 476
diff changeset
   752
lemma simp_flatten3:
Chengsong
parents: 476
diff changeset
   753
  shows "rsimp (RALTS (rsa @ [RALTS rs] @ rsb)) = rsimp (RALTS (rsa @ rs @ rsb))"
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   754
  sorry
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   755
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   756
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   757
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   758
fun vsuf :: "char list \<Rightarrow> rrexp \<Rightarrow> char list list" where
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   759
"vsuf [] _ = []"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   760
|"vsuf (c#cs) r1 = (if (rnullable r1) then  (vsuf cs (rder c r1)) @ [c # cs]
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   761
                                      else  (vsuf cs (rder c r1))
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   762
                   ) "
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   763
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   764
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   765
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   766
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   767
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   768
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   769
fun star_update :: "char \<Rightarrow> rrexp \<Rightarrow> char list list \<Rightarrow> char list list" where
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   770
"star_update c r [] = []"
486
f5b96a532c85 starclosed
Chengsong
parents: 481
diff changeset
   771
|"star_update c r (s # Ss) = (if (rnullable (rders r s)) 
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   772
                                then (s@[c]) # [c] # (star_update c r Ss) 
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   773
                               else   (s@[c]) # (star_update c r Ss) )"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   774
486
f5b96a532c85 starclosed
Chengsong
parents: 481
diff changeset
   775
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   776
fun star_updates :: "char list \<Rightarrow> rrexp \<Rightarrow> char list list \<Rightarrow> char list list"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   777
  where
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   778
"star_updates [] r Ss = Ss"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   779
| "star_updates (c # cs) r Ss = star_updates cs r (star_update c r Ss)"
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   780
486
f5b96a532c85 starclosed
Chengsong
parents: 481
diff changeset
   781
lemma stupdates_append: shows 
f5b96a532c85 starclosed
Chengsong
parents: 481
diff changeset
   782
"star_updates (s @ [c]) r Ss = star_update c r (star_updates s r Ss)"
f5b96a532c85 starclosed
Chengsong
parents: 481
diff changeset
   783
  apply(induct s arbitrary: Ss)
f5b96a532c85 starclosed
Chengsong
parents: 481
diff changeset
   784
   apply simp
f5b96a532c85 starclosed
Chengsong
parents: 481
diff changeset
   785
  apply simp
f5b96a532c85 starclosed
Chengsong
parents: 481
diff changeset
   786
  done
f5b96a532c85 starclosed
Chengsong
parents: 481
diff changeset
   787
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   788
478
Chengsong
parents: 476
diff changeset
   789
lemma distinct_flts_no0:
Chengsong
parents: 476
diff changeset
   790
  shows "  rflts (map rsimp (rdistinct rs (insert RZERO rset)))  =
Chengsong
parents: 476
diff changeset
   791
           rflts (map rsimp (rdistinct rs rset))  "
Chengsong
parents: 476
diff changeset
   792
  
Chengsong
parents: 476
diff changeset
   793
  apply(induct rs arbitrary: rset)
Chengsong
parents: 476
diff changeset
   794
   apply simp
Chengsong
parents: 476
diff changeset
   795
  apply(case_tac a)
Chengsong
parents: 476
diff changeset
   796
  apply simp+
Chengsong
parents: 476
diff changeset
   797
    apply (smt (verit, ccfv_SIG) rflts.simps(2) rflts.simps(3) rflts_def_idiot)
Chengsong
parents: 476
diff changeset
   798
  prefer 2
Chengsong
parents: 476
diff changeset
   799
  apply simp  
Chengsong
parents: 476
diff changeset
   800
  by (smt (verit, ccfv_threshold) Un_insert_right insert_iff list.simps(9) rdistinct.simps(2) rflts.simps(2) rflts.simps(3) rflts_def_idiot rrexp.distinct(7))
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   801
478
Chengsong
parents: 476
diff changeset
   802
lemma flts_removes0:
Chengsong
parents: 476
diff changeset
   803
  shows "  rflts (rs @ [RZERO])  =
Chengsong
parents: 476
diff changeset
   804
           rflts rs"
Chengsong
parents: 476
diff changeset
   805
  apply(induct rs)
Chengsong
parents: 476
diff changeset
   806
   apply simp
Chengsong
parents: 476
diff changeset
   807
  by (metis append_Cons rflts.simps(2) rflts.simps(3) rflts_def_idiot)
Chengsong
parents: 476
diff changeset
   808
  
Chengsong
parents: 476
diff changeset
   809
Chengsong
parents: 476
diff changeset
   810
lemma rflts_spills_last:
Chengsong
parents: 476
diff changeset
   811
  shows "a = RALTS rs \<Longrightarrow> rflts (rs1 @ [a]) = rflts rs1 @ rs"
Chengsong
parents: 476
diff changeset
   812
  apply (induct rs1)
Chengsong
parents: 476
diff changeset
   813
  apply simp
Chengsong
parents: 476
diff changeset
   814
  by (metis append.assoc append_Cons rflts.simps(2) rflts.simps(3) rflts_def_idiot)
Chengsong
parents: 476
diff changeset
   815
Chengsong
parents: 476
diff changeset
   816
lemma flts_keeps1:
Chengsong
parents: 476
diff changeset
   817
  shows " rflts (rs @ [RONE]) = 
Chengsong
parents: 476
diff changeset
   818
          rflts  rs @ [RONE] "
Chengsong
parents: 476
diff changeset
   819
  apply (induct rs)
Chengsong
parents: 476
diff changeset
   820
   apply simp
Chengsong
parents: 476
diff changeset
   821
  by (metis append.assoc append_Cons rflts.simps(2) rflts.simps(3) rflts_def_idiot)
Chengsong
parents: 476
diff changeset
   822
Chengsong
parents: 476
diff changeset
   823
lemma flts_keeps_others:
Chengsong
parents: 476
diff changeset
   824
  shows "\<lbrakk>a \<noteq> RZERO; \<nexists>rs1. a = RALTS rs1\<rbrakk> \<Longrightarrow>rflts (rs @ [a]) = rflts rs @ [a]"
Chengsong
parents: 476
diff changeset
   825
  apply(induct rs)
Chengsong
parents: 476
diff changeset
   826
   apply simp
Chengsong
parents: 476
diff changeset
   827
  apply (simp add: rflts_def_idiot)
Chengsong
parents: 476
diff changeset
   828
  apply(case_tac a)
Chengsong
parents: 476
diff changeset
   829
       apply simp
Chengsong
parents: 476
diff changeset
   830
  using flts_keeps1 apply blast
Chengsong
parents: 476
diff changeset
   831
     apply (metis append.assoc append_Cons rflts.simps(2) rflts.simps(3) rflts_def_idiot)
Chengsong
parents: 476
diff changeset
   832
  apply (metis append.assoc append_Cons rflts.simps(2) rflts.simps(3) rflts_def_idiot)
Chengsong
parents: 476
diff changeset
   833
  apply blast
Chengsong
parents: 476
diff changeset
   834
  by (metis append.assoc append_Cons rflts.simps(2) rflts.simps(3) rflts_def_idiot)
Chengsong
parents: 476
diff changeset
   835
Chengsong
parents: 476
diff changeset
   836
lemma spilled_alts_contained:
Chengsong
parents: 476
diff changeset
   837
  shows "\<lbrakk>a = RALTS rs ; a \<in> set rs1\<rbrakk> \<Longrightarrow> \<forall>r \<in> set rs. r \<in> set (rflts rs1)"
Chengsong
parents: 476
diff changeset
   838
  apply(induct rs1)
Chengsong
parents: 476
diff changeset
   839
   apply simp 
Chengsong
parents: 476
diff changeset
   840
  apply(case_tac "a = aa")
Chengsong
parents: 476
diff changeset
   841
   apply simp
Chengsong
parents: 476
diff changeset
   842
  apply(subgoal_tac " a \<in> set rs1")
Chengsong
parents: 476
diff changeset
   843
  prefer 2
Chengsong
parents: 476
diff changeset
   844
   apply (meson set_ConsD)
Chengsong
parents: 476
diff changeset
   845
  apply(case_tac aa)
Chengsong
parents: 476
diff changeset
   846
  using rflts.simps(2) apply presburger
Chengsong
parents: 476
diff changeset
   847
      apply fastforce
Chengsong
parents: 476
diff changeset
   848
  apply fastforce
Chengsong
parents: 476
diff changeset
   849
  apply fastforce
Chengsong
parents: 476
diff changeset
   850
  apply fastforce
Chengsong
parents: 476
diff changeset
   851
  by fastforce
Chengsong
parents: 476
diff changeset
   852
Chengsong
parents: 476
diff changeset
   853
Chengsong
parents: 476
diff changeset
   854
lemma distinct_removes_duplicate_flts:
Chengsong
parents: 476
diff changeset
   855
  shows " a \<in> set rsa
Chengsong
parents: 476
diff changeset
   856
       \<Longrightarrow> rdistinct (rflts (map rsimp rsa @ [rsimp a])) {} =
Chengsong
parents: 476
diff changeset
   857
           rdistinct (rflts (map rsimp rsa)) {}"
Chengsong
parents: 476
diff changeset
   858
  apply(subgoal_tac "rsimp a \<in> set (map rsimp rsa)")
Chengsong
parents: 476
diff changeset
   859
  prefer 2
Chengsong
parents: 476
diff changeset
   860
  apply simp
Chengsong
parents: 476
diff changeset
   861
  apply(induct "rsimp a")
Chengsong
parents: 476
diff changeset
   862
       apply simp
Chengsong
parents: 476
diff changeset
   863
  using flts_removes0 apply presburger
Chengsong
parents: 476
diff changeset
   864
      apply(subgoal_tac " rdistinct (rflts (map rsimp rsa @ [rsimp a])) {} =  
Chengsong
parents: 476
diff changeset
   865
                          rdistinct (rflts (map rsimp rsa @ [RONE])) {}")
Chengsong
parents: 476
diff changeset
   866
      apply (simp only:)
Chengsong
parents: 476
diff changeset
   867
       apply(subst flts_keeps1)
Chengsong
parents: 476
diff changeset
   868
  apply (metis distinct_removes_last2 rflts_def_idiot2 rrexp.simps(20) rrexp.simps(6))
Chengsong
parents: 476
diff changeset
   869
      apply presburger
Chengsong
parents: 476
diff changeset
   870
        apply(subgoal_tac " rdistinct (rflts (map rsimp rsa @ [rsimp a]))    {} =  
Chengsong
parents: 476
diff changeset
   871
                            rdistinct ((rflts (map rsimp rsa)) @ [RCHAR x]) {}")
Chengsong
parents: 476
diff changeset
   872
      apply (simp only:)
Chengsong
parents: 476
diff changeset
   873
      prefer 2
Chengsong
parents: 476
diff changeset
   874
      apply (metis flts_keeps_others rrexp.distinct(21) rrexp.distinct(3))
Chengsong
parents: 476
diff changeset
   875
  apply (metis distinct_removes_last2 rflts_def_idiot2 rrexp.distinct(21) rrexp.distinct(3))
Chengsong
parents: 476
diff changeset
   876
Chengsong
parents: 476
diff changeset
   877
    apply (metis distinct_removes_last2 flts_keeps_others rflts_def_idiot2 rrexp.distinct(25) rrexp.distinct(5))
Chengsong
parents: 476
diff changeset
   878
   prefer 2
Chengsong
parents: 476
diff changeset
   879
   apply (metis distinct_removes_last2 flts_keeps_others flts_removes0 rflts_def_idiot2 rrexp.distinct(29))
Chengsong
parents: 476
diff changeset
   880
  apply(subgoal_tac "rflts (map rsimp rsa @ [rsimp a]) = rflts (map rsimp rsa) @ x")
Chengsong
parents: 476
diff changeset
   881
  prefer 2
Chengsong
parents: 476
diff changeset
   882
  apply (simp add: rflts_spills_last)
Chengsong
parents: 476
diff changeset
   883
  apply(simp only:)
Chengsong
parents: 476
diff changeset
   884
  apply(subgoal_tac "\<forall> r \<in> set x. r \<in> set (rflts (map rsimp rsa))")
Chengsong
parents: 476
diff changeset
   885
  prefer 2
Chengsong
parents: 476
diff changeset
   886
  using spilled_alts_contained apply presburger
Chengsong
parents: 476
diff changeset
   887
  using distinct_removes_list by blast
444
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   888
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   889
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   890
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   891
(*some basic facts about rsimp*)
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   892
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   893
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   894
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   895
a7e98deebb5c restructured sizebound proof
Chengsong
parents:
diff changeset
   896
end