src/HOL/IMPP/Hoare.thy
changeset 60754 02924903a6fd
parent 59807 22bc39064290
child 63167 0909deb8059b
equal deleted inserted replaced
60753:80ca4a065a48 60754:02924903a6fd
   276 apply (fast intro!: Body_triple_valid_Suc [THEN iffD1])
   276 apply (fast intro!: Body_triple_valid_Suc [THEN iffD1])
   277 done
   277 done
   278 
   278 
   279 lemma hoare_sound: "G||-ts ==> G||=ts"
   279 lemma hoare_sound: "G||-ts ==> G||=ts"
   280 apply (erule hoare_derivs.induct)
   280 apply (erule hoare_derivs.induct)
   281 apply              (tactic {* TRYALL (eresolve_tac @{context} [@{thm Loop_sound_lemma}, @{thm Body_sound_lemma}] THEN_ALL_NEW atac) *})
   281 apply              (tactic {* TRYALL (eresolve_tac @{context} [@{thm Loop_sound_lemma}, @{thm Body_sound_lemma}] THEN_ALL_NEW assume_tac @{context}) *})
   282 apply            (unfold hoare_valids_def)
   282 apply            (unfold hoare_valids_def)
   283 apply            blast
   283 apply            blast
   284 apply           blast
   284 apply           blast
   285 apply          (blast) (* asm *)
   285 apply          (blast) (* asm *)
   286 apply         (blast) (* cut *)
   286 apply         (blast) (* cut *)
   349 apply        (rule_tac [3] escape, tactic {* clarsimp_tac @{context} 3 *},
   349 apply        (rule_tac [3] escape, tactic {* clarsimp_tac @{context} 3 *},
   350   rename_tac [3] loc "fun" y Z,
   350   rename_tac [3] loc "fun" y Z,
   351   rule_tac [3] P1 = "%Z' s. s= (Z[Loc loc::=fun Z])" in hoare_derivs.Local [THEN conseq1],
   351   rule_tac [3] P1 = "%Z' s. s= (Z[Loc loc::=fun Z])" in hoare_derivs.Local [THEN conseq1],
   352   erule_tac [3] conseq12)
   352   erule_tac [3] conseq12)
   353 apply         (erule_tac [5] hoare_derivs.Comp, erule_tac [5] conseq12)
   353 apply         (erule_tac [5] hoare_derivs.Comp, erule_tac [5] conseq12)
   354 apply         (tactic {* (rtac @{thm hoare_derivs.If} THEN_ALL_NEW etac @{thm conseq12}) 6 *})
   354 apply         (tactic {* (resolve_tac @{context} @{thms hoare_derivs.If} THEN_ALL_NEW
       
   355                 eresolve_tac @{context} @{thms conseq12}) 6 *})
   355 apply          (rule_tac [8] hoare_derivs.Loop [THEN conseq2], erule_tac [8] conseq12)
   356 apply          (rule_tac [8] hoare_derivs.Loop [THEN conseq2], erule_tac [8] conseq12)
   356 apply           auto
   357 apply           auto
   357 done
   358 done
   358 
   359 
   359 (* Version: nested single recursion *)
   360 (* Version: nested single recursion *)
   433   F<=(%pn. {=}.the (body pn).{->})`dom body |] ==>
   434   F<=(%pn. {=}.the (body pn).{->})`dom body |] ==>
   434      (%pn. {=}.     BODY pn .{->})`dom body||-F"
   435      (%pn. {=}.     BODY pn .{->})`dom body||-F"
   435 apply (frule finite_subset)
   436 apply (frule finite_subset)
   436 apply (rule finite_dom_body [THEN finite_imageI])
   437 apply (rule finite_dom_body [THEN finite_imageI])
   437 apply (rotate_tac 2)
   438 apply (rotate_tac 2)
   438 apply (tactic "make_imp_tac 1")
   439 apply (tactic "make_imp_tac @{context} 1")
   439 apply (erule finite_induct)
   440 apply (erule finite_induct)
   440 apply  (clarsimp intro!: hoare_derivs.empty)
   441 apply  (clarsimp intro!: hoare_derivs.empty)
   441 apply (clarsimp intro!: hoare_derivs.insert simp del: range_composition)
   442 apply (clarsimp intro!: hoare_derivs.insert simp del: range_composition)
   442 apply (erule MGF_lemma1)
   443 apply (erule MGF_lemma1)
   443 prefer 2 apply  (fast dest: WT_bodiesD)
   444 prefer 2 apply  (fast dest: WT_bodiesD)