src/HOL/Lex/RegExp2NA.ML
author oheimb
Mon Sep 21 23:17:28 1998 +0200 (1998-09-21)
changeset 5525 896f8234b864
parent 5457 367878234bb2
child 5758 27a2b36efd95
permissions -rw-r--r--
improved addbefore and addSbefore
improved mechanism for unsafe wrappers
nipkow@5323
     1
(*  Title:      HOL/Lex/RegExp2NA.ML
nipkow@5323
     2
    ID:         $Id$
nipkow@5323
     3
    Author:     Tobias Nipkow
nipkow@5323
     4
    Copyright   1998 TUM
nipkow@5323
     5
*)
nipkow@5323
     6
nipkow@5323
     7
(******************************************************)
nipkow@5323
     8
(*                       atom                         *)
nipkow@5323
     9
(******************************************************)
nipkow@5323
    10
nipkow@5323
    11
Goalw [atom_def] "(fin (atom a) q) = (q = [False])";
nipkow@5323
    12
by(Simp_tac 1);
nipkow@5323
    13
qed "fin_atom";
nipkow@5323
    14
nipkow@5323
    15
Goalw [atom_def] "start (atom a) = [True]";
nipkow@5323
    16
by(Simp_tac 1);
nipkow@5323
    17
qed "start_atom";
nipkow@5323
    18
nipkow@5323
    19
Goalw [atom_def,step_def]
nipkow@5323
    20
 "(p,q) : step (atom a) b = (p=[True] & q=[False] & b=a)";
nipkow@5323
    21
by(Simp_tac 1);
nipkow@5323
    22
qed "in_step_atom_Some";
nipkow@5323
    23
Addsimps [in_step_atom_Some];
nipkow@5323
    24
nipkow@5323
    25
Goal
nipkow@5323
    26
 "([False],[False]) : steps (atom a) w = (w = [])";
nipkow@5323
    27
by (induct_tac "w" 1);
nipkow@5323
    28
 by(Simp_tac 1);
nipkow@5323
    29
by(asm_simp_tac (simpset() addsimps [comp_def]) 1);
nipkow@5323
    30
qed "False_False_in_steps_atom";
nipkow@5323
    31
nipkow@5323
    32
Goal
nipkow@5323
    33
 "(start (atom a), [False]) : steps (atom a) w = (w = [a])";
nipkow@5323
    34
by (induct_tac "w" 1);
nipkow@5323
    35
 by(asm_simp_tac (simpset() addsimps [start_atom]) 1);
nipkow@5323
    36
by(asm_full_simp_tac (simpset()
nipkow@5323
    37
     addsimps [False_False_in_steps_atom,comp_def,start_atom]) 1);
nipkow@5323
    38
qed "start_fin_in_steps_atom";
nipkow@5323
    39
nipkow@5323
    40
Goal
nipkow@5323
    41
 "accepts (atom a) w = (w = [a])";
nipkow@5323
    42
by(simp_tac(simpset() addsimps
nipkow@5323
    43
       [accepts_conv_steps,start_fin_in_steps_atom,fin_atom]) 1);
nipkow@5323
    44
qed "accepts_atom";
nipkow@5323
    45
nipkow@5323
    46
nipkow@5323
    47
(******************************************************)
nipkow@5323
    48
(*                      union                         *)
nipkow@5323
    49
(******************************************************)
nipkow@5323
    50
nipkow@5323
    51
(***** True/False ueber fin anheben *****)
nipkow@5323
    52
nipkow@5323
    53
Goalw [union_def] 
nipkow@5323
    54
 "!L R. fin (union L R) (True#p) = fin L p";
nipkow@5323
    55
by (Simp_tac 1);
nipkow@5323
    56
qed_spec_mp "fin_union_True";
nipkow@5323
    57
nipkow@5323
    58
Goalw [union_def] 
nipkow@5323
    59
 "!L R. fin (union L R) (False#p) = fin R p";
nipkow@5323
    60
by (Simp_tac 1);
nipkow@5323
    61
qed_spec_mp "fin_union_False";
nipkow@5323
    62
nipkow@5323
    63
AddIffs [fin_union_True,fin_union_False];
nipkow@5323
    64
nipkow@5323
    65
(***** True/False ueber step anheben *****)
nipkow@5323
    66
nipkow@5323
    67
Goalw [union_def,step_def]
nipkow@5323
    68
"!L R. (True#p,q) : step (union L R) a = (? r. q = True#r & (p,r) : step L a)";
nipkow@5323
    69
by (Simp_tac 1);
nipkow@5323
    70
by(Blast_tac 1);
nipkow@5323
    71
qed_spec_mp "True_in_step_union";
nipkow@5323
    72
nipkow@5323
    73
Goalw [union_def,step_def]
nipkow@5323
    74
"!L R. (False#p,q) : step (union L R) a = (? r. q = False#r & (p,r) : step R a)";
nipkow@5323
    75
by (Simp_tac 1);
nipkow@5323
    76
by(Blast_tac 1);
nipkow@5323
    77
qed_spec_mp "False_in_step_union";
nipkow@5323
    78
nipkow@5323
    79
AddIffs [True_in_step_union,False_in_step_union];
nipkow@5323
    80
nipkow@5323
    81
nipkow@5323
    82
(***** True/False ueber steps anheben *****)
nipkow@5323
    83
nipkow@5323
    84
Goal
nipkow@5323
    85
 "!p. (True#p,q):steps (union L R) w = (? r. q = True # r & (p,r):steps L w)";
nipkow@5323
    86
by (induct_tac "w" 1);
paulson@5457
    87
by Auto_tac;
nipkow@5323
    88
qed_spec_mp "lift_True_over_steps_union";
nipkow@5323
    89
nipkow@5323
    90
Goal 
nipkow@5323
    91
 "!p. (False#p,q):steps (union L R) w = (? r. q = False#r & (p,r):steps R w)";
nipkow@5323
    92
by (induct_tac "w" 1);
paulson@5457
    93
by Auto_tac;
nipkow@5323
    94
qed_spec_mp "lift_False_over_steps_union";
nipkow@5323
    95
nipkow@5323
    96
AddIffs [lift_True_over_steps_union,lift_False_over_steps_union];
nipkow@5323
    97
nipkow@5323
    98
nipkow@5323
    99
(** From the start  **)
nipkow@5323
   100
nipkow@5323
   101
Goalw [union_def,step_def]
nipkow@5323
   102
 "!L R. (start(union L R),q) : step(union L R) a = \
nipkow@5323
   103
\       (? p. (q = True#p & (start L,p) : step L a) | \
nipkow@5323
   104
\             (q = False#p & (start R,p) : step R a))";
nipkow@5323
   105
by(Simp_tac 1);
nipkow@5323
   106
by(Blast_tac 1);
nipkow@5323
   107
qed_spec_mp "start_step_union";
nipkow@5323
   108
AddIffs [start_step_union];
nipkow@5323
   109
nipkow@5323
   110
Goal
nipkow@5323
   111
 "(start(union L R), q) : steps (union L R) w = \
nipkow@5323
   112
\ ( (w = [] & q = start(union L R)) | \
nipkow@5323
   113
\   (w ~= [] & (? p.  q = True  # p & (start L,p) : steps L w | \
nipkow@5323
   114
\                     q = False # p & (start R,p) : steps R w)))";
nipkow@5323
   115
by(exhaust_tac "w" 1);
nipkow@5323
   116
 by (Asm_simp_tac 1);
nipkow@5323
   117
 by(Blast_tac 1);
nipkow@5323
   118
by (Asm_simp_tac 1);
nipkow@5323
   119
by(Blast_tac 1);
nipkow@5323
   120
qed "steps_union";
nipkow@5323
   121
nipkow@5323
   122
Goalw [union_def]
nipkow@5323
   123
 "!L R. fin (union L R) (start(union L R)) = \
nipkow@5323
   124
\       (fin L (start L) | fin R (start R))";
nipkow@5323
   125
by(Simp_tac 1);
nipkow@5323
   126
qed_spec_mp "fin_start_union";
nipkow@5323
   127
AddIffs [fin_start_union];
nipkow@5323
   128
nipkow@5323
   129
Goal
nipkow@5323
   130
 "accepts (union L R) w = (accepts L w | accepts R w)";
nipkow@5323
   131
by (simp_tac (simpset() addsimps [accepts_conv_steps,steps_union]) 1);
nipkow@5323
   132
(* get rid of case_tac: *)
nipkow@5323
   133
by(case_tac "w = []" 1);
nipkow@5323
   134
by(Auto_tac);
nipkow@5323
   135
qed "accepts_union";
nipkow@5323
   136
AddIffs [accepts_union];
nipkow@5323
   137
nipkow@5323
   138
(******************************************************)
nipkow@5323
   139
(*                      conc                        *)
nipkow@5323
   140
(******************************************************)
nipkow@5323
   141
nipkow@5323
   142
(** True/False in fin **)
nipkow@5323
   143
nipkow@5323
   144
Goalw [conc_def]
nipkow@5323
   145
 "!L R. fin (conc L R) (True#p) = (fin L p & fin R (start R))";
nipkow@5323
   146
by (Simp_tac 1);
nipkow@5323
   147
qed_spec_mp "fin_conc_True";
nipkow@5323
   148
nipkow@5323
   149
Goalw [conc_def] 
nipkow@5323
   150
 "!L R. fin (conc L R) (False#p) = fin R p";
nipkow@5323
   151
by (Simp_tac 1);
nipkow@5323
   152
qed "fin_conc_False";
nipkow@5323
   153
nipkow@5323
   154
AddIffs [fin_conc_True,fin_conc_False];
nipkow@5323
   155
nipkow@5323
   156
(** True/False in step **)
nipkow@5323
   157
nipkow@5323
   158
Goalw [conc_def,step_def]
nipkow@5323
   159
 "!L R. (True#p,q) : step (conc L R) a = \
nipkow@5323
   160
\       ((? r. q=True#r & (p,r): step L a) | \
nipkow@5323
   161
\        (fin L p & (? r. q=False#r & (start R,r) : step R a)))";
nipkow@5323
   162
by (Simp_tac 1);
nipkow@5323
   163
by(Blast_tac 1);
nipkow@5323
   164
qed_spec_mp "True_step_conc";
nipkow@5323
   165
nipkow@5323
   166
Goalw [conc_def,step_def]
nipkow@5323
   167
 "!L R. (False#p,q) : step (conc L R) a = \
nipkow@5323
   168
\       (? r. q = False#r & (p,r) : step R a)";
nipkow@5323
   169
by (Simp_tac 1);
nipkow@5323
   170
by(Blast_tac 1);
nipkow@5323
   171
qed_spec_mp "False_step_conc";
nipkow@5323
   172
nipkow@5323
   173
AddIffs [True_step_conc, False_step_conc];
nipkow@5323
   174
nipkow@5323
   175
(** False in steps **)
nipkow@5323
   176
nipkow@5323
   177
Goal
nipkow@5323
   178
 "!p. (False#p,q): steps (conc L R) w = (? r. q=False#r & (p,r): steps R w)";
nipkow@5323
   179
by (induct_tac "w" 1);
paulson@5457
   180
by Auto_tac;
nipkow@5323
   181
qed_spec_mp "False_steps_conc";
nipkow@5323
   182
AddIffs [False_steps_conc];
nipkow@5323
   183
nipkow@5323
   184
(** True in steps **)
nipkow@5323
   185
nipkow@5323
   186
Goal
nipkow@5323
   187
 "!!L R. !p. (p,q) : steps L w --> (True#p,True#q) : steps (conc L R) w";
nipkow@5323
   188
by(induct_tac "w" 1);
nipkow@5323
   189
 by (Simp_tac 1);
nipkow@5323
   190
by (Simp_tac 1);
nipkow@5323
   191
by(Blast_tac 1);
nipkow@5323
   192
qed_spec_mp "True_True_steps_concI";
nipkow@5323
   193
nipkow@5323
   194
Goal
nipkow@5323
   195
 "!L R. (True#p,False#q) : step (conc L R) a = \
nipkow@5323
   196
\       (fin L p & (start R,q) : step R a)";
nipkow@5323
   197
by(Simp_tac 1);
nipkow@5323
   198
qed "True_False_step_conc";
nipkow@5323
   199
AddIffs [True_False_step_conc];
nipkow@5323
   200
nipkow@5323
   201
Goal
nipkow@5323
   202
 "!p. (True#p,q) : steps (conc L R) w --> \
nipkow@5323
   203
\     ((? r. (p,r) : steps L w & q = True#r)  | \
nipkow@5323
   204
\  (? u a v. w = u@a#v & \
nipkow@5323
   205
\            (? r. (p,r) : steps L u & fin L r & \
nipkow@5323
   206
\            (? s. (start R,s) : step R a & \
nipkow@5323
   207
\            (? t. (s,t) : steps R v & q = False#t)))))";
nipkow@5323
   208
by(induct_tac "w" 1);
nipkow@5323
   209
 by(Simp_tac 1);
nipkow@5323
   210
by(Simp_tac 1);
nipkow@5323
   211
by(clarify_tac (claset() delrules [disjCI]) 1);
nipkow@5323
   212
be disjE 1;
nipkow@5323
   213
 by(clarify_tac (claset() delrules [disjCI]) 1);
nipkow@5323
   214
 by(etac allE 1 THEN mp_tac 1);
nipkow@5323
   215
 be disjE 1;
nipkow@5323
   216
  by (Blast_tac 1);
nipkow@5323
   217
 br disjI2 1;
nipkow@5323
   218
 by (Clarify_tac 1);
nipkow@5323
   219
 by(Simp_tac 1);
nipkow@5323
   220
 by(res_inst_tac[("x","a#u")] exI 1);
nipkow@5323
   221
 by(Simp_tac 1);
nipkow@5323
   222
 by (Blast_tac 1);
nipkow@5323
   223
br disjI2 1;
nipkow@5323
   224
by (Clarify_tac 1);
nipkow@5323
   225
by(Simp_tac 1);
nipkow@5323
   226
by(res_inst_tac[("x","[]")] exI 1);
nipkow@5323
   227
by(Simp_tac 1);
nipkow@5323
   228
by (Blast_tac 1);
nipkow@5323
   229
qed_spec_mp "True_steps_concD";
nipkow@5323
   230
nipkow@5323
   231
Goal
nipkow@5323
   232
 "(True#p,q) : steps (conc L R) w = \
nipkow@5323
   233
\ ((? r. (p,r) : steps L w & q = True#r)  | \
nipkow@5323
   234
\  (? u a v. w = u@a#v & \
nipkow@5323
   235
\            (? r. (p,r) : steps L u & fin L r & \
nipkow@5323
   236
\            (? s. (start R,s) : step R a & \
nipkow@5323
   237
\            (? t. (s,t) : steps R v & q = False#t)))))";
oheimb@5525
   238
by(force_tac (claset() addDs [True_steps_concD]
oheimb@5525
   239
     addIs [True_True_steps_concI],simpset()) 1);
nipkow@5323
   240
qed "True_steps_conc";
nipkow@5323
   241
nipkow@5323
   242
(** starting from the start **)
nipkow@5323
   243
nipkow@5323
   244
Goalw [conc_def]
nipkow@5323
   245
  "!L R. start(conc L R) = True#start L";
nipkow@5323
   246
by(Simp_tac 1);
nipkow@5323
   247
qed_spec_mp "start_conc";
nipkow@5323
   248
nipkow@5323
   249
Goalw [conc_def]
nipkow@5323
   250
 "!L R. fin(conc L R) p = ((fin R (start R) & (? s. p = True#s & fin L s)) | \
nipkow@5323
   251
\                          (? s. p = False#s & fin R s))";
nipkow@5323
   252
by (simp_tac (simpset() addsplits [list.split]) 1);
nipkow@5323
   253
by (Blast_tac 1);
nipkow@5323
   254
qed_spec_mp "final_conc";
nipkow@5323
   255
nipkow@5323
   256
Goal
nipkow@5323
   257
 "accepts (conc L R) w = (? u v. w = u@v & accepts L u & accepts R v)";
nipkow@5323
   258
by (simp_tac (simpset() addsimps
nipkow@5323
   259
     [accepts_conv_steps,True_steps_conc,final_conc,start_conc]) 1);
nipkow@5323
   260
br iffI 1;
nipkow@5323
   261
 by (Clarify_tac 1);
nipkow@5323
   262
 be disjE 1;
nipkow@5323
   263
  by (Clarify_tac 1);
nipkow@5323
   264
  be disjE 1;
nipkow@5323
   265
   by(res_inst_tac [("x","w")] exI 1);
nipkow@5323
   266
   by(Simp_tac 1);
nipkow@5323
   267
   by(Blast_tac 1);
nipkow@5323
   268
  by(Blast_tac 1);
nipkow@5323
   269
 be disjE 1;
nipkow@5323
   270
  by(Blast_tac 1);
nipkow@5323
   271
 by (Clarify_tac 1);
nipkow@5323
   272
 by(res_inst_tac [("x","u")] exI 1);
nipkow@5323
   273
 by(Simp_tac 1);
nipkow@5323
   274
 by(Blast_tac 1);
nipkow@5323
   275
by (Clarify_tac 1);
nipkow@5323
   276
by(exhaust_tac "v" 1);
nipkow@5323
   277
 by(Asm_full_simp_tac 1);
nipkow@5323
   278
 by(Blast_tac 1);
nipkow@5323
   279
by(Asm_full_simp_tac 1);
nipkow@5323
   280
by(Blast_tac 1);
nipkow@5323
   281
qed "accepts_conc";
nipkow@5323
   282
nipkow@5323
   283
(******************************************************)
nipkow@5323
   284
(*                     epsilon                        *)
nipkow@5323
   285
(******************************************************)
nipkow@5323
   286
nipkow@5323
   287
Goalw [epsilon_def,step_def] "step epsilon a = {}";
nipkow@5323
   288
by(Simp_tac 1);
nipkow@5323
   289
by(Blast_tac 1);
nipkow@5323
   290
qed "step_epsilon";
nipkow@5323
   291
Addsimps [step_epsilon];
nipkow@5323
   292
nipkow@5323
   293
Goal "((p,q) : steps epsilon w) = (w=[] & p=q)";
nipkow@5323
   294
by(induct_tac "w" 1);
nipkow@5323
   295
by(Auto_tac);
nipkow@5323
   296
qed "steps_epsilon";
nipkow@5323
   297
nipkow@5323
   298
Goal "accepts epsilon w = (w = [])";
nipkow@5323
   299
by(simp_tac (simpset() addsimps [steps_epsilon,accepts_conv_steps]) 1);
nipkow@5323
   300
by(simp_tac (simpset() addsimps [epsilon_def]) 1);
nipkow@5323
   301
qed "accepts_epsilon";
nipkow@5323
   302
AddIffs [accepts_epsilon];
nipkow@5323
   303
nipkow@5323
   304
(******************************************************)
nipkow@5323
   305
(*                       plus                         *)
nipkow@5323
   306
(******************************************************)
nipkow@5323
   307
nipkow@5323
   308
Goalw [plus_def] "!A. start (plus A) = start A";
nipkow@5323
   309
by(Simp_tac 1);
nipkow@5323
   310
qed_spec_mp "start_plus";
nipkow@5323
   311
Addsimps [start_plus];
nipkow@5323
   312
nipkow@5323
   313
Goalw [plus_def] "!A. fin (plus A) = fin A";
nipkow@5323
   314
by(Simp_tac 1);
nipkow@5323
   315
qed_spec_mp "fin_plus";
nipkow@5323
   316
AddIffs [fin_plus];
nipkow@5323
   317
nipkow@5323
   318
Goalw [plus_def,step_def]
nipkow@5323
   319
  "!A. (p,q) : step A a --> (p,q) : step (plus A) a";
nipkow@5323
   320
by(Simp_tac 1);
nipkow@5323
   321
qed_spec_mp "step_plusI";
nipkow@5323
   322
nipkow@5323
   323
Goal "!p. (p,q) : steps A w --> (p,q) : steps (plus A) w";
nipkow@5323
   324
by(induct_tac "w" 1);
nipkow@5323
   325
 by(Simp_tac 1);
nipkow@5323
   326
by(Simp_tac 1);
nipkow@5323
   327
by(blast_tac (claset() addIs [step_plusI]) 1);
nipkow@5323
   328
qed_spec_mp "steps_plusI";
nipkow@5323
   329
nipkow@5323
   330
Goalw [plus_def,step_def]
nipkow@5323
   331
 "!A. (p,r): step (plus A) a = \
nipkow@5323
   332
\     ( (p,r): step A a | fin A p & (start A,r) : step A a )";
nipkow@5323
   333
by(Simp_tac 1);
nipkow@5323
   334
qed_spec_mp "step_plus_conv";
nipkow@5323
   335
AddIffs [step_plus_conv];
nipkow@5323
   336
nipkow@5323
   337
Goal
nipkow@5323
   338
 "[| (start A,q) : steps A u; u ~= []; fin A p |] \
nipkow@5323
   339
\ ==> (p,q) : steps (plus A) u";
nipkow@5323
   340
by(exhaust_tac "u" 1);
nipkow@5323
   341
 by(Blast_tac 1);
nipkow@5323
   342
by(Asm_full_simp_tac 1);
nipkow@5323
   343
by(blast_tac (claset() addIs [steps_plusI]) 1);
nipkow@5323
   344
qed "fin_steps_plusI";
nipkow@5323
   345
nipkow@5323
   346
(* reverse list induction! Complicates matters for conc? *)
nipkow@5323
   347
Goal
nipkow@5323
   348
 "!r. (start A,r) : steps (plus A) w --> \
nipkow@5323
   349
\     (? us v. w = concat us @ v & \
nipkow@5323
   350
\              (!u:set us. u ~= [] & accepts A u) & \
nipkow@5323
   351
\              (start A,r) : steps A v)";
nipkow@5323
   352
by(rev_induct_tac "w" 1);
nipkow@5323
   353
 by (Simp_tac 1);
nipkow@5323
   354
 by(res_inst_tac [("x","[]")] exI 1);
nipkow@5323
   355
 by (Simp_tac 1);
nipkow@5323
   356
by (Simp_tac 1);
nipkow@5323
   357
by (Clarify_tac 1);
nipkow@5323
   358
by(etac allE 1 THEN mp_tac 1);
nipkow@5323
   359
by (Clarify_tac 1);
nipkow@5323
   360
be disjE 1;
nipkow@5323
   361
 by(res_inst_tac [("x","us")] exI 1);
nipkow@5323
   362
 by(Asm_simp_tac 1);
nipkow@5323
   363
 by(Blast_tac 1);
nipkow@5323
   364
by(exhaust_tac "v" 1);
nipkow@5323
   365
 by(res_inst_tac [("x","us")] exI 1);
nipkow@5323
   366
 by(Asm_full_simp_tac 1);
nipkow@5323
   367
by(res_inst_tac [("x","us@[v]")] exI 1);
nipkow@5323
   368
by(asm_full_simp_tac (simpset() addsimps [accepts_conv_steps]) 1);
nipkow@5323
   369
by(Blast_tac 1);
nipkow@5323
   370
qed_spec_mp "start_steps_plusD";
nipkow@5323
   371
nipkow@5323
   372
Goal
nipkow@5323
   373
 "!r. (start A,r) : steps (plus A) w --> \
nipkow@5323
   374
\     (? us v. w = concat us @ v & \
nipkow@5323
   375
\              (!u:set us. accepts A u) & \
nipkow@5323
   376
\              (start A,r) : steps A v)";
nipkow@5323
   377
by(rev_induct_tac "w" 1);
nipkow@5323
   378
 by (Simp_tac 1);
nipkow@5323
   379
 by(res_inst_tac [("x","[]")] exI 1);
nipkow@5323
   380
 by (Simp_tac 1);
nipkow@5323
   381
by (Simp_tac 1);
nipkow@5323
   382
by (Clarify_tac 1);
nipkow@5323
   383
by(etac allE 1 THEN mp_tac 1);
nipkow@5323
   384
by (Clarify_tac 1);
nipkow@5323
   385
be disjE 1;
nipkow@5323
   386
 by(res_inst_tac [("x","us")] exI 1);
nipkow@5323
   387
 by(Asm_simp_tac 1);
nipkow@5323
   388
 by(Blast_tac 1);
nipkow@5323
   389
by(res_inst_tac [("x","us@[v]")] exI 1);
nipkow@5323
   390
by(asm_full_simp_tac (simpset() addsimps [accepts_conv_steps]) 1);
nipkow@5323
   391
by(Blast_tac 1);
nipkow@5323
   392
qed_spec_mp "start_steps_plusD";
nipkow@5323
   393
nipkow@5323
   394
Goal
nipkow@5323
   395
 "us ~= [] --> (!u : set us. accepts A u) --> accepts (plus A) (concat us)";
nipkow@5323
   396
by(simp_tac (simpset() addsimps [accepts_conv_steps]) 1);
nipkow@5323
   397
by(rev_induct_tac "us" 1);
nipkow@5323
   398
 by(Simp_tac 1);
nipkow@5323
   399
by(rename_tac "u us" 1);
nipkow@5323
   400
by(Simp_tac 1);
nipkow@5323
   401
by (Clarify_tac 1);
nipkow@5323
   402
by(case_tac "us = []" 1);
nipkow@5323
   403
 by(Asm_full_simp_tac 1);
nipkow@5323
   404
 by(blast_tac (claset() addIs [steps_plusI,fin_steps_plusI]) 1);
nipkow@5323
   405
by (Clarify_tac 1);
nipkow@5323
   406
by(case_tac "u = []" 1);
nipkow@5323
   407
 by(Asm_full_simp_tac 1);
nipkow@5323
   408
 by(blast_tac (claset() addIs [steps_plusI,fin_steps_plusI]) 1);
nipkow@5323
   409
by(Asm_full_simp_tac 1);
nipkow@5323
   410
by(blast_tac (claset() addIs [steps_plusI,fin_steps_plusI]) 1);
nipkow@5323
   411
qed_spec_mp "steps_star_cycle";
nipkow@5323
   412
nipkow@5323
   413
Goal
nipkow@5323
   414
 "accepts (plus A) w = \
nipkow@5323
   415
\ (? us. us ~= [] & w = concat us & (!u : set us. accepts A u))";
nipkow@5323
   416
br iffI 1;
nipkow@5323
   417
 by(asm_full_simp_tac (simpset() addsimps [accepts_conv_steps]) 1);
nipkow@5323
   418
 by (Clarify_tac 1);
nipkow@5323
   419
 bd start_steps_plusD 1;
nipkow@5323
   420
 by (Clarify_tac 1);
nipkow@5323
   421
 by(res_inst_tac [("x","us@[v]")] exI 1);
nipkow@5323
   422
 by(asm_full_simp_tac (simpset() addsimps [accepts_conv_steps]) 1);
nipkow@5323
   423
 by(Blast_tac 1);
nipkow@5323
   424
by(blast_tac (claset() addIs [steps_star_cycle]) 1);
nipkow@5323
   425
qed "accepts_plus";
nipkow@5323
   426
AddIffs [accepts_plus];
nipkow@5323
   427
nipkow@5323
   428
(******************************************************)
nipkow@5323
   429
(*                       star                         *)
nipkow@5323
   430
(******************************************************)
nipkow@5323
   431
nipkow@5323
   432
Goalw [star_def]
nipkow@5323
   433
"accepts (star A) w = \
nipkow@5323
   434
\ (? us. (!u : set us. accepts A u) & w = concat us)";
nipkow@5323
   435
br iffI 1;
nipkow@5323
   436
 by (Clarify_tac 1);
nipkow@5323
   437
 be disjE 1;
nipkow@5323
   438
  by(res_inst_tac [("x","[]")] exI 1);
nipkow@5323
   439
  by(Simp_tac 1);
nipkow@5323
   440
  by(Blast_tac 1);
nipkow@5323
   441
 by(Blast_tac 1);
oheimb@5525
   442
by(Force_tac 1);
nipkow@5323
   443
qed "accepts_star";
nipkow@5323
   444
nipkow@5323
   445
(***** Correctness of r2n *****)
nipkow@5323
   446
nipkow@5323
   447
Goal
nipkow@5323
   448
 "!w. accepts (rexp2na r) w = (w : lang r)";
nipkow@5323
   449
by(induct_tac "r" 1);
nipkow@5323
   450
    by(simp_tac (simpset() addsimps [accepts_conv_steps]) 1);
nipkow@5323
   451
   by(simp_tac(simpset() addsimps [accepts_atom]) 1);
nipkow@5323
   452
  by(Asm_simp_tac 1);
nipkow@5323
   453
 by(asm_simp_tac (simpset() addsimps [accepts_conc,RegSet.conc_def]) 1);
nipkow@5323
   454
by(asm_simp_tac (simpset() addsimps [accepts_star,in_star]) 1);
nipkow@5323
   455
qed_spec_mp "accepts_rexp2na";