src/HOL/Lex/RegExp2NA.ML
author nipkow
Thu Dec 13 16:47:35 2001 +0100 (2001-12-13)
changeset 12487 bbd564190c9b
parent 11379 0c90ffd3f3e2
child 12792 b344226f924c
permissions -rw-r--r--
comp -> rel_comp
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])";
paulson@6162
    12
by (Simp_tac 1);
nipkow@5323
    13
qed "fin_atom";
nipkow@5323
    14
nipkow@5323
    15
Goalw [atom_def] "start (atom a) = [True]";
paulson@6162
    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)";
paulson@6162
    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);
paulson@6162
    28
 by (Simp_tac 1);
nipkow@12487
    29
by (asm_simp_tac (simpset() addsimps [rel_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);
paulson@6162
    35
 by (asm_simp_tac (simpset() addsimps [start_atom]) 1);
paulson@6162
    36
by (asm_full_simp_tac (simpset()
nipkow@12487
    37
     addsimps [False_False_in_steps_atom,rel_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])";
paulson@6162
    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);
paulson@6162
    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);
paulson@6162
    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);
oheimb@5758
    87
by (ALLGOALS Force_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);
oheimb@5758
    93
by (ALLGOALS Force_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))";
paulson@6162
   105
by (Simp_tac 1);
paulson@6162
   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)))";
wenzelm@8442
   115
by (case_tac "w" 1);
nipkow@5323
   116
 by (Asm_simp_tac 1);
paulson@6162
   117
 by (Blast_tac 1);
nipkow@5323
   118
by (Asm_simp_tac 1);
paulson@6162
   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))";
paulson@6162
   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: *)
paulson@6162
   133
by (case_tac "w = []" 1);
paulson@6162
   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);
paulson@6162
   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);
paulson@6162
   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);
oheimb@5758
   180
by (ALLGOALS Force_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";
paulson@6162
   188
by (induct_tac "w" 1);
nipkow@5323
   189
 by (Simp_tac 1);
nipkow@5323
   190
by (Simp_tac 1);
paulson@6162
   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)";
paulson@6162
   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)))))";
paulson@6162
   208
by (induct_tac "w" 1);
paulson@6162
   209
 by (Simp_tac 1);
paulson@6162
   210
by (Simp_tac 1);
paulson@6162
   211
by (clarify_tac (claset() delrules [disjCI]) 1);
paulson@6162
   212
by (etac disjE 1);
paulson@6162
   213
 by (clarify_tac (claset() delrules [disjCI]) 1);
paulson@6162
   214
 by (etac allE 1 THEN mp_tac 1);
paulson@6162
   215
 by (etac disjE 1);
nipkow@5323
   216
  by (Blast_tac 1);
paulson@6162
   217
 by (rtac disjI2 1);
nipkow@5323
   218
 by (Clarify_tac 1);
paulson@6162
   219
 by (Simp_tac 1);
paulson@6162
   220
 by (res_inst_tac[("x","a#u")] exI 1);
paulson@6162
   221
 by (Simp_tac 1);
nipkow@5323
   222
 by (Blast_tac 1);
paulson@6162
   223
by (rtac disjI2 1);
nipkow@5323
   224
by (Clarify_tac 1);
paulson@6162
   225
by (Simp_tac 1);
paulson@6162
   226
by (res_inst_tac[("x","[]")] exI 1);
paulson@6162
   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)))))";
paulson@6162
   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";
paulson@6162
   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);
paulson@6162
   260
by (rtac iffI 1);
nipkow@5323
   261
 by (Clarify_tac 1);
paulson@6162
   262
 by (etac disjE 1);
nipkow@5323
   263
  by (Clarify_tac 1);
paulson@6162
   264
  by (etac disjE 1);
paulson@6162
   265
   by (res_inst_tac [("x","w")] exI 1);
paulson@6162
   266
   by (Simp_tac 1);
paulson@6162
   267
   by (Blast_tac 1);
paulson@6162
   268
  by (Blast_tac 1);
paulson@6162
   269
 by (etac disjE 1);
paulson@6162
   270
  by (Blast_tac 1);
nipkow@5323
   271
 by (Clarify_tac 1);
paulson@6162
   272
 by (res_inst_tac [("x","u")] exI 1);
paulson@6162
   273
 by (Simp_tac 1);
paulson@6162
   274
 by (Blast_tac 1);
nipkow@5323
   275
by (Clarify_tac 1);
wenzelm@8442
   276
by (case_tac "v" 1);
paulson@6162
   277
 by (Asm_full_simp_tac 1);
paulson@6162
   278
 by (Blast_tac 1);
paulson@6162
   279
by (Asm_full_simp_tac 1);
paulson@6162
   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 = {}";
paulson@6162
   288
by (Simp_tac 1);
nipkow@5323
   289
qed "step_epsilon";
nipkow@5323
   290
Addsimps [step_epsilon];
nipkow@5323
   291
nipkow@5323
   292
Goal "((p,q) : steps epsilon w) = (w=[] & p=q)";
paulson@6162
   293
by (induct_tac "w" 1);
paulson@6162
   294
by (Auto_tac);
nipkow@5323
   295
qed "steps_epsilon";
nipkow@5323
   296
nipkow@5323
   297
Goal "accepts epsilon w = (w = [])";
paulson@6162
   298
by (simp_tac (simpset() addsimps [steps_epsilon,accepts_conv_steps]) 1);
paulson@6162
   299
by (simp_tac (simpset() addsimps [epsilon_def]) 1);
nipkow@5323
   300
qed "accepts_epsilon";
nipkow@5323
   301
AddIffs [accepts_epsilon];
nipkow@5323
   302
nipkow@5323
   303
(******************************************************)
nipkow@5323
   304
(*                       plus                         *)
nipkow@5323
   305
(******************************************************)
nipkow@5323
   306
nipkow@5323
   307
Goalw [plus_def] "!A. start (plus A) = start A";
paulson@6162
   308
by (Simp_tac 1);
nipkow@5323
   309
qed_spec_mp "start_plus";
nipkow@5323
   310
Addsimps [start_plus];
nipkow@5323
   311
nipkow@5323
   312
Goalw [plus_def] "!A. fin (plus A) = fin A";
paulson@6162
   313
by (Simp_tac 1);
nipkow@5323
   314
qed_spec_mp "fin_plus";
nipkow@5323
   315
AddIffs [fin_plus];
nipkow@5323
   316
nipkow@5323
   317
Goalw [plus_def,step_def]
nipkow@5323
   318
  "!A. (p,q) : step A a --> (p,q) : step (plus A) a";
paulson@6162
   319
by (Simp_tac 1);
nipkow@5323
   320
qed_spec_mp "step_plusI";
nipkow@5323
   321
nipkow@5323
   322
Goal "!p. (p,q) : steps A w --> (p,q) : steps (plus A) w";
paulson@6162
   323
by (induct_tac "w" 1);
paulson@6162
   324
 by (Simp_tac 1);
paulson@6162
   325
by (Simp_tac 1);
paulson@6162
   326
by (blast_tac (claset() addIs [step_plusI]) 1);
nipkow@5323
   327
qed_spec_mp "steps_plusI";
nipkow@5323
   328
nipkow@5323
   329
Goalw [plus_def,step_def]
nipkow@5323
   330
 "!A. (p,r): step (plus A) a = \
nipkow@5323
   331
\     ( (p,r): step A a | fin A p & (start A,r) : step A a )";
paulson@6162
   332
by (Simp_tac 1);
nipkow@5323
   333
qed_spec_mp "step_plus_conv";
nipkow@5323
   334
AddIffs [step_plus_conv];
nipkow@5323
   335
nipkow@5323
   336
Goal
nipkow@5323
   337
 "[| (start A,q) : steps A u; u ~= []; fin A p |] \
nipkow@5323
   338
\ ==> (p,q) : steps (plus A) u";
wenzelm@8442
   339
by (case_tac "u" 1);
paulson@6162
   340
 by (Blast_tac 1);
paulson@6162
   341
by (Asm_full_simp_tac 1);
paulson@6162
   342
by (blast_tac (claset() addIs [steps_plusI]) 1);
nipkow@5323
   343
qed "fin_steps_plusI";
nipkow@5323
   344
nipkow@5323
   345
(* reverse list induction! Complicates matters for conc? *)
nipkow@5323
   346
Goal
nipkow@5323
   347
 "!r. (start A,r) : steps (plus A) w --> \
nipkow@5323
   348
\     (? us v. w = concat us @ v & \
nipkow@5323
   349
\              (!u:set us. accepts A u) & \
nipkow@5323
   350
\              (start A,r) : steps A v)";
paulson@6162
   351
by (rev_induct_tac "w" 1);
nipkow@5323
   352
 by (Simp_tac 1);
paulson@6162
   353
 by (res_inst_tac [("x","[]")] exI 1);
nipkow@5323
   354
 by (Simp_tac 1);
nipkow@5323
   355
by (Simp_tac 1);
nipkow@5323
   356
by (Clarify_tac 1);
paulson@6162
   357
by (etac allE 1 THEN mp_tac 1);
nipkow@5323
   358
by (Clarify_tac 1);
paulson@6162
   359
by (etac disjE 1);
paulson@6162
   360
 by (res_inst_tac [("x","us")] exI 1);
paulson@6162
   361
 by (Asm_simp_tac 1);
paulson@6162
   362
 by (Blast_tac 1);
paulson@6162
   363
by (res_inst_tac [("x","us@[v]")] exI 1);
paulson@6162
   364
by (asm_full_simp_tac (simpset() addsimps [accepts_conv_steps]) 1);
paulson@6162
   365
by (Blast_tac 1);
nipkow@5323
   366
qed_spec_mp "start_steps_plusD";
nipkow@5323
   367
nipkow@5323
   368
Goal
nipkow@5323
   369
 "us ~= [] --> (!u : set us. accepts A u) --> accepts (plus A) (concat us)";
paulson@6162
   370
by (simp_tac (simpset() addsimps [accepts_conv_steps]) 1);
paulson@6162
   371
by (rev_induct_tac "us" 1);
paulson@6162
   372
 by (Simp_tac 1);
paulson@6162
   373
by (rename_tac "u us" 1);
paulson@6162
   374
by (Simp_tac 1);
nipkow@5323
   375
by (Clarify_tac 1);
paulson@6162
   376
by (case_tac "us = []" 1);
paulson@6162
   377
 by (Asm_full_simp_tac 1);
paulson@6162
   378
 by (blast_tac (claset() addIs [steps_plusI,fin_steps_plusI]) 1);
nipkow@5323
   379
by (Clarify_tac 1);
paulson@6162
   380
by (case_tac "u = []" 1);
paulson@6162
   381
 by (Asm_full_simp_tac 1);
paulson@6162
   382
 by (blast_tac (claset() addIs [steps_plusI,fin_steps_plusI]) 1);
paulson@6162
   383
by (Asm_full_simp_tac 1);
paulson@6162
   384
by (blast_tac (claset() addIs [steps_plusI,fin_steps_plusI]) 1);
nipkow@5323
   385
qed_spec_mp "steps_star_cycle";
nipkow@5323
   386
nipkow@5323
   387
Goal
nipkow@5323
   388
 "accepts (plus A) w = \
nipkow@5323
   389
\ (? us. us ~= [] & w = concat us & (!u : set us. accepts A u))";
paulson@6162
   390
by (rtac iffI 1);
paulson@6162
   391
 by (asm_full_simp_tac (simpset() addsimps [accepts_conv_steps]) 1);
nipkow@5323
   392
 by (Clarify_tac 1);
paulson@6162
   393
 by (dtac start_steps_plusD 1);
nipkow@5323
   394
 by (Clarify_tac 1);
paulson@6162
   395
 by (res_inst_tac [("x","us@[v]")] exI 1);
paulson@6162
   396
 by (asm_full_simp_tac (simpset() addsimps [accepts_conv_steps]) 1);
paulson@6162
   397
 by (Blast_tac 1);
paulson@6162
   398
by (blast_tac (claset() addIs [steps_star_cycle]) 1);
nipkow@5323
   399
qed "accepts_plus";
nipkow@5323
   400
AddIffs [accepts_plus];
nipkow@5323
   401
nipkow@5323
   402
(******************************************************)
nipkow@5323
   403
(*                       star                         *)
nipkow@5323
   404
(******************************************************)
nipkow@5323
   405
nipkow@5323
   406
Goalw [star_def]
nipkow@5323
   407
"accepts (star A) w = \
nipkow@5323
   408
\ (? us. (!u : set us. accepts A u) & w = concat us)";
paulson@6162
   409
by (rtac iffI 1);
nipkow@5323
   410
 by (Clarify_tac 1);
paulson@6162
   411
 by (etac disjE 1);
paulson@6162
   412
  by (res_inst_tac [("x","[]")] exI 1);
paulson@6162
   413
  by (Simp_tac 1);
paulson@6162
   414
  by (Blast_tac 1);
paulson@6162
   415
 by (Blast_tac 1);
paulson@6162
   416
by (Force_tac 1);
nipkow@5323
   417
qed "accepts_star";
nipkow@5323
   418
nipkow@5323
   419
(***** Correctness of r2n *****)
nipkow@5323
   420
nipkow@5323
   421
Goal
nipkow@5323
   422
 "!w. accepts (rexp2na r) w = (w : lang r)";
paulson@6162
   423
by (induct_tac "r" 1);
paulson@6162
   424
    by (simp_tac (simpset() addsimps [accepts_conv_steps]) 1);
paulson@6162
   425
   by (simp_tac(simpset() addsimps [accepts_atom]) 1);
paulson@6162
   426
  by (Asm_simp_tac 1);
paulson@6162
   427
 by (asm_simp_tac (simpset() addsimps [accepts_conc,RegSet.conc_def]) 1);
paulson@6162
   428
by (asm_simp_tac (simpset() addsimps [accepts_star,in_star]) 1);
nipkow@5323
   429
qed_spec_mp "accepts_rexp2na";