src/HOL/Arith.ML
changeset 5069 3ea049f7979d
parent 4830 bd73675adbed
child 5078 7b5ea59c0275
--- a/src/HOL/Arith.ML	Mon Jun 22 17:13:09 1998 +0200
+++ b/src/HOL/Arith.ML	Mon Jun 22 17:26:46 1998 +0200
@@ -28,7 +28,7 @@
 (* Could be (and is, below) generalized in various ways;
    However, none of the generalizations are currently in the simpset,
    and I dread to think what happens if I put them in *)
-goal thy "!!n. 0 < n ==> Suc(n-1) = n";
+Goal "!!n. 0 < n ==> Suc(n-1) = n";
 by (asm_simp_tac (simpset() addsplits [split_nat_case]) 1);
 qed "Suc_pred";
 Addsimps [Suc_pred];
@@ -63,25 +63,25 @@
 (*Addition is an AC-operator*)
 val add_ac = [add_assoc, add_commute, add_left_commute];
 
-goal thy "!!k::nat. (k + m = k + n) = (m=n)";
+Goal "!!k::nat. (k + m = k + n) = (m=n)";
 by (induct_tac "k" 1);
 by (Simp_tac 1);
 by (Asm_simp_tac 1);
 qed "add_left_cancel";
 
-goal thy "!!k::nat. (m + k = n + k) = (m=n)";
+Goal "!!k::nat. (m + k = n + k) = (m=n)";
 by (induct_tac "k" 1);
 by (Simp_tac 1);
 by (Asm_simp_tac 1);
 qed "add_right_cancel";
 
-goal thy "!!k::nat. (k + m <= k + n) = (m<=n)";
+Goal "!!k::nat. (k + m <= k + n) = (m<=n)";
 by (induct_tac "k" 1);
 by (Simp_tac 1);
 by (Asm_simp_tac 1);
 qed "add_left_cancel_le";
 
-goal thy "!!k::nat. (k + m < k + n) = (m<n)";
+Goal "!!k::nat. (k + m < k + n) = (m<n)";
 by (induct_tac "k" 1);
 by (Simp_tac 1);
 by (Asm_simp_tac 1);
@@ -92,26 +92,26 @@
 
 (** Reasoning about m+0=0, etc. **)
 
-goal thy "(m+n = 0) = (m=0 & n=0)";
+Goal "(m+n = 0) = (m=0 & n=0)";
 by (induct_tac "m" 1);
 by (ALLGOALS Asm_simp_tac);
 qed "add_is_0";
 AddIffs [add_is_0];
 
-goal thy "(0<m+n) = (0<m | 0<n)";
+Goal "(0<m+n) = (0<m | 0<n)";
 by (simp_tac (simpset() delsimps [neq0_conv] addsimps [neq0_conv RS sym]) 1);
 qed "add_gr_0";
 AddIffs [add_gr_0];
 
 (* FIXME: really needed?? *)
-goal thy "((m+n)-1 = 0) = (m=0 & n-1 = 0 | m-1 = 0 & n=0)";
+Goal "((m+n)-1 = 0) = (m=0 & n-1 = 0 | m-1 = 0 & n=0)";
 by (exhaust_tac "m" 1);
 by (ALLGOALS (fast_tac (claset() addss (simpset()))));
 qed "pred_add_is_0";
 Addsimps [pred_add_is_0];
 
 (* Could be generalized, eg to "!!n. k<n ==> m+(n-(Suc k)) = (m+n)-(Suc k)" *)
-goal thy "!!n. 0<n ==> m + (n-1) = (m+n)-1";
+Goal "!!n. 0<n ==> m + (n-1) = (m+n)-1";
 by (exhaust_tac "m" 1);
 by (ALLGOALS (asm_simp_tac (simpset() addsimps [diff_Suc]
                                       addsplits [split_nat_case])));
@@ -121,7 +121,7 @@
 
 (**** Additional theorems about "less than" ****)
 
-goal thy "i<j --> (EX k. j = Suc(i+k))";
+Goal "i<j --> (EX k. j = Suc(i+k))";
 by (induct_tac "j" 1);
 by (Simp_tac 1);
 by (blast_tac (claset() addSEs [less_SucE] 
@@ -131,21 +131,21 @@
 (* [| i<j;  !!x. j = Suc(i+x) ==> Q |] ==> Q *)
 bind_thm ("less_natE", lemma RS mp RS exE);
 
-goal thy "!!m. m<n --> (? k. n=Suc(m+k))";
+Goal "!!m. m<n --> (? k. n=Suc(m+k))";
 by (induct_tac "n" 1);
 by (ALLGOALS (simp_tac (simpset() addsimps [less_Suc_eq])));
 by (blast_tac (claset() addSEs [less_SucE] 
                        addSIs [add_0_right RS sym, add_Suc_right RS sym]) 1);
 qed_spec_mp "less_eq_Suc_add";
 
-goal thy "n <= ((m + n)::nat)";
+Goal "n <= ((m + n)::nat)";
 by (induct_tac "m" 1);
 by (ALLGOALS Simp_tac);
 by (etac le_trans 1);
 by (rtac (lessI RS less_imp_le) 1);
 qed "le_add2";
 
-goal thy "n <= ((n + m)::nat)";
+Goal "n <= ((n + m)::nat)";
 by (simp_tac (simpset() addsimps add_ac) 1);
 by (rtac le_add2 1);
 qed "le_add1";
@@ -165,49 +165,49 @@
 (*"i < j ==> i < m+j"*)
 bind_thm ("trans_less_add2", le_add2 RSN (2,less_le_trans));
 
-goal thy "!!i. i+j < (k::nat) ==> i<k";
+Goal "!!i. i+j < (k::nat) ==> i<k";
 by (etac rev_mp 1);
 by (induct_tac "j" 1);
 by (ALLGOALS Asm_simp_tac);
 by (blast_tac (claset() addDs [Suc_lessD]) 1);
 qed "add_lessD1";
 
-goal thy "!!i::nat. ~ (i+j < i)";
+Goal "!!i::nat. ~ (i+j < i)";
 by (rtac notI 1);
 by (etac (add_lessD1 RS less_irrefl) 1);
 qed "not_add_less1";
 
-goal thy "!!i::nat. ~ (j+i < i)";
+Goal "!!i::nat. ~ (j+i < i)";
 by (simp_tac (simpset() addsimps [add_commute, not_add_less1]) 1);
 qed "not_add_less2";
 AddIffs [not_add_less1, not_add_less2];
 
-goal thy "!!k::nat. m <= n ==> m <= n+k";
+Goal "!!k::nat. m <= n ==> m <= n+k";
 by (etac le_trans 1);
 by (rtac le_add1 1);
 qed "le_imp_add_le";
 
-goal thy "!!k::nat. m < n ==> m < n+k";
+Goal "!!k::nat. m < n ==> m < n+k";
 by (etac less_le_trans 1);
 by (rtac le_add1 1);
 qed "less_imp_add_less";
 
-goal thy "m+k<=n --> m<=(n::nat)";
+Goal "m+k<=n --> m<=(n::nat)";
 by (induct_tac "k" 1);
 by (ALLGOALS Asm_simp_tac);
 by (blast_tac (claset() addDs [Suc_leD]) 1);
 qed_spec_mp "add_leD1";
 
-goal thy "!!n::nat. m+k<=n ==> k<=n";
+Goal "!!n::nat. m+k<=n ==> k<=n";
 by (full_simp_tac (simpset() addsimps [add_commute]) 1);
 by (etac add_leD1 1);
 qed_spec_mp "add_leD2";
 
-goal thy "!!n::nat. m+k<=n ==> m<=n & k<=n";
+Goal "!!n::nat. m+k<=n ==> m<=n & k<=n";
 by (blast_tac (claset() addDs [add_leD1, add_leD2]) 1);
 bind_thm ("add_leE", result() RS conjE);
 
-goal thy "!!k l::nat. [| k<l; m+l = k+n |] ==> m<n";
+Goal "!!k l::nat. [| k<l; m+l = k+n |] ==> m<n";
 by (safe_tac (claset() addSDs [less_eq_Suc_add]));
 by (asm_full_simp_tac
     (simpset() delsimps [add_Suc_right]
@@ -220,13 +220,13 @@
 (*** Monotonicity of Addition ***)
 
 (*strict, in 1st argument*)
-goal thy "!!i j k::nat. i < j ==> i + k < j + k";
+Goal "!!i j k::nat. i < j ==> i + k < j + k";
 by (induct_tac "k" 1);
 by (ALLGOALS Asm_simp_tac);
 qed "add_less_mono1";
 
 (*strict, in both arguments*)
-goal thy "!!i j k::nat. [|i < j; k < l|] ==> i + k < j + l";
+Goal "!!i j k::nat. [|i < j; k < l|] ==> i + k < j + l";
 by (rtac (add_less_mono1 RS less_trans) 1);
 by (REPEAT (assume_tac 1));
 by (induct_tac "j" 1);
@@ -244,14 +244,14 @@
 qed "less_mono_imp_le_mono";
 
 (*non-strict, in 1st argument*)
-goal thy "!!i j k::nat. i<=j ==> i + k <= j + k";
+Goal "!!i j k::nat. i<=j ==> i + k <= j + k";
 by (res_inst_tac [("f", "%j. j+k")] less_mono_imp_le_mono 1);
 by (etac add_less_mono1 1);
 by (assume_tac 1);
 qed "add_le_mono1";
 
 (*non-strict, in both arguments*)
-goal thy "!!k l::nat. [|i<=j;  k<=l |] ==> i + k <= j + l";
+Goal "!!k l::nat. [|i<=j;  k<=l |] ==> i + k <= j + l";
 by (etac (add_le_mono1 RS le_trans) 1);
 by (simp_tac (simpset() addsimps [add_commute]) 1);
 (*j moves to the end because it is free while k, l are bound*)
@@ -272,11 +272,11 @@
 
 Addsimps [mult_0_right, mult_Suc_right];
 
-goal thy "1 * n = n";
+Goal "1 * n = n";
 by (Asm_simp_tac 1);
 qed "mult_1";
 
-goal thy "n * 1 = n";
+Goal "n * 1 = n";
 by (Asm_simp_tac 1);
 qed "mult_1_right";
 
@@ -304,14 +304,14 @@
 
 val mult_ac = [mult_assoc,mult_commute,mult_left_commute];
 
-goal thy "(m*n = 0) = (m=0 | n=0)";
+Goal "(m*n = 0) = (m=0 | n=0)";
 by (induct_tac "m" 1);
 by (induct_tac "n" 2);
 by (ALLGOALS Asm_simp_tac);
 qed "mult_is_0";
 Addsimps [mult_is_0];
 
-goal thy "!!m::nat. m <= m*m";
+Goal "!!m::nat. m <= m*m";
 by (induct_tac "m" 1);
 by (ALLGOALS (asm_simp_tac (simpset() addsimps [add_assoc RS sym])));
 by (etac (le_add2 RSN (2,le_trans)) 1);
@@ -326,16 +326,16 @@
 Addsimps [diff_self_eq_0];
 
 (*Addition is the inverse of subtraction: if n<=m then n+(m-n) = m. *)
-goal thy "~ m<n --> n+(m-n) = (m::nat)";
+Goal "~ m<n --> n+(m-n) = (m::nat)";
 by (res_inst_tac [("m","m"),("n","n")] diff_induct 1);
 by (ALLGOALS Asm_simp_tac);
 qed_spec_mp "add_diff_inverse";
 
-goal thy "!!m. n<=m ==> n+(m-n) = (m::nat)";
+Goal "!!m. n<=m ==> n+(m-n) = (m::nat)";
 by (asm_simp_tac (simpset() addsimps [add_diff_inverse, not_less_iff_le]) 1);
 qed "le_add_diff_inverse";
 
-goal thy "!!m. n<=m ==> (m-n)+n = (m::nat)";
+Goal "!!m. n<=m ==> (m-n)+n = (m::nat)";
 by (asm_simp_tac (simpset() addsimps [le_add_diff_inverse, add_commute]) 1);
 qed "le_add_diff_inverse2";
 
@@ -350,13 +350,13 @@
 by (ALLGOALS Asm_simp_tac);
 qed "Suc_diff_n";
 
-goal thy "m - n < Suc(m)";
+Goal "m - n < Suc(m)";
 by (res_inst_tac [("m","m"),("n","n")] diff_induct 1);
 by (etac less_SucE 3);
 by (ALLGOALS (asm_simp_tac (simpset() addsimps [less_Suc_eq])));
 qed "diff_less_Suc";
 
-goal thy "!!m::nat. m - n <= m";
+Goal "!!m::nat. m - n <= m";
 by (res_inst_tac [("m","m"), ("n","n")] diff_induct 1);
 by (ALLGOALS Asm_simp_tac);
 qed "diff_le_self";
@@ -365,61 +365,61 @@
 (* j<k ==> j-n < k *)
 bind_thm ("less_imp_diff_less", diff_le_self RS le_less_trans);
 
-goal thy "!!i::nat. i-j-k = i - (j+k)";
+Goal "!!i::nat. i-j-k = i - (j+k)";
 by (res_inst_tac [("m","i"),("n","j")] diff_induct 1);
 by (ALLGOALS Asm_simp_tac);
 qed "diff_diff_left";
 
-goal Arith.thy "(Suc m - n) - Suc k = m - n - k";
+Goal "(Suc m - n) - Suc k = m - n - k";
 by (simp_tac (simpset() addsimps [diff_diff_left]) 1);
 qed "Suc_diff_diff";
 Addsimps [Suc_diff_diff];
 
-goal thy "!!n. 0<n ==> n - Suc i < n";
+Goal "!!n. 0<n ==> n - Suc i < n";
 by (res_inst_tac [("n","n")] natE 1);
 by Safe_tac;
 by (asm_simp_tac (simpset() addsimps [le_eq_less_Suc RS sym]) 1);
 qed "diff_Suc_less";
 Addsimps [diff_Suc_less];
 
-goal thy "!!n::nat. m - n <= Suc m - n";
+Goal "!!n::nat. m - n <= Suc m - n";
 by (res_inst_tac [("m","m"),("n","n")] diff_induct 1);
 by (ALLGOALS Asm_simp_tac);
 qed "diff_le_Suc_diff";
 
 (*This and the next few suggested by Florian Kammueller*)
-goal thy "!!i::nat. i-j-k = i-k-j";
+Goal "!!i::nat. i-j-k = i-k-j";
 by (simp_tac (simpset() addsimps [diff_diff_left, add_commute]) 1);
 qed "diff_commute";
 
-goal thy "!!i j k:: nat. k<=j --> j<=i --> i - (j - k) = i - j + k";
+Goal "!!i j k:: nat. k<=j --> j<=i --> i - (j - k) = i - j + k";
 by (res_inst_tac [("m","i"),("n","j")] diff_induct 1);
 by (ALLGOALS Asm_simp_tac);
 by (asm_simp_tac
     (simpset() addsimps [Suc_diff_n, le_imp_less_Suc, le_Suc_eq]) 1);
 qed_spec_mp "diff_diff_right";
 
-goal thy "!!i j k:: nat. k<=j --> (i + j) - k = i + (j - k)";
+Goal "!!i j k:: nat. k<=j --> (i + j) - k = i + (j - k)";
 by (res_inst_tac [("m","j"),("n","k")] diff_induct 1);
 by (ALLGOALS Asm_simp_tac);
 qed_spec_mp "diff_add_assoc";
 
-goal thy "!!i j k:: nat. k<=j --> (j + i) - k = i + (j - k)";
+Goal "!!i j k:: nat. k<=j --> (j + i) - k = i + (j - k)";
 by (asm_simp_tac (simpset() addsimps [add_commute, diff_add_assoc]) 1);
 qed_spec_mp "diff_add_assoc2";
 
-goal thy "!!n::nat. (n+m) - n = m";
+Goal "!!n::nat. (n+m) - n = m";
 by (induct_tac "n" 1);
 by (ALLGOALS Asm_simp_tac);
 qed "diff_add_inverse";
 Addsimps [diff_add_inverse];
 
-goal thy "!!n::nat.(m+n) - n = m";
+Goal "!!n::nat.(m+n) - n = m";
 by (simp_tac (simpset() addsimps [diff_add_assoc]) 1);
 qed "diff_add_inverse2";
 Addsimps [diff_add_inverse2];
 
-goal thy "!!i j k::nat. i<=j ==> (j-i=k) = (j=k+i)";
+Goal "!!i j k::nat. i<=j ==> (j-i=k) = (j=k+i)";
 by Safe_tac;
 by (ALLGOALS Asm_simp_tac);
 qed "le_imp_diff_is_add";
@@ -442,15 +442,15 @@
 by (ALLGOALS Asm_simp_tac);
 qed "less_imp_diff_positive";
 
-goal thy "Suc(m)-n = (if m<n then 0 else Suc(m-n))";
+Goal "Suc(m)-n = (if m<n then 0 else Suc(m-n))";
 by (simp_tac (simpset() addsimps [less_imp_diff_is_0, not_less_eq, Suc_diff_n]) 1);
 qed "if_Suc_diff_n";
 
-goal thy "Suc(m)-n <= Suc(m-n)";
+Goal "Suc(m)-n <= Suc(m-n)";
 by (simp_tac (simpset() addsimps [if_Suc_diff_n]) 1);
 qed "diff_Suc_le_Suc_diff";
 
-goal thy "P(k) --> (!n. P(Suc(n))--> P(n)) --> P(k-i)";
+Goal "P(k) --> (!n. P(Suc(n))--> P(n)) --> P(k-i)";
 by (res_inst_tac [("m","k"),("n","i")] diff_induct 1);
 by (ALLGOALS (Clarify_tac THEN' Simp_tac THEN' TRY o Blast_tac));
 qed "zero_induct_lemma";
@@ -461,20 +461,20 @@
 by (REPEAT (ares_tac ([impI,allI]@prems) 1));
 qed "zero_induct";
 
-goal thy "!!k::nat. (k+m) - (k+n) = m - n";
+Goal "!!k::nat. (k+m) - (k+n) = m - n";
 by (induct_tac "k" 1);
 by (ALLGOALS Asm_simp_tac);
 qed "diff_cancel";
 Addsimps [diff_cancel];
 
-goal thy "!!m::nat. (m+k) - (n+k) = m - n";
+Goal "!!m::nat. (m+k) - (n+k) = m - n";
 val add_commute_k = read_instantiate [("n","k")] add_commute;
 by (asm_simp_tac (simpset() addsimps ([add_commute_k])) 1);
 qed "diff_cancel2";
 Addsimps [diff_cancel2];
 
 (*From Clemens Ballarin*)
-goal thy "!!n::nat. [| k<=n; n<=m |] ==> (m-k) - (n-k) = m-n";
+Goal "!!n::nat. [| k<=n; n<=m |] ==> (m-k) - (n-k) = m-n";
 by (subgoal_tac "k<=n --> n<=m --> (m-k) - (n-k) = m-n" 1);
 by (Asm_full_simp_tac 1);
 by (induct_tac "k" 1);
@@ -489,7 +489,7 @@
 		       addsimps [Suc_diff_n RS sym, le_eq_less_Suc]) 1);
 qed "diff_right_cancel";
 
-goal thy "!!n::nat. n - (n+m) = 0";
+Goal "!!n::nat. n - (n+m) = 0";
 by (induct_tac "n" 1);
 by (ALLGOALS Asm_simp_tac);
 qed "diff_add_0";
@@ -497,12 +497,12 @@
 
 (** Difference distributes over multiplication **)
 
-goal thy "!!m::nat. (m - n) * k = (m * k) - (n * k)";
+Goal "!!m::nat. (m - n) * k = (m * k) - (n * k)";
 by (res_inst_tac [("m","m"),("n","n")] diff_induct 1);
 by (ALLGOALS Asm_simp_tac);
 qed "diff_mult_distrib" ;
 
-goal thy "!!m::nat. k * (m - n) = (k * m) - (k * n)";
+Goal "!!m::nat. k * (m - n) = (k * m) - (k * n)";
 val mult_commute_k = read_instantiate [("m","k")] mult_commute;
 by (simp_tac (simpset() addsimps [diff_mult_distrib, mult_commute_k]) 1);
 qed "diff_mult_distrib2" ;
@@ -511,13 +511,13 @@
 
 (*** Monotonicity of Multiplication ***)
 
-goal thy "!!i::nat. i<=j ==> i*k<=j*k";
+Goal "!!i::nat. i<=j ==> i*k<=j*k";
 by (induct_tac "k" 1);
 by (ALLGOALS (asm_simp_tac (simpset() addsimps [add_le_mono])));
 qed "mult_le_mono1";
 
 (*<=monotonicity, BOTH arguments*)
-goal thy "!!i::nat. [| i<=j; k<=l |] ==> i*k<=j*l";
+Goal "!!i::nat. [| i<=j; k<=l |] ==> i*k<=j*l";
 by (etac (mult_le_mono1 RS le_trans) 1);
 by (rtac le_trans 1);
 by (stac mult_commute 2);
@@ -526,26 +526,26 @@
 qed "mult_le_mono";
 
 (*strict, in 1st argument; proof is by induction on k>0*)
-goal thy "!!i::nat. [| i<j; 0<k |] ==> k*i < k*j";
+Goal "!!i::nat. [| i<j; 0<k |] ==> k*i < k*j";
 by (eres_inst_tac [("i","0")] less_natE 1);
 by (Asm_simp_tac 1);
 by (induct_tac "x" 1);
 by (ALLGOALS (asm_simp_tac (simpset() addsimps [add_less_mono])));
 qed "mult_less_mono2";
 
-goal thy "!!i::nat. [| i<j; 0<k |] ==> i*k < j*k";
+Goal "!!i::nat. [| i<j; 0<k |] ==> i*k < j*k";
 by (dtac mult_less_mono2 1);
 by (ALLGOALS (asm_full_simp_tac (simpset() addsimps [mult_commute])));
 qed "mult_less_mono1";
 
-goal thy "(0 < m*n) = (0<m & 0<n)";
+Goal "(0 < m*n) = (0<m & 0<n)";
 by (induct_tac "m" 1);
 by (induct_tac "n" 2);
 by (ALLGOALS Asm_simp_tac);
 qed "zero_less_mult_iff";
 Addsimps [zero_less_mult_iff];
 
-goal thy "(m*n = 1) = (m=1 & n=1)";
+Goal "(m*n = 1) = (m=1 & n=1)";
 by (induct_tac "m" 1);
 by (Simp_tac 1);
 by (induct_tac "n" 1);
@@ -554,29 +554,29 @@
 qed "mult_eq_1_iff";
 Addsimps [mult_eq_1_iff];
 
-goal thy "!!k. 0<k ==> (m*k < n*k) = (m<n)";
+Goal "!!k. 0<k ==> (m*k < n*k) = (m<n)";
 by (safe_tac (claset() addSIs [mult_less_mono1]));
 by (cut_facts_tac [less_linear] 1);
 by (blast_tac (claset() addIs [mult_less_mono1] addEs [less_asym]) 1);
 qed "mult_less_cancel2";
 
-goal thy "!!k. 0<k ==> (k*m < k*n) = (m<n)";
+Goal "!!k. 0<k ==> (k*m < k*n) = (m<n)";
 by (dtac mult_less_cancel2 1);
 by (asm_full_simp_tac (simpset() addsimps [mult_commute]) 1);
 qed "mult_less_cancel1";
 Addsimps [mult_less_cancel1, mult_less_cancel2];
 
-goal thy "(Suc k * m < Suc k * n) = (m < n)";
+Goal "(Suc k * m < Suc k * n) = (m < n)";
 by (rtac mult_less_cancel1 1);
 by (Simp_tac 1);
 qed "Suc_mult_less_cancel1";
 
-goalw thy [le_def] "(Suc k * m <= Suc k * n) = (m <= n)";
+Goalw [le_def] "(Suc k * m <= Suc k * n) = (m <= n)";
 by (simp_tac (simpset_of HOL.thy) 1);
 by (rtac Suc_mult_less_cancel1 1);
 qed "Suc_mult_le_cancel1";
 
-goal thy "!!k. 0<k ==> (m*k = n*k) = (m=n)";
+Goal "!!k. 0<k ==> (m*k = n*k) = (m=n)";
 by (cut_facts_tac [less_linear] 1);
 by Safe_tac;
 by (assume_tac 2);
@@ -584,13 +584,13 @@
 by (ALLGOALS Asm_full_simp_tac);
 qed "mult_cancel2";
 
-goal thy "!!k. 0<k ==> (k*m = k*n) = (m=n)";
+Goal "!!k. 0<k ==> (k*m = k*n) = (m=n)";
 by (dtac mult_cancel2 1);
 by (asm_full_simp_tac (simpset() addsimps [mult_commute]) 1);
 qed "mult_cancel1";
 Addsimps [mult_cancel1, mult_cancel2];
 
-goal thy "(Suc k * m = Suc k * n) = (m = n)";
+Goal "(Suc k * m = Suc k * n) = (m = n)";
 by (rtac mult_cancel1 1);
 by (Simp_tac 1);
 qed "Suc_mult_cancel1";
@@ -598,7 +598,7 @@
 
 (** Lemma for gcd **)
 
-goal thy "!!m n. m = m*n ==> n=1 | m=0";
+Goal "!!m n. m = m*n ==> n=1 | m=0";
 by (dtac sym 1);
 by (rtac disjCI 1);
 by (rtac nat_less_cases 1 THEN assume_tac 2);
@@ -609,7 +609,7 @@
 
 (*** Subtraction laws -- mostly from Clemens Ballarin ***)
 
-goal thy "!! a b c::nat. [| a < b; c <= a |] ==> a-c < b-c";
+Goal "!! a b c::nat. [| a < b; c <= a |] ==> a-c < b-c";
 by (subgoal_tac "c+(a-c) < c+(b-c)" 1);
 by (Full_simp_tac 1);
 by (subgoal_tac "c <= b" 1);
@@ -617,29 +617,29 @@
 by (Asm_simp_tac 1);
 qed "diff_less_mono";
 
-goal thy "!! a b c::nat. a+b < c ==> a < c-b";
+Goal "!! a b c::nat. a+b < c ==> a < c-b";
 by (dtac diff_less_mono 1);
 by (rtac le_add2 1);
 by (Asm_full_simp_tac 1);
 qed "add_less_imp_less_diff";
 
-goal thy "!! n. n <= m ==> Suc m - n = Suc (m - n)";
+Goal "!! n. n <= m ==> Suc m - n = Suc (m - n)";
 by (asm_full_simp_tac (simpset() addsimps [Suc_diff_n, le_eq_less_Suc]) 1);
 qed "Suc_diff_le";
 
-goal thy "!! n. Suc i <= n ==> Suc (n - Suc i) = n - i";
+Goal "!! n. Suc i <= n ==> Suc (n - Suc i) = n - i";
 by (asm_full_simp_tac
     (simpset() addsimps [Suc_diff_n RS sym, le_eq_less_Suc]) 1);
 qed "Suc_diff_Suc";
 
-goal thy "!! i::nat. i <= n ==> n - (n - i) = i";
+Goal "!! i::nat. i <= n ==> n - (n - i) = i";
 by (etac rev_mp 1);
 by (res_inst_tac [("m","n"),("n","i")] diff_induct 1);
 by (ALLGOALS (asm_simp_tac  (simpset() addsimps [Suc_diff_le])));
 qed "diff_diff_cancel";
 Addsimps [diff_diff_cancel];
 
-goal thy "!!k::nat. k <= n ==> m <= n + m - k";
+Goal "!!k::nat. k <= n ==> m <= n + m - k";
 by (etac rev_mp 1);
 by (res_inst_tac [("m", "k"), ("n", "n")] diff_induct 1);
 by (Simp_tac 1);
@@ -647,7 +647,7 @@
 by (Simp_tac 1);
 qed "le_add_diff";
 
-goal Arith.thy "!!i::nat. 0<k ==> j<i --> j+k-i < k";
+Goal "!!i::nat. 0<k ==> j<i --> j+k-i < k";
 by (res_inst_tac [("m","j"),("n","i")] diff_induct 1);
 by (ALLGOALS Asm_simp_tac);
 qed_spec_mp "add_diff_less";
@@ -657,14 +657,14 @@
 (** (Anti)Monotonicity of subtraction -- by Stefan Merz **)
 
 (* Monotonicity of subtraction in first argument *)
-goal thy "!!n::nat. m<=n --> (m-l) <= (n-l)";
+Goal "!!n::nat. m<=n --> (m-l) <= (n-l)";
 by (induct_tac "n" 1);
 by (Simp_tac 1);
 by (simp_tac (simpset() addsimps [le_Suc_eq]) 1);
 by (blast_tac (claset() addIs [diff_le_Suc_diff, le_trans]) 1);
 qed_spec_mp "diff_le_mono";
 
-goal thy "!!n::nat. m<=n ==> (l-n) <= (l-m)";
+Goal "!!n::nat. m<=n ==> (l-n) <= (l-m)";
 by (induct_tac "l" 1);
 by (Simp_tac 1);
 by (case_tac "n <= l" 1);