author | wenzelm |
Tue, 01 Sep 2020 16:57:54 +0200 | |
changeset 72233 | c17d0227205c |
parent 67443 | 3abf6a722518 |
permissions | -rw-r--r-- |
59189 | 1 |
chapter \<open>Case Study: Single and Multi-Mutator Garbage Collection Algorithms\<close> |
13020 | 2 |
|
59189 | 3 |
section \<open>Formalization of the Memory\<close> |
13020 | 4 |
|
16417 | 5 |
theory Graph imports Main begin |
13020 | 6 |
|
58310 | 7 |
datatype node = Black | White |
13020 | 8 |
|
42174 | 9 |
type_synonym nodes = "node list" |
10 |
type_synonym edge = "nat \<times> nat" |
|
11 |
type_synonym edges = "edge list" |
|
13020 | 12 |
|
13 |
consts Roots :: "nat set" |
|
14 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
32960
diff
changeset
|
15 |
definition Proper_Roots :: "nodes \<Rightarrow> bool" where |
13020 | 16 |
"Proper_Roots M \<equiv> Roots\<noteq>{} \<and> Roots \<subseteq> {i. i<length M}" |
17 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
32960
diff
changeset
|
18 |
definition Proper_Edges :: "(nodes \<times> edges) \<Rightarrow> bool" where |
13020 | 19 |
"Proper_Edges \<equiv> (\<lambda>(M,E). \<forall>i<length E. fst(E!i)<length M \<and> snd(E!i)<length M)" |
20 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
32960
diff
changeset
|
21 |
definition BtoW :: "(edge \<times> nodes) \<Rightarrow> bool" where |
13020 | 22 |
"BtoW \<equiv> (\<lambda>(e,M). (M!fst e)=Black \<and> (M!snd e)\<noteq>Black)" |
23 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
32960
diff
changeset
|
24 |
definition Blacks :: "nodes \<Rightarrow> nat set" where |
13020 | 25 |
"Blacks M \<equiv> {i. i<length M \<and> M!i=Black}" |
26 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
32960
diff
changeset
|
27 |
definition Reach :: "edges \<Rightarrow> nat set" where |
13020 | 28 |
"Reach E \<equiv> {x. (\<exists>path. 1<length path \<and> path!(length path - 1)\<in>Roots \<and> x=path!0 |
29 |
\<and> (\<forall>i<length path - 1. (\<exists>j<length E. E!j=(path!(i+1), path!i)))) |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32642
diff
changeset
|
30 |
\<or> x\<in>Roots}" |
13020 | 31 |
|
59189 | 32 |
text\<open>Reach: the set of reachable nodes is the set of Roots together with the |
13020 | 33 |
nodes reachable from some Root by a path represented by a list of |
34 |
nodes (at least two since we traverse at least one edge), where two |
|
59189 | 35 |
consecutive nodes correspond to an edge in E.\<close> |
13020 | 36 |
|
59189 | 37 |
subsection \<open>Proofs about Graphs\<close> |
13020 | 38 |
|
39 |
lemmas Graph_defs= Blacks_def Proper_Roots_def Proper_Edges_def BtoW_def |
|
40 |
declare Graph_defs [simp] |
|
41 |
||
59189 | 42 |
subsubsection\<open>Graph 1\<close> |
13020 | 43 |
|
59189 | 44 |
lemma Graph1_aux [rule_format]: |
13020 | 45 |
"\<lbrakk> Roots\<subseteq>Blacks M; \<forall>i<length E. \<not>BtoW(E!i,M)\<rbrakk> |
59189 | 46 |
\<Longrightarrow> 1< length path \<longrightarrow> (path!(length path - 1))\<in>Roots \<longrightarrow> |
47 |
(\<forall>i<length path - 1. (\<exists>j. j < length E \<and> E!j=(path!(Suc i), path!i))) |
|
13020 | 48 |
\<longrightarrow> M!(path!0) = Black" |
49 |
apply(induct_tac "path") |
|
50 |
apply force |
|
51 |
apply clarify |
|
52 |
apply simp |
|
53 |
apply(case_tac "list") |
|
54 |
apply force |
|
55 |
apply simp |
|
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
54863
diff
changeset
|
56 |
apply(rename_tac lista) |
13601 | 57 |
apply(rotate_tac -2) |
13020 | 58 |
apply(erule_tac x = "0" in all_dupE) |
59 |
apply simp |
|
60 |
apply clarify |
|
61 |
apply(erule allE , erule (1) notE impE) |
|
62 |
apply simp |
|
63 |
apply(erule mp) |
|
64 |
apply(case_tac "lista") |
|
65 |
apply force |
|
66 |
apply simp |
|
67 |
apply(erule mp) |
|
68 |
apply clarify |
|
69 |
apply(erule_tac x = "Suc i" in allE) |
|
70 |
apply force |
|
71 |
done |
|
72 |
||
59189 | 73 |
lemma Graph1: |
74 |
"\<lbrakk>Roots\<subseteq>Blacks M; Proper_Edges(M, E); \<forall>i<length E. \<not>BtoW(E!i,M) \<rbrakk> |
|
13020 | 75 |
\<Longrightarrow> Reach E\<subseteq>Blacks M" |
76 |
apply (unfold Reach_def) |
|
77 |
apply simp |
|
78 |
apply clarify |
|
79 |
apply(erule disjE) |
|
80 |
apply clarify |
|
81 |
apply(rule conjI) |
|
82 |
apply(subgoal_tac "0< length path - Suc 0") |
|
83 |
apply(erule allE , erule (1) notE impE) |
|
84 |
apply force |
|
85 |
apply simp |
|
86 |
apply(rule Graph1_aux) |
|
87 |
apply auto |
|
88 |
done |
|
89 |
||
59189 | 90 |
subsubsection\<open>Graph 2\<close> |
13020 | 91 |
|
59189 | 92 |
lemma Ex_first_occurrence [rule_format]: |
58860 | 93 |
"P (n::nat) \<longrightarrow> (\<exists>m. P m \<and> (\<forall>i. i<m \<longrightarrow> \<not> P i))" |
13020 | 94 |
apply(rule nat_less_induct) |
95 |
apply clarify |
|
96 |
apply(case_tac "\<forall>m. m<n \<longrightarrow> \<not> P m") |
|
97 |
apply auto |
|
98 |
done |
|
99 |
||
100 |
lemma Compl_lemma: "(n::nat)\<le>l \<Longrightarrow> (\<exists>m. m\<le>l \<and> n=l - m)" |
|
101 |
apply(rule_tac x = "l - n" in exI) |
|
102 |
apply arith |
|
103 |
done |
|
104 |
||
59189 | 105 |
lemma Ex_last_occurrence: |
13020 | 106 |
"\<lbrakk>P (n::nat); n\<le>l\<rbrakk> \<Longrightarrow> (\<exists>m. P (l - m) \<and> (\<forall>i. i<m \<longrightarrow> \<not>P (l - i)))" |
107 |
apply(drule Compl_lemma) |
|
108 |
apply clarify |
|
109 |
apply(erule Ex_first_occurrence) |
|
110 |
done |
|
111 |
||
59189 | 112 |
lemma Graph2: |
13020 | 113 |
"\<lbrakk>T \<in> Reach E; R<length E\<rbrakk> \<Longrightarrow> T \<in> Reach (E[R:=(fst(E!R), T)])" |
114 |
apply (unfold Reach_def) |
|
115 |
apply clarify |
|
116 |
apply simp |
|
117 |
apply(case_tac "\<forall>z<length path. fst(E!R)\<noteq>path!z") |
|
118 |
apply(rule_tac x = "path" in exI) |
|
119 |
apply simp |
|
120 |
apply clarify |
|
121 |
apply(erule allE , erule (1) notE impE) |
|
122 |
apply clarify |
|
123 |
apply(rule_tac x = "j" in exI) |
|
124 |
apply(case_tac "j=R") |
|
125 |
apply(erule_tac x = "Suc i" in allE) |
|
126 |
apply simp |
|
127 |
apply (force simp add:nth_list_update) |
|
128 |
apply simp |
|
129 |
apply(erule exE) |
|
130 |
apply(subgoal_tac "z \<le> length path - Suc 0") |
|
131 |
prefer 2 apply arith |
|
132 |
apply(drule_tac P = "\<lambda>m. m<length path \<and> fst(E!R)=path!m" in Ex_last_occurrence) |
|
133 |
apply assumption |
|
134 |
apply clarify |
|
135 |
apply simp |
|
136 |
apply(rule_tac x = "(path!0)#(drop (length path - Suc m) path)" in exI) |
|
137 |
apply simp |
|
138 |
apply(case_tac "length path - (length path - Suc m)") |
|
139 |
apply arith |
|
140 |
apply simp |
|
141 |
apply(subgoal_tac "(length path - Suc m) + nat \<le> length path") |
|
142 |
prefer 2 apply arith |
|
143 |
apply(subgoal_tac "length path - Suc m + nat = length path - Suc 0") |
|
59189 | 144 |
prefer 2 apply arith |
13020 | 145 |
apply clarify |
146 |
apply(case_tac "i") |
|
147 |
apply(force simp add: nth_list_update) |
|
148 |
apply simp |
|
149 |
apply(subgoal_tac "(length path - Suc m) + nata \<le> length path") |
|
150 |
prefer 2 apply arith |
|
151 |
apply(subgoal_tac "(length path - Suc m) + (Suc nata) \<le> length path") |
|
152 |
prefer 2 apply arith |
|
153 |
apply simp |
|
154 |
apply(erule_tac x = "length path - Suc m + nata" in allE) |
|
155 |
apply simp |
|
156 |
apply clarify |
|
157 |
apply(rule_tac x = "j" in exI) |
|
158 |
apply(case_tac "R=j") |
|
159 |
prefer 2 apply force |
|
160 |
apply simp |
|
161 |
apply(drule_tac t = "path ! (length path - Suc m)" in sym) |
|
162 |
apply simp |
|
163 |
apply(case_tac " length path - Suc 0 < m") |
|
164 |
apply(subgoal_tac "(length path - Suc m)=0") |
|
165 |
prefer 2 apply arith |
|
166 |
apply(simp del: diff_is_0_eq) |
|
167 |
apply(subgoal_tac "Suc nata\<le>nat") |
|
168 |
prefer 2 apply arith |
|
169 |
apply(drule_tac n = "Suc nata" in Compl_lemma) |
|
170 |
apply clarify |
|
72233 | 171 |
subgoal using [[linarith_split_limit = 0]] by force |
13020 | 172 |
apply(drule leI) |
173 |
apply(subgoal_tac "Suc (length path - Suc m + nata)=(length path - Suc 0) - (m - Suc nata)") |
|
174 |
apply(erule_tac x = "m - (Suc nata)" in allE) |
|
175 |
apply(case_tac "m") |
|
176 |
apply simp |
|
177 |
apply simp |
|
13601 | 178 |
apply simp |
13020 | 179 |
done |
180 |
||
20432
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
webertj
parents:
20279
diff
changeset
|
181 |
|
59189 | 182 |
subsubsection\<open>Graph 3\<close> |
13020 | 183 |
|
54863
82acc20ded73
prefer more canonical names for lemmas on min/max
haftmann
parents:
42174
diff
changeset
|
184 |
declare min.absorb1 [simp] min.absorb2 [simp] |
32642
026e7c6a6d08
be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents:
32621
diff
changeset
|
185 |
|
59189 | 186 |
lemma Graph3: |
13020 | 187 |
"\<lbrakk> T\<in>Reach E; R<length E \<rbrakk> \<Longrightarrow> Reach(E[R:=(fst(E!R),T)]) \<subseteq> Reach E" |
188 |
apply (unfold Reach_def) |
|
189 |
apply clarify |
|
190 |
apply simp |
|
191 |
apply(case_tac "\<exists>i<length path - 1. (fst(E!R),T)=(path!(Suc i),path!i)") |
|
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
62042
diff
changeset
|
192 |
\<comment> \<open>the changed edge is part of the path\<close> |
13020 | 193 |
apply(erule exE) |
194 |
apply(drule_tac P = "\<lambda>i. i<length path - 1 \<and> (fst(E!R),T)=(path!Suc i,path!i)" in Ex_first_occurrence) |
|
195 |
apply clarify |
|
196 |
apply(erule disjE) |
|
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
62042
diff
changeset
|
197 |
\<comment> \<open>T is NOT a root\<close> |
13020 | 198 |
apply clarify |
199 |
apply(rule_tac x = "(take m path)@patha" in exI) |
|
200 |
apply(subgoal_tac "\<not>(length path\<le>m)") |
|
201 |
prefer 2 apply arith |
|
32442 | 202 |
apply(simp) |
13020 | 203 |
apply(rule conjI) |
204 |
apply(subgoal_tac "\<not>(m + length patha - 1 < m)") |
|
205 |
prefer 2 apply arith |
|
32442 | 206 |
apply(simp add: nth_append) |
13020 | 207 |
apply(rule conjI) |
208 |
apply(case_tac "m") |
|
209 |
apply force |
|
210 |
apply(case_tac "path") |
|
211 |
apply force |
|
212 |
apply force |
|
213 |
apply clarify |
|
214 |
apply(case_tac "Suc i\<le>m") |
|
215 |
apply(erule_tac x = "i" in allE) |
|
216 |
apply simp |
|
217 |
apply clarify |
|
218 |
apply(rule_tac x = "j" in exI) |
|
219 |
apply(case_tac "Suc i<m") |
|
22230 | 220 |
apply(simp add: nth_append) |
13020 | 221 |
apply(case_tac "R=j") |
222 |
apply(simp add: nth_list_update) |
|
223 |
apply(case_tac "i=m") |
|
224 |
apply force |
|
225 |
apply(erule_tac x = "i" in allE) |
|
226 |
apply force |
|
227 |
apply(force simp add: nth_list_update) |
|
22230 | 228 |
apply(simp add: nth_append) |
13020 | 229 |
apply(subgoal_tac "i=m - 1") |
230 |
prefer 2 apply arith |
|
231 |
apply(case_tac "R=j") |
|
232 |
apply(erule_tac x = "m - 1" in allE) |
|
233 |
apply(simp add: nth_list_update) |
|
234 |
apply(force simp add: nth_list_update) |
|
32442 | 235 |
apply(simp add: nth_append) |
13020 | 236 |
apply(rotate_tac -4) |
237 |
apply(erule_tac x = "i - m" in allE) |
|
238 |
apply(subgoal_tac "Suc (i - m)=(Suc i - m)" ) |
|
239 |
prefer 2 apply arith |
|
240 |
apply simp |
|
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
62042
diff
changeset
|
241 |
\<comment> \<open>T is a root\<close> |
13020 | 242 |
apply(case_tac "m=0") |
243 |
apply force |
|
244 |
apply(rule_tac x = "take (Suc m) path" in exI) |
|
245 |
apply(subgoal_tac "\<not>(length path\<le>Suc m)" ) |
|
246 |
prefer 2 apply arith |
|
32442 | 247 |
apply clarsimp |
13020 | 248 |
apply(erule_tac x = "i" in allE) |
249 |
apply simp |
|
250 |
apply clarify |
|
251 |
apply(case_tac "R=j") |
|
252 |
apply(force simp add: nth_list_update) |
|
253 |
apply(force simp add: nth_list_update) |
|
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
62042
diff
changeset
|
254 |
\<comment> \<open>the changed edge is not part of the path\<close> |
13020 | 255 |
apply(rule_tac x = "path" in exI) |
256 |
apply simp |
|
257 |
apply clarify |
|
258 |
apply(erule_tac x = "i" in allE) |
|
259 |
apply clarify |
|
260 |
apply(case_tac "R=j") |
|
261 |
apply(erule_tac x = "i" in allE) |
|
262 |
apply simp |
|
263 |
apply(force simp add: nth_list_update) |
|
264 |
done |
|
265 |
||
59189 | 266 |
subsubsection\<open>Graph 4\<close> |
13020 | 267 |
|
59189 | 268 |
lemma Graph4: |
269 |
"\<lbrakk>T \<in> Reach E; Roots\<subseteq>Blacks M; I\<le>length E; T<length M; R<length E; |
|
270 |
\<forall>i<I. \<not>BtoW(E!i,M); R<I; M!fst(E!R)=Black; M!T\<noteq>Black\<rbrakk> \<Longrightarrow> |
|
13020 | 271 |
(\<exists>r. I\<le>r \<and> r<length E \<and> BtoW(E[R:=(fst(E!R),T)]!r,M))" |
272 |
apply (unfold Reach_def) |
|
273 |
apply simp |
|
274 |
apply(erule disjE) |
|
275 |
prefer 2 apply force |
|
276 |
apply clarify |
|
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
62042
diff
changeset
|
277 |
\<comment> \<open>there exist a black node in the path to T\<close> |
13020 | 278 |
apply(case_tac "\<exists>m<length path. M!(path!m)=Black") |
279 |
apply(erule exE) |
|
280 |
apply(drule_tac P = "\<lambda>m. m<length path \<and> M!(path!m)=Black" in Ex_first_occurrence) |
|
281 |
apply clarify |
|
282 |
apply(case_tac "ma") |
|
283 |
apply force |
|
284 |
apply simp |
|
285 |
apply(case_tac "length path") |
|
286 |
apply force |
|
287 |
apply simp |
|
59807 | 288 |
apply(erule_tac P = "\<lambda>i. i < nata \<longrightarrow> P i" and x = "nat" for P in allE) |
13020 | 289 |
apply simp |
290 |
apply clarify |
|
59807 | 291 |
apply(erule_tac P = "\<lambda>i. i < Suc nat \<longrightarrow> P i" and x = "nat" for P in allE) |
13020 | 292 |
apply simp |
293 |
apply(case_tac "j<I") |
|
294 |
apply(erule_tac x = "j" in allE) |
|
295 |
apply force |
|
296 |
apply(rule_tac x = "j" in exI) |
|
297 |
apply(force simp add: nth_list_update) |
|
298 |
apply simp |
|
299 |
apply(rotate_tac -1) |
|
300 |
apply(erule_tac x = "length path - 1" in allE) |
|
301 |
apply(case_tac "length path") |
|
302 |
apply force |
|
303 |
apply force |
|
304 |
done |
|
305 |
||
54863
82acc20ded73
prefer more canonical names for lemmas on min/max
haftmann
parents:
42174
diff
changeset
|
306 |
declare min.absorb1 [simp del] min.absorb2 [simp del] |
32642
026e7c6a6d08
be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents:
32621
diff
changeset
|
307 |
|
59189 | 308 |
subsubsection \<open>Graph 5\<close> |
13020 | 309 |
|
59189 | 310 |
lemma Graph5: |
311 |
"\<lbrakk> T \<in> Reach E ; Roots \<subseteq> Blacks M; \<forall>i<R. \<not>BtoW(E!i,M); T<length M; |
|
312 |
R<length E; M!fst(E!R)=Black; M!snd(E!R)=Black; M!T \<noteq> Black\<rbrakk> |
|
13020 | 313 |
\<Longrightarrow> (\<exists>r. R<r \<and> r<length E \<and> BtoW(E[R:=(fst(E!R),T)]!r,M))" |
314 |
apply (unfold Reach_def) |
|
315 |
apply simp |
|
316 |
apply(erule disjE) |
|
317 |
prefer 2 apply force |
|
318 |
apply clarify |
|
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
62042
diff
changeset
|
319 |
\<comment> \<open>there exist a black node in the path to T\<close> |
13020 | 320 |
apply(case_tac "\<exists>m<length path. M!(path!m)=Black") |
321 |
apply(erule exE) |
|
322 |
apply(drule_tac P = "\<lambda>m. m<length path \<and> M!(path!m)=Black" in Ex_first_occurrence) |
|
323 |
apply clarify |
|
324 |
apply(case_tac "ma") |
|
325 |
apply force |
|
326 |
apply simp |
|
327 |
apply(case_tac "length path") |
|
328 |
apply force |
|
329 |
apply simp |
|
59807 | 330 |
apply(erule_tac P = "\<lambda>i. i < nata \<longrightarrow> P i" and x = "nat" for P in allE) |
13020 | 331 |
apply simp |
332 |
apply clarify |
|
59807 | 333 |
apply(erule_tac P = "\<lambda>i. i < Suc nat \<longrightarrow> P i" and x = "nat" for P in allE) |
13020 | 334 |
apply simp |
335 |
apply(case_tac "j\<le>R") |
|
26316
9e9e67e33557
removed redundant less_trans, less_linear, le_imp_less_or_eq, le_less_trans, less_le_trans (cf. Orderings.thy);
wenzelm
parents:
24742
diff
changeset
|
336 |
apply(drule le_imp_less_or_eq [of _ R]) |
13020 | 337 |
apply(erule disjE) |
338 |
apply(erule allE , erule (1) notE impE) |
|
339 |
apply force |
|
340 |
apply force |
|
341 |
apply(rule_tac x = "j" in exI) |
|
342 |
apply(force simp add: nth_list_update) |
|
343 |
apply simp |
|
344 |
apply(rotate_tac -1) |
|
345 |
apply(erule_tac x = "length path - 1" in allE) |
|
346 |
apply(case_tac "length path") |
|
347 |
apply force |
|
348 |
apply force |
|
349 |
done |
|
350 |
||
59189 | 351 |
subsubsection \<open>Other lemmas about graphs\<close> |
13020 | 352 |
|
59189 | 353 |
lemma Graph6: |
13020 | 354 |
"\<lbrakk>Proper_Edges(M,E); R<length E ; T<length M\<rbrakk> \<Longrightarrow> Proper_Edges(M,E[R:=(fst(E!R),T)])" |
355 |
apply (unfold Proper_Edges_def) |
|
356 |
apply(force simp add: nth_list_update) |
|
357 |
done |
|
358 |
||
59189 | 359 |
lemma Graph7: |
13020 | 360 |
"\<lbrakk>Proper_Edges(M,E)\<rbrakk> \<Longrightarrow> Proper_Edges(M[T:=a],E)" |
361 |
apply (unfold Proper_Edges_def) |
|
362 |
apply force |
|
363 |
done |
|
364 |
||
59189 | 365 |
lemma Graph8: |
13020 | 366 |
"\<lbrakk>Proper_Roots(M)\<rbrakk> \<Longrightarrow> Proper_Roots(M[T:=a])" |
367 |
apply (unfold Proper_Roots_def) |
|
368 |
apply force |
|
369 |
done |
|
370 |
||
59189 | 371 |
text\<open>Some specific lemmata for the verification of garbage collection algorithms.\<close> |
13020 | 372 |
|
373 |
lemma Graph9: "j<length M \<Longrightarrow> Blacks M\<subseteq>Blacks (M[j := Black])" |
|
374 |
apply (unfold Blacks_def) |
|
375 |
apply(force simp add: nth_list_update) |
|
376 |
done |
|
377 |
||
378 |
lemma Graph10 [rule_format (no_asm)]: "\<forall>i. M!i=a \<longrightarrow>M[i:=a]=M" |
|
379 |
apply(induct_tac "M") |
|
380 |
apply auto |
|
381 |
apply(case_tac "i") |
|
382 |
apply auto |
|
383 |
done |
|
384 |
||
59189 | 385 |
lemma Graph11 [rule_format (no_asm)]: |
13020 | 386 |
"\<lbrakk> M!j\<noteq>Black;j<length M\<rbrakk> \<Longrightarrow> Blacks M \<subset> Blacks (M[j := Black])" |
387 |
apply (unfold Blacks_def) |
|
388 |
apply(rule psubsetI) |
|
389 |
apply(force simp add: nth_list_update) |
|
390 |
apply safe |
|
391 |
apply(erule_tac c = "j" in equalityCE) |
|
392 |
apply auto |
|
393 |
done |
|
394 |
||
395 |
lemma Graph12: "\<lbrakk>a\<subseteq>Blacks M;j<length M\<rbrakk> \<Longrightarrow> a\<subseteq>Blacks (M[j := Black])" |
|
396 |
apply (unfold Blacks_def) |
|
397 |
apply(force simp add: nth_list_update) |
|
398 |
done |
|
399 |
||
400 |
lemma Graph13: "\<lbrakk>a\<subset> Blacks M;j<length M\<rbrakk> \<Longrightarrow> a \<subset> Blacks (M[j := Black])" |
|
401 |
apply (unfold Blacks_def) |
|
402 |
apply(erule psubset_subset_trans) |
|
403 |
apply(force simp add: nth_list_update) |
|
404 |
done |
|
405 |
||
406 |
declare Graph_defs [simp del] |
|
407 |
||
408 |
end |