# HG changeset patch # User oheimb # Date 962029131 -7200 # Node ID 9a64807da0235f1bf54d4688eddc85ace479bf58 # Parent dde1affac73ea620823998bc4bff3ee341c56fdf corrected specifications and simplified proofs diff -r dde1affac73e -r 9a64807da023 src/HOL/Hoare/Examples.ML --- a/src/HOL/Hoare/Examples.ML Mon Jun 26 11:43:56 2000 +0200 +++ b/src/HOL/Hoare/Examples.ML Mon Jun 26 16:18:51 2000 +0200 @@ -8,30 +8,31 @@ (** multiplication by successive addition **) -Goal "|- VARS m s. \ -\ {m=0 & s=0} \ +Goal "|- VARS m s a b. \ +\ {a=A & b=B} \ +\ m := 0; s := 0; \ \ WHILE m~=a \ -\ INV {s=m*b} \ +\ INV {s=m*b & a=A & b=B} \ \ DO s := s+b; m := m+1 OD \ -\ {s = a*b}"; +\ {s = A*B}"; by (hoare_tac (Asm_full_simp_tac) 1); qed "multiply_by_add"; (** Euclid's algorithm for GCD **) Goal "|- VARS a b. \ -\ {0 A!k = pivot) & geq A l}"; (* expand and delete abbreviations first *) by (asm_simp_tac HOL_basic_ss 1); -by (REPEAT(etac thin_rl 1)); +by (REPEAT (etac thin_rl 1)); by (hoare_tac Asm_full_simp_tac 1); - by (asm_full_simp_tac (simpset() addsimps [neq_Nil_conv]) 1); - by (Clarify_tac 1); - by (asm_full_simp_tac (simpset() addsimps [nth_list_update]) 1); + by (SELECT_GOAL (auto_tac (claset(), simpset() addsimps [neq_Nil_conv])) 1); by (blast_tac (claset() addSEs [less_SucE] addIs [Suc_leI]) 1); - by (rtac conjI 1); - by (Clarify_tac 1); - by (dtac (pred_less_imp_le RS le_imp_less_Suc) 1); - by (blast_tac (claset() addSEs [less_SucE]) 1); - by (rtac less_imp_diff_less 1); - by (Blast_tac 1); - by (Clarify_tac 1); - by (asm_simp_tac (simpset() addsimps [nth_list_update]) 1); - by (Clarify_tac 1); - by (Simp_tac 1); -by (Clarify_tac 1); -by (Asm_simp_tac 1); -by (rtac conjI 1); - by (Clarify_tac 1); - by (rtac order_antisym 1); - by (Asm_simp_tac 1); - by (Asm_simp_tac 1); -by (Clarify_tac 1); -by (Asm_simp_tac 1); + by (blast_tac (claset() addSEs [less_SucE] addIs [less_imp_diff_less] + addDs [pred_less_imp_le RS le_imp_less_Suc] ) 1); + by (SELECT_GOAL (auto_tac (claset(), simpset() addsimps [nth_list_update])) 1); +by (SELECT_GOAL (auto_tac (claset() addIs [order_antisym], simpset())) 1); qed "Partition";