src/HOL/HoareParallel/OG_Examples.thy
changeset 16733 236dfafbeb63
parent 16417 9bc16273c2d4
child 20217 25b068a99d2b
equal deleted inserted replaced
16732:1bbe526a552c 16733:236dfafbeb63
   173 --{* 21 vc *}
   173 --{* 21 vc *}
   174 apply(tactic {* ALLGOALS Clarify_tac *})
   174 apply(tactic {* ALLGOALS Clarify_tac *})
   175 --{* 11 vc *}
   175 --{* 11 vc *}
   176 apply simp_all
   176 apply simp_all
   177 apply(tactic {* ALLGOALS Clarify_tac *})
   177 apply(tactic {* ALLGOALS Clarify_tac *})
   178 --{* 11 subgoals left *}
   178 --{* 10 subgoals left *}
   179 apply(erule less_SucE)
   179 apply(erule less_SucE)
   180  apply simp
   180  apply simp
   181 apply simp
   181 apply simp
   182 --{* 10 subgoals left *}
   182 --{* 9 subgoals left *}
   183 apply force
       
   184 apply(case_tac "i=k")
   183 apply(case_tac "i=k")
   185  apply force
   184  apply force
   186 apply simp
   185 apply simp
   187 apply(case_tac "i=l")
   186 apply(case_tac "i=l")
   188  apply force
   187  apply force
   441 --{* 930 subgoals left *}
   440 --{* 930 subgoals left *}
   442 apply(tactic {* ALLGOALS Clarify_tac *})
   441 apply(tactic {* ALLGOALS Clarify_tac *})
   443 apply(simp_all (asm_lr) only:length_0_conv [THEN sym])
   442 apply(simp_all (asm_lr) only:length_0_conv [THEN sym])
   444 --{* 44 subgoals left *}
   443 --{* 44 subgoals left *}
   445 apply (simp_all (asm_lr) del:length_0_conv add: nth_list_update mod_less_divisor mod_lemma)
   444 apply (simp_all (asm_lr) del:length_0_conv add: nth_list_update mod_less_divisor mod_lemma)
   446 --{* 33 subgoals left *}
   445 --{* 32 subgoals left *}
   447 apply(tactic {* ALLGOALS Clarify_tac *})
   446 apply(tactic {* ALLGOALS Clarify_tac *})
   448 
   447 
   449 apply(tactic {* TRYALL simple_arith_tac *})
   448 apply(tactic {* TRYALL simple_arith_tac *})
   450 --{* 10 subgoals left *}
   449 --{* 9 subgoals left *}
   451 apply (force simp add:less_Suc_eq)
   450 apply (force simp add:less_Suc_eq)
   452 apply(drule sym)
   451 apply(drule sym)
   453 apply (force simp add:less_Suc_eq)+
   452 apply (force simp add:less_Suc_eq)+
   454 done
   453 done
   455 
   454 
   523 apply(rotate_tac -1)
   522 apply(rotate_tac -1)
   524 apply(erule ssubst)
   523 apply(erule ssubst)
   525 apply simp_all
   524 apply simp_all
   526 done
   525 done
   527 
   526 
   528 lemma Example2_lemma3: "!!b. \<forall>i< n. b i = (Suc 0) \<Longrightarrow> (\<Sum>i=0..<n. b i)= n"
       
   529 apply (induct n)
       
   530 apply auto
       
   531 done
       
   532 
   527 
   533 record Example2 = 
   528 record Example2 = 
   534  c :: "nat \<Rightarrow> nat" 
   529  c :: "nat \<Rightarrow> nat" 
   535  x :: nat
   530  x :: nat
   536 
   531 
   542    \<langle> \<acute>x:=\<acute>x+(Suc 0),, \<acute>c:=\<acute>c (i:=(Suc 0)) \<rangle>
   537    \<langle> \<acute>x:=\<acute>x+(Suc 0),, \<acute>c:=\<acute>c (i:=(Suc 0)) \<rangle>
   543   .{\<acute>x=(\<Sum>i=0..<n. \<acute>c i) \<and> \<acute>c i=(Suc 0)}.
   538   .{\<acute>x=(\<Sum>i=0..<n. \<acute>c i) \<and> \<acute>c i=(Suc 0)}.
   544  COEND 
   539  COEND 
   545  .{\<acute>x=n}."
   540  .{\<acute>x=n}."
   546 apply oghoare
   541 apply oghoare
   547 apply simp_all
   542 apply (simp_all cong del: strong_setsum_cong)
   548 apply (tactic {* ALLGOALS Clarify_tac *})
   543 apply (tactic {* ALLGOALS Clarify_tac *})
   549 apply simp_all
   544 apply (simp_all cong del: strong_setsum_cong)
   550    apply(erule Example2_lemma2)
   545    apply(erule (1) Example2_lemma2)
   551    apply simp
   546   apply(erule (1) Example2_lemma2)
   552   apply(erule Example2_lemma2)
   547  apply(erule (1) Example2_lemma2)
   553   apply simp
   548 apply(simp)
   554  apply(erule Example2_lemma2)
       
   555  apply simp
       
   556 apply(force intro: Example2_lemma3)
       
   557 done
   549 done
   558 
   550 
   559 end
   551 end