401 val Stable_completion = thm "Stable_completion"; |
401 val Stable_completion = thm "Stable_completion"; |
402 val Finite_stable_completion = thm "Finite_stable_completion"; |
402 val Finite_stable_completion = thm "Finite_stable_completion"; |
403 |
403 |
404 |
404 |
405 (*proves "ensures/leadsTo" properties when the program is specified*) |
405 (*proves "ensures/leadsTo" properties when the program is specified*) |
406 fun gen_ensures_tac(cs,ss) sact = |
406 fun ensures_tac ctxt sact = |
|
407 let val css as (cs, ss) = local_clasimpset_of ctxt in |
407 SELECT_GOAL |
408 SELECT_GOAL |
408 (EVERY [REPEAT (Always_Int_tac 1), |
409 (EVERY [REPEAT (Always_Int_tac 1), |
409 etac Always_LeadsTo_Basis 1 |
410 etac Always_LeadsTo_Basis 1 |
410 ORELSE (*subgoal may involve LeadsTo, leadsTo or ensures*) |
411 ORELSE (*subgoal may involve LeadsTo, leadsTo or ensures*) |
411 REPEAT (ares_tac [LeadsTo_Basis, leadsTo_Basis, |
412 REPEAT (ares_tac [LeadsTo_Basis, leadsTo_Basis, |
414 simp_tac (ss addsimps !program_defs_ref) 2, |
415 simp_tac (ss addsimps !program_defs_ref) 2, |
415 res_inst_tac [("act", sact)] transientI 2, |
416 res_inst_tac [("act", sact)] transientI 2, |
416 (*simplify the command's domain*) |
417 (*simplify the command's domain*) |
417 simp_tac (ss addsimps [domain_def]) 3, |
418 simp_tac (ss addsimps [domain_def]) 3, |
418 (* proving the domain part *) |
419 (* proving the domain part *) |
419 clarify_tac cs 3, dtac Cla.swap 3, force_tac (cs,ss) 4, |
420 clarify_tac cs 3, dtac Cla.swap 3, force_tac css 4, |
420 rtac ReplaceI 3, force_tac (cs,ss) 3, force_tac (cs,ss) 4, |
421 rtac ReplaceI 3, force_tac css 3, force_tac css 4, |
421 asm_full_simp_tac ss 3, rtac conjI 3, simp_tac ss 4, |
422 asm_full_simp_tac ss 3, rtac conjI 3, simp_tac ss 4, |
422 REPEAT (rtac state_update_type 3), |
423 REPEAT (rtac state_update_type 3), |
423 gen_constrains_tac (cs,ss) 1, |
424 constrains_tac ctxt 1, |
424 ALLGOALS (clarify_tac cs), |
425 ALLGOALS (clarify_tac cs), |
425 ALLGOALS (asm_full_simp_tac (ss addsimps [st_set_def])), |
426 ALLGOALS (asm_full_simp_tac (ss addsimps [st_set_def])), |
426 ALLGOALS (clarify_tac cs), |
427 ALLGOALS (clarify_tac cs), |
427 ALLGOALS (asm_lr_simp_tac ss)]); |
428 ALLGOALS (asm_lr_simp_tac ss)]) |
428 |
429 end; |
429 fun ensures_tac sact = gen_ensures_tac (claset(), simpset()) sact; |
|
430 *} |
430 *} |
431 |
|
432 |
431 |
433 method_setup ensures_tac = {* |
432 method_setup ensures_tac = {* |
434 fn args => fn ctxt => |
433 fn args => fn ctxt => |
435 Method.goal_args' (Scan.lift Args.name) |
434 Method.goal_args' (Scan.lift Args.name) (ensures_tac ctxt) |
436 (gen_ensures_tac (local_clasimpset_of ctxt)) |
|
437 args ctxt *} |
435 args ctxt *} |
438 "for proving progress properties" |
436 "for proving progress properties" |
439 |
437 |
440 |
|
441 end |
438 end |