Myhill.thy
author wu
Fri, 31 Dec 2010 13:47:53 +0000
changeset 28 cef2893f353b
parent 27 90a57a533b0c
child 29 c64241fa4dff
permissions -rw-r--r--
Rewritten of hard direction once more. To make it looking better.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
     1
theory MyhillNerode
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
     2
  imports "Main" "List_Prefix"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
     3
begin
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
     4
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
     5
text {* sequential composition of languages *}
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
     6
definition
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
     7
  Seq :: "string set \<Rightarrow> string set \<Rightarrow> string set" ("_ ;; _" [100,100] 100)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
     8
where 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
     9
  "L1 ;; L2 = {s1 @ s2 | s1 s2. s1 \<in> L1 \<and> s2 \<in> L2}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    10
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    11
inductive_set
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    12
  Star :: "string set \<Rightarrow> string set" ("_\<star>" [101] 102)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    13
  for L :: "string set"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    14
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    15
  start[intro]: "[] \<in> L\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    16
| step[intro]:  "\<lbrakk>s1 \<in> L; s2 \<in> L\<star>\<rbrakk> \<Longrightarrow> s1@s2 \<in> L\<star>" 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    17
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    18
lemma seq_union_distrib:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    19
  "(A \<union> B) ;; C = (A ;; C) \<union> (B ;; C)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    20
by (auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    21
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    22
lemma seq_assoc:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    23
  "(A ;; B) ;; C = A ;; (B ;; C)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    24
unfolding Seq_def
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    25
apply(auto)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    26
apply(metis)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    27
by (metis append_assoc)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    29
lemma union_seq:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    30
  "\<Union> {f x y ;; z| x y. P x y } = (\<Union> {f x y|x y. P x y });; z"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    31
apply (auto simp add:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    32
apply metis
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    33
done
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    34
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    35
theorem ardens_revised:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    36
  assumes nemp: "[] \<notin> A"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    37
  shows "(X = X ;; A \<union> B) \<longleftrightarrow> (X = B ;; A\<star>)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    38
proof
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    39
  assume eq: "X = B ;; A\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    40
  have "A\<star> =  {[]} \<union> A\<star> ;; A" sorry
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    41
  then have "B ;; A\<star> = B ;; ({[]} \<union> A\<star> ;; A)" unfolding Seq_def by simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    42
  also have "\<dots> = B \<union> B ;; (A\<star> ;; A)"  unfolding Seq_def by auto
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    43
  also have "\<dots> = B \<union> (B ;; A\<star>) ;; A"  unfolding Seq_def
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    44
    by (auto) (metis append_assoc)+
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    45
  finally show "X = X ;; A \<union> B" using eq by auto
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    46
next
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    47
  assume "X = X ;; A \<union> B"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    48
  then have "B \<subseteq> X" "X ;; A \<subseteq> X" by auto
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    49
  show "X = B ;; A\<star>" sorry
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    50
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    51
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    52
datatype rexp =
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    53
  NULL
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    54
| EMPTY
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    55
| CHAR char
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    56
| SEQ rexp rexp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    57
| ALT rexp rexp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    58
| STAR rexp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    59
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    60
consts L:: "'a \<Rightarrow> string set"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    61
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    62
overloading L_rexp \<equiv> "L::  rexp \<Rightarrow> string set"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    63
begin
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    64
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    65
fun
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    66
  L_rexp :: "rexp \<Rightarrow> string set"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    67
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    68
    "L_rexp (NULL) = {}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    69
  | "L_rexp (EMPTY) = {[]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    70
  | "L_rexp (CHAR c) = {[c]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    71
  | "L_rexp (SEQ r1 r2) = (L_rexp r1) ;; (L_rexp r2)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    72
  | "L_rexp (ALT r1 r2) = (L_rexp r1) \<union> (L_rexp r2)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    73
  | "L_rexp (STAR r) = (L_rexp r)\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    74
end
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    75
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    76
definition 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    77
  folds :: "('a \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> 'b \<Rightarrow> 'a set \<Rightarrow> 'b"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    78
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    79
  "folds f z S \<equiv> SOME x. fold_graph f z S x"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    80
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    81
lemma folds_alt_simp [simp]:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    82
  "finite rs \<Longrightarrow> L (folds ALT NULL rs) = \<Union> (L ` rs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    83
apply (rule set_ext, simp add:folds_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    84
apply (rule someI2_ex, erule finite_imp_fold_graph)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    85
by (erule fold_graph.induct, auto)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    86
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    87
lemma [simp]:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    88
  shows "(x, y) \<in> {(x, y). P x y} \<longleftrightarrow> P x y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    89
by simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    90
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    91
definition
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    92
  str_eq ("_ \<approx>_ _")
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    93
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    94
  "x \<approx>Lang y \<equiv> (\<forall>z. x @ z \<in> Lang \<longleftrightarrow> y @ z \<in> Lang)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    95
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    96
definition
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    97
  str_eq_rel ("\<approx>_")
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    98
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    99
  "\<approx>Lang \<equiv> {(x, y). x \<approx>Lang y}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   100
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   101
definition
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   102
  final :: "string set \<Rightarrow> string set \<Rightarrow> bool"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   103
where
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   104
  "final X Lang \<equiv> (X \<in> UNIV // \<approx>Lang) \<and> (\<forall>s \<in> X. s \<in> Lang)"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   105
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   106
lemma lang_is_union_of_finals: 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   107
  "Lang = \<Union> {X. final X Lang}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   108
proof 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   109
  show "Lang \<subseteq> \<Union> {X. final X Lang}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   110
  proof
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   111
    fix x
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   112
    assume "x \<in> Lang"   
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   113
    thus "x \<in> \<Union> {X. final X Lang}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   114
      apply (simp, rule_tac x = "(\<approx>Lang) `` {x}" in exI)      
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   115
      apply (auto simp:final_def quotient_def Image_def str_eq_rel_def str_eq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   116
      by (drule_tac x = "[]" in spec, simp)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   117
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   118
next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   119
  show "\<Union>{X. final X Lang} \<subseteq> Lang"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   120
    by (auto simp:final_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   121
qed
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   122
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   123
section {* finite \<Rightarrow> regular *}
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   124
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   125
datatype rhs_item = 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   126
   Lam "rexp"                           (* Lambda *)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   127
 | Trn "string set" "rexp"              (* Transition *)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   128
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   129
fun the_Trn:: "rhs_item \<Rightarrow> (string set \<times> rexp)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   130
where "the_Trn (Trn Y r) = (Y, r)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   131
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   132
fun the_r :: "rhs_item \<Rightarrow> rexp"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   133
where "the_r (Lam r) = r"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   134
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   135
overloading L_rhs_e \<equiv> "L:: rhs_item \<Rightarrow> string set"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   136
begin
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   137
fun L_rhs_e:: "rhs_item \<Rightarrow> string set"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   138
where
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   139
  "L_rhs_e (Lam r) = L r" |
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   140
  "L_rhs_e (Trn X r) = X ;; L r"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   141
end
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   142
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   143
overloading L_rhs \<equiv> "L:: rhs_item set \<Rightarrow> string set"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   144
begin
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   145
fun L_rhs:: "rhs_item set \<Rightarrow> string set"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   146
where
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   147
  "L_rhs rhs = \<Union> (L ` rhs)"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   148
end
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   149
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   150
definition
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   151
  "init_rhs CS X \<equiv>  if ([] \<in> X)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   152
                    then {Lam EMPTY} \<union> {Trn Y (CHAR c)| Y c. Y \<in> CS \<and> Y ;; {[c]} \<subseteq> X}
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   153
                    else {Trn Y (CHAR c)| Y c. Y \<in> CS \<and> Y ;; {[c]} \<subseteq> X}"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   154
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   155
definition
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   156
  "eqs CS \<equiv> {(X, init_rhs CS X)|X.  X \<in> CS}"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   157
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   158
(************ arden's lemma variation ********************)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   159
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   160
definition
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   161
  "items_of rhs X \<equiv> {Trn X r | r. (Trn X r) \<in> rhs}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   162
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   163
definition
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   164
  "lam_of rhs \<equiv> {Lam r | r. Lam r \<in> rhs}"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   165
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   166
definition 
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   167
  "rexp_of rhs X \<equiv> folds ALT NULL ((snd o the_Trn) ` items_of rhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   168
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   169
definition
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   170
  "rexp_of_lam rhs \<equiv> folds ALT NULL (the_r ` lam_of rhs)"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   171
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   172
fun attach_rexp :: "rexp \<Rightarrow> rhs_item \<Rightarrow> rhs_item"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   173
where
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   174
  "attach_rexp r' (Lam r)   = Lam (SEQ r r')"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   175
| "attach_rexp r' (Trn X r) = Trn X (SEQ r r')"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   176
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   177
definition
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   178
  "append_rhs_rexp rhs r \<equiv> (attach_rexp r) ` rhs"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   179
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   180
definition 
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   181
  "arden_variate X rhs \<equiv> append_rhs_rexp (rhs - items_of rhs X) (STAR (rexp_of rhs X))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   182
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   183
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   184
(*********** substitution of ES *************)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   185
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   186
text {* rhs_subst rhs X xrhs: substitude all occurence of X in rhs with xrhs *}
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   187
definition 
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   188
  "rhs_subst rhs X xrhs \<equiv> (rhs - (items_of rhs X)) \<union> (append_rhs_rexp xrhs (rexp_of rhs X))"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   189
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   190
definition
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   191
  "eqs_subst ES X xrhs \<equiv> {(Y, rhs_subst yrhs X xrhs) | Y yrhs. (Y, yrhs) \<in> ES}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   192
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   193
text {*
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   194
  Inv: Invairance of the equation-system, during the decrease of the equation-system, Inv holds.
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   195
*}
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   196
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   197
definition 
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   198
  "distinct_equas ES \<equiv> \<forall> X rhs rhs'. (X, rhs) \<in> ES \<and> (X, rhs') \<in> ES \<longrightarrow> rhs = rhs'"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   199
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   200
definition 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   201
  "valid_eqns ES \<equiv> \<forall> X rhs. (X, rhs) \<in> ES \<longrightarrow> (X = L rhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   202
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   203
definition 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   204
  "rhs_nonempty rhs \<equiv> (\<forall> Y r. Trn Y r \<in> rhs \<longrightarrow> [] \<notin> L r)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   205
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   206
definition 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   207
  "ardenable ES \<equiv> \<forall> X rhs. (X, rhs) \<in> ES \<longrightarrow> rhs_nonempty rhs"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   208
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   209
definition 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   210
  "non_empty ES \<equiv> \<forall> X rhs. (X, rhs) \<in> ES \<longrightarrow> X \<noteq> {}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   211
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   212
definition
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   213
  "finite_rhs ES \<equiv> \<forall> X rhs. (X, rhs) \<in> ES \<longrightarrow> finite rhs"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   214
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   215
definition 
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   216
  "classes_of rhs \<equiv> {X. \<exists> r. Trn X r \<in> rhs}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   217
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   218
definition
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   219
  "lefts_of ES \<equiv> {Y | Y yrhs. (Y, yrhs) \<in> ES}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   220
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   221
definition 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   222
  "self_contained ES \<equiv> \<forall> (X, xrhs) \<in> ES. classes_of xrhs \<subseteq> lefts_of ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   223
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   224
definition 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   225
  "Inv ES \<equiv> valid_eqns ES \<and> finite ES \<and> distinct_equas ES \<and> ardenable ES \<and> 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   226
            non_empty ES \<and> finite_rhs ES \<and> self_contained ES"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   227
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   228
lemma wf_iter [rule_format]: 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   229
  fixes f
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   230
  assumes step: "\<And> e. \<lbrakk>P e; \<not> Q e\<rbrakk> \<Longrightarrow> (\<exists> e'. P e' \<and>  (f(e'), f(e)) \<in> less_than)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   231
  shows pe:     "P e \<longrightarrow> (\<exists> e'. P e' \<and>  Q e')"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   232
proof(induct e rule: wf_induct 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   233
           [OF wf_inv_image[OF wf_less_than, where f = "f"]], clarify)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   234
  fix x 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   235
  assume h [rule_format]: 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   236
    "\<forall>y. (y, x) \<in> inv_image less_than f \<longrightarrow> P y \<longrightarrow> (\<exists>e'. P e' \<and> Q e')"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   237
    and px: "P x"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   238
  show "\<exists>e'. P e' \<and> Q e'"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   239
  proof(cases "Q x")
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   240
    assume "Q x" with px show ?thesis by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   241
  next
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   242
    assume nq: "\<not> Q x"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   243
    from step [OF px nq]
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   244
    obtain e' where pe': "P e'" and ltf: "(f e', f x) \<in> less_than" by auto
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   245
    show ?thesis
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   246
    proof(rule h)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   247
      from ltf show "(e', x) \<in> inv_image less_than f" 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   248
	by (simp add:inv_image_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   249
    next
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   250
      from pe' show "P e'" .
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   251
    qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   252
  qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   253
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   254
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   255
text {* ************* basic properties of definitions above ************************ *}
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   256
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   257
lemma L_rhs_union_distrib:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   258
  " L (A::rhs_item set) \<union> L B = L (A \<union> B)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   259
by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   260
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   261
lemma finite_snd_Trn:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   262
  assumes finite:"finite rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   263
  shows "finite {r\<^isub>2. Trn Y r\<^isub>2 \<in> rhs}" (is "finite ?B")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   264
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   265
  def rhs' \<equiv> "{e \<in> rhs. \<exists> r. e = Trn Y r}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   266
  have "?B = (snd o the_Trn) ` rhs'" using rhs'_def by (auto simp:image_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   267
  moreover have "finite rhs'" using finite rhs'_def by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   268
  ultimately show ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   269
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   270
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   271
lemma rexp_of_empty:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   272
  assumes finite:"finite rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   273
  and nonempty:"rhs_nonempty rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   274
  shows "[] \<notin> L (rexp_of rhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   275
using finite nonempty rhs_nonempty_def
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   276
by (drule_tac finite_snd_Trn[where Y = X], auto simp:rexp_of_def items_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   277
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   278
lemma [intro!]:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   279
  "P (Trn X r) \<Longrightarrow> (\<exists>a. (\<exists>r. a = Trn X r \<and> P a))" by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   280
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   281
lemma finite_items_of:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   282
  "finite rhs \<Longrightarrow> finite (items_of rhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   283
by (auto simp:items_of_def intro:finite_subset)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   284
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   285
lemma lang_of_rexp_of:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   286
  assumes finite:"finite rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   287
  shows "L (items_of rhs X) = X ;; (L (rexp_of rhs X))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   288
proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   289
  have "finite ((snd \<circ> the_Trn) ` items_of rhs X)" using finite_items_of[OF finite] by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   290
  thus ?thesis
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   291
    apply (auto simp:rexp_of_def Seq_def items_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   292
    apply (rule_tac x = s1 in exI, rule_tac x = s2 in exI, auto)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   293
    by (rule_tac x= "Trn X r" in exI, auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   294
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   295
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   296
lemma rexp_of_lam_eq_lam_set:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   297
  assumes finite: "finite rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   298
  shows "L (rexp_of_lam rhs) = L (lam_of rhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   299
proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   300
  have "finite (the_r ` {Lam r |r. Lam r \<in> rhs})" using finite
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   301
    by (rule_tac finite_imageI, auto intro:finite_subset)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   302
  thus ?thesis by (auto simp:rexp_of_lam_def lam_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   303
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   304
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   305
lemma [simp]:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   306
  " L (attach_rexp r xb) = L xb ;; L r"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   307
apply (cases xb, auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   308
by (rule_tac x = "s1 @ s1a" in exI, rule_tac x = s2a in exI,auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   309
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   310
lemma lang_of_append_rhs:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   311
  "L (append_rhs_rexp rhs r) = L rhs ;; L r"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   312
apply (auto simp:append_rhs_rexp_def image_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   313
apply (auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   314
apply (rule_tac x = "L xb ;; L r" in exI, auto simp add:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   315
by (rule_tac x = "attach_rexp r xb" in exI, auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   316
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   317
lemma classes_of_union_distrib:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   318
  "classes_of A \<union> classes_of B = classes_of (A \<union> B)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   319
by (auto simp add:classes_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   320
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   321
lemma lefts_of_union_distrib:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   322
  "lefts_of A \<union> lefts_of B = lefts_of (A \<union> B)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   323
by (auto simp:lefts_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   324
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   325
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   326
text {* ******BEGIN: proving the initial equation-system satisfies Inv ****** *}
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   327
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   328
lemma defined_by_str:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   329
  "\<lbrakk>s \<in> X; X \<in> UNIV // (\<approx>Lang)\<rbrakk> \<Longrightarrow> X = (\<approx>Lang) `` {s}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   330
by (auto simp:quotient_def Image_def str_eq_rel_def str_eq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   331
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   332
lemma every_eqclass_has_transition:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   333
  assumes has_str: "s @ [c] \<in> X"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   334
  and     in_CS:   "X \<in> UNIV // (\<approx>Lang)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   335
  obtains Y where "Y \<in> UNIV // (\<approx>Lang)" and "Y ;; {[c]} \<subseteq> X" and "s \<in> Y"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   336
proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   337
  def Y \<equiv> "(\<approx>Lang) `` {s}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   338
  have "Y \<in> UNIV // (\<approx>Lang)" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   339
    unfolding Y_def quotient_def by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   340
  moreover
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   341
  have "X = (\<approx>Lang) `` {s @ [c]}" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   342
    using has_str in_CS defined_by_str by blast
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   343
  then have "Y ;; {[c]} \<subseteq> X" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   344
    unfolding Y_def Image_def Seq_def
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   345
    unfolding str_eq_rel_def
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   346
    by (auto) (simp add: str_eq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   347
  moreover
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   348
  have "s \<in> Y" unfolding Y_def 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   349
    unfolding Image_def str_eq_rel_def str_eq_def by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   350
  ultimately show thesis by (blast intro: that)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   351
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   352
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   353
lemma l_eq_r_in_eqs:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   354
  assumes X_in_eqs: "(X, xrhs) \<in> (eqs (UNIV // (\<approx>Lang)))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   355
  shows "X = L xrhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   356
proof 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   357
  show "X \<subseteq> L xrhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   358
  proof
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   359
    fix x
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   360
    assume "(1)": "x \<in> X"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   361
    show "x \<in> L xrhs"          
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   362
    proof (cases "x = []")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   363
      assume empty: "x = []"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   364
      thus ?thesis using X_in_eqs "(1)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   365
        by (auto simp:eqs_def init_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   366
    next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   367
      assume not_empty: "x \<noteq> []"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   368
      then obtain clist c where decom: "x = clist @ [c]"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   369
        by (case_tac x rule:rev_cases, auto)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   370
      have "X \<in> UNIV // (\<approx>Lang)" using X_in_eqs by (auto simp:eqs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   371
      then obtain Y 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   372
        where "Y \<in> UNIV // (\<approx>Lang)" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   373
        and "Y ;; {[c]} \<subseteq> X"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   374
        and "clist \<in> Y"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   375
        using decom "(1)" every_eqclass_has_transition by blast
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   376
      hence "x \<in> L {Trn Y (CHAR c)| Y c. Y \<in> UNIV // (\<approx>Lang) \<and> Y ;; {[c]} \<subseteq> X}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   377
        using "(1)" decom
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   378
        by (simp, rule_tac x = "Trn Y (CHAR c)" in exI, simp add:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   379
      thus ?thesis using X_in_eqs "(1)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   380
        by (simp add:eqs_def init_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   381
    qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   382
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   383
next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   384
  show "L xrhs \<subseteq> X" using X_in_eqs
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   385
    by (auto simp:eqs_def init_rhs_def) 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   386
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   387
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   388
lemma finite_init_rhs: 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   389
  assumes finite: "finite CS"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   390
  shows "finite (init_rhs CS X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   391
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   392
  have "finite {Trn Y (CHAR c) |Y c. Y \<in> CS \<and> Y ;; {[c]} \<subseteq> X}" (is "finite ?A")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   393
  proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   394
    def S \<equiv> "{(Y, c)| Y c. Y \<in> CS \<and> Y ;; {[c]} \<subseteq> X}" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   395
    def h \<equiv> "\<lambda> (Y, c). Trn Y (CHAR c)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   396
    have "finite (CS \<times> (UNIV::char set))" using finite by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   397
    hence "finite S" using S_def 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   398
      by (rule_tac B = "CS \<times> UNIV" in finite_subset, auto)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   399
    moreover have "?A = h ` S" by (auto simp: S_def h_def image_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   400
    ultimately show ?thesis 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   401
      by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   402
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   403
  thus ?thesis by (simp add:init_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   404
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   405
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   406
lemma init_ES_satisfy_Inv:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   407
  assumes finite_CS: "finite (UNIV // (\<approx>Lang))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   408
  shows "Inv (eqs (UNIV // (\<approx>Lang)))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   409
proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   410
  have "finite (eqs (UNIV // (\<approx>Lang)))" using finite_CS
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   411
    by (simp add:eqs_def)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   412
  moreover have "distinct_equas (eqs (UNIV // (\<approx>Lang)))"     
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   413
    by (simp add:distinct_equas_def eqs_def)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   414
  moreover have "ardenable (eqs (UNIV // (\<approx>Lang)))"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   415
    by (auto simp add:ardenable_def eqs_def init_rhs_def rhs_nonempty_def del:L_rhs.simps)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   416
  moreover have "valid_eqns (eqs (UNIV // (\<approx>Lang)))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   417
    using l_eq_r_in_eqs by (simp add:valid_eqns_def)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   418
  moreover have "non_empty (eqs (UNIV // (\<approx>Lang)))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   419
    by (auto simp:non_empty_def eqs_def quotient_def Image_def str_eq_rel_def str_eq_def)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   420
  moreover have "finite_rhs (eqs (UNIV // (\<approx>Lang)))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   421
    using finite_init_rhs[OF finite_CS] 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   422
    by (auto simp:finite_rhs_def eqs_def)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   423
  moreover have "self_contained (eqs (UNIV // (\<approx>Lang)))"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   424
    by (auto simp:self_contained_def eqs_def init_rhs_def classes_of_def lefts_of_def)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   425
  ultimately show ?thesis by (simp add:Inv_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   426
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   427
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   428
text {* ****** BEGIN: proving every equation-system's iteration step satisfies Inv ***** *}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   429
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   430
lemma arden_variate_keeps_eq:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   431
  assumes l_eq_r: "X = L rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   432
  and not_empty: "[] \<notin> L (rexp_of rhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   433
  and finite: "finite rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   434
  shows "X = L (arden_variate X rhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   435
proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   436
  def A \<equiv> "L (rexp_of rhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   437
  def b \<equiv> "rhs - items_of rhs X"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   438
  def B \<equiv> "L b" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   439
  have "X = B ;; A\<star>"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   440
  proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   441
    have "rhs = items_of rhs X \<union> b" by (auto simp:b_def items_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   442
    hence "L rhs = L(items_of rhs X \<union> b)" by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   443
    hence "L rhs = L(items_of rhs X) \<union> B" by (simp only:L_rhs_union_distrib B_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   444
    with lang_of_rexp_of
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   445
    have "L rhs = X ;; A \<union> B " using finite by (simp only:B_def b_def A_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   446
    thus ?thesis
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   447
      using l_eq_r not_empty
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   448
      apply (drule_tac B = B and X = X in ardens_revised)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   449
      by (auto simp:A_def simp del:L_rhs.simps)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   450
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   451
  moreover have "L (arden_variate X rhs) = (B ;; A\<star>)" (is "?L = ?R")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   452
    by (simp only:arden_variate_def L_rhs_union_distrib lang_of_append_rhs 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   453
                  B_def A_def b_def L_rexp.simps seq_union_distrib)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   454
   ultimately show ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   455
qed 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   456
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   457
lemma append_keeps_finite:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   458
  "finite rhs \<Longrightarrow> finite (append_rhs_rexp rhs r)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   459
by (auto simp:append_rhs_rexp_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   460
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   461
lemma arden_variate_keeps_finite:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   462
  "finite rhs \<Longrightarrow> finite (arden_variate X rhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   463
by (auto simp:arden_variate_def append_keeps_finite)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   464
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   465
lemma append_keeps_nonempty:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   466
  "rhs_nonempty rhs \<Longrightarrow> rhs_nonempty (append_rhs_rexp rhs r)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   467
apply (auto simp:rhs_nonempty_def append_rhs_rexp_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   468
by (case_tac x, auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   469
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   470
lemma nonempty_set_sub:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   471
  "rhs_nonempty rhs \<Longrightarrow> rhs_nonempty (rhs - A)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   472
by (auto simp:rhs_nonempty_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   473
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   474
lemma nonempty_set_union:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   475
  "\<lbrakk>rhs_nonempty rhs; rhs_nonempty rhs'\<rbrakk> \<Longrightarrow> rhs_nonempty (rhs \<union> rhs')"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   476
by (auto simp:rhs_nonempty_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   477
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   478
lemma arden_variate_keeps_nonempty:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   479
  "rhs_nonempty rhs \<Longrightarrow> rhs_nonempty (arden_variate X rhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   480
by (simp only:arden_variate_def append_keeps_nonempty nonempty_set_sub)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   481
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   482
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   483
lemma rhs_subst_keeps_nonempty:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   484
  "\<lbrakk>rhs_nonempty rhs; rhs_nonempty xrhs\<rbrakk> \<Longrightarrow> rhs_nonempty (rhs_subst rhs X xrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   485
by (simp only:rhs_subst_def append_keeps_nonempty  nonempty_set_union nonempty_set_sub)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   486
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   487
lemma rhs_subst_keeps_eq:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   488
  assumes substor: "X = L xrhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   489
  and finite: "finite rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   490
  shows "L (rhs_subst rhs X xrhs) = L rhs" (is "?Left = ?Right")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   491
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   492
  def A \<equiv> "L (rhs - items_of rhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   493
  have "?Left = A \<union> L (append_rhs_rexp xrhs (rexp_of rhs X))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   494
    by (simp only:rhs_subst_def L_rhs_union_distrib A_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   495
  moreover have "?Right = A \<union> L (items_of rhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   496
  proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   497
    have "rhs = (rhs - items_of rhs X) \<union> (items_of rhs X)" by (auto simp:items_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   498
    thus ?thesis by (simp only:L_rhs_union_distrib A_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   499
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   500
  moreover have "L (append_rhs_rexp xrhs (rexp_of rhs X)) = L (items_of rhs X)" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   501
    using finite substor  by (simp only:lang_of_append_rhs lang_of_rexp_of)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   502
  ultimately show ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   503
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   504
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   505
lemma rhs_subst_keeps_finite_rhs:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   506
  "\<lbrakk>finite rhs; finite yrhs\<rbrakk> \<Longrightarrow> finite (rhs_subst rhs Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   507
by (auto simp:rhs_subst_def append_keeps_finite)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   508
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   509
lemma eqs_subst_keeps_finite:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   510
  assumes finite:"finite (ES:: (string set \<times> rhs_item set) set)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   511
  shows "finite (eqs_subst ES Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   512
proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   513
  have "finite {(Ya, rhs_subst yrhsa Y yrhs) |Ya yrhsa. (Ya, yrhsa) \<in> ES}" (is "finite ?A")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   514
  proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   515
    def eqns' \<equiv> "{((Ya::string set), yrhsa)| Ya yrhsa. (Ya, yrhsa) \<in> ES}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   516
    def h \<equiv> "\<lambda> ((Ya::string set), yrhsa). (Ya, rhs_subst yrhsa Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   517
    have "finite (h ` eqns')" using finite h_def eqns'_def by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   518
    moreover have "?A = h ` eqns'" by (auto simp:h_def eqns'_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   519
    ultimately show ?thesis by auto      
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   520
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   521
  thus ?thesis by (simp add:eqs_subst_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   522
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   523
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   524
lemma eqs_subst_keeps_finite_rhs:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   525
  "\<lbrakk>finite_rhs ES; finite yrhs\<rbrakk> \<Longrightarrow> finite_rhs (eqs_subst ES Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   526
by (auto intro:rhs_subst_keeps_finite_rhs simp add:eqs_subst_def finite_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   527
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   528
lemma append_rhs_keeps_cls:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   529
  "classes_of (append_rhs_rexp rhs r) = classes_of rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   530
apply (auto simp:classes_of_def append_rhs_rexp_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   531
apply (case_tac xa, auto simp:image_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   532
by (rule_tac x = "SEQ ra r" in exI, rule_tac x = "Trn x ra" in bexI, simp+)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   533
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   534
lemma arden_variate_removes_cl:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   535
  "classes_of (arden_variate Y yrhs) = classes_of yrhs - {Y}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   536
apply (simp add:arden_variate_def append_rhs_keeps_cls items_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   537
by (auto simp:classes_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   538
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   539
lemma lefts_of_keeps_cls:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   540
  "lefts_of (eqs_subst ES Y yrhs) = lefts_of ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   541
by (auto simp:lefts_of_def eqs_subst_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   542
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   543
lemma rhs_subst_updates_cls:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   544
  "X \<notin> classes_of xrhs \<Longrightarrow> classes_of (rhs_subst rhs X xrhs) = classes_of rhs \<union> classes_of xrhs - {X}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   545
apply (simp only:rhs_subst_def append_rhs_keeps_cls classes_of_union_distrib[THEN sym])
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   546
by (auto simp:classes_of_def items_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   547
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   548
lemma eqs_subst_keeps_self_contained:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   549
  fixes Y
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   550
  assumes sc: "self_contained (ES \<union> {(Y, yrhs)})" (is "self_contained ?A")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   551
  shows "self_contained (eqs_subst ES Y (arden_variate Y yrhs))" (is "self_contained ?B")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   552
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   553
  { fix X xrhs'
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   554
    assume "(X, xrhs') \<in> ?B"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   555
    then obtain xrhs 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   556
      where xrhs_xrhs': "xrhs' = rhs_subst xrhs Y (arden_variate Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   557
      and X_in: "(X, xrhs) \<in> ES" by (simp add:eqs_subst_def, blast)    
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   558
    have "classes_of xrhs' \<subseteq> lefts_of ?B"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   559
    proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   560
      have "lefts_of ?B = lefts_of ES" by (auto simp add:lefts_of_def eqs_subst_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   561
      moreover have "classes_of xrhs' \<subseteq> lefts_of ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   562
      proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   563
        have "classes_of xrhs' \<subseteq> classes_of xrhs \<union> classes_of (arden_variate Y yrhs) - {Y}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   564
        proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   565
          have "Y \<notin> classes_of (arden_variate Y yrhs)" using arden_variate_removes_cl by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   566
          thus ?thesis using xrhs_xrhs' by (auto simp:rhs_subst_updates_cls)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   567
        qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   568
        moreover have "classes_of xrhs \<subseteq> lefts_of ES \<union> {Y}" using X_in sc
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   569
          apply (simp only:self_contained_def lefts_of_union_distrib[THEN sym])
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   570
          by (drule_tac x = "(X, xrhs)" in bspec, auto simp:lefts_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   571
        moreover have "classes_of (arden_variate Y yrhs) \<subseteq> lefts_of ES \<union> {Y}" using sc
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   572
          by (auto simp add:arden_variate_removes_cl self_contained_def lefts_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   573
        ultimately show ?thesis by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   574
      qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   575
      ultimately show ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   576
    qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   577
  } thus ?thesis by (auto simp only:eqs_subst_def self_contained_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   578
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   579
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   580
lemma eqs_subst_satisfy_Inv:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   581
  assumes Inv_ES: "Inv (ES \<union> {(Y, yrhs)})"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   582
  shows "Inv (eqs_subst ES Y (arden_variate Y yrhs))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   583
proof -  
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   584
  have finite_yrhs: "finite yrhs" using Inv_ES by (auto simp:Inv_def finite_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   585
  have nonempty_yrhs: "rhs_nonempty yrhs" using Inv_ES by (auto simp:Inv_def ardenable_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   586
  have Y_eq_yrhs: "Y = L yrhs" using Inv_ES by (simp only:Inv_def valid_eqns_def, blast)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   587
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   588
  have "distinct_equas (eqs_subst ES Y (arden_variate Y yrhs))" using Inv_ES
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   589
    by (auto simp:distinct_equas_def eqs_subst_def Inv_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   590
  moreover have "finite (eqs_subst ES Y (arden_variate Y yrhs))" using Inv_ES 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   591
    by (simp add:Inv_def eqs_subst_keeps_finite)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   592
  moreover have "finite_rhs (eqs_subst ES Y (arden_variate Y yrhs))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   593
  proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   594
    have "finite_rhs ES" using Inv_ES by (simp add:Inv_def finite_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   595
    moreover have "finite (arden_variate Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   596
    proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   597
      have "finite yrhs" using Inv_ES by (auto simp:Inv_def finite_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   598
      thus ?thesis using arden_variate_keeps_finite by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   599
    qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   600
    ultimately show ?thesis by (simp add:eqs_subst_keeps_finite_rhs)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   601
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   602
  moreover have "ardenable (eqs_subst ES Y (arden_variate Y yrhs))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   603
  proof - 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   604
    { fix X rhs
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   605
      assume "(X, rhs) \<in> ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   606
      hence "rhs_nonempty rhs"  using prems Inv_ES  by (simp add:Inv_def ardenable_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   607
      with nonempty_yrhs have "rhs_nonempty (rhs_subst rhs Y (arden_variate Y yrhs))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   608
        by (simp add:nonempty_yrhs rhs_subst_keeps_nonempty arden_variate_keeps_nonempty)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   609
    } thus ?thesis by (auto simp add:ardenable_def eqs_subst_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   610
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   611
  moreover have "valid_eqns (eqs_subst ES Y (arden_variate Y yrhs))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   612
  proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   613
    have "Y = L (arden_variate Y yrhs)" using Y_eq_yrhs Inv_ES finite_yrhs nonempty_yrhs      
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   614
        by (rule_tac arden_variate_keeps_eq, (simp add:rexp_of_empty)+)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   615
    thus ?thesis using Inv_ES 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   616
      by (clarsimp simp add:valid_eqns_def eqs_subst_def rhs_subst_keeps_eq Inv_def finite_rhs_def
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   617
                   simp del:L_rhs.simps)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   618
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   619
  moreover have non_empty_subst: "non_empty (eqs_subst ES Y (arden_variate Y yrhs))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   620
    using Inv_ES by (auto simp:Inv_def non_empty_def eqs_subst_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   621
  moreover have self_subst: "self_contained (eqs_subst ES Y (arden_variate Y yrhs))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   622
    using Inv_ES eqs_subst_keeps_self_contained by (simp add:Inv_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   623
  ultimately show ?thesis using Inv_ES by (simp add:Inv_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   624
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   625
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   626
lemma eqs_subst_card_le: 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   627
  assumes finite: "finite (ES::(string set \<times> rhs_item set) set)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   628
  shows "card (eqs_subst ES Y yrhs) <= card ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   629
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   630
  def f \<equiv> "\<lambda> x. ((fst x)::string set, rhs_subst (snd x) Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   631
  have "eqs_subst ES Y yrhs = f ` ES" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   632
    apply (auto simp:eqs_subst_def f_def image_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   633
    by (rule_tac x = "(Ya, yrhsa)" in bexI, simp+)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   634
  thus ?thesis using finite by (auto intro:card_image_le)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   635
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   636
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   637
lemma eqs_subst_cls_remains: 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   638
  "(X, xrhs) \<in> ES \<Longrightarrow> \<exists> xrhs'. (X, xrhs') \<in> (eqs_subst ES Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   639
by (auto simp:eqs_subst_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   640
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   641
lemma card_noteq_1_has_more:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   642
  assumes card:"card S \<noteq> 1"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   643
  and e_in: "e \<in> S"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   644
  and finite: "finite S"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   645
  obtains e' where "e' \<in> S \<and> e \<noteq> e'" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   646
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   647
  have "card (S - {e}) > 0"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   648
  proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   649
    have "card S > 1" using card e_in finite  by (case_tac "card S", auto) 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   650
    thus ?thesis using finite e_in by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   651
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   652
  hence "S - {e} \<noteq> {}" using finite by (rule_tac notI, simp)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   653
  thus "(\<And>e'. e' \<in> S \<and> e \<noteq> e' \<Longrightarrow> thesis) \<Longrightarrow> thesis" by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   654
qed
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   655
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   656
lemma iteration_step: 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   657
  assumes Inv_ES: "Inv ES"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   658
  and    X_in_ES: "(X, xrhs) \<in> ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   659
  and    not_T: "card ES \<noteq> 1"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   660
  shows "\<exists> ES'. (Inv ES' \<and> (\<exists> xrhs'.(X, xrhs') \<in> ES')) \<and> (card ES', card ES) \<in> less_than" (is "\<exists> ES'. ?P ES'")
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   661
proof -
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   662
  have finite_ES: "finite ES" using Inv_ES by (simp add:Inv_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   663
  then obtain Y yrhs where Y_in_ES: "(Y, yrhs) \<in> ES" and not_eq: "(X, xrhs) \<noteq> (Y, yrhs)" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   664
    using not_T X_in_ES by (drule_tac card_noteq_1_has_more, auto)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   665
  def ES' == "ES - {(Y, yrhs)}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   666
  let ?ES'' = "eqs_subst ES' Y (arden_variate Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   667
  have "?P ?ES''"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   668
  proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   669
    have "Inv ?ES''" using Y_in_ES Inv_ES
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   670
      by (rule_tac eqs_subst_satisfy_Inv, simp add:ES'_def insert_absorb)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   671
    moreover have "\<exists>xrhs'. (X, xrhs') \<in> ?ES''"  using not_eq X_in_ES
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   672
      by (rule_tac ES = ES' in eqs_subst_cls_remains, auto simp add:ES'_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   673
    moreover have "(card ?ES'', card ES) \<in> less_than" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   674
    proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   675
      have "finite ES'" using finite_ES ES'_def by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   676
      moreover have "card ES' < card ES" using finite_ES Y_in_ES
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   677
        by (auto simp:ES'_def card_gt_0_iff intro:diff_Suc_less)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   678
      ultimately show ?thesis 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   679
        by (auto dest:eqs_subst_card_le elim:le_less_trans)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   680
    qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   681
    ultimately show ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   682
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   683
  thus ?thesis by blast
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   684
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   685
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   686
text {* ***** END: proving every equation-system's iteration step satisfies Inv ************** *}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   687
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   688
lemma iteration_conc: 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   689
  assumes history: "Inv ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   690
  and    X_in_ES: "\<exists> xrhs. (X, xrhs) \<in> ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   691
  shows "\<exists> ES'. (Inv ES' \<and> (\<exists> xrhs'. (X, xrhs') \<in> ES')) \<and> card ES' = 1" (is "\<exists> ES'. ?P ES'")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   692
proof (cases "card ES = 1")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   693
  case True
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   694
  thus ?thesis using history X_in_ES
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   695
    by blast
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   696
next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   697
  case False  
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   698
  thus ?thesis using history iteration_step X_in_ES
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   699
    by (rule_tac f = card in wf_iter, auto)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   700
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   701
  
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   702
lemma last_cl_exists_rexp:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   703
  assumes ES_single: "ES = {(X, xrhs)}" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   704
  and Inv_ES: "Inv ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   705
  shows "\<exists> (r::rexp). L r = X" (is "\<exists> r. ?P r")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   706
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   707
  let ?A = "arden_variate X xrhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   708
  have "?P (rexp_of_lam ?A)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   709
  proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   710
    have "L (rexp_of_lam ?A) = L (lam_of ?A)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   711
    proof(rule rexp_of_lam_eq_lam_set)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   712
      show "finite (arden_variate X xrhs)" using Inv_ES ES_single 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   713
        by (rule_tac arden_variate_keeps_finite, auto simp add:Inv_def finite_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   714
    qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   715
    also have "\<dots> = L ?A"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   716
    proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   717
      have "lam_of ?A = ?A"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   718
      proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   719
        have "classes_of ?A = {}" using Inv_ES ES_single
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   720
          by (simp add:arden_variate_removes_cl self_contained_def Inv_def lefts_of_def) 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   721
        thus ?thesis by (auto simp only:lam_of_def classes_of_def, case_tac x, auto)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   722
      qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   723
      thus ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   724
    qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   725
    also have "\<dots> = X"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   726
    proof(rule arden_variate_keeps_eq [THEN sym])
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   727
      show "X = L xrhs" using Inv_ES ES_single by (auto simp only:Inv_def valid_eqns_def)  
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   728
    next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   729
      from Inv_ES ES_single show "[] \<notin> L (rexp_of xrhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   730
        by(simp add:Inv_def ardenable_def rexp_of_empty finite_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   731
    next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   732
      from Inv_ES ES_single show "finite xrhs" by (simp add:Inv_def finite_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   733
    qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   734
    finally show ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   735
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   736
  thus ?thesis by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   737
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   738
   
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   739
lemma every_eqcl_has_reg: 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   740
  assumes finite_CS: "finite (UNIV // (\<approx>Lang))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   741
  and X_in_CS: "X \<in> (UNIV // (\<approx>Lang))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   742
  shows "\<exists> (reg::rexp). L reg = X" (is "\<exists> r. ?E r")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   743
proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   744
  from X_in_CS have "\<exists> xrhs. (X, xrhs) \<in> (eqs (UNIV  // (\<approx>Lang)))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   745
    by (auto simp:eqs_def init_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   746
  then obtain ES xrhs where Inv_ES: "Inv ES" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   747
    and X_in_ES: "(X, xrhs) \<in> ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   748
    and card_ES: "card ES = 1"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   749
    using finite_CS X_in_CS init_ES_satisfy_Inv iteration_conc
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   750
    by blast
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   751
  hence ES_single_equa: "ES = {(X, xrhs)}" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   752
    by (auto simp:Inv_def dest!:card_Suc_Diff1 simp:card_eq_0_iff) 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   753
  thus ?thesis using Inv_ES
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   754
    by (rule last_cl_exists_rexp)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   755
qed
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   756
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   757
theorem hard_direction: 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   758
  assumes finite_CS: "finite (UNIV // (\<approx>Lang))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   759
  shows   "\<exists> (reg::rexp). Lang = L reg"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   760
proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   761
  have "\<forall> X \<in> (UNIV // (\<approx>Lang)). \<exists> (reg::rexp). X = L reg" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   762
    using finite_CS every_eqcl_has_reg by blast
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   763
  then obtain f where f_prop: "\<forall> X \<in> (UNIV // (\<approx>Lang)). X = L ((f X)::rexp)" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   764
    by (auto dest:bchoice)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   765
  def rs \<equiv> "f ` {X. final X Lang}"  
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   766
  have "Lang = \<Union> {X. final X Lang}" using lang_is_union_of_finals by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   767
  also have "\<dots> = L (folds ALT NULL rs)" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   768
  proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   769
    have "finite {X. final X Lang}" using finite_CS by (auto simp:final_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   770
    thus ?thesis  using f_prop by (auto simp:rs_def final_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   771
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   772
  finally show ?thesis by blast
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   773
qed 
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   774
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   775
section {* regular \<Rightarrow> finite*}
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   776
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   777
lemma quot_empty_subset:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   778
  "UNIV // (\<approx>{[]}) \<subseteq> {{[]}, UNIV - {[]}}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   779
proof
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   780
  fix x
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   781
  assume h: "x \<in> UNIV // \<approx>{[]}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   782
  show "x \<in> {{[]}, UNIV - {[]}}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   783
    
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   784
 
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   785
  have "\<And> s. s \<approx>{[]} [] \<Longrightarrow> s = []"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   786
    apply (auto simp add:str_eq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   787
    apply blast
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   788
  
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   789
  hence "False"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   790
    apply (simp add:quotient_def)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   791
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   792
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   793
lemma other_direction:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   794
  "Lang = L (r::rexp) \<Longrightarrow> finite (UNIV // (\<approx>Lang))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   795
proof (induct arbitrary:Lang rule:rexp.induct)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   796
  case NULL
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   797
  have "UNIV // (\<approx>{}) \<subseteq> {UNIV} "
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   798
    by (auto simp:quotient_def str_eq_rel_def str_eq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   799
  with prems show "?case" by (auto intro:finite_subset)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   800
next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   801
  case EMPTY
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   802
  have "UNIV // (\<approx>{[]}) \<subseteq> {{[]}, UNIV - {[]}}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   803
    sorry
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   804
  with prems show ?case by (auto intro:finite_subset)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   805
next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   806
  case (CHAR c)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   807
  have "UNIV // (\<approx>{[c]}) \<subseteq> {{[]},{[c]}, UNIV - {[], [c]}}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   808
    sorry
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   809
  with prems show ?case by (auto intro:finite_subset)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   810
next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   811
  case (SEQ r1 r2)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   812
  show ?case sorry
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   813
next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   814
  case (ALT r1 r1)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   815
  show ?case sorry
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   816
next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   817
  case (STAR r)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   818
  show ?case sorry
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   819
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   820
    
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   821
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   822
      
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   823
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   824
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   825
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   826
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   827
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   828
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   829
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   830
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   831
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   832
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   833
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   834
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   835
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   836
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   837
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   838
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   839
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   840
apply (induct arbitrary:Lang rule:rexp.induct)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   841
apply (simp add:QUOT_def equiv_class_def equiv_str_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   842
by (simp_all add:quot_lambda quot_single quot_seq quot_alt quot_star)  
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   843
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   844
(* Alternative definition for Quo *)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   845
definition 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   846
  QUOT :: "string set \<Rightarrow> (string set) set"  
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   847
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   848
  "QUOT Lang \<equiv> (\<Union>x. {\<lbrakk>x\<rbrakk>Lang})"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   849
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   850
lemma test: 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   851
  "UNIV Quo Lang = QUOT Lang"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   852
by (auto simp add: quot_def QUOT_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   853
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   854
lemma test1:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   855
  assumes finite_CS: "finite (QUOT Lang)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   856
  shows "reg Lang"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   857
using finite_CS
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   858
unfolding test[symmetric]
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   859
by (auto dest: myhill_nerode)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   860
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   861
lemma cons_one: "x @ y \<in> {z} \<Longrightarrow> x @ y = z"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   862
by simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   863
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   864
lemma quot_lambda: "QUOT {[]} = {{[]}, UNIV - {[]}}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   865
proof 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   866
  show "QUOT {[]} \<subseteq> {{[]}, UNIV - {[]}}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   867
  proof 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   868
    fix x 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   869
    assume in_quot: "x \<in> QUOT {[]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   870
    show "x \<in> {{[]}, UNIV - {[]}}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   871
    proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   872
      from in_quot 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   873
      have "x = {[]} \<or> x = UNIV - {[]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   874
        unfolding QUOT_def equiv_class_def
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   875
      proof 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   876
        fix xa
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   877
        assume in_univ: "xa \<in> UNIV"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   878
           and in_eqiv: "x \<in> {{y. xa \<equiv>{[]}\<equiv> y}}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   879
        show "x = {[]} \<or> x = UNIV - {[]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   880
        proof(cases "xa = []")
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   881
          case True
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   882
          hence "{y. xa \<equiv>{[]}\<equiv> y} = {[]}" using in_eqiv
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   883
            by (auto simp add:equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   884
          thus ?thesis using in_eqiv by (rule_tac disjI1, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   885
        next
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   886
          case False
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   887
          hence "{y. xa \<equiv>{[]}\<equiv> y} = UNIV - {[]}" using in_eqiv
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   888
            by (auto simp:equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   889
          thus ?thesis using in_eqiv by (rule_tac disjI2, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   890
        qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   891
      qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   892
      thus ?thesis by simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   893
    qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   894
  qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   895
next
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   896
  show "{{[]}, UNIV - {[]}} \<subseteq> QUOT {[]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   897
  proof
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   898
    fix x
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   899
    assume in_res: "x \<in> {{[]}, (UNIV::string set) - {[]}}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   900
    show "x \<in> (QUOT {[]})"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   901
    proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   902
      have "x = {[]} \<Longrightarrow> x \<in> QUOT {[]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   903
        apply (simp add:QUOT_def equiv_class_def equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   904
        by (rule_tac x = "[]" in exI, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   905
      moreover have "x = UNIV - {[]} \<Longrightarrow> x \<in> QUOT {[]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   906
        apply (simp add:QUOT_def equiv_class_def equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   907
        by (rule_tac x = "''a''" in exI, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   908
      ultimately show ?thesis using in_res by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   909
    qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   910
  qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   911
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   912
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   913
lemma quot_single_aux: "\<lbrakk>x \<noteq> []; x \<noteq> [c]\<rbrakk> \<Longrightarrow> x @ z \<noteq> [c]"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   914
by (induct x, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   915
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   916
lemma quot_single: "\<And> (c::char). QUOT {[c]} = {{[]}, {[c]}, UNIV - {[], [c]}}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   917
proof - 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   918
  fix c::"char" 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   919
  have exist_another: "\<exists> a. a \<noteq> c" 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   920
    apply (case_tac "c = CHR ''a''")
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   921
    apply (rule_tac x = "CHR ''b''" in exI, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   922
    by (rule_tac x = "CHR ''a''" in exI, simp)  
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   923
  show "QUOT {[c]} = {{[]}, {[c]}, UNIV - {[], [c]}}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   924
  proof
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   925
    show "QUOT {[c]} \<subseteq> {{[]},{[c]}, UNIV - {[], [c]}}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   926
    proof 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   927
      fix x 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   928
      assume in_quot: "x \<in> QUOT {[c]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   929
      show "x \<in> {{[]}, {[c]}, UNIV - {[],[c]}}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   930
      proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   931
        from in_quot 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   932
        have "x = {[]} \<or> x = {[c]} \<or> x = UNIV - {[],[c]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   933
          unfolding QUOT_def equiv_class_def
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   934
        proof 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   935
          fix xa
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   936
          assume in_eqiv: "x \<in> {{y. xa \<equiv>{[c]}\<equiv> y}}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   937
          show "x = {[]} \<or> x = {[c]} \<or> x = UNIV - {[], [c]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   938
          proof-
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   939
            have "xa = [] \<Longrightarrow> x = {[]}" using in_eqiv 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   940
              by (auto simp add:equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   941
            moreover have "xa = [c] \<Longrightarrow> x = {[c]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   942
            proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   943
              have "xa = [c] \<Longrightarrow> {y. xa \<equiv>{[c]}\<equiv> y} = {[c]}" using in_eqiv
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   944
                apply (simp add:equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   945
                apply (rule set_ext, rule iffI, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   946
                apply (drule_tac x = "[]" in spec, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   947
                done   
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   948
              thus "xa = [c] \<Longrightarrow> x = {[c]}" using in_eqiv by simp 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   949
            qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   950
            moreover have "\<lbrakk>xa \<noteq> []; xa \<noteq> [c]\<rbrakk> \<Longrightarrow> x = UNIV - {[],[c]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   951
            proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   952
              have "\<lbrakk>xa \<noteq> []; xa \<noteq> [c]\<rbrakk> \<Longrightarrow> {y. xa \<equiv>{[c]}\<equiv> y} = UNIV - {[],[c]}" 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   953
                apply (clarsimp simp add:equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   954
                apply (rule set_ext, rule iffI, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   955
                apply (rule conjI)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   956
                apply (drule_tac x = "[c]" in spec, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   957
                apply (drule_tac x = "[]" in spec, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   958
                by (auto dest:quot_single_aux)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   959
              thus "\<lbrakk>xa \<noteq> []; xa \<noteq> [c]\<rbrakk> \<Longrightarrow> x = UNIV - {[],[c]}" using in_eqiv by simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   960
            qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   961
            ultimately show ?thesis by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   962
          qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   963
        qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   964
        thus ?thesis by simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   965
      qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   966
    qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   967
  next
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   968
    show "{{[]}, {[c]}, UNIV - {[],[c]}} \<subseteq> QUOT {[c]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   969
    proof
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   970
      fix x
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   971
      assume in_res: "x \<in> {{[]},{[c]}, (UNIV::string set) - {[],[c]}}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   972
      show "x \<in> (QUOT {[c]})"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   973
      proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   974
        have "x = {[]} \<Longrightarrow> x \<in> QUOT {[c]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   975
          apply (simp add:QUOT_def equiv_class_def equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   976
          by (rule_tac x = "[]" in exI, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   977
        moreover have "x = {[c]} \<Longrightarrow> x \<in> QUOT {[c]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   978
          apply (simp add:QUOT_def equiv_class_def equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   979
          apply (rule_tac x = "[c]" in exI, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   980
          apply (rule set_ext, rule iffI, simp+)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   981
          by (drule_tac x = "[]" in spec, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   982
        moreover have "x = UNIV - {[],[c]} \<Longrightarrow> x \<in> QUOT {[c]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   983
          using exist_another
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   984
          apply (clarsimp simp add:QUOT_def equiv_class_def equiv_str_def)        
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   985
          apply (rule_tac x = "[a]" in exI, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   986
          apply (rule set_ext, rule iffI, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   987
          apply (clarsimp simp:quot_single_aux, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   988
          apply (rule conjI)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   989
          apply (drule_tac x = "[c]" in spec, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   990
          by (drule_tac x = "[]" in spec, simp)     
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   991
        ultimately show ?thesis using in_res by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   992
      qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   993
    qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   994
  qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   995
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   996
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   997
lemma eq_class_imp_eq_str:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   998
  "\<lbrakk>x\<rbrakk>lang = \<lbrakk>y\<rbrakk>lang \<Longrightarrow> x \<equiv>lang\<equiv> y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   999
by (auto simp:equiv_class_def equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1000
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1001
lemma finite_tag_image: 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1002
  "finite (range tag) \<Longrightarrow> finite (((op `) tag) ` S)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1003
apply (rule_tac B = "Pow (tag ` UNIV)" in finite_subset)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1004
by (auto simp add:image_def Pow_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1005
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1006
lemma str_inj_imps:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1007
  assumes str_inj: "\<And> m n. tag m = tag (n::string) \<Longrightarrow> m \<equiv>lang\<equiv> n"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1008
  shows "inj_on ((op `) tag) (QUOT lang)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1009
proof (clarsimp simp add:inj_on_def QUOT_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1010
  fix x y
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1011
  assume eq_tag: "tag ` \<lbrakk>x\<rbrakk>lang = tag ` \<lbrakk>y\<rbrakk>lang"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1012
  show "\<lbrakk>x\<rbrakk>lang = \<lbrakk>y\<rbrakk>lang"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1013
  proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1014
    have aux1:"\<And>a b. a \<in> (\<lbrakk>b\<rbrakk>lang) \<Longrightarrow> (a \<equiv>lang\<equiv> b)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1015
      by (simp add:equiv_class_def equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1016
    have aux2: "\<And> A B f. \<lbrakk>f ` A = f ` B; A \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists> a b. a \<in> A \<and> b \<in> B \<and> f a = f b"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1017
      by auto
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1018
    have aux3: "\<And> a l. \<lbrakk>a\<rbrakk>l \<noteq> {}" 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1019
      by (auto simp:equiv_class_def equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1020
    show ?thesis using eq_tag
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1021
      apply (drule_tac aux2, simp add:aux3, clarsimp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1022
      apply (drule_tac str_inj, (drule_tac aux1)+)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1023
      by (simp add:equiv_str_def equiv_class_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1024
  qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1025
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1026
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1027
definition tag_str_ALT :: "string set \<Rightarrow> string set \<Rightarrow> string \<Rightarrow> (string set \<times> string set)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1028
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1029
  "tag_str_ALT L\<^isub>1 L\<^isub>2 x \<equiv> (\<lbrakk>x\<rbrakk>L\<^isub>1, \<lbrakk>x\<rbrakk>L\<^isub>2)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1030
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1031
lemma tag_str_alt_range_finite:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1032
  assumes finite1: "finite (QUOT L\<^isub>1)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1033
  and finite2: "finite (QUOT L\<^isub>2)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1034
  shows "finite (range (tag_str_ALT L\<^isub>1 L\<^isub>2))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1035
proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1036
  have "{y. \<exists>x. y = (\<lbrakk>x\<rbrakk>L\<^isub>1, \<lbrakk>x\<rbrakk>L\<^isub>2)} \<subseteq> (QUOT L\<^isub>1) \<times> (QUOT L\<^isub>2)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1037
    by (auto simp:QUOT_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1038
  thus ?thesis using finite1 finite2
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1039
    by (auto simp: image_def tag_str_ALT_def UNION_def 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1040
            intro: finite_subset[where B = "(QUOT L\<^isub>1) \<times> (QUOT L\<^isub>2)"])
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1041
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1042
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1043
lemma tag_str_alt_inj:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1044
  "tag_str_ALT L\<^isub>1 L\<^isub>2 x = tag_str_ALT L\<^isub>1 L\<^isub>2 y \<Longrightarrow> x \<equiv>(L\<^isub>1 \<union> L\<^isub>2)\<equiv> y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1045
apply (simp add:tag_str_ALT_def equiv_class_def equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1046
by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1047
  
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1048
lemma quot_alt:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1049
  assumes finite1: "finite (QUOT L\<^isub>1)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1050
  and finite2: "finite (QUOT L\<^isub>2)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1051
  shows "finite (QUOT (L\<^isub>1 \<union> L\<^isub>2))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1052
proof (rule_tac f = "(op `) (tag_str_ALT L\<^isub>1 L\<^isub>2)" in finite_imageD)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1053
  show "finite (op ` (tag_str_ALT L\<^isub>1 L\<^isub>2) ` QUOT (L\<^isub>1 \<union> L\<^isub>2))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1054
    using finite_tag_image tag_str_alt_range_finite finite1 finite2
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1055
    by auto
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1056
next
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1057
  show "inj_on (op ` (tag_str_ALT L\<^isub>1 L\<^isub>2)) (QUOT (L\<^isub>1 \<union> L\<^isub>2))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1058
    apply (rule_tac str_inj_imps)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1059
    by (erule_tac tag_str_alt_inj)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1060
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1061
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1062
(* list_diff:: list substract, once different return tailer *)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1063
fun list_diff :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" (infix "-" 51)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1064
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1065
  "list_diff []  xs = []" |
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1066
  "list_diff (x#xs) [] = x#xs" |
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1067
  "list_diff (x#xs) (y#ys) = (if x = y then list_diff xs ys else (x#xs))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1068
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1069
lemma [simp]: "(x @ y) - x = y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1070
apply (induct x)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1071
by (case_tac y, simp+)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1072
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1073
lemma [simp]: "x - x = []"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1074
by (induct x, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1075
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1076
lemma [simp]: "x = xa @ y \<Longrightarrow> x - xa = y "
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1077
by (induct x, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1078
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1079
lemma [simp]: "x - [] = x"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1080
by (induct x, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1081
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1082
lemma [simp]: "xa \<le> x \<Longrightarrow> (x @ y) - xa = (x - xa) @ y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1083
by (auto elim:prefixE)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1084
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1085
definition tag_str_SEQ:: "string set \<Rightarrow> string set \<Rightarrow> string \<Rightarrow> (string set \<times> string set set)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1086
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1087
  "tag_str_SEQ L\<^isub>1 L\<^isub>2 x \<equiv> if (\<exists> xa \<le> x. xa \<in> L\<^isub>1)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1088
                         then (\<lbrakk>x\<rbrakk>L\<^isub>1, {\<lbrakk>(x - xa)\<rbrakk>L\<^isub>2 | xa.  xa \<le> x \<and> xa \<in> L\<^isub>1})
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1089
                         else (\<lbrakk>x\<rbrakk>L\<^isub>1, {})"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1090
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1091
lemma tag_seq_eq_E:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1092
  "tag_str_SEQ L\<^isub>1 L\<^isub>2 x = tag_str_SEQ L\<^isub>1 L\<^isub>2 y \<Longrightarrow>
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1093
   ((\<exists> xa \<le> x. xa \<in> L\<^isub>1) \<and> \<lbrakk>x\<rbrakk>L\<^isub>1 = \<lbrakk>y\<rbrakk>L\<^isub>1 \<and> 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1094
    {\<lbrakk>(x - xa)\<rbrakk>L\<^isub>2 | xa. xa \<le> x \<and> xa \<in> L\<^isub>1} = {\<lbrakk>(y - ya)\<rbrakk>L\<^isub>2 | ya. ya \<le> y \<and> ya \<in> L\<^isub>1} ) \<or>
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1095
   ((\<forall> xa \<le> x. xa \<notin> L\<^isub>1) \<and> \<lbrakk>x\<rbrakk>L\<^isub>1 = \<lbrakk>y\<rbrakk>L\<^isub>1)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1096
by (simp add:tag_str_SEQ_def split:if_splits, blast)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1097
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1098
lemma tag_str_seq_range_finite:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1099
  assumes finite1: "finite (QUOT L\<^isub>1)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1100
  and finite2: "finite (QUOT L\<^isub>2)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1101
  shows "finite (range (tag_str_SEQ L\<^isub>1 L\<^isub>2))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1102
proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1103
  have "(range (tag_str_SEQ L\<^isub>1 L\<^isub>2)) \<subseteq> (QUOT L\<^isub>1) \<times> (Pow (QUOT L\<^isub>2))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1104
    by (auto simp:image_def tag_str_SEQ_def QUOT_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1105
  thus ?thesis using finite1 finite2 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1106
    by (rule_tac B = "(QUOT L\<^isub>1) \<times> (Pow (QUOT L\<^isub>2))" in finite_subset, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1107
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1108
  
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1109
lemma app_in_seq_decom[rule_format]:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1110
  "\<forall> x. x @ z \<in> L\<^isub>1 ; L\<^isub>2 \<longrightarrow> (\<exists> xa \<le> x. xa \<in> L\<^isub>1 \<and> (x - xa) @ z \<in> L\<^isub>2) \<or> 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1111
                            (\<exists> za \<le> z. (x @ za) \<in> L\<^isub>1 \<and> (z - za) \<in> L\<^isub>2)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1112
apply (induct z)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1113
apply (simp, rule allI, rule impI, rule disjI1)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1114
apply (clarsimp simp add:lang_seq_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1115
apply (rule_tac x = s1 in exI, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1116
apply (rule allI | rule impI)+
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1117
apply (drule_tac x = "x @ [a]" in spec, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1118
apply (erule exE | erule conjE | erule disjE)+
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1119
apply (rule disjI2, rule_tac x = "[a]" in exI, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1120
apply (rule disjI1, rule_tac x = xa in exI, simp) 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1121
apply (erule exE | erule conjE)+
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1122
apply (rule disjI2, rule_tac x = "a # za" in exI, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1123
done
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1124
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1125
lemma tag_str_seq_inj:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1126
  assumes tag_eq: "tag_str_SEQ L\<^isub>1 L\<^isub>2 x = tag_str_SEQ L\<^isub>1 L\<^isub>2 y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1127
  shows "(x::string) \<equiv>(L\<^isub>1 ; L\<^isub>2)\<equiv> y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1128
proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1129
  have aux: "\<And> x y z. \<lbrakk>tag_str_SEQ L\<^isub>1 L\<^isub>2 x = tag_str_SEQ L\<^isub>1 L\<^isub>2 y; x @ z \<in> L\<^isub>1 ; L\<^isub>2\<rbrakk> 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1130
                       \<Longrightarrow> y @ z \<in> L\<^isub>1 ; L\<^isub>2"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1131
  proof (drule app_in_seq_decom, erule disjE)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1132
    fix x y z
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1133
    assume tag_eq: "tag_str_SEQ L\<^isub>1 L\<^isub>2 x = tag_str_SEQ L\<^isub>1 L\<^isub>2 y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1134
      and x_gets_l2: "\<exists>xa\<le>x. xa \<in> L\<^isub>1 \<and> (x - xa) @ z \<in> L\<^isub>2"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1135
    from x_gets_l2 have "\<exists> xa \<le> x. xa \<in> L\<^isub>1" by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1136
    hence xy_l2:"{\<lbrakk>(x - xa)\<rbrakk>L\<^isub>2 | xa. xa \<le> x \<and> xa \<in> L\<^isub>1} = {\<lbrakk>(y - ya)\<rbrakk>L\<^isub>2 | ya. ya \<le> y \<and> ya \<in> L\<^isub>1}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1137
      using tag_eq tag_seq_eq_E by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1138
    from x_gets_l2 obtain xa where xa_le_x: "xa \<le> x"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1139
                               and xa_in_l1: "xa \<in> L\<^isub>1"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1140
                               and rest_in_l2: "(x - xa) @ z \<in> L\<^isub>2" by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1141
    hence "\<exists> ya. \<lbrakk>(x - xa)\<rbrakk>L\<^isub>2 = \<lbrakk>(y - ya)\<rbrakk>L\<^isub>2 \<and> ya \<le> y \<and> ya \<in> L\<^isub>1" using xy_l2 by auto
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1142
    then obtain ya where ya_le_x: "ya \<le> y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1143
                     and ya_in_l1: "ya \<in> L\<^isub>1"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1144
                     and rest_eq: "\<lbrakk>(x - xa)\<rbrakk>L\<^isub>2 = \<lbrakk>(y - ya)\<rbrakk>L\<^isub>2" by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1145
    from rest_eq rest_in_l2 have "(y - ya) @ z \<in> L\<^isub>2" 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1146
      by (auto simp:equiv_class_def equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1147
    hence "ya @ ((y - ya) @ z) \<in> L\<^isub>1 ; L\<^isub>2" using ya_in_l1
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1148
      by (auto simp:lang_seq_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1149
    thus "y @ z \<in> L\<^isub>1 ; L\<^isub>2" using ya_le_x 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1150
      by (erule_tac prefixE, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1151
  next
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1152
    fix x y z
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1153
    assume tag_eq: "tag_str_SEQ L\<^isub>1 L\<^isub>2 x = tag_str_SEQ L\<^isub>1 L\<^isub>2 y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1154
      and x_gets_l1: "\<exists>za\<le>z. x @ za \<in> L\<^isub>1 \<and> z - za \<in> L\<^isub>2"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1155
    from tag_eq tag_seq_eq_E have x_y_eq: "\<lbrakk>x\<rbrakk>L\<^isub>1 = \<lbrakk>y\<rbrakk>L\<^isub>1" by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1156
    from x_gets_l1 obtain za where za_le_z: "za \<le> z"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1157
                               and x_za_in_l1: "(x @ za) \<in> L\<^isub>1"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1158
                               and rest_in_l2: "z - za \<in> L\<^isub>2" by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1159
    from x_y_eq x_za_in_l1 have y_za_in_l1: "y @ za \<in> L\<^isub>1"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1160
      by (auto simp:equiv_class_def equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1161
    hence "(y @ za) @ (z - za) \<in> L\<^isub>1 ; L\<^isub>2" using rest_in_l2
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1162
      apply (simp add:lang_seq_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1163
      by (rule_tac x = "y @ za" in exI, rule_tac x = "z - za" in exI, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1164
    thus "y @ z \<in> L\<^isub>1 ; L\<^isub>2" using za_le_z
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1165
      by (erule_tac prefixE, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1166
  qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1167
  show ?thesis using tag_eq
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1168
    apply (simp add:equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1169
    by (auto intro:aux)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1170
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1171
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1172
lemma quot_seq: 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1173
  assumes finite1: "finite (QUOT L\<^isub>1)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1174
  and finite2: "finite (QUOT L\<^isub>2)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1175
  shows "finite (QUOT (L\<^isub>1;L\<^isub>2))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1176
proof (rule_tac f = "(op `) (tag_str_SEQ L\<^isub>1 L\<^isub>2)" in finite_imageD)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1177
  show "finite (op ` (tag_str_SEQ L\<^isub>1 L\<^isub>2) ` QUOT (L\<^isub>1 ; L\<^isub>2))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1178
    using finite_tag_image tag_str_seq_range_finite finite1 finite2
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1179
    by auto
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1180
next
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1181
  show "inj_on (op ` (tag_str_SEQ L\<^isub>1 L\<^isub>2)) (QUOT (L\<^isub>1 ; L\<^isub>2))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1182
    apply (rule_tac str_inj_imps)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1183
    by (erule_tac tag_str_seq_inj)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1184
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1185
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1186
(****************** the STAR case ************************)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1187
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1188
lemma app_eq_elim[rule_format]:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1189
  "\<And> a. \<forall> b x y. a @ b = x @ y \<longrightarrow> (\<exists> aa ab. a = aa @ ab \<and> x = aa \<and> y = ab @ b) \<or>
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1190
                                   (\<exists> ba bb. b = ba @ bb \<and> x = a @ ba \<and> y = bb \<and> ba \<noteq> [])"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1191
  apply (induct_tac a rule:List.induct, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1192
  apply (rule allI | rule impI)+
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1193
  by (case_tac x, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1194
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1195
definition tag_str_STAR:: "string set \<Rightarrow> string \<Rightarrow> string set set"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1196
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1197
  "tag_str_STAR L\<^isub>1 x \<equiv> if (x = []) 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1198
                       then {}
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1199
                       else {\<lbrakk>x\<^isub>2\<rbrakk>L\<^isub>1 | x\<^isub>1 x\<^isub>2. x =  x\<^isub>1 @ x\<^isub>2 \<and> x\<^isub>1 \<in> L\<^isub>1\<star> \<and> x\<^isub>2 \<noteq> []}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1200
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1201
lemma tag_str_star_range_finite:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1202
  assumes finite1: "finite (QUOT L\<^isub>1)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1203
  shows "finite (range (tag_str_STAR L\<^isub>1))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1204
proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1205
  have "range (tag_str_STAR L\<^isub>1) \<subseteq> Pow (QUOT L\<^isub>1)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1206
    by (auto simp:image_def tag_str_STAR_def QUOT_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1207
  thus ?thesis using finite1
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1208
    by (rule_tac B = "Pow (QUOT L\<^isub>1)" in finite_subset, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1209
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1210
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1211
lemma star_prop[rule_format]: "x \<in> lang\<star> \<Longrightarrow> \<forall> y. y \<in> lang\<star> \<longrightarrow> x @ y \<in> lang\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1212
by (erule Star.induct, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1213
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1214
lemma star_prop2: "y \<in> lang \<Longrightarrow> y \<in> lang\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1215
by (drule step[of y lang "[]"], auto simp:start)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1216
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1217
lemma star_prop3[rule_format]: "x \<in> lang\<star> \<Longrightarrow> \<forall>y . y \<in> lang \<longrightarrow> x @ y \<in> lang\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1218
by (erule Star.induct, auto intro:star_prop2)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1219
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1220
lemma postfix_prop: "y >>= (x @ y) \<Longrightarrow> x = []"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1221
by (erule postfixE, induct x arbitrary:y, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1222
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1223
lemma inj_aux:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1224
  "\<lbrakk>(m @ z) \<in> L\<^isub>1\<star>; m \<equiv>L\<^isub>1\<equiv> yb; xa @ m = x; xa \<in> L\<^isub>1\<star>; m \<noteq> [];
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1225
    \<forall> xa xb. x = xa @ xb \<and> xa \<in> L\<^isub>1\<star> \<and> xb \<noteq> [] \<and> xb @ z \<in> L\<^isub>1\<star> \<longrightarrow> xb >>= m\<rbrakk> 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1226
  \<Longrightarrow> (yb @ z) \<in> L\<^isub>1\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1227
proof- 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1228
  have "\<And>s. s \<in> L\<^isub>1\<star> \<Longrightarrow> \<forall> m z yb. (s = m @ z \<and> m \<equiv>L\<^isub>1\<equiv> yb \<and> x = xa @ m \<and> xa \<in> L\<^isub>1\<star> \<and> m \<noteq> [] \<and>  
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1229
    (\<forall> xa xb. x = xa @ xb \<and> xa \<in> L\<^isub>1\<star> \<and> xb \<noteq> [] \<and> xb @ z \<in> L\<^isub>1\<star> \<longrightarrow> xb >>= m) \<longrightarrow> (yb @ z) \<in> L\<^isub>1\<star>)"    
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1230
    apply (erule Star.induct, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1231
    apply (rule allI | rule impI | erule conjE)+
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1232
    apply (drule app_eq_elim)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1233
    apply (erule disjE | erule exE | erule conjE)+
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1234
    apply simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1235
    apply (simp (no_asm) only:append_assoc[THEN sym])
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1236
    apply (rule step) 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1237
    apply (simp add:equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1238
    apply simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1239
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1240
    apply (erule exE | erule conjE)+    
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1241
    apply (rotate_tac 3)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1242
    apply (frule_tac x = "xa @ s1" in spec)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1243
    apply (rotate_tac 12)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1244
    apply (drule_tac x = ba in spec)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1245
    apply (erule impE)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1246
    apply ( simp add:star_prop3)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1247
    apply (simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1248
    apply (drule postfix_prop)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1249
    apply simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1250
    done
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1251
  thus "\<lbrakk>(m @ z) \<in> L\<^isub>1\<star>; m \<equiv>L\<^isub>1\<equiv> yb; xa @ m = x; xa \<in> L\<^isub>1\<star>; m \<noteq> [];
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1252
         \<forall> xa xb. x = xa @ xb \<and> xa \<in> L\<^isub>1\<star> \<and> xb \<noteq> [] \<and> xb @ z \<in> L\<^isub>1\<star> \<longrightarrow> xb >>= m\<rbrakk> 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1253
        \<Longrightarrow> (yb @ z) \<in> L\<^isub>1\<star>" by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1254
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1255
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1256
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1257
lemma min_postfix_exists[rule_format]:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1258
  "finite A \<Longrightarrow> A \<noteq> {} \<and> (\<forall> a \<in> A. \<forall> b \<in> A. ((b >>= a) \<or> (a >>= b))) 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1259
                \<longrightarrow> (\<exists> min. (min \<in> A \<and> (\<forall> a \<in> A. a >>= min)))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1260
apply (erule finite.induct)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1261
apply simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1262
apply simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1263
apply (case_tac "A = {}")
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1264
apply simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1265
apply clarsimp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1266
apply (case_tac "a >>= min")
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1267
apply (rule_tac x = min in exI, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1268
apply (rule_tac x = a in exI, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1269
apply clarify
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1270
apply (rotate_tac 5)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1271
apply (erule_tac x = aa in ballE) defer apply simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1272
apply (erule_tac ys = min in postfix_trans)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1273
apply (erule_tac x = min in ballE) 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1274
by simp+
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1275
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1276
lemma tag_str_star_inj:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1277
  "tag_str_STAR L\<^isub>1 x = tag_str_STAR L\<^isub>1 (y::string) \<Longrightarrow> x \<equiv>L\<^isub>1\<star>\<equiv> y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1278
proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1279
  have aux: "\<And> x y z. \<lbrakk>tag_str_STAR L\<^isub>1 x = tag_str_STAR L\<^isub>1 y; x @ z \<in> L\<^isub>1\<star>\<rbrakk> \<Longrightarrow> y @ z \<in> L\<^isub>1\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1280
  proof-
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1281
    fix x y z
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1282
    assume tag_eq: "tag_str_STAR L\<^isub>1 x = tag_str_STAR L\<^isub>1 y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1283
      and x_z: "x @ z \<in> L\<^isub>1\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1284
    show "y @ z \<in> L\<^isub>1\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1285
    proof (cases "x = []")
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1286
      case True
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1287
      with tag_eq have "y = []" by (simp add:tag_str_STAR_def split:if_splits, blast)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1288
      thus ?thesis using x_z True by simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1289
    next
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1290
      case False
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1291
      hence not_empty: "{xb. \<exists> xa. x = xa @ xb \<and> xa \<in> L\<^isub>1\<star> \<and> xb \<noteq> [] \<and> xb @ z \<in> L\<^isub>1\<star>} \<noteq> {}" using x_z
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1292
        by (simp, rule_tac x = x in exI, rule_tac x = "[]" in exI, simp add:start)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1293
      have finite_set: "finite {xb. \<exists> xa. x = xa @ xb \<and> xa \<in> L\<^isub>1\<star> \<and> xb \<noteq> [] \<and> xb @ z \<in> L\<^isub>1\<star>}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1294
        apply (rule_tac B = "{xb. \<exists> xa. x = xa @ xb}" in finite_subset)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1295
        apply auto
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1296
        apply (induct x, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1297
        apply (subgoal_tac "{xb. \<exists>xa. a # x = xa @ xb} = insert (a # x) {xb. \<exists>xa. x = xa @ xb}")
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1298
        apply auto
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1299
        by (case_tac xaa, simp+)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1300
      have comparable: "\<forall> a \<in> {xb. \<exists> xa. x = xa @ xb \<and> xa \<in> L\<^isub>1\<star> \<and> xb \<noteq> [] \<and> xb @ z \<in> L\<^isub>1\<star>}. 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1301
                        \<forall> b \<in> {xb. \<exists> xa. x = xa @ xb \<and> xa \<in> L\<^isub>1\<star> \<and> xb \<noteq> [] \<and> xb @ z \<in> L\<^isub>1\<star>}.
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1302
                          ((b >>= a) \<or> (a >>= b))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1303
        by (auto simp:postfix_def, drule app_eq_elim, blast)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1304
      hence "\<exists> min. min \<in> {xb. \<exists> xa. x = xa @ xb \<and> xa \<in> L\<^isub>1\<star> \<and> xb \<noteq> [] \<and> xb @ z \<in> L\<^isub>1\<star>} 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1305
                \<and> (\<forall> xa xb. x = xa @ xb \<and> xa \<in> L\<^isub>1\<star> \<and> xb \<noteq> [] \<and> xb @ z \<in> L\<^isub>1\<star> \<longrightarrow> xb >>= min)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1306
        using finite_set not_empty comparable
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1307
        apply (drule_tac min_postfix_exists, simp)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1308
        by (erule exE, rule_tac x = min in exI, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1309
      then obtain min xa where x_decom: "x = xa @ min \<and> xa \<in> L\<^isub>1\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1310
        and min_not_empty: "min \<noteq> []"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1311
        and min_z_in_star: "min @ z \<in> L\<^isub>1\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1312
        and is_min: "\<forall> xa xb. x = xa @ xb \<and> xa \<in> L\<^isub>1\<star> \<and> xb \<noteq> [] \<and> xb @ z \<in> L\<^isub>1\<star> \<longrightarrow> xb >>= min"  by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1313
      from x_decom min_not_empty have "\<lbrakk>min\<rbrakk>L\<^isub>1 \<in> tag_str_STAR L\<^isub>1 x"  by (auto simp:tag_str_STAR_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1314
      hence "\<exists> yb. \<lbrakk>yb\<rbrakk>L\<^isub>1 \<in> tag_str_STAR L\<^isub>1 y \<and> \<lbrakk>min\<rbrakk>L\<^isub>1 = \<lbrakk>yb\<rbrakk>L\<^isub>1" using tag_eq by auto
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1315
      hence "\<exists> ya yb. y = ya @ yb \<and> ya \<in> L\<^isub>1\<star> \<and> min \<equiv>L\<^isub>1\<equiv> yb \<and> yb \<noteq> [] " 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1316
        by (simp add:tag_str_STAR_def equiv_class_def equiv_str_def split:if_splits, blast)        
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1317
      then obtain ya yb where y_decom: "y = ya @ yb"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1318
                          and ya_in_star: "ya \<in> L\<^isub>1\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1319
                          and yb_not_empty: "yb \<noteq> []"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1320
                          and min_yb_eq: "min \<equiv>L\<^isub>1\<equiv> yb"  by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1321
      from min_z_in_star min_yb_eq min_not_empty is_min x_decom
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1322
      have "yb @ z \<in> L\<^isub>1\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1323
        by (rule_tac x = x and xa = xa in inj_aux, simp+)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1324
      thus ?thesis using ya_in_star y_decom
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1325
        by (auto dest:star_prop)        
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1326
    qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1327
  qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1328
  show "tag_str_STAR L\<^isub>1 x = tag_str_STAR L\<^isub>1 (y::string) \<Longrightarrow> x \<equiv>L\<^isub>1\<star>\<equiv> y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1329
    by (auto intro:aux simp:equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1330
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1331
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1332
lemma quot_star:  
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1333
  assumes finite1: "finite (QUOT L\<^isub>1)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1334
  shows "finite (QUOT (L\<^isub>1\<star>))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1335
proof (rule_tac f = "(op `) (tag_str_STAR L\<^isub>1)" in finite_imageD)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1336
  show "finite (op ` (tag_str_STAR L\<^isub>1) ` QUOT (L\<^isub>1\<star>))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1337
    using finite_tag_image tag_str_star_range_finite finite1
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1338
    by auto
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1339
next
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1340
  show "inj_on (op ` (tag_str_STAR L\<^isub>1)) (QUOT (L\<^isub>1\<star>))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1341
    apply (rule_tac str_inj_imps)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1342
    by (erule_tac tag_str_star_inj)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1343
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1344
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1345
lemma other_direction:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1346
  "Lang = L (r::rexp) \<Longrightarrow> finite (QUOT Lang)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1347
apply (induct arbitrary:Lang rule:rexp.induct)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1348
apply (simp add:QUOT_def equiv_class_def equiv_str_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1349
by (simp_all add:quot_lambda quot_single quot_seq quot_alt quot_star)  
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1350
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1351
end