281 apply simp |
281 apply simp |
282 apply (force simp add: nth_Cons split: list.split nat.split) |
282 apply (force simp add: nth_Cons split: list.split nat.split) |
283 done |
283 done |
284 |
284 |
285 |
285 |
286 lemma plus_list_ub1 [rule_format]: |
286 lemma (in semilat) plus_list_ub1 [rule_format]: |
287 "\<lbrakk> semilat(A,r,f); set xs <= A; set ys <= A; size xs = size ys \<rbrakk> |
287 "\<lbrakk> set xs <= A; set ys <= A; size xs = size ys \<rbrakk> |
288 \<Longrightarrow> xs <=[r] xs +[f] ys" |
288 \<Longrightarrow> xs <=[r] xs +[f] ys" |
289 apply (unfold unfold_lesub_list) |
289 apply (unfold unfold_lesub_list) |
290 apply (simp add: Listn.le_def list_all2_conv_all_nth) |
290 apply (simp add: Listn.le_def list_all2_conv_all_nth) |
291 done |
291 done |
292 |
292 |
293 lemma plus_list_ub2: |
293 lemma (in semilat) plus_list_ub2: |
294 "\<lbrakk> semilat(A,r,f); set xs <= A; set ys <= A; size xs = size ys \<rbrakk> |
294 "\<lbrakk>set xs <= A; set ys <= A; size xs = size ys \<rbrakk> |
295 \<Longrightarrow> ys <=[r] xs +[f] ys" |
295 \<Longrightarrow> ys <=[r] xs +[f] ys" |
296 apply (unfold unfold_lesub_list) |
296 apply (unfold unfold_lesub_list) |
297 apply (simp add: Listn.le_def list_all2_conv_all_nth) |
297 apply (simp add: Listn.le_def list_all2_conv_all_nth) |
298 done |
298 done |
299 |
299 |
300 lemma plus_list_lub [rule_format]: |
300 lemma (in semilat) plus_list_lub [rule_format]: |
301 "semilat(A,r,f) \<Longrightarrow> !xs ys zs. set xs <= A \<longrightarrow> set ys <= A \<longrightarrow> set zs <= A |
301 shows "!xs ys zs. set xs <= A \<longrightarrow> set ys <= A \<longrightarrow> set zs <= A |
302 \<longrightarrow> size xs = n & size ys = n \<longrightarrow> |
302 \<longrightarrow> size xs = n & size ys = n \<longrightarrow> |
303 xs <=[r] zs & ys <=[r] zs \<longrightarrow> xs +[f] ys <=[r] zs" |
303 xs <=[r] zs & ys <=[r] zs \<longrightarrow> xs +[f] ys <=[r] zs" |
304 apply (unfold unfold_lesub_list) |
304 apply (unfold unfold_lesub_list) |
305 apply (simp add: Listn.le_def list_all2_conv_all_nth) |
305 apply (simp add: Listn.le_def list_all2_conv_all_nth) |
306 done |
306 done |
307 |
307 |
308 lemma list_update_incr [rule_format]: |
308 lemma (in semilat) list_update_incr [rule_format]: |
309 "\<lbrakk> semilat(A,r,f); x:A \<rbrakk> \<Longrightarrow> set xs <= A \<longrightarrow> |
309 "x:A \<Longrightarrow> set xs <= A \<longrightarrow> |
310 (!i. i<size xs \<longrightarrow> xs <=[r] xs[i := x +_f xs!i])" |
310 (!i. i<size xs \<longrightarrow> xs <=[r] xs[i := x +_f xs!i])" |
311 apply (unfold unfold_lesub_list) |
311 apply (unfold unfold_lesub_list) |
312 apply (simp add: Listn.le_def list_all2_conv_all_nth) |
312 apply (simp add: Listn.le_def list_all2_conv_all_nth) |
313 apply (induct xs) |
313 apply (induct xs) |
314 apply simp |
314 apply simp |
315 apply (simp add: in_list_Suc_iff) |
315 apply (simp add: in_list_Suc_iff) |
316 apply clarify |
316 apply clarify |
317 apply (simp add: nth_Cons split: nat.split) |
317 apply (simp add: nth_Cons split: nat.split) |
318 done |
318 done |
319 |
319 |
320 lemma acc_le_listI [intro!]: |
320 lemma acc_le_listI [intro!]: |
321 "\<lbrakk> order r; acc r \<rbrakk> \<Longrightarrow> acc(Listn.le r)" |
321 "\<lbrakk> order r; acc r \<rbrakk> \<Longrightarrow> acc(Listn.le r)" |
322 apply (unfold acc_def) |
322 apply (unfold acc_def) |
323 apply (subgoal_tac |
323 apply (subgoal_tac |
374 apply simp |
374 apply simp |
375 apply clarify |
375 apply clarify |
376 apply (simp add: in_list_Suc_iff) |
376 apply (simp add: in_list_Suc_iff) |
377 apply clarify |
377 apply clarify |
378 apply simp |
378 apply simp |
379 done |
379 done |
380 |
380 |
381 |
381 |
382 lemma semilat_Listn_sl: |
382 lemma Listn_sl_aux: |
383 "\<And>L. semilat L \<Longrightarrow> semilat (Listn.sl n L)" |
383 includes semilat shows "semilat (Listn.sl n (A,r,f))" |
384 apply (unfold Listn.sl_def) |
384 apply (unfold Listn.sl_def) |
385 apply (simp (no_asm_simp) only: split_tupled_all) |
|
386 apply (simp (no_asm) only: semilat_Def split_conv) |
385 apply (simp (no_asm) only: semilat_Def split_conv) |
387 apply (rule conjI) |
386 apply (rule conjI) |
388 apply simp |
387 apply simp |
389 apply (rule conjI) |
388 apply (rule conjI) |
390 apply (simp only: semilatDclosedI closed_listI) |
389 apply (simp only: closedI closed_listI) |
391 apply (simp (no_asm) only: list_def) |
390 apply (simp (no_asm) only: list_def) |
392 apply (simp (no_asm_simp) add: plus_list_ub1 plus_list_ub2 plus_list_lub) |
391 apply (simp (no_asm_simp) add: plus_list_ub1 plus_list_ub2 plus_list_lub) |
393 done |
392 done |
394 |
393 |
|
394 lemma Listn_sl: "\<And>L. semilat L \<Longrightarrow> semilat (Listn.sl n L)" |
|
395 by(simp add: Listn_sl_aux split_tupled_all) |
395 |
396 |
396 lemma coalesce_in_err_list [rule_format]: |
397 lemma coalesce_in_err_list [rule_format]: |
397 "!xes. xes : list n (err A) \<longrightarrow> coalesce xes : err(list n A)" |
398 "!xes. xes : list n (err A) \<longrightarrow> coalesce xes : err(list n A)" |
398 apply (induct n) |
399 apply (induct n) |
399 apply simp |
400 apply simp |
441 apply clarify |
442 apply clarify |
442 apply (rotate_tac -3) |
443 apply (rotate_tac -3) |
443 apply (erule thin_rl) |
444 apply (erule thin_rl) |
444 apply (erule thin_rl) |
445 apply (erule thin_rl) |
445 apply force |
446 apply force |
446 done |
447 done |
447 |
448 |
448 lemma coalesce_eq_OK_ub_D [rule_format]: |
449 lemma coalesce_eq_OK_ub_D [rule_format]: |
449 "semilat(err A, Err.le r, lift2 f) \<Longrightarrow> |
450 "semilat(err A, Err.le r, lift2 f) \<Longrightarrow> |
450 !xs. xs : list n A \<longrightarrow> (!ys. ys : list n A \<longrightarrow> |
451 !xs. xs : list n A \<longrightarrow> (!ys. ys : list n A \<longrightarrow> |
451 (!zs us. coalesce (xs +[f] ys) = OK zs & xs <=[r] us & ys <=[r] us |
452 (!zs us. coalesce (xs +[f] ys) = OK zs & xs <=[r] us & ys <=[r] us |
498 apply simp |
499 apply simp |
499 apply clarify |
500 apply clarify |
500 apply (simp add: in_list_Suc_iff) |
501 apply (simp add: in_list_Suc_iff) |
501 apply clarify |
502 apply clarify |
502 apply (simp add: plussub_def closed_err_lift2_conv) |
503 apply (simp add: plussub_def closed_err_lift2_conv) |
503 done |
504 done |
504 |
505 |
505 lemma closed_lift2_sup: |
506 lemma closed_lift2_sup: |
506 "closed (err A) (lift2 f) \<Longrightarrow> |
507 "closed (err A) (lift2 f) \<Longrightarrow> |
507 closed (err (list n A)) (lift2 (sup f))" |
508 closed (err (list n A)) (lift2 (sup f))" |
508 by (fastsimp simp add: closed_def plussub_def sup_def lift2_def |
509 by (fastsimp simp add: closed_def plussub_def sup_def lift2_def |
513 "err_semilat (A,r,f) \<Longrightarrow> |
514 "err_semilat (A,r,f) \<Longrightarrow> |
514 err_semilat (list n A, Listn.le r, sup f)" |
515 err_semilat (list n A, Listn.le r, sup f)" |
515 apply (unfold Err.sl_def) |
516 apply (unfold Err.sl_def) |
516 apply (simp only: split_conv) |
517 apply (simp only: split_conv) |
517 apply (simp (no_asm) only: semilat_Def plussub_def) |
518 apply (simp (no_asm) only: semilat_Def plussub_def) |
518 apply (simp (no_asm_simp) only: semilatDclosedI closed_lift2_sup) |
519 apply (simp (no_asm_simp) only: semilat.closedI closed_lift2_sup) |
519 apply (rule conjI) |
520 apply (rule conjI) |
520 apply (drule semilatDorderI) |
521 apply (drule semilat.orderI) |
521 apply simp |
522 apply simp |
522 apply (simp (no_asm) only: unfold_lesub_err Err.le_def err_def sup_def lift2_def) |
523 apply (simp (no_asm) only: unfold_lesub_err Err.le_def err_def sup_def lift2_def) |
523 apply (simp (no_asm_simp) add: coalesce_eq_OK1_D coalesce_eq_OK2_D split: err.split) |
524 apply (simp (no_asm_simp) add: coalesce_eq_OK1_D coalesce_eq_OK2_D split: err.split) |
524 apply (blast intro: coalesce_eq_OK_ub_D dest: coalesce_eq_Err_D) |
525 apply (blast intro: coalesce_eq_OK_ub_D dest: coalesce_eq_Err_D) |
525 done |
526 done |