author | wu |
Tue, 14 Dec 2010 14:31:31 +0000 | |
changeset 27 | 90a57a533b0c |
child 28 | cef2893f353b |
permissions | -rw-r--r-- |
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 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
18 |
theorem ardens_revised: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
19 |
assumes nemp: "[] \<notin> A" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
20 |
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
|
21 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
22 |
assume eq: "X = B ;; A\<star>" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
23 |
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
|
24 |
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
|
25 |
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
|
26 |
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
|
27 |
by (auto) (metis append_assoc)+ |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
28 |
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
|
29 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
30 |
assume "X = X ;; A \<union> B" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
31 |
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
|
32 |
show "X = B ;; A\<star>" sorry |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
33 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
34 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
35 |
datatype rexp = |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
36 |
NULL |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
37 |
| EMPTY |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
38 |
| CHAR char |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
39 |
| SEQ rexp rexp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
40 |
| ALT rexp rexp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
41 |
| STAR rexp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
42 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
43 |
consts L:: "'a \<Rightarrow> string set" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
44 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
45 |
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
|
46 |
begin |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
47 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
48 |
fun |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
49 |
L_rexp :: "rexp \<Rightarrow> string set" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
50 |
where |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
51 |
"L_rexp (NULL) = {}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
52 |
| "L_rexp (EMPTY) = {[]}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
53 |
| "L_rexp (CHAR c) = {[c]}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
54 |
| "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
|
55 |
| "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
|
56 |
| "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
|
57 |
end |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
58 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
59 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
60 |
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
|
61 |
where |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
62 |
"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
|
63 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
64 |
lemma folds_simp_null [simp]: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
65 |
"finite rs \<Longrightarrow> x \<in> L (folds ALT NULL rs) \<longleftrightarrow> (\<exists>r \<in> rs. x \<in> L r)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
66 |
apply (simp add: folds_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
67 |
apply (rule someI2_ex) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
68 |
apply (erule finite_imp_fold_graph) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
69 |
apply (erule fold_graph.induct) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
70 |
apply (auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
71 |
done |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
72 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
73 |
lemma [simp]: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
74 |
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
|
75 |
by simp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
76 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
77 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
78 |
str_eq ("_ \<approx>_ _") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
79 |
where |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
80 |
"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
|
81 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
82 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
83 |
str_eq_rel ("\<approx>_") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
84 |
where |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
85 |
"\<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
|
86 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
87 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
88 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
89 |
section {* finite \<Rightarrow> regular *} |
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 |
transitions :: "string set \<Rightarrow> string set \<Rightarrow> rexp set" ("_\<Turnstile>\<Rightarrow>_") |
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 |
"Y \<Turnstile>\<Rightarrow> X \<equiv> {CHAR c | c. Y ;; {[c]} \<subseteq> X}" |
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 |
transitions_rexp ("_ \<turnstile>\<rightarrow> _") |
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 |
"Y \<turnstile>\<rightarrow> X \<equiv> folds ALT NULL (Y \<Turnstile>\<Rightarrow>X)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
100 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
101 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
102 |
"init_rhs CS X \<equiv> if X = {[]} |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
103 |
then {({[]}, EMPTY)} |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
104 |
else if ([] \<in> X) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
105 |
then insert ({[]}, EMPTY) {(Y, Y \<turnstile>\<rightarrow>X) | Y. Y \<in> CS} |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
106 |
else {(Y, Y \<turnstile>\<rightarrow>X) | Y. Y \<in> CS}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
107 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
108 |
overloading L_rhs \<equiv> "L:: (string set \<times> rexp) set \<Rightarrow> string set" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
109 |
begin |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
110 |
fun L_rhs:: "(string set \<times> rexp) set \<Rightarrow> string set" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
111 |
where |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
112 |
"L_rhs rhs = \<Union> {(Y;; L r) | Y r . (Y, r) \<in> rhs}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
113 |
end |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
114 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
115 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
116 |
"eqs CS \<equiv> (\<Union>X \<in> CS. {(X, init_rhs CS X)})" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
117 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
118 |
lemma [simp]: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
119 |
shows "finite (Y \<Turnstile>\<Rightarrow> X)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
120 |
unfolding transitions_def |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
121 |
by auto |
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 |
lemma defined_by_str: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
124 |
assumes "s \<in> X" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
125 |
and "X \<in> UNIV // (\<approx>Lang)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
126 |
shows "X = (\<approx>Lang) `` {s}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
127 |
using assms |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
128 |
unfolding quotient_def Image_def |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
129 |
unfolding str_eq_rel_def str_eq_def |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
130 |
by auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
131 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
132 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
133 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
134 |
(************ arden's lemma variation ********************) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
135 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
136 |
"rexp_of rhs X \<equiv> folds ALT NULL {r. (X, r) \<in> rhs}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
137 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
138 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
139 |
"arden_variate X rhs \<equiv> {(Y, SEQ r (STAR (rexp_of rhs X)))| Y r. (Y, r) \<in> rhs \<and> Y \<noteq> X}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
140 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
141 |
(************* rhs/equations property **************) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
142 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
143 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
144 |
"distinct_equas ES \<equiv> \<forall> X rhs rhs'. (X, rhs) \<in> ES \<and> (X, rhs') \<in> ES \<longrightarrow> rhs = rhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
145 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
146 |
(*********** substitution of ES *************) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
147 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
148 |
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
|
149 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
150 |
"rhs_subst rhs X xrhs \<equiv> {(Y, r) | Y r. Y \<noteq> X \<and> (Y, r) \<in> rhs} \<union> |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
151 |
{(X, SEQ r\<^isub>1 r\<^isub>2 ) | r\<^isub>1 r\<^isub>2. (X, r\<^isub>1) \<in> xrhs \<and> (X, r\<^isub>2) \<in> rhs}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
152 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
153 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
154 |
"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
|
155 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
156 |
text {* |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
157 |
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
|
158 |
*} |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
159 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
160 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
161 |
"ardenable ES \<equiv> \<forall> X rhs. (X, rhs) \<in> ES \<longrightarrow> ([] \<notin> L (rexp_of rhs X)) \<and> X = L rhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
162 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
163 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
164 |
"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
|
165 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
166 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
167 |
"self_contained ES \<equiv> \<forall> X xrhs. (X, xrhs) \<in> ES |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
168 |
\<longrightarrow> (\<forall> Y r.(Y, r) \<in> xrhs \<and> Y \<noteq> {[]} \<longrightarrow> (\<exists> yrhs. (Y, yrhs) \<in> ES))" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
169 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
170 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
171 |
"Inv ES \<equiv> finite ES \<and> distinct_equas ES \<and> ardenable ES \<and> non_empty ES \<and> self_contained ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
172 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
173 |
lemma wf_iter [rule_format]: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
174 |
fixes f |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
175 |
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
|
176 |
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
|
177 |
proof(induct e rule: wf_induct |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
178 |
[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
|
179 |
fix x |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
180 |
assume h [rule_format]: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
181 |
"\<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
|
182 |
and px: "P x" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
183 |
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
|
184 |
proof(cases "Q x") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
185 |
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
|
186 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
187 |
assume nq: "\<not> Q x" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
188 |
from step [OF px nq] |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
189 |
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
|
190 |
show ?thesis |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
191 |
proof(rule h) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
192 |
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
|
193 |
by (simp add:inv_image_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
194 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
195 |
from pe' show "P e'" . |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
196 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
197 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
198 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
199 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
200 |
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
|
201 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
202 |
lemma init_ES_satisfy_Inv: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
203 |
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
|
204 |
and X_in_eq_cls: "X \<in> (UNIV // (\<approx>Lang))" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
205 |
shows "Inv (eqs (UNIV // (\<approx>Lang)))" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
206 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
207 |
have "finite (eqs (UNIV // (\<approx>Lang)))" using finite_CS |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
208 |
by (auto simp add:eqs_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
209 |
moreover have "distinct_equas (eqs (UNIV // (\<approx>Lang)))" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
210 |
by (auto simp:distinct_equas_def eqs_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
211 |
moreover have "ardenable (eqs (UNIV // (\<approx>Lang)))" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
212 |
proof- |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
213 |
have "\<And> X rhs. (X, rhs) \<in> (eqs (UNIV // (\<approx>Lang))) \<Longrightarrow> ([] \<notin> L (rexp_of rhs X))" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
214 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
215 |
apply (auto simp:eqs_def rexp_of_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
216 |
sorry |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
217 |
moreover have "\<forall> X rhs. (X, rhs) \<in> (eqs (UNIV // (\<approx>Lang))) \<longrightarrow> X = L rhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
218 |
sorry |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
219 |
ultimately show ?thesis by (simp add:ardenable_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
220 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
221 |
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
|
222 |
by (auto simp:non_empty_def eqs_def quotient_def Image_def str_eq_rel_def str_eq_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
223 |
moreover have "self_contained (eqs (UNIV // (\<approx>Lang)))" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
224 |
by (auto simp:self_contained_def eqs_def init_rhs_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
225 |
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
|
226 |
qed |
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 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
229 |
text {* ****** BEGIN: proving every equation-system's iteration step satisfies Inv ***** *} |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
230 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
231 |
lemma iteration_step: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
232 |
assumes Inv_ES: "Inv ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
233 |
and X_in_ES: "\<exists> xrhs. (X, xrhs) \<in> ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
234 |
and not_T: "card ES > 1" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
235 |
shows "(\<exists> ES' xrhs'. Inv ES' \<and> (card ES', card ES) \<in> less_than \<and> (X, xrhs') \<in> ES')" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
236 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
237 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
238 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
239 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
240 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
241 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
242 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
243 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
244 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
245 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
246 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
247 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
248 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
249 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
250 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
251 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
252 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
253 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
254 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
255 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
256 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
257 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
258 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
259 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
260 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
261 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
262 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
263 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
264 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
265 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
266 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
267 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
268 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
269 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
270 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
271 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
272 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
273 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
274 |
lemma distinct_rhs_equations: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
275 |
"(X, xrhs) \<in> equations (UNIV Quo Lang) \<Longrightarrow> distinct_rhs xrhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
276 |
by (auto simp: equations_def equation_rhs_def distinct_rhs_def empty_rhs_def dest:no_two_cls_inters) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
277 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
278 |
lemma every_nonempty_eqclass_has_strings: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
279 |
"\<lbrakk>X \<in> (UNIV Quo Lang); X \<noteq> {[]}\<rbrakk> \<Longrightarrow> \<exists> clist. clist \<in> X \<and> clist \<noteq> []" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
280 |
by (auto simp: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
|
281 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
282 |
lemma every_eqclass_is_derived_from_empty: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
283 |
assumes not_empty: "X \<noteq> {[]}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
284 |
shows "X \<in> (UNIV Quo Lang) \<Longrightarrow> \<exists> clist. {[]};{clist} \<subseteq> X \<and> clist \<noteq> []" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
285 |
using not_empty |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
286 |
apply (drule_tac every_nonempty_eqclass_has_strings, simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
287 |
by (auto intro:exI[where x = clist] simp:lang_seq_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
288 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
289 |
lemma equiv_str_in_CS: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
290 |
"\<lbrakk>clist\<rbrakk>Lang \<in> (UNIV Quo Lang)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
291 |
by (auto simp:quot_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
292 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
293 |
lemma has_str_imp_defined_by_str: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
294 |
"\<lbrakk>str \<in> X; X \<in> UNIV Quo Lang\<rbrakk> \<Longrightarrow> X = \<lbrakk>str\<rbrakk>Lang" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
295 |
by (auto simp: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
|
296 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
297 |
lemma every_eqclass_has_ascendent: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
298 |
assumes has_str: "clist @ [c] \<in> X" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
299 |
and in_CS: "X \<in> UNIV Quo Lang" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
300 |
shows "\<exists> Y. Y \<in> UNIV Quo Lang \<and> Y-c\<rightarrow>X \<and> clist \<in> Y" (is "\<exists> Y. ?P Y") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
301 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
302 |
have "?P (\<lbrakk>clist\<rbrakk>Lang)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
303 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
304 |
have "\<lbrakk>clist\<rbrakk>Lang \<in> UNIV Quo Lang" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
305 |
by (simp add:quot_def, rule_tac x = clist in exI, simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
306 |
moreover have "\<lbrakk>clist\<rbrakk>Lang-c\<rightarrow>X" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
307 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
308 |
have "X = \<lbrakk>(clist @ [c])\<rbrakk>Lang" using has_str in_CS |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
309 |
by (auto intro!:has_str_imp_defined_by_str) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
310 |
moreover have "\<forall> sl. sl \<in> \<lbrakk>clist\<rbrakk>Lang \<longrightarrow> sl @ [c] \<in> \<lbrakk>(clist @ [c])\<rbrakk>Lang" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
311 |
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
|
312 |
ultimately show ?thesis unfolding CT_def lang_seq_def |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
313 |
by auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
314 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
315 |
moreover have "clist \<in> \<lbrakk>clist\<rbrakk>Lang" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
316 |
by (auto simp:equiv_str_def equiv_class_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
317 |
ultimately show "?P (\<lbrakk>clist\<rbrakk>Lang)" by simp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
318 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
319 |
thus ?thesis by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
320 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
321 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
322 |
lemma finite_charset_rS: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
323 |
"finite {CHAR c |c. Y-c\<rightarrow>X}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
324 |
by (rule_tac A = UNIV and f = CHAR in finite_surj, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
325 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
326 |
lemma l_eq_r_in_equations: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
327 |
assumes X_in_equas: "(X, xrhs) \<in> equations (UNIV Quo Lang)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
328 |
shows "X = L xrhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
329 |
proof (cases "X = {[]}") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
330 |
case True |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
331 |
thus ?thesis using X_in_equas |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
332 |
by (simp add:equations_def equation_rhs_def lang_seq_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
333 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
334 |
case False |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
335 |
show ?thesis |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
336 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
337 |
show "X \<subseteq> L xrhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
338 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
339 |
fix x |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
340 |
assume "(1)": "x \<in> X" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
341 |
show "x \<in> L xrhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
342 |
proof (cases "x = []") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
343 |
assume empty: "x = []" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
344 |
hence "x \<in> L (empty_rhs X)" using "(1)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
345 |
by (auto simp:empty_rhs_def lang_seq_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
346 |
thus ?thesis using X_in_equas False empty "(1)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
347 |
unfolding equations_def equation_rhs_def by auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
348 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
349 |
assume not_empty: "x \<noteq> []" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
350 |
hence "\<exists> clist c. x = clist @ [c]" by (case_tac x rule:rev_cases, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
351 |
then obtain clist c where decom: "x = clist @ [c]" by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
352 |
moreover have "\<And> Y. \<lbrakk>Y \<in> UNIV Quo Lang; Y-c\<rightarrow>X; clist \<in> Y\<rbrakk> |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
353 |
\<Longrightarrow> [c] \<in> L (folds ALT NULL {CHAR c |c. Y-c\<rightarrow>X})" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
354 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
355 |
fix Y |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
356 |
assume Y_is_eq_cl: "Y \<in> UNIV Quo Lang" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
357 |
and Y_CT_X: "Y-c\<rightarrow>X" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
358 |
and clist_in_Y: "clist \<in> Y" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
359 |
with finite_charset_rS |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
360 |
show "[c] \<in> L (folds ALT NULL {CHAR c |c. Y-c\<rightarrow>X})" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
361 |
by (auto simp :fold_alt_null_eqs) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
362 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
363 |
hence "\<exists>Xa. Xa \<in> UNIV Quo Lang \<and> clist @ [c] \<in> Xa ; L (folds ALT NULL {CHAR c |c. Xa-c\<rightarrow>X})" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
364 |
using X_in_equas False not_empty "(1)" decom |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
365 |
by (auto dest!:every_eqclass_has_ascendent simp:equations_def equation_rhs_def lang_seq_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
366 |
then obtain Xa where |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
367 |
"Xa \<in> UNIV Quo Lang \<and> clist @ [c] \<in> Xa ; L (folds ALT NULL {CHAR c |c. Xa-c\<rightarrow>X})" by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
368 |
hence "x \<in> L {(S, folds ALT NULL {CHAR c |c. S-c\<rightarrow>X}) |S. S \<in> UNIV Quo Lang}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
369 |
using X_in_equas "(1)" decom |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
370 |
by (auto simp add:equations_def equation_rhs_def intro!:exI[where x = Xa]) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
371 |
thus "x \<in> L xrhs" using X_in_equas False not_empty unfolding equations_def equation_rhs_def |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
372 |
by auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
373 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
374 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
375 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
376 |
show "L xrhs \<subseteq> X" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
377 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
378 |
fix x |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
379 |
assume "(2)": "x \<in> L xrhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
380 |
have "(2_1)": "\<And> s1 s2 r Xa. \<lbrakk>s1 \<in> Xa; s2 \<in> L (folds ALT NULL {CHAR c |c. Xa-c\<rightarrow>X})\<rbrakk> \<Longrightarrow> s1 @ s2 \<in> X" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
381 |
using finite_charset_rS |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
382 |
by (auto simp:CT_def lang_seq_def fold_alt_null_eqs) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
383 |
have "(2_2)": "\<And> s1 s2 Xa r.\<lbrakk>s1 \<in> Xa; s2 \<in> L r; (Xa, r) \<in> empty_rhs X\<rbrakk> \<Longrightarrow> s1 @ s2 \<in> X" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
384 |
by (simp add:empty_rhs_def split:if_splits) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
385 |
show "x \<in> X" using X_in_equas False "(2)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
386 |
by (auto intro:"(2_1)" "(2_2)" simp:equations_def equation_rhs_def lang_seq_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
387 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
388 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
389 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
390 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
391 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
392 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
393 |
lemma no_EMPTY_equations: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
394 |
"(X, xrhs) \<in> equations CS \<Longrightarrow> no_EMPTY_rhs xrhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
395 |
apply (clarsimp simp add:equations_def equation_rhs_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
396 |
apply (simp add:no_EMPTY_rhs_def empty_rhs_def, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
397 |
apply (subgoal_tac "finite {CHAR c |c. Xa-c\<rightarrow>X}", drule_tac x = "[]" in fold_alt_null_eqs, clarsimp, rule finite_charset_rS)+ |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
398 |
done |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
399 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
400 |
lemma init_ES_satisfy_ardenable: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
401 |
"(X, xrhs) \<in> equations (UNIV Quo Lang) \<Longrightarrow> ardenable (X, xrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
402 |
unfolding ardenable_def |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
403 |
by (auto intro:distinct_rhs_equations no_EMPTY_equations simp:l_eq_r_in_equations simp del:L_rhs.simps) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
404 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
405 |
lemma init_ES_satisfy_Inv: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
406 |
assumes finite_CS: "finite (UNIV Quo Lang)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
407 |
and X_in_eq_cls: "X \<in> UNIV Quo Lang" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
408 |
shows "Inv X (equations (UNIV Quo 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 (equations (UNIV Quo Lang))" using finite_CS |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
411 |
by (auto simp:equations_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
412 |
moreover have "\<exists>rhs. (X, rhs) \<in> equations (UNIV Quo Lang)" using X_in_eq_cls |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
413 |
by (simp add:equations_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
414 |
moreover have "distinct_equas (equations (UNIV Quo Lang))" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
415 |
by (auto simp:distinct_equas_def equations_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
416 |
moreover have "\<forall>X xrhs. (X, xrhs) \<in> equations (UNIV Quo Lang) \<longrightarrow> |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
417 |
rhs_eq_cls xrhs \<subseteq> insert {[]} (left_eq_cls (equations (UNIV Quo Lang)))" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
418 |
apply (simp add:left_eq_cls_def equations_def rhs_eq_cls_def equation_rhs_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
419 |
by (auto simp:empty_rhs_def split:if_splits) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
420 |
moreover have "\<forall>X xrhs. (X, xrhs) \<in> equations (UNIV Quo Lang) \<longrightarrow> X \<noteq> {}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
421 |
by (clarsimp simp:equations_def empty_notin_CS intro:classical) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
422 |
moreover have "\<forall>X xrhs. (X, xrhs) \<in> equations (UNIV Quo Lang) \<longrightarrow> ardenable (X, xrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
423 |
by (auto intro!:init_ES_satisfy_ardenable) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
424 |
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
|
425 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
426 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
427 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
428 |
text {* *********** END: 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
|
429 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
430 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
431 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
432 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
433 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
434 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
435 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
436 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
437 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
438 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
439 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
440 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
441 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
442 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
443 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
444 |
text {* ****** BEGIN: proving every equation-system's iteration step satisfies Inv ***** *} |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
445 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
446 |
lemma not_T_aux: "\<lbrakk>\<not> TCon (insert a A); x = a\<rbrakk> |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
447 |
\<Longrightarrow> \<exists>y. x \<noteq> y \<and> y \<in> insert a A " |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
448 |
apply (case_tac "insert a A = {a}") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
449 |
by (auto simp:TCon_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
450 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
451 |
lemma not_T_atleast_2[rule_format]: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
452 |
"finite S \<Longrightarrow> \<forall> x. x \<in> S \<and> (\<not> TCon S)\<longrightarrow> (\<exists> y. x \<noteq> y \<and> y \<in> S)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
453 |
apply (erule finite.induct, simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
454 |
apply (clarify, case_tac "x = a") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
455 |
by (erule not_T_aux, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
456 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
457 |
lemma exist_another_equa: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
458 |
"\<lbrakk>\<not> TCon ES; finite ES; distinct_equas ES; (X, rhl) \<in> ES\<rbrakk> \<Longrightarrow> \<exists> Y yrhl. (Y, yrhl) \<in> ES \<and> X \<noteq> Y" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
459 |
apply (drule not_T_atleast_2, simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
460 |
apply (clarsimp simp:distinct_equas_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
461 |
apply (drule_tac x= X in spec, drule_tac x = rhl in spec, drule_tac x = b in spec) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
462 |
by auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
463 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
464 |
lemma Inv_mono_with_lambda: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
465 |
assumes Inv_ES: "Inv X ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
466 |
and X_noteq_Y: "X \<noteq> {[]}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
467 |
shows "Inv X (ES - {({[]}, yrhs)})" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
468 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
469 |
have "finite (ES - {({[]}, yrhs)})" using Inv_ES |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
470 |
by (simp add:Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
471 |
moreover have "\<exists>rhs. (X, rhs) \<in> ES - {({[]}, yrhs)}" using Inv_ES X_noteq_Y |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
472 |
by (simp add:Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
473 |
moreover have "distinct_equas (ES - {({[]}, yrhs)})" using Inv_ES X_noteq_Y |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
474 |
apply (clarsimp simp:Inv_def distinct_equas_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
475 |
by (drule_tac x = Xa in spec, simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
476 |
moreover have "\<forall>X xrhs.(X, xrhs) \<in> ES - {({[]}, yrhs)} \<longrightarrow> |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
477 |
ardenable (X, xrhs) \<and> X \<noteq> {}" using Inv_ES |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
478 |
by (clarify, simp add:Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
479 |
moreover |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
480 |
have "insert {[]} (left_eq_cls (ES - {({[]}, yrhs)})) = insert {[]} (left_eq_cls ES)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
481 |
by (auto simp:left_eq_cls_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
482 |
hence "\<forall>X xrhs.(X, xrhs) \<in> ES - {({[]}, yrhs)} \<longrightarrow> |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
483 |
rhs_eq_cls xrhs \<subseteq> insert {[]} (left_eq_cls (ES - {({[]}, yrhs)}))" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
484 |
using Inv_ES by (auto simp:Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
485 |
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
|
486 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
487 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
488 |
lemma non_empty_card_prop: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
489 |
"finite ES \<Longrightarrow> \<forall>e. e \<in> ES \<longrightarrow> card ES - Suc 0 < card ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
490 |
apply (erule finite.induct, simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
491 |
apply (case_tac[!] "a \<in> A") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
492 |
by (auto simp:insert_absorb) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
493 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
494 |
lemma ardenable_prop: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
495 |
assumes not_lambda: "Y \<noteq> {[]}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
496 |
and ardable: "ardenable (Y, yrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
497 |
shows "\<exists> yrhs'. Y = L yrhs' \<and> distinct_rhs yrhs' \<and> rhs_eq_cls yrhs' = rhs_eq_cls yrhs - {Y}" (is "\<exists> yrhs'. ?P yrhs'") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
498 |
proof (cases "(\<exists> reg. (Y, reg) \<in> yrhs)") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
499 |
case True |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
500 |
thus ?thesis |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
501 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
502 |
fix reg |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
503 |
assume self_contained: "(Y, reg) \<in> yrhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
504 |
show ?thesis |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
505 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
506 |
have "?P (arden_variate Y reg yrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
507 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
508 |
have "Y = L (arden_variate Y reg yrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
509 |
using self_contained not_lambda ardable |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
510 |
by (rule_tac arden_variate_valid, simp_all add:ardenable_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
511 |
moreover have "distinct_rhs (arden_variate Y reg yrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
512 |
using ardable |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
513 |
by (auto simp:distinct_rhs_def arden_variate_def seq_rhs_r_def del_x_paired_def ardenable_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
514 |
moreover have "rhs_eq_cls (arden_variate Y reg yrhs) = rhs_eq_cls yrhs - {Y}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
515 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
516 |
have "\<And> rhs r. rhs_eq_cls (seq_rhs_r rhs r) = rhs_eq_cls rhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
517 |
apply (auto simp:rhs_eq_cls_def seq_rhs_r_def image_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
518 |
by (rule_tac x = "SEQ ra r" in exI, rule_tac x = "(x, ra)" in bexI, simp+) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
519 |
moreover have "\<And> rhs X. rhs_eq_cls (del_x_paired rhs X) = rhs_eq_cls rhs - {X}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
520 |
by (auto simp:rhs_eq_cls_def del_x_paired_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
521 |
ultimately show ?thesis by (simp add:arden_variate_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
522 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
523 |
ultimately show ?thesis by simp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
524 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
525 |
thus ?thesis by (rule_tac x= "arden_variate Y reg yrhs" in exI, simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
526 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
527 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
528 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
529 |
case False |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
530 |
hence "(2)": "rhs_eq_cls yrhs - {Y} = rhs_eq_cls yrhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
531 |
by (auto simp:rhs_eq_cls_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
532 |
show ?thesis |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
533 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
534 |
have "?P yrhs" using False ardable "(2)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
535 |
by (simp add:ardenable_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
536 |
thus ?thesis by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
537 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
538 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
539 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
540 |
lemma equas_subst_f_del_no_other: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
541 |
assumes self_contained: "(Y, rhs) \<in> ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
542 |
shows "\<exists> rhs'. (Y, rhs') \<in> (equas_subst_f X xrhs ` ES)" (is "\<exists> rhs'. ?P rhs'") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
543 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
544 |
have "\<exists> rhs'. equas_subst_f X xrhs (Y, rhs) = (Y, rhs')" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
545 |
by (auto simp:equas_subst_f_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
546 |
then obtain rhs' where "equas_subst_f X xrhs (Y, rhs) = (Y, rhs')" by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
547 |
hence "?P rhs'" unfolding image_def using self_contained |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
548 |
by (auto intro:bexI[where x = "(Y, rhs)"]) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
549 |
thus ?thesis by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
550 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
551 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
552 |
lemma del_x_paired_del_only_x: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
553 |
"\<lbrakk>X \<noteq> Y; (X, rhs) \<in> ES\<rbrakk> \<Longrightarrow> (X, rhs) \<in> del_x_paired ES Y" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
554 |
by (auto simp:del_x_paired_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
555 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
556 |
lemma equas_subst_del_no_other: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
557 |
"\<lbrakk>(X, rhs) \<in> ES; X \<noteq> Y\<rbrakk> \<Longrightarrow> (\<exists>rhs. (X, rhs) \<in> equas_subst ES Y rhs')" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
558 |
unfolding equas_subst_def |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
559 |
apply (drule_tac X = Y and xrhs = rhs' in equas_subst_f_del_no_other) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
560 |
by (erule exE, drule del_x_paired_del_only_x, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
561 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
562 |
lemma equas_subst_holds_distinct: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
563 |
"distinct_equas ES \<Longrightarrow> distinct_equas (equas_subst ES Y rhs')" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
564 |
apply (clarsimp simp add:equas_subst_def distinct_equas_def del_x_paired_def equas_subst_f_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
565 |
by (auto split:if_splits) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
566 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
567 |
lemma del_x_paired_dels: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
568 |
"(X, rhs) \<in> ES \<Longrightarrow> {Y. Y \<in> ES \<and> fst Y = X} \<inter> ES \<noteq> {}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
569 |
by (auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
570 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
571 |
lemma del_x_paired_subset: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
572 |
"(X, rhs) \<in> ES \<Longrightarrow> ES - {Y. Y \<in> ES \<and> fst Y = X} \<subset> ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
573 |
apply (drule del_x_paired_dels) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
574 |
by auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
575 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
576 |
lemma del_x_paired_card_less: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
577 |
"\<lbrakk>finite ES; (X, rhs) \<in> ES\<rbrakk> \<Longrightarrow> card (del_x_paired ES X) < card ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
578 |
apply (simp add:del_x_paired_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
579 |
apply (drule del_x_paired_subset) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
580 |
by (auto intro:psubset_card_mono) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
581 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
582 |
lemma equas_subst_card_less: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
583 |
"\<lbrakk>finite ES; (Y, yrhs) \<in> ES\<rbrakk> \<Longrightarrow> card (equas_subst ES Y rhs') < card ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
584 |
apply (simp add:equas_subst_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
585 |
apply (frule_tac h = "equas_subst_f Y rhs'" in finite_imageI) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
586 |
apply (drule_tac f = "equas_subst_f Y rhs'" in Finite_Set.card_image_le) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
587 |
apply (drule_tac X = Y and xrhs = rhs' in equas_subst_f_del_no_other,erule exE) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
588 |
by (drule del_x_paired_card_less, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
589 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
590 |
lemma equas_subst_holds_distinct_rhs: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
591 |
assumes dist': "distinct_rhs yrhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
592 |
and history: "\<forall>X xrhs. (X, xrhs) \<in> ES \<longrightarrow> ardenable (X, xrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
593 |
and X_in : "(X, xrhs) \<in> equas_subst ES Y yrhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
594 |
shows "distinct_rhs xrhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
595 |
using X_in history |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
596 |
apply (clarsimp simp:equas_subst_def del_x_paired_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
597 |
apply (drule_tac x = a in spec, drule_tac x = b in spec) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
598 |
apply (simp add:ardenable_def equas_subst_f_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
599 |
by (auto intro:rhs_subst_holds_distinct_rhs simp:dist' split:if_splits) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
600 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
601 |
lemma r_no_EMPTY_imp_seq_rhs_r_no_EMPTY: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
602 |
"[] \<notin> L r \<Longrightarrow> no_EMPTY_rhs (seq_rhs_r rhs r)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
603 |
by (auto simp:no_EMPTY_rhs_def seq_rhs_r_def lang_seq_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
604 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
605 |
lemma del_x_paired_holds_no_EMPTY: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
606 |
"no_EMPTY_rhs yrhs \<Longrightarrow> no_EMPTY_rhs (del_x_paired yrhs Y)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
607 |
by (auto simp:no_EMPTY_rhs_def del_x_paired_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
608 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
609 |
lemma rhs_subst_holds_no_EMPTY: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
610 |
"\<lbrakk>no_EMPTY_rhs yrhs; (Y, r) \<in> yrhs; Y \<noteq> {[]}\<rbrakk> \<Longrightarrow> no_EMPTY_rhs (rhs_subst yrhs Y rhs' r)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
611 |
apply (auto simp:rhs_subst_def intro!:no_EMPTY_rhss_imp_merge_no_EMPTY r_no_EMPTY_imp_seq_rhs_r_no_EMPTY del_x_paired_holds_no_EMPTY) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
612 |
by (auto simp:no_EMPTY_rhs_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
613 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
614 |
lemma equas_subst_holds_no_EMPTY: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
615 |
assumes substor: "Y \<noteq> {[]}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
616 |
and history: "\<forall>X xrhs. (X, xrhs) \<in> ES \<longrightarrow> ardenable (X, xrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
617 |
and X_in:"(X, xrhs) \<in> equas_subst ES Y yrhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
618 |
shows "no_EMPTY_rhs xrhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
619 |
proof- |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
620 |
from X_in have "\<exists> (Z, zrhs) \<in> ES. (X, xrhs) = equas_subst_f Y yrhs' (Z, zrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
621 |
by (auto simp add:equas_subst_def del_x_paired_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
622 |
then obtain Z zrhs where Z_in: "(Z, zrhs) \<in> ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
623 |
and X_Z: "(X, xrhs) = equas_subst_f Y yrhs' (Z, zrhs)" by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
624 |
hence dist_zrhs: "distinct_rhs zrhs" using history |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
625 |
by (auto simp:ardenable_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
626 |
show ?thesis |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
627 |
proof (cases "\<exists> r. (Y, r) \<in> zrhs") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
628 |
case True |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
629 |
then obtain r where Y_in_zrhs: "(Y, r) \<in> zrhs" .. |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
630 |
hence some: "(SOME r. (Y, r) \<in> zrhs) = r" using Z_in dist_zrhs |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
631 |
by (auto simp:distinct_rhs_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
632 |
hence "no_EMPTY_rhs (rhs_subst zrhs Y yrhs' r)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
633 |
using substor Y_in_zrhs history Z_in |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
634 |
by (rule_tac rhs_subst_holds_no_EMPTY, auto simp:ardenable_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
635 |
thus ?thesis using X_Z True some |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
636 |
by (simp add:equas_subst_def equas_subst_f_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
637 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
638 |
case False |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
639 |
hence "(X, xrhs) = (Z, zrhs)" using Z_in X_Z |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
640 |
by (simp add:equas_subst_f_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
641 |
thus ?thesis using history Z_in |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
642 |
by (auto simp:ardenable_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
643 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
644 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
645 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
646 |
lemma equas_subst_f_holds_left_eq_right: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
647 |
assumes substor: "Y = L rhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
648 |
and history: "\<forall>X xrhs. (X, xrhs) \<in> ES \<longrightarrow> distinct_rhs xrhs \<and> X = L xrhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
649 |
and subst: "(X, xrhs) = equas_subst_f Y rhs' (Z, zrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
650 |
and self_contained: "(Z, zrhs) \<in> ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
651 |
shows "X = L xrhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
652 |
proof (cases "\<exists> r. (Y, r) \<in> zrhs") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
653 |
case True |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
654 |
from True obtain r where "(1)":"(Y, r) \<in> zrhs" .. |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
655 |
show ?thesis |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
656 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
657 |
from history self_contained |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
658 |
have dist: "distinct_rhs zrhs" by auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
659 |
hence "(SOME r. (Y, r) \<in> zrhs) = r" using self_contained "(1)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
660 |
using distinct_rhs_def by (auto intro:some_equality) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
661 |
moreover have "L zrhs = L (rhs_subst zrhs Y rhs' r)" using substor dist "(1)" self_contained |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
662 |
by (rule_tac rhs_subst_prop1, auto simp:distinct_equas_rhs_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
663 |
ultimately show ?thesis using subst history self_contained |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
664 |
by (auto simp:equas_subst_f_def split:if_splits) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
665 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
666 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
667 |
case False |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
668 |
thus ?thesis using history subst self_contained |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
669 |
by (auto simp:equas_subst_f_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
670 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
671 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
672 |
lemma equas_subst_holds_left_eq_right: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
673 |
assumes history: "\<forall>X xrhs. (X, xrhs) \<in> ES \<longrightarrow> ardenable (X, xrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
674 |
and substor: "Y = L rhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
675 |
and X_in : "(X, xrhs) \<in> equas_subst ES Y yrhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
676 |
shows "\<forall>X xrhs. (X, xrhs) \<in> equas_subst ES Y rhs' \<longrightarrow> X = L xrhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
677 |
apply (clarsimp simp add:equas_subst_def del_x_paired_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
678 |
using substor |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
679 |
apply (drule_tac equas_subst_f_holds_left_eq_right) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
680 |
using history |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
681 |
by (auto simp:ardenable_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
682 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
683 |
lemma equas_subst_holds_ardenable: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
684 |
assumes substor: "Y = L yrhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
685 |
and history: "\<forall>X xrhs. (X, xrhs) \<in> ES \<longrightarrow> ardenable (X, xrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
686 |
and X_in:"(X, xrhs) \<in> equas_subst ES Y yrhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
687 |
and dist': "distinct_rhs yrhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
688 |
and not_lambda: "Y \<noteq> {[]}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
689 |
shows "ardenable (X, xrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
690 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
691 |
have "distinct_rhs xrhs" using history X_in dist' |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
692 |
by (auto dest:equas_subst_holds_distinct_rhs) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
693 |
moreover have "no_EMPTY_rhs xrhs" using history X_in not_lambda |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
694 |
by (auto intro:equas_subst_holds_no_EMPTY) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
695 |
moreover have "X = L xrhs" using history substor X_in |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
696 |
by (auto dest: equas_subst_holds_left_eq_right simp del:L_rhs.simps) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
697 |
ultimately show ?thesis using ardenable_def by simp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
698 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
699 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
700 |
lemma equas_subst_holds_cls_defined: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
701 |
assumes X_in: "(X, xrhs) \<in> equas_subst ES Y yrhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
702 |
and Inv_ES: "Inv X' ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
703 |
and subst: "(Y, yrhs) \<in> ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
704 |
and cls_holds_but_Y: "rhs_eq_cls yrhs' = rhs_eq_cls yrhs - {Y}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
705 |
shows "rhs_eq_cls xrhs \<subseteq> insert {[]} (left_eq_cls (equas_subst ES Y yrhs'))" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
706 |
proof- |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
707 |
have tac: "\<lbrakk> A \<subseteq> B; C \<subseteq> D; E \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> E \<subseteq> B \<union> D" by auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
708 |
from X_in have "\<exists> (Z, zrhs) \<in> ES. (X, xrhs) = equas_subst_f Y yrhs' (Z, zrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
709 |
by (auto simp add:equas_subst_def del_x_paired_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
710 |
then obtain Z zrhs where Z_in: "(Z, zrhs) \<in> ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
711 |
and X_Z: "(X, xrhs) = equas_subst_f Y yrhs' (Z, zrhs)" by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
712 |
hence "rhs_eq_cls zrhs \<subseteq> insert {[]} (left_eq_cls ES)" using Inv_ES |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
713 |
by (auto simp:Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
714 |
moreover have "rhs_eq_cls yrhs' \<subseteq> insert {[]} (left_eq_cls ES) - {Y}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
715 |
using Inv_ES subst cls_holds_but_Y |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
716 |
by (auto simp:Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
717 |
moreover have "rhs_eq_cls xrhs \<subseteq> rhs_eq_cls zrhs \<union> rhs_eq_cls yrhs' - {Y}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
718 |
using X_Z cls_holds_but_Y |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
719 |
apply (clarsimp simp add:equas_subst_f_def rhs_subst_def split:if_splits) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
720 |
by (auto simp:rhs_eq_cls_def merge_rhs_def del_x_paired_def seq_rhs_r_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
721 |
moreover have "left_eq_cls (equas_subst ES Y yrhs') = left_eq_cls ES - {Y}" using subst |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
722 |
by (auto simp: left_eq_cls_def equas_subst_def del_x_paired_def equas_subst_f_def |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
723 |
dest: equas_subst_f_del_no_other |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
724 |
split: if_splits) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
725 |
ultimately show ?thesis by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
726 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
727 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
728 |
lemma iteration_step: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
729 |
assumes Inv_ES: "Inv X ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
730 |
and not_T: "\<not> TCon ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
731 |
shows "(\<exists> ES'. Inv X ES' \<and> (card ES', card ES) \<in> less_than)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
732 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
733 |
from Inv_ES not_T have another: "\<exists>Y yrhs. (Y, yrhs) \<in> ES \<and> X \<noteq> Y" unfolding Inv_def |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
734 |
by (clarify, rule_tac exist_another_equa[where X = X], auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
735 |
then obtain Y yrhs where subst: "(Y, yrhs) \<in> ES" and not_X: " X \<noteq> Y" by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
736 |
show ?thesis (is "\<exists> ES'. ?P ES'") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
737 |
proof (cases "Y = {[]}") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
738 |
case True |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
739 |
--"in this situation, we pick a \"\<lambda>\" equation, thus directly remove it from the equation-system" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
740 |
have "?P (ES - {(Y, yrhs)})" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
741 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
742 |
show "Inv X (ES - {(Y, yrhs)})" using True not_X |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
743 |
by (simp add:Inv_ES Inv_mono_with_lambda) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
744 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
745 |
show "(card (ES - {(Y, yrhs)}), card ES) \<in> less_than" using Inv_ES subst |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
746 |
by (auto elim:non_empty_card_prop[rule_format] simp:Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
747 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
748 |
thus ?thesis by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
749 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
750 |
case False |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
751 |
--"in this situation, we pick a equation and using ardenable to get a |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
752 |
rhs without itself in it, then use equas_subst to form a new equation-system" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
753 |
hence "\<exists> yrhs'. Y = L yrhs' \<and> distinct_rhs yrhs' \<and> rhs_eq_cls yrhs' = rhs_eq_cls yrhs - {Y}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
754 |
using subst Inv_ES |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
755 |
by (auto intro:ardenable_prop simp add:Inv_def simp del:L_rhs.simps) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
756 |
then obtain yrhs' where Y'_l_eq_r: "Y = L yrhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
757 |
and dist_Y': "distinct_rhs yrhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
758 |
and cls_holds_but_Y: "rhs_eq_cls yrhs' = rhs_eq_cls yrhs - {Y}" by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
759 |
hence "?P (equas_subst ES Y yrhs')" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
760 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
761 |
have finite_del: "\<And> S x. finite S \<Longrightarrow> finite (del_x_paired S x)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
762 |
apply (rule_tac A = "del_x_paired S x" in finite_subset) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
763 |
by (auto simp:del_x_paired_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
764 |
have "finite (equas_subst ES Y yrhs')" using Inv_ES |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
765 |
by (auto intro!:finite_del simp:equas_subst_def Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
766 |
moreover have "\<exists>rhs. (X, rhs) \<in> equas_subst ES Y yrhs'" using Inv_ES not_X |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
767 |
by (auto intro:equas_subst_del_no_other simp:Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
768 |
moreover have "distinct_equas (equas_subst ES Y yrhs')" using Inv_ES |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
769 |
by (auto intro:equas_subst_holds_distinct simp:Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
770 |
moreover have "\<forall>X xrhs. (X, xrhs) \<in> equas_subst ES Y yrhs' \<longrightarrow> ardenable (X, xrhs)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
771 |
using Inv_ES dist_Y' False Y'_l_eq_r |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
772 |
apply (clarsimp simp:Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
773 |
by (rule equas_subst_holds_ardenable, simp_all) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
774 |
moreover have "\<forall>X xrhs. (X, xrhs) \<in> equas_subst ES Y yrhs' \<longrightarrow> X \<noteq> {}" using Inv_ES |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
775 |
by (clarsimp simp:equas_subst_def Inv_def del_x_paired_def equas_subst_f_def split:if_splits, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
776 |
moreover have "\<forall>X xrhs. (X, xrhs) \<in> equas_subst ES Y yrhs' \<longrightarrow> |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
777 |
rhs_eq_cls xrhs \<subseteq> insert {[]} (left_eq_cls (equas_subst ES Y yrhs'))" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
778 |
using Inv_ES subst cls_holds_but_Y |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
779 |
apply (rule_tac impI | rule_tac allI)+ |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
780 |
by (erule equas_subst_holds_cls_defined, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
781 |
moreover have "(card (equas_subst ES Y yrhs'), card ES) \<in> less_than"using Inv_ES subst |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
782 |
by (simp add:equas_subst_card_less Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
783 |
ultimately show "?P (equas_subst ES Y yrhs')" by (auto simp:Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
784 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
785 |
thus ?thesis by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
786 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
787 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
788 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
789 |
text {* ***** END: proving every equation-system's iteration step satisfies Inv ************** *} |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
790 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
791 |
lemma iteration_conc: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
792 |
assumes history: "Inv X ES" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
793 |
shows "\<exists> ES'. Inv X ES' \<and> TCon ES'" (is "\<exists> ES'. ?P ES'") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
794 |
proof (cases "TCon ES") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
795 |
case True |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
796 |
hence "?P ES" using history by simp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
797 |
thus ?thesis by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
798 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
799 |
case False |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
800 |
thus ?thesis using history iteration_step |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
801 |
by (rule_tac f = card in wf_iter, simp_all) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
802 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
803 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
804 |
lemma eqset_imp_iff': "A = B \<Longrightarrow> \<forall> x. x \<in> A \<longleftrightarrow> x \<in> B" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
805 |
apply (auto simp:mem_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
806 |
done |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
807 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
808 |
lemma set_cases2: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
809 |
"\<lbrakk>(A = {} \<Longrightarrow> R A); \<And> x. (A = {x}) \<Longrightarrow> R A; \<And> x y. \<lbrakk>x \<noteq> y; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> R A\<rbrakk> \<Longrightarrow> R A" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
810 |
apply (case_tac "A = {}", simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
811 |
by (case_tac "\<exists> x. A = {x}", clarsimp, blast) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
812 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
813 |
lemma rhs_aux:"\<lbrakk>distinct_rhs rhs; {Y. \<exists>r. (Y, r) \<in> rhs} = {X}\<rbrakk> \<Longrightarrow> (\<exists>r. rhs = {(X, r)})" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
814 |
apply (rule_tac A = rhs in set_cases2, simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
815 |
apply (drule_tac x = X in eqset_imp_iff, clarsimp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
816 |
apply (drule eqset_imp_iff',clarsimp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
817 |
apply (frule_tac x = a in spec, drule_tac x = aa in spec) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
818 |
by (auto simp:distinct_rhs_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
819 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
820 |
lemma every_eqcl_has_reg: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
821 |
assumes finite_CS: "finite (UNIV Quo Lang)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
822 |
and X_in_CS: "X \<in> (UNIV Quo Lang)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
823 |
shows "\<exists> (reg::rexp). L reg = X" (is "\<exists> r. ?E r") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
824 |
proof- |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
825 |
have "\<exists>ES'. Inv X ES' \<and> TCon ES'" using finite_CS X_in_CS |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
826 |
by (auto intro:init_ES_satisfy_Inv iteration_conc) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
827 |
then obtain ES' where Inv_ES': "Inv X ES'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
828 |
and TCon_ES': "TCon ES'" by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
829 |
from Inv_ES' TCon_ES' |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
830 |
have "\<exists> rhs. ES' = {(X, rhs)}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
831 |
apply (clarsimp simp:Inv_def TCon_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
832 |
apply (rule_tac x = rhs in exI) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
833 |
by (auto dest!:card_Suc_Diff1 simp:card_eq_0_iff) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
834 |
then obtain rhs where ES'_single_equa: "ES' = {(X, rhs)}" .. |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
835 |
hence X_ardenable: "ardenable (X, rhs)" using Inv_ES' |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
836 |
by (simp add:Inv_def) |
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 |
from X_ardenable have X_l_eq_r: "X = L rhs" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
839 |
by (simp add:ardenable_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
840 |
hence rhs_not_empty: "rhs \<noteq> {}" using Inv_ES' ES'_single_equa |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
841 |
by (auto simp:Inv_def ardenable_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
842 |
have rhs_eq_cls: "rhs_eq_cls rhs \<subseteq> {X, {[]}}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
843 |
using Inv_ES' ES'_single_equa |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
844 |
by (auto simp:Inv_def ardenable_def left_eq_cls_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
845 |
have X_not_empty: "X \<noteq> {}" using Inv_ES' ES'_single_equa |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
846 |
by (auto simp:Inv_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
847 |
show ?thesis |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
848 |
proof (cases "X = {[]}") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
849 |
case True |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
850 |
hence "?E EMPTY" by (simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
851 |
thus ?thesis by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
852 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
853 |
case False with X_ardenable |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
854 |
have "\<exists> rhs'. X = L rhs' \<and> rhs_eq_cls rhs' = rhs_eq_cls rhs - {X} \<and> distinct_rhs rhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
855 |
by (drule_tac ardenable_prop, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
856 |
then obtain rhs' where X_eq_rhs': "X = L rhs'" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
857 |
and rhs'_eq_cls: "rhs_eq_cls rhs' = rhs_eq_cls rhs - {X}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
858 |
and rhs'_dist : "distinct_rhs rhs'" by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
859 |
have "rhs_eq_cls rhs' \<subseteq> {{[]}}" using rhs_eq_cls False rhs'_eq_cls rhs_not_empty |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
860 |
by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
861 |
hence "rhs_eq_cls rhs' = {{[]}}" using X_not_empty X_eq_rhs' |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
862 |
by (auto simp:rhs_eq_cls_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
863 |
hence "\<exists> r. rhs' = {({[]}, r)}" using rhs'_dist |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
864 |
by (auto intro:rhs_aux simp:rhs_eq_cls_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
865 |
then obtain r where "rhs' = {({[]}, r)}" .. |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
866 |
hence "?E r" using X_eq_rhs' by (auto simp add:lang_seq_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
867 |
thus ?thesis by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
868 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
869 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
870 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
871 |
text {* definition of a regular language *} |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
872 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
873 |
abbreviation |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
874 |
reg :: "string set => bool" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
875 |
where |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
876 |
"reg L1 \<equiv> (\<exists>r::rexp. L r = L1)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
877 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
878 |
theorem myhill_nerode: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
879 |
assumes finite_CS: "finite (UNIV Quo Lang)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
880 |
shows "\<exists> (reg::rexp). Lang = L reg" (is "\<exists> r. ?P r") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
881 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
882 |
have has_r_each: "\<forall>C\<in>{X \<in> UNIV Quo Lang. \<forall>x\<in>X. x \<in> Lang}. \<exists>(r::rexp). C = L r" using finite_CS |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
883 |
by (auto dest:every_eqcl_has_reg) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
884 |
have "\<exists> (rS::rexp set). finite rS \<and> |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
885 |
(\<forall> C \<in> {X \<in> UNIV Quo Lang. \<forall>x\<in>X. x \<in> Lang}. \<exists> r \<in> rS. C = L r) \<and> |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
886 |
(\<forall> r \<in> rS. \<exists> C \<in> {X \<in> UNIV Quo Lang. \<forall>x\<in>X. x \<in> Lang}. C = L r)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
887 |
(is "\<exists> rS. ?Q rS") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
888 |
proof- |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
889 |
have "\<And> C. C \<in> {X \<in> UNIV Quo Lang. \<forall>x\<in>X. x \<in> Lang} \<Longrightarrow> C = L (SOME (ra::rexp). C = L ra)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
890 |
using has_r_each |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
891 |
apply (erule_tac x = C in ballE, erule_tac exE) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
892 |
by (rule_tac a = r in someI2, simp+) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
893 |
hence "?Q ((\<lambda> C. SOME r. C = L r) ` {X \<in> UNIV Quo Lang. \<forall>x\<in>X. x \<in> Lang})" using has_r_each |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
894 |
using finite_CS by auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
895 |
thus ?thesis by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
896 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
897 |
then obtain rS where finite_rS : "finite rS" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
898 |
and has_r_each': "\<forall> C \<in> {X \<in> UNIV Quo Lang. \<forall>x\<in>X. x \<in> Lang}. \<exists> r \<in> (rS::rexp set). C = L r" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
899 |
and has_cl_each: "\<forall> r \<in> (rS::rexp set). \<exists> C \<in> {X \<in> UNIV Quo Lang. \<forall>x\<in>X. x \<in> Lang}. C = L r" by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
900 |
have "?P (folds ALT NULL rS)" |
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 |
show "Lang \<subseteq> L (folds ALT NULL rS)" using finite_rS lang_eqs_union_of_eqcls[of Lang] has_r_each' |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
903 |
apply (clarsimp simp:fold_alt_null_eqs) by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
904 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
905 |
show "L (folds ALT NULL rS) \<subseteq> Lang" using finite_rS lang_eqs_union_of_eqcls[of Lang] has_cl_each |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
906 |
by (clarsimp simp:fold_alt_null_eqs) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
907 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
908 |
thus ?thesis 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 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
911 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
912 |
text {* tests by Christian *} |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
913 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
914 |
(* Alternative definition for Quo *) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
915 |
definition |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
916 |
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
|
917 |
where |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
918 |
"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
|
919 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
920 |
lemma test: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
921 |
"UNIV Quo Lang = QUOT Lang" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
922 |
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
|
923 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
924 |
lemma test1: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
925 |
assumes finite_CS: "finite (QUOT Lang)" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
926 |
shows "reg Lang" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
927 |
using finite_CS |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
928 |
unfolding test[symmetric] |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
929 |
by (auto dest: myhill_nerode) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
930 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
931 |
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
|
932 |
by simp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
933 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
934 |
lemma quot_lambda: "QUOT {[]} = {{[]}, UNIV - {[]}}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
935 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
936 |
show "QUOT {[]} \<subseteq> {{[]}, UNIV - {[]}}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
937 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
938 |
fix x |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
939 |
assume in_quot: "x \<in> QUOT {[]}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
940 |
show "x \<in> {{[]}, UNIV - {[]}}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
941 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
942 |
from in_quot |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
943 |
have "x = {[]} \<or> x = UNIV - {[]}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
944 |
unfolding QUOT_def equiv_class_def |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
945 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
946 |
fix xa |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
947 |
assume in_univ: "xa \<in> UNIV" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
948 |
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
|
949 |
show "x = {[]} \<or> x = UNIV - {[]}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
950 |
proof(cases "xa = []") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
951 |
case True |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
952 |
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
|
953 |
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
|
954 |
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
|
955 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
956 |
case False |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
957 |
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
|
958 |
by (auto simp:equiv_str_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
959 |
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
|
960 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
961 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
962 |
thus ?thesis by simp |
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 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
965 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
966 |
show "{{[]}, UNIV - {[]}} \<subseteq> QUOT {[]}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
967 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
968 |
fix x |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
969 |
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
|
970 |
show "x \<in> (QUOT {[]})" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
971 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
972 |
have "x = {[]} \<Longrightarrow> x \<in> QUOT {[]}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
973 |
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
|
974 |
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
|
975 |
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
|
976 |
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
|
977 |
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
|
978 |
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
|
979 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
980 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
981 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
982 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
983 |
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
|
984 |
by (induct x, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
985 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
986 |
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
|
987 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
988 |
fix c::"char" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
989 |
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
|
990 |
apply (case_tac "c = CHR ''a''") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
991 |
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
|
992 |
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
|
993 |
show "QUOT {[c]} = {{[]}, {[c]}, UNIV - {[], [c]}}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
994 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
995 |
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
|
996 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
997 |
fix x |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
998 |
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
|
999 |
show "x \<in> {{[]}, {[c]}, UNIV - {[],[c]}}" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1000 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1001 |
from in_quot |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1002 |
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
|
1003 |
unfolding QUOT_def equiv_class_def |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1004 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1005 |
fix xa |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1006 |
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
|
1007 |
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
|
1008 |
proof- |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1009 |
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
|
1010 |
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
|
1011 |
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
|
1012 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1013 |
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
|
1014 |
apply (simp add:equiv_str_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1015 |
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
|
1016 |
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
|
1017 |
done |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1018 |
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
|
1019 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1020 |
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
|
1021 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1022 |
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
|
1023 |
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
|
1024 |
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
|
1025 |
apply (rule conjI) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1026 |
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
|
1027 |
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
|
1028 |
by (auto dest:quot_single_aux) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1029 |
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
|
1030 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1031 |
ultimately show ?thesis by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1032 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1033 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1034 |
thus ?thesis by simp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1035 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1036 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1037 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1038 |
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
|
1039 |
proof |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1040 |
fix x |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1041 |
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
|
1042 |
show "x \<in> (QUOT {[c]})" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1043 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1044 |
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
|
1045 |
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
|
1046 |
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
|
1047 |
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
|
1048 |
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
|
1049 |
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
|
1050 |
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
|
1051 |
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
|
1052 |
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
|
1053 |
using exist_another |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1054 |
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
|
1055 |
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
|
1056 |
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
|
1057 |
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
|
1058 |
apply (rule conjI) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1059 |
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
|
1060 |
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
|
1061 |
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
|
1062 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1063 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1064 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1065 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1066 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1067 |
lemma eq_class_imp_eq_str: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1068 |
"\<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
|
1069 |
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
|
1070 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1071 |
lemma finite_tag_image: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1072 |
"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
|
1073 |
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
|
1074 |
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
|
1075 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1076 |
lemma str_inj_imps: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1077 |
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
|
1078 |
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
|
1079 |
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
|
1080 |
fix x y |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1081 |
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
|
1082 |
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
|
1083 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1084 |
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
|
1085 |
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
|
1086 |
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
|
1087 |
by auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1088 |
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
|
1089 |
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
|
1090 |
show ?thesis using eq_tag |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1091 |
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
|
1092 |
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
|
1093 |
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
|
1094 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1095 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1096 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1097 |
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
|
1098 |
where |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1099 |
"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
|
1100 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1101 |
lemma tag_str_alt_range_finite: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1102 |
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
|
1103 |
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
|
1104 |
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
|
1105 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1106 |
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
|
1107 |
by (auto simp:QUOT_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1108 |
thus ?thesis using finite1 finite2 |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1109 |
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
|
1110 |
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
|
1111 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1112 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1113 |
lemma tag_str_alt_inj: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1114 |
"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
|
1115 |
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
|
1116 |
by blast |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1117 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1118 |
lemma quot_alt: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1119 |
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
|
1120 |
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
|
1121 |
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
|
1122 |
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
|
1123 |
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
|
1124 |
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
|
1125 |
by auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1126 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1127 |
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
|
1128 |
apply (rule_tac str_inj_imps) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1129 |
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
|
1130 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1131 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1132 |
(* 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
|
1133 |
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
|
1134 |
where |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1135 |
"list_diff [] xs = []" | |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1136 |
"list_diff (x#xs) [] = x#xs" | |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1137 |
"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
|
1138 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1139 |
lemma [simp]: "(x @ y) - x = y" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1140 |
apply (induct x) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1141 |
by (case_tac y, simp+) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1142 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1143 |
lemma [simp]: "x - x = []" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1144 |
by (induct x, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1145 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1146 |
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
|
1147 |
by (induct x, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1148 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1149 |
lemma [simp]: "x - [] = x" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1150 |
by (induct x, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1151 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1152 |
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
|
1153 |
by (auto elim:prefixE) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1154 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1155 |
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
|
1156 |
where |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1157 |
"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
|
1158 |
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
|
1159 |
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
|
1160 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1161 |
lemma tag_seq_eq_E: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1162 |
"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
|
1163 |
((\<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
|
1164 |
{\<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
|
1165 |
((\<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
|
1166 |
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
|
1167 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1168 |
lemma tag_str_seq_range_finite: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1169 |
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
|
1170 |
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
|
1171 |
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
|
1172 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1173 |
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
|
1174 |
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
|
1175 |
thus ?thesis using finite1 finite2 |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1176 |
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
|
1177 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1178 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1179 |
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
|
1180 |
"\<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
|
1181 |
(\<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
|
1182 |
apply (induct z) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1183 |
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
|
1184 |
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
|
1185 |
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
|
1186 |
apply (rule allI | rule impI)+ |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1187 |
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
|
1188 |
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
|
1189 |
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
|
1190 |
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
|
1191 |
apply (erule exE | erule conjE)+ |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1192 |
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
|
1193 |
done |
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 |
lemma tag_str_seq_inj: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1196 |
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
|
1197 |
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
|
1198 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1199 |
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
|
1200 |
\<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
|
1201 |
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
|
1202 |
fix x y z |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1203 |
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
|
1204 |
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
|
1205 |
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
|
1206 |
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
|
1207 |
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
|
1208 |
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
|
1209 |
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
|
1210 |
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
|
1211 |
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
|
1212 |
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
|
1213 |
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
|
1214 |
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
|
1215 |
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
|
1216 |
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
|
1217 |
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
|
1218 |
by (auto simp:lang_seq_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1219 |
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
|
1220 |
by (erule_tac prefixE, simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1221 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1222 |
fix x y z |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1223 |
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
|
1224 |
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
|
1225 |
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
|
1226 |
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
|
1227 |
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
|
1228 |
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
|
1229 |
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
|
1230 |
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
|
1231 |
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
|
1232 |
apply (simp add:lang_seq_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1233 |
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
|
1234 |
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
|
1235 |
by (erule_tac prefixE, simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1236 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1237 |
show ?thesis using tag_eq |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1238 |
apply (simp add:equiv_str_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1239 |
by (auto intro:aux) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1240 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1241 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1242 |
lemma quot_seq: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1243 |
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
|
1244 |
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
|
1245 |
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
|
1246 |
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
|
1247 |
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
|
1248 |
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
|
1249 |
by auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1250 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1251 |
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
|
1252 |
apply (rule_tac str_inj_imps) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1253 |
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
|
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 |
(****************** the STAR case ************************) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1257 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1258 |
lemma app_eq_elim[rule_format]: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1259 |
"\<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
|
1260 |
(\<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
|
1261 |
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
|
1262 |
apply (rule allI | rule impI)+ |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1263 |
by (case_tac x, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1264 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1265 |
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
|
1266 |
where |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1267 |
"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
|
1268 |
then {} |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1269 |
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
|
1270 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1271 |
lemma tag_str_star_range_finite: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1272 |
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
|
1273 |
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
|
1274 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1275 |
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
|
1276 |
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
|
1277 |
thus ?thesis using finite1 |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1278 |
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
|
1279 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1280 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1281 |
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
|
1282 |
by (erule Star.induct, auto) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1283 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1284 |
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
|
1285 |
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
|
1286 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1287 |
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
|
1288 |
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
|
1289 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1290 |
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
|
1291 |
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
|
1292 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1293 |
lemma inj_aux: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1294 |
"\<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
|
1295 |
\<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
|
1296 |
\<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
|
1297 |
proof- |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1298 |
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
|
1299 |
(\<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
|
1300 |
apply (erule Star.induct, simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1301 |
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
|
1302 |
apply (drule app_eq_elim) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1303 |
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
|
1304 |
apply simp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1305 |
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
|
1306 |
apply (rule step) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1307 |
apply (simp add:equiv_str_def) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1308 |
apply simp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1309 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1310 |
apply (erule exE | erule conjE)+ |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1311 |
apply (rotate_tac 3) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1312 |
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
|
1313 |
apply (rotate_tac 12) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1314 |
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
|
1315 |
apply (erule impE) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1316 |
apply ( simp add:star_prop3) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1317 |
apply (simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1318 |
apply (drule postfix_prop) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1319 |
apply simp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1320 |
done |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1321 |
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
|
1322 |
\<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
|
1323 |
\<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
|
1324 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1325 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1326 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1327 |
lemma min_postfix_exists[rule_format]: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1328 |
"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
|
1329 |
\<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
|
1330 |
apply (erule finite.induct) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1331 |
apply simp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1332 |
apply simp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1333 |
apply (case_tac "A = {}") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1334 |
apply simp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1335 |
apply clarsimp |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1336 |
apply (case_tac "a >>= min") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1337 |
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
|
1338 |
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
|
1339 |
apply clarify |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1340 |
apply (rotate_tac 5) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1341 |
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
|
1342 |
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
|
1343 |
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
|
1344 |
by simp+ |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1345 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1346 |
lemma tag_str_star_inj: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1347 |
"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
|
1348 |
proof - |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1349 |
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
|
1350 |
proof- |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1351 |
fix x y z |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1352 |
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
|
1353 |
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
|
1354 |
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
|
1355 |
proof (cases "x = []") |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1356 |
case True |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1357 |
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
|
1358 |
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
|
1359 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1360 |
case False |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1361 |
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
|
1362 |
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
|
1363 |
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
|
1364 |
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
|
1365 |
apply auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1366 |
apply (induct x, simp) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1367 |
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
|
1368 |
apply auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1369 |
by (case_tac xaa, simp+) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1370 |
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
|
1371 |
\<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
|
1372 |
((b >>= a) \<or> (a >>= b))" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1373 |
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
|
1374 |
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
|
1375 |
\<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
|
1376 |
using finite_set not_empty comparable |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1377 |
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
|
1378 |
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
|
1379 |
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
|
1380 |
and min_not_empty: "min \<noteq> []" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1381 |
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
|
1382 |
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
|
1383 |
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
|
1384 |
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
|
1385 |
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
|
1386 |
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
|
1387 |
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
|
1388 |
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
|
1389 |
and yb_not_empty: "yb \<noteq> []" |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1390 |
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
|
1391 |
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
|
1392 |
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
|
1393 |
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
|
1394 |
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
|
1395 |
by (auto dest:star_prop) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1396 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1397 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1398 |
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
|
1399 |
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
|
1400 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1401 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1402 |
lemma quot_star: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1403 |
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
|
1404 |
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
|
1405 |
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
|
1406 |
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
|
1407 |
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
|
1408 |
by auto |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1409 |
next |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1410 |
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
|
1411 |
apply (rule_tac str_inj_imps) |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1412 |
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
|
1413 |
qed |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1414 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1415 |
lemma other_direction: |
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1416 |
"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
|
1417 |
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
|
1418 |
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
|
1419 |
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
|
1420 |
|
90a57a533b0c
Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff
changeset
|
1421 |
end |