thys3/BasicIdentities.thy
author Chengsong
Wed, 29 Jun 2022 12:38:05 +0100
changeset 556 c27f04bb2262
child 642 6c13f76c070b
permissions -rw-r--r--
hello
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
556
Chengsong
parents:
diff changeset
     1
theory BasicIdentities 
Chengsong
parents:
diff changeset
     2
  imports "RfltsRdistinctProps" 
Chengsong
parents:
diff changeset
     3
begin
Chengsong
parents:
diff changeset
     4
Chengsong
parents:
diff changeset
     5
Chengsong
parents:
diff changeset
     6
Chengsong
parents:
diff changeset
     7
lemma rder_rsimp_ALTs_commute:
Chengsong
parents:
diff changeset
     8
  shows "  (rder x (rsimp_ALTs rs)) = rsimp_ALTs (map (rder x) rs)"
Chengsong
parents:
diff changeset
     9
  apply(induct rs)
Chengsong
parents:
diff changeset
    10
   apply simp
Chengsong
parents:
diff changeset
    11
  apply(case_tac rs)
Chengsong
parents:
diff changeset
    12
   apply simp
Chengsong
parents:
diff changeset
    13
  apply auto
Chengsong
parents:
diff changeset
    14
  done
Chengsong
parents:
diff changeset
    15
Chengsong
parents:
diff changeset
    16
Chengsong
parents:
diff changeset
    17
Chengsong
parents:
diff changeset
    18
lemma rsimp_aalts_smaller:
Chengsong
parents:
diff changeset
    19
  shows "rsize (rsimp_ALTs  rs) \<le> rsize (RALTS rs)"
Chengsong
parents:
diff changeset
    20
  apply(induct rs)
Chengsong
parents:
diff changeset
    21
   apply simp
Chengsong
parents:
diff changeset
    22
  apply simp
Chengsong
parents:
diff changeset
    23
  apply(case_tac "rs = []")
Chengsong
parents:
diff changeset
    24
   apply simp
Chengsong
parents:
diff changeset
    25
  apply(subgoal_tac "\<exists>rsp ap. rs = ap # rsp")
Chengsong
parents:
diff changeset
    26
   apply(erule exE)+
Chengsong
parents:
diff changeset
    27
   apply simp
Chengsong
parents:
diff changeset
    28
  apply simp
Chengsong
parents:
diff changeset
    29
  by(meson neq_Nil_conv)
Chengsong
parents:
diff changeset
    30
  
Chengsong
parents:
diff changeset
    31
Chengsong
parents:
diff changeset
    32
Chengsong
parents:
diff changeset
    33
Chengsong
parents:
diff changeset
    34
Chengsong
parents:
diff changeset
    35
lemma rSEQ_mono:
Chengsong
parents:
diff changeset
    36
  shows "rsize (rsimp_SEQ r1 r2) \<le>rsize (RSEQ r1 r2)"
Chengsong
parents:
diff changeset
    37
  apply auto
Chengsong
parents:
diff changeset
    38
  apply(induct r1)
Chengsong
parents:
diff changeset
    39
       apply auto
Chengsong
parents:
diff changeset
    40
      apply(case_tac "r2")
Chengsong
parents:
diff changeset
    41
       apply simp_all
Chengsong
parents:
diff changeset
    42
     apply(case_tac r2)
Chengsong
parents:
diff changeset
    43
          apply simp_all
Chengsong
parents:
diff changeset
    44
     apply(case_tac r2)
Chengsong
parents:
diff changeset
    45
         apply simp_all
Chengsong
parents:
diff changeset
    46
     apply(case_tac r2)
Chengsong
parents:
diff changeset
    47
        apply simp_all
Chengsong
parents:
diff changeset
    48
     apply(case_tac r2)
Chengsong
parents:
diff changeset
    49
  apply simp_all
Chengsong
parents:
diff changeset
    50
  done
Chengsong
parents:
diff changeset
    51
Chengsong
parents:
diff changeset
    52
lemma ralts_cap_mono:
Chengsong
parents:
diff changeset
    53
  shows "rsize (RALTS rs) \<le> Suc (rsizes rs)"
Chengsong
parents:
diff changeset
    54
  by simp
Chengsong
parents:
diff changeset
    55
Chengsong
parents:
diff changeset
    56
Chengsong
parents:
diff changeset
    57
Chengsong
parents:
diff changeset
    58
Chengsong
parents:
diff changeset
    59
lemma rflts_mono:
Chengsong
parents:
diff changeset
    60
  shows "rsizes (rflts rs) \<le> rsizes rs"
Chengsong
parents:
diff changeset
    61
  apply(induct rs)
Chengsong
parents:
diff changeset
    62
  apply simp
Chengsong
parents:
diff changeset
    63
  apply(case_tac "a = RZERO")
Chengsong
parents:
diff changeset
    64
   apply simp
Chengsong
parents:
diff changeset
    65
  apply(case_tac "\<exists>rs1. a = RALTS rs1")
Chengsong
parents:
diff changeset
    66
  apply(erule exE)
Chengsong
parents:
diff changeset
    67
   apply simp
Chengsong
parents:
diff changeset
    68
  apply(subgoal_tac "rflts (a # rs) = a # (rflts rs)")
Chengsong
parents:
diff changeset
    69
   prefer 2
Chengsong
parents:
diff changeset
    70
  
Chengsong
parents:
diff changeset
    71
  using rflts_def_idiot apply blast
Chengsong
parents:
diff changeset
    72
  apply simp
Chengsong
parents:
diff changeset
    73
  done
Chengsong
parents:
diff changeset
    74
Chengsong
parents:
diff changeset
    75
lemma rdistinct_smaller: 
Chengsong
parents:
diff changeset
    76
  shows "rsizes (rdistinct rs ss) \<le> rsizes rs"
Chengsong
parents:
diff changeset
    77
  apply (induct rs arbitrary: ss)
Chengsong
parents:
diff changeset
    78
   apply simp
Chengsong
parents:
diff changeset
    79
  by (simp add: trans_le_add2)
Chengsong
parents:
diff changeset
    80
Chengsong
parents:
diff changeset
    81
Chengsong
parents:
diff changeset
    82
lemma rsimp_alts_mono :
Chengsong
parents:
diff changeset
    83
  shows "\<And>x. (\<And>xa. xa \<in> set x \<Longrightarrow> rsize (rsimp xa) \<le> rsize xa)  \<Longrightarrow>
Chengsong
parents:
diff changeset
    84
      rsize (rsimp_ALTs (rdistinct (rflts (map rsimp x)) {})) \<le> Suc (rsizes x)"
Chengsong
parents:
diff changeset
    85
  apply(subgoal_tac "rsize (rsimp_ALTs (rdistinct (rflts (map rsimp x)) {} )) 
Chengsong
parents:
diff changeset
    86
                    \<le> rsize (RALTS (rdistinct (rflts (map rsimp x)) {} ))")
Chengsong
parents:
diff changeset
    87
  prefer 2
Chengsong
parents:
diff changeset
    88
  using rsimp_aalts_smaller apply auto[1]
Chengsong
parents:
diff changeset
    89
  apply(subgoal_tac "rsize (RALTS (rdistinct (rflts (map rsimp x)) {})) \<le>Suc (rsizes (rdistinct (rflts (map rsimp x)) {}))")
Chengsong
parents:
diff changeset
    90
  prefer 2
Chengsong
parents:
diff changeset
    91
  using ralts_cap_mono apply blast
Chengsong
parents:
diff changeset
    92
  apply(subgoal_tac "rsizes (rdistinct (rflts (map rsimp x)) {}) \<le> rsizes (rflts (map rsimp x))")
Chengsong
parents:
diff changeset
    93
  prefer 2
Chengsong
parents:
diff changeset
    94
  using rdistinct_smaller apply presburger
Chengsong
parents:
diff changeset
    95
  apply(subgoal_tac "rsizes (rflts (map rsimp x)) \<le> rsizes (map rsimp x)")
Chengsong
parents:
diff changeset
    96
  prefer 2
Chengsong
parents:
diff changeset
    97
  using rflts_mono apply blast
Chengsong
parents:
diff changeset
    98
  apply(subgoal_tac "rsizes (map rsimp x) \<le> rsizes x")
Chengsong
parents:
diff changeset
    99
  prefer 2
Chengsong
parents:
diff changeset
   100
  
Chengsong
parents:
diff changeset
   101
  apply (simp add: sum_list_mono)
Chengsong
parents:
diff changeset
   102
  by linarith
Chengsong
parents:
diff changeset
   103
Chengsong
parents:
diff changeset
   104
Chengsong
parents:
diff changeset
   105
Chengsong
parents:
diff changeset
   106
Chengsong
parents:
diff changeset
   107
Chengsong
parents:
diff changeset
   108
lemma rsimp_mono:
Chengsong
parents:
diff changeset
   109
  shows "rsize (rsimp r) \<le> rsize r"
Chengsong
parents:
diff changeset
   110
  apply(induct r)
Chengsong
parents:
diff changeset
   111
  apply simp_all
Chengsong
parents:
diff changeset
   112
  apply(subgoal_tac "rsize (rsimp_SEQ (rsimp r1) (rsimp r2)) \<le> rsize (RSEQ (rsimp r1) (rsimp r2))")
Chengsong
parents:
diff changeset
   113
    apply force
Chengsong
parents:
diff changeset
   114
  using rSEQ_mono
Chengsong
parents:
diff changeset
   115
   apply presburger
Chengsong
parents:
diff changeset
   116
  using rsimp_alts_mono by auto
Chengsong
parents:
diff changeset
   117
Chengsong
parents:
diff changeset
   118
lemma idiot:
Chengsong
parents:
diff changeset
   119
  shows "rsimp_SEQ RONE r = r"
Chengsong
parents:
diff changeset
   120
  apply(case_tac r)
Chengsong
parents:
diff changeset
   121
       apply simp_all
Chengsong
parents:
diff changeset
   122
  done
Chengsong
parents:
diff changeset
   123
Chengsong
parents:
diff changeset
   124
Chengsong
parents:
diff changeset
   125
Chengsong
parents:
diff changeset
   126
Chengsong
parents:
diff changeset
   127
Chengsong
parents:
diff changeset
   128
lemma idiot2:
Chengsong
parents:
diff changeset
   129
  shows " \<lbrakk>r1 \<noteq> RZERO; r1 \<noteq> RONE;r2 \<noteq> RZERO\<rbrakk>
Chengsong
parents:
diff changeset
   130
    \<Longrightarrow> rsimp_SEQ r1 r2 = RSEQ r1 r2"
Chengsong
parents:
diff changeset
   131
  apply(case_tac r1)
Chengsong
parents:
diff changeset
   132
       apply(case_tac r2)
Chengsong
parents:
diff changeset
   133
  apply simp_all
Chengsong
parents:
diff changeset
   134
     apply(case_tac r2)
Chengsong
parents:
diff changeset
   135
  apply simp_all
Chengsong
parents:
diff changeset
   136
     apply(case_tac r2)
Chengsong
parents:
diff changeset
   137
  apply simp_all
Chengsong
parents:
diff changeset
   138
   apply(case_tac r2)
Chengsong
parents:
diff changeset
   139
  apply simp_all
Chengsong
parents:
diff changeset
   140
  apply(case_tac r2)
Chengsong
parents:
diff changeset
   141
       apply simp_all
Chengsong
parents:
diff changeset
   142
  done
Chengsong
parents:
diff changeset
   143
Chengsong
parents:
diff changeset
   144
lemma rders__onechar:
Chengsong
parents:
diff changeset
   145
  shows " (rders_simp r [c]) =  (rsimp (rders r [c]))"
Chengsong
parents:
diff changeset
   146
  by simp
Chengsong
parents:
diff changeset
   147
Chengsong
parents:
diff changeset
   148
lemma rders_append:
Chengsong
parents:
diff changeset
   149
  "rders c (s1 @ s2) = rders (rders c s1) s2"
Chengsong
parents:
diff changeset
   150
  apply(induct s1 arbitrary: c s2)
Chengsong
parents:
diff changeset
   151
  apply(simp_all)
Chengsong
parents:
diff changeset
   152
  done
Chengsong
parents:
diff changeset
   153
Chengsong
parents:
diff changeset
   154
lemma rders_simp_append:
Chengsong
parents:
diff changeset
   155
  "rders_simp c (s1 @ s2) = rders_simp (rders_simp c s1) s2"
Chengsong
parents:
diff changeset
   156
  apply(induct s1 arbitrary: c s2)
Chengsong
parents:
diff changeset
   157
   apply(simp_all)
Chengsong
parents:
diff changeset
   158
  done
Chengsong
parents:
diff changeset
   159
Chengsong
parents:
diff changeset
   160
Chengsong
parents:
diff changeset
   161
lemma rders_simp_one_char:
Chengsong
parents:
diff changeset
   162
  shows "rders_simp r [c] = rsimp (rder c r)"
Chengsong
parents:
diff changeset
   163
  apply auto
Chengsong
parents:
diff changeset
   164
  done
Chengsong
parents:
diff changeset
   165
Chengsong
parents:
diff changeset
   166
Chengsong
parents:
diff changeset
   167
Chengsong
parents:
diff changeset
   168
Chengsong
parents:
diff changeset
   169
Chengsong
parents:
diff changeset
   170
lemma  k0a:
Chengsong
parents:
diff changeset
   171
  shows "rflts [RALTS rs] =   rs"
Chengsong
parents:
diff changeset
   172
  apply(simp)
Chengsong
parents:
diff changeset
   173
  done
Chengsong
parents:
diff changeset
   174
Chengsong
parents:
diff changeset
   175
lemma bbbbs:
Chengsong
parents:
diff changeset
   176
  assumes "good r" "r = RALTS rs"
Chengsong
parents:
diff changeset
   177
  shows "rsimp_ALTs  (rflts [r]) = RALTS rs"
Chengsong
parents:
diff changeset
   178
  using  assms
Chengsong
parents:
diff changeset
   179
  by (metis good.simps(4) good.simps(5) k0a rsimp_ALTs.elims)
Chengsong
parents:
diff changeset
   180
Chengsong
parents:
diff changeset
   181
lemma bbbbs1:
Chengsong
parents:
diff changeset
   182
  shows "nonalt r \<or> (\<exists> rs. r  = RALTS  rs)"
Chengsong
parents:
diff changeset
   183
  by (meson nonalt.elims(3))
Chengsong
parents:
diff changeset
   184
Chengsong
parents:
diff changeset
   185
Chengsong
parents:
diff changeset
   186
Chengsong
parents:
diff changeset
   187
lemma good0:
Chengsong
parents:
diff changeset
   188
  assumes "rs \<noteq> Nil" "\<forall>r \<in> set rs. nonalt r" "distinct rs"
Chengsong
parents:
diff changeset
   189
  shows "good (rsimp_ALTs rs) \<longleftrightarrow> (\<forall>r \<in> set rs. good r)"
Chengsong
parents:
diff changeset
   190
  using  assms
Chengsong
parents:
diff changeset
   191
  apply(induct  rs rule: rsimp_ALTs.induct)
Chengsong
parents:
diff changeset
   192
  apply(auto)
Chengsong
parents:
diff changeset
   193
  done
Chengsong
parents:
diff changeset
   194
Chengsong
parents:
diff changeset
   195
lemma flts1:
Chengsong
parents:
diff changeset
   196
  assumes "good r" 
Chengsong
parents:
diff changeset
   197
  shows "rflts [r] \<noteq> []"
Chengsong
parents:
diff changeset
   198
  using  assms
Chengsong
parents:
diff changeset
   199
  apply(induct r)
Chengsong
parents:
diff changeset
   200
       apply(simp_all)
Chengsong
parents:
diff changeset
   201
  using good.simps(4) by blast
Chengsong
parents:
diff changeset
   202
Chengsong
parents:
diff changeset
   203
lemma flts2:
Chengsong
parents:
diff changeset
   204
  assumes "good r" 
Chengsong
parents:
diff changeset
   205
  shows "\<forall>r' \<in> set (rflts [r]). good r' \<and> nonalt r'"
Chengsong
parents:
diff changeset
   206
  using  assms
Chengsong
parents:
diff changeset
   207
  apply(induct r)
Chengsong
parents:
diff changeset
   208
       apply(simp)
Chengsong
parents:
diff changeset
   209
      apply(simp)
Chengsong
parents:
diff changeset
   210
     apply(simp)
Chengsong
parents:
diff changeset
   211
    prefer 2
Chengsong
parents:
diff changeset
   212
    apply(simp)
Chengsong
parents:
diff changeset
   213
    apply(auto)[1]
Chengsong
parents:
diff changeset
   214
  
Chengsong
parents:
diff changeset
   215
     apply (metis flts1 good.simps(5) good.simps(6) k0a neq_Nil_conv)
Chengsong
parents:
diff changeset
   216
    apply (metis flts1 good.simps(5) good.simps(6) k0a neq_Nil_conv)
Chengsong
parents:
diff changeset
   217
   apply fastforce
Chengsong
parents:
diff changeset
   218
  apply(simp)
Chengsong
parents:
diff changeset
   219
  done  
Chengsong
parents:
diff changeset
   220
Chengsong
parents:
diff changeset
   221
Chengsong
parents:
diff changeset
   222
Chengsong
parents:
diff changeset
   223
lemma flts3:
Chengsong
parents:
diff changeset
   224
  assumes "\<forall>r \<in> set rs. good r \<or> r = RZERO" 
Chengsong
parents:
diff changeset
   225
  shows "\<forall>r \<in> set (rflts rs). good r"
Chengsong
parents:
diff changeset
   226
  using  assms
Chengsong
parents:
diff changeset
   227
  apply(induct rs rule: rflts.induct)
Chengsong
parents:
diff changeset
   228
        apply(simp_all)
Chengsong
parents:
diff changeset
   229
  by (metis UnE flts2 k0a)
Chengsong
parents:
diff changeset
   230
Chengsong
parents:
diff changeset
   231
Chengsong
parents:
diff changeset
   232
lemma  k0:
Chengsong
parents:
diff changeset
   233
  shows "rflts (r # rs1) = rflts [r] @ rflts rs1"
Chengsong
parents:
diff changeset
   234
  apply(induct r arbitrary: rs1)
Chengsong
parents:
diff changeset
   235
   apply(auto)
Chengsong
parents:
diff changeset
   236
  done
Chengsong
parents:
diff changeset
   237
Chengsong
parents:
diff changeset
   238
Chengsong
parents:
diff changeset
   239
lemma good_SEQ:
Chengsong
parents:
diff changeset
   240
  assumes "r1 \<noteq> RZERO" "r2 \<noteq> RZERO" " r1 \<noteq> RONE"
Chengsong
parents:
diff changeset
   241
  shows "good (RSEQ r1 r2) = (good r1 \<and> good r2)"
Chengsong
parents:
diff changeset
   242
  using assms
Chengsong
parents:
diff changeset
   243
  apply(case_tac r1)
Chengsong
parents:
diff changeset
   244
       apply(simp_all)
Chengsong
parents:
diff changeset
   245
  apply(case_tac r2)
Chengsong
parents:
diff changeset
   246
          apply(simp_all)
Chengsong
parents:
diff changeset
   247
  apply(case_tac r2)
Chengsong
parents:
diff changeset
   248
         apply(simp_all)
Chengsong
parents:
diff changeset
   249
  apply(case_tac r2)
Chengsong
parents:
diff changeset
   250
        apply(simp_all)
Chengsong
parents:
diff changeset
   251
  apply(case_tac r2)
Chengsong
parents:
diff changeset
   252
       apply(simp_all)
Chengsong
parents:
diff changeset
   253
  done
Chengsong
parents:
diff changeset
   254
Chengsong
parents:
diff changeset
   255
lemma rsize0:
Chengsong
parents:
diff changeset
   256
  shows "0 < rsize r"
Chengsong
parents:
diff changeset
   257
  apply(induct  r)
Chengsong
parents:
diff changeset
   258
       apply(auto)
Chengsong
parents:
diff changeset
   259
  done
Chengsong
parents:
diff changeset
   260
Chengsong
parents:
diff changeset
   261
Chengsong
parents:
diff changeset
   262
Chengsong
parents:
diff changeset
   263
Chengsong
parents:
diff changeset
   264
Chengsong
parents:
diff changeset
   265
Chengsong
parents:
diff changeset
   266
Chengsong
parents:
diff changeset
   267
Chengsong
parents:
diff changeset
   268
Chengsong
parents:
diff changeset
   269
Chengsong
parents:
diff changeset
   270
Chengsong
parents:
diff changeset
   271
lemma nn1qq:
Chengsong
parents:
diff changeset
   272
  assumes "nonnested (RALTS rs)"
Chengsong
parents:
diff changeset
   273
  shows "\<nexists> rs1. RALTS rs1 \<in> set rs"
Chengsong
parents:
diff changeset
   274
  using assms
Chengsong
parents:
diff changeset
   275
  apply(induct rs rule: rflts.induct)
Chengsong
parents:
diff changeset
   276
  apply(auto)
Chengsong
parents:
diff changeset
   277
  done
Chengsong
parents:
diff changeset
   278
Chengsong
parents:
diff changeset
   279
 
Chengsong
parents:
diff changeset
   280
Chengsong
parents:
diff changeset
   281
lemma n0:
Chengsong
parents:
diff changeset
   282
  shows "nonnested (RALTS rs) \<longleftrightarrow> (\<forall>r \<in> set rs. nonalt r)"
Chengsong
parents:
diff changeset
   283
  apply(induct rs )
Chengsong
parents:
diff changeset
   284
   apply(auto)
Chengsong
parents:
diff changeset
   285
    apply (metis list.set_intros(1) nn1qq nonalt.elims(3))
Chengsong
parents:
diff changeset
   286
  apply (metis nonalt.elims(2) nonnested.simps(3) nonnested.simps(4) nonnested.simps(5) nonnested.simps(6) nonnested.simps(7))
Chengsong
parents:
diff changeset
   287
  using bbbbs1 apply fastforce
Chengsong
parents:
diff changeset
   288
  by (metis bbbbs1 list.set_intros(2) nn1qq)
Chengsong
parents:
diff changeset
   289
Chengsong
parents:
diff changeset
   290
  
Chengsong
parents:
diff changeset
   291
  
Chengsong
parents:
diff changeset
   292
Chengsong
parents:
diff changeset
   293
lemma nn1c:
Chengsong
parents:
diff changeset
   294
  assumes "\<forall>r \<in> set rs. nonnested r"
Chengsong
parents:
diff changeset
   295
  shows "\<forall>r \<in> set (rflts rs). nonalt r"
Chengsong
parents:
diff changeset
   296
  using assms
Chengsong
parents:
diff changeset
   297
  apply(induct rs rule: rflts.induct)
Chengsong
parents:
diff changeset
   298
        apply(auto)
Chengsong
parents:
diff changeset
   299
  using n0 by blast
Chengsong
parents:
diff changeset
   300
Chengsong
parents:
diff changeset
   301
lemma nn1bb:
Chengsong
parents:
diff changeset
   302
  assumes "\<forall>r \<in> set rs. nonalt r"
Chengsong
parents:
diff changeset
   303
  shows "nonnested (rsimp_ALTs  rs)"
Chengsong
parents:
diff changeset
   304
  using assms
Chengsong
parents:
diff changeset
   305
  apply(induct  rs rule: rsimp_ALTs.induct)
Chengsong
parents:
diff changeset
   306
    apply(auto)
Chengsong
parents:
diff changeset
   307
  using nonalt.simps(1) nonnested.elims(3) apply blast
Chengsong
parents:
diff changeset
   308
  using n0 by auto
Chengsong
parents:
diff changeset
   309
Chengsong
parents:
diff changeset
   310
lemma bsimp_ASEQ0:
Chengsong
parents:
diff changeset
   311
  shows "rsimp_SEQ  r1 RZERO = RZERO"
Chengsong
parents:
diff changeset
   312
  apply(induct r1)
Chengsong
parents:
diff changeset
   313
  apply(auto)
Chengsong
parents:
diff changeset
   314
  done
Chengsong
parents:
diff changeset
   315
Chengsong
parents:
diff changeset
   316
lemma nn1b:
Chengsong
parents:
diff changeset
   317
  shows "nonnested (rsimp r)"
Chengsong
parents:
diff changeset
   318
  apply(induct r)
Chengsong
parents:
diff changeset
   319
       apply(simp_all)
Chengsong
parents:
diff changeset
   320
  apply(case_tac "rsimp r1 = RZERO")
Chengsong
parents:
diff changeset
   321
    apply(simp)
Chengsong
parents:
diff changeset
   322
 apply(case_tac "rsimp r2 = RZERO")
Chengsong
parents:
diff changeset
   323
   apply(simp)
Chengsong
parents:
diff changeset
   324
    apply(subst bsimp_ASEQ0)
Chengsong
parents:
diff changeset
   325
  apply(simp)
Chengsong
parents:
diff changeset
   326
  apply(case_tac "\<exists>bs. rsimp r1 = RONE")
Chengsong
parents:
diff changeset
   327
    apply(auto)[1]
Chengsong
parents:
diff changeset
   328
  using idiot apply fastforce
Chengsong
parents:
diff changeset
   329
  using idiot2 nonnested.simps(11) apply presburger
Chengsong
parents:
diff changeset
   330
  by (metis (mono_tags, lifting) Diff_empty image_iff list.set_map nn1bb nn1c rdistinct_set_equality1)
Chengsong
parents:
diff changeset
   331
Chengsong
parents:
diff changeset
   332
lemma nonalt_flts_rd:
Chengsong
parents:
diff changeset
   333
  shows "\<lbrakk>xa \<in> set (rdistinct (rflts (map rsimp rs)) {})\<rbrakk>
Chengsong
parents:
diff changeset
   334
       \<Longrightarrow> nonalt xa"
Chengsong
parents:
diff changeset
   335
  by (metis Diff_empty ex_map_conv nn1b nn1c rdistinct_set_equality1)
Chengsong
parents:
diff changeset
   336
Chengsong
parents:
diff changeset
   337
Chengsong
parents:
diff changeset
   338
Chengsong
parents:
diff changeset
   339
Chengsong
parents:
diff changeset
   340
lemma bsimp_ASEQ2:
Chengsong
parents:
diff changeset
   341
  shows "rsimp_SEQ RONE r2 =  r2"
Chengsong
parents:
diff changeset
   342
  apply(induct r2)
Chengsong
parents:
diff changeset
   343
  apply(auto)
Chengsong
parents:
diff changeset
   344
  done
Chengsong
parents:
diff changeset
   345
Chengsong
parents:
diff changeset
   346
lemma elem_smaller_than_set:
Chengsong
parents:
diff changeset
   347
  shows "xa \<in> set  list \<Longrightarrow> rsize xa < Suc (rsizes list)"
Chengsong
parents:
diff changeset
   348
  apply(induct list)
Chengsong
parents:
diff changeset
   349
   apply simp
Chengsong
parents:
diff changeset
   350
  by (metis image_eqI le_imp_less_Suc list.set_map member_le_sum_list)
Chengsong
parents:
diff changeset
   351
Chengsong
parents:
diff changeset
   352
lemma rsimp_list_mono:
Chengsong
parents:
diff changeset
   353
  shows "rsizes (map rsimp rs) \<le> rsizes rs"
Chengsong
parents:
diff changeset
   354
  apply(induct rs)
Chengsong
parents:
diff changeset
   355
   apply simp+
Chengsong
parents:
diff changeset
   356
  by (simp add: add_mono_thms_linordered_semiring(1) rsimp_mono)
Chengsong
parents:
diff changeset
   357
Chengsong
parents:
diff changeset
   358
Chengsong
parents:
diff changeset
   359
(*says anything coming out of simp+flts+db will be good*)
Chengsong
parents:
diff changeset
   360
lemma good2_obv_simplified:
Chengsong
parents:
diff changeset
   361
  shows " \<lbrakk>\<forall>y. rsize y < Suc (rsizes rs) \<longrightarrow> good (rsimp y) \<or> rsimp y = RZERO;
Chengsong
parents:
diff changeset
   362
           xa \<in> set (rdistinct (rflts (map rsimp rs)) {})\<rbrakk> \<Longrightarrow> good xa"
Chengsong
parents:
diff changeset
   363
  apply(subgoal_tac " \<forall>xa' \<in> set (map rsimp rs). good xa' \<or> xa' = RZERO")
Chengsong
parents:
diff changeset
   364
  prefer 2
Chengsong
parents:
diff changeset
   365
   apply (simp add: elem_smaller_than_set)
Chengsong
parents:
diff changeset
   366
  by (metis Diff_empty flts3 rdistinct_set_equality1)
Chengsong
parents:
diff changeset
   367
Chengsong
parents:
diff changeset
   368
Chengsong
parents:
diff changeset
   369
Chengsong
parents:
diff changeset
   370
Chengsong
parents:
diff changeset
   371
lemma good1:
Chengsong
parents:
diff changeset
   372
  shows "good (rsimp a) \<or> rsimp a = RZERO"
Chengsong
parents:
diff changeset
   373
  apply(induct a taking: rsize rule: measure_induct)
Chengsong
parents:
diff changeset
   374
  apply(case_tac x)
Chengsong
parents:
diff changeset
   375
  apply(simp)
Chengsong
parents:
diff changeset
   376
  apply(simp)
Chengsong
parents:
diff changeset
   377
  apply(simp)
Chengsong
parents:
diff changeset
   378
  prefer 3
Chengsong
parents:
diff changeset
   379
    apply(simp)
Chengsong
parents:
diff changeset
   380
   prefer 2
Chengsong
parents:
diff changeset
   381
   apply(simp only:)
Chengsong
parents:
diff changeset
   382
   apply simp
Chengsong
parents:
diff changeset
   383
  apply (smt (verit, ccfv_threshold) add_mono_thms_linordered_semiring(1) elem_smaller_than_set good0 good2_obv_simplified le_eq_less_or_eq nonalt_flts_rd order_less_trans plus_1_eq_Suc rdistinct_does_the_job rdistinct_smaller rflts_mono rsimp_ALTs.simps(1) rsimp_list_mono)
Chengsong
parents:
diff changeset
   384
  apply simp
Chengsong
parents:
diff changeset
   385
  apply(subgoal_tac "good (rsimp x41) \<or> rsimp x41 = RZERO")
Chengsong
parents:
diff changeset
   386
   apply(subgoal_tac "good (rsimp x42) \<or> rsimp x42 = RZERO")
Chengsong
parents:
diff changeset
   387
    apply(case_tac "rsimp x41 = RZERO")
Chengsong
parents:
diff changeset
   388
     apply simp
Chengsong
parents:
diff changeset
   389
    apply(case_tac "rsimp x42 = RZERO")
Chengsong
parents:
diff changeset
   390
     apply simp
Chengsong
parents:
diff changeset
   391
  using bsimp_ASEQ0 apply blast
Chengsong
parents:
diff changeset
   392
    apply(subgoal_tac "good (rsimp x41)")
Chengsong
parents:
diff changeset
   393
     apply(subgoal_tac "good (rsimp x42)")
Chengsong
parents:
diff changeset
   394
      apply simp
Chengsong
parents:
diff changeset
   395
  apply (metis bsimp_ASEQ2 good_SEQ idiot2)
Chengsong
parents:
diff changeset
   396
  apply blast
Chengsong
parents:
diff changeset
   397
  apply fastforce
Chengsong
parents:
diff changeset
   398
  using less_add_Suc2 apply blast  
Chengsong
parents:
diff changeset
   399
  using less_iff_Suc_add by blast
Chengsong
parents:
diff changeset
   400
Chengsong
parents:
diff changeset
   401
lemma RL_rnullable:
Chengsong
parents:
diff changeset
   402
  shows "rnullable r = ([] \<in> RL r)"
Chengsong
parents:
diff changeset
   403
  apply(induct r)
Chengsong
parents:
diff changeset
   404
  apply(auto simp add: Sequ_def)
Chengsong
parents:
diff changeset
   405
  done
Chengsong
parents:
diff changeset
   406
Chengsong
parents:
diff changeset
   407
lemma RL_rder:
Chengsong
parents:
diff changeset
   408
  shows "RL (rder c r) = Der c (RL r)"
Chengsong
parents:
diff changeset
   409
  apply(induct r)
Chengsong
parents:
diff changeset
   410
  apply(auto simp add: Sequ_def Der_def)
Chengsong
parents:
diff changeset
   411
        apply (metis append_Cons)
Chengsong
parents:
diff changeset
   412
  using RL_rnullable apply blast
Chengsong
parents:
diff changeset
   413
  apply (metis append_eq_Cons_conv)
Chengsong
parents:
diff changeset
   414
  apply (metis append_Cons)
Chengsong
parents:
diff changeset
   415
  apply (metis RL_rnullable append_eq_Cons_conv)
Chengsong
parents:
diff changeset
   416
  apply (metis Star.step append_Cons)
Chengsong
parents:
diff changeset
   417
  using Star_decomp by auto
Chengsong
parents:
diff changeset
   418
Chengsong
parents:
diff changeset
   419
Chengsong
parents:
diff changeset
   420
Chengsong
parents:
diff changeset
   421
Chengsong
parents:
diff changeset
   422
lemma RL_rsimp_RSEQ:
Chengsong
parents:
diff changeset
   423
  shows "RL (rsimp_SEQ r1 r2) = (RL r1 ;; RL r2)"
Chengsong
parents:
diff changeset
   424
  apply(induct r1 r2 rule: rsimp_SEQ.induct)
Chengsong
parents:
diff changeset
   425
  apply(simp_all)
Chengsong
parents:
diff changeset
   426
  done
Chengsong
parents:
diff changeset
   427
Chengsong
parents:
diff changeset
   428
Chengsong
parents:
diff changeset
   429
Chengsong
parents:
diff changeset
   430
lemma RL_rsimp_RALTS:
Chengsong
parents:
diff changeset
   431
  shows "RL (rsimp_ALTs rs) = (\<Union> (set (map RL rs)))"
Chengsong
parents:
diff changeset
   432
  apply(induct rs rule: rsimp_ALTs.induct)
Chengsong
parents:
diff changeset
   433
  apply(simp_all)
Chengsong
parents:
diff changeset
   434
  done
Chengsong
parents:
diff changeset
   435
Chengsong
parents:
diff changeset
   436
lemma RL_rsimp_rdistinct:
Chengsong
parents:
diff changeset
   437
  shows "(\<Union> (set (map RL (rdistinct rs {})))) = (\<Union> (set (map RL rs)))"
Chengsong
parents:
diff changeset
   438
  apply(auto)
Chengsong
parents:
diff changeset
   439
  apply (metis Diff_iff rdistinct_set_equality1)
Chengsong
parents:
diff changeset
   440
  by (metis Diff_empty rdistinct_set_equality1)
Chengsong
parents:
diff changeset
   441
Chengsong
parents:
diff changeset
   442
lemma RL_rsimp_rflts:
Chengsong
parents:
diff changeset
   443
  shows "(\<Union> (set (map RL (rflts rs)))) = (\<Union> (set (map RL rs)))"
Chengsong
parents:
diff changeset
   444
  apply(induct rs rule: rflts.induct)
Chengsong
parents:
diff changeset
   445
  apply(simp_all)
Chengsong
parents:
diff changeset
   446
  done
Chengsong
parents:
diff changeset
   447
Chengsong
parents:
diff changeset
   448
lemma RL_rsimp:
Chengsong
parents:
diff changeset
   449
  shows "RL r = RL (rsimp r)"
Chengsong
parents:
diff changeset
   450
  apply(induct r rule: rsimp.induct)
Chengsong
parents:
diff changeset
   451
       apply(auto simp add: Sequ_def RL_rsimp_RSEQ)
Chengsong
parents:
diff changeset
   452
  using RL_rsimp_RALTS RL_rsimp_rdistinct RL_rsimp_rflts apply auto[1]
Chengsong
parents:
diff changeset
   453
  by (smt (verit, del_insts) RL_rsimp_RALTS RL_rsimp_rdistinct RL_rsimp_rflts UN_E image_iff list.set_map)
Chengsong
parents:
diff changeset
   454
Chengsong
parents:
diff changeset
   455
Chengsong
parents:
diff changeset
   456
Chengsong
parents:
diff changeset
   457
lemma der_simp_nullability:
Chengsong
parents:
diff changeset
   458
  shows "rnullable r = rnullable (rsimp r)"
Chengsong
parents:
diff changeset
   459
  using RL_rnullable RL_rsimp by auto
Chengsong
parents:
diff changeset
   460
  
Chengsong
parents:
diff changeset
   461
Chengsong
parents:
diff changeset
   462
lemma qqq1:
Chengsong
parents:
diff changeset
   463
  shows "RZERO \<notin> set (rflts (map rsimp rs))"
Chengsong
parents:
diff changeset
   464
  by (metis ex_map_conv flts3 good.simps(1) good1)
Chengsong
parents:
diff changeset
   465
Chengsong
parents:
diff changeset
   466
Chengsong
parents:
diff changeset
   467
Chengsong
parents:
diff changeset
   468
Chengsong
parents:
diff changeset
   469
Chengsong
parents:
diff changeset
   470
lemma flts_single1:
Chengsong
parents:
diff changeset
   471
  assumes "nonalt r" "nonazero r"
Chengsong
parents:
diff changeset
   472
  shows "rflts [r] = [r]"
Chengsong
parents:
diff changeset
   473
  using assms
Chengsong
parents:
diff changeset
   474
  apply(induct r)
Chengsong
parents:
diff changeset
   475
  apply(auto)
Chengsong
parents:
diff changeset
   476
  done
Chengsong
parents:
diff changeset
   477
Chengsong
parents:
diff changeset
   478
lemma nonalt0_flts_keeps:
Chengsong
parents:
diff changeset
   479
  shows "(a \<noteq> RZERO) \<and> (\<forall>rs. a \<noteq> RALTS rs) \<Longrightarrow> rflts (a # xs) = a # rflts xs"
Chengsong
parents:
diff changeset
   480
  apply(case_tac a)
Chengsong
parents:
diff changeset
   481
       apply simp+
Chengsong
parents:
diff changeset
   482
  done
Chengsong
parents:
diff changeset
   483
Chengsong
parents:
diff changeset
   484
Chengsong
parents:
diff changeset
   485
lemma nonalt0_fltseq:
Chengsong
parents:
diff changeset
   486
  shows "\<forall>r \<in> set rs. r \<noteq> RZERO \<and> nonalt r \<Longrightarrow> rflts rs = rs"
Chengsong
parents:
diff changeset
   487
  apply(induct rs)
Chengsong
parents:
diff changeset
   488
   apply simp
Chengsong
parents:
diff changeset
   489
  apply(case_tac "a = RZERO")
Chengsong
parents:
diff changeset
   490
   apply fastforce
Chengsong
parents:
diff changeset
   491
  apply(case_tac "\<exists>rs1. a = RALTS rs1")
Chengsong
parents:
diff changeset
   492
   apply(erule exE)
Chengsong
parents:
diff changeset
   493
   apply simp+
Chengsong
parents:
diff changeset
   494
  using nonalt0_flts_keeps by presburger
Chengsong
parents:
diff changeset
   495
Chengsong
parents:
diff changeset
   496
  
Chengsong
parents:
diff changeset
   497
Chengsong
parents:
diff changeset
   498
Chengsong
parents:
diff changeset
   499
lemma goodalts_nonalt:
Chengsong
parents:
diff changeset
   500
  shows "good (RALTS rs) \<Longrightarrow> rflts rs = rs"
Chengsong
parents:
diff changeset
   501
  apply(induct x == "RALTS rs" arbitrary: rs rule: good.induct)
Chengsong
parents:
diff changeset
   502
    apply simp
Chengsong
parents:
diff changeset
   503
  
Chengsong
parents:
diff changeset
   504
  using good.simps(5) apply blast
Chengsong
parents:
diff changeset
   505
  apply simp
Chengsong
parents:
diff changeset
   506
  apply(case_tac "r1 = RZERO")
Chengsong
parents:
diff changeset
   507
  using good.simps(1) apply force
Chengsong
parents:
diff changeset
   508
  apply(case_tac "r2 = RZERO")
Chengsong
parents:
diff changeset
   509
  using good.simps(1) apply force
Chengsong
parents:
diff changeset
   510
  apply(subgoal_tac "rflts (r1 # r2 # rs) = r1 # r2 # rflts rs")
Chengsong
parents:
diff changeset
   511
  prefer 2
Chengsong
parents:
diff changeset
   512
   apply (metis nonalt.simps(1) rflts_def_idiot)
Chengsong
parents:
diff changeset
   513
  apply(subgoal_tac "\<forall>r \<in> set rs. r \<noteq> RZERO \<and> nonalt r")
Chengsong
parents:
diff changeset
   514
   apply(subgoal_tac "rflts rs = rs")
Chengsong
parents:
diff changeset
   515
    apply presburger
Chengsong
parents:
diff changeset
   516
  using nonalt0_fltseq apply presburger
Chengsong
parents:
diff changeset
   517
  using good.simps(1) by blast
Chengsong
parents:
diff changeset
   518
  
Chengsong
parents:
diff changeset
   519
Chengsong
parents:
diff changeset
   520
  
Chengsong
parents:
diff changeset
   521
Chengsong
parents:
diff changeset
   522
Chengsong
parents:
diff changeset
   523
lemma test:
Chengsong
parents:
diff changeset
   524
  assumes "good r"
Chengsong
parents:
diff changeset
   525
  shows "rsimp r = r"
Chengsong
parents:
diff changeset
   526
Chengsong
parents:
diff changeset
   527
  using assms
Chengsong
parents:
diff changeset
   528
  apply(induct rule: good.induct)
Chengsong
parents:
diff changeset
   529
                      apply simp
Chengsong
parents:
diff changeset
   530
                      apply simp
Chengsong
parents:
diff changeset
   531
                      apply simp
Chengsong
parents:
diff changeset
   532
                      apply simp
Chengsong
parents:
diff changeset
   533
                      apply simp
Chengsong
parents:
diff changeset
   534
                      apply(subgoal_tac "distinct (r1 # r2 # rs)")
Chengsong
parents:
diff changeset
   535
  prefer 2
Chengsong
parents:
diff changeset
   536
  using good.simps(6) apply blast
Chengsong
parents:
diff changeset
   537
  apply(subgoal_tac "rflts (r1 # r2 # rs ) = r1 # r2 # rs")
Chengsong
parents:
diff changeset
   538
  prefer 2
Chengsong
parents:
diff changeset
   539
  using goodalts_nonalt apply blast
Chengsong
parents:
diff changeset
   540
Chengsong
parents:
diff changeset
   541
                      apply(subgoal_tac "r1 \<noteq> r2")
Chengsong
parents:
diff changeset
   542
  prefer 2
Chengsong
parents:
diff changeset
   543
                      apply (meson distinct_length_2_or_more)
Chengsong
parents:
diff changeset
   544
                      apply(subgoal_tac "r1 \<notin> set rs")
Chengsong
parents:
diff changeset
   545
                      apply(subgoal_tac "r2 \<notin> set rs")
Chengsong
parents:
diff changeset
   546
                      apply(subgoal_tac "\<forall>r \<in> set rs. rsimp r = r")
Chengsong
parents:
diff changeset
   547
                      apply(subgoal_tac "map rsimp rs = rs")
Chengsong
parents:
diff changeset
   548
  apply simp             
Chengsong
parents:
diff changeset
   549
                      apply(subgoal_tac "\<forall>r \<in>  {r1, r2}. r \<notin> set rs")
Chengsong
parents:
diff changeset
   550
  apply (metis distinct_not_exist rdistinct_on_distinct)
Chengsong
parents:
diff changeset
   551
  
Chengsong
parents:
diff changeset
   552
                      apply blast
Chengsong
parents:
diff changeset
   553
                      apply (meson map_idI)
Chengsong
parents:
diff changeset
   554
                      apply (metis good.simps(6) insert_iff list.simps(15))
Chengsong
parents:
diff changeset
   555
Chengsong
parents:
diff changeset
   556
  apply (meson distinct.simps(2))
Chengsong
parents:
diff changeset
   557
                      apply (simp add: distinct_length_2_or_more)
Chengsong
parents:
diff changeset
   558
                      apply simp+
Chengsong
parents:
diff changeset
   559
  done
Chengsong
parents:
diff changeset
   560
Chengsong
parents:
diff changeset
   561
Chengsong
parents:
diff changeset
   562
Chengsong
parents:
diff changeset
   563
lemma rsimp_idem:
Chengsong
parents:
diff changeset
   564
  shows "rsimp (rsimp r) = rsimp r"
Chengsong
parents:
diff changeset
   565
  using test good1
Chengsong
parents:
diff changeset
   566
  by force
Chengsong
parents:
diff changeset
   567
Chengsong
parents:
diff changeset
   568
corollary rsimp_inner_idem4:
Chengsong
parents:
diff changeset
   569
  shows "rsimp r = RALTS rs \<Longrightarrow> rflts rs = rs"
Chengsong
parents:
diff changeset
   570
  by (metis good1 goodalts_nonalt rrexp.simps(12))
Chengsong
parents:
diff changeset
   571
Chengsong
parents:
diff changeset
   572
Chengsong
parents:
diff changeset
   573
corollary head_one_more_simp:
Chengsong
parents:
diff changeset
   574
  shows "map rsimp (r # rs) = map rsimp (( rsimp r) # rs)"
Chengsong
parents:
diff changeset
   575
  by (simp add: rsimp_idem)
Chengsong
parents:
diff changeset
   576
Chengsong
parents:
diff changeset
   577
Chengsong
parents:
diff changeset
   578
Chengsong
parents:
diff changeset
   579
Chengsong
parents:
diff changeset
   580
lemma basic_regex_property1:
Chengsong
parents:
diff changeset
   581
  shows "rnullable r \<Longrightarrow> rsimp r \<noteq> RZERO"
Chengsong
parents:
diff changeset
   582
  apply(induct r rule: rsimp.induct)
Chengsong
parents:
diff changeset
   583
  apply(auto)
Chengsong
parents:
diff changeset
   584
  apply (metis idiot idiot2 rrexp.distinct(5))
Chengsong
parents:
diff changeset
   585
  by (metis der_simp_nullability rnullable.simps(1) rnullable.simps(4) rsimp.simps(2))
Chengsong
parents:
diff changeset
   586
Chengsong
parents:
diff changeset
   587
Chengsong
parents:
diff changeset
   588
Chengsong
parents:
diff changeset
   589
lemma no_alt_short_list_after_simp:
Chengsong
parents:
diff changeset
   590
  shows "RALTS rs = rsimp r \<Longrightarrow> rsimp_ALTs rs = RALTS rs"
Chengsong
parents:
diff changeset
   591
  by (metis bbbbs good1 k0a rrexp.simps(12))
Chengsong
parents:
diff changeset
   592
Chengsong
parents:
diff changeset
   593
Chengsong
parents:
diff changeset
   594
lemma no_further_dB_after_simp:
Chengsong
parents:
diff changeset
   595
  shows "RALTS rs = rsimp r \<Longrightarrow> rdistinct rs {} = rs"
Chengsong
parents:
diff changeset
   596
  apply(subgoal_tac "good (RALTS rs)")
Chengsong
parents:
diff changeset
   597
  apply(subgoal_tac "distinct rs")
Chengsong
parents:
diff changeset
   598
  using rdistinct_on_distinct apply blast
Chengsong
parents:
diff changeset
   599
  apply (metis distinct.simps(1) distinct.simps(2) empty_iff good.simps(6) list.exhaust set_empty2)
Chengsong
parents:
diff changeset
   600
  using good1 by fastforce
Chengsong
parents:
diff changeset
   601
Chengsong
parents:
diff changeset
   602
Chengsong
parents:
diff changeset
   603
lemma idem_after_simp1:
Chengsong
parents:
diff changeset
   604
  shows "rsimp_ALTs (rdistinct (rflts [rsimp aa]) {}) = rsimp aa"
Chengsong
parents:
diff changeset
   605
  apply(case_tac "rsimp aa")
Chengsong
parents:
diff changeset
   606
  apply simp+
Chengsong
parents:
diff changeset
   607
  apply (metis no_alt_short_list_after_simp no_further_dB_after_simp)
Chengsong
parents:
diff changeset
   608
  by simp
Chengsong
parents:
diff changeset
   609
Chengsong
parents:
diff changeset
   610
Chengsong
parents:
diff changeset
   611
Chengsong
parents:
diff changeset
   612
Chengsong
parents:
diff changeset
   613
Chengsong
parents:
diff changeset
   614
(*equalities with rsimp *)
Chengsong
parents:
diff changeset
   615
lemma identity_wwo0:
Chengsong
parents:
diff changeset
   616
  shows "rsimp (rsimp_ALTs (RZERO # rs)) = rsimp (rsimp_ALTs rs)"
Chengsong
parents:
diff changeset
   617
  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:
diff changeset
   618
Chengsong
parents:
diff changeset
   619
Chengsong
parents:
diff changeset
   620
Chengsong
parents:
diff changeset
   621
Chengsong
parents:
diff changeset
   622
Chengsong
parents:
diff changeset
   623
Chengsong
parents:
diff changeset
   624
Chengsong
parents:
diff changeset
   625
(*some basic facts about rsimp*)
Chengsong
parents:
diff changeset
   626
Chengsong
parents:
diff changeset
   627
unused_thms
Chengsong
parents:
diff changeset
   628
Chengsong
parents:
diff changeset
   629
Chengsong
parents:
diff changeset
   630
end