renamed lemmas: nat_xyz/int_xyz -> xyz_nat/xyz_int
authornipkow
Tue Jul 07 17:39:51 2009 +0200 (2009-07-07)
changeset 3195240501bb2d57c
parent 31951 9787769764bb
child 31953 eeb8a300f362
child 31960 1984af09eb41
renamed lemmas: nat_xyz/int_xyz -> xyz_nat/xyz_int
src/HOL/Algebra/Exponent.thy
src/HOL/Decision_Procs/Cooper.thy
src/HOL/Decision_Procs/Ferrack.thy
src/HOL/Decision_Procs/MIR.thy
src/HOL/Divides.thy
src/HOL/GCD.thy
src/HOL/Library/Abstract_Rat.thy
src/HOL/Library/Legacy_GCD.thy
src/HOL/Library/Pocklington.thy
src/HOL/Library/Primes.thy
src/HOL/NewNumberTheory/Binomial.thy
src/HOL/NewNumberTheory/Cong.thy
src/HOL/NewNumberTheory/Fib.thy
src/HOL/NewNumberTheory/MiscAlgebra.thy
src/HOL/NewNumberTheory/Residues.thy
src/HOL/NewNumberTheory/UniqueFactorization.thy
src/HOL/RealDef.thy
src/HOL/ex/LocaleTest2.thy
src/HOL/ex/Sqrt.thy
     1.1 --- a/src/HOL/Algebra/Exponent.thy	Tue Jul 07 07:56:24 2009 +0200
     1.2 +++ b/src/HOL/Algebra/Exponent.thy	Tue Jul 07 17:39:51 2009 +0200
     1.3 @@ -217,7 +217,7 @@
     1.4   prefer 2 apply (blast intro: dvd_mult2)
     1.5  apply (drule dvd_diffD1)
     1.6    apply assumption
     1.7 - prefer 2 apply (blast intro: nat_dvd_diff)
     1.8 + prefer 2 apply (blast intro: dvd_diff_nat)
     1.9  apply (drule gr0_implies_Suc, auto)
    1.10  done
    1.11  
    1.12 @@ -233,7 +233,7 @@
    1.13   prefer 2 apply (blast intro: dvd_mult2)
    1.14  apply (drule dvd_diffD1)
    1.15    apply assumption
    1.16 - prefer 2 apply (blast intro: nat_dvd_diff)
    1.17 + prefer 2 apply (blast intro: dvd_diff_nat)
    1.18  apply (drule less_imp_Suc_add, auto)
    1.19  done
    1.20  
     2.1 --- a/src/HOL/Decision_Procs/Cooper.thy	Tue Jul 07 07:56:24 2009 +0200
     2.2 +++ b/src/HOL/Decision_Procs/Cooper.thy	Tue Jul 07 17:39:51 2009 +0200
     2.3 @@ -1042,7 +1042,7 @@
     2.4  consts 
     2.5    plusinf:: "fm \<Rightarrow> fm" (* Virtual substitution of +\<infinity>*)
     2.6    minusinf:: "fm \<Rightarrow> fm" (* Virtual substitution of -\<infinity>*)
     2.7 -  \<delta> :: "fm \<Rightarrow> int" (* Compute lcm {d| N\<^isup>?\<^isup> Dvd c*x+t \<in> p}*)
     2.8 +  \<delta> :: "fm \<Rightarrow> int" (* Compute lcm {d| N\<^isup>? Dvd c*x+t \<in> p}*)
     2.9    d\<delta> :: "fm \<Rightarrow> int \<Rightarrow> bool" (* checks if a given l divides all the ds above*)
    2.10  
    2.11  recdef minusinf "measure size"
    2.12 @@ -1104,7 +1104,7 @@
    2.13  proof (induct p rule: iszlfm.induct)
    2.14    case (1 p q) 
    2.15    let ?d = "\<delta> (And p q)"
    2.16 -  from prems int_lcm_pos have dp: "?d >0" by simp
    2.17 +  from prems lcm_pos_int have dp: "?d >0" by simp
    2.18    have d1: "\<delta> p dvd \<delta> (And p q)" using prems by simp
    2.19    hence th: "d\<delta> p ?d" using delta_mono prems(3-4) by(simp only: iszlfm.simps)
    2.20    have "\<delta> q dvd \<delta> (And p q)" using prems by simp
    2.21 @@ -1113,7 +1113,7 @@
    2.22  next
    2.23    case (2 p q)  
    2.24    let ?d = "\<delta> (And p q)"
    2.25 -  from prems int_lcm_pos have dp: "?d >0" by simp
    2.26 +  from prems lcm_pos_int have dp: "?d >0" by simp
    2.27    have "\<delta> p dvd \<delta> (And p q)" using prems by simp
    2.28    hence th: "d\<delta> p ?d" using delta_mono prems by(simp only: iszlfm.simps)
    2.29    have "\<delta> q dvd \<delta> (And p q)" using prems by simp
    2.30 @@ -1410,15 +1410,15 @@
    2.31    from prems have dl2: "\<zeta> q dvd lcm (\<zeta> p) (\<zeta> q)"  by simp
    2.32    from prems d\<beta>_mono[where p = "p" and l="\<zeta> p" and l'="lcm (\<zeta> p) (\<zeta> q)"] 
    2.33      d\<beta>_mono[where p = "q" and l="\<zeta> q" and l'="lcm (\<zeta> p) (\<zeta> q)"] 
    2.34 -    dl1 dl2 show ?case by (auto simp add: int_lcm_pos)
    2.35 +    dl1 dl2 show ?case by (auto simp add: lcm_pos_int)
    2.36  next
    2.37    case (2 p q)
    2.38    from prems have dl1: "\<zeta> p dvd lcm (\<zeta> p) (\<zeta> q)" by simp
    2.39    from prems have dl2: "\<zeta> q dvd lcm (\<zeta> p) (\<zeta> q)" by simp
    2.40    from prems d\<beta>_mono[where p = "p" and l="\<zeta> p" and l'="lcm (\<zeta> p) (\<zeta> q)"] 
    2.41      d\<beta>_mono[where p = "q" and l="\<zeta> q" and l'="lcm (\<zeta> p) (\<zeta> q)"] 
    2.42 -    dl1 dl2 show ?case by (auto simp add: int_lcm_pos)
    2.43 -qed (auto simp add: int_lcm_pos)
    2.44 +    dl1 dl2 show ?case by (auto simp add: lcm_pos_int)
    2.45 +qed (auto simp add: lcm_pos_int)
    2.46  
    2.47  lemma a\<beta>: assumes linp: "iszlfm p" and d: "d\<beta> p l" and lp: "l > 0"
    2.48    shows "iszlfm (a\<beta> p l) \<and> d\<beta> (a\<beta> p l) 1 \<and> (Ifm bbs (l*x #bs) (a\<beta> p l) = Ifm bbs (x#bs) p)"
     3.1 --- a/src/HOL/Decision_Procs/Ferrack.thy	Tue Jul 07 07:56:24 2009 +0200
     3.2 +++ b/src/HOL/Decision_Procs/Ferrack.thy	Tue Jul 07 17:39:51 2009 +0200
     3.3 @@ -746,7 +746,7 @@
     3.4      moreover
     3.5      {assume g1:"?g>1" hence g0: "?g > 0" by simp
     3.6        from g1 nnz have gp0: "?g' \<noteq> 0" by simp
     3.7 -      hence g'p: "?g' > 0" using int_gcd_ge_0[where x="n" and y="numgcd ?t'"] by arith 
     3.8 +      hence g'p: "?g' > 0" using gcd_ge_0_int[where x="n" and y="numgcd ?t'"] by arith 
     3.9        hence "?g'= 1 \<or> ?g' > 1" by arith
    3.10        moreover {assume "?g'=1" hence ?thesis by (simp add: Let_def simp_num_pair_def simpnum_ci)}
    3.11        moreover {assume g'1:"?g'>1"
    3.12 @@ -782,7 +782,7 @@
    3.13      moreover
    3.14      {assume g1:"?g>1" hence g0: "?g > 0" by simp
    3.15        from g1 nnz have gp0: "?g' \<noteq> 0" by simp
    3.16 -      hence g'p: "?g' > 0" using int_gcd_ge_0[where x="n" and y="numgcd ?t'"] by arith
    3.17 +      hence g'p: "?g' > 0" using gcd_ge_0_int[where x="n" and y="numgcd ?t'"] by arith
    3.18        hence "?g'= 1 \<or> ?g' > 1" by arith
    3.19        moreover {assume "?g'=1" hence ?thesis using prems 
    3.20  	  by (auto simp add: Let_def simp_num_pair_def simpnum_numbound0)}
     4.1 --- a/src/HOL/Decision_Procs/MIR.thy	Tue Jul 07 07:56:24 2009 +0200
     4.2 +++ b/src/HOL/Decision_Procs/MIR.thy	Tue Jul 07 17:39:51 2009 +0200
     4.3 @@ -1060,7 +1060,7 @@
     4.4      moreover
     4.5      {assume g1:"?g>1" hence g0: "?g > 0" by simp
     4.6        from g1 nnz have gp0: "?g' \<noteq> 0" by simp
     4.7 -      hence g'p: "?g' > 0" using int_gcd_ge_0[where x="n" and y="numgcd ?t'"] by arith
     4.8 +      hence g'p: "?g' > 0" using gcd_ge_0_int[where x="n" and y="numgcd ?t'"] by arith
     4.9        hence "?g'= 1 \<or> ?g' > 1" by arith
    4.10        moreover {assume "?g'=1" hence ?thesis by (simp add: Let_def simp_num_pair_def)}
    4.11        moreover {assume g'1:"?g'>1"
    4.12 @@ -1096,7 +1096,7 @@
    4.13      moreover
    4.14      {assume g1:"?g>1" hence g0: "?g > 0" by simp
    4.15        from g1 nnz have gp0: "?g' \<noteq> 0" by simp
    4.16 -      hence g'p: "?g' > 0" using int_gcd_ge_0[where x="n" and y="numgcd ?t'"] by arith
    4.17 +      hence g'p: "?g' > 0" using gcd_ge_0_int[where x="n" and y="numgcd ?t'"] by arith
    4.18        hence "?g'= 1 \<or> ?g' > 1" by arith
    4.19        moreover {assume "?g'=1" hence ?thesis using prems 
    4.20  	  by (auto simp add: Let_def simp_num_pair_def)}
    4.21 @@ -1233,7 +1233,7 @@
    4.22    moreover
    4.23    {assume g1:"?g>1" hence g0: "?g > 0" by simp
    4.24      from g1 dnz have gp0: "?g' \<noteq> 0" by simp
    4.25 -    hence g'p: "?g' > 0" using int_gcd_ge_0[where x="d" and y="numgcd t"] by arith
    4.26 +    hence g'p: "?g' > 0" using gcd_ge_0_int[where x="d" and y="numgcd t"] by arith
    4.27      hence "?g'= 1 \<or> ?g' > 1" by arith
    4.28      moreover {assume "?g'=1" hence ?thesis by (simp add: Let_def simpdvd_def)}
    4.29      moreover {assume g'1:"?g'>1"
    4.30 @@ -2126,7 +2126,7 @@
    4.31  proof (induct p rule: iszlfm.induct)
    4.32    case (1 p q) 
    4.33    let ?d = "\<delta> (And p q)"
    4.34 -  from prems int_lcm_pos have dp: "?d >0" by simp
    4.35 +  from prems lcm_pos_int have dp: "?d >0" by simp
    4.36    have d1: "\<delta> p dvd \<delta> (And p q)" using prems by simp 
    4.37     hence th: "d\<delta> p ?d" 
    4.38       using delta_mono prems by(simp only: iszlfm.simps) blast
    4.39 @@ -2136,7 +2136,7 @@
    4.40  next
    4.41    case (2 p q)  
    4.42    let ?d = "\<delta> (And p q)"
    4.43 -  from prems int_lcm_pos have dp: "?d >0" by simp
    4.44 +  from prems lcm_pos_int have dp: "?d >0" by simp
    4.45    have "\<delta> p dvd \<delta> (And p q)" using prems by simp hence th: "d\<delta> p ?d" using delta_mono prems 
    4.46      by(simp only: iszlfm.simps) blast
    4.47    have "\<delta> q dvd \<delta> (And p q)" using prems by simp hence th': "d\<delta> q ?d" using delta_mono prems by(simp only: iszlfm.simps) blast
    4.48 @@ -2514,15 +2514,15 @@
    4.49    from prems have dl2: "\<zeta> q dvd lcm (\<zeta> p) (\<zeta> q)" by simp
    4.50    from prems d\<beta>_mono[where p = "p" and l="\<zeta> p" and l'="lcm (\<zeta> p) (\<zeta> q)"] 
    4.51      d\<beta>_mono[where p = "q" and l="\<zeta> q" and l'="lcm (\<zeta> p) (\<zeta> q)"] 
    4.52 -    dl1 dl2 show ?case by (auto simp add: int_lcm_pos)
    4.53 +    dl1 dl2 show ?case by (auto simp add: lcm_pos_int)
    4.54  next
    4.55    case (2 p q)
    4.56    from prems have dl1: "\<zeta> p dvd lcm (\<zeta> p) (\<zeta> q)" by simp
    4.57    from prems have dl2: "\<zeta> q dvd lcm (\<zeta> p) (\<zeta> q)" by simp
    4.58    from prems d\<beta>_mono[where p = "p" and l="\<zeta> p" and l'="lcm (\<zeta> p) (\<zeta> q)"] 
    4.59      d\<beta>_mono[where p = "q" and l="\<zeta> q" and l'="lcm (\<zeta> p) (\<zeta> q)"] 
    4.60 -    dl1 dl2 show ?case by (auto simp add: int_lcm_pos)
    4.61 -qed (auto simp add: int_lcm_pos)
    4.62 +    dl1 dl2 show ?case by (auto simp add: lcm_pos_int)
    4.63 +qed (auto simp add: lcm_pos_int)
    4.64  
    4.65  lemma a\<beta>: assumes linp: "iszlfm p (a #bs)" and d: "d\<beta> p l" and lp: "l > 0"
    4.66    shows "iszlfm (a\<beta> p l) (a #bs) \<and> d\<beta> (a\<beta> p l) 1 \<and> (Ifm (real (l * x) #bs) (a\<beta> p l) = Ifm ((real x)#bs) p)"
    4.67 @@ -4175,7 +4175,7 @@
    4.68    by (induct p rule: isrlfm.induct, auto)
    4.69  lemma zgcd_le1: assumes ip: "(0::int) < i" shows "gcd i j \<le> i"
    4.70  proof-
    4.71 -  from int_gcd_dvd1 have th: "gcd i j dvd i" by blast
    4.72 +  from gcd_dvd1_int have th: "gcd i j dvd i" by blast
    4.73    from zdvd_imp_le[OF th ip] show ?thesis .
    4.74  qed
    4.75  
     5.1 --- a/src/HOL/Divides.thy	Tue Jul 07 07:56:24 2009 +0200
     5.2 +++ b/src/HOL/Divides.thy	Tue Jul 07 17:39:51 2009 +0200
     5.3 @@ -887,7 +887,7 @@
     5.4  interpretation dvd: order "op dvd" "\<lambda>n m \<Colon> nat. n dvd m \<and> \<not> m dvd n"
     5.5    proof qed (auto intro: dvd_refl dvd_trans dvd_anti_sym)
     5.6  
     5.7 -lemma nat_dvd_diff[simp]: "[| k dvd m; k dvd n |] ==> k dvd (m-n :: nat)"
     5.8 +lemma dvd_diff_nat[simp]: "[| k dvd m; k dvd n |] ==> k dvd (m-n :: nat)"
     5.9  unfolding dvd_def
    5.10  by (blast intro: diff_mult_distrib2 [symmetric])
    5.11  
    5.12 @@ -897,7 +897,7 @@
    5.13    done
    5.14  
    5.15  lemma dvd_diffD1: "[| k dvd m-n; k dvd m; n\<le>m |] ==> k dvd (n::nat)"
    5.16 -by (drule_tac m = m in nat_dvd_diff, auto)
    5.17 +by (drule_tac m = m in dvd_diff_nat, auto)
    5.18  
    5.19  lemma dvd_reduce: "(k dvd n + k) = (k dvd (n::nat))"
    5.20    apply (rule iffI)
    5.21 @@ -906,7 +906,7 @@
    5.22    apply (subgoal_tac "n = (n+k) -k")
    5.23     prefer 2 apply simp
    5.24    apply (erule ssubst)
    5.25 -  apply (erule nat_dvd_diff)
    5.26 +  apply (erule dvd_diff_nat)
    5.27    apply (rule dvd_refl)
    5.28    done
    5.29  
     6.1 --- a/src/HOL/GCD.thy	Tue Jul 07 07:56:24 2009 +0200
     6.2 +++ b/src/HOL/GCD.thy	Tue Jul 07 17:39:51 2009 +0200
     6.3 @@ -163,7 +163,7 @@
     6.4  subsection {* GCD *}
     6.5  
     6.6  (* was gcd_induct *)
     6.7 -lemma nat_gcd_induct:
     6.8 +lemma gcd_nat_induct:
     6.9    fixes m n :: nat
    6.10    assumes "\<And>m. P m 0"
    6.11      and "\<And>m n. 0 < n \<Longrightarrow> P n (m mod n) \<Longrightarrow> P m n"
    6.12 @@ -175,43 +175,43 @@
    6.13  
    6.14  (* specific to int *)
    6.15  
    6.16 -lemma int_gcd_neg1 [simp]: "gcd (-x::int) y = gcd x y"
    6.17 +lemma gcd_neg1_int [simp]: "gcd (-x::int) y = gcd x y"
    6.18    by (simp add: gcd_int_def)
    6.19  
    6.20 -lemma int_gcd_neg2 [simp]: "gcd (x::int) (-y) = gcd x y"
    6.21 +lemma gcd_neg2_int [simp]: "gcd (x::int) (-y) = gcd x y"
    6.22    by (simp add: gcd_int_def)
    6.23  
    6.24  lemma abs_gcd_int[simp]: "abs(gcd (x::int) y) = gcd x y"
    6.25  by(simp add: gcd_int_def)
    6.26  
    6.27 -lemma int_gcd_abs: "gcd (x::int) y = gcd (abs x) (abs y)"
    6.28 +lemma gcd_abs_int: "gcd (x::int) y = gcd (abs x) (abs y)"
    6.29  by (simp add: gcd_int_def)
    6.30  
    6.31  lemma gcd_abs1_int[simp]: "gcd (abs x) (y::int) = gcd x y"
    6.32 -by (metis abs_idempotent int_gcd_abs)
    6.33 +by (metis abs_idempotent gcd_abs_int)
    6.34  
    6.35  lemma gcd_abs2_int[simp]: "gcd x (abs y::int) = gcd x y"
    6.36 -by (metis abs_idempotent int_gcd_abs)
    6.37 +by (metis abs_idempotent gcd_abs_int)
    6.38  
    6.39 -lemma int_gcd_cases:
    6.40 +lemma gcd_cases_int:
    6.41    fixes x :: int and y
    6.42    assumes "x >= 0 \<Longrightarrow> y >= 0 \<Longrightarrow> P (gcd x y)"
    6.43        and "x >= 0 \<Longrightarrow> y <= 0 \<Longrightarrow> P (gcd x (-y))"
    6.44        and "x <= 0 \<Longrightarrow> y >= 0 \<Longrightarrow> P (gcd (-x) y)"
    6.45        and "x <= 0 \<Longrightarrow> y <= 0 \<Longrightarrow> P (gcd (-x) (-y))"
    6.46    shows "P (gcd x y)"
    6.47 -by (insert prems, auto simp add: int_gcd_neg1 int_gcd_neg2, arith)
    6.48 +by (insert prems, auto simp add: gcd_neg1_int gcd_neg2_int, arith)
    6.49  
    6.50 -lemma int_gcd_ge_0 [simp]: "gcd (x::int) y >= 0"
    6.51 +lemma gcd_ge_0_int [simp]: "gcd (x::int) y >= 0"
    6.52    by (simp add: gcd_int_def)
    6.53  
    6.54 -lemma int_lcm_neg1: "lcm (-x::int) y = lcm x y"
    6.55 +lemma lcm_neg1_int: "lcm (-x::int) y = lcm x y"
    6.56    by (simp add: lcm_int_def)
    6.57  
    6.58 -lemma int_lcm_neg2: "lcm (x::int) (-y) = lcm x y"
    6.59 +lemma lcm_neg2_int: "lcm (x::int) (-y) = lcm x y"
    6.60    by (simp add: lcm_int_def)
    6.61  
    6.62 -lemma int_lcm_abs: "lcm (x::int) y = lcm (abs x) (abs y)"
    6.63 +lemma lcm_abs_int: "lcm (x::int) y = lcm (abs x) (abs y)"
    6.64    by (simp add: lcm_int_def)
    6.65  
    6.66  lemma abs_lcm_int [simp]: "abs (lcm i j::int) = lcm i j"
    6.67 @@ -223,53 +223,53 @@
    6.68  lemma lcm_abs2_int[simp]: "lcm x (abs y::int) = lcm x y"
    6.69  by (metis abs_idempotent lcm_int_def)
    6.70  
    6.71 -lemma int_lcm_cases:
    6.72 +lemma lcm_cases_int:
    6.73    fixes x :: int and y
    6.74    assumes "x >= 0 \<Longrightarrow> y >= 0 \<Longrightarrow> P (lcm x y)"
    6.75        and "x >= 0 \<Longrightarrow> y <= 0 \<Longrightarrow> P (lcm x (-y))"
    6.76        and "x <= 0 \<Longrightarrow> y >= 0 \<Longrightarrow> P (lcm (-x) y)"
    6.77        and "x <= 0 \<Longrightarrow> y <= 0 \<Longrightarrow> P (lcm (-x) (-y))"
    6.78    shows "P (lcm x y)"
    6.79 -by (insert prems, auto simp add: int_lcm_neg1 int_lcm_neg2, arith)
    6.80 +by (insert prems, auto simp add: lcm_neg1_int lcm_neg2_int, arith)
    6.81  
    6.82 -lemma int_lcm_ge_0 [simp]: "lcm (x::int) y >= 0"
    6.83 +lemma lcm_ge_0_int [simp]: "lcm (x::int) y >= 0"
    6.84    by (simp add: lcm_int_def)
    6.85  
    6.86  (* was gcd_0, etc. *)
    6.87 -lemma nat_gcd_0 [simp]: "gcd (x::nat) 0 = x"
    6.88 +lemma gcd_0_nat [simp]: "gcd (x::nat) 0 = x"
    6.89    by simp
    6.90  
    6.91  (* was igcd_0, etc. *)
    6.92 -lemma int_gcd_0 [simp]: "gcd (x::int) 0 = abs x"
    6.93 +lemma gcd_0_int [simp]: "gcd (x::int) 0 = abs x"
    6.94    by (unfold gcd_int_def, auto)
    6.95  
    6.96 -lemma nat_gcd_0_left [simp]: "gcd 0 (x::nat) = x"
    6.97 +lemma gcd_0_left_nat [simp]: "gcd 0 (x::nat) = x"
    6.98    by simp
    6.99  
   6.100 -lemma int_gcd_0_left [simp]: "gcd 0 (x::int) = abs x"
   6.101 +lemma gcd_0_left_int [simp]: "gcd 0 (x::int) = abs x"
   6.102    by (unfold gcd_int_def, auto)
   6.103  
   6.104 -lemma nat_gcd_red: "gcd (x::nat) y = gcd y (x mod y)"
   6.105 +lemma gcd_red_nat: "gcd (x::nat) y = gcd y (x mod y)"
   6.106    by (case_tac "y = 0", auto)
   6.107  
   6.108  (* weaker, but useful for the simplifier *)
   6.109  
   6.110 -lemma nat_gcd_non_0: "y ~= (0::nat) \<Longrightarrow> gcd (x::nat) y = gcd y (x mod y)"
   6.111 +lemma gcd_non_0_nat: "y ~= (0::nat) \<Longrightarrow> gcd (x::nat) y = gcd y (x mod y)"
   6.112    by simp
   6.113  
   6.114 -lemma nat_gcd_1 [simp]: "gcd (m::nat) 1 = 1"
   6.115 +lemma gcd_1_nat [simp]: "gcd (m::nat) 1 = 1"
   6.116    by simp
   6.117  
   6.118 -lemma nat_gcd_Suc_0 [simp]: "gcd (m::nat) (Suc 0) = Suc 0"
   6.119 +lemma gcd_Suc_0 [simp]: "gcd (m::nat) (Suc 0) = Suc 0"
   6.120    by (simp add: One_nat_def)
   6.121  
   6.122 -lemma int_gcd_1 [simp]: "gcd (m::int) 1 = 1"
   6.123 +lemma gcd_1_int [simp]: "gcd (m::int) 1 = 1"
   6.124    by (simp add: gcd_int_def)
   6.125  
   6.126 -lemma nat_gcd_idem: "gcd (x::nat) x = x"
   6.127 +lemma gcd_idem_nat: "gcd (x::nat) x = x"
   6.128  by simp
   6.129  
   6.130 -lemma int_gcd_idem: "gcd (x::int) x = abs x"
   6.131 +lemma gcd_idem_int: "gcd (x::int) x = abs x"
   6.132  by (auto simp add: gcd_int_def)
   6.133  
   6.134  declare gcd_nat.simps [simp del]
   6.135 @@ -279,260 +279,260 @@
   6.136    conjunctions don't seem provable separately.
   6.137  *}
   6.138  
   6.139 -lemma nat_gcd_dvd1 [iff]: "(gcd (m::nat)) n dvd m"
   6.140 -  and nat_gcd_dvd2 [iff]: "(gcd m n) dvd n"
   6.141 -  apply (induct m n rule: nat_gcd_induct)
   6.142 -  apply (simp_all add: nat_gcd_non_0)
   6.143 +lemma gcd_dvd1_nat [iff]: "(gcd (m::nat)) n dvd m"
   6.144 +  and gcd_dvd2_nat [iff]: "(gcd m n) dvd n"
   6.145 +  apply (induct m n rule: gcd_nat_induct)
   6.146 +  apply (simp_all add: gcd_non_0_nat)
   6.147    apply (blast dest: dvd_mod_imp_dvd)
   6.148  done
   6.149  
   6.150 -lemma int_gcd_dvd1 [iff]: "gcd (x::int) y dvd x"
   6.151 -by (metis gcd_int_def int_dvd_iff nat_gcd_dvd1)
   6.152 +lemma gcd_dvd1_int [iff]: "gcd (x::int) y dvd x"
   6.153 +by (metis gcd_int_def int_dvd_iff gcd_dvd1_nat)
   6.154  
   6.155 -lemma int_gcd_dvd2 [iff]: "gcd (x::int) y dvd y"
   6.156 -by (metis gcd_int_def int_dvd_iff nat_gcd_dvd2)
   6.157 +lemma gcd_dvd2_int [iff]: "gcd (x::int) y dvd y"
   6.158 +by (metis gcd_int_def int_dvd_iff gcd_dvd2_nat)
   6.159  
   6.160  lemma dvd_gcd_D1_nat: "k dvd gcd m n \<Longrightarrow> (k::nat) dvd m"
   6.161 -by(metis nat_gcd_dvd1 dvd_trans)
   6.162 +by(metis gcd_dvd1_nat dvd_trans)
   6.163  
   6.164  lemma dvd_gcd_D2_nat: "k dvd gcd m n \<Longrightarrow> (k::nat) dvd n"
   6.165 -by(metis nat_gcd_dvd2 dvd_trans)
   6.166 +by(metis gcd_dvd2_nat dvd_trans)
   6.167  
   6.168  lemma dvd_gcd_D1_int: "i dvd gcd m n \<Longrightarrow> (i::int) dvd m"
   6.169 -by(metis int_gcd_dvd1 dvd_trans)
   6.170 +by(metis gcd_dvd1_int dvd_trans)
   6.171  
   6.172  lemma dvd_gcd_D2_int: "i dvd gcd m n \<Longrightarrow> (i::int) dvd n"
   6.173 -by(metis int_gcd_dvd2 dvd_trans)
   6.174 +by(metis gcd_dvd2_int dvd_trans)
   6.175  
   6.176 -lemma nat_gcd_le1 [simp]: "a \<noteq> 0 \<Longrightarrow> gcd (a::nat) b \<le> a"
   6.177 +lemma gcd_le1_nat [simp]: "a \<noteq> 0 \<Longrightarrow> gcd (a::nat) b \<le> a"
   6.178    by (rule dvd_imp_le, auto)
   6.179  
   6.180 -lemma nat_gcd_le2 [simp]: "b \<noteq> 0 \<Longrightarrow> gcd (a::nat) b \<le> b"
   6.181 +lemma gcd_le2_nat [simp]: "b \<noteq> 0 \<Longrightarrow> gcd (a::nat) b \<le> b"
   6.182    by (rule dvd_imp_le, auto)
   6.183  
   6.184 -lemma int_gcd_le1 [simp]: "a > 0 \<Longrightarrow> gcd (a::int) b \<le> a"
   6.185 +lemma gcd_le1_int [simp]: "a > 0 \<Longrightarrow> gcd (a::int) b \<le> a"
   6.186    by (rule zdvd_imp_le, auto)
   6.187  
   6.188 -lemma int_gcd_le2 [simp]: "b > 0 \<Longrightarrow> gcd (a::int) b \<le> b"
   6.189 +lemma gcd_le2_int [simp]: "b > 0 \<Longrightarrow> gcd (a::int) b \<le> b"
   6.190    by (rule zdvd_imp_le, auto)
   6.191  
   6.192 -lemma nat_gcd_greatest: "(k::nat) dvd m \<Longrightarrow> k dvd n \<Longrightarrow> k dvd gcd m n"
   6.193 -by (induct m n rule: nat_gcd_induct) (simp_all add: nat_gcd_non_0 dvd_mod)
   6.194 +lemma gcd_greatest_nat: "(k::nat) dvd m \<Longrightarrow> k dvd n \<Longrightarrow> k dvd gcd m n"
   6.195 +by (induct m n rule: gcd_nat_induct) (simp_all add: gcd_non_0_nat dvd_mod)
   6.196  
   6.197 -lemma int_gcd_greatest:
   6.198 +lemma gcd_greatest_int:
   6.199    "(k::int) dvd m \<Longrightarrow> k dvd n \<Longrightarrow> k dvd gcd m n"
   6.200 -  apply (subst int_gcd_abs)
   6.201 +  apply (subst gcd_abs_int)
   6.202    apply (subst abs_dvd_iff [symmetric])
   6.203 -  apply (rule nat_gcd_greatest [transferred])
   6.204 +  apply (rule gcd_greatest_nat [transferred])
   6.205    apply auto
   6.206  done
   6.207  
   6.208 -lemma nat_gcd_greatest_iff [iff]: "(k dvd gcd (m::nat) n) =
   6.209 +lemma gcd_greatest_iff_nat [iff]: "(k dvd gcd (m::nat) n) =
   6.210      (k dvd m & k dvd n)"
   6.211 -  by (blast intro!: nat_gcd_greatest intro: dvd_trans)
   6.212 +  by (blast intro!: gcd_greatest_nat intro: dvd_trans)
   6.213  
   6.214 -lemma int_gcd_greatest_iff: "((k::int) dvd gcd m n) = (k dvd m & k dvd n)"
   6.215 -  by (blast intro!: int_gcd_greatest intro: dvd_trans)
   6.216 +lemma gcd_greatest_iff_int: "((k::int) dvd gcd m n) = (k dvd m & k dvd n)"
   6.217 +  by (blast intro!: gcd_greatest_int intro: dvd_trans)
   6.218  
   6.219 -lemma nat_gcd_zero [simp]: "(gcd (m::nat) n = 0) = (m = 0 & n = 0)"
   6.220 -  by (simp only: dvd_0_left_iff [symmetric] nat_gcd_greatest_iff)
   6.221 +lemma gcd_zero_nat [simp]: "(gcd (m::nat) n = 0) = (m = 0 & n = 0)"
   6.222 +  by (simp only: dvd_0_left_iff [symmetric] gcd_greatest_iff_nat)
   6.223  
   6.224 -lemma int_gcd_zero [simp]: "(gcd (m::int) n = 0) = (m = 0 & n = 0)"
   6.225 +lemma gcd_zero_int [simp]: "(gcd (m::int) n = 0) = (m = 0 & n = 0)"
   6.226    by (auto simp add: gcd_int_def)
   6.227  
   6.228 -lemma nat_gcd_pos [simp]: "(gcd (m::nat) n > 0) = (m ~= 0 | n ~= 0)"
   6.229 -  by (insert nat_gcd_zero [of m n], arith)
   6.230 +lemma gcd_pos_nat [simp]: "(gcd (m::nat) n > 0) = (m ~= 0 | n ~= 0)"
   6.231 +  by (insert gcd_zero_nat [of m n], arith)
   6.232  
   6.233 -lemma int_gcd_pos [simp]: "(gcd (m::int) n > 0) = (m ~= 0 | n ~= 0)"
   6.234 -  by (insert int_gcd_zero [of m n], insert int_gcd_ge_0 [of m n], arith)
   6.235 +lemma gcd_pos_int [simp]: "(gcd (m::int) n > 0) = (m ~= 0 | n ~= 0)"
   6.236 +  by (insert gcd_zero_int [of m n], insert gcd_ge_0_int [of m n], arith)
   6.237  
   6.238 -lemma nat_gcd_commute: "gcd (m::nat) n = gcd n m"
   6.239 +lemma gcd_commute_nat: "gcd (m::nat) n = gcd n m"
   6.240    by (rule dvd_anti_sym, auto)
   6.241  
   6.242 -lemma int_gcd_commute: "gcd (m::int) n = gcd n m"
   6.243 -  by (auto simp add: gcd_int_def nat_gcd_commute)
   6.244 +lemma gcd_commute_int: "gcd (m::int) n = gcd n m"
   6.245 +  by (auto simp add: gcd_int_def gcd_commute_nat)
   6.246  
   6.247 -lemma nat_gcd_assoc: "gcd (gcd (k::nat) m) n = gcd k (gcd m n)"
   6.248 +lemma gcd_assoc_nat: "gcd (gcd (k::nat) m) n = gcd k (gcd m n)"
   6.249    apply (rule dvd_anti_sym)
   6.250    apply (blast intro: dvd_trans)+
   6.251  done
   6.252  
   6.253 -lemma int_gcd_assoc: "gcd (gcd (k::int) m) n = gcd k (gcd m n)"
   6.254 -  by (auto simp add: gcd_int_def nat_gcd_assoc)
   6.255 +lemma gcd_assoc_int: "gcd (gcd (k::int) m) n = gcd k (gcd m n)"
   6.256 +  by (auto simp add: gcd_int_def gcd_assoc_nat)
   6.257  
   6.258 -lemmas nat_gcd_left_commute =
   6.259 -  mk_left_commute[of gcd, OF nat_gcd_assoc nat_gcd_commute]
   6.260 +lemmas gcd_left_commute_nat =
   6.261 +  mk_left_commute[of gcd, OF gcd_assoc_nat gcd_commute_nat]
   6.262  
   6.263 -lemmas int_gcd_left_commute =
   6.264 -  mk_left_commute[of gcd, OF int_gcd_assoc int_gcd_commute]
   6.265 +lemmas gcd_left_commute_int =
   6.266 +  mk_left_commute[of gcd, OF gcd_assoc_int gcd_commute_int]
   6.267  
   6.268 -lemmas nat_gcd_ac = nat_gcd_assoc nat_gcd_commute nat_gcd_left_commute
   6.269 +lemmas gcd_ac_nat = gcd_assoc_nat gcd_commute_nat gcd_left_commute_nat
   6.270    -- {* gcd is an AC-operator *}
   6.271  
   6.272 -lemmas int_gcd_ac = int_gcd_assoc int_gcd_commute int_gcd_left_commute
   6.273 +lemmas gcd_ac_int = gcd_assoc_int gcd_commute_int gcd_left_commute_int
   6.274  
   6.275 -lemma nat_gcd_unique: "(d::nat) dvd a \<and> d dvd b \<and>
   6.276 +lemma gcd_unique_nat: "(d::nat) dvd a \<and> d dvd b \<and>
   6.277      (\<forall>e. e dvd a \<and> e dvd b \<longrightarrow> e dvd d) \<longleftrightarrow> d = gcd a b"
   6.278    apply auto
   6.279    apply (rule dvd_anti_sym)
   6.280 -  apply (erule (1) nat_gcd_greatest)
   6.281 +  apply (erule (1) gcd_greatest_nat)
   6.282    apply auto
   6.283  done
   6.284  
   6.285 -lemma int_gcd_unique: "d >= 0 & (d::int) dvd a \<and> d dvd b \<and>
   6.286 +lemma gcd_unique_int: "d >= 0 & (d::int) dvd a \<and> d dvd b \<and>
   6.287      (\<forall>e. e dvd a \<and> e dvd b \<longrightarrow> e dvd d) \<longleftrightarrow> d = gcd a b"
   6.288    apply (case_tac "d = 0")
   6.289    apply force
   6.290    apply (rule iffI)
   6.291    apply (rule zdvd_anti_sym)
   6.292    apply arith
   6.293 -  apply (subst int_gcd_pos)
   6.294 +  apply (subst gcd_pos_int)
   6.295    apply clarsimp
   6.296    apply (drule_tac x = "d + 1" in spec)
   6.297    apply (frule zdvd_imp_le)
   6.298 -  apply (auto intro: int_gcd_greatest)
   6.299 +  apply (auto intro: gcd_greatest_int)
   6.300  done
   6.301  
   6.302  lemma gcd_proj1_if_dvd_nat [simp]: "(x::nat) dvd y \<Longrightarrow> gcd x y = x"
   6.303 -by (metis dvd.eq_iff nat_gcd_unique)
   6.304 +by (metis dvd.eq_iff gcd_unique_nat)
   6.305  
   6.306  lemma gcd_proj2_if_dvd_nat [simp]: "(y::nat) dvd x \<Longrightarrow> gcd x y = y"
   6.307 -by (metis dvd.eq_iff nat_gcd_unique)
   6.308 +by (metis dvd.eq_iff gcd_unique_nat)
   6.309  
   6.310  lemma gcd_proj1_if_dvd_int[simp]: "x dvd y \<Longrightarrow> gcd (x::int) y = abs x"
   6.311 -by (metis abs_dvd_iff abs_eq_0 int_gcd_0_left int_gcd_abs int_gcd_unique)
   6.312 +by (metis abs_dvd_iff abs_eq_0 gcd_0_left_int gcd_abs_int gcd_unique_int)
   6.313  
   6.314  lemma gcd_proj2_if_dvd_int[simp]: "y dvd x \<Longrightarrow> gcd (x::int) y = abs y"
   6.315 -by (metis gcd_proj1_if_dvd_int int_gcd_commute)
   6.316 +by (metis gcd_proj1_if_dvd_int gcd_commute_int)
   6.317  
   6.318  
   6.319  text {*
   6.320    \medskip Multiplication laws
   6.321  *}
   6.322  
   6.323 -lemma nat_gcd_mult_distrib: "(k::nat) * gcd m n = gcd (k * m) (k * n)"
   6.324 +lemma gcd_mult_distrib_nat: "(k::nat) * gcd m n = gcd (k * m) (k * n)"
   6.325      -- {* \cite[page 27]{davenport92} *}
   6.326 -  apply (induct m n rule: nat_gcd_induct)
   6.327 +  apply (induct m n rule: gcd_nat_induct)
   6.328    apply simp
   6.329    apply (case_tac "k = 0")
   6.330 -  apply (simp_all add: mod_geq nat_gcd_non_0 mod_mult_distrib2)
   6.331 +  apply (simp_all add: mod_geq gcd_non_0_nat mod_mult_distrib2)
   6.332  done
   6.333  
   6.334 -lemma int_gcd_mult_distrib: "abs (k::int) * gcd m n = gcd (k * m) (k * n)"
   6.335 -  apply (subst (1 2) int_gcd_abs)
   6.336 +lemma gcd_mult_distrib_int: "abs (k::int) * gcd m n = gcd (k * m) (k * n)"
   6.337 +  apply (subst (1 2) gcd_abs_int)
   6.338    apply (subst (1 2) abs_mult)
   6.339 -  apply (rule nat_gcd_mult_distrib [transferred])
   6.340 +  apply (rule gcd_mult_distrib_nat [transferred])
   6.341    apply auto
   6.342  done
   6.343  
   6.344 -lemma nat_coprime_dvd_mult: "coprime (k::nat) n \<Longrightarrow> k dvd m * n \<Longrightarrow> k dvd m"
   6.345 -  apply (insert nat_gcd_mult_distrib [of m k n])
   6.346 +lemma coprime_dvd_mult_nat: "coprime (k::nat) n \<Longrightarrow> k dvd m * n \<Longrightarrow> k dvd m"
   6.347 +  apply (insert gcd_mult_distrib_nat [of m k n])
   6.348    apply simp
   6.349    apply (erule_tac t = m in ssubst)
   6.350    apply simp
   6.351    done
   6.352  
   6.353 -lemma int_coprime_dvd_mult:
   6.354 +lemma coprime_dvd_mult_int:
   6.355    "coprime (k::int) n \<Longrightarrow> k dvd m * n \<Longrightarrow> k dvd m"
   6.356  apply (subst abs_dvd_iff [symmetric])
   6.357  apply (subst dvd_abs_iff [symmetric])
   6.358 -apply (subst (asm) int_gcd_abs)
   6.359 -apply (rule nat_coprime_dvd_mult [transferred])
   6.360 +apply (subst (asm) gcd_abs_int)
   6.361 +apply (rule coprime_dvd_mult_nat [transferred])
   6.362      prefer 4 apply assumption
   6.363     apply auto
   6.364  apply (subst abs_mult [symmetric], auto)
   6.365  done
   6.366  
   6.367 -lemma nat_coprime_dvd_mult_iff: "coprime (k::nat) n \<Longrightarrow>
   6.368 +lemma coprime_dvd_mult_iff_nat: "coprime (k::nat) n \<Longrightarrow>
   6.369      (k dvd m * n) = (k dvd m)"
   6.370 -  by (auto intro: nat_coprime_dvd_mult)
   6.371 +  by (auto intro: coprime_dvd_mult_nat)
   6.372  
   6.373 -lemma int_coprime_dvd_mult_iff: "coprime (k::int) n \<Longrightarrow>
   6.374 +lemma coprime_dvd_mult_iff_int: "coprime (k::int) n \<Longrightarrow>
   6.375      (k dvd m * n) = (k dvd m)"
   6.376 -  by (auto intro: int_coprime_dvd_mult)
   6.377 +  by (auto intro: coprime_dvd_mult_int)
   6.378  
   6.379 -lemma nat_gcd_mult_cancel: "coprime k n \<Longrightarrow> gcd ((k::nat) * m) n = gcd m n"
   6.380 +lemma gcd_mult_cancel_nat: "coprime k n \<Longrightarrow> gcd ((k::nat) * m) n = gcd m n"
   6.381    apply (rule dvd_anti_sym)
   6.382 -  apply (rule nat_gcd_greatest)
   6.383 -  apply (rule_tac n = k in nat_coprime_dvd_mult)
   6.384 -  apply (simp add: nat_gcd_assoc)
   6.385 -  apply (simp add: nat_gcd_commute)
   6.386 +  apply (rule gcd_greatest_nat)
   6.387 +  apply (rule_tac n = k in coprime_dvd_mult_nat)
   6.388 +  apply (simp add: gcd_assoc_nat)
   6.389 +  apply (simp add: gcd_commute_nat)
   6.390    apply (simp_all add: mult_commute)
   6.391  done
   6.392  
   6.393 -lemma int_gcd_mult_cancel:
   6.394 +lemma gcd_mult_cancel_int:
   6.395    "coprime (k::int) n \<Longrightarrow> gcd (k * m) n = gcd m n"
   6.396 -apply (subst (1 2) int_gcd_abs)
   6.397 +apply (subst (1 2) gcd_abs_int)
   6.398  apply (subst abs_mult)
   6.399 -apply (rule nat_gcd_mult_cancel [transferred], auto)
   6.400 +apply (rule gcd_mult_cancel_nat [transferred], auto)
   6.401  done
   6.402  
   6.403  text {* \medskip Addition laws *}
   6.404  
   6.405 -lemma nat_gcd_add1 [simp]: "gcd ((m::nat) + n) n = gcd m n"
   6.406 +lemma gcd_add1_nat [simp]: "gcd ((m::nat) + n) n = gcd m n"
   6.407    apply (case_tac "n = 0")
   6.408 -  apply (simp_all add: nat_gcd_non_0)
   6.409 +  apply (simp_all add: gcd_non_0_nat)
   6.410  done
   6.411  
   6.412 -lemma nat_gcd_add2 [simp]: "gcd (m::nat) (m + n) = gcd m n"
   6.413 -  apply (subst (1 2) nat_gcd_commute)
   6.414 +lemma gcd_add2_nat [simp]: "gcd (m::nat) (m + n) = gcd m n"
   6.415 +  apply (subst (1 2) gcd_commute_nat)
   6.416    apply (subst add_commute)
   6.417    apply simp
   6.418  done
   6.419  
   6.420  (* to do: add the other variations? *)
   6.421  
   6.422 -lemma nat_gcd_diff1: "(m::nat) >= n \<Longrightarrow> gcd (m - n) n = gcd m n"
   6.423 -  by (subst nat_gcd_add1 [symmetric], auto)
   6.424 +lemma gcd_diff1_nat: "(m::nat) >= n \<Longrightarrow> gcd (m - n) n = gcd m n"
   6.425 +  by (subst gcd_add1_nat [symmetric], auto)
   6.426  
   6.427 -lemma nat_gcd_diff2: "(n::nat) >= m \<Longrightarrow> gcd (n - m) n = gcd m n"
   6.428 -  apply (subst nat_gcd_commute)
   6.429 -  apply (subst nat_gcd_diff1 [symmetric])
   6.430 +lemma gcd_diff2_nat: "(n::nat) >= m \<Longrightarrow> gcd (n - m) n = gcd m n"
   6.431 +  apply (subst gcd_commute_nat)
   6.432 +  apply (subst gcd_diff1_nat [symmetric])
   6.433    apply auto
   6.434 -  apply (subst nat_gcd_commute)
   6.435 -  apply (subst nat_gcd_diff1)
   6.436 +  apply (subst gcd_commute_nat)
   6.437 +  apply (subst gcd_diff1_nat)
   6.438    apply assumption
   6.439 -  apply (rule nat_gcd_commute)
   6.440 +  apply (rule gcd_commute_nat)
   6.441  done
   6.442  
   6.443 -lemma int_gcd_non_0: "(y::int) > 0 \<Longrightarrow> gcd x y = gcd y (x mod y)"
   6.444 +lemma gcd_non_0_int: "(y::int) > 0 \<Longrightarrow> gcd x y = gcd y (x mod y)"
   6.445    apply (frule_tac b = y and a = x in pos_mod_sign)
   6.446    apply (simp del: pos_mod_sign add: gcd_int_def abs_if nat_mod_distrib)
   6.447 -  apply (auto simp add: nat_gcd_non_0 nat_mod_distrib [symmetric]
   6.448 +  apply (auto simp add: gcd_non_0_nat nat_mod_distrib [symmetric]
   6.449      zmod_zminus1_eq_if)
   6.450    apply (frule_tac a = x in pos_mod_bound)
   6.451 -  apply (subst (1 2) nat_gcd_commute)
   6.452 -  apply (simp del: pos_mod_bound add: nat_diff_distrib nat_gcd_diff2
   6.453 +  apply (subst (1 2) gcd_commute_nat)
   6.454 +  apply (simp del: pos_mod_bound add: nat_diff_distrib gcd_diff2_nat
   6.455      nat_le_eq_zle)
   6.456  done
   6.457  
   6.458 -lemma int_gcd_red: "gcd (x::int) y = gcd y (x mod y)"
   6.459 +lemma gcd_red_int: "gcd (x::int) y = gcd y (x mod y)"
   6.460    apply (case_tac "y = 0")
   6.461    apply force
   6.462    apply (case_tac "y > 0")
   6.463 -  apply (subst int_gcd_non_0, auto)
   6.464 -  apply (insert int_gcd_non_0 [of "-y" "-x"])
   6.465 -  apply (auto simp add: int_gcd_neg1 int_gcd_neg2)
   6.466 +  apply (subst gcd_non_0_int, auto)
   6.467 +  apply (insert gcd_non_0_int [of "-y" "-x"])
   6.468 +  apply (auto simp add: gcd_neg1_int gcd_neg2_int)
   6.469  done
   6.470  
   6.471 -lemma int_gcd_add1 [simp]: "gcd ((m::int) + n) n = gcd m n"
   6.472 -by (metis int_gcd_red mod_add_self1 zadd_commute)
   6.473 +lemma gcd_add1_int [simp]: "gcd ((m::int) + n) n = gcd m n"
   6.474 +by (metis gcd_red_int mod_add_self1 zadd_commute)
   6.475  
   6.476 -lemma int_gcd_add2 [simp]: "gcd m ((m::int) + n) = gcd m n"
   6.477 -by (metis int_gcd_add1 int_gcd_commute zadd_commute)
   6.478 +lemma gcd_add2_int [simp]: "gcd m ((m::int) + n) = gcd m n"
   6.479 +by (metis gcd_add1_int gcd_commute_int zadd_commute)
   6.480  
   6.481 -lemma nat_gcd_add_mult: "gcd (m::nat) (k * m + n) = gcd m n"
   6.482 -by (metis mod_mult_self3 nat_gcd_commute nat_gcd_red)
   6.483 +lemma gcd_add_mult_nat: "gcd (m::nat) (k * m + n) = gcd m n"
   6.484 +by (metis mod_mult_self3 gcd_commute_nat gcd_red_nat)
   6.485  
   6.486 -lemma int_gcd_add_mult: "gcd (m::int) (k * m + n) = gcd m n"
   6.487 -by (metis int_gcd_commute int_gcd_red mod_mult_self1 zadd_commute)
   6.488 +lemma gcd_add_mult_int: "gcd (m::int) (k * m + n) = gcd m n"
   6.489 +by (metis gcd_commute_int gcd_red_int mod_mult_self1 zadd_commute)
   6.490  
   6.491  
   6.492  (* to do: differences, and all variations of addition rules
   6.493      as simplification rules for nat and int *)
   6.494  
   6.495  (* FIXME remove iff *)
   6.496 -lemma nat_gcd_dvd_prod [iff]: "gcd (m::nat) n dvd k * n"
   6.497 +lemma gcd_dvd_prod_nat [iff]: "gcd (m::nat) n dvd k * n"
   6.498    using mult_dvd_mono [of 1] by auto
   6.499  
   6.500  (* to do: add the three variations of these, and for ints? *)
   6.501 @@ -559,7 +559,7 @@
   6.502  apply(rule Max_eqI[THEN sym])
   6.503    apply (metis dvd.eq_iff finite_Collect_conjI finite_divisors_nat)
   6.504   apply simp
   6.505 - apply(metis Suc_diff_1 Suc_neq_Zero dvd_imp_le nat_gcd_greatest_iff nat_gcd_pos)
   6.506 + apply(metis Suc_diff_1 Suc_neq_Zero dvd_imp_le gcd_greatest_iff_nat gcd_pos_nat)
   6.507  apply simp
   6.508  done
   6.509  
   6.510 @@ -568,14 +568,14 @@
   6.511  apply(rule Max_eqI[THEN sym])
   6.512    apply (metis dvd.eq_iff finite_Collect_conjI finite_divisors_int)
   6.513   apply simp
   6.514 - apply (metis int_gcd_greatest_iff int_gcd_pos zdvd_imp_le)
   6.515 + apply (metis gcd_greatest_iff_int gcd_pos_int zdvd_imp_le)
   6.516  apply simp
   6.517  done
   6.518  
   6.519  
   6.520  subsection {* Coprimality *}
   6.521  
   6.522 -lemma nat_div_gcd_coprime:
   6.523 +lemma div_gcd_coprime_nat:
   6.524    assumes nz: "(a::nat) \<noteq> 0 \<or> b \<noteq> 0"
   6.525    shows "coprime (a div gcd a b) (b div gcd a b)"
   6.526  proof -
   6.527 @@ -593,34 +593,34 @@
   6.528    then have dvdgg':"?g * ?g' dvd a" "?g* ?g' dvd b"
   6.529      by (auto simp add: dvd_mult_div_cancel [OF dvdg(1)]
   6.530        dvd_mult_div_cancel [OF dvdg(2)] dvd_def)
   6.531 -  have "?g \<noteq> 0" using nz by (simp add: nat_gcd_zero)
   6.532 +  have "?g \<noteq> 0" using nz by (simp add: gcd_zero_nat)
   6.533    then have gp: "?g > 0" by arith
   6.534 -  from nat_gcd_greatest [OF dvdgg'] have "?g * ?g' dvd ?g" .
   6.535 +  from gcd_greatest_nat [OF dvdgg'] have "?g * ?g' dvd ?g" .
   6.536    with dvd_mult_cancel1 [OF gp] show "?g' = 1" by simp
   6.537  qed
   6.538  
   6.539 -lemma int_div_gcd_coprime:
   6.540 +lemma div_gcd_coprime_int:
   6.541    assumes nz: "(a::int) \<noteq> 0 \<or> b \<noteq> 0"
   6.542    shows "coprime (a div gcd a b) (b div gcd a b)"
   6.543 -apply (subst (1 2 3) int_gcd_abs)
   6.544 +apply (subst (1 2 3) gcd_abs_int)
   6.545  apply (subst (1 2) abs_div)
   6.546    apply simp
   6.547   apply simp
   6.548  apply(subst (1 2) abs_gcd_int)
   6.549 -apply (rule nat_div_gcd_coprime [transferred])
   6.550 -using nz apply (auto simp add: int_gcd_abs [symmetric])
   6.551 +apply (rule div_gcd_coprime_nat [transferred])
   6.552 +using nz apply (auto simp add: gcd_abs_int [symmetric])
   6.553  done
   6.554  
   6.555 -lemma nat_coprime: "coprime (a::nat) b \<longleftrightarrow> (\<forall>d. d dvd a \<and> d dvd b \<longleftrightarrow> d = 1)"
   6.556 -  using nat_gcd_unique[of 1 a b, simplified] by auto
   6.557 +lemma coprime_nat: "coprime (a::nat) b \<longleftrightarrow> (\<forall>d. d dvd a \<and> d dvd b \<longleftrightarrow> d = 1)"
   6.558 +  using gcd_unique_nat[of 1 a b, simplified] by auto
   6.559  
   6.560 -lemma nat_coprime_Suc_0:
   6.561 +lemma coprime_Suc_0_nat:
   6.562      "coprime (a::nat) b \<longleftrightarrow> (\<forall>d. d dvd a \<and> d dvd b \<longleftrightarrow> d = Suc 0)"
   6.563 -  using nat_coprime by (simp add: One_nat_def)
   6.564 +  using coprime_nat by (simp add: One_nat_def)
   6.565  
   6.566 -lemma int_coprime: "coprime (a::int) b \<longleftrightarrow>
   6.567 +lemma coprime_int: "coprime (a::int) b \<longleftrightarrow>
   6.568      (\<forall>d. d >= 0 \<and> d dvd a \<and> d dvd b \<longleftrightarrow> d = 1)"
   6.569 -  using int_gcd_unique [of 1 a b]
   6.570 +  using gcd_unique_int [of 1 a b]
   6.571    apply clarsimp
   6.572    apply (erule subst)
   6.573    apply (rule iffI)
   6.574 @@ -631,7 +631,7 @@
   6.575    apply force
   6.576  done
   6.577  
   6.578 -lemma nat_gcd_coprime:
   6.579 +lemma gcd_coprime_nat:
   6.580    assumes z: "gcd (a::nat) b \<noteq> 0" and a: "a = a' * gcd a b" and
   6.581      b: "b = b' * gcd a b"
   6.582    shows    "coprime a' b'"
   6.583 @@ -640,7 +640,7 @@
   6.584    apply (erule ssubst)
   6.585    apply (subgoal_tac "b' = b div gcd a b")
   6.586    apply (erule ssubst)
   6.587 -  apply (rule nat_div_gcd_coprime)
   6.588 +  apply (rule div_gcd_coprime_nat)
   6.589    using prems
   6.590    apply force
   6.591    apply (subst (1) b)
   6.592 @@ -649,7 +649,7 @@
   6.593    using z apply force
   6.594  done
   6.595  
   6.596 -lemma int_gcd_coprime:
   6.597 +lemma gcd_coprime_int:
   6.598    assumes z: "gcd (a::int) b \<noteq> 0" and a: "a = a' * gcd a b" and
   6.599      b: "b = b' * gcd a b"
   6.600    shows    "coprime a' b'"
   6.601 @@ -658,7 +658,7 @@
   6.602    apply (erule ssubst)
   6.603    apply (subgoal_tac "b' = b div gcd a b")
   6.604    apply (erule ssubst)
   6.605 -  apply (rule int_div_gcd_coprime)
   6.606 +  apply (rule div_gcd_coprime_int)
   6.607    using prems
   6.608    apply force
   6.609    apply (subst (1) b)
   6.610 @@ -667,117 +667,117 @@
   6.611    using z apply force
   6.612  done
   6.613  
   6.614 -lemma nat_coprime_mult: assumes da: "coprime (d::nat) a" and db: "coprime d b"
   6.615 +lemma coprime_mult_nat: assumes da: "coprime (d::nat) a" and db: "coprime d b"
   6.616      shows "coprime d (a * b)"
   6.617 -  apply (subst nat_gcd_commute)
   6.618 -  using da apply (subst nat_gcd_mult_cancel)
   6.619 -  apply (subst nat_gcd_commute, assumption)
   6.620 -  apply (subst nat_gcd_commute, rule db)
   6.621 +  apply (subst gcd_commute_nat)
   6.622 +  using da apply (subst gcd_mult_cancel_nat)
   6.623 +  apply (subst gcd_commute_nat, assumption)
   6.624 +  apply (subst gcd_commute_nat, rule db)
   6.625  done
   6.626  
   6.627 -lemma int_coprime_mult: assumes da: "coprime (d::int) a" and db: "coprime d b"
   6.628 +lemma coprime_mult_int: assumes da: "coprime (d::int) a" and db: "coprime d b"
   6.629      shows "coprime d (a * b)"
   6.630 -  apply (subst int_gcd_commute)
   6.631 -  using da apply (subst int_gcd_mult_cancel)
   6.632 -  apply (subst int_gcd_commute, assumption)
   6.633 -  apply (subst int_gcd_commute, rule db)
   6.634 +  apply (subst gcd_commute_int)
   6.635 +  using da apply (subst gcd_mult_cancel_int)
   6.636 +  apply (subst gcd_commute_int, assumption)
   6.637 +  apply (subst gcd_commute_int, rule db)
   6.638  done
   6.639  
   6.640 -lemma nat_coprime_lmult:
   6.641 +lemma coprime_lmult_nat:
   6.642    assumes dab: "coprime (d::nat) (a * b)" shows "coprime d a"
   6.643  proof -
   6.644    have "gcd d a dvd gcd d (a * b)"
   6.645 -    by (rule nat_gcd_greatest, auto)
   6.646 +    by (rule gcd_greatest_nat, auto)
   6.647    with dab show ?thesis
   6.648      by auto
   6.649  qed
   6.650  
   6.651 -lemma int_coprime_lmult:
   6.652 +lemma coprime_lmult_int:
   6.653    assumes "coprime (d::int) (a * b)" shows "coprime d a"
   6.654  proof -
   6.655    have "gcd d a dvd gcd d (a * b)"
   6.656 -    by (rule int_gcd_greatest, auto)
   6.657 +    by (rule gcd_greatest_int, auto)
   6.658    with assms show ?thesis
   6.659      by auto
   6.660  qed
   6.661  
   6.662 -lemma nat_coprime_rmult:
   6.663 +lemma coprime_rmult_nat:
   6.664    assumes "coprime (d::nat) (a * b)" shows "coprime d b"
   6.665  proof -
   6.666    have "gcd d b dvd gcd d (a * b)"
   6.667 -    by (rule nat_gcd_greatest, auto intro: dvd_mult)
   6.668 +    by (rule gcd_greatest_nat, auto intro: dvd_mult)
   6.669    with assms show ?thesis
   6.670      by auto
   6.671  qed
   6.672  
   6.673 -lemma int_coprime_rmult:
   6.674 +lemma coprime_rmult_int:
   6.675    assumes dab: "coprime (d::int) (a * b)" shows "coprime d b"
   6.676  proof -
   6.677    have "gcd d b dvd gcd d (a * b)"
   6.678 -    by (rule int_gcd_greatest, auto intro: dvd_mult)
   6.679 +    by (rule gcd_greatest_int, auto intro: dvd_mult)
   6.680    with dab show ?thesis
   6.681      by auto
   6.682  qed
   6.683  
   6.684 -lemma nat_coprime_mul_eq: "coprime (d::nat) (a * b) \<longleftrightarrow>
   6.685 +lemma coprime_mul_eq_nat: "coprime (d::nat) (a * b) \<longleftrightarrow>
   6.686      coprime d a \<and>  coprime d b"
   6.687 -  using nat_coprime_rmult[of d a b] nat_coprime_lmult[of d a b]
   6.688 -    nat_coprime_mult[of d a b]
   6.689 +  using coprime_rmult_nat[of d a b] coprime_lmult_nat[of d a b]
   6.690 +    coprime_mult_nat[of d a b]
   6.691    by blast
   6.692  
   6.693 -lemma int_coprime_mul_eq: "coprime (d::int) (a * b) \<longleftrightarrow>
   6.694 +lemma coprime_mul_eq_int: "coprime (d::int) (a * b) \<longleftrightarrow>
   6.695      coprime d a \<and>  coprime d b"
   6.696 -  using int_coprime_rmult[of d a b] int_coprime_lmult[of d a b]
   6.697 -    int_coprime_mult[of d a b]
   6.698 +  using coprime_rmult_int[of d a b] coprime_lmult_int[of d a b]
   6.699 +    coprime_mult_int[of d a b]
   6.700    by blast
   6.701  
   6.702 -lemma nat_gcd_coprime_exists:
   6.703 +lemma gcd_coprime_exists_nat:
   6.704      assumes nz: "gcd (a::nat) b \<noteq> 0"
   6.705      shows "\<exists>a' b'. a = a' * gcd a b \<and> b = b' * gcd a b \<and> coprime a' b'"
   6.706    apply (rule_tac x = "a div gcd a b" in exI)
   6.707    apply (rule_tac x = "b div gcd a b" in exI)
   6.708 -  using nz apply (auto simp add: nat_div_gcd_coprime dvd_div_mult)
   6.709 +  using nz apply (auto simp add: div_gcd_coprime_nat dvd_div_mult)
   6.710  done
   6.711  
   6.712 -lemma int_gcd_coprime_exists:
   6.713 +lemma gcd_coprime_exists_int:
   6.714      assumes nz: "gcd (a::int) b \<noteq> 0"
   6.715      shows "\<exists>a' b'. a = a' * gcd a b \<and> b = b' * gcd a b \<and> coprime a' b'"
   6.716    apply (rule_tac x = "a div gcd a b" in exI)
   6.717    apply (rule_tac x = "b div gcd a b" in exI)
   6.718 -  using nz apply (auto simp add: int_div_gcd_coprime dvd_div_mult_self)
   6.719 +  using nz apply (auto simp add: div_gcd_coprime_int dvd_div_mult_self)
   6.720  done
   6.721  
   6.722 -lemma nat_coprime_exp: "coprime (d::nat) a \<Longrightarrow> coprime d (a^n)"
   6.723 -  by (induct n, simp_all add: nat_coprime_mult)
   6.724 +lemma coprime_exp_nat: "coprime (d::nat) a \<Longrightarrow> coprime d (a^n)"
   6.725 +  by (induct n, simp_all add: coprime_mult_nat)
   6.726  
   6.727 -lemma int_coprime_exp: "coprime (d::int) a \<Longrightarrow> coprime d (a^n)"
   6.728 -  by (induct n, simp_all add: int_coprime_mult)
   6.729 +lemma coprime_exp_int: "coprime (d::int) a \<Longrightarrow> coprime d (a^n)"
   6.730 +  by (induct n, simp_all add: coprime_mult_int)
   6.731  
   6.732 -lemma nat_coprime_exp2 [intro]: "coprime (a::nat) b \<Longrightarrow> coprime (a^n) (b^m)"
   6.733 -  apply (rule nat_coprime_exp)
   6.734 -  apply (subst nat_gcd_commute)
   6.735 -  apply (rule nat_coprime_exp)
   6.736 -  apply (subst nat_gcd_commute, assumption)
   6.737 +lemma coprime_exp2_nat [intro]: "coprime (a::nat) b \<Longrightarrow> coprime (a^n) (b^m)"
   6.738 +  apply (rule coprime_exp_nat)
   6.739 +  apply (subst gcd_commute_nat)
   6.740 +  apply (rule coprime_exp_nat)
   6.741 +  apply (subst gcd_commute_nat, assumption)
   6.742  done
   6.743  
   6.744 -lemma int_coprime_exp2 [intro]: "coprime (a::int) b \<Longrightarrow> coprime (a^n) (b^m)"
   6.745 -  apply (rule int_coprime_exp)
   6.746 -  apply (subst int_gcd_commute)
   6.747 -  apply (rule int_coprime_exp)
   6.748 -  apply (subst int_gcd_commute, assumption)
   6.749 +lemma coprime_exp2_int [intro]: "coprime (a::int) b \<Longrightarrow> coprime (a^n) (b^m)"
   6.750 +  apply (rule coprime_exp_int)
   6.751 +  apply (subst gcd_commute_int)
   6.752 +  apply (rule coprime_exp_int)
   6.753 +  apply (subst gcd_commute_int, assumption)
   6.754  done
   6.755  
   6.756 -lemma nat_gcd_exp: "gcd ((a::nat)^n) (b^n) = (gcd a b)^n"
   6.757 +lemma gcd_exp_nat: "gcd ((a::nat)^n) (b^n) = (gcd a b)^n"
   6.758  proof (cases)
   6.759    assume "a = 0 & b = 0"
   6.760    thus ?thesis by simp
   6.761    next assume "~(a = 0 & b = 0)"
   6.762    hence "coprime ((a div gcd a b)^n) ((b div gcd a b)^n)"
   6.763 -    by (auto simp:nat_div_gcd_coprime)
   6.764 +    by (auto simp:div_gcd_coprime_nat)
   6.765    hence "gcd ((a div gcd a b)^n * (gcd a b)^n)
   6.766        ((b div gcd a b)^n * (gcd a b)^n) = (gcd a b)^n"
   6.767      apply (subst (1 2) mult_commute)
   6.768 -    apply (subst nat_gcd_mult_distrib [symmetric])
   6.769 +    apply (subst gcd_mult_distrib_nat [symmetric])
   6.770      apply simp
   6.771      done
   6.772    also have "(a div gcd a b)^n * (gcd a b)^n = a^n"
   6.773 @@ -797,29 +797,29 @@
   6.774    finally show ?thesis .
   6.775  qed
   6.776  
   6.777 -lemma int_gcd_exp: "gcd ((a::int)^n) (b^n) = (gcd a b)^n"
   6.778 -  apply (subst (1 2) int_gcd_abs)
   6.779 +lemma gcd_exp_int: "gcd ((a::int)^n) (b^n) = (gcd a b)^n"
   6.780 +  apply (subst (1 2) gcd_abs_int)
   6.781    apply (subst (1 2) power_abs)
   6.782 -  apply (rule nat_gcd_exp [where n = n, transferred])
   6.783 +  apply (rule gcd_exp_nat [where n = n, transferred])
   6.784    apply auto
   6.785  done
   6.786  
   6.787 -lemma nat_coprime_divprod: "(d::nat) dvd a * b  \<Longrightarrow> coprime d a \<Longrightarrow> d dvd b"
   6.788 -  using nat_coprime_dvd_mult_iff[of d a b]
   6.789 +lemma coprime_divprod_nat: "(d::nat) dvd a * b  \<Longrightarrow> coprime d a \<Longrightarrow> d dvd b"
   6.790 +  using coprime_dvd_mult_iff_nat[of d a b]
   6.791    by (auto simp add: mult_commute)
   6.792  
   6.793 -lemma int_coprime_divprod: "(d::int) dvd a * b  \<Longrightarrow> coprime d a \<Longrightarrow> d dvd b"
   6.794 -  using int_coprime_dvd_mult_iff[of d a b]
   6.795 +lemma coprime_divprod_int: "(d::int) dvd a * b  \<Longrightarrow> coprime d a \<Longrightarrow> d dvd b"
   6.796 +  using coprime_dvd_mult_iff_int[of d a b]
   6.797    by (auto simp add: mult_commute)
   6.798  
   6.799 -lemma nat_division_decomp: assumes dc: "(a::nat) dvd b * c"
   6.800 +lemma division_decomp_nat: assumes dc: "(a::nat) dvd b * c"
   6.801    shows "\<exists>b' c'. a = b' * c' \<and> b' dvd b \<and> c' dvd c"
   6.802  proof-
   6.803    let ?g = "gcd a b"
   6.804    {assume "?g = 0" with dc have ?thesis by auto}
   6.805    moreover
   6.806    {assume z: "?g \<noteq> 0"
   6.807 -    from nat_gcd_coprime_exists[OF z]
   6.808 +    from gcd_coprime_exists_nat[OF z]
   6.809      obtain a' b' where ab': "a = a' * ?g" "b = b' * ?g" "coprime a' b'"
   6.810        by blast
   6.811      have thb: "?g dvd b" by auto
   6.812 @@ -828,21 +828,21 @@
   6.813      from dc ab'(1,2) have "a'*?g dvd (b'*?g) *c" by auto
   6.814      hence "?g*a' dvd ?g * (b' * c)" by (simp add: mult_assoc)
   6.815      with z have th_1: "a' dvd b' * c" by auto
   6.816 -    from nat_coprime_dvd_mult[OF ab'(3)] th_1
   6.817 +    from coprime_dvd_mult_nat[OF ab'(3)] th_1
   6.818      have thc: "a' dvd c" by (subst (asm) mult_commute, blast)
   6.819      from ab' have "a = ?g*a'" by algebra
   6.820      with thb thc have ?thesis by blast }
   6.821    ultimately show ?thesis by blast
   6.822  qed
   6.823  
   6.824 -lemma int_division_decomp: assumes dc: "(a::int) dvd b * c"
   6.825 +lemma division_decomp_int: assumes dc: "(a::int) dvd b * c"
   6.826    shows "\<exists>b' c'. a = b' * c' \<and> b' dvd b \<and> c' dvd c"
   6.827  proof-
   6.828    let ?g = "gcd a b"
   6.829    {assume "?g = 0" with dc have ?thesis by auto}
   6.830    moreover
   6.831    {assume z: "?g \<noteq> 0"
   6.832 -    from int_gcd_coprime_exists[OF z]
   6.833 +    from gcd_coprime_exists_int[OF z]
   6.834      obtain a' b' where ab': "a = a' * ?g" "b = b' * ?g" "coprime a' b'"
   6.835        by blast
   6.836      have thb: "?g dvd b" by auto
   6.837 @@ -852,14 +852,14 @@
   6.838      from dc ab'(1,2) have "a'*?g dvd (b'*?g) *c" by auto
   6.839      hence "?g*a' dvd ?g * (b' * c)" by (simp add: mult_assoc)
   6.840      with z have th_1: "a' dvd b' * c" by auto
   6.841 -    from int_coprime_dvd_mult[OF ab'(3)] th_1
   6.842 +    from coprime_dvd_mult_int[OF ab'(3)] th_1
   6.843      have thc: "a' dvd c" by (subst (asm) mult_commute, blast)
   6.844      from ab' have "a = ?g*a'" by algebra
   6.845      with thb thc have ?thesis by blast }
   6.846    ultimately show ?thesis by blast
   6.847  qed
   6.848  
   6.849 -lemma nat_pow_divides_pow:
   6.850 +lemma pow_divides_pow_nat:
   6.851    assumes ab: "(a::nat) ^ n dvd b ^n" and n:"n \<noteq> 0"
   6.852    shows "a dvd b"
   6.853  proof-
   6.854 @@ -869,7 +869,7 @@
   6.855    moreover
   6.856    {assume z: "?g \<noteq> 0"
   6.857      hence zn: "?g ^ n \<noteq> 0" using n by (simp add: neq0_conv)
   6.858 -    from nat_gcd_coprime_exists[OF z]
   6.859 +    from gcd_coprime_exists_nat[OF z]
   6.860      obtain a' b' where ab': "a = a' * ?g" "b = b' * ?g" "coprime a' b'"
   6.861        by blast
   6.862      from ab have "(a' * ?g) ^ n dvd (b' * ?g)^n"
   6.863 @@ -880,14 +880,14 @@
   6.864      have "a' dvd a'^n" by (simp add: m)
   6.865      with th0 have "a' dvd b'^n" using dvd_trans[of a' "a'^n" "b'^n"] by simp
   6.866      hence th1: "a' dvd b'^m * b'" by (simp add: m mult_commute)
   6.867 -    from nat_coprime_dvd_mult[OF nat_coprime_exp [OF ab'(3), of m]] th1
   6.868 +    from coprime_dvd_mult_nat[OF coprime_exp_nat [OF ab'(3), of m]] th1
   6.869      have "a' dvd b'" by (subst (asm) mult_commute, blast)
   6.870      hence "a'*?g dvd b'*?g" by simp
   6.871      with ab'(1,2)  have ?thesis by simp }
   6.872    ultimately show ?thesis by blast
   6.873  qed
   6.874  
   6.875 -lemma int_pow_divides_pow:
   6.876 +lemma pow_divides_pow_int:
   6.877    assumes ab: "(a::int) ^ n dvd b ^n" and n:"n \<noteq> 0"
   6.878    shows "a dvd b"
   6.879  proof-
   6.880 @@ -897,7 +897,7 @@
   6.881    moreover
   6.882    {assume z: "?g \<noteq> 0"
   6.883      hence zn: "?g ^ n \<noteq> 0" using n by (simp add: neq0_conv)
   6.884 -    from int_gcd_coprime_exists[OF z]
   6.885 +    from gcd_coprime_exists_int[OF z]
   6.886      obtain a' b' where ab': "a = a' * ?g" "b = b' * ?g" "coprime a' b'"
   6.887        by blast
   6.888      from ab have "(a' * ?g) ^ n dvd (b' * ?g)^n"
   6.889 @@ -909,7 +909,7 @@
   6.890      with th0 have "a' dvd b'^n"
   6.891        using dvd_trans[of a' "a'^n" "b'^n"] by simp
   6.892      hence th1: "a' dvd b'^m * b'" by (simp add: m mult_commute)
   6.893 -    from int_coprime_dvd_mult[OF int_coprime_exp [OF ab'(3), of m]] th1
   6.894 +    from coprime_dvd_mult_int[OF coprime_exp_int [OF ab'(3), of m]] th1
   6.895      have "a' dvd b'" by (subst (asm) mult_commute, blast)
   6.896      hence "a'*?g dvd b'*?g" by simp
   6.897      with ab'(1,2)  have ?thesis by simp }
   6.898 @@ -917,76 +917,76 @@
   6.899  qed
   6.900  
   6.901  (* FIXME move to Divides(?) *)
   6.902 -lemma nat_pow_divides_eq [simp]: "n ~= 0 \<Longrightarrow> ((a::nat)^n dvd b^n) = (a dvd b)"
   6.903 -  by (auto intro: nat_pow_divides_pow dvd_power_same)
   6.904 +lemma pow_divides_eq_nat [simp]: "n ~= 0 \<Longrightarrow> ((a::nat)^n dvd b^n) = (a dvd b)"
   6.905 +  by (auto intro: pow_divides_pow_nat dvd_power_same)
   6.906  
   6.907 -lemma int_pow_divides_eq [simp]: "n ~= 0 \<Longrightarrow> ((a::int)^n dvd b^n) = (a dvd b)"
   6.908 -  by (auto intro: int_pow_divides_pow dvd_power_same)
   6.909 +lemma pow_divides_eq_int [simp]: "n ~= 0 \<Longrightarrow> ((a::int)^n dvd b^n) = (a dvd b)"
   6.910 +  by (auto intro: pow_divides_pow_int dvd_power_same)
   6.911  
   6.912 -lemma nat_divides_mult:
   6.913 +lemma divides_mult_nat:
   6.914    assumes mr: "(m::nat) dvd r" and nr: "n dvd r" and mn:"coprime m n"
   6.915    shows "m * n dvd r"
   6.916  proof-
   6.917    from mr nr obtain m' n' where m': "r = m*m'" and n': "r = n*n'"
   6.918      unfolding dvd_def by blast
   6.919    from mr n' have "m dvd n'*n" by (simp add: mult_commute)
   6.920 -  hence "m dvd n'" using nat_coprime_dvd_mult_iff[OF mn] by simp
   6.921 +  hence "m dvd n'" using coprime_dvd_mult_iff_nat[OF mn] by simp
   6.922    then obtain k where k: "n' = m*k" unfolding dvd_def by blast
   6.923    from n' k show ?thesis unfolding dvd_def by auto
   6.924  qed
   6.925  
   6.926 -lemma int_divides_mult:
   6.927 +lemma divides_mult_int:
   6.928    assumes mr: "(m::int) dvd r" and nr: "n dvd r" and mn:"coprime m n"
   6.929    shows "m * n dvd r"
   6.930  proof-
   6.931    from mr nr obtain m' n' where m': "r = m*m'" and n': "r = n*n'"
   6.932      unfolding dvd_def by blast
   6.933    from mr n' have "m dvd n'*n" by (simp add: mult_commute)
   6.934 -  hence "m dvd n'" using int_coprime_dvd_mult_iff[OF mn] by simp
   6.935 +  hence "m dvd n'" using coprime_dvd_mult_iff_int[OF mn] by simp
   6.936    then obtain k where k: "n' = m*k" unfolding dvd_def by blast
   6.937    from n' k show ?thesis unfolding dvd_def by auto
   6.938  qed
   6.939  
   6.940 -lemma nat_coprime_plus_one [simp]: "coprime ((n::nat) + 1) n"
   6.941 +lemma coprime_plus_one_nat [simp]: "coprime ((n::nat) + 1) n"
   6.942    apply (subgoal_tac "gcd (n + 1) n dvd (n + 1 - n)")
   6.943    apply force
   6.944 -  apply (rule nat_dvd_diff)
   6.945 +  apply (rule dvd_diff_nat)
   6.946    apply auto
   6.947  done
   6.948  
   6.949 -lemma nat_coprime_Suc [simp]: "coprime (Suc n) n"
   6.950 -  using nat_coprime_plus_one by (simp add: One_nat_def)
   6.951 +lemma coprime_Suc_nat [simp]: "coprime (Suc n) n"
   6.952 +  using coprime_plus_one_nat by (simp add: One_nat_def)
   6.953  
   6.954 -lemma int_coprime_plus_one [simp]: "coprime ((n::int) + 1) n"
   6.955 +lemma coprime_plus_one_int [simp]: "coprime ((n::int) + 1) n"
   6.956    apply (subgoal_tac "gcd (n + 1) n dvd (n + 1 - n)")
   6.957    apply force
   6.958    apply (rule dvd_diff)
   6.959    apply auto
   6.960  done
   6.961  
   6.962 -lemma nat_coprime_minus_one: "(n::nat) \<noteq> 0 \<Longrightarrow> coprime (n - 1) n"
   6.963 -  using nat_coprime_plus_one [of "n - 1"]
   6.964 -    nat_gcd_commute [of "n - 1" n] by auto
   6.965 +lemma coprime_minus_one_nat: "(n::nat) \<noteq> 0 \<Longrightarrow> coprime (n - 1) n"
   6.966 +  using coprime_plus_one_nat [of "n - 1"]
   6.967 +    gcd_commute_nat [of "n - 1" n] by auto
   6.968  
   6.969 -lemma int_coprime_minus_one: "coprime ((n::int) - 1) n"
   6.970 -  using int_coprime_plus_one [of "n - 1"]
   6.971 -    int_gcd_commute [of "n - 1" n] by auto
   6.972 +lemma coprime_minus_one_int: "coprime ((n::int) - 1) n"
   6.973 +  using coprime_plus_one_int [of "n - 1"]
   6.974 +    gcd_commute_int [of "n - 1" n] by auto
   6.975  
   6.976 -lemma nat_setprod_coprime [rule_format]:
   6.977 +lemma setprod_coprime_nat [rule_format]:
   6.978      "(ALL i: A. coprime (f i) (x::nat)) --> coprime (PROD i:A. f i) x"
   6.979    apply (case_tac "finite A")
   6.980    apply (induct set: finite)
   6.981 -  apply (auto simp add: nat_gcd_mult_cancel)
   6.982 +  apply (auto simp add: gcd_mult_cancel_nat)
   6.983  done
   6.984  
   6.985 -lemma int_setprod_coprime [rule_format]:
   6.986 +lemma setprod_coprime_int [rule_format]:
   6.987      "(ALL i: A. coprime (f i) (x::int)) --> coprime (PROD i:A. f i) x"
   6.988    apply (case_tac "finite A")
   6.989    apply (induct set: finite)
   6.990 -  apply (auto simp add: int_gcd_mult_cancel)
   6.991 +  apply (auto simp add: gcd_mult_cancel_int)
   6.992  done
   6.993  
   6.994 -lemma nat_prime_odd: "prime (p::nat) \<Longrightarrow> p > 2 \<Longrightarrow> odd p"
   6.995 +lemma prime_odd_nat: "prime (p::nat) \<Longrightarrow> p > 2 \<Longrightarrow> odd p"
   6.996    unfolding prime_nat_def
   6.997    apply (subst even_mult_two_ex)
   6.998    apply clarify
   6.999 @@ -994,41 +994,41 @@
  6.1000    apply auto
  6.1001  done
  6.1002  
  6.1003 -lemma int_prime_odd: "prime (p::int) \<Longrightarrow> p > 2 \<Longrightarrow> odd p"
  6.1004 +lemma prime_odd_int: "prime (p::int) \<Longrightarrow> p > 2 \<Longrightarrow> odd p"
  6.1005    unfolding prime_int_def
  6.1006 -  apply (frule nat_prime_odd)
  6.1007 +  apply (frule prime_odd_nat)
  6.1008    apply (auto simp add: even_nat_def)
  6.1009  done
  6.1010  
  6.1011 -lemma nat_coprime_common_divisor: "coprime (a::nat) b \<Longrightarrow> x dvd a \<Longrightarrow>
  6.1012 +lemma coprime_common_divisor_nat: "coprime (a::nat) b \<Longrightarrow> x dvd a \<Longrightarrow>
  6.1013      x dvd b \<Longrightarrow> x = 1"
  6.1014    apply (subgoal_tac "x dvd gcd a b")
  6.1015    apply simp
  6.1016 -  apply (erule (1) nat_gcd_greatest)
  6.1017 +  apply (erule (1) gcd_greatest_nat)
  6.1018  done
  6.1019  
  6.1020 -lemma int_coprime_common_divisor: "coprime (a::int) b \<Longrightarrow> x dvd a \<Longrightarrow>
  6.1021 +lemma coprime_common_divisor_int: "coprime (a::int) b \<Longrightarrow> x dvd a \<Longrightarrow>
  6.1022      x dvd b \<Longrightarrow> abs x = 1"
  6.1023    apply (subgoal_tac "x dvd gcd a b")
  6.1024    apply simp
  6.1025 -  apply (erule (1) int_gcd_greatest)
  6.1026 +  apply (erule (1) gcd_greatest_int)
  6.1027  done
  6.1028  
  6.1029 -lemma nat_coprime_divisors: "(d::int) dvd a \<Longrightarrow> e dvd b \<Longrightarrow> coprime a b \<Longrightarrow>
  6.1030 +lemma coprime_divisors_nat: "(d::int) dvd a \<Longrightarrow> e dvd b \<Longrightarrow> coprime a b \<Longrightarrow>
  6.1031      coprime d e"
  6.1032    apply (auto simp add: dvd_def)
  6.1033 -  apply (frule int_coprime_lmult)
  6.1034 -  apply (subst int_gcd_commute)
  6.1035 -  apply (subst (asm) (2) int_gcd_commute)
  6.1036 -  apply (erule int_coprime_lmult)
  6.1037 +  apply (frule coprime_lmult_int)
  6.1038 +  apply (subst gcd_commute_int)
  6.1039 +  apply (subst (asm) (2) gcd_commute_int)
  6.1040 +  apply (erule coprime_lmult_int)
  6.1041  done
  6.1042  
  6.1043 -lemma nat_invertible_coprime: "(x::nat) * y mod m = 1 \<Longrightarrow> coprime x m"
  6.1044 -apply (metis nat_coprime_lmult nat_gcd_1 nat_gcd_commute nat_gcd_red)
  6.1045 +lemma invertible_coprime_nat: "(x::nat) * y mod m = 1 \<Longrightarrow> coprime x m"
  6.1046 +apply (metis coprime_lmult_nat gcd_1_nat gcd_commute_nat gcd_red_nat)
  6.1047  done
  6.1048  
  6.1049 -lemma int_invertible_coprime: "(x::int) * y mod m = 1 \<Longrightarrow> coprime x m"
  6.1050 -apply (metis int_coprime_lmult int_gcd_1 int_gcd_commute int_gcd_red)
  6.1051 +lemma invertible_coprime_int: "(x::int) * y mod m = 1 \<Longrightarrow> coprime x m"
  6.1052 +apply (metis coprime_lmult_int gcd_1_int gcd_commute_int gcd_red_int)
  6.1053  done
  6.1054  
  6.1055  
  6.1056 @@ -1054,7 +1054,7 @@
  6.1057  
  6.1058  lemma bezw_aux [rule_format]:
  6.1059      "fst (bezw x y) * int x + snd (bezw x y) * int y = int (gcd x y)"
  6.1060 -proof (induct x y rule: nat_gcd_induct)
  6.1061 +proof (induct x y rule: gcd_nat_induct)
  6.1062    fix m :: nat
  6.1063    show "fst (bezw m 0) * int m + snd (bezw m 0) * int 0 = int (gcd m 0)"
  6.1064      by auto
  6.1065 @@ -1064,7 +1064,7 @@
  6.1066          snd (bezw n (m mod n)) * int (m mod n) =
  6.1067          int (gcd n (m mod n))"
  6.1068      thus "fst (bezw m n) * int m + snd (bezw m n) * int n = int (gcd m n)"
  6.1069 -      apply (simp add: bezw_non_0 nat_gcd_non_0)
  6.1070 +      apply (simp add: bezw_non_0 gcd_non_0_nat)
  6.1071        apply (erule subst)
  6.1072        apply (simp add: ring_simps)
  6.1073        apply (subst mod_div_equality [of m n, symmetric])
  6.1074 @@ -1075,7 +1075,7 @@
  6.1075        done
  6.1076  qed
  6.1077  
  6.1078 -lemma int_bezout:
  6.1079 +lemma bezout_int:
  6.1080    fixes x y
  6.1081    shows "EX u v. u * (x::int) + v * y = gcd x y"
  6.1082  proof -
  6.1083 @@ -1098,7 +1098,7 @@
  6.1084      apply auto
  6.1085      apply (rule_tac x = u in exI)
  6.1086      apply (rule_tac x = "-v" in exI)
  6.1087 -    apply (subst int_gcd_neg2 [symmetric])
  6.1088 +    apply (subst gcd_neg2_int [symmetric])
  6.1089      apply auto
  6.1090      done
  6.1091    moreover have "x <= 0 \<Longrightarrow> y >= 0 \<Longrightarrow> ?thesis"
  6.1092 @@ -1106,7 +1106,7 @@
  6.1093      apply auto
  6.1094      apply (rule_tac x = "-u" in exI)
  6.1095      apply (rule_tac x = v in exI)
  6.1096 -    apply (subst int_gcd_neg1 [symmetric])
  6.1097 +    apply (subst gcd_neg1_int [symmetric])
  6.1098      apply auto
  6.1099      done
  6.1100    moreover have "x <= 0 \<Longrightarrow> y <= 0 \<Longrightarrow> ?thesis"
  6.1101 @@ -1114,8 +1114,8 @@
  6.1102      apply auto
  6.1103      apply (rule_tac x = "-u" in exI)
  6.1104      apply (rule_tac x = "-v" in exI)
  6.1105 -    apply (subst int_gcd_neg1 [symmetric])
  6.1106 -    apply (subst int_gcd_neg2 [symmetric])
  6.1107 +    apply (subst gcd_neg1_int [symmetric])
  6.1108 +    apply (subst gcd_neg2_int [symmetric])
  6.1109      apply auto
  6.1110      done
  6.1111    ultimately show ?thesis by blast
  6.1112 @@ -1160,7 +1160,7 @@
  6.1113  ultimately  show "P a b" by blast
  6.1114  qed
  6.1115  
  6.1116 -lemma nat_bezout_lemma:
  6.1117 +lemma bezout_lemma_nat:
  6.1118    assumes ex: "\<exists>(d::nat) x y. d dvd a \<and> d dvd b \<and>
  6.1119      (a * x = b * y + d \<or> b * x = a * y + d)"
  6.1120    shows "\<exists>d x y. d dvd a \<and> d dvd a + b \<and>
  6.1121 @@ -1177,7 +1177,7 @@
  6.1122    apply algebra
  6.1123  done
  6.1124  
  6.1125 -lemma nat_bezout_add: "\<exists>(d::nat) x y. d dvd a \<and> d dvd b \<and>
  6.1126 +lemma bezout_add_nat: "\<exists>(d::nat) x y. d dvd a \<and> d dvd b \<and>
  6.1127      (a * x = b * y + d \<or> b * x = a * y + d)"
  6.1128    apply(induct a b rule: ind_euclid)
  6.1129    apply blast
  6.1130 @@ -1194,9 +1194,9 @@
  6.1131    apply algebra
  6.1132  done
  6.1133  
  6.1134 -lemma nat_bezout1: "\<exists>(d::nat) x y. d dvd a \<and> d dvd b \<and>
  6.1135 +lemma bezout1_nat: "\<exists>(d::nat) x y. d dvd a \<and> d dvd b \<and>
  6.1136      (a * x - b * y = d \<or> b * x - a * y = d)"
  6.1137 -  using nat_bezout_add[of a b]
  6.1138 +  using bezout_add_nat[of a b]
  6.1139    apply clarsimp
  6.1140    apply (rule_tac x="d" in exI, simp)
  6.1141    apply (rule_tac x="x" in exI)
  6.1142 @@ -1204,11 +1204,11 @@
  6.1143    apply auto
  6.1144  done
  6.1145  
  6.1146 -lemma nat_bezout_add_strong: assumes nz: "a \<noteq> (0::nat)"
  6.1147 +lemma bezout_add_strong_nat: assumes nz: "a \<noteq> (0::nat)"
  6.1148    shows "\<exists>d x y. d dvd a \<and> d dvd b \<and> a * x = b * y + d"
  6.1149  proof-
  6.1150   from nz have ap: "a > 0" by simp
  6.1151 - from nat_bezout_add[of a b]
  6.1152 + from bezout_add_nat[of a b]
  6.1153   have "(\<exists>d x y. d dvd a \<and> d dvd b \<and> a * x = b * y + d) \<or>
  6.1154     (\<exists>d x y. d dvd a \<and> d dvd b \<and> b * x = a * y + d)" by blast
  6.1155   moreover
  6.1156 @@ -1258,11 +1258,11 @@
  6.1157   ultimately show ?thesis by blast
  6.1158  qed
  6.1159  
  6.1160 -lemma nat_bezout: assumes a: "(a::nat) \<noteq> 0"
  6.1161 +lemma bezout_nat: assumes a: "(a::nat) \<noteq> 0"
  6.1162    shows "\<exists>x y. a * x = b * y + gcd a b"
  6.1163  proof-
  6.1164    let ?g = "gcd a b"
  6.1165 -  from nat_bezout_add_strong[OF a, of b]
  6.1166 +  from bezout_add_strong_nat[OF a, of b]
  6.1167    obtain d x y where d: "d dvd a" "d dvd b" "a * x = b * y + d" by blast
  6.1168    from d(1,2) have "d dvd ?g" by simp
  6.1169    then obtain k where k: "?g = d*k" unfolding dvd_def by blast
  6.1170 @@ -1274,99 +1274,99 @@
  6.1171  
  6.1172  subsection {* LCM *}
  6.1173  
  6.1174 -lemma int_lcm_altdef: "lcm (a::int) b = (abs a) * (abs b) div gcd a b"
  6.1175 +lemma lcm_altdef_int: "lcm (a::int) b = (abs a) * (abs b) div gcd a b"
  6.1176    by (simp add: lcm_int_def lcm_nat_def zdiv_int
  6.1177      zmult_int [symmetric] gcd_int_def)
  6.1178  
  6.1179 -lemma nat_prod_gcd_lcm: "(m::nat) * n = gcd m n * lcm m n"
  6.1180 +lemma prod_gcd_lcm_nat: "(m::nat) * n = gcd m n * lcm m n"
  6.1181    unfolding lcm_nat_def
  6.1182 -  by (simp add: dvd_mult_div_cancel [OF nat_gcd_dvd_prod])
  6.1183 +  by (simp add: dvd_mult_div_cancel [OF gcd_dvd_prod_nat])
  6.1184  
  6.1185 -lemma int_prod_gcd_lcm: "abs(m::int) * abs n = gcd m n * lcm m n"
  6.1186 +lemma prod_gcd_lcm_int: "abs(m::int) * abs n = gcd m n * lcm m n"
  6.1187    unfolding lcm_int_def gcd_int_def
  6.1188    apply (subst int_mult [symmetric])
  6.1189 -  apply (subst nat_prod_gcd_lcm [symmetric])
  6.1190 +  apply (subst prod_gcd_lcm_nat [symmetric])
  6.1191    apply (subst nat_abs_mult_distrib [symmetric])
  6.1192    apply (simp, simp add: abs_mult)
  6.1193  done
  6.1194  
  6.1195 -lemma nat_lcm_0 [simp]: "lcm (m::nat) 0 = 0"
  6.1196 +lemma lcm_0_nat [simp]: "lcm (m::nat) 0 = 0"
  6.1197    unfolding lcm_nat_def by simp
  6.1198  
  6.1199 -lemma int_lcm_0 [simp]: "lcm (m::int) 0 = 0"
  6.1200 +lemma lcm_0_int [simp]: "lcm (m::int) 0 = 0"
  6.1201    unfolding lcm_int_def by simp
  6.1202  
  6.1203 -lemma nat_lcm_0_left [simp]: "lcm (0::nat) n = 0"
  6.1204 +lemma lcm_0_left_nat [simp]: "lcm (0::nat) n = 0"
  6.1205    unfolding lcm_nat_def by simp
  6.1206  
  6.1207 -lemma int_lcm_0_left [simp]: "lcm (0::int) n = 0"
  6.1208 +lemma lcm_0_left_int [simp]: "lcm (0::int) n = 0"
  6.1209    unfolding lcm_int_def by simp
  6.1210  
  6.1211 -lemma nat_lcm_commute: "lcm (m::nat) n = lcm n m"
  6.1212 -  unfolding lcm_nat_def by (simp add: nat_gcd_commute ring_simps)
  6.1213 +lemma lcm_commute_nat: "lcm (m::nat) n = lcm n m"
  6.1214 +  unfolding lcm_nat_def by (simp add: gcd_commute_nat ring_simps)
  6.1215  
  6.1216 -lemma int_lcm_commute: "lcm (m::int) n = lcm n m"
  6.1217 -  unfolding lcm_int_def by (subst nat_lcm_commute, rule refl)
  6.1218 +lemma lcm_commute_int: "lcm (m::int) n = lcm n m"
  6.1219 +  unfolding lcm_int_def by (subst lcm_commute_nat, rule refl)
  6.1220  
  6.1221  
  6.1222 -lemma nat_lcm_pos:
  6.1223 +lemma lcm_pos_nat:
  6.1224    "(m::nat) > 0 \<Longrightarrow> n>0 \<Longrightarrow> lcm m n > 0"
  6.1225 -by (metis gr0I mult_is_0 nat_prod_gcd_lcm)
  6.1226 +by (metis gr0I mult_is_0 prod_gcd_lcm_nat)
  6.1227  
  6.1228 -lemma int_lcm_pos:
  6.1229 +lemma lcm_pos_int:
  6.1230    "(m::int) ~= 0 \<Longrightarrow> n ~= 0 \<Longrightarrow> lcm m n > 0"
  6.1231 -  apply (subst int_lcm_abs)
  6.1232 -  apply (rule nat_lcm_pos [transferred])
  6.1233 +  apply (subst lcm_abs_int)
  6.1234 +  apply (rule lcm_pos_nat [transferred])
  6.1235    apply auto
  6.1236  done
  6.1237  
  6.1238 -lemma nat_dvd_pos:
  6.1239 +lemma dvd_pos_nat:
  6.1240    fixes n m :: nat
  6.1241    assumes "n > 0" and "m dvd n"
  6.1242    shows "m > 0"
  6.1243  using assms by (cases m) auto
  6.1244  
  6.1245 -lemma nat_lcm_least:
  6.1246 +lemma lcm_least_nat:
  6.1247    assumes "(m::nat) dvd k" and "n dvd k"
  6.1248    shows "lcm m n dvd k"
  6.1249  proof (cases k)
  6.1250    case 0 then show ?thesis by auto
  6.1251  next
  6.1252    case (Suc _) then have pos_k: "k > 0" by auto
  6.1253 -  from assms nat_dvd_pos [OF this] have pos_mn: "m > 0" "n > 0" by auto
  6.1254 -  with nat_gcd_zero [of m n] have pos_gcd: "gcd m n > 0" by simp
  6.1255 +  from assms dvd_pos_nat [OF this] have pos_mn: "m > 0" "n > 0" by auto
  6.1256 +  with gcd_zero_nat [of m n] have pos_gcd: "gcd m n > 0" by simp
  6.1257    from assms obtain p where k_m: "k = m * p" using dvd_def by blast
  6.1258    from assms obtain q where k_n: "k = n * q" using dvd_def by blast
  6.1259    from pos_k k_m have pos_p: "p > 0" by auto
  6.1260    from pos_k k_n have pos_q: "q > 0" by auto
  6.1261    have "k * k * gcd q p = k * gcd (k * q) (k * p)"
  6.1262 -    by (simp add: mult_ac nat_gcd_mult_distrib)
  6.1263 +    by (simp add: mult_ac gcd_mult_distrib_nat)
  6.1264    also have "\<dots> = k * gcd (m * p * q) (n * q * p)"
  6.1265      by (simp add: k_m [symmetric] k_n [symmetric])
  6.1266    also have "\<dots> = k * p * q * gcd m n"
  6.1267 -    by (simp add: mult_ac nat_gcd_mult_distrib)
  6.1268 +    by (simp add: mult_ac gcd_mult_distrib_nat)
  6.1269    finally have "(m * p) * (n * q) * gcd q p = k * p * q * gcd m n"
  6.1270      by (simp only: k_m [symmetric] k_n [symmetric])
  6.1271    then have "p * q * m * n * gcd q p = p * q * k * gcd m n"
  6.1272      by (simp add: mult_ac)
  6.1273    with pos_p pos_q have "m * n * gcd q p = k * gcd m n"
  6.1274      by simp
  6.1275 -  with nat_prod_gcd_lcm [of m n]
  6.1276 +  with prod_gcd_lcm_nat [of m n]
  6.1277    have "lcm m n * gcd q p * gcd m n = k * gcd m n"
  6.1278      by (simp add: mult_ac)
  6.1279    with pos_gcd have "lcm m n * gcd q p = k" by auto
  6.1280    then show ?thesis using dvd_def by auto
  6.1281  qed
  6.1282  
  6.1283 -lemma int_lcm_least:
  6.1284 +lemma lcm_least_int:
  6.1285    "(m::int) dvd k \<Longrightarrow> n dvd k \<Longrightarrow> lcm m n dvd k"
  6.1286 -apply (subst int_lcm_abs)
  6.1287 +apply (subst lcm_abs_int)
  6.1288  apply (rule dvd_trans)
  6.1289 -apply (rule nat_lcm_least [transferred, of _ "abs k" _])
  6.1290 +apply (rule lcm_least_nat [transferred, of _ "abs k" _])
  6.1291  apply auto
  6.1292  done
  6.1293  
  6.1294 -lemma nat_lcm_dvd1: "(m::nat) dvd lcm m n"
  6.1295 +lemma lcm_dvd1_nat: "(m::nat) dvd lcm m n"
  6.1296  proof (cases m)
  6.1297    case 0 then show ?thesis by simp
  6.1298  next
  6.1299 @@ -1382,82 +1382,82 @@
  6.1300      then obtain k where "n = gcd m n * k" using dvd_def by auto
  6.1301      then have "m * n div gcd m n = m * (gcd m n * k) div gcd m n"
  6.1302        by (simp add: mult_ac)
  6.1303 -    also have "\<dots> = m * k" using mpos npos nat_gcd_zero by simp
  6.1304 +    also have "\<dots> = m * k" using mpos npos gcd_zero_nat by simp
  6.1305      finally show ?thesis by (simp add: lcm_nat_def)
  6.1306    qed
  6.1307  qed
  6.1308  
  6.1309 -lemma int_lcm_dvd1: "(m::int) dvd lcm m n"
  6.1310 -  apply (subst int_lcm_abs)
  6.1311 +lemma lcm_dvd1_int: "(m::int) dvd lcm m n"
  6.1312 +  apply (subst lcm_abs_int)
  6.1313    apply (rule dvd_trans)
  6.1314    prefer 2
  6.1315 -  apply (rule nat_lcm_dvd1 [transferred])
  6.1316 +  apply (rule lcm_dvd1_nat [transferred])
  6.1317    apply auto
  6.1318  done
  6.1319  
  6.1320 -lemma nat_lcm_dvd2: "(n::nat) dvd lcm m n"
  6.1321 -  by (subst nat_lcm_commute, rule nat_lcm_dvd1)
  6.1322 +lemma lcm_dvd2_nat: "(n::nat) dvd lcm m n"
  6.1323 +  by (subst lcm_commute_nat, rule lcm_dvd1_nat)
  6.1324  
  6.1325 -lemma int_lcm_dvd2: "(n::int) dvd lcm m n"
  6.1326 -  by (subst int_lcm_commute, rule int_lcm_dvd1)
  6.1327 +lemma lcm_dvd2_int: "(n::int) dvd lcm m n"
  6.1328 +  by (subst lcm_commute_int, rule lcm_dvd1_int)
  6.1329  
  6.1330  lemma dvd_lcm_I1_nat[simp]: "(k::nat) dvd m \<Longrightarrow> k dvd lcm m n"
  6.1331 -by(metis nat_lcm_dvd1 dvd_trans)
  6.1332 +by(metis lcm_dvd1_nat dvd_trans)
  6.1333  
  6.1334  lemma dvd_lcm_I2_nat[simp]: "(k::nat) dvd n \<Longrightarrow> k dvd lcm m n"
  6.1335 -by(metis nat_lcm_dvd2 dvd_trans)
  6.1336 +by(metis lcm_dvd2_nat dvd_trans)
  6.1337  
  6.1338  lemma dvd_lcm_I1_int[simp]: "(i::int) dvd m \<Longrightarrow> i dvd lcm m n"
  6.1339 -by(metis int_lcm_dvd1 dvd_trans)
  6.1340 +by(metis lcm_dvd1_int dvd_trans)
  6.1341  
  6.1342  lemma dvd_lcm_I2_int[simp]: "(i::int) dvd n \<Longrightarrow> i dvd lcm m n"
  6.1343 -by(metis int_lcm_dvd2 dvd_trans)
  6.1344 +by(metis lcm_dvd2_int dvd_trans)
  6.1345  
  6.1346 -lemma nat_lcm_unique: "(a::nat) dvd d \<and> b dvd d \<and>
  6.1347 +lemma lcm_unique_nat: "(a::nat) dvd d \<and> b dvd d \<and>
  6.1348      (\<forall>e. a dvd e \<and> b dvd e \<longrightarrow> d dvd e) \<longleftrightarrow> d = lcm a b"
  6.1349 -  by (auto intro: dvd_anti_sym nat_lcm_least nat_lcm_dvd1 nat_lcm_dvd2)
  6.1350 +  by (auto intro: dvd_anti_sym lcm_least_nat lcm_dvd1_nat lcm_dvd2_nat)
  6.1351  
  6.1352 -lemma int_lcm_unique: "d >= 0 \<and> (a::int) dvd d \<and> b dvd d \<and>
  6.1353 +lemma lcm_unique_int: "d >= 0 \<and> (a::int) dvd d \<and> b dvd d \<and>
  6.1354      (\<forall>e. a dvd e \<and> b dvd e \<longrightarrow> d dvd e) \<longleftrightarrow> d = lcm a b"
  6.1355 -  by (auto intro: dvd_anti_sym [transferred] int_lcm_least)
  6.1356 +  by (auto intro: dvd_anti_sym [transferred] lcm_least_int)
  6.1357  
  6.1358  lemma lcm_proj2_if_dvd_nat [simp]: "(x::nat) dvd y \<Longrightarrow> lcm x y = y"
  6.1359    apply (rule sym)
  6.1360 -  apply (subst nat_lcm_unique [symmetric])
  6.1361 +  apply (subst lcm_unique_nat [symmetric])
  6.1362    apply auto
  6.1363  done
  6.1364  
  6.1365  lemma lcm_proj2_if_dvd_int [simp]: "(x::int) dvd y \<Longrightarrow> lcm x y = abs y"
  6.1366    apply (rule sym)
  6.1367 -  apply (subst int_lcm_unique [symmetric])
  6.1368 +  apply (subst lcm_unique_int [symmetric])
  6.1369    apply auto
  6.1370  done
  6.1371  
  6.1372  lemma lcm_proj1_if_dvd_nat [simp]: "(x::nat) dvd y \<Longrightarrow> lcm y x = y"
  6.1373 -by (subst nat_lcm_commute, erule lcm_proj2_if_dvd_nat)
  6.1374 +by (subst lcm_commute_nat, erule lcm_proj2_if_dvd_nat)
  6.1375  
  6.1376  lemma lcm_proj1_if_dvd_int [simp]: "(x::int) dvd y \<Longrightarrow> lcm y x = abs y"
  6.1377 -by (subst int_lcm_commute, erule lcm_proj2_if_dvd_int)
  6.1378 +by (subst lcm_commute_int, erule lcm_proj2_if_dvd_int)
  6.1379  
  6.1380  
  6.1381  lemma lcm_assoc_nat: "lcm (lcm n m) (p::nat) = lcm n (lcm m p)"
  6.1382 -apply(rule nat_lcm_unique[THEN iffD1])
  6.1383 -apply (metis dvd.order_trans nat_lcm_unique)
  6.1384 +apply(rule lcm_unique_nat[THEN iffD1])
  6.1385 +apply (metis dvd.order_trans lcm_unique_nat)
  6.1386  done
  6.1387  
  6.1388  lemma lcm_assoc_int: "lcm (lcm n m) (p::int) = lcm n (lcm m p)"
  6.1389 -apply(rule int_lcm_unique[THEN iffD1])
  6.1390 -apply (metis dvd_trans int_lcm_unique)
  6.1391 +apply(rule lcm_unique_int[THEN iffD1])
  6.1392 +apply (metis dvd_trans lcm_unique_int)
  6.1393  done
  6.1394  
  6.1395  lemmas lcm_left_commute_nat =
  6.1396 -  mk_left_commute[of lcm, OF lcm_assoc_nat nat_lcm_commute]
  6.1397 +  mk_left_commute[of lcm, OF lcm_assoc_nat lcm_commute_nat]
  6.1398  
  6.1399  lemmas lcm_left_commute_int =
  6.1400 -  mk_left_commute[of lcm, OF lcm_assoc_int int_lcm_commute]
  6.1401 +  mk_left_commute[of lcm, OF lcm_assoc_int lcm_commute_int]
  6.1402  
  6.1403 -lemmas lcm_ac_nat = lcm_assoc_nat nat_lcm_commute lcm_left_commute_nat
  6.1404 -lemmas lcm_ac_int = lcm_assoc_int int_lcm_commute lcm_left_commute_int
  6.1405 +lemmas lcm_ac_nat = lcm_assoc_nat lcm_commute_nat lcm_left_commute_nat
  6.1406 +lemmas lcm_ac_int = lcm_assoc_int lcm_commute_int lcm_left_commute_int
  6.1407  
  6.1408  
  6.1409  subsection {* Primes *}
  6.1410 @@ -1465,40 +1465,40 @@
  6.1411  (* Is there a better way to handle these, rather than making them
  6.1412     elim rules? *)
  6.1413  
  6.1414 -lemma nat_prime_ge_0 [elim]: "prime (p::nat) \<Longrightarrow> p >= 0"
  6.1415 +lemma prime_ge_0_nat [elim]: "prime (p::nat) \<Longrightarrow> p >= 0"
  6.1416    by (unfold prime_nat_def, auto)
  6.1417  
  6.1418 -lemma nat_prime_gt_0 [elim]: "prime (p::nat) \<Longrightarrow> p > 0"
  6.1419 +lemma prime_gt_0_nat [elim]: "prime (p::nat) \<Longrightarrow> p > 0"
  6.1420    by (unfold prime_nat_def, auto)
  6.1421  
  6.1422 -lemma nat_prime_ge_1 [elim]: "prime (p::nat) \<Longrightarrow> p >= 1"
  6.1423 +lemma prime_ge_1_nat [elim]: "prime (p::nat) \<Longrightarrow> p >= 1"
  6.1424    by (unfold prime_nat_def, auto)
  6.1425  
  6.1426 -lemma nat_prime_gt_1 [elim]: "prime (p::nat) \<Longrightarrow> p > 1"
  6.1427 +lemma prime_gt_1_nat [elim]: "prime (p::nat) \<Longrightarrow> p > 1"
  6.1428    by (unfold prime_nat_def, auto)
  6.1429  
  6.1430 -lemma nat_prime_ge_Suc_0 [elim]: "prime (p::nat) \<Longrightarrow> p >= Suc 0"
  6.1431 +lemma prime_ge_Suc_0_nat [elim]: "prime (p::nat) \<Longrightarrow> p >= Suc 0"
  6.1432    by (unfold prime_nat_def, auto)
  6.1433  
  6.1434 -lemma nat_prime_gt_Suc_0 [elim]: "prime (p::nat) \<Longrightarrow> p > Suc 0"
  6.1435 +lemma prime_gt_Suc_0_nat [elim]: "prime (p::nat) \<Longrightarrow> p > Suc 0"
  6.1436    by (unfold prime_nat_def, auto)
  6.1437  
  6.1438 -lemma nat_prime_ge_2 [elim]: "prime (p::nat) \<Longrightarrow> p >= 2"
  6.1439 +lemma prime_ge_2_nat [elim]: "prime (p::nat) \<Longrightarrow> p >= 2"
  6.1440    by (unfold prime_nat_def, auto)
  6.1441  
  6.1442 -lemma int_prime_ge_0 [elim]: "prime (p::int) \<Longrightarrow> p >= 0"
  6.1443 +lemma prime_ge_0_int [elim]: "prime (p::int) \<Longrightarrow> p >= 0"
  6.1444    by (unfold prime_int_def prime_nat_def, auto)
  6.1445  
  6.1446 -lemma int_prime_gt_0 [elim]: "prime (p::int) \<Longrightarrow> p > 0"
  6.1447 +lemma prime_gt_0_int [elim]: "prime (p::int) \<Longrightarrow> p > 0"
  6.1448    by (unfold prime_int_def prime_nat_def, auto)
  6.1449  
  6.1450 -lemma int_prime_ge_1 [elim]: "prime (p::int) \<Longrightarrow> p >= 1"
  6.1451 +lemma prime_ge_1_int [elim]: "prime (p::int) \<Longrightarrow> p >= 1"
  6.1452    by (unfold prime_int_def prime_nat_def, auto)
  6.1453  
  6.1454 -lemma int_prime_gt_1 [elim]: "prime (p::int) \<Longrightarrow> p > 1"
  6.1455 +lemma prime_gt_1_int [elim]: "prime (p::int) \<Longrightarrow> p > 1"
  6.1456    by (unfold prime_int_def prime_nat_def, auto)
  6.1457  
  6.1458 -lemma int_prime_ge_2 [elim]: "prime (p::int) \<Longrightarrow> p >= 2"
  6.1459 +lemma prime_ge_2_int [elim]: "prime (p::int) \<Longrightarrow> p >= 2"
  6.1460    by (unfold prime_int_def prime_nat_def, auto)
  6.1461  
  6.1462  thm prime_nat_def;
  6.1463 @@ -1508,59 +1508,59 @@
  6.1464      m = 1 \<or> m = p))"
  6.1465    using prime_nat_def [transferred]
  6.1466      apply (case_tac "p >= 0")
  6.1467 -    by (blast, auto simp add: int_prime_ge_0)
  6.1468 +    by (blast, auto simp add: prime_ge_0_int)
  6.1469  
  6.1470  (* To do: determine primality of any numeral *)
  6.1471  
  6.1472 -lemma nat_zero_not_prime [simp]: "~prime (0::nat)"
  6.1473 +lemma zero_not_prime_nat [simp]: "~prime (0::nat)"
  6.1474    by (simp add: prime_nat_def)
  6.1475  
  6.1476 -lemma int_zero_not_prime [simp]: "~prime (0::int)"
  6.1477 +lemma zero_not_prime_int [simp]: "~prime (0::int)"
  6.1478    by (simp add: prime_int_def)
  6.1479  
  6.1480 -lemma nat_one_not_prime [simp]: "~prime (1::nat)"
  6.1481 +lemma one_not_prime_nat [simp]: "~prime (1::nat)"
  6.1482    by (simp add: prime_nat_def)
  6.1483  
  6.1484 -lemma nat_Suc_0_not_prime [simp]: "~prime (Suc 0)"
  6.1485 +lemma Suc_0_not_prime_nat [simp]: "~prime (Suc 0)"
  6.1486    by (simp add: prime_nat_def One_nat_def)
  6.1487  
  6.1488 -lemma int_one_not_prime [simp]: "~prime (1::int)"
  6.1489 +lemma one_not_prime_int [simp]: "~prime (1::int)"
  6.1490    by (simp add: prime_int_def)
  6.1491  
  6.1492 -lemma nat_two_is_prime [simp]: "prime (2::nat)"
  6.1493 +lemma two_is_prime_nat [simp]: "prime (2::nat)"
  6.1494    apply (auto simp add: prime_nat_def)
  6.1495    apply (case_tac m)
  6.1496    apply (auto dest!: dvd_imp_le)
  6.1497    done
  6.1498  
  6.1499 -lemma int_two_is_prime [simp]: "prime (2::int)"
  6.1500 -  by (rule nat_two_is_prime [transferred direction: nat "op <= (0::int)"])
  6.1501 +lemma two_is_prime_int [simp]: "prime (2::int)"
  6.1502 +  by (rule two_is_prime_nat [transferred direction: nat "op <= (0::int)"])
  6.1503  
  6.1504 -lemma nat_prime_imp_coprime: "prime (p::nat) \<Longrightarrow> \<not> p dvd n \<Longrightarrow> coprime p n"
  6.1505 +lemma prime_imp_coprime_nat: "prime (p::nat) \<Longrightarrow> \<not> p dvd n \<Longrightarrow> coprime p n"
  6.1506    apply (unfold prime_nat_def)
  6.1507 -  apply (metis nat_gcd_dvd1 nat_gcd_dvd2)
  6.1508 +  apply (metis gcd_dvd1_nat gcd_dvd2_nat)
  6.1509    done
  6.1510  
  6.1511 -lemma int_prime_imp_coprime: "prime (p::int) \<Longrightarrow> \<not> p dvd n \<Longrightarrow> coprime p n"
  6.1512 +lemma prime_imp_coprime_int: "prime (p::int) \<Longrightarrow> \<not> p dvd n \<Longrightarrow> coprime p n"
  6.1513    apply (unfold prime_int_altdef)
  6.1514 -  apply (metis int_gcd_dvd1 int_gcd_dvd2 int_gcd_ge_0)
  6.1515 +  apply (metis gcd_dvd1_int gcd_dvd2_int gcd_ge_0_int)
  6.1516    done
  6.1517  
  6.1518 -lemma nat_prime_dvd_mult: "prime (p::nat) \<Longrightarrow> p dvd m * n \<Longrightarrow> p dvd m \<or> p dvd n"
  6.1519 -  by (blast intro: nat_coprime_dvd_mult nat_prime_imp_coprime)
  6.1520 +lemma prime_dvd_mult_nat: "prime (p::nat) \<Longrightarrow> p dvd m * n \<Longrightarrow> p dvd m \<or> p dvd n"
  6.1521 +  by (blast intro: coprime_dvd_mult_nat prime_imp_coprime_nat)
  6.1522  
  6.1523 -lemma int_prime_dvd_mult: "prime (p::int) \<Longrightarrow> p dvd m * n \<Longrightarrow> p dvd m \<or> p dvd n"
  6.1524 -  by (blast intro: int_coprime_dvd_mult int_prime_imp_coprime)
  6.1525 +lemma prime_dvd_mult_int: "prime (p::int) \<Longrightarrow> p dvd m * n \<Longrightarrow> p dvd m \<or> p dvd n"
  6.1526 +  by (blast intro: coprime_dvd_mult_int prime_imp_coprime_int)
  6.1527  
  6.1528 -lemma nat_prime_dvd_mult_eq [simp]: "prime (p::nat) \<Longrightarrow>
  6.1529 +lemma prime_dvd_mult_eq_nat [simp]: "prime (p::nat) \<Longrightarrow>
  6.1530      p dvd m * n = (p dvd m \<or> p dvd n)"
  6.1531 -  by (rule iffI, rule nat_prime_dvd_mult, auto)
  6.1532 +  by (rule iffI, rule prime_dvd_mult_nat, auto)
  6.1533  
  6.1534 -lemma int_prime_dvd_mult_eq [simp]: "prime (p::int) \<Longrightarrow>
  6.1535 +lemma prime_dvd_mult_eq_int [simp]: "prime (p::int) \<Longrightarrow>
  6.1536      p dvd m * n = (p dvd m \<or> p dvd n)"
  6.1537 -  by (rule iffI, rule int_prime_dvd_mult, auto)
  6.1538 +  by (rule iffI, rule prime_dvd_mult_int, auto)
  6.1539  
  6.1540 -lemma nat_not_prime_eq_prod: "(n::nat) > 1 \<Longrightarrow> ~ prime n \<Longrightarrow>
  6.1541 +lemma not_prime_eq_prod_nat: "(n::nat) > 1 \<Longrightarrow> ~ prime n \<Longrightarrow>
  6.1542      EX m k. n = m * k & 1 < m & m < n & 1 < k & k < n"
  6.1543    unfolding prime_nat_def dvd_def apply auto
  6.1544    apply (subgoal_tac "k > 1")
  6.1545 @@ -1573,7 +1573,7 @@
  6.1546  
  6.1547  (* there's a lot of messing around with signs of products here --
  6.1548     could this be made more automatic? *)
  6.1549 -lemma int_not_prime_eq_prod: "(n::int) > 1 \<Longrightarrow> ~ prime n \<Longrightarrow>
  6.1550 +lemma not_prime_eq_prod_int: "(n::int) > 1 \<Longrightarrow> ~ prime n \<Longrightarrow>
  6.1551      EX m k. n = m * k & 1 < m & m < n & 1 < k & k < n"
  6.1552    unfolding prime_int_altdef dvd_def
  6.1553    apply auto
  6.1554 @@ -1593,72 +1593,72 @@
  6.1555    apply auto
  6.1556  done
  6.1557  
  6.1558 -lemma nat_prime_dvd_power [rule_format]: "prime (p::nat) -->
  6.1559 +lemma prime_dvd_power_nat [rule_format]: "prime (p::nat) -->
  6.1560      n > 0 --> (p dvd x^n --> p dvd x)"
  6.1561    by (induct n rule: nat_induct, auto)
  6.1562  
  6.1563 -lemma int_prime_dvd_power [rule_format]: "prime (p::int) -->
  6.1564 +lemma prime_dvd_power_int [rule_format]: "prime (p::int) -->
  6.1565      n > 0 --> (p dvd x^n --> p dvd x)"
  6.1566    apply (induct n rule: nat_induct, auto)
  6.1567 -  apply (frule int_prime_ge_0)
  6.1568 +  apply (frule prime_ge_0_int)
  6.1569    apply auto
  6.1570  done
  6.1571  
  6.1572 -lemma nat_prime_imp_power_coprime: "prime (p::nat) \<Longrightarrow> ~ p dvd a \<Longrightarrow>
  6.1573 +lemma prime_imp_power_coprime_nat: "prime (p::nat) \<Longrightarrow> ~ p dvd a \<Longrightarrow>
  6.1574      coprime a (p^m)"
  6.1575 -  apply (rule nat_coprime_exp)
  6.1576 -  apply (subst nat_gcd_commute)
  6.1577 -  apply (erule (1) nat_prime_imp_coprime)
  6.1578 +  apply (rule coprime_exp_nat)
  6.1579 +  apply (subst gcd_commute_nat)
  6.1580 +  apply (erule (1) prime_imp_coprime_nat)
  6.1581  done
  6.1582  
  6.1583 -lemma int_prime_imp_power_coprime: "prime (p::int) \<Longrightarrow> ~ p dvd a \<Longrightarrow>
  6.1584 +lemma prime_imp_power_coprime_int: "prime (p::int) \<Longrightarrow> ~ p dvd a \<Longrightarrow>
  6.1585      coprime a (p^m)"
  6.1586 -  apply (rule int_coprime_exp)
  6.1587 -  apply (subst int_gcd_commute)
  6.1588 -  apply (erule (1) int_prime_imp_coprime)
  6.1589 +  apply (rule coprime_exp_int)
  6.1590 +  apply (subst gcd_commute_int)
  6.1591 +  apply (erule (1) prime_imp_coprime_int)
  6.1592  done
  6.1593  
  6.1594 -lemma nat_primes_coprime: "prime (p::nat) \<Longrightarrow> prime q \<Longrightarrow> p \<noteq> q \<Longrightarrow> coprime p q"
  6.1595 -  apply (rule nat_prime_imp_coprime, assumption)
  6.1596 +lemma primes_coprime_nat: "prime (p::nat) \<Longrightarrow> prime q \<Longrightarrow> p \<noteq> q \<Longrightarrow> coprime p q"
  6.1597 +  apply (rule prime_imp_coprime_nat, assumption)
  6.1598    apply (unfold prime_nat_def, auto)
  6.1599  done
  6.1600  
  6.1601 -lemma int_primes_coprime: "prime (p::int) \<Longrightarrow> prime q \<Longrightarrow> p \<noteq> q \<Longrightarrow> coprime p q"
  6.1602 -  apply (rule int_prime_imp_coprime, assumption)
  6.1603 +lemma primes_coprime_int: "prime (p::int) \<Longrightarrow> prime q \<Longrightarrow> p \<noteq> q \<Longrightarrow> coprime p q"
  6.1604 +  apply (rule prime_imp_coprime_int, assumption)
  6.1605    apply (unfold prime_int_altdef, clarify)
  6.1606    apply (drule_tac x = q in spec)
  6.1607    apply (drule_tac x = p in spec)
  6.1608    apply auto
  6.1609  done
  6.1610  
  6.1611 -lemma nat_primes_imp_powers_coprime: "prime (p::nat) \<Longrightarrow> prime q \<Longrightarrow> p ~= q \<Longrightarrow>
  6.1612 +lemma primes_imp_powers_coprime_nat: "prime (p::nat) \<Longrightarrow> prime q \<Longrightarrow> p ~= q \<Longrightarrow>
  6.1613      coprime (p^m) (q^n)"
  6.1614 -  by (rule nat_coprime_exp2, rule nat_primes_coprime)
  6.1615 +  by (rule coprime_exp2_nat, rule primes_coprime_nat)
  6.1616  
  6.1617 -lemma int_primes_imp_powers_coprime: "prime (p::int) \<Longrightarrow> prime q \<Longrightarrow> p ~= q \<Longrightarrow>
  6.1618 +lemma primes_imp_powers_coprime_int: "prime (p::int) \<Longrightarrow> prime q \<Longrightarrow> p ~= q \<Longrightarrow>
  6.1619      coprime (p^m) (q^n)"
  6.1620 -  by (rule int_coprime_exp2, rule int_primes_coprime)
  6.1621 +  by (rule coprime_exp2_int, rule primes_coprime_int)
  6.1622  
  6.1623 -lemma nat_prime_factor: "n \<noteq> (1::nat) \<Longrightarrow> \<exists> p. prime p \<and> p dvd n"
  6.1624 +lemma prime_factor_nat: "n \<noteq> (1::nat) \<Longrightarrow> \<exists> p. prime p \<and> p dvd n"
  6.1625    apply (induct n rule: nat_less_induct)
  6.1626    apply (case_tac "n = 0")
  6.1627 -  using nat_two_is_prime apply blast
  6.1628 +  using two_is_prime_nat apply blast
  6.1629    apply (case_tac "prime n")
  6.1630    apply blast
  6.1631    apply (subgoal_tac "n > 1")
  6.1632 -  apply (frule (1) nat_not_prime_eq_prod)
  6.1633 +  apply (frule (1) not_prime_eq_prod_nat)
  6.1634    apply (auto intro: dvd_mult dvd_mult2)
  6.1635  done
  6.1636  
  6.1637  (* An Isar version:
  6.1638  
  6.1639 -lemma nat_prime_factor_b:
  6.1640 +lemma prime_factor_b_nat:
  6.1641    fixes n :: nat
  6.1642    assumes "n \<noteq> 1"
  6.1643    shows "\<exists>p. prime p \<and> p dvd n"
  6.1644  
  6.1645  using `n ~= 1`
  6.1646 -proof (induct n rule: nat_less_induct)
  6.1647 +proof (induct n rule: less_induct_nat)
  6.1648    fix n :: nat
  6.1649    assume "n ~= 1" and
  6.1650      ih: "\<forall>m<n. m \<noteq> 1 \<longrightarrow> (\<exists>p. prime p \<and> p dvd m)"
  6.1651 @@ -1666,9 +1666,9 @@
  6.1652    proof -
  6.1653    {
  6.1654      assume "n = 0"
  6.1655 -    moreover note nat_two_is_prime
  6.1656 +    moreover note two_is_prime_nat
  6.1657      ultimately have ?thesis
  6.1658 -      by (auto simp del: nat_two_is_prime)
  6.1659 +      by (auto simp del: two_is_prime_nat)
  6.1660    }
  6.1661    moreover
  6.1662    {
  6.1663 @@ -1679,7 +1679,7 @@
  6.1664    {
  6.1665      assume "n ~= 0" and "~ prime n"
  6.1666      with `n ~= 1` have "n > 1" by auto
  6.1667 -    with `~ prime n` and nat_not_prime_eq_prod obtain m k where
  6.1668 +    with `~ prime n` and not_prime_eq_prod_nat obtain m k where
  6.1669        "n = m * k" and "1 < m" and "m < n" by blast
  6.1670      with ih obtain p where "prime p" and "p dvd m" by blast
  6.1671      with `n = m * k` have ?thesis by auto
  6.1672 @@ -1692,7 +1692,7 @@
  6.1673  
  6.1674  text {* One property of coprimality is easier to prove via prime factors. *}
  6.1675  
  6.1676 -lemma nat_prime_divprod_pow:
  6.1677 +lemma prime_divprod_pow_nat:
  6.1678    assumes p: "prime (p::nat)" and ab: "coprime a b" and pab: "p^n dvd a * b"
  6.1679    shows "p^n dvd a \<or> p^n dvd b"
  6.1680  proof-
  6.1681 @@ -1705,27 +1705,27 @@
  6.1682      from n have "p dvd p^n" by (intro dvd_power, auto)
  6.1683      also note pab
  6.1684      finally have pab': "p dvd a * b".
  6.1685 -    from nat_prime_dvd_mult[OF p pab']
  6.1686 +    from prime_dvd_mult_nat[OF p pab']
  6.1687      have "p dvd a \<or> p dvd b" .
  6.1688      moreover
  6.1689      {assume pa: "p dvd a"
  6.1690        have pnba: "p^n dvd b*a" using pab by (simp add: mult_commute)
  6.1691 -      from nat_coprime_common_divisor [OF ab, OF pa] p have "\<not> p dvd b" by auto
  6.1692 +      from coprime_common_divisor_nat [OF ab, OF pa] p have "\<not> p dvd b" by auto
  6.1693        with p have "coprime b p"
  6.1694 -        by (subst nat_gcd_commute, intro nat_prime_imp_coprime)
  6.1695 +        by (subst gcd_commute_nat, intro prime_imp_coprime_nat)
  6.1696        hence pnb: "coprime (p^n) b"
  6.1697 -        by (subst nat_gcd_commute, rule nat_coprime_exp)
  6.1698 -      from nat_coprime_divprod[OF pnba pnb] have ?thesis by blast }
  6.1699 +        by (subst gcd_commute_nat, rule coprime_exp_nat)
  6.1700 +      from coprime_divprod_nat[OF pnba pnb] have ?thesis by blast }
  6.1701      moreover
  6.1702      {assume pb: "p dvd b"
  6.1703        have pnba: "p^n dvd b*a" using pab by (simp add: mult_commute)
  6.1704 -      from nat_coprime_common_divisor [OF ab, of p] pb p have "\<not> p dvd a"
  6.1705 +      from coprime_common_divisor_nat [OF ab, of p] pb p have "\<not> p dvd a"
  6.1706          by auto
  6.1707        with p have "coprime a p"
  6.1708 -        by (subst nat_gcd_commute, intro nat_prime_imp_coprime)
  6.1709 +        by (subst gcd_commute_nat, intro prime_imp_coprime_nat)
  6.1710        hence pna: "coprime (p^n) a"
  6.1711 -        by (subst nat_gcd_commute, rule nat_coprime_exp)
  6.1712 -      from nat_coprime_divprod[OF pab pna] have ?thesis by blast }
  6.1713 +        by (subst gcd_commute_nat, rule coprime_exp_nat)
  6.1714 +      from coprime_divprod_nat[OF pab pna] have ?thesis by blast }
  6.1715      ultimately have ?thesis by blast}
  6.1716    ultimately show ?thesis by blast
  6.1717  qed
     7.1 --- a/src/HOL/Library/Abstract_Rat.thy	Tue Jul 07 07:56:24 2009 +0200
     7.2 +++ b/src/HOL/Library/Abstract_Rat.thy	Tue Jul 07 17:39:51 2009 +0200
     7.3 @@ -30,8 +30,8 @@
     7.4    (let g = gcd a b 
     7.5     in if b > 0 then (a div g, b div g) else (- (a div g), - (b div g)))))"
     7.6  
     7.7 -declare int_gcd_dvd1[presburger]
     7.8 -declare int_gcd_dvd2[presburger]
     7.9 +declare gcd_dvd1_int[presburger]
    7.10 +declare gcd_dvd2_int[presburger]
    7.11  lemma normNum_isnormNum [simp]: "isnormNum (normNum x)"
    7.12  proof -
    7.13    have " \<exists> a b. x = (a,b)" by auto
    7.14 @@ -43,7 +43,7 @@
    7.15      let ?a' = "a div ?g"
    7.16      let ?b' = "b div ?g"
    7.17      let ?g' = "gcd ?a' ?b'"
    7.18 -    from anz bnz have "?g \<noteq> 0" by simp  with int_gcd_ge_0[of a b] 
    7.19 +    from anz bnz have "?g \<noteq> 0" by simp  with gcd_ge_0_int[of a b] 
    7.20      have gpos: "?g > 0"  by arith
    7.21      have gdvd: "?g dvd a" "?g dvd b" by arith+ 
    7.22      from zdvd_mult_div_cancel[OF gdvd(1)] zdvd_mult_div_cancel[OF gdvd(2)]
    7.23 @@ -51,7 +51,7 @@
    7.24      have nz':"?a' \<noteq> 0" "?b' \<noteq> 0"
    7.25        by - (rule notI, simp)+
    7.26      from anz bnz have stupid: "a \<noteq> 0 \<or> b \<noteq> 0" by arith 
    7.27 -    from int_div_gcd_coprime[OF stupid] have gp1: "?g' = 1" .
    7.28 +    from div_gcd_coprime_int[OF stupid] have gp1: "?g' = 1" .
    7.29      from bnz have "b < 0 \<or> b > 0" by arith
    7.30      moreover
    7.31      {assume b: "b > 0"
    7.32 @@ -137,7 +137,7 @@
    7.33  
    7.34  lemma Ninv_normN[simp]: "isnormNum x \<Longrightarrow> isnormNum (Ninv x)"
    7.35    by (simp add: Ninv_def isnormNum_def split_def)
    7.36 -    (cases "fst x = 0", auto simp add: int_gcd_commute)
    7.37 +    (cases "fst x = 0", auto simp add: gcd_commute_int)
    7.38  
    7.39  lemma isnormNum_int[simp]: 
    7.40    "isnormNum 0\<^sub>N" "isnormNum (1::int)\<^sub>N" "i \<noteq> 0 \<Longrightarrow> isnormNum i\<^sub>N"
    7.41 @@ -203,7 +203,7 @@
    7.42      from prems have eq:"a * b' = a'*b" 
    7.43        by (simp add: INum_def  eq_divide_eq divide_eq_eq of_int_mult[symmetric] del: of_int_mult)
    7.44      from prems have gcd1: "gcd a b = 1" "gcd b a = 1" "gcd a' b' = 1" "gcd b' a' = 1"       
    7.45 -      by (simp_all add: isnormNum_def add: int_gcd_commute)
    7.46 +      by (simp_all add: isnormNum_def add: gcd_commute_int)
    7.47      from eq have raw_dvd: "a dvd a'*b" "b dvd b'*a" "a' dvd a*b'" "b' dvd b*a'"
    7.48        apply - 
    7.49        apply algebra
    7.50 @@ -211,8 +211,8 @@
    7.51        apply simp
    7.52        apply algebra
    7.53        done
    7.54 -    from zdvd_dvd_eq[OF bz int_coprime_dvd_mult[OF gcd1(2) raw_dvd(2)]
    7.55 -      int_coprime_dvd_mult[OF gcd1(4) raw_dvd(4)]]
    7.56 +    from zdvd_dvd_eq[OF bz coprime_dvd_mult_int[OF gcd1(2) raw_dvd(2)]
    7.57 +      coprime_dvd_mult_int[OF gcd1(4) raw_dvd(4)]]
    7.58        have eq1: "b = b'" using pos by arith  
    7.59        with eq have "a = a'" using pos by simp
    7.60        with eq1 have ?rhs by simp}
    7.61 @@ -297,8 +297,8 @@
    7.62        let ?g = "gcd (a * b' + b * a') (b*b')"
    7.63        have gz: "?g \<noteq> 0" using z by simp
    7.64        have ?thesis using aa' bb' z gz
    7.65 -	of_int_div[where ?'a = 'a, OF gz int_gcd_dvd1[where x="a * b' + b * a'" and y="b*b'"]]	of_int_div[where ?'a = 'a,
    7.66 -	OF gz int_gcd_dvd2[where x="a * b' + b * a'" and y="b*b'"]]
    7.67 +	of_int_div[where ?'a = 'a, OF gz gcd_dvd1_int[where x="a * b' + b * a'" and y="b*b'"]]	of_int_div[where ?'a = 'a,
    7.68 +	OF gz gcd_dvd2_int[where x="a * b' + b * a'" and y="b*b'"]]
    7.69  	by (simp add: x y Nadd_def INum_def normNum_def Let_def add_divide_distrib)}
    7.70      ultimately have ?thesis using aa' bb' 
    7.71        by (simp add: Nadd_def INum_def normNum_def x y Let_def) }
    7.72 @@ -319,8 +319,8 @@
    7.73    {assume z: "a \<noteq> 0" "a' \<noteq> 0" "b \<noteq> 0" "b' \<noteq> 0"
    7.74      let ?g="gcd (a*a') (b*b')"
    7.75      have gz: "?g \<noteq> 0" using z by simp
    7.76 -    from z of_int_div[where ?'a = 'a, OF gz int_gcd_dvd1[where x="a*a'" and y="b*b'"]] 
    7.77 -      of_int_div[where ?'a = 'a , OF gz int_gcd_dvd2[where x="a*a'" and y="b*b'"]] 
    7.78 +    from z of_int_div[where ?'a = 'a, OF gz gcd_dvd1_int[where x="a*a'" and y="b*b'"]] 
    7.79 +      of_int_div[where ?'a = 'a , OF gz gcd_dvd2_int[where x="a*a'" and y="b*b'"]] 
    7.80      have ?thesis by (simp add: Nmul_def x y Let_def INum_def)}
    7.81    ultimately show ?thesis by blast
    7.82  qed
    7.83 @@ -478,7 +478,7 @@
    7.84  qed
    7.85  
    7.86  lemma Nmul_commute: "isnormNum x \<Longrightarrow> isnormNum y \<Longrightarrow> x *\<^sub>N y = y *\<^sub>N x"
    7.87 -  by (simp add: Nmul_def split_def Let_def int_gcd_commute mult_commute)
    7.88 +  by (simp add: Nmul_def split_def Let_def gcd_commute_int mult_commute)
    7.89  
    7.90  lemma Nmul_assoc:
    7.91    assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
     8.1 --- a/src/HOL/Library/Legacy_GCD.thy	Tue Jul 07 07:56:24 2009 +0200
     8.2 +++ b/src/HOL/Library/Legacy_GCD.thy	Tue Jul 07 17:39:51 2009 +0200
     8.3 @@ -409,7 +409,7 @@
     8.4    {fix x y assume H: "a * x - b * y = d \<or> b * x - a * y = d"
     8.5      have dv: "?g dvd a*x" "?g dvd b * y" "?g dvd b*x" "?g dvd a * y"
     8.6        using dvd_mult2[OF gcd_dvd1[of a b]] dvd_mult2[OF gcd_dvd2[of a b]] by simp_all
     8.7 -    from nat_dvd_diff[OF dv(1,2)] nat_dvd_diff[OF dv(3,4)] H
     8.8 +    from dvd_diff_nat[OF dv(1,2)] dvd_diff_nat[OF dv(3,4)] H
     8.9      have ?rhs by auto}
    8.10    ultimately show ?thesis by blast
    8.11  qed
     9.1 --- a/src/HOL/Library/Pocklington.thy	Tue Jul 07 07:56:24 2009 +0200
     9.2 +++ b/src/HOL/Library/Pocklington.thy	Tue Jul 07 17:39:51 2009 +0200
     9.3 @@ -846,7 +846,7 @@
     9.4        from lh[unfolded nat_mod]
     9.5        obtain q1 q2 where q12:"a ^ d + n * q1 = 1 + n * q2" by blast
     9.6        hence "a ^ d + n * q1 - n * q2 = 1" by simp
     9.7 -      with nat_dvd_diff [OF dvd_add [OF divides_rexp[OF p(2), of d'] dvd_mult2[OF p(1), of q1]] dvd_mult2[OF p(1), of q2]] d' have "p dvd 1" by simp
     9.8 +      with dvd_diff_nat [OF dvd_add [OF divides_rexp[OF p(2), of d'] dvd_mult2[OF p(1), of q1]] dvd_mult2[OF p(1), of q2]] d' have "p dvd 1" by simp
     9.9        with p(3) have False by simp
    9.10        hence ?rhs ..}
    9.11      ultimately have ?rhs by blast}
    10.1 --- a/src/HOL/Library/Primes.thy	Tue Jul 07 07:56:24 2009 +0200
    10.2 +++ b/src/HOL/Library/Primes.thy	Tue Jul 07 17:39:51 2009 +0200
    10.3 @@ -311,8 +311,8 @@
    10.4    {fix e assume H: "e dvd a^n" "e dvd b^n"
    10.5      from bezout_gcd_pow[of a n b] obtain x y 
    10.6        where xy: "a ^ n * x - b ^ n * y = ?gn \<or> b ^ n * x - a ^ n * y = ?gn" by blast
    10.7 -    from nat_dvd_diff [OF dvd_mult2[OF H(1), of x] dvd_mult2[OF H(2), of y]]
    10.8 -      nat_dvd_diff [OF dvd_mult2[OF H(2), of x] dvd_mult2[OF H(1), of y]] xy
    10.9 +    from dvd_diff_nat [OF dvd_mult2[OF H(1), of x] dvd_mult2[OF H(2), of y]]
   10.10 +      dvd_diff_nat [OF dvd_mult2[OF H(2), of x] dvd_mult2[OF H(1), of y]] xy
   10.11      have "e dvd ?gn" by (cases "a ^ n * x - b ^ n * y = gcd a b ^ n", simp_all)}
   10.12    hence th:  "\<forall>e. e dvd a^n \<and> e dvd b^n \<longrightarrow> e dvd ?gn" by blast
   10.13    from divides_exp[OF gcd_dvd1[of a b], of n] divides_exp[OF gcd_dvd2[of a b], of n] th
    11.1 --- a/src/HOL/NewNumberTheory/Binomial.thy	Tue Jul 07 07:56:24 2009 +0200
    11.2 +++ b/src/HOL/NewNumberTheory/Binomial.thy	Tue Jul 07 17:39:51 2009 +0200
    11.3 @@ -109,68 +109,68 @@
    11.4  
    11.5  subsection {* Factorial *}
    11.6  
    11.7 -lemma nat_fact_zero [simp]: "fact (0::nat) = 1"
    11.8 +lemma fact_zero_nat [simp]: "fact (0::nat) = 1"
    11.9    by simp
   11.10  
   11.11 -lemma int_fact_zero [simp]: "fact (0::int) = 1"
   11.12 +lemma fact_zero_int [simp]: "fact (0::int) = 1"
   11.13    by (simp add: fact_int_def)
   11.14  
   11.15 -lemma nat_fact_one [simp]: "fact (1::nat) = 1"
   11.16 +lemma fact_one_nat [simp]: "fact (1::nat) = 1"
   11.17    by simp
   11.18  
   11.19 -lemma nat_fact_Suc_0 [simp]: "fact (Suc 0) = Suc 0"
   11.20 +lemma fact_Suc_0_nat [simp]: "fact (Suc 0) = Suc 0"
   11.21    by (simp add: One_nat_def)
   11.22  
   11.23 -lemma int_fact_one [simp]: "fact (1::int) = 1"
   11.24 +lemma fact_one_int [simp]: "fact (1::int) = 1"
   11.25    by (simp add: fact_int_def)
   11.26  
   11.27 -lemma nat_fact_plus_one: "fact ((n::nat) + 1) = (n + 1) * fact n"
   11.28 +lemma fact_plus_one_nat: "fact ((n::nat) + 1) = (n + 1) * fact n"
   11.29    by simp
   11.30  
   11.31 -lemma nat_fact_Suc: "fact (Suc n) = (Suc n) * fact n"
   11.32 +lemma fact_Suc_nat: "fact (Suc n) = (Suc n) * fact n"
   11.33    by (simp add: One_nat_def)
   11.34  
   11.35 -lemma int_fact_plus_one: 
   11.36 +lemma fact_plus_one_int: 
   11.37    assumes "n >= 0"
   11.38    shows "fact ((n::int) + 1) = (n + 1) * fact n"
   11.39  
   11.40 -  using prems by (rule nat_fact_plus_one [transferred])
   11.41 +  using prems by (rule fact_plus_one_nat [transferred])
   11.42  
   11.43 -lemma nat_fact_reduce: "(n::nat) > 0 \<Longrightarrow> fact n = n * fact (n - 1)"
   11.44 +lemma fact_reduce_nat: "(n::nat) > 0 \<Longrightarrow> fact n = n * fact (n - 1)"
   11.45    by simp
   11.46  
   11.47 -lemma int_fact_reduce: 
   11.48 +lemma fact_reduce_int: 
   11.49    assumes "(n::int) > 0"
   11.50    shows "fact n = n * fact (n - 1)"
   11.51  
   11.52    using prems apply (subst tsub_eq [symmetric], auto)
   11.53 -  apply (rule nat_fact_reduce [transferred])
   11.54 +  apply (rule fact_reduce_nat [transferred])
   11.55    using prems apply auto
   11.56  done
   11.57  
   11.58  declare fact_nat.simps [simp del]
   11.59  
   11.60 -lemma nat_fact_nonzero [simp]: "fact (n::nat) \<noteq> 0"
   11.61 -  apply (induct n rule: nat_induct')
   11.62 -  apply (auto simp add: nat_fact_plus_one)
   11.63 +lemma fact_nonzero_nat [simp]: "fact (n::nat) \<noteq> 0"
   11.64 +  apply (induct n rule: induct'_nat)
   11.65 +  apply (auto simp add: fact_plus_one_nat)
   11.66  done
   11.67  
   11.68 -lemma int_fact_nonzero [simp]: "n >= 0 \<Longrightarrow> fact (n::int) ~= 0"
   11.69 +lemma fact_nonzero_int [simp]: "n >= 0 \<Longrightarrow> fact (n::int) ~= 0"
   11.70    by (simp add: fact_int_def)
   11.71  
   11.72 -lemma nat_fact_gt_zero [simp]: "fact (n :: nat) > 0"
   11.73 -  by (insert nat_fact_nonzero [of n], arith)
   11.74 +lemma fact_gt_zero_nat [simp]: "fact (n :: nat) > 0"
   11.75 +  by (insert fact_nonzero_nat [of n], arith)
   11.76  
   11.77 -lemma int_fact_gt_zero [simp]: "n >= 0 \<Longrightarrow> fact (n :: int) > 0"
   11.78 +lemma fact_gt_zero_int [simp]: "n >= 0 \<Longrightarrow> fact (n :: int) > 0"
   11.79    by (auto simp add: fact_int_def)
   11.80  
   11.81 -lemma nat_fact_ge_one [simp]: "fact (n :: nat) >= 1"
   11.82 -  by (insert nat_fact_nonzero [of n], arith)
   11.83 +lemma fact_ge_one_nat [simp]: "fact (n :: nat) >= 1"
   11.84 +  by (insert fact_nonzero_nat [of n], arith)
   11.85  
   11.86 -lemma nat_fact_ge_Suc_0 [simp]: "fact (n :: nat) >= Suc 0"
   11.87 -  by (insert nat_fact_nonzero [of n], arith)
   11.88 +lemma fact_ge_Suc_0_nat [simp]: "fact (n :: nat) >= Suc 0"
   11.89 +  by (insert fact_nonzero_nat [of n], arith)
   11.90  
   11.91 -lemma int_fact_ge_one [simp]: "n >= 0 \<Longrightarrow> fact (n :: int) >= 1"
   11.92 +lemma fact_ge_one_int [simp]: "n >= 0 \<Longrightarrow> fact (n :: int) >= 1"
   11.93    apply (auto simp add: fact_int_def)
   11.94    apply (subgoal_tac "1 = int 1")
   11.95    apply (erule ssubst)
   11.96 @@ -178,41 +178,41 @@
   11.97    apply auto
   11.98  done
   11.99  
  11.100 -lemma nat_dvd_fact [rule_format]: "1 <= m \<longrightarrow> m <= n \<longrightarrow> m dvd fact (n::nat)"
  11.101 -  apply (induct n rule: nat_induct')
  11.102 -  apply (auto simp add: nat_fact_plus_one)
  11.103 +lemma dvd_fact_nat [rule_format]: "1 <= m \<longrightarrow> m <= n \<longrightarrow> m dvd fact (n::nat)"
  11.104 +  apply (induct n rule: induct'_nat)
  11.105 +  apply (auto simp add: fact_plus_one_nat)
  11.106    apply (subgoal_tac "m = n + 1")
  11.107    apply auto
  11.108  done
  11.109  
  11.110 -lemma int_dvd_fact [rule_format]: "1 <= m \<longrightarrow> m <= n \<longrightarrow> m dvd fact (n::int)"
  11.111 +lemma dvd_fact_int [rule_format]: "1 <= m \<longrightarrow> m <= n \<longrightarrow> m dvd fact (n::int)"
  11.112    apply (case_tac "1 <= n")
  11.113    apply (induct n rule: int_ge_induct)
  11.114 -  apply (auto simp add: int_fact_plus_one)
  11.115 +  apply (auto simp add: fact_plus_one_int)
  11.116    apply (subgoal_tac "m = i + 1")
  11.117    apply auto
  11.118  done
  11.119  
  11.120 -lemma nat_interval_plus_one: "(i::nat) <= j + 1 \<Longrightarrow> 
  11.121 +lemma interval_plus_one_nat: "(i::nat) <= j + 1 \<Longrightarrow> 
  11.122    {i..j+1} = {i..j} Un {j+1}"
  11.123    by auto
  11.124  
  11.125 -lemma int_interval_plus_one: "(i::int) <= j + 1 \<Longrightarrow> {i..j+1} = {i..j} Un {j+1}"
  11.126 +lemma interval_plus_one_int: "(i::int) <= j + 1 \<Longrightarrow> {i..j+1} = {i..j} Un {j+1}"
  11.127    by auto
  11.128  
  11.129 -lemma nat_fact_altdef: "fact (n::nat) = (PROD i:{1..n}. i)"
  11.130 -  apply (induct n rule: nat_induct')
  11.131 +lemma fact_altdef_nat: "fact (n::nat) = (PROD i:{1..n}. i)"
  11.132 +  apply (induct n rule: induct'_nat)
  11.133    apply force
  11.134 -  apply (subst nat_fact_plus_one)
  11.135 -  apply (subst nat_interval_plus_one)
  11.136 +  apply (subst fact_plus_one_nat)
  11.137 +  apply (subst interval_plus_one_nat)
  11.138    apply auto
  11.139  done
  11.140  
  11.141 -lemma int_fact_altdef: "n >= 0 \<Longrightarrow> fact (n::int) = (PROD i:{1..n}. i)"
  11.142 +lemma fact_altdef_int: "n >= 0 \<Longrightarrow> fact (n::int) = (PROD i:{1..n}. i)"
  11.143    apply (induct n rule: int_ge_induct)
  11.144    apply force
  11.145 -  apply (subst int_fact_plus_one, assumption)
  11.146 -  apply (subst int_interval_plus_one)
  11.147 +  apply (subst fact_plus_one_int, assumption)
  11.148 +  apply (subst interval_plus_one_int)
  11.149    apply auto
  11.150  done
  11.151  
  11.152 @@ -220,8 +220,8 @@
  11.153  
  11.154  lemma next_prime_bound: "\<exists>(p::nat). prime p \<and> n < p \<and> p <= fact n + 1"
  11.155  proof-
  11.156 -  have f1: "fact n + 1 \<noteq> 1" using nat_fact_ge_one [of n] by arith 
  11.157 -  from nat_prime_factor [OF f1]
  11.158 +  have f1: "fact n + 1 \<noteq> 1" using fact_ge_one_nat [of n] by arith 
  11.159 +  from prime_factor_nat [OF f1]
  11.160        obtain p where "prime p" and "p dvd fact n + 1" by auto
  11.161    hence "p \<le> fact n + 1" 
  11.162      by (intro dvd_imp_le, auto)
  11.163 @@ -229,9 +229,9 @@
  11.164      from `prime p` have "p \<ge> 1" 
  11.165        by (cases p, simp_all)
  11.166      with `p <= n` have "p dvd fact n" 
  11.167 -      by (intro nat_dvd_fact)
  11.168 +      by (intro dvd_fact_nat)
  11.169      with `p dvd fact n + 1` have "p dvd fact n + 1 - fact n"
  11.170 -      by (rule nat_dvd_diff)
  11.171 +      by (rule dvd_diff_nat)
  11.172      hence "p dvd 1" by simp
  11.173      hence "p <= 1" by auto
  11.174      moreover from `prime p` have "p > 1" by auto
  11.175 @@ -256,95 +256,94 @@
  11.176  
  11.177  subsection {* Binomial coefficients *}
  11.178  
  11.179 -lemma nat_choose_zero [simp]: "(n::nat) choose 0 = 1"
  11.180 +lemma choose_zero_nat [simp]: "(n::nat) choose 0 = 1"
  11.181    by simp
  11.182  
  11.183 -lemma int_choose_zero [simp]: "n \<ge> 0 \<Longrightarrow> (n::int) choose 0 = 1"
  11.184 +lemma choose_zero_int [simp]: "n \<ge> 0 \<Longrightarrow> (n::int) choose 0 = 1"
  11.185    by (simp add: binomial_int_def)
  11.186  
  11.187 -lemma nat_zero_choose [rule_format,simp]: "ALL (k::nat) > n. n choose k = 0"
  11.188 -  by (induct n rule: nat_induct', auto)
  11.189 +lemma zero_choose_nat [rule_format,simp]: "ALL (k::nat) > n. n choose k = 0"
  11.190 +  by (induct n rule: induct'_nat, auto)
  11.191  
  11.192 -lemma int_zero_choose [rule_format,simp]: "(k::int) > n \<Longrightarrow> n choose k = 0"
  11.193 +lemma zero_choose_int [rule_format,simp]: "(k::int) > n \<Longrightarrow> n choose k = 0"
  11.194    unfolding binomial_int_def apply (case_tac "n < 0")
  11.195    apply force
  11.196    apply (simp del: binomial_nat.simps)
  11.197  done
  11.198  
  11.199 -lemma nat_choose_reduce: "(n::nat) > 0 \<Longrightarrow> 0 < k \<Longrightarrow>
  11.200 +lemma choose_reduce_nat: "(n::nat) > 0 \<Longrightarrow> 0 < k \<Longrightarrow>
  11.201      (n choose k) = ((n - 1) choose k) + ((n - 1) choose (k - 1))"
  11.202    by simp
  11.203  
  11.204 -lemma int_choose_reduce: "(n::int) > 0 \<Longrightarrow> 0 < k \<Longrightarrow>
  11.205 +lemma choose_reduce_int: "(n::int) > 0 \<Longrightarrow> 0 < k \<Longrightarrow>
  11.206      (n choose k) = ((n - 1) choose k) + ((n - 1) choose (k - 1))"
  11.207 -  unfolding binomial_int_def apply (subst nat_choose_reduce)
  11.208 +  unfolding binomial_int_def apply (subst choose_reduce_nat)
  11.209      apply (auto simp del: binomial_nat.simps 
  11.210        simp add: nat_diff_distrib)
  11.211  done
  11.212  
  11.213 -lemma nat_choose_plus_one: "((n::nat) + 1) choose (k + 1) = 
  11.214 +lemma choose_plus_one_nat: "((n::nat) + 1) choose (k + 1) = 
  11.215      (n choose (k + 1)) + (n choose k)"
  11.216 -  by (simp add: nat_choose_reduce)
  11.217 +  by (simp add: choose_reduce_nat)
  11.218  
  11.219 -lemma nat_choose_Suc: "(Suc n) choose (Suc k) = 
  11.220 +lemma choose_Suc_nat: "(Suc n) choose (Suc k) = 
  11.221      (n choose (Suc k)) + (n choose k)"
  11.222 -  by (simp add: nat_choose_reduce One_nat_def)
  11.223 +  by (simp add: choose_reduce_nat One_nat_def)
  11.224  
  11.225 -lemma int_choose_plus_one: "n \<ge> 0 \<Longrightarrow> k \<ge> 0 \<Longrightarrow> ((n::int) + 1) choose (k + 1) = 
  11.226 +lemma choose_plus_one_int: "n \<ge> 0 \<Longrightarrow> k \<ge> 0 \<Longrightarrow> ((n::int) + 1) choose (k + 1) = 
  11.227      (n choose (k + 1)) + (n choose k)"
  11.228 -  by (simp add: binomial_int_def nat_choose_plus_one nat_add_distrib 
  11.229 -    del: binomial_nat.simps)
  11.230 +  by (simp add: binomial_int_def choose_plus_one_nat nat_add_distrib del: binomial_nat.simps)
  11.231  
  11.232  declare binomial_nat.simps [simp del]
  11.233  
  11.234 -lemma nat_choose_self [simp]: "((n::nat) choose n) = 1"
  11.235 -  by (induct n rule: nat_induct', auto simp add: nat_choose_plus_one)
  11.236 +lemma choose_self_nat [simp]: "((n::nat) choose n) = 1"
  11.237 +  by (induct n rule: induct'_nat, auto simp add: choose_plus_one_nat)
  11.238  
  11.239 -lemma int_choose_self [simp]: "n \<ge> 0 \<Longrightarrow> ((n::int) choose n) = 1"
  11.240 +lemma choose_self_int [simp]: "n \<ge> 0 \<Longrightarrow> ((n::int) choose n) = 1"
  11.241    by (auto simp add: binomial_int_def)
  11.242  
  11.243 -lemma nat_choose_one [simp]: "(n::nat) choose 1 = n"
  11.244 -  by (induct n rule: nat_induct', auto simp add: nat_choose_reduce)
  11.245 +lemma choose_one_nat [simp]: "(n::nat) choose 1 = n"
  11.246 +  by (induct n rule: induct'_nat, auto simp add: choose_reduce_nat)
  11.247  
  11.248 -lemma int_choose_one [simp]: "n \<ge> 0 \<Longrightarrow> (n::int) choose 1 = n"
  11.249 +lemma choose_one_int [simp]: "n \<ge> 0 \<Longrightarrow> (n::int) choose 1 = n"
  11.250    by (auto simp add: binomial_int_def)
  11.251  
  11.252 -lemma nat_plus_one_choose_self [simp]: "(n::nat) + 1 choose n = n + 1"
  11.253 -  apply (induct n rule: nat_induct', force)
  11.254 +lemma plus_one_choose_self_nat [simp]: "(n::nat) + 1 choose n = n + 1"
  11.255 +  apply (induct n rule: induct'_nat, force)
  11.256    apply (case_tac "n = 0")
  11.257    apply auto
  11.258 -  apply (subst nat_choose_reduce)
  11.259 +  apply (subst choose_reduce_nat)
  11.260    apply (auto simp add: One_nat_def)  
  11.261    (* natdiff_cancel_numerals introduces Suc *)
  11.262  done
  11.263  
  11.264 -lemma nat_Suc_choose_self [simp]: "(Suc n) choose n = Suc n"
  11.265 -  using nat_plus_one_choose_self by (simp add: One_nat_def)
  11.266 +lemma Suc_choose_self_nat [simp]: "(Suc n) choose n = Suc n"
  11.267 +  using plus_one_choose_self_nat by (simp add: One_nat_def)
  11.268  
  11.269 -lemma int_plus_one_choose_self [rule_format, simp]: 
  11.270 +lemma plus_one_choose_self_int [rule_format, simp]: 
  11.271      "(n::int) \<ge> 0 \<longrightarrow> n + 1 choose n = n + 1"
  11.272     by (auto simp add: binomial_int_def nat_add_distrib)
  11.273  
  11.274  (* bounded quantification doesn't work with the unicode characters? *)
  11.275 -lemma nat_choose_pos [rule_format]: "ALL k <= (n::nat). 
  11.276 +lemma choose_pos_nat [rule_format]: "ALL k <= (n::nat). 
  11.277      ((n::nat) choose k) > 0"
  11.278 -  apply (induct n rule: nat_induct') 
  11.279 +  apply (induct n rule: induct'_nat) 
  11.280    apply force
  11.281    apply clarify
  11.282    apply (case_tac "k = 0")
  11.283    apply force
  11.284 -  apply (subst nat_choose_reduce)
  11.285 +  apply (subst choose_reduce_nat)
  11.286    apply auto
  11.287  done
  11.288  
  11.289 -lemma int_choose_pos: "n \<ge> 0 \<Longrightarrow> k >= 0 \<Longrightarrow> k \<le> n \<Longrightarrow>
  11.290 +lemma choose_pos_int: "n \<ge> 0 \<Longrightarrow> k >= 0 \<Longrightarrow> k \<le> n \<Longrightarrow>
  11.291      ((n::int) choose k) > 0"
  11.292 -  by (auto simp add: binomial_int_def nat_choose_pos)
  11.293 +  by (auto simp add: binomial_int_def choose_pos_nat)
  11.294  
  11.295  lemma binomial_induct [rule_format]: "(ALL (n::nat). P n n) \<longrightarrow> 
  11.296      (ALL n. P (n + 1) 0) \<longrightarrow> (ALL n. (ALL k < n. P n k \<longrightarrow> P n (k + 1) \<longrightarrow>
  11.297      P (n + 1) (k + 1))) \<longrightarrow> (ALL k <= n. P n k)"
  11.298 -  apply (induct n rule: nat_induct')
  11.299 +  apply (induct n rule: induct'_nat)
  11.300    apply auto
  11.301    apply (case_tac "k = 0")
  11.302    apply auto
  11.303 @@ -355,7 +354,7 @@
  11.304    apply auto
  11.305  done
  11.306  
  11.307 -lemma nat_choose_altdef_aux: "(k::nat) \<le> n \<Longrightarrow> 
  11.308 +lemma choose_altdef_aux_nat: "(k::nat) \<le> n \<Longrightarrow> 
  11.309      fact k * fact (n - k) * (n choose k) = fact n"
  11.310    apply (rule binomial_induct [of _ k n])
  11.311    apply auto
  11.312 @@ -364,22 +363,22 @@
  11.313    assume less: "k < n"
  11.314    assume ih1: "fact k * fact (n - k) * (n choose k) = fact n"
  11.315    hence one: "fact (k + 1) * fact (n - k) * (n choose k) = (k + 1) * fact n"
  11.316 -    by (subst nat_fact_plus_one, auto)
  11.317 +    by (subst fact_plus_one_nat, auto)
  11.318    assume ih2: "fact (k + 1) * fact (n - (k + 1)) * (n choose (k + 1)) = 
  11.319        fact n"
  11.320    with less have "fact (k + 1) * fact ((n - (k + 1)) + 1) * 
  11.321        (n choose (k + 1)) = (n - k) * fact n"
  11.322 -    by (subst (2) nat_fact_plus_one, auto)
  11.323 +    by (subst (2) fact_plus_one_nat, auto)
  11.324    with less have two: "fact (k + 1) * fact (n - k) * (n choose (k + 1)) = 
  11.325        (n - k) * fact n" by simp
  11.326    have "fact (k + 1) * fact (n - k) * (n + 1 choose (k + 1)) =
  11.327        fact (k + 1) * fact (n - k) * (n choose (k + 1)) + 
  11.328        fact (k + 1) * fact (n - k) * (n choose k)" 
  11.329 -    by (subst nat_choose_reduce, auto simp add: ring_simps)
  11.330 +    by (subst choose_reduce_nat, auto simp add: ring_simps)
  11.331    also note one
  11.332    also note two
  11.333    also with less have "(n - k) * fact n + (k + 1) * fact n= fact (n + 1)" 
  11.334 -    apply (subst nat_fact_plus_one)
  11.335 +    apply (subst fact_plus_one_nat)
  11.336      apply (subst left_distrib [symmetric])
  11.337      apply simp
  11.338      done
  11.339 @@ -387,43 +386,43 @@
  11.340      fact (n + 1)" .
  11.341  qed
  11.342  
  11.343 -lemma nat_choose_altdef: "(k::nat) \<le> n \<Longrightarrow> 
  11.344 +lemma choose_altdef_nat: "(k::nat) \<le> n \<Longrightarrow> 
  11.345      n choose k = fact n div (fact k * fact (n - k))"
  11.346 -  apply (frule nat_choose_altdef_aux)
  11.347 +  apply (frule choose_altdef_aux_nat)
  11.348    apply (erule subst)
  11.349    apply (simp add: mult_ac)
  11.350  done
  11.351  
  11.352  
  11.353 -lemma int_choose_altdef: 
  11.354 +lemma choose_altdef_int: 
  11.355    assumes "(0::int) <= k" and "k <= n"
  11.356    shows "n choose k = fact n div (fact k * fact (n - k))"
  11.357    
  11.358    apply (subst tsub_eq [symmetric], rule prems)
  11.359 -  apply (rule nat_choose_altdef [transferred])
  11.360 +  apply (rule choose_altdef_nat [transferred])
  11.361    using prems apply auto
  11.362  done
  11.363  
  11.364 -lemma nat_choose_dvd: "(k::nat) \<le> n \<Longrightarrow> fact k * fact (n - k) dvd fact n"
  11.365 -  unfolding dvd_def apply (frule nat_choose_altdef_aux)
  11.366 +lemma choose_dvd_nat: "(k::nat) \<le> n \<Longrightarrow> fact k * fact (n - k) dvd fact n"
  11.367 +  unfolding dvd_def apply (frule choose_altdef_aux_nat)
  11.368    (* why don't blast and auto get this??? *)
  11.369    apply (rule exI)
  11.370    apply (erule sym)
  11.371  done
  11.372  
  11.373 -lemma int_choose_dvd: 
  11.374 +lemma choose_dvd_int: 
  11.375    assumes "(0::int) <= k" and "k <= n"
  11.376    shows "fact k * fact (n - k) dvd fact n"
  11.377   
  11.378    apply (subst tsub_eq [symmetric], rule prems)
  11.379 -  apply (rule nat_choose_dvd [transferred])
  11.380 +  apply (rule choose_dvd_nat [transferred])
  11.381    using prems apply auto
  11.382  done
  11.383  
  11.384  (* generalizes Tobias Nipkow's proof to any commutative semiring *)
  11.385  theorem binomial: "(a+b::'a::{comm_ring_1,power})^n = 
  11.386    (SUM k=0..n. (of_nat (n choose k)) * a^k * b^(n-k))" (is "?P n")
  11.387 -proof (induct n rule: nat_induct')
  11.388 +proof (induct n rule: induct'_nat)
  11.389    show "?P 0" by simp
  11.390  next
  11.391    fix n
  11.392 @@ -455,7 +454,7 @@
  11.393        "... = a^(n+1) + b^(n+1) + 
  11.394           (SUM k=1..n. of_nat(n+1 choose k) * a^k * b^(n+1-k))"
  11.395      by (auto simp add: ring_simps setsum_addf [symmetric]
  11.396 -      nat_choose_reduce)
  11.397 +      choose_reduce_nat)
  11.398    also have "... = (SUM k=0..n+1. of_nat (n+1 choose k) * a^k * b^(n+1-k))"
  11.399      using decomp by (simp add: ring_simps)
  11.400    finally show "?P (n + 1)" by simp
  11.401 @@ -464,7 +463,7 @@
  11.402  lemma set_explicit: "{S. S = T \<and> P S} = (if P T then {T} else {})"
  11.403    by auto
  11.404  
  11.405 -lemma nat_card_subsets [rule_format]:
  11.406 +lemma card_subsets_nat [rule_format]:
  11.407    fixes S :: "'a set"
  11.408    assumes "finite S"
  11.409    shows "ALL k. card {T. T \<le> S \<and> card T = k} = card S choose k" 
  11.410 @@ -480,7 +479,7 @@
  11.411      fix k
  11.412      show "card {T. T \<subseteq> (insert x F) \<and> card T = k} = 
  11.413          card (insert x F) choose k" (is "?Q k")
  11.414 -    proof (induct k rule: nat_induct')
  11.415 +    proof (induct k rule: induct'_nat)
  11.416        from iassms have "{T. T \<le> (insert x F) \<and> card T = 0} = {{}}"
  11.417          apply auto
  11.418          apply (subst (asm) card_0_eq)
  11.419 @@ -530,7 +529,7 @@
  11.420            by auto
  11.421          finally have "card ({T. T \<le> insert x F \<and> card T = k + 1}) = 
  11.422            card F choose (k + 1) + (card F choose k)".
  11.423 -        with iassms nat_choose_plus_one show ?thesis
  11.424 +        with iassms choose_plus_one_nat show ?thesis
  11.425            by auto
  11.426        qed
  11.427      qed
    12.1 --- a/src/HOL/NewNumberTheory/Cong.thy	Tue Jul 07 07:56:24 2009 +0200
    12.2 +++ b/src/HOL/NewNumberTheory/Cong.thy	Tue Jul 07 17:39:51 2009 +0200
    12.3 @@ -35,18 +35,18 @@
    12.4  
    12.5  subsection {* Turn off One_nat_def *}
    12.6  
    12.7 -lemma nat_induct' [case_names zero plus1, induct type: nat]: 
    12.8 +lemma induct'_nat [case_names zero plus1, induct type: nat]: 
    12.9      "\<lbrakk> P (0::nat); !!n. P n \<Longrightarrow> P (n + 1)\<rbrakk> \<Longrightarrow> P n"
   12.10  by (erule nat_induct) (simp add:One_nat_def)
   12.11  
   12.12 -lemma nat_cases [case_names zero plus1, cases type: nat]: 
   12.13 +lemma cases_nat [case_names zero plus1, cases type: nat]: 
   12.14      "P (0::nat) \<Longrightarrow> (!!n. P (n + 1)) \<Longrightarrow> P n"
   12.15 -by(metis nat_induct')
   12.16 +by(metis induct'_nat)
   12.17  
   12.18  lemma power_plus_one [simp]: "(x::'a::power)^(n + 1) = x * x^n"
   12.19  by (simp add: One_nat_def)
   12.20  
   12.21 -lemma nat_power_eq_one_eq [simp]: 
   12.22 +lemma power_eq_one_eq_nat [simp]: 
   12.23    "((x::nat)^m = 1) = (m = 0 | x = 1)"
   12.24  by (induct m, auto)
   12.25  
   12.26 @@ -147,55 +147,55 @@
   12.27  subsection {* Congruence *}
   12.28  
   12.29  (* was zcong_0, etc. *)
   12.30 -lemma nat_cong_0 [simp, presburger]: "([(a::nat) = b] (mod 0)) = (a = b)"
   12.31 +lemma cong_0_nat [simp, presburger]: "([(a::nat) = b] (mod 0)) = (a = b)"
   12.32    by (unfold cong_nat_def, auto)
   12.33  
   12.34 -lemma int_cong_0 [simp, presburger]: "([(a::int) = b] (mod 0)) = (a = b)"
   12.35 +lemma cong_0_int [simp, presburger]: "([(a::int) = b] (mod 0)) = (a = b)"
   12.36    by (unfold cong_int_def, auto)
   12.37  
   12.38 -lemma nat_cong_1 [simp, presburger]: "[(a::nat) = b] (mod 1)"
   12.39 +lemma cong_1_nat [simp, presburger]: "[(a::nat) = b] (mod 1)"
   12.40    by (unfold cong_nat_def, auto)
   12.41  
   12.42 -lemma nat_cong_Suc_0 [simp, presburger]: "[(a::nat) = b] (mod Suc 0)"
   12.43 +lemma cong_Suc_0_nat [simp, presburger]: "[(a::nat) = b] (mod Suc 0)"
   12.44    by (unfold cong_nat_def, auto simp add: One_nat_def)
   12.45  
   12.46 -lemma int_cong_1 [simp, presburger]: "[(a::int) = b] (mod 1)"
   12.47 +lemma cong_1_int [simp, presburger]: "[(a::int) = b] (mod 1)"
   12.48    by (unfold cong_int_def, auto)
   12.49  
   12.50 -lemma nat_cong_refl [simp]: "[(k::nat) = k] (mod m)"
   12.51 +lemma cong_refl_nat [simp]: "[(k::nat) = k] (mod m)"
   12.52    by (unfold cong_nat_def, auto)
   12.53  
   12.54 -lemma int_cong_refl [simp]: "[(k::int) = k] (mod m)"
   12.55 +lemma cong_refl_int [simp]: "[(k::int) = k] (mod m)"
   12.56    by (unfold cong_int_def, auto)
   12.57  
   12.58 -lemma nat_cong_sym: "[(a::nat) = b] (mod m) \<Longrightarrow> [b = a] (mod m)"
   12.59 +lemma cong_sym_nat: "[(a::nat) = b] (mod m) \<Longrightarrow> [b = a] (mod m)"
   12.60    by (unfold cong_nat_def, auto)
   12.61  
   12.62 -lemma int_cong_sym: "[(a::int) = b] (mod m) \<Longrightarrow> [b = a] (mod m)"
   12.63 +lemma cong_sym_int: "[(a::int) = b] (mod m) \<Longrightarrow> [b = a] (mod m)"
   12.64    by (unfold cong_int_def, auto)
   12.65  
   12.66 -lemma nat_cong_sym_eq: "[(a::nat) = b] (mod m) = [b = a] (mod m)"
   12.67 +lemma cong_sym_eq_nat: "[(a::nat) = b] (mod m) = [b = a] (mod m)"
   12.68    by (unfold cong_nat_def, auto)
   12.69  
   12.70 -lemma int_cong_sym_eq: "[(a::int) = b] (mod m) = [b = a] (mod m)"
   12.71 +lemma cong_sym_eq_int: "[(a::int) = b] (mod m) = [b = a] (mod m)"
   12.72    by (unfold cong_int_def, auto)
   12.73  
   12.74 -lemma nat_cong_trans [trans]:
   12.75 +lemma cong_trans_nat [trans]:
   12.76      "[(a::nat) = b] (mod m) \<Longrightarrow> [b = c] (mod m) \<Longrightarrow> [a = c] (mod m)"
   12.77    by (unfold cong_nat_def, auto)
   12.78  
   12.79 -lemma int_cong_trans [trans]:
   12.80 +lemma cong_trans_int [trans]:
   12.81      "[(a::int) = b] (mod m) \<Longrightarrow> [b = c] (mod m) \<Longrightarrow> [a = c] (mod m)"
   12.82    by (unfold cong_int_def, auto)
   12.83  
   12.84 -lemma nat_cong_add:
   12.85 +lemma cong_add_nat:
   12.86      "[(a::nat) = b] (mod m) \<Longrightarrow> [c = d] (mod m) \<Longrightarrow> [a + c = b + d] (mod m)"
   12.87    apply (unfold cong_nat_def)
   12.88    apply (subst (1 2) mod_add_eq)
   12.89    apply simp
   12.90  done
   12.91  
   12.92 -lemma int_cong_add:
   12.93 +lemma cong_add_int:
   12.94      "[(a::int) = b] (mod m) \<Longrightarrow> [c = d] (mod m) \<Longrightarrow> [a + c = b + d] (mod m)"
   12.95    apply (unfold cong_int_def)
   12.96    apply (subst (1 2) mod_add_left_eq)
   12.97 @@ -203,35 +203,35 @@
   12.98    apply simp
   12.99  done
  12.100  
  12.101 -lemma int_cong_diff:
  12.102 +lemma cong_diff_int:
  12.103      "[(a::int) = b] (mod m) \<Longrightarrow> [c = d] (mod m) \<Longrightarrow> [a - c = b - d] (mod m)"
  12.104    apply (unfold cong_int_def)
  12.105    apply (subst (1 2) mod_diff_eq)
  12.106    apply simp
  12.107  done
  12.108  
  12.109 -lemma int_cong_diff_aux:
  12.110 +lemma cong_diff_aux_int:
  12.111    "(a::int) >= c \<Longrightarrow> b >= d \<Longrightarrow> [(a::int) = b] (mod m) \<Longrightarrow> 
  12.112        [c = d] (mod m) \<Longrightarrow> [tsub a c = tsub b d] (mod m)"
  12.113    apply (subst (1 2) tsub_eq)
  12.114 -  apply (auto intro: int_cong_diff)
  12.115 +  apply (auto intro: cong_diff_int)
  12.116  done;
  12.117  
  12.118 -lemma nat_cong_diff:
  12.119 +lemma cong_diff_nat:
  12.120    assumes "(a::nat) >= c" and "b >= d" and "[a = b] (mod m)" and
  12.121      "[c = d] (mod m)"
  12.122    shows "[a - c = b - d] (mod m)"
  12.123  
  12.124 -  using prems by (rule int_cong_diff_aux [transferred]);
  12.125 +  using prems by (rule cong_diff_aux_int [transferred]);
  12.126  
  12.127 -lemma nat_cong_mult:
  12.128 +lemma cong_mult_nat:
  12.129      "[(a::nat) = b] (mod m) \<Longrightarrow> [c = d] (mod m) \<Longrightarrow> [a * c = b * d] (mod m)"
  12.130    apply (unfold cong_nat_def)
  12.131    apply (subst (1 2) mod_mult_eq)
  12.132    apply simp
  12.133  done
  12.134  
  12.135 -lemma int_cong_mult:
  12.136 +lemma cong_mult_int:
  12.137      "[(a::int) = b] (mod m) \<Longrightarrow> [c = d] (mod m) \<Longrightarrow> [a * c = b * d] (mod m)"
  12.138    apply (unfold cong_int_def)
  12.139    apply (subst (1 2) zmod_zmult1_eq)
  12.140 @@ -240,197 +240,197 @@
  12.141    apply simp
  12.142  done
  12.143  
  12.144 -lemma nat_cong_exp: "[(x::nat) = y] (mod n) \<Longrightarrow> [x^k = y^k] (mod n)"
  12.145 +lemma cong_exp_nat: "[(x::nat) = y] (mod n) \<Longrightarrow> [x^k = y^k] (mod n)"
  12.146    apply (induct k)
  12.147 -  apply (auto simp add: nat_cong_refl nat_cong_mult)
  12.148 +  apply (auto simp add: cong_refl_nat cong_mult_nat)
  12.149  done
  12.150  
  12.151 -lemma int_cong_exp: "[(x::int) = y] (mod n) \<Longrightarrow> [x^k = y^k] (mod n)"
  12.152 +lemma cong_exp_int: "[(x::int) = y] (mod n) \<Longrightarrow> [x^k = y^k] (mod n)"
  12.153    apply (induct k)
  12.154 -  apply (auto simp add: int_cong_refl int_cong_mult)
  12.155 +  apply (auto simp add: cong_refl_int cong_mult_int)
  12.156  done
  12.157  
  12.158 -lemma nat_cong_setsum [rule_format]: 
  12.159 +lemma cong_setsum_nat [rule_format]: 
  12.160      "(ALL x: A. [((f x)::nat) = g x] (mod m)) \<longrightarrow> 
  12.161        [(SUM x:A. f x) = (SUM x:A. g x)] (mod m)"
  12.162    apply (case_tac "finite A")
  12.163    apply (induct set: finite)
  12.164 -  apply (auto intro: nat_cong_add)
  12.165 +  apply (auto intro: cong_add_nat)
  12.166  done
  12.167  
  12.168 -lemma int_cong_setsum [rule_format]:
  12.169 +lemma cong_setsum_int [rule_format]:
  12.170      "(ALL x: A. [((f x)::int) = g x] (mod m)) \<longrightarrow> 
  12.171        [(SUM x:A. f x) = (SUM x:A. g x)] (mod m)"
  12.172    apply (case_tac "finite A")
  12.173    apply (induct set: finite)
  12.174 -  apply (auto intro: int_cong_add)
  12.175 +  apply (auto intro: cong_add_int)
  12.176  done
  12.177  
  12.178 -lemma nat_cong_setprod [rule_format]: 
  12.179 +lemma cong_setprod_nat [rule_format]: 
  12.180      "(ALL x: A. [((f x)::nat) = g x] (mod m)) \<longrightarrow> 
  12.181        [(PROD x:A. f x) = (PROD x:A. g x)] (mod m)"
  12.182    apply (case_tac "finite A")
  12.183    apply (induct set: finite)
  12.184 -  apply (auto intro: nat_cong_mult)
  12.185 +  apply (auto intro: cong_mult_nat)
  12.186  done
  12.187  
  12.188 -lemma int_cong_setprod [rule_format]: 
  12.189 +lemma cong_setprod_int [rule_format]: 
  12.190      "(ALL x: A. [((f x)::int) = g x] (mod m)) \<longrightarrow> 
  12.191        [(PROD x:A. f x) = (PROD x:A. g x)] (mod m)"
  12.192    apply (case_tac "finite A")
  12.193    apply (induct set: finite)
  12.194 -  apply (auto intro: int_cong_mult)
  12.195 +  apply (auto intro: cong_mult_int)
  12.196  done
  12.197  
  12.198 -lemma nat_cong_scalar: "[(a::nat)= b] (mod m) \<Longrightarrow> [a * k = b * k] (mod m)"
  12.199 -  by (rule nat_cong_mult, simp_all)
  12.200 +lemma cong_scalar_nat: "[(a::nat)= b] (mod m) \<Longrightarrow> [a * k = b * k] (mod m)"
  12.201 +  by (rule cong_mult_nat, simp_all)
  12.202  
  12.203 -lemma int_cong_scalar: "[(a::int)= b] (mod m) \<Longrightarrow> [a * k = b * k] (mod m)"
  12.204 -  by (rule int_cong_mult, simp_all)
  12.205 +lemma cong_scalar_int: "[(a::int)= b] (mod m) \<Longrightarrow> [a * k = b * k] (mod m)"
  12.206 +  by (rule cong_mult_int, simp_all)
  12.207  
  12.208 -lemma nat_cong_scalar2: "[(a::nat)= b] (mod m) \<Longrightarrow> [k * a = k * b] (mod m)"
  12.209 -  by (rule nat_cong_mult, simp_all)
  12.210 +lemma cong_scalar2_nat: "[(a::nat)= b] (mod m) \<Longrightarrow> [k * a = k * b] (mod m)"
  12.211 +  by (rule cong_mult_nat, simp_all)
  12.212  
  12.213 -lemma int_cong_scalar2: "[(a::int)= b] (mod m) \<Longrightarrow> [k * a = k * b] (mod m)"
  12.214 -  by (rule int_cong_mult, simp_all)
  12.215 +lemma cong_scalar2_int: "[(a::int)= b] (mod m) \<Longrightarrow> [k * a = k * b] (mod m)"
  12.216 +  by (rule cong_mult_int, simp_all)
  12.217  
  12.218 -lemma nat_cong_mult_self: "[(a::nat) * m = 0] (mod m)"
  12.219 +lemma cong_mult_self_nat: "[(a::nat) * m = 0] (mod m)"
  12.220    by (unfold cong_nat_def, auto)
  12.221  
  12.222 -lemma int_cong_mult_self: "[(a::int) * m = 0] (mod m)"
  12.223 +lemma cong_mult_self_int: "[(a::int) * m = 0] (mod m)"
  12.224    by (unfold cong_int_def, auto)
  12.225  
  12.226 -lemma int_cong_eq_diff_cong_0: "[(a::int) = b] (mod m) = [a - b = 0] (mod m)"
  12.227 +lemma cong_eq_diff_cong_0_int: "[(a::int) = b] (mod m) = [a - b = 0] (mod m)"
  12.228    apply (rule iffI)
  12.229 -  apply (erule int_cong_diff [of a b m b b, simplified])
  12.230 -  apply (erule int_cong_add [of "a - b" 0 m b b, simplified])
  12.231 +  apply (erule cong_diff_int [of a b m b b, simplified])
  12.232 +  apply (erule cong_add_int [of "a - b" 0 m b b, simplified])
  12.233  done
  12.234  
  12.235 -lemma int_cong_eq_diff_cong_0_aux: "a >= b \<Longrightarrow>
  12.236 +lemma cong_eq_diff_cong_0_aux_int: "a >= b \<Longrightarrow>
  12.237      [(a::int) = b] (mod m) = [tsub a b = 0] (mod m)"
  12.238 -  by (subst tsub_eq, assumption, rule int_cong_eq_diff_cong_0)
  12.239 +  by (subst tsub_eq, assumption, rule cong_eq_diff_cong_0_int)
  12.240  
  12.241 -lemma nat_cong_eq_diff_cong_0:
  12.242 +lemma cong_eq_diff_cong_0_nat:
  12.243    assumes "(a::nat) >= b"
  12.244    shows "[a = b] (mod m) = [a - b = 0] (mod m)"
  12.245  
  12.246 -  using prems by (rule int_cong_eq_diff_cong_0_aux [transferred])
  12.247 +  using prems by (rule cong_eq_diff_cong_0_aux_int [transferred])
  12.248  
  12.249 -lemma nat_cong_diff_cong_0': 
  12.250 +lemma cong_diff_cong_0'_nat: 
  12.251    "[(x::nat) = y] (mod n) \<longleftrightarrow> 
  12.252      (if x <= y then [y - x = 0] (mod n) else [x - y = 0] (mod n))"
  12.253    apply (case_tac "y <= x")
  12.254 -  apply (frule nat_cong_eq_diff_cong_0 [where m = n])
  12.255 +  apply (frule cong_eq_diff_cong_0_nat [where m = n])
  12.256    apply auto [1]
  12.257    apply (subgoal_tac "x <= y")
  12.258 -  apply (frule nat_cong_eq_diff_cong_0 [where m = n])
  12.259 -  apply (subst nat_cong_sym_eq)
  12.260 +  apply (frule cong_eq_diff_cong_0_nat [where m = n])
  12.261 +  apply (subst cong_sym_eq_nat)
  12.262    apply auto
  12.263  done
  12.264  
  12.265 -lemma nat_cong_altdef: "(a::nat) >= b \<Longrightarrow> [a = b] (mod m) = (m dvd (a - b))"
  12.266 -  apply (subst nat_cong_eq_diff_cong_0, assumption)
  12.267 +lemma cong_altdef_nat: "(a::nat) >= b \<Longrightarrow> [a = b] (mod m) = (m dvd (a - b))"
  12.268 +  apply (subst cong_eq_diff_cong_0_nat, assumption)
  12.269    apply (unfold cong_nat_def)
  12.270    apply (simp add: dvd_eq_mod_eq_0 [symmetric])
  12.271  done
  12.272  
  12.273 -lemma int_cong_altdef: "[(a::int) = b] (mod m) = (m dvd (a - b))"
  12.274 -  apply (subst int_cong_eq_diff_cong_0)
  12.275 +lemma cong_altdef_int: "[(a::int) = b] (mod m) = (m dvd (a - b))"
  12.276 +  apply (subst cong_eq_diff_cong_0_int)
  12.277    apply (unfold cong_int_def)
  12.278    apply (simp add: dvd_eq_mod_eq_0 [symmetric])
  12.279  done
  12.280  
  12.281 -lemma int_cong_abs: "[(x::int) = y] (mod abs m) = [x = y] (mod m)"
  12.282 -  by (simp add: int_cong_altdef)
  12.283 +lemma cong_abs_int: "[(x::int) = y] (mod abs m) = [x = y] (mod m)"
  12.284 +  by (simp add: cong_altdef_int)
  12.285  
  12.286 -lemma int_cong_square:
  12.287 +lemma cong_square_int:
  12.288     "\<lbrakk> prime (p::int); 0 < a; [a * a = 1] (mod p) \<rbrakk>
  12.289      \<Longrightarrow> [a = 1] (mod p) \<or> [a = - 1] (mod p)"
  12.290 -  apply (simp only: int_cong_altdef)
  12.291 -  apply (subst int_prime_dvd_mult_eq [symmetric], assumption)
  12.292 +  apply (simp only: cong_altdef_int)
  12.293 +  apply (subst prime_dvd_mult_eq_int [symmetric], assumption)
  12.294    (* any way around this? *)
  12.295    apply (subgoal_tac "a * a - 1 = (a - 1) * (a - -1)")
  12.296    apply (auto simp add: ring_simps)
  12.297  done
  12.298  
  12.299 -lemma int_cong_mult_rcancel:
  12.300 +lemma cong_mult_rcancel_int:
  12.301    "coprime k (m::int) \<Longrightarrow> [a * k = b * k] (mod m) = [a = b] (mod m)"
  12.302 -  apply (subst (1 2) int_cong_altdef)
  12.303 +  apply (subst (1 2) cong_altdef_int)
  12.304    apply (subst left_diff_distrib [symmetric])
  12.305 -  apply (rule int_coprime_dvd_mult_iff)
  12.306 -  apply (subst int_gcd_commute, assumption)
  12.307 +  apply (rule coprime_dvd_mult_iff_int)
  12.308 +  apply (subst gcd_commute_int, assumption)
  12.309  done
  12.310  
  12.311 -lemma nat_cong_mult_rcancel:
  12.312 +lemma cong_mult_rcancel_nat:
  12.313    assumes  "coprime k (m::nat)"
  12.314    shows "[a * k = b * k] (mod m) = [a = b] (mod m)"
  12.315  
  12.316 -  apply (rule int_cong_mult_rcancel [transferred])
  12.317 +  apply (rule cong_mult_rcancel_int [transferred])
  12.318    using prems apply auto
  12.319  done
  12.320  
  12.321 -lemma nat_cong_mult_lcancel:
  12.322 +lemma cong_mult_lcancel_nat:
  12.323    "coprime k (m::nat) \<Longrightarrow> [k * a = k * b ] (mod m) = [a = b] (mod m)"
  12.324 -  by (simp add: mult_commute nat_cong_mult_rcancel)
  12.325 +  by (simp add: mult_commute cong_mult_rcancel_nat)
  12.326  
  12.327 -lemma int_cong_mult_lcancel:
  12.328 +lemma cong_mult_lcancel_int:
  12.329    "coprime k (m::int) \<Longrightarrow> [k * a = k * b] (mod m) = [a = b] (mod m)"
  12.330 -  by (simp add: mult_commute int_cong_mult_rcancel)
  12.331 +  by (simp add: mult_commute cong_mult_rcancel_int)
  12.332  
  12.333  (* was zcong_zgcd_zmult_zmod *)
  12.334 -lemma int_coprime_cong_mult:
  12.335 +lemma coprime_cong_mult_int:
  12.336    "[(a::int) = b] (mod m) \<Longrightarrow> [a = b] (mod n) \<Longrightarrow> coprime m n
  12.337      \<Longrightarrow> [a = b] (mod m * n)"
  12.338 -  apply (simp only: int_cong_altdef)
  12.339 -  apply (erule (2) int_divides_mult)
  12.340 +  apply (simp only: cong_altdef_int)
  12.341 +  apply (erule (2) divides_mult_int)
  12.342  done
  12.343  
  12.344 -lemma nat_coprime_cong_mult:
  12.345 +lemma coprime_cong_mult_nat:
  12.346    assumes "[(a::nat) = b] (mod m)" and "[a = b] (mod n)" and "coprime m n"
  12.347    shows "[a = b] (mod m * n)"
  12.348  
  12.349 -  apply (rule int_coprime_cong_mult [transferred])
  12.350 +  apply (rule coprime_cong_mult_int [transferred])
  12.351    using prems apply auto
  12.352  done
  12.353  
  12.354 -lemma nat_cong_less_imp_eq: "0 \<le> (a::nat) \<Longrightarrow>
  12.355 +lemma cong_less_imp_eq_nat: "0 \<le> (a::nat) \<Longrightarrow>
  12.356      a < m \<Longrightarrow> 0 \<le> b \<Longrightarrow> b < m \<Longrightarrow> [a = b] (mod m) \<Longrightarrow> a = b"
  12.357    by (auto simp add: cong_nat_def mod_pos_pos_trivial)
  12.358  
  12.359 -lemma int_cong_less_imp_eq: "0 \<le> (a::int) \<Longrightarrow>
  12.360 +lemma cong_less_imp_eq_int: "0 \<le> (a::int) \<Longrightarrow>
  12.361      a < m \<Longrightarrow> 0 \<le> b \<Longrightarrow> b < m \<Longrightarrow> [a = b] (mod m) \<Longrightarrow> a = b"
  12.362    by (auto simp add: cong_int_def mod_pos_pos_trivial)
  12.363  
  12.364 -lemma nat_cong_less_unique:
  12.365 +lemma cong_less_unique_nat:
  12.366      "0 < (m::nat) \<Longrightarrow> (\<exists>!b. 0 \<le> b \<and> b < m \<and> [a = b] (mod m))"
  12.367    apply auto
  12.368    apply (rule_tac x = "a mod m" in exI)
  12.369    apply (unfold cong_nat_def, auto)
  12.370  done
  12.371  
  12.372 -lemma int_cong_less_unique:
  12.373 +lemma cong_less_unique_int:
  12.374      "0 < (m::int) \<Longrightarrow> (\<exists>!b. 0 \<le> b \<and> b < m \<and> [a = b] (mod m))"
  12.375    apply auto
  12.376    apply (rule_tac x = "a mod m" in exI)
  12.377    apply (unfold cong_int_def, auto simp add: mod_pos_pos_trivial)
  12.378  done
  12.379  
  12.380 -lemma int_cong_iff_lin: "([(a::int) = b] (mod m)) = (\<exists>k. b = a + m * k)"
  12.381 -  apply (auto simp add: int_cong_altdef dvd_def ring_simps)
  12.382 +lemma cong_iff_lin_int: "([(a::int) = b] (mod m)) = (\<exists>k. b = a + m * k)"
  12.383 +  apply (auto simp add: cong_altdef_int dvd_def ring_simps)
  12.384    apply (rule_tac [!] x = "-k" in exI, auto)
  12.385  done
  12.386  
  12.387 -lemma nat_cong_iff_lin: "([(a::nat) = b] (mod m)) = 
  12.388 +lemma cong_iff_lin_nat: "([(a::nat) = b] (mod m)) = 
  12.389      (\<exists>k1 k2. b + k1 * m = a + k2 * m)"
  12.390    apply (rule iffI)
  12.391    apply (case_tac "b <= a")
  12.392 -  apply (subst (asm) nat_cong_altdef, assumption)
  12.393 +  apply (subst (asm) cong_altdef_nat, assumption)
  12.394    apply (unfold dvd_def, auto)
  12.395    apply (rule_tac x = k in exI)
  12.396    apply (rule_tac x = 0 in exI)
  12.397    apply (auto simp add: ring_simps)
  12.398 -  apply (subst (asm) nat_cong_sym_eq)
  12.399 -  apply (subst (asm) nat_cong_altdef)
  12.400 +  apply (subst (asm) cong_sym_eq_nat)
  12.401 +  apply (subst (asm) cong_altdef_nat)
  12.402    apply force
  12.403    apply (unfold dvd_def, auto)
  12.404    apply (rule_tac x = 0 in exI)
  12.405 @@ -443,50 +443,50 @@
  12.406    apply auto
  12.407  done
  12.408  
  12.409 -lemma int_cong_gcd_eq: "[(a::int) = b] (mod m) \<Longrightarrow> gcd a m = gcd b m"
  12.410 -  apply (subst (asm) int_cong_iff_lin, auto)
  12.411 +lemma cong_gcd_eq_int: "[(a::int) = b] (mod m) \<Longrightarrow> gcd a m = gcd b m"
  12.412 +  apply (subst (asm) cong_iff_lin_int, auto)
  12.413    apply (subst add_commute) 
  12.414 -  apply (subst (2) int_gcd_commute)
  12.415 +  apply (subst (2) gcd_commute_int)
  12.416    apply (subst mult_commute)
  12.417 -  apply (subst int_gcd_add_mult)
  12.418 -  apply (rule int_gcd_commute)
  12.419 +  apply (subst gcd_add_mult_int)
  12.420 +  apply (rule gcd_commute_int)
  12.421  done
  12.422  
  12.423 -lemma nat_cong_gcd_eq: 
  12.424 +lemma cong_gcd_eq_nat: 
  12.425    assumes "[(a::nat) = b] (mod m)"
  12.426    shows "gcd a m = gcd b m"
  12.427  
  12.428 -  apply (rule int_cong_gcd_eq [transferred])
  12.429 +  apply (rule cong_gcd_eq_int [transferred])
  12.430    using prems apply auto
  12.431  done
  12.432  
  12.433 -lemma nat_cong_imp_coprime: "[(a::nat) = b] (mod m) \<Longrightarrow> coprime a m \<Longrightarrow> 
  12.434 +lemma cong_imp_coprime_nat: "[(a::nat) = b] (mod m) \<Longrightarrow> coprime a m \<Longrightarrow> 
  12.435      coprime b m"
  12.436 -  by (auto simp add: nat_cong_gcd_eq)
  12.437 +  by (auto simp add: cong_gcd_eq_nat)
  12.438  
  12.439 -lemma int_cong_imp_coprime: "[(a::int) = b] (mod m) \<Longrightarrow> coprime a m \<Longrightarrow> 
  12.440 +lemma cong_imp_coprime_int: "[(a::int) = b] (mod m) \<Longrightarrow> coprime a m \<Longrightarrow> 
  12.441      coprime b m"
  12.442 -  by (auto simp add: int_cong_gcd_eq)
  12.443 +  by (auto simp add: cong_gcd_eq_int)
  12.444  
  12.445 -lemma nat_cong_cong_mod: "[(a::nat) = b] (mod m) = 
  12.446 +lemma cong_cong_mod_nat: "[(a::nat) = b] (mod m) = 
  12.447      [a mod m = b mod m] (mod m)"
  12.448    by (auto simp add: cong_nat_def)
  12.449  
  12.450 -lemma int_cong_cong_mod: "[(a::int) = b] (mod m) = 
  12.451 +lemma cong_cong_mod_int: "[(a::int) = b] (mod m) = 
  12.452      [a mod m = b mod m] (mod m)"
  12.453    by (auto simp add: cong_int_def)
  12.454  
  12.455 -lemma int_cong_minus [iff]: "[(a::int) = b] (mod -m) = [a = b] (mod m)"
  12.456 -  by (subst (1 2) int_cong_altdef, auto)
  12.457 +lemma cong_minus_int [iff]: "[(a::int) = b] (mod -m) = [a = b] (mod m)"
  12.458 +  by (subst (1 2) cong_altdef_int, auto)
  12.459  
  12.460 -lemma nat_cong_zero [iff]: "[(a::nat) = b] (mod 0) = (a = b)"
  12.461 +lemma cong_zero_nat [iff]: "[(a::nat) = b] (mod 0) = (a = b)"
  12.462    by (auto simp add: cong_nat_def)
  12.463  
  12.464 -lemma int_cong_zero [iff]: "[(a::int) = b] (mod 0) = (a = b)"
  12.465 +lemma cong_zero_int [iff]: "[(a::int) = b] (mod 0) = (a = b)"
  12.466    by (auto simp add: cong_int_def)
  12.467  
  12.468  (*
  12.469 -lemma int_mod_dvd_mod:
  12.470 +lemma mod_dvd_mod_int:
  12.471      "0 < (m::int) \<Longrightarrow> m dvd b \<Longrightarrow> (a mod b mod m) = (a mod m)"
  12.472    apply (unfold dvd_def, auto)
  12.473    apply (rule mod_mod_cancel)
  12.474 @@ -497,79 +497,79 @@
  12.475    assumes "0 < (m::nat)" and "m dvd b"
  12.476    shows "(a mod b mod m) = (a mod m)"
  12.477  
  12.478 -  apply (rule int_mod_dvd_mod [transferred])
  12.479 +  apply (rule mod_dvd_mod_int [transferred])
  12.480    using prems apply auto
  12.481  done
  12.482  *)
  12.483  
  12.484 -lemma nat_cong_add_lcancel: 
  12.485 +lemma cong_add_lcancel_nat: 
  12.486      "[(a::nat) + x = a + y] (mod n) \<longleftrightarrow> [x = y] (mod n)" 
  12.487 -  by (simp add: nat_cong_iff_lin)
  12.488 +  by (simp add: cong_iff_lin_nat)
  12.489  
  12.490 -lemma int_cong_add_lcancel: 
  12.491 +lemma cong_add_lcancel_int: 
  12.492      "[(a::int) + x = a + y] (mod n) \<longleftrightarrow> [x = y] (mod n)" 
  12.493 -  by (simp add: int_cong_iff_lin)
  12.494 +  by (simp add: cong_iff_lin_int)
  12.495  
  12.496 -lemma nat_cong_add_rcancel: "[(x::nat) + a = y + a] (mod n) \<longleftrightarrow> [x = y] (mod n)"
  12.497 -  by (simp add: nat_cong_iff_lin)
  12.498 +lemma cong_add_rcancel_nat: "[(x::nat) + a = y + a] (mod n) \<longleftrightarrow> [x = y] (mod n)"
  12.499 +  by (simp add: cong_iff_lin_nat)
  12.500  
  12.501 -lemma int_cong_add_rcancel: "[(x::int) + a = y + a] (mod n) \<longleftrightarrow> [x = y] (mod n)"
  12.502 -  by (simp add: int_cong_iff_lin)
  12.503 +lemma cong_add_rcancel_int: "[(x::int) + a = y + a] (mod n) \<longleftrightarrow> [x = y] (mod n)"
  12.504 +  by (simp add: cong_iff_lin_int)
  12.505  
  12.506 -lemma nat_cong_add_lcancel_0: "[(a::nat) + x = a] (mod n) \<longleftrightarrow> [x = 0] (mod n)" 
  12.507 -  by (simp add: nat_cong_iff_lin)
  12.508 +lemma cong_add_lcancel_0_nat: "[(a::nat) + x = a] (mod n) \<longleftrightarrow> [x = 0] (mod n)" 
  12.509 +  by (simp add: cong_iff_lin_nat)
  12.510  
  12.511 -lemma int_cong_add_lcancel_0: "[(a::int) + x = a] (mod n) \<longleftrightarrow> [x = 0] (mod n)" 
  12.512 -  by (simp add: int_cong_iff_lin)
  12.513 +lemma cong_add_lcancel_0_int: "[(a::int) + x = a] (mod n) \<longleftrightarrow> [x = 0] (mod n)" 
  12.514 +  by (simp add: cong_iff_lin_int)
  12.515  
  12.516 -lemma nat_cong_add_rcancel_0: "[x + (a::nat) = a] (mod n) \<longleftrightarrow> [x = 0] (mod n)" 
  12.517 -  by (simp add: nat_cong_iff_lin)
  12.518 +lemma cong_add_rcancel_0_nat: "[x + (a::nat) = a] (mod n) \<longleftrightarrow> [x = 0] (mod n)" 
  12.519 +  by (simp add: cong_iff_lin_nat)
  12.520  
  12.521 -lemma int_cong_add_rcancel_0: "[x + (a::int) = a] (mod n) \<longleftrightarrow> [x = 0] (mod n)" 
  12.522 -  by (simp add: int_cong_iff_lin)
  12.523 +lemma cong_add_rcancel_0_int: "[x + (a::int) = a] (mod n) \<longleftrightarrow> [x = 0] (mod n)" 
  12.524 +  by (simp add: cong_iff_lin_int)
  12.525  
  12.526 -lemma nat_cong_dvd_modulus: "[(x::nat) = y] (mod m) \<Longrightarrow> n dvd m \<Longrightarrow> 
  12.527 +lemma cong_dvd_modulus_nat: "[(x::nat) = y] (mod m) \<Longrightarrow> n dvd m \<Longrightarrow> 
  12.528      [x = y] (mod n)"
  12.529 -  apply (auto simp add: nat_cong_iff_lin dvd_def)
  12.530 +  apply (auto simp add: cong_iff_lin_nat dvd_def)
  12.531    apply (rule_tac x="k1 * k" in exI)
  12.532    apply (rule_tac x="k2 * k" in exI)
  12.533    apply (simp add: ring_simps)
  12.534  done
  12.535  
  12.536 -lemma int_cong_dvd_modulus: "[(x::int) = y] (mod m) \<Longrightarrow> n dvd m \<Longrightarrow> 
  12.537 +lemma cong_dvd_modulus_int: "[(x::int) = y] (mod m) \<Longrightarrow> n dvd m \<Longrightarrow> 
  12.538      [x = y] (mod n)"
  12.539 -  by (auto simp add: int_cong_altdef dvd_def)
  12.540 +  by (auto simp add: cong_altdef_int dvd_def)
  12.541  
  12.542 -lemma nat_cong_dvd_eq: "[(x::nat) = y] (mod n) \<Longrightarrow> n dvd x \<longleftrightarrow> n dvd y"
  12.543 +lemma cong_dvd_eq_nat: "[(x::nat) = y] (mod n) \<Longrightarrow> n dvd x \<longleftrightarrow> n dvd y"
  12.544    by (unfold cong_nat_def, auto simp add: dvd_eq_mod_eq_0)
  12.545  
  12.546 -lemma int_cong_dvd_eq: "[(x::int) = y] (mod n) \<Longrightarrow> n dvd x \<longleftrightarrow> n dvd y"
  12.547 +lemma cong_dvd_eq_int: "[(x::int) = y] (mod n) \<Longrightarrow> n dvd x \<longleftrightarrow> n dvd y"
  12.548    by (unfold cong_int_def, auto simp add: dvd_eq_mod_eq_0)
  12.549  
  12.550 -lemma nat_cong_mod: "(n::nat) ~= 0 \<Longrightarrow> [a mod n = a] (mod n)" 
  12.551 +lemma cong_mod_nat: "(n::nat) ~= 0 \<Longrightarrow> [a mod n = a] (mod n)" 
  12.552    by (simp add: cong_nat_def)
  12.553  
  12.554 -lemma int_cong_mod: "(n::int) ~= 0 \<Longrightarrow> [a mod n = a] (mod n)" 
  12.555 +lemma cong_mod_int: "(n::int) ~= 0 \<Longrightarrow> [a mod n = a] (mod n)" 
  12.556    by (simp add: cong_int_def)
  12.557  
  12.558 -lemma nat_mod_mult_cong: "(a::nat) ~= 0 \<Longrightarrow> b ~= 0 
  12.559 +lemma mod_mult_cong_nat: "(a::nat) ~= 0 \<Longrightarrow> b ~= 0 
  12.560      \<Longrightarrow> [x mod (a * b) = y] (mod a) \<longleftrightarrow> [x = y] (mod a)"
  12.561    by (simp add: cong_nat_def mod_mult2_eq  mod_add_left_eq)
  12.562  
  12.563 -lemma int_neg_cong: "([(a::int) = b] (mod m)) = ([-a = -b] (mod m))"
  12.564 -  apply (simp add: int_cong_altdef)
  12.565 +lemma neg_cong_int: "([(a::int) = b] (mod m)) = ([-a = -b] (mod m))"
  12.566 +  apply (simp add: cong_altdef_int)
  12.567    apply (subst dvd_minus_iff [symmetric])
  12.568    apply (simp add: ring_simps)
  12.569  done
  12.570  
  12.571 -lemma int_cong_modulus_neg: "([(a::int) = b] (mod m)) = ([a = b] (mod -m))"
  12.572 -  by (auto simp add: int_cong_altdef)
  12.573 +lemma cong_modulus_neg_int: "([(a::int) = b] (mod m)) = ([a = b] (mod -m))"
  12.574 +  by (auto simp add: cong_altdef_int)
  12.575  
  12.576 -lemma int_mod_mult_cong: "(a::int) ~= 0 \<Longrightarrow> b ~= 0 
  12.577 +lemma mod_mult_cong_int: "(a::int) ~= 0 \<Longrightarrow> b ~= 0 
  12.578      \<Longrightarrow> [x mod (a * b) = y] (mod a) \<longleftrightarrow> [x = y] (mod a)"
  12.579    apply (case_tac "b > 0")
  12.580    apply (simp add: cong_int_def mod_mod_cancel mod_add_left_eq)
  12.581 -  apply (subst (1 2) int_cong_modulus_neg)
  12.582 +  apply (subst (1 2) cong_modulus_neg_int)
  12.583    apply (unfold cong_int_def)
  12.584    apply (subgoal_tac "a * b = (-a * -b)")
  12.585    apply (erule ssubst)
  12.586 @@ -577,89 +577,89 @@
  12.587    apply (auto simp add: mod_add_left_eq) 
  12.588  done
  12.589  
  12.590 -lemma nat_cong_to_1: "([(a::nat) = 1] (mod n)) \<Longrightarrow> (n dvd (a - 1))"
  12.591 +lemma cong_to_1_nat: "([(a::nat) = 1] (mod n)) \<Longrightarrow> (n dvd (a - 1))"
  12.592    apply (case_tac "a = 0")
  12.593    apply force
  12.594 -  apply (subst (asm) nat_cong_altdef)
  12.595 +  apply (subst (asm) cong_altdef_nat)
  12.596    apply auto
  12.597  done
  12.598  
  12.599 -lemma nat_0_cong_1: "[(0::nat) = 1] (mod n) = (n = 1)"
  12.600 +lemma cong_0_1_nat: "[(0::nat) = 1] (mod n) = (n = 1)"
  12.601    by (unfold cong_nat_def, auto)
  12.602  
  12.603 -lemma int_0_cong_1: "[(0::int) = 1] (mod n) = ((n = 1) | (n = -1))"
  12.604 +lemma cong_0_1_int: "[(0::int) = 1] (mod n) = ((n = 1) | (n = -1))"
  12.605    by (unfold cong_int_def, auto simp add: zmult_eq_1_iff)
  12.606  
  12.607 -lemma nat_cong_to_1': "[(a::nat) = 1] (mod n) \<longleftrightarrow> 
  12.608 +lemma cong_to_1'_nat: "[(a::nat) = 1] (mod n) \<longleftrightarrow> 
  12.609      a = 0 \<and> n = 1 \<or> (\<exists>m. a = 1 + m * n)"
  12.610    apply (case_tac "n = 1")
  12.611    apply auto [1]
  12.612    apply (drule_tac x = "a - 1" in spec)
  12.613    apply force
  12.614    apply (case_tac "a = 0")
  12.615 -  apply (auto simp add: nat_0_cong_1) [1]
  12.616 +  apply (auto simp add: cong_0_1_nat) [1]
  12.617    apply (rule iffI)
  12.618 -  apply (drule nat_cong_to_1)
  12.619 +  apply (drule cong_to_1_nat)
  12.620    apply (unfold dvd_def)
  12.621    apply auto [1]
  12.622    apply (rule_tac x = k in exI)
  12.623    apply (auto simp add: ring_simps) [1]
  12.624 -  apply (subst nat_cong_altdef)
  12.625 +  apply (subst cong_altdef_nat)
  12.626    apply (auto simp add: dvd_def)
  12.627  done
  12.628  
  12.629 -lemma nat_cong_le: "(y::nat) <= x \<Longrightarrow> [x = y] (mod n) \<longleftrightarrow> (\<exists>q. x = q * n + y)"
  12.630 -  apply (subst nat_cong_altdef)
  12.631 +lemma cong_le_nat: "(y::nat) <= x \<Longrightarrow> [x = y] (mod n) \<longleftrightarrow> (\<exists>q. x = q * n + y)"
  12.632 +  apply (subst cong_altdef_nat)
  12.633    apply assumption
  12.634    apply (unfold dvd_def, auto simp add: ring_simps)
  12.635    apply (rule_tac x = k in exI)
  12.636    apply auto
  12.637  done
  12.638  
  12.639 -lemma nat_cong_solve: "(a::nat) \<noteq> 0 \<Longrightarrow> EX x. [a * x = gcd a n] (mod n)"
  12.640 +lemma cong_solve_nat: "(a::nat) \<noteq> 0 \<Longrightarrow> EX x. [a * x = gcd a n] (mod n)"
  12.641    apply (case_tac "n = 0")
  12.642    apply force
  12.643 -  apply (frule nat_bezout [of a n], auto)
  12.644 +  apply (frule bezout_nat [of a n], auto)
  12.645    apply (rule exI, erule ssubst)
  12.646 -  apply (rule nat_cong_trans)
  12.647 -  apply (rule nat_cong_add)
  12.648 +  apply (rule cong_trans_nat)
  12.649 +  apply (rule cong_add_nat)
  12.650    apply (subst mult_commute)
  12.651 -  apply (rule nat_cong_mult_self)
  12.652 +  apply (rule cong_mult_self_nat)
  12.653    prefer 2
  12.654    apply simp
  12.655 -  apply (rule nat_cong_refl)
  12.656 -  apply (rule nat_cong_refl)
  12.657 +  apply (rule cong_refl_nat)
  12.658 +  apply (rule cong_refl_nat)
  12.659  done
  12.660  
  12.661 -lemma int_cong_solve: "(a::int) \<noteq> 0 \<Longrightarrow> EX x. [a * x = gcd a n] (mod n)"
  12.662 +lemma cong_solve_int: "(a::int) \<noteq> 0 \<Longrightarrow> EX x. [a * x = gcd a n] (mod n)"
  12.663    apply (case_tac "n = 0")
  12.664    apply (case_tac "a \<ge> 0")
  12.665    apply auto
  12.666    apply (rule_tac x = "-1" in exI)
  12.667    apply auto
  12.668 -  apply (insert int_bezout [of a n], auto)
  12.669 +  apply (insert bezout_int [of a n], auto)
  12.670    apply (rule exI)
  12.671    apply (erule subst)
  12.672 -  apply (rule int_cong_trans)
  12.673 +  apply (rule cong_trans_int)
  12.674    prefer 2
  12.675 -  apply (rule int_cong_add)
  12.676 -  apply (rule int_cong_refl)
  12.677 -  apply (rule int_cong_sym)
  12.678 -  apply (rule int_cong_mult_self)
  12.679 +  apply (rule cong_add_int)
  12.680 +  apply (rule cong_refl_int)
  12.681 +  apply (rule cong_sym_int)
  12.682 +  apply (rule cong_mult_self_int)
  12.683    apply simp
  12.684    apply (subst mult_commute)
  12.685 -  apply (rule int_cong_refl)
  12.686 +  apply (rule cong_refl_int)
  12.687  done
  12.688    
  12.689 -lemma nat_cong_solve_dvd: 
  12.690 +lemma cong_solve_dvd_nat: 
  12.691    assumes a: "(a::nat) \<noteq> 0" and b: "gcd a n dvd d"
  12.692    shows "EX x. [a * x = d] (mod n)"
  12.693  proof -
  12.694 -  from nat_cong_solve [OF a] obtain x where 
  12.695 +  from cong_solve_nat [OF a] obtain x where 
  12.696        "[a * x = gcd a n](mod n)"
  12.697      by auto
  12.698    hence "[(d div gcd a n) * (a * x) = (d div gcd a n) * gcd a n] (mod n)" 
  12.699 -    by (elim nat_cong_scalar2)
  12.700 +    by (elim cong_scalar2_nat)
  12.701    also from b have "(d div gcd a n) * gcd a n = d"
  12.702      by (rule dvd_div_mult_self)
  12.703    also have "(d div gcd a n) * (a * x) = a * (d div gcd a n * x)"
  12.704 @@ -668,15 +668,15 @@
  12.705      by auto
  12.706  qed
  12.707  
  12.708 -lemma int_cong_solve_dvd: 
  12.709 +lemma cong_solve_dvd_int: 
  12.710    assumes a: "(a::int) \<noteq> 0" and b: "gcd a n dvd d"
  12.711    shows "EX x. [a * x = d] (mod n)"
  12.712  proof -
  12.713 -  from int_cong_solve [OF a] obtain x where 
  12.714 +  from cong_solve_int [OF a] obtain x where 
  12.715        "[a * x = gcd a n](mod n)"
  12.716      by auto
  12.717    hence "[(d div gcd a n) * (a * x) = (d div gcd a n) * gcd a n] (mod n)" 
  12.718 -    by (elim int_cong_scalar2)
  12.719 +    by (elim cong_scalar2_int)
  12.720    also from b have "(d div gcd a n) * gcd a n = d"
  12.721      by (rule dvd_div_mult_self)
  12.722    also have "(d div gcd a n) * (a * x) = a * (d div gcd a n * x)"
  12.723 @@ -685,41 +685,41 @@
  12.724      by auto
  12.725  qed
  12.726  
  12.727 -lemma nat_cong_solve_coprime: "coprime (a::nat) n \<Longrightarrow> 
  12.728 +lemma cong_solve_coprime_nat: "coprime (a::nat) n \<Longrightarrow> 
  12.729      EX x. [a * x = 1] (mod n)"
  12.730    apply (case_tac "a = 0")
  12.731    apply force
  12.732 -  apply (frule nat_cong_solve [of a n])
  12.733 +  apply (frule cong_solve_nat [of a n])
  12.734    apply auto
  12.735  done
  12.736  
  12.737 -lemma int_cong_solve_coprime: "coprime (a::int) n \<Longrightarrow> 
  12.738 +lemma cong_solve_coprime_int: "coprime (a::int) n \<Longrightarrow> 
  12.739      EX x. [a * x = 1] (mod n)"
  12.740    apply (case_tac "a = 0")
  12.741    apply auto
  12.742    apply (case_tac "n \<ge> 0")
  12.743    apply auto
  12.744    apply (subst cong_int_def, auto)
  12.745 -  apply (frule int_cong_solve [of a n])
  12.746 +  apply (frule cong_solve_int [of a n])
  12.747    apply auto
  12.748  done
  12.749  
  12.750 -lemma nat_coprime_iff_invertible: "m > (1::nat) \<Longrightarrow> coprime a m = 
  12.751 +lemma coprime_iff_invertible_nat: "m > (1::nat) \<Longrightarrow> coprime a m = 
  12.752      (EX x. [a * x = 1] (mod m))"
  12.753 -  apply (auto intro: nat_cong_solve_coprime)
  12.754 -  apply (unfold cong_nat_def, auto intro: nat_invertible_coprime)
  12.755 +  apply (auto intro: cong_solve_coprime_nat)
  12.756 +  apply (unfold cong_nat_def, auto intro: invertible_coprime_nat)
  12.757  done
  12.758  
  12.759 -lemma int_coprime_iff_invertible: "m > (1::int) \<Longrightarrow> coprime a m = 
  12.760 +lemma coprime_iff_invertible_int: "m > (1::int) \<Longrightarrow> coprime a m = 
  12.761      (EX x. [a * x = 1] (mod m))"
  12.762 -  apply (auto intro: int_cong_solve_coprime)
  12.763 +  apply (auto intro: cong_solve_coprime_int)
  12.764    apply (unfold cong_int_def)
  12.765 -  apply (auto intro: int_invertible_coprime)
  12.766 +  apply (auto intro: invertible_coprime_int)
  12.767  done
  12.768  
  12.769 -lemma int_coprime_iff_invertible': "m > (1::int) \<Longrightarrow> coprime a m = 
  12.770 +lemma coprime_iff_invertible'_int: "m > (1::int) \<Longrightarrow> coprime a m = 
  12.771      (EX x. 0 <= x & x < m & [a * x = 1] (mod m))"
  12.772 -  apply (subst int_coprime_iff_invertible)
  12.773 +  apply (subst coprime_iff_invertible_int)
  12.774    apply auto
  12.775    apply (auto simp add: cong_int_def)
  12.776    apply (rule_tac x = "x mod m" in exI)
  12.777 @@ -727,200 +727,200 @@
  12.778  done
  12.779  
  12.780  
  12.781 -lemma nat_cong_cong_lcm: "[(x::nat) = y] (mod a) \<Longrightarrow>
  12.782 +lemma cong_cong_lcm_nat: "[(x::nat) = y] (mod a) \<Longrightarrow>
  12.783      [x = y] (mod b) \<Longrightarrow> [x = y] (mod lcm a b)"
  12.784    apply (case_tac "y \<le> x")
  12.785 -  apply (auto simp add: nat_cong_altdef nat_lcm_least) [1]
  12.786 -  apply (rule nat_cong_sym)
  12.787 -  apply (subst (asm) (1 2) nat_cong_sym_eq)
  12.788 -  apply (auto simp add: nat_cong_altdef nat_lcm_least)
  12.789 +  apply (auto simp add: cong_altdef_nat lcm_least_nat) [1]
  12.790 +  apply (rule cong_sym_nat)
  12.791 +  apply (subst (asm) (1 2) cong_sym_eq_nat)
  12.792 +  apply (auto simp add: cong_altdef_nat lcm_least_nat)
  12.793  done
  12.794  
  12.795 -lemma int_cong_cong_lcm: "[(x::int) = y] (mod a) \<Longrightarrow>
  12.796 +lemma cong_cong_lcm_int: "[(x::int) = y] (mod a) \<Longrightarrow>
  12.797      [x = y] (mod b) \<Longrightarrow> [x = y] (mod lcm a b)"
  12.798 -  by (auto simp add: int_cong_altdef int_lcm_least) [1]
  12.799 +  by (auto simp add: cong_altdef_int lcm_least_int) [1]
  12.800  
  12.801 -lemma nat_cong_cong_coprime: "coprime a b \<Longrightarrow> [(x::nat) = y] (mod a) \<Longrightarrow>
  12.802 +lemma cong_cong_coprime_nat: "coprime a b \<Longrightarrow> [(x::nat) = y] (mod a) \<Longrightarrow>
  12.803      [x = y] (mod b) \<Longrightarrow> [x = y] (mod a * b)"
  12.804 -  apply (frule (1) nat_cong_cong_lcm)back
  12.805 +  apply (frule (1) cong_cong_lcm_nat)back
  12.806    apply (simp add: lcm_nat_def)
  12.807  done
  12.808  
  12.809 -lemma int_cong_cong_coprime: "coprime a b \<Longrightarrow> [(x::int) = y] (mod a) \<Longrightarrow>
  12.810 +lemma cong_cong_coprime_int: "coprime a b \<Longrightarrow> [(x::int) = y] (mod a) \<Longrightarrow>
  12.811      [x = y] (mod b) \<Longrightarrow> [x = y] (mod a * b)"
  12.812 -  apply (frule (1) int_cong_cong_lcm)back
  12.813 -  apply (simp add: int_lcm_altdef int_cong_abs abs_mult [symmetric])
  12.814 +  apply (frule (1) cong_cong_lcm_int)back
  12.815 +  apply (simp add: lcm_altdef_int cong_abs_int abs_mult [symmetric])
  12.816  done
  12.817  
  12.818 -lemma nat_cong_cong_setprod_coprime [rule_format]: "finite A \<Longrightarrow>
  12.819 +lemma cong_cong_setprod_coprime_nat [rule_format]: "finite A \<Longrightarrow>
  12.820      (ALL i:A. (ALL j:A. i \<noteq> j \<longrightarrow> coprime (m i) (m j))) \<longrightarrow>
  12.821      (ALL i:A. [(x::nat) = y] (mod m i)) \<longrightarrow>
  12.822        [x = y] (mod (PROD i:A. m i))"
  12.823    apply (induct set: finite)
  12.824    apply auto
  12.825 -  apply (rule nat_cong_cong_coprime)
  12.826 -  apply (subst nat_gcd_commute)
  12.827 -  apply (rule nat_setprod_coprime)
  12.828 +  apply (rule cong_cong_coprime_nat)
  12.829 +  apply (subst gcd_commute_nat)
  12.830 +  apply (rule setprod_coprime_nat)
  12.831    apply auto
  12.832  done
  12.833  
  12.834 -lemma int_cong_cong_setprod_coprime [rule_format]: "finite A \<Longrightarrow>
  12.835 +lemma cong_cong_setprod_coprime_int [rule_format]: "finite A \<Longrightarrow>
  12.836      (ALL i:A. (ALL j:A. i \<noteq> j \<longrightarrow> coprime (m i) (m j))) \<longrightarrow>
  12.837      (ALL i:A. [(x::int) = y] (mod m i)) \<longrightarrow>
  12.838        [x = y] (mod (PROD i:A. m i))"
  12.839    apply (induct set: finite)
  12.840    apply auto
  12.841 -  apply (rule int_cong_cong_coprime)
  12.842 -  apply (subst int_gcd_commute)
  12.843 -  apply (rule int_setprod_coprime)
  12.844 +  apply (rule cong_cong_coprime_int)
  12.845 +  apply (subst gcd_commute_int)
  12.846 +  apply (rule setprod_coprime_int)
  12.847    apply auto
  12.848  done
  12.849  
  12.850 -lemma nat_binary_chinese_remainder_aux: 
  12.851 +lemma binary_chinese_remainder_aux_nat: 
  12.852    assumes a: "coprime (m1::nat) m2"
  12.853    shows "EX b1 b2. [b1 = 1] (mod m1) \<and> [b1 = 0] (mod m2) \<and>
  12.854      [b2 = 0] (mod m1) \<and> [b2 = 1] (mod m2)"
  12.855  proof -
  12.856 -  from nat_cong_solve_coprime [OF a]
  12.857 +  from cong_solve_coprime_nat [OF a]
  12.858        obtain x1 where one: "[m1 * x1 = 1] (mod m2)"
  12.859      by auto
  12.860    from a have b: "coprime m2 m1" 
  12.861 -    by (subst nat_gcd_commute)
  12.862 -  from nat_cong_solve_coprime [OF b]
  12.863 +    by (subst gcd_commute_nat)
  12.864 +  from cong_solve_coprime_nat [OF b]
  12.865        obtain x2 where two: "[m2 * x2 = 1] (mod m1)"
  12.866      by auto
  12.867    have "[m1 * x1 = 0] (mod m1)"
  12.868 -    by (subst mult_commute, rule nat_cong_mult_self)
  12.869 +    by (subst mult_commute, rule cong_mult_self_nat)
  12.870    moreover have "[m2 * x2 = 0] (mod m2)"
  12.871 -    by (subst mult_commute, rule nat_cong_mult_self)
  12.872 +    by (subst mult_commute, rule cong_mult_self_nat)
  12.873    moreover note one two
  12.874    ultimately show ?thesis by blast
  12.875  qed
  12.876  
  12.877 -lemma int_binary_chinese_remainder_aux: 
  12.878 +lemma binary_chinese_remainder_aux_int: 
  12.879    assumes a: "coprime (m1::int) m2"
  12.880    shows "EX b1 b2. [b1 = 1] (mod m1) \<and> [b1 = 0] (mod m2) \<and>
  12.881      [b2 = 0] (mod m1) \<and> [b2 = 1] (mod m2)"
  12.882  proof -
  12.883 -  from int_cong_solve_coprime [OF a]
  12.884 +  from cong_solve_coprime_int [OF a]
  12.885        obtain x1 where one: "[m1 * x1 = 1] (mod m2)"
  12.886      by auto
  12.887    from a have b: "coprime m2 m1" 
  12.888 -    by (subst int_gcd_commute)
  12.889 -  from int_cong_solve_coprime [OF b]
  12.890 +    by (subst gcd_commute_int)
  12.891 +  from cong_solve_coprime_int [OF b]
  12.892        obtain x2 where two: "[m2 * x2 = 1] (mod m1)"
  12.893      by auto
  12.894    have "[m1 * x1 = 0] (mod m1)"
  12.895 -    by (subst mult_commute, rule int_cong_mult_self)
  12.896 +    by (subst mult_commute, rule cong_mult_self_int)
  12.897    moreover have "[m2 * x2 = 0] (mod m2)"
  12.898 -    by (subst mult_commute, rule int_cong_mult_self)
  12.899 +    by (subst mult_commute, rule cong_mult_self_int)
  12.900    moreover note one two
  12.901    ultimately show ?thesis by blast
  12.902  qed
  12.903  
  12.904 -lemma nat_binary_chinese_remainder:
  12.905 +lemma binary_chinese_remainder_nat:
  12.906    assumes a: "coprime (m1::nat) m2"
  12.907    shows "EX x. [x = u1] (mod m1) \<and> [x = u2] (mod m2)"
  12.908  proof -
  12.909 -  from nat_binary_chinese_remainder_aux [OF a] obtain b1 b2
  12.910 +  from binary_chinese_remainder_aux_nat [OF a] obtain b1 b2
  12.911      where "[b1 = 1] (mod m1)" and "[b1 = 0] (mod m2)" and
  12.912            "[b2 = 0] (mod m1)" and "[b2 = 1] (mod m2)"
  12.913      by blast
  12.914    let ?x = "u1 * b1 + u2 * b2"
  12.915    have "[?x = u1 * 1 + u2 * 0] (mod m1)"
  12.916 -    apply (rule nat_cong_add)
  12.917 -    apply (rule nat_cong_scalar2)
  12.918 +    apply (rule cong_add_nat)
  12.919 +    apply (rule cong_scalar2_nat)
  12.920      apply (rule `[b1 = 1] (mod m1)`)
  12.921 -    apply (rule nat_cong_scalar2)
  12.922 +    apply (rule cong_scalar2_nat)
  12.923      apply (rule `[b2 = 0] (mod m1)`)
  12.924      done
  12.925    hence "[?x = u1] (mod m1)" by simp
  12.926    have "[?x = u1 * 0 + u2 * 1] (mod m2)"
  12.927 -    apply (rule nat_cong_add)
  12.928 -    apply (rule nat_cong_scalar2)
  12.929 +    apply (rule cong_add_nat)
  12.930 +    apply (rule cong_scalar2_nat)
  12.931      apply (rule `[b1 = 0] (mod m2)`)
  12.932 -    apply (rule nat_cong_scalar2)
  12.933 +    apply (rule cong_scalar2_nat)
  12.934      apply (rule `[b2 = 1] (mod m2)`)
  12.935      done
  12.936    hence "[?x = u2] (mod m2)" by simp
  12.937    with `[?x = u1] (mod m1)` show ?thesis by blast
  12.938  qed
  12.939  
  12.940 -lemma int_binary_chinese_remainder:
  12.941 +lemma binary_chinese_remainder_int:
  12.942    assumes a: "coprime (m1::int) m2"
  12.943    shows "EX x. [x = u1] (mod m1) \<and> [x = u2] (mod m2)"
  12.944  proof -
  12.945 -  from int_binary_chinese_remainder_aux [OF a] obtain b1 b2
  12.946 +  from binary_chinese_remainder_aux_int [OF a] obtain b1 b2
  12.947      where "[b1 = 1] (mod m1)" and "[b1 = 0] (mod m2)" and
  12.948            "[b2 = 0] (mod m1)" and "[b2 = 1] (mod m2)"
  12.949      by blast
  12.950    let ?x = "u1 * b1 + u2 * b2"
  12.951    have "[?x = u1 * 1 + u2 * 0] (mod m1)"
  12.952 -    apply (rule int_cong_add)
  12.953 -    apply (rule int_cong_scalar2)
  12.954 +    apply (rule cong_add_int)
  12.955 +    apply (rule cong_scalar2_int)
  12.956      apply (rule `[b1 = 1] (mod m1)`)
  12.957 -    apply (rule int_cong_scalar2)
  12.958 +    apply (rule cong_scalar2_int)
  12.959      apply (rule `[b2 = 0] (mod m1)`)
  12.960      done
  12.961    hence "[?x = u1] (mod m1)" by simp
  12.962    have "[?x = u1 * 0 + u2 * 1] (mod m2)"
  12.963 -    apply (rule int_cong_add)
  12.964 -    apply (rule int_cong_scalar2)
  12.965 +    apply (rule cong_add_int)
  12.966 +    apply (rule cong_scalar2_int)
  12.967      apply (rule `[b1 = 0] (mod m2)`)
  12.968 -    apply (rule int_cong_scalar2)
  12.969 +    apply (rule cong_scalar2_int)
  12.970      apply (rule `[b2 = 1] (mod m2)`)
  12.971      done
  12.972    hence "[?x = u2] (mod m2)" by simp
  12.973    with `[?x = u1] (mod m1)` show ?thesis by blast
  12.974  qed
  12.975  
  12.976 -lemma nat_cong_modulus_mult: "[(x::nat) = y] (mod m * n) \<Longrightarrow> 
  12.977 +lemma cong_modulus_mult_nat: "[(x::nat) = y] (mod m * n) \<Longrightarrow> 
  12.978      [x = y] (mod m)"
  12.979    apply (case_tac "y \<le> x")
  12.980 -  apply (simp add: nat_cong_altdef)
  12.981 +  apply (simp add: cong_altdef_nat)
  12.982    apply (erule dvd_mult_left)
  12.983 -  apply (rule nat_cong_sym)
  12.984 -  apply (subst (asm) nat_cong_sym_eq)
  12.985 -  apply (simp add: nat_cong_altdef) 
  12.986 +  apply (rule cong_sym_nat)
  12.987 +  apply (subst (asm) cong_sym_eq_nat)
  12.988 +  apply (simp add: cong_altdef_nat) 
  12.989    apply (erule dvd_mult_left)
  12.990  done
  12.991  
  12.992 -lemma int_cong_modulus_mult: "[(x::int) = y] (mod m * n) \<Longrightarrow> 
  12.993 +lemma cong_modulus_mult_int: "[(x::int) = y] (mod m * n) \<Longrightarrow> 
  12.994      [x = y] (mod m)"
  12.995 -  apply (simp add: int_cong_altdef) 
  12.996 +  apply (simp add: cong_altdef_int) 
  12.997    apply (erule dvd_mult_left)
  12.998  done
  12.999  
 12.1000 -lemma nat_cong_less_modulus_unique: 
 12.1001 +lemma cong_less_modulus_unique_nat: 
 12.1002      "[(x::nat) = y] (mod m) \<Longrightarrow> x < m \<Longrightarrow> y < m \<Longrightarrow> x = y"
 12.1003    by (simp add: cong_nat_def)
 12.1004  
 12.1005 -lemma nat_binary_chinese_remainder_unique:
 12.1006 +lemma binary_chinese_remainder_unique_nat:
 12.1007    assumes a: "coprime (m1::nat) m2" and
 12.1008           nz: "m1 \<noteq> 0" "m2 \<noteq> 0"
 12.1009    shows "EX! x. x < m1 * m2 \<and> [x = u1] (mod m1) \<and> [x = u2] (mod m2)"
 12.1010  proof -
 12.1011 -  from nat_binary_chinese_remainder [OF a] obtain y where 
 12.1012 +  from binary_chinese_remainder_nat [OF a] obtain y where 
 12.1013        "[y = u1] (mod m1)" and "[y = u2] (mod m2)"
 12.1014      by blast
 12.1015    let ?x = "y mod (m1 * m2)"
 12.1016    from nz have less: "?x < m1 * m2"
 12.1017      by auto   
 12.1018    have one: "[?x = u1] (mod m1)"
 12.1019 -    apply (rule nat_cong_trans)
 12.1020 +    apply (rule cong_trans_nat)
 12.1021      prefer 2
 12.1022      apply (rule `[y = u1] (mod m1)`)
 12.1023 -    apply (rule nat_cong_modulus_mult)
 12.1024 -    apply (rule nat_cong_mod)
 12.1025 +    apply (rule cong_modulus_mult_nat)
 12.1026 +    apply (rule cong_mod_nat)
 12.1027      using nz apply auto
 12.1028      done
 12.1029    have two: "[?x = u2] (mod m2)"
 12.1030 -    apply (rule nat_cong_trans)
 12.1031 +    apply (rule cong_trans_nat)
 12.1032      prefer 2
 12.1033      apply (rule `[y = u2] (mod m2)`)
 12.1034      apply (subst mult_commute)
 12.1035 -    apply (rule nat_cong_modulus_mult)
 12.1036 -    apply (rule nat_cong_mod)
 12.1037 +    apply (rule cong_modulus_mult_nat)
 12.1038 +    apply (rule cong_mod_nat)
 12.1039      using nz apply auto
 12.1040      done
 12.1041    have "ALL z. z < m1 * m2 \<and> [z = u1] (mod m1) \<and> [z = u2] (mod m2) \<longrightarrow>
 12.1042 @@ -930,29 +930,29 @@
 12.1043      assume "z < m1 * m2"
 12.1044      assume "[z = u1] (mod m1)" and  "[z = u2] (mod m2)"
 12.1045      have "[?x = z] (mod m1)"
 12.1046 -      apply (rule nat_cong_trans)
 12.1047 +      apply (rule cong_trans_nat)
 12.1048        apply (rule `[?x = u1] (mod m1)`)
 12.1049 -      apply (rule nat_cong_sym)
 12.1050 +      apply (rule cong_sym_nat)
 12.1051        apply (rule `[z = u1] (mod m1)`)
 12.1052        done
 12.1053      moreover have "[?x = z] (mod m2)"
 12.1054 -      apply (rule nat_cong_trans)
 12.1055 +      apply (rule cong_trans_nat)
 12.1056        apply (rule `[?x = u2] (mod m2)`)
 12.1057 -      apply (rule nat_cong_sym)
 12.1058 +      apply (rule cong_sym_nat)
 12.1059        apply (rule `[z = u2] (mod m2)`)
 12.1060        done
 12.1061      ultimately have "[?x = z] (mod m1 * m2)"
 12.1062 -      by (auto intro: nat_coprime_cong_mult a)
 12.1063 +      by (auto intro: coprime_cong_mult_nat a)
 12.1064      with `z < m1 * m2` `?x < m1 * m2` show "z = ?x"
 12.1065 -      apply (intro nat_cong_less_modulus_unique)
 12.1066 -      apply (auto, erule nat_cong_sym)
 12.1067 +      apply (intro cong_less_modulus_unique_nat)
 12.1068 +      apply (auto, erule cong_sym_nat)
 12.1069        done
 12.1070    qed  
 12.1071    with less one two show ?thesis
 12.1072      by auto
 12.1073   qed
 12.1074  
 12.1075 -lemma nat_chinese_remainder_aux:
 12.1076 +lemma chinese_remainder_aux_nat:
 12.1077    fixes A :: "'a set" and
 12.1078          m :: "'a \<Rightarrow> nat"
 12.1079    assumes fin: "finite A" and
 12.1080 @@ -963,20 +963,20 @@
 12.1081    fix i
 12.1082    assume "i : A"
 12.1083    with cop have "coprime (PROD j : A - {i}. m j) (m i)"
 12.1084 -    by (intro nat_setprod_coprime, auto)
 12.1085 +    by (intro setprod_coprime_nat, auto)
 12.1086    hence "EX x. [(PROD j : A - {i}. m j) * x = 1] (mod m i)"
 12.1087 -    by (elim nat_cong_solve_coprime)
 12.1088 +    by (elim cong_solve_coprime_nat)
 12.1089    then obtain x where "[(PROD j : A - {i}. m j) * x = 1] (mod m i)"
 12.1090      by auto
 12.1091    moreover have "[(PROD j : A - {i}. m j) * x = 0] 
 12.1092      (mod (PROD j : A - {i}. m j))"
 12.1093 -    by (subst mult_commute, rule nat_cong_mult_self)
 12.1094 +    by (subst mult_commute, rule cong_mult_self_nat)
 12.1095    ultimately show "\<exists>a. [a = 1] (mod m i) \<and> [a = 0] 
 12.1096        (mod setprod m (A - {i}))"
 12.1097      by blast
 12.1098  qed
 12.1099  
 12.1100 -lemma nat_chinese_remainder:
 12.1101 +lemma chinese_remainder_nat:
 12.1102    fixes A :: "'a set" and
 12.1103          m :: "'a \<Rightarrow> nat" and
 12.1104          u :: "'a \<Rightarrow> nat"
 12.1105 @@ -985,7 +985,7 @@
 12.1106          cop: "ALL i:A. (ALL j : A. i \<noteq> j \<longrightarrow> coprime (m i) (m j))"
 12.1107    shows "EX x. (ALL i:A. [x = u i] (mod m i))"
 12.1108  proof -
 12.1109 -  from nat_chinese_remainder_aux [OF fin cop] obtain b where
 12.1110 +  from chinese_remainder_aux_nat [OF fin cop] obtain b where
 12.1111      bprop: "ALL i:A. [b i = 1] (mod m i) \<and> 
 12.1112        [b i = 0] (mod (PROD j : A - {i}. m j))"
 12.1113      by blast
 12.1114 @@ -1003,13 +1003,13 @@
 12.1115          by auto
 12.1116        also have "[u i * b i + (SUM j:A-{i}. u j * b j) =
 12.1117                    u i * 1 + (SUM j:A-{i}. u j * 0)] (mod m i)"
 12.1118 -        apply (rule nat_cong_add)
 12.1119 -        apply (rule nat_cong_scalar2)
 12.1120 +        apply (rule cong_add_nat)
 12.1121 +        apply (rule cong_scalar2_nat)
 12.1122          using bprop a apply blast
 12.1123 -        apply (rule nat_cong_setsum)
 12.1124 -        apply (rule nat_cong_scalar2)
 12.1125 +        apply (rule cong_setsum_nat)
 12.1126 +        apply (rule cong_scalar2_nat)
 12.1127          using bprop apply auto
 12.1128 -        apply (rule nat_cong_dvd_modulus)
 12.1129 +        apply (rule cong_dvd_modulus_nat)
 12.1130          apply (drule (1) bspec)
 12.1131          apply (erule conjE)
 12.1132          apply assumption
 12.1133 @@ -1022,19 +1022,19 @@
 12.1134    qed
 12.1135  qed
 12.1136  
 12.1137 -lemma nat_coprime_cong_prod [rule_format]: "finite A \<Longrightarrow> 
 12.1138 +lemma coprime_cong_prod_nat [rule_format]: "finite A \<Longrightarrow> 
 12.1139      (ALL i: A. (ALL j: A. i \<noteq> j \<longrightarrow> coprime (m i) (m j))) \<longrightarrow>
 12.1140        (ALL i: A. [(x::nat) = y] (mod m i)) \<longrightarrow>
 12.1141           [x = y] (mod (PROD i:A. m i))" 
 12.1142    apply (induct set: finite)
 12.1143    apply auto
 12.1144 -  apply (erule (1) nat_coprime_cong_mult)
 12.1145 -  apply (subst nat_gcd_commute)
 12.1146 -  apply (rule nat_setprod_coprime)
 12.1147 +  apply (erule (1) coprime_cong_mult_nat)
 12.1148 +  apply (subst gcd_commute_nat)
 12.1149 +  apply (rule setprod_coprime_nat)
 12.1150    apply auto
 12.1151  done
 12.1152  
 12.1153 -lemma nat_chinese_remainder_unique:
 12.1154 +lemma chinese_remainder_unique_nat:
 12.1155    fixes A :: "'a set" and
 12.1156          m :: "'a \<Rightarrow> nat" and
 12.1157          u :: "'a \<Rightarrow> nat"
 12.1158 @@ -1044,7 +1044,7 @@
 12.1159          cop: "ALL i:A. (ALL j : A. i \<noteq> j \<longrightarrow> coprime (m i) (m j))"
 12.1160    shows "EX! x. x < (PROD i:A. m i) \<and> (ALL i:A. [x = u i] (mod m i))"
 12.1161  proof -
 12.1162 -  from nat_chinese_remainder [OF fin cop] obtain y where
 12.1163 +  from chinese_remainder_nat [OF fin cop] obtain y where
 12.1164        one: "(ALL i:A. [y = u i] (mod m i))" 
 12.1165      by blast
 12.1166    let ?x = "y mod (PROD i:A. m i)"
 12.1167 @@ -1054,11 +1054,11 @@
 12.1168      by auto
 12.1169    have cong: "ALL i:A. [?x = u i] (mod m i)"
 12.1170      apply auto
 12.1171 -    apply (rule nat_cong_trans)
 12.1172 +    apply (rule cong_trans_nat)
 12.1173      prefer 2
 12.1174      using one apply auto
 12.1175 -    apply (rule nat_cong_dvd_modulus)
 12.1176 -    apply (rule nat_cong_mod)
 12.1177 +    apply (rule cong_dvd_modulus_nat)
 12.1178 +    apply (rule cong_mod_nat)
 12.1179      using prodnz apply auto
 12.1180      apply (rule dvd_setprod)
 12.1181      apply (rule fin)
 12.1182 @@ -1072,16 +1072,16 @@
 12.1183      assume zcong: "(ALL i:A. [z = u i] (mod m i))"
 12.1184      have "ALL i:A. [?x = z] (mod m i)"
 12.1185        apply clarify     
 12.1186 -      apply (rule nat_cong_trans)
 12.1187 +      apply (rule cong_trans_nat)
 12.1188        using cong apply (erule bspec)
 12.1189 -      apply (rule nat_cong_sym)
 12.1190 +      apply (rule cong_sym_nat)
 12.1191        using zcong apply auto
 12.1192        done
 12.1193      with fin cop have "[?x = z] (mod (PROD i:A. m i))"
 12.1194 -      by (intro nat_coprime_cong_prod, auto)
 12.1195 +      by (intro coprime_cong_prod_nat, auto)
 12.1196      with zless less show "z = ?x"
 12.1197 -      apply (intro nat_cong_less_modulus_unique)
 12.1198 -      apply (auto, erule nat_cong_sym)
 12.1199 +      apply (intro cong_less_modulus_unique_nat)
 12.1200 +      apply (auto, erule cong_sym_nat)
 12.1201        done
 12.1202    qed 
 12.1203    from less cong unique show ?thesis
    13.1 --- a/src/HOL/NewNumberTheory/Fib.thy	Tue Jul 07 07:56:24 2009 +0200
    13.2 +++ b/src/HOL/NewNumberTheory/Fib.thy	Tue Jul 07 17:39:51 2009 +0200
    13.3 @@ -86,45 +86,45 @@
    13.4  
    13.5  subsection {* Fibonacci numbers *}
    13.6  
    13.7 -lemma nat_fib_0 [simp]: "fib (0::nat) = 0"
    13.8 +lemma fib_0_nat [simp]: "fib (0::nat) = 0"
    13.9    by simp
   13.10  
   13.11 -lemma int_fib_0 [simp]: "fib (0::int) = 0"
   13.12 +lemma fib_0_int [simp]: "fib (0::int) = 0"
   13.13    unfolding fib_int_def by simp
   13.14  
   13.15 -lemma nat_fib_1 [simp]: "fib (1::nat) = 1"
   13.16 +lemma fib_1_nat [simp]: "fib (1::nat) = 1"
   13.17    by simp
   13.18  
   13.19 -lemma nat_fib_Suc_0 [simp]: "fib (Suc 0) = Suc 0"
   13.20 +lemma fib_Suc_0_nat [simp]: "fib (Suc 0) = Suc 0"
   13.21    by simp
   13.22  
   13.23 -lemma int_fib_1 [simp]: "fib (1::int) = 1"
   13.24 +lemma fib_1_int [simp]: "fib (1::int) = 1"
   13.25    unfolding fib_int_def by simp
   13.26  
   13.27 -lemma nat_fib_reduce: "(n::nat) >= 2 \<Longrightarrow> fib n = fib (n - 1) + fib (n - 2)"
   13.28 +lemma fib_reduce_nat: "(n::nat) >= 2 \<Longrightarrow> fib n = fib (n - 1) + fib (n - 2)"
   13.29    by simp
   13.30  
   13.31  declare fib_nat.simps [simp del]
   13.32  
   13.33 -lemma int_fib_reduce: "(n::int) >= 2 \<Longrightarrow> fib n = fib (n - 1) + fib (n - 2)"
   13.34 +lemma fib_reduce_int: "(n::int) >= 2 \<Longrightarrow> fib n = fib (n - 1) + fib (n - 2)"
   13.35    unfolding fib_int_def
   13.36 -  by (auto simp add: nat_fib_reduce nat_diff_distrib)
   13.37 +  by (auto simp add: fib_reduce_nat nat_diff_distrib)
   13.38  
   13.39 -lemma int_fib_neg [simp]: "(n::int) < 0 \<Longrightarrow> fib n = 0"
   13.40 +lemma fib_neg_int [simp]: "(n::int) < 0 \<Longrightarrow> fib n = 0"
   13.41    unfolding fib_int_def by auto
   13.42  
   13.43 -lemma nat_fib_2 [simp]: "fib (2::nat) = 1"
   13.44 -  by (subst nat_fib_reduce, auto)
   13.45 +lemma fib_2_nat [simp]: "fib (2::nat) = 1"
   13.46 +  by (subst fib_reduce_nat, auto)
   13.47  
   13.48 -lemma int_fib_2 [simp]: "fib (2::int) = 1"
   13.49 -  by (subst int_fib_reduce, auto)
   13.50 +lemma fib_2_int [simp]: "fib (2::int) = 1"
   13.51 +  by (subst fib_reduce_int, auto)
   13.52  
   13.53 -lemma nat_fib_plus_2: "fib ((n::nat) + 2) = fib (n + 1) + fib n"
   13.54 -  by (subst nat_fib_reduce, auto simp add: One_nat_def)
   13.55 +lemma fib_plus_2_nat: "fib ((n::nat) + 2) = fib (n + 1) + fib n"
   13.56 +  by (subst fib_reduce_nat, auto simp add: One_nat_def)
   13.57  (* the need for One_nat_def is due to the natdiff_cancel_numerals
   13.58     procedure *)
   13.59  
   13.60 -lemma nat_fib_induct: "P (0::nat) \<Longrightarrow> P (1::nat) \<Longrightarrow> 
   13.61 +lemma fib_induct_nat: "P (0::nat) \<Longrightarrow> P (1::nat) \<Longrightarrow> 
   13.62      (!!n. P n \<Longrightarrow> P (n + 1) \<Longrightarrow> P (n + 2)) \<Longrightarrow> P n"
   13.63    apply (atomize, induct n rule: nat_less_induct)
   13.64    apply auto
   13.65 @@ -138,13 +138,13 @@
   13.66    apply (auto simp add: One_nat_def) (* again, natdiff_cancel *)
   13.67  done
   13.68  
   13.69 -lemma nat_fib_add: "fib ((n::nat) + k + 1) = fib (k + 1) * fib (n + 1) + 
   13.70 +lemma fib_add_nat: "fib ((n::nat) + k + 1) = fib (k + 1) * fib (n + 1) + 
   13.71      fib k * fib n"
   13.72 -  apply (induct n rule: nat_fib_induct)
   13.73 +  apply (induct n rule: fib_induct_nat)
   13.74    apply auto
   13.75 -  apply (subst nat_fib_reduce)
   13.76 +  apply (subst fib_reduce_nat)
   13.77    apply (auto simp add: ring_simps)
   13.78 -  apply (subst (1 3 5) nat_fib_reduce)
   13.79 +  apply (subst (1 3 5) fib_reduce_nat)
   13.80    apply (auto simp add: ring_simps Suc_eq_plus1)
   13.81  (* hmmm. Why doesn't "n + (1 + (1 + k))" simplify to "n + k + 2"? *)
   13.82    apply (subgoal_tac "n + (k + 2) = n + (1 + (1 + k))")
   13.83 @@ -153,112 +153,112 @@
   13.84    apply auto
   13.85  done
   13.86  
   13.87 -lemma nat_fib_add': "fib (n + Suc k) = fib (Suc k) * fib (Suc n) + 
   13.88 +lemma fib_add'_nat: "fib (n + Suc k) = fib (Suc k) * fib (Suc n) + 
   13.89      fib k * fib n"
   13.90 -  using nat_fib_add by (auto simp add: One_nat_def)
   13.91 +  using fib_add_nat by (auto simp add: One_nat_def)
   13.92  
   13.93  
   13.94  (* transfer from nats to ints *)
   13.95 -lemma int_fib_add [rule_format]: "(n::int) >= 0 \<Longrightarrow> k >= 0 \<Longrightarrow>
   13.96 +lemma fib_add_int [rule_format]: "(n::int) >= 0 \<Longrightarrow> k >= 0 \<Longrightarrow>
   13.97      fib (n + k + 1) = fib (k + 1) * fib (n + 1) + 
   13.98      fib k * fib n "
   13.99  
  13.100 -  by (rule nat_fib_add [transferred])
  13.101 +  by (rule fib_add_nat [transferred])
  13.102  
  13.103 -lemma nat_fib_neq_0: "(n::nat) > 0 \<Longrightarrow> fib n ~= 0"
  13.104 -  apply (induct n rule: nat_fib_induct)
  13.105 -  apply (auto simp add: nat_fib_plus_2)
  13.106 +lemma fib_neq_0_nat: "(n::nat) > 0 \<Longrightarrow> fib n ~= 0"
  13.107 +  apply (induct n rule: fib_induct_nat)
  13.108 +  apply (auto simp add: fib_plus_2_nat)
  13.109  done
  13.110  
  13.111 -lemma nat_fib_gr_0: "(n::nat) > 0 \<Longrightarrow> fib n > 0"
  13.112 -  by (frule nat_fib_neq_0, simp)
  13.113 +lemma fib_gr_0_nat: "(n::nat) > 0 \<Longrightarrow> fib n > 0"
  13.114 +  by (frule fib_neq_0_nat, simp)
  13.115  
  13.116 -lemma int_fib_gr_0: "(n::int) > 0 \<Longrightarrow> fib n > 0"
  13.117 -  unfolding fib_int_def by (simp add: nat_fib_gr_0)
  13.118 +lemma fib_gr_0_int: "(n::int) > 0 \<Longrightarrow> fib n > 0"
  13.119 +  unfolding fib_int_def by (simp add: fib_gr_0_nat)
  13.120  
  13.121  text {*
  13.122    \medskip Concrete Mathematics, page 278: Cassini's identity.  The proof is
  13.123    much easier using integers, not natural numbers!
  13.124  *}
  13.125  
  13.126 -lemma int_fib_Cassini_aux: "fib (int n + 2) * fib (int n) - 
  13.127 +lemma fib_Cassini_aux_int: "fib (int n + 2) * fib (int n) - 
  13.128      (fib (int n + 1))^2 = (-1)^(n + 1)"
  13.129    apply (induct n)
  13.130 -  apply (auto simp add: ring_simps power2_eq_square int_fib_reduce
  13.131 +  apply (auto simp add: ring_simps power2_eq_square fib_reduce_int
  13.132        power_add)
  13.133  done
  13.134  
  13.135 -lemma int_fib_Cassini: "n >= 0 \<Longrightarrow> fib (n + 2) * fib n - 
  13.136 +lemma fib_Cassini_int: "n >= 0 \<Longrightarrow> fib (n + 2) * fib n - 
  13.137      (fib (n + 1))^2 = (-1)^(nat n + 1)"
  13.138 -  by (insert int_fib_Cassini_aux [of "nat n"], auto)
  13.139 +  by (insert fib_Cassini_aux_int [of "nat n"], auto)
  13.140  
  13.141  (*
  13.142 -lemma int_fib_Cassini': "n >= 0 \<Longrightarrow> fib (n + 2) * fib n = 
  13.143 +lemma fib_Cassini'_int: "n >= 0 \<Longrightarrow> fib (n + 2) * fib n = 
  13.144      (fib (n + 1))^2 + (-1)^(nat n + 1)"
  13.145 -  by (frule int_fib_Cassini, simp) 
  13.146 +  by (frule fib_Cassini_int, simp) 
  13.147  *)
  13.148  
  13.149 -lemma int_fib_Cassini': "n >= 0 \<Longrightarrow> fib ((n::int) + 2) * fib n =
  13.150 +lemma fib_Cassini'_int: "n >= 0 \<Longrightarrow> fib ((n::int) + 2) * fib n =
  13.151    (if even n then tsub ((fib (n + 1))^2) 1
  13.152     else (fib (n + 1))^2 + 1)"
  13.153 -  apply (frule int_fib_Cassini, auto simp add: pos_int_even_equiv_nat_even)
  13.154 +  apply (frule fib_Cassini_int, auto simp add: pos_int_even_equiv_nat_even)
  13.155    apply (subst tsub_eq)
  13.156 -  apply (insert int_fib_gr_0 [of "n + 1"], force)
  13.157 +  apply (insert fib_gr_0_int [of "n + 1"], force)
  13.158    apply auto
  13.159  done
  13.160  
  13.161 -lemma nat_fib_Cassini: "fib ((n::nat) + 2) * fib n =
  13.162 +lemma fib_Cassini_nat: "fib ((n::nat) + 2) * fib n =
  13.163    (if even n then (fib (n + 1))^2 - 1
  13.164     else (fib (n + 1))^2 + 1)"
  13.165  
  13.166 -  by (rule int_fib_Cassini' [transferred, of n], auto)
  13.167 +  by (rule fib_Cassini'_int [transferred, of n], auto)
  13.168  
  13.169  
  13.170  text {* \medskip Toward Law 6.111 of Concrete Mathematics *}
  13.171  
  13.172 -lemma nat_coprime_fib_plus_1: "coprime (fib (n::nat)) (fib (n + 1))"
  13.173 -  apply (induct n rule: nat_fib_induct)
  13.174 +lemma coprime_fib_plus_1_nat: "coprime (fib (n::nat)) (fib (n + 1))"
  13.175 +  apply (induct n rule: fib_induct_nat)
  13.176    apply auto
  13.177 -  apply (subst (2) nat_fib_reduce)
  13.178 +  apply (subst (2) fib_reduce_nat)
  13.179    apply (auto simp add: Suc_eq_plus1) (* again, natdiff_cancel *)
  13.180    apply (subst add_commute, auto)
  13.181 -  apply (subst nat_gcd_commute, auto simp add: ring_simps)
  13.182 +  apply (subst gcd_commute_nat, auto simp add: ring_simps)
  13.183  done
  13.184  
  13.185 -lemma nat_coprime_fib_Suc: "coprime (fib n) (fib (Suc n))"
  13.186 -  using nat_coprime_fib_plus_1 by (simp add: One_nat_def)
  13.187 +lemma coprime_fib_Suc_nat: "coprime (fib n) (fib (Suc n))"
  13.188 +  using coprime_fib_plus_1_nat by (simp add: One_nat_def)
  13.189  
  13.190 -lemma int_coprime_fib_plus_1: 
  13.191 +lemma coprime_fib_plus_1_int: 
  13.192      "n >= 0 \<Longrightarrow> coprime (fib (n::int)) (fib (n + 1))"
  13.193 -  by (erule nat_coprime_fib_plus_1 [transferred])
  13.194 +  by (erule coprime_fib_plus_1_nat [transferred])
  13.195  
  13.196 -lemma nat_gcd_fib_add: "gcd (fib (m::nat)) (fib (n + m)) = gcd (fib m) (fib n)"
  13.197 -  apply (simp add: nat_gcd_commute [of "fib m"])
  13.198 -  apply (rule nat_cases [of _ m])
  13.199 +lemma gcd_fib_add_nat: "gcd (fib (m::nat)) (fib (n + m)) = gcd (fib m) (fib n)"
  13.200 +  apply (simp add: gcd_commute_nat [of "fib m"])
  13.201 +  apply (rule cases_nat [of _ m])
  13.202    apply simp
  13.203    apply (subst add_assoc [symmetric])
  13.204 -  apply (simp add: nat_fib_add)
  13.205 -  apply (subst nat_gcd_commute)
  13.206 +  apply (simp add: fib_add_nat)
  13.207 +  apply (subst gcd_commute_nat)
  13.208    apply (subst mult_commute)
  13.209 -  apply (subst nat_gcd_add_mult)
  13.210 -  apply (subst nat_gcd_commute)
  13.211 -  apply (rule nat_gcd_mult_cancel)
  13.212 -  apply (rule nat_coprime_fib_plus_1)
  13.213 +  apply (subst gcd_add_mult_nat)
  13.214 +  apply (subst gcd_commute_nat)
  13.215 +  apply (rule gcd_mult_cancel_nat)
  13.216 +  apply (rule coprime_fib_plus_1_nat)
  13.217  done
  13.218  
  13.219 -lemma int_gcd_fib_add [rule_format]: "m >= 0 \<Longrightarrow> n >= 0 \<Longrightarrow> 
  13.220 +lemma gcd_fib_add_int [rule_format]: "m >= 0 \<Longrightarrow> n >= 0 \<Longrightarrow> 
  13.221      gcd (fib (m::int)) (fib (n + m)) = gcd (fib m) (fib n)"
  13.222 -  by (erule nat_gcd_fib_add [transferred])
  13.223 +  by (erule gcd_fib_add_nat [transferred])
  13.224  
  13.225 -lemma nat_gcd_fib_diff: "(m::nat) \<le> n \<Longrightarrow> 
  13.226 +lemma gcd_fib_diff_nat: "(m::nat) \<le> n \<Longrightarrow> 
  13.227      gcd (fib m) (fib (n - m)) = gcd (fib m) (fib n)"
  13.228 -  by (simp add: nat_gcd_fib_add [symmetric, of _ "n-m"])
  13.229 +  by (simp add: gcd_fib_add_nat [symmetric, of _ "n-m"])
  13.230  
  13.231 -lemma int_gcd_fib_diff: "0 <= (m::int) \<Longrightarrow> m \<le> n \<Longrightarrow> 
  13.232 +lemma gcd_fib_diff_int: "0 <= (m::int) \<Longrightarrow> m \<le> n \<Longrightarrow> 
  13.233      gcd (fib m) (fib (n - m)) = gcd (fib m) (fib n)"
  13.234 -  by (simp add: int_gcd_fib_add [symmetric, of _ "n-m"])
  13.235 +  by (simp add: gcd_fib_add_int [symmetric, of _ "n-m"])
  13.236  
  13.237 -lemma nat_gcd_fib_mod: "0 < (m::nat) \<Longrightarrow> 
  13.238 +lemma gcd_fib_mod_nat: "0 < (m::nat) \<Longrightarrow> 
  13.239      gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)"
  13.240  proof (induct n rule: less_induct)
  13.241    case (less n)
  13.242 @@ -273,7 +273,7 @@
  13.243      by (simp add: mod_if [of n]) (insert m_n, auto)
  13.244      also have "\<dots> = gcd (fib m)  (fib (n - m))" 
  13.245        by (simp add: less.hyps diff pos_m)
  13.246 -    also have "\<dots> = gcd (fib m) (fib n)" by (simp add: nat_gcd_fib_diff m_n')
  13.247 +    also have "\<dots> = gcd (fib m) (fib n)" by (simp add: gcd_fib_diff_nat m_n')
  13.248      finally show "gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)" .
  13.249    next
  13.250      case False then show "gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)"
  13.251 @@ -281,39 +281,39 @@
  13.252    qed
  13.253  qed
  13.254  
  13.255 -lemma int_gcd_fib_mod: 
  13.256 +lemma gcd_fib_mod_int: 
  13.257    assumes "0 < (m::int)" and "0 <= n"
  13.258    shows "gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)"
  13.259  
  13.260 -  apply (rule nat_gcd_fib_mod [transferred])
  13.261 +  apply (rule gcd_fib_mod_nat [transferred])
  13.262    using prems apply auto
  13.263  done
  13.264  
  13.265 -lemma nat_fib_gcd: "fib (gcd (m::nat) n) = gcd (fib m) (fib n)"  
  13.266 +lemma fib_gcd_nat: "fib (gcd (m::nat) n) = gcd (fib m) (fib n)"  
  13.267      -- {* Law 6.111 *}
  13.268 -  apply (induct m n rule: nat_gcd_induct)
  13.269 -  apply (simp_all add: nat_gcd_non_0 nat_gcd_commute nat_gcd_fib_mod)
  13.270 +  apply (induct m n rule: gcd_nat_induct)
  13.271 +  apply (simp_all add: gcd_non_0_nat gcd_commute_nat gcd_fib_mod_nat)
  13.272  done
  13.273  
  13.274 -lemma int_fib_gcd: "m >= 0 \<Longrightarrow> n >= 0 \<Longrightarrow>
  13.275 +lemma fib_gcd_int: "m >= 0 \<Longrightarrow> n >= 0 \<Longrightarrow>
  13.276      fib (gcd (m::int) n) = gcd (fib m) (fib n)"
  13.277 -  by (erule nat_fib_gcd [transferred])
  13.278 +  by (erule fib_gcd_nat [transferred])
  13.279  
  13.280 -lemma nat_atMost_plus_one: "{..(k::nat) + 1} = insert (k + 1) {..k}" 
  13.281 +lemma atMost_plus_one_nat: "{..(k::nat) + 1} = insert (k + 1) {..k}" 
  13.282    by auto
  13.283  
  13.284 -theorem nat_fib_mult_eq_setsum:
  13.285 +theorem fib_mult_eq_setsum_nat:
  13.286      "fib ((n::nat) + 1) * fib n = (\<Sum>k \<in> {..n}. fib k * fib k)"
  13.287    apply (induct n)
  13.288 -  apply (auto simp add: nat_atMost_plus_one nat_fib_plus_2 ring_simps)
  13.289 +  apply (auto simp add: atMost_plus_one_nat fib_plus_2_nat ring_simps)
  13.290  done
  13.291  
  13.292 -theorem nat_fib_mult_eq_setsum':
  13.293 +theorem fib_mult_eq_setsum'_nat:
  13.294      "fib (Suc n) * fib n = (\<Sum>k \<in> {..n}. fib k * fib k)"
  13.295 -  using nat_fib_mult_eq_setsum by (simp add: One_nat_def)
  13.296 +  using fib_mult_eq_setsum_nat by (simp add: One_nat_def)
  13.297  
  13.298 -theorem int_fib_mult_eq_setsum [rule_format]:
  13.299 +theorem fib_mult_eq_setsum_int [rule_format]:
  13.300      "n >= 0 \<Longrightarrow> fib ((n::int) + 1) * fib n = (\<Sum>k \<in> {0..n}. fib k * fib k)"
  13.301 -  by (erule nat_fib_mult_eq_setsum [transferred])
  13.302 +  by (erule fib_mult_eq_setsum_nat [transferred])
  13.303  
  13.304  end
    14.1 --- a/src/HOL/NewNumberTheory/MiscAlgebra.thy	Tue Jul 07 07:56:24 2009 +0200
    14.2 +++ b/src/HOL/NewNumberTheory/MiscAlgebra.thy	Tue Jul 07 17:39:51 2009 +0200
    14.3 @@ -12,7 +12,7 @@
    14.4  
    14.5  (* finiteness stuff *)
    14.6  
    14.7 -lemma int_bounded_set1 [intro]: "finite {(x::int). a < x & x < b & P x}" 
    14.8 +lemma bounded_set1_int [intro]: "finite {(x::int). a < x & x < b & P x}" 
    14.9    apply (subgoal_tac "{x. a < x & x < b & P x} <= {a<..<b}")
   14.10    apply (erule finite_subset)
   14.11    apply auto
    15.1 --- a/src/HOL/NewNumberTheory/Residues.thy	Tue Jul 07 07:56:24 2009 +0200
    15.2 +++ b/src/HOL/NewNumberTheory/Residues.thy	Tue Jul 07 17:39:51 2009 +0200
    15.3 @@ -105,10 +105,10 @@
    15.4    apply auto
    15.5    apply (subgoal_tac "x ~= 0")
    15.6    apply auto
    15.7 -  apply (rule int_invertible_coprime)
    15.8 +  apply (rule invertible_coprime_int)
    15.9    apply (subgoal_tac "x ~= 0")
   15.10    apply auto
   15.11 -  apply (subst (asm) int_coprime_iff_invertible')
   15.12 +  apply (subst (asm) coprime_iff_invertible'_int)
   15.13    apply (rule m_gt_one)
   15.14    apply (auto simp add: cong_int_def mult_commute)
   15.15  done
   15.16 @@ -202,8 +202,8 @@
   15.17    apply (subgoal_tac "a mod m ~= 0")
   15.18    apply arith
   15.19    apply auto
   15.20 -  apply (subst (asm) int_gcd_red)
   15.21 -  apply (subst int_gcd_commute, assumption)
   15.22 +  apply (subst (asm) gcd_red_int)
   15.23 +  apply (subst gcd_commute_int, assumption)
   15.24  done
   15.25  
   15.26  lemma res_eq_to_cong: "((a mod m) = (b mod m)) = [a = b] (mod (m::int))" 
   15.27 @@ -254,8 +254,8 @@
   15.28      res_units_eq)
   15.29    apply (rule classical)
   15.30    apply (erule notE)
   15.31 -  apply (subst int_gcd_commute)
   15.32 -  apply (rule int_prime_imp_coprime)
   15.33 +  apply (subst gcd_commute_int)
   15.34 +  apply (rule prime_imp_coprime_int)
   15.35    apply (rule p_prime)
   15.36    apply (rule notI)
   15.37    apply (frule zdvd_imp_le)
   15.38 @@ -265,8 +265,8 @@
   15.39  lemma res_prime_units_eq: "Units R = {1..p - 1}"
   15.40    apply (subst res_units_eq)
   15.41    apply auto
   15.42 -  apply (subst int_gcd_commute)
   15.43 -  apply (rule int_prime_imp_coprime)
   15.44 +  apply (subst gcd_commute_int)
   15.45 +  apply (rule prime_imp_coprime_int)
   15.46    apply (rule p_prime)
   15.47    apply (rule zdvd_not_zless)
   15.48    apply auto
   15.49 @@ -367,8 +367,8 @@
   15.50      apply (intro euler_theorem)
   15.51      (* auto should get this next part. matching across
   15.52         substitutions is needed. *)
   15.53 -    apply (frule int_prime_gt_1, arith)
   15.54 -    apply (subst int_gcd_commute, erule int_prime_imp_coprime, assumption)
   15.55 +    apply (frule prime_gt_1_int, arith)
   15.56 +    apply (subst gcd_commute_int, erule prime_imp_coprime_int, assumption)
   15.57      done
   15.58    also have "phi p = nat p - 1"
   15.59      by (rule phi_prime, rule prems)
   15.60 @@ -442,7 +442,7 @@
   15.61      apply auto
   15.62      done
   15.63    also have "\<dots> = fact (p - 1) mod p"
   15.64 -    apply (subst int_fact_altdef)
   15.65 +    apply (subst fact_altdef_int)
   15.66      apply (insert prems, force)
   15.67      apply (subst res_prime_units_eq, rule refl)
   15.68      done
   15.69 @@ -452,9 +452,9 @@
   15.70  qed
   15.71  
   15.72  lemma wilson_theorem: "prime (p::int) \<Longrightarrow> [fact (p - 1) = - 1] (mod p)"
   15.73 -  apply (frule int_prime_gt_1)
   15.74 +  apply (frule prime_gt_1_int)
   15.75    apply (case_tac "p = 2")
   15.76 -  apply (subst int_fact_altdef, simp)
   15.77 +  apply (subst fact_altdef_int, simp)
   15.78    apply (subst cong_int_def)
   15.79    apply simp
   15.80    apply (rule residues_prime.wilson_theorem1)
    16.1 --- a/src/HOL/NewNumberTheory/UniqueFactorization.thy	Tue Jul 07 07:56:24 2009 +0200
    16.2 +++ b/src/HOL/NewNumberTheory/UniqueFactorization.thy	Tue Jul 07 17:39:51 2009 +0200
    16.3 @@ -134,7 +134,7 @@
    16.4    moreover 
    16.5    {
    16.6      assume "n > 1" and "~ prime n"
    16.7 -    from prems nat_not_prime_eq_prod
    16.8 +    from prems not_prime_eq_prod_nat
    16.9        obtain m k where "n = m * k & 1 < m & m < n & 1 < k & k < n"
   16.10          by blast
   16.11      with ih obtain Q R where "(ALL p : set_of Q. prime p) & m = (PROD i:#Q. i)"
   16.12 @@ -182,13 +182,13 @@
   16.13        a^(count N a) * (PROD i : (set_of N - {a}). i ^ (count N i))".
   16.14    moreover have "coprime (a ^ count M a)
   16.15        (PROD i : (set_of N - {a}). i ^ (count N i))"
   16.16 -    apply (subst nat_gcd_commute)
   16.17 -    apply (rule nat_setprod_coprime)
   16.18 -    apply (rule nat_primes_imp_powers_coprime)
   16.19 +    apply (subst gcd_commute_nat)
   16.20 +    apply (rule setprod_coprime_nat)
   16.21 +    apply (rule primes_imp_powers_coprime_nat)
   16.22      apply (insert prems, auto) 
   16.23      done
   16.24    ultimately have "a ^ count M a dvd a^(count N a)"
   16.25 -    by (elim nat_coprime_dvd_mult)
   16.26 +    by (elim coprime_dvd_mult_nat)
   16.27    with a show ?thesis 
   16.28      by (intro power_dvd_imp_le, auto)
   16.29  next
   16.30 @@ -322,66 +322,66 @@
   16.31  
   16.32  subsection {* Properties of prime factors and multiplicity for nats and ints *}
   16.33  
   16.34 -lemma int_prime_factors_ge_0 [elim]: "p : prime_factors (n::int) \<Longrightarrow> p >= 0"
   16.35 +lemma prime_factors_ge_0_int [elim]: "p : prime_factors (n::int) \<Longrightarrow> p >= 0"
   16.36    by (unfold prime_factors_int_def, auto)
   16.37  
   16.38 -lemma nat_prime_factors_prime [intro]: "p : prime_factors (n::nat) \<Longrightarrow> prime p"
   16.39 +lemma prime_factors_prime_nat [intro]: "p : prime_factors (n::nat) \<Longrightarrow> prime p"
   16.40    apply (case_tac "n = 0")
   16.41    apply (simp add: prime_factors_nat_def multiset_prime_factorization_def)
   16.42    apply (auto simp add: prime_factors_nat_def multiset_prime_factorization)
   16.43  done
   16.44  
   16.45 -lemma int_prime_factors_prime [intro]:
   16.46 +lemma prime_factors_prime_int [intro]:
   16.47    assumes "n >= 0" and "p : prime_factors (n::int)"
   16.48    shows "prime p"
   16.49  
   16.50 -  apply (rule nat_prime_factors_prime [transferred, of n p])
   16.51 +  apply (rule prime_factors_prime_nat [transferred, of n p])
   16.52    using prems apply auto
   16.53  done
   16.54  
   16.55 -lemma nat_prime_factors_gt_0 [elim]: "p : prime_factors x \<Longrightarrow> p > (0::nat)"
   16.56 -  by (frule nat_prime_factors_prime, auto)
   16.57 +lemma prime_factors_gt_0_nat [elim]: "p : prime_factors x \<Longrightarrow> p > (0::nat)"
   16.58 +  by (frule prime_factors_prime_nat, auto)
   16.59  
   16.60 -lemma int_prime_factors_gt_0 [elim]: "x >= 0 \<Longrightarrow> p : prime_factors x \<Longrightarrow> 
   16.61 +lemma prime_factors_gt_0_int [elim]: "x >= 0 \<Longrightarrow> p : prime_factors x \<Longrightarrow> 
   16.62      p > (0::int)"
   16.63 -  by (frule (1) int_prime_factors_prime, auto)
   16.64 +  by (frule (1) prime_factors_prime_int, auto)
   16.65  
   16.66 -lemma nat_prime_factors_finite [iff]: "finite (prime_factors (n::nat))"
   16.67 +lemma prime_factors_finite_nat [iff]: "finite (prime_factors (n::nat))"
   16.68    by (unfold prime_factors_nat_def, auto)
   16.69  
   16.70 -lemma int_prime_factors_finite [iff]: "finite (prime_factors (n::int))"
   16.71 +lemma prime_factors_finite_int [iff]: "finite (prime_factors (n::int))"
   16.72    by (unfold prime_factors_int_def, auto)
   16.73  
   16.74 -lemma nat_prime_factors_altdef: "prime_factors (n::nat) = 
   16.75 +lemma prime_factors_altdef_nat: "prime_factors (n::nat) = 
   16.76      {p. multiplicity p n > 0}"
   16.77    by (force simp add: prime_factors_nat_def multiplicity_nat_def)
   16.78  
   16.79 -lemma int_prime_factors_altdef: "prime_factors (n::int) = 
   16.80 +lemma prime_factors_altdef_int: "prime_factors (n::int) = 
   16.81      {p. p >= 0 & multiplicity p n > 0}"
   16.82    apply (unfold prime_factors_int_def multiplicity_int_def)
   16.83 -  apply (subst nat_prime_factors_altdef)
   16.84 +  apply (subst prime_factors_altdef_nat)
   16.85    apply (auto simp add: image_def)
   16.86  done
   16.87  
   16.88 -lemma nat_prime_factorization: "(n::nat) > 0 \<Longrightarrow> 
   16.89 +lemma prime_factorization_nat: "(n::nat) > 0 \<Longrightarrow> 
   16.90      n = (PROD p : prime_factors n. p^(multiplicity p n))"
   16.91    by (frule multiset_prime_factorization, 
   16.92      simp add: prime_factors_nat_def multiplicity_nat_def msetprod_def)
   16.93  
   16.94 -thm nat_prime_factorization [transferred] 
   16.95 +thm prime_factorization_nat [transferred] 
   16.96  
   16.97 -lemma int_prime_factorization: 
   16.98 +lemma prime_factorization_int: 
   16.99    assumes "(n::int) > 0"
  16.100    shows "n = (PROD p : prime_factors n. p^(multiplicity p n))"
  16.101  
  16.102 -  apply (rule nat_prime_factorization [transferred, of n])
  16.103 +  apply (rule prime_factorization_nat [transferred, of n])
  16.104    using prems apply auto
  16.105  done
  16.106  
  16.107 -lemma nat_neq_zero_eq_gt_zero: "((x::nat) ~= 0) = (x > 0)"
  16.108 +lemma neq_zero_eq_gt_zero_nat: "((x::nat) ~= 0) = (x > 0)"
  16.109    by auto
  16.110  
  16.111 -lemma nat_prime_factorization_unique: 
  16.112 +lemma prime_factorization_unique_nat: 
  16.113      "S = { (p::nat) . f p > 0} \<Longrightarrow> finite S \<Longrightarrow> (ALL p : S. prime p) \<Longrightarrow>
  16.114        n = (PROD p : S. p^(f p)) \<Longrightarrow>
  16.115          S = prime_factors n & (ALL p. f p = multiplicity p n)"
  16.116 @@ -407,23 +407,23 @@
  16.117    unfolding multiset_def apply force 
  16.118  done
  16.119  
  16.120 -lemma nat_prime_factors_characterization: "S = {p. 0 < f (p::nat)} \<Longrightarrow> 
  16.121 +lemma prime_factors_characterization_nat: "S = {p. 0 < f (p::nat)} \<Longrightarrow> 
  16.122      finite S \<Longrightarrow> (ALL p:S. prime p) \<Longrightarrow> n = (PROD p:S. p ^ f p) \<Longrightarrow>
  16.123        prime_factors n = S"
  16.124 -  by (rule nat_prime_factorization_unique [THEN conjunct1, symmetric],
  16.125 +  by (rule prime_factorization_unique_nat [THEN conjunct1, symmetric],
  16.126      assumption+)
  16.127  
  16.128 -lemma nat_prime_factors_characterization': 
  16.129 +lemma prime_factors_characterization'_nat: 
  16.130    "finite {p. 0 < f (p::nat)} \<Longrightarrow>
  16.131      (ALL p. 0 < f p \<longrightarrow> prime p) \<Longrightarrow>
  16.132        prime_factors (PROD p | 0 < f p . p ^ f p) = {p. 0 < f p}"
  16.133 -  apply (rule nat_prime_factors_characterization)
  16.134 +  apply (rule prime_factors_characterization_nat)
  16.135    apply auto
  16.136  done
  16.137  
  16.138  (* A minor glitch:*)
  16.139  
  16.140 -thm nat_prime_factors_characterization' 
  16.141 +thm prime_factors_characterization'_nat 
  16.142      [where f = "%x. f (int (x::nat))", 
  16.143        transferred direction: nat "op <= (0::int)", rule_format]
  16.144  
  16.145 @@ -432,106 +432,106 @@
  16.146    remain a comparison between nats. But the transfer still works. 
  16.147  *)
  16.148  
  16.149 -lemma int_primes_characterization' [rule_format]: 
  16.150 +lemma primes_characterization'_int [rule_format]: 
  16.151      "finite {p. p >= 0 & 0 < f (p::int)} \<Longrightarrow>
  16.152        (ALL p. 0 < f p \<longrightarrow> prime p) \<Longrightarrow>
  16.153          prime_factors (PROD p | p >=0 & 0 < f p . p ^ f p) = 
  16.154            {p. p >= 0 & 0 < f p}"
  16.155  
  16.156 -  apply (insert nat_prime_factors_characterization' 
  16.157 +  apply (insert prime_factors_characterization'_nat 
  16.158      [where f = "%x. f (int (x::nat))", 
  16.159      transferred direction: nat "op <= (0::int)"])
  16.160    apply auto
  16.161  done
  16.162  
  16.163 -lemma int_prime_factors_characterization: "S = {p. 0 < f (p::int)} \<Longrightarrow> 
  16.164 +lemma prime_factors_characterization_int: "S = {p. 0 < f (p::int)} \<Longrightarrow> 
  16.165      finite S \<Longrightarrow> (ALL p:S. prime p) \<Longrightarrow> n = (PROD p:S. p ^ f p) \<Longrightarrow>
  16.166        prime_factors n = S"
  16.167    apply simp
  16.168    apply (subgoal_tac "{p. 0 < f p} = {p. 0 <= p & 0 < f p}")
  16.169    apply (simp only:)
  16.170 -  apply (subst int_primes_characterization')
  16.171 +  apply (subst primes_characterization'_int)
  16.172    apply auto
  16.173 -  apply (auto simp add: int_prime_ge_0)
  16.174 +  apply (auto simp add: prime_ge_0_int)
  16.175  done
  16.176  
  16.177 -lemma nat_multiplicity_characterization: "S = {p. 0 < f (p::nat)} \<Longrightarrow> 
  16.178 +lemma multiplicity_characterization_nat: "S = {p. 0 < f (p::nat)} \<Longrightarrow> 
  16.179      finite S \<Longrightarrow> (ALL p:S. prime p) \<Longrightarrow> n = (PROD p:S. p ^ f p) \<Longrightarrow>
  16.180        multiplicity p n = f p"
  16.181 -  by (frule nat_prime_factorization_unique [THEN conjunct2, rule_format, 
  16.182 +  by (frule prime_factorization_unique_nat [THEN conjunct2, rule_format, 
  16.183      symmetric], auto)
  16.184  
  16.185 -lemma nat_multiplicity_characterization': "finite {p. 0 < f (p::nat)} \<longrightarrow>
  16.186 +lemma multiplicity_characterization'_nat: "finite {p. 0 < f (p::nat)} \<longrightarrow>
  16.187      (ALL p. 0 < f p \<longrightarrow> prime p) \<longrightarrow>
  16.188        multiplicity p (PROD p | 0 < f p . p ^ f p) = f p"
  16.189    apply (rule impI)+
  16.190 -  apply (rule nat_multiplicity_characterization)
  16.191 +  apply (rule multiplicity_characterization_nat)
  16.192    apply auto
  16.193  done
  16.194  
  16.195 -lemma int_multiplicity_characterization' [rule_format]: 
  16.196 +lemma multiplicity_characterization'_int [rule_format]: 
  16.197    "finite {p. p >= 0 & 0 < f (p::int)} \<Longrightarrow>
  16.198      (ALL p. 0 < f p \<longrightarrow> prime p) \<Longrightarrow> p >= 0 \<Longrightarrow>
  16.199        multiplicity p (PROD p | p >= 0 & 0 < f p . p ^ f p) = f p"
  16.200  
  16.201 -  apply (insert nat_multiplicity_characterization' 
  16.202 +  apply (insert multiplicity_characterization'_nat 
  16.203      [where f = "%x. f (int (x::nat))", 
  16.204        transferred direction: nat "op <= (0::int)", rule_format])
  16.205    apply auto
  16.206  done
  16.207  
  16.208 -lemma int_multiplicity_characterization: "S = {p. 0 < f (p::int)} \<Longrightarrow> 
  16.209 +lemma multiplicity_characterization_int: "S = {p. 0 < f (p::int)} \<Longrightarrow> 
  16.210      finite S \<Longrightarrow> (ALL p:S. prime p) \<Longrightarrow> n = (PROD p:S. p ^ f p) \<Longrightarrow>
  16.211        p >= 0 \<Longrightarrow> multiplicity p n = f p"
  16.212    apply simp
  16.213    apply (subgoal_tac "{p. 0 < f p} = {p. 0 <= p & 0 < f p}")
  16.214    apply (simp only:)
  16.215 -  apply (subst int_multiplicity_characterization')
  16.216 +  apply (subst multiplicity_characterization'_int)
  16.217    apply auto
  16.218 -  apply (auto simp add: int_prime_ge_0)
  16.219 +  apply (auto simp add: prime_ge_0_int)
  16.220  done
  16.221  
  16.222 -lemma nat_multiplicity_zero [simp]: "multiplicity (p::nat) 0 = 0"
  16.223 +lemma multiplicity_zero_nat [simp]: "multiplicity (p::nat) 0 = 0"
  16.224    by (simp add: multiplicity_nat_def multiset_prime_factorization_def)
  16.225  
  16.226 -lemma int_multiplicity_zero [simp]: "multiplicity (p::int) 0 = 0"
  16.227 +lemma multiplicity_zero_int [simp]: "multiplicity (p::int) 0 = 0"
  16.228    by (simp add: multiplicity_int_def) 
  16.229  
  16.230 -lemma nat_multiplicity_one [simp]: "multiplicity p (1::nat) = 0"
  16.231 -  by (subst nat_multiplicity_characterization [where f = "%x. 0"], auto)
  16.232 +lemma multiplicity_one_nat [simp]: "multiplicity p (1::nat) = 0"
  16.233 +  by (subst multiplicity_characterization_nat [where f = "%x. 0"], auto)
  16.234  
  16.235 -lemma int_multiplicity_one [simp]: "multiplicity p (1::int) = 0"
  16.236 +lemma multiplicity_one_int [simp]: "multiplicity p (1::int) = 0"
  16.237    by (simp add: multiplicity_int_def)
  16.238  
  16.239 -lemma nat_multiplicity_prime [simp]: "prime (p::nat) \<Longrightarrow> multiplicity p p = 1"
  16.240 -  apply (subst nat_multiplicity_characterization
  16.241 +lemma multiplicity_prime_nat [simp]: "prime (p::nat) \<Longrightarrow> multiplicity p p = 1"
  16.242 +  apply (subst multiplicity_characterization_nat
  16.243        [where f = "(%q. if q = p then 1 else 0)"])
  16.244    apply auto
  16.245    apply (case_tac "x = p")
  16.246    apply auto
  16.247  done
  16.248  
  16.249 -lemma int_multiplicity_prime [simp]: "prime (p::int) \<Longrightarrow> multiplicity p p = 1"
  16.250 +lemma multiplicity_prime_int [simp]: "prime (p::int) \<Longrightarrow> multiplicity p p = 1"
  16.251    unfolding prime_int_def multiplicity_int_def by auto
  16.252  
  16.253 -lemma nat_multiplicity_prime_power [simp]: "prime (p::nat) \<Longrightarrow> 
  16.254 +lemma multiplicity_prime_power_nat [simp]: "prime (p::nat) \<Longrightarrow> 
  16.255      multiplicity p (p^n) = n"
  16.256    apply (case_tac "n = 0")
  16.257    apply auto
  16.258 -  apply (subst nat_multiplicity_characterization
  16.259 +  apply (subst multiplicity_characterization_nat
  16.260        [where f = "(%q. if q = p then n else 0)"])
  16.261    apply auto
  16.262    apply (case_tac "x = p")
  16.263    apply auto
  16.264  done
  16.265  
  16.266 -lemma int_multiplicity_prime_power [simp]: "prime (p::int) \<Longrightarrow> 
  16.267 +lemma multiplicity_prime_power_int [simp]: "prime (p::int) \<Longrightarrow> 
  16.268      multiplicity p (p^n) = n"
  16.269 -  apply (frule int_prime_ge_0)
  16.270 +  apply (frule prime_ge_0_int)
  16.271    apply (auto simp add: prime_int_def multiplicity_int_def nat_power_eq)
  16.272  done
  16.273  
  16.274 -lemma nat_multiplicity_nonprime [simp]: "~ prime (p::nat) \<Longrightarrow> 
  16.275 +lemma multiplicity_nonprime_nat [simp]: "~ prime (p::nat) \<Longrightarrow> 
  16.276      multiplicity p n = 0"
  16.277    apply (case_tac "n = 0")
  16.278    apply auto
  16.279 @@ -539,22 +539,22 @@
  16.280    apply (auto simp add: set_of_def multiplicity_nat_def)
  16.281  done
  16.282  
  16.283 -lemma int_multiplicity_nonprime [simp]: "~ prime (p::int) \<Longrightarrow> multiplicity p n = 0"
  16.284 +lemma multiplicity_nonprime_int [simp]: "~ prime (p::int) \<Longrightarrow> multiplicity p n = 0"
  16.285    by (unfold multiplicity_int_def prime_int_def, auto)
  16.286  
  16.287 -lemma nat_multiplicity_not_factor [simp]: 
  16.288 +lemma multiplicity_not_factor_nat [simp]: 
  16.289      "p ~: prime_factors (n::nat) \<Longrightarrow> multiplicity p n = 0"
  16.290 -  by (subst (asm) nat_prime_factors_altdef, auto)
  16.291 +  by (subst (asm) prime_factors_altdef_nat, auto)
  16.292  
  16.293 -lemma int_multiplicity_not_factor [simp]: 
  16.294 +lemma multiplicity_not_factor_int [simp]: 
  16.295      "p >= 0 \<Longrightarrow> p ~: prime_factors (n::int) \<Longrightarrow> multiplicity p n = 0"
  16.296 -  by (subst (asm) int_prime_factors_altdef, auto)
  16.297 +  by (subst (asm) prime_factors_altdef_int, auto)
  16.298  
  16.299 -lemma nat_multiplicity_product_aux: "(k::nat) > 0 \<Longrightarrow> l > 0 \<Longrightarrow>
  16.300 +lemma multiplicity_product_aux_nat: "(k::nat) > 0 \<Longrightarrow> l > 0 \<Longrightarrow>
  16.301      (prime_factors k) Un (prime_factors l) = prime_factors (k * l) &
  16.302      (ALL p. multiplicity p k + multiplicity p l = multiplicity p (k * l))"
  16.303 -  apply (rule nat_prime_factorization_unique)
  16.304 -  apply (simp only: nat_prime_factors_altdef)
  16.305 +  apply (rule prime_factorization_unique_nat)
  16.306 +  apply (simp only: prime_factors_altdef_nat)
  16.307    apply auto
  16.308    apply (subst power_add)
  16.309    apply (subst setprod_timesf)
  16.310 @@ -568,7 +568,7 @@
  16.311        (\<Prod>p\<in>prime_factors l - prime_factors k. 1)")
  16.312    apply (erule ssubst)
  16.313    apply (simp add: setprod_1)
  16.314 -  apply (erule nat_prime_factorization)
  16.315 +  apply (erule prime_factorization_nat)
  16.316    apply (rule setprod_cong, auto)
  16.317    apply (subgoal_tac "prime_factors k Un prime_factors l = prime_factors l Un 
  16.318        (prime_factors k - prime_factors l)")
  16.319 @@ -579,47 +579,47 @@
  16.320        (\<Prod>p\<in>prime_factors k - prime_factors l. 1)")
  16.321    apply (erule ssubst)
  16.322    apply (simp add: setprod_1)
  16.323 -  apply (erule nat_prime_factorization)
  16.324 +  apply (erule prime_factorization_nat)
  16.325    apply (rule setprod_cong, auto)
  16.326  done
  16.327  
  16.328  (* transfer doesn't have the same problem here with the right 
  16.329     choice of rules. *)
  16.330  
  16.331 -lemma int_multiplicity_product_aux: 
  16.332 +lemma multiplicity_product_aux_int: 
  16.333    assumes "(k::int) > 0" and "l > 0"
  16.334    shows 
  16.335      "(prime_factors k) Un (prime_factors l) = prime_factors (k * l) &
  16.336      (ALL p >= 0. multiplicity p k + multiplicity p l = multiplicity p (k * l))"
  16.337  
  16.338 -  apply (rule nat_multiplicity_product_aux [transferred, of l k])
  16.339 +  apply (rule multiplicity_product_aux_nat [transferred, of l k])
  16.340    using prems apply auto
  16.341  done
  16.342  
  16.343 -lemma nat_prime_factors_product: "(k::nat) > 0 \<Longrightarrow> l > 0 \<Longrightarrow> prime_factors (k * l) = 
  16.344 +lemma prime_factors_product_nat: "(k::nat) > 0 \<Longrightarrow> l > 0 \<Longrightarrow> prime_factors (k * l) = 
  16.345      prime_factors k Un prime_factors l"
  16.346 -  by (rule nat_multiplicity_product_aux [THEN conjunct1, symmetric])
  16.347 +  by (rule multiplicity_product_aux_nat [THEN conjunct1, symmetric])
  16.348  
  16.349 -lemma int_prime_factors_product: "(k::int) > 0 \<Longrightarrow> l > 0 \<Longrightarrow> prime_factors (k * l) = 
  16.350 +lemma prime_factors_product_int: "(k::int) > 0 \<Longrightarrow> l > 0 \<Longrightarrow> prime_factors (k * l) = 
  16.351      prime_factors k Un prime_factors l"
  16.352 -  by (rule int_multiplicity_product_aux [THEN conjunct1, symmetric])
  16.353 +  by (rule multiplicity_product_aux_int [THEN conjunct1, symmetric])
  16.354  
  16.355 -lemma nat_multiplicity_product: "(k::nat) > 0 \<Longrightarrow> l > 0 \<Longrightarrow> multiplicity p (k * l) = 
  16.356 +lemma multiplicity_product_nat: "(k::nat) > 0 \<Longrightarrow> l > 0 \<Longrightarrow> multiplicity p (k * l) = 
  16.357      multiplicity p k + multiplicity p l"
  16.358 -  by (rule nat_multiplicity_product_aux [THEN conjunct2, rule_format, 
  16.359 +  by (rule multiplicity_product_aux_nat [THEN conjunct2, rule_format, 
  16.360        symmetric])
  16.361  
  16.362 -lemma int_multiplicity_product: "(k::int) > 0 \<Longrightarrow> l > 0 \<Longrightarrow> p >= 0 \<Longrightarrow> 
  16.363 +lemma multiplicity_product_int: "(k::int) > 0 \<Longrightarrow> l > 0 \<Longrightarrow> p >= 0 \<Longrightarrow> 
  16.364      multiplicity p (k * l) = multiplicity p k + multiplicity p l"
  16.365 -  by (rule int_multiplicity_product_aux [THEN conjunct2, rule_format, 
  16.366 +  by (rule multiplicity_product_aux_int [THEN conjunct2, rule_format, 
  16.367        symmetric])
  16.368  
  16.369 -lemma nat_multiplicity_setprod: "finite S \<Longrightarrow> (ALL x : S. f x > 0) \<Longrightarrow> 
  16.370 +lemma multiplicity_setprod_nat: "finite S \<Longrightarrow> (ALL x : S. f x > 0) \<Longrightarrow> 
  16.371      multiplicity (p::nat) (PROD x : S. f x) = 
  16.372        (SUM x : S. multiplicity p (f x))"
  16.373    apply (induct set: finite)
  16.374    apply auto
  16.375 -  apply (subst nat_multiplicity_product)
  16.376 +  apply (subst multiplicity_product_nat)
  16.377    apply auto
  16.378  done
  16.379  
  16.380 @@ -643,12 +643,12 @@
  16.381    add return: transfer_nat_int_sum_prod_closure3
  16.382    del: transfer_nat_int_sum_prod2 (1)]
  16.383  
  16.384 -lemma int_multiplicity_setprod: "p >= 0 \<Longrightarrow> finite S \<Longrightarrow> 
  16.385 +lemma multiplicity_setprod_int: "p >= 0 \<Longrightarrow> finite S \<Longrightarrow> 
  16.386    (ALL x : S. f x > 0) \<Longrightarrow> 
  16.387      multiplicity (p::int) (PROD x : S. f x) = 
  16.388        (SUM x : S. multiplicity p (f x))"
  16.389  
  16.390 -  apply (frule nat_multiplicity_setprod
  16.391 +  apply (frule multiplicity_setprod_nat
  16.392      [where f = "%x. nat(int(nat(f x)))", 
  16.393        transferred direction: nat "op <= (0::int)"])
  16.394    apply auto
  16.395 @@ -663,13 +663,13 @@
  16.396  declare TransferMorphism_nat_int[transfer 
  16.397    add return: transfer_nat_int_sum_prod2 (1)]
  16.398  
  16.399 -lemma nat_multiplicity_prod_prime_powers:
  16.400 +lemma multiplicity_prod_prime_powers_nat:
  16.401      "finite S \<Longrightarrow> (ALL p : S. prime (p::nat)) \<Longrightarrow>
  16.402         multiplicity p (PROD p : S. p ^ f p) = (if p : S then f p else 0)"
  16.403    apply (subgoal_tac "(PROD p : S. p ^ f p) = 
  16.404        (PROD p : S. p ^ (%x. if x : S then f x else 0) p)")
  16.405    apply (erule ssubst)
  16.406 -  apply (subst nat_multiplicity_characterization)
  16.407 +  apply (subst multiplicity_characterization_nat)
  16.408    prefer 5 apply (rule refl)
  16.409    apply (rule refl)
  16.410    apply auto
  16.411 @@ -683,85 +683,85 @@
  16.412  
  16.413  (* Here the issue with transfer is the implicit quantifier over S *)
  16.414  
  16.415 -lemma int_multiplicity_prod_prime_powers:
  16.416 +lemma multiplicity_prod_prime_powers_int:
  16.417      "(p::int) >= 0 \<Longrightarrow> finite S \<Longrightarrow> (ALL p : S. prime p) \<Longrightarrow>
  16.418         multiplicity p (PROD p : S. p ^ f p) = (if p : S then f p else 0)"
  16.419  
  16.420    apply (subgoal_tac "int ` nat ` S = S")
  16.421 -  apply (frule nat_multiplicity_prod_prime_powers [where f = "%x. f(int x)" 
  16.422 +  apply (frule multiplicity_prod_prime_powers_nat [where f = "%x. f(int x)" 
  16.423      and S = "nat ` S", transferred])
  16.424    apply auto
  16.425    apply (subst prime_int_def [symmetric])
  16.426    apply auto
  16.427    apply (subgoal_tac "xb >= 0")
  16.428    apply force
  16.429 -  apply (rule int_prime_ge_0)
  16.430 +  apply (rule prime_ge_0_int)
  16.431    apply force
  16.432    apply (subst transfer_nat_int_set_return_embed)
  16.433    apply (unfold nat_set_def, auto)
  16.434  done
  16.435  
  16.436 -lemma nat_multiplicity_distinct_prime_power: "prime (p::nat) \<Longrightarrow> prime q \<Longrightarrow>
  16.437 +lemma multiplicity_distinct_prime_power_nat: "prime (p::nat) \<Longrightarrow> prime q \<Longrightarrow>
  16.438      p ~= q \<Longrightarrow> multiplicity p (q^n) = 0"
  16.439    apply (subgoal_tac "q^n = setprod (%x. x^n) {q}")
  16.440    apply (erule ssubst)
  16.441 -  apply (subst nat_multiplicity_prod_prime_powers)
  16.442 +  apply (subst multiplicity_prod_prime_powers_nat)
  16.443    apply auto
  16.444  done
  16.445  
  16.446 -lemma int_multiplicity_distinct_prime_power: "prime (p::int) \<Longrightarrow> prime q \<Longrightarrow>
  16.447 +lemma multiplicity_distinct_prime_power_int: "prime (p::int) \<Longrightarrow> prime q \<Longrightarrow>
  16.448      p ~= q \<Longrightarrow> multiplicity p (q^n) = 0"
  16.449 -  apply (frule int_prime_ge_0 [of q])
  16.450 -  apply (frule nat_multiplicity_distinct_prime_power [transferred leaving: n]) 
  16.451 +  apply (frule prime_ge_0_int [of q])
  16.452 +  apply (frule multiplicity_distinct_prime_power_nat [transferred leaving: n]) 
  16.453    prefer 4
  16.454    apply assumption
  16.455    apply auto
  16.456  done
  16.457  
  16.458 -lemma nat_dvd_multiplicity: 
  16.459 +lemma dvd_multiplicity_nat: 
  16.460      "(0::nat) < y \<Longrightarrow> x dvd y \<Longrightarrow> multiplicity p x <= multiplicity p y"
  16.461    apply (case_tac "x = 0")
  16.462 -  apply (auto simp add: dvd_def nat_multiplicity_product)
  16.463 +  apply (auto simp add: dvd_def multiplicity_product_nat)
  16.464  done
  16.465  
  16.466 -lemma int_dvd_multiplicity: 
  16.467 +lemma dvd_multiplicity_int: 
  16.468      "(0::int) < y \<Longrightarrow> 0 <= x \<Longrightarrow> x dvd y \<Longrightarrow> p >= 0 \<Longrightarrow> 
  16.469        multiplicity p x <= multiplicity p y"
  16.470    apply (case_tac "x = 0")
  16.471    apply (auto simp add: dvd_def)
  16.472    apply (subgoal_tac "0 < k")
  16.473 -  apply (auto simp add: int_multiplicity_product)
  16.474 +  apply (auto simp add: multiplicity_product_int)
  16.475    apply (erule zero_less_mult_pos)
  16.476    apply arith
  16.477  done
  16.478  
  16.479 -lemma nat_dvd_prime_factors [intro]:
  16.480 +lemma dvd_prime_factors_nat [intro]:
  16.481      "0 < (y::nat) \<Longrightarrow> x dvd y \<Longrightarrow> prime_factors x <= prime_factors y"
  16.482 -  apply (simp only: nat_prime_factors_altdef)
  16.483 +  apply (simp only: prime_factors_altdef_nat)
  16.484    apply auto
  16.485 -  apply (frule nat_dvd_multiplicity)
  16.486 +  apply (frule dvd_multiplicity_nat)
  16.487    apply auto
  16.488  (* It is a shame that auto and arith don't get this. *)
  16.489    apply (erule order_less_le_trans)back
  16.490    apply assumption
  16.491  done
  16.492  
  16.493 -lemma int_dvd_prime_factors [intro]:
  16.494 +lemma dvd_prime_factors_int [intro]:
  16.495      "0 < (y::int) \<Longrightarrow> 0 <= x \<Longrightarrow> x dvd y \<Longrightarrow> prime_factors x <= prime_factors y"
  16.496 -  apply (auto simp add: int_prime_factors_altdef)
  16.497 +  apply (auto simp add: prime_factors_altdef_int)
  16.498    apply (erule order_less_le_trans)
  16.499 -  apply (rule int_dvd_multiplicity)
  16.500 +  apply (rule dvd_multiplicity_int)
  16.501    apply auto
  16.502  done
  16.503  
  16.504 -lemma nat_multiplicity_dvd: "0 < (x::nat) \<Longrightarrow> 0 < y \<Longrightarrow> 
  16.505 +lemma multiplicity_dvd_nat: "0 < (x::nat) \<Longrightarrow> 0 < y \<Longrightarrow> 
  16.506      ALL p. multiplicity p x <= multiplicity p y \<Longrightarrow>
  16.507        x dvd y"
  16.508 -  apply (subst nat_prime_factorization [of x], assumption)
  16.509 -  apply (subst nat_prime_factorization [of y], assumption)
  16.510 +  apply (subst prime_factorization_nat [of x], assumption)
  16.511 +  apply (subst prime_factorization_nat [of y], assumption)
  16.512    apply (rule setprod_dvd_setprod_subset2)
  16.513    apply force
  16.514 -  apply (subst nat_prime_factors_altdef)+
  16.515 +  apply (subst prime_factors_altdef_nat)+
  16.516    apply auto
  16.517  (* Again, a shame that auto and arith don't get this. *)
  16.518    apply (drule_tac x = xa in spec, auto)
  16.519 @@ -769,14 +769,14 @@
  16.520    apply blast
  16.521  done
  16.522  
  16.523 -lemma int_multiplicity_dvd: "0 < (x::int) \<Longrightarrow> 0 < y \<Longrightarrow> 
  16.524 +lemma multiplicity_dvd_int: "0 < (x::int) \<Longrightarrow> 0 < y \<Longrightarrow> 
  16.525      ALL p >= 0. multiplicity p x <= multiplicity p y \<Longrightarrow>
  16.526        x dvd y"
  16.527 -  apply (subst int_prime_factorization [of x], assumption)
  16.528 -  apply (subst int_prime_factorization [of y], assumption)
  16.529 +  apply (subst prime_factorization_int [of x], assumption)
  16.530 +  apply (subst prime_factorization_int [of y], assumption)
  16.531    apply (rule setprod_dvd_setprod_subset2)
  16.532    apply force
  16.533 -  apply (subst int_prime_factors_altdef)+
  16.534 +  apply (subst prime_factors_altdef_int)+
  16.535    apply auto
  16.536    apply (rule dvd_power_le)
  16.537    apply auto
  16.538 @@ -785,83 +785,83 @@
  16.539    apply auto
  16.540  done
  16.541  
  16.542 -lemma nat_multiplicity_dvd': "(0::nat) < x \<Longrightarrow> 
  16.543 +lemma multiplicity_dvd'_nat: "(0::nat) < x \<Longrightarrow> 
  16.544      \<forall>p. prime p \<longrightarrow> multiplicity p x \<le> multiplicity p y \<Longrightarrow> x dvd y"
  16.545    apply (cases "y = 0")
  16.546    apply auto
  16.547 -  apply (rule nat_multiplicity_dvd, auto)
  16.548 +  apply (rule multiplicity_dvd_nat, auto)
  16.549    apply (case_tac "prime p")
  16.550    apply auto
  16.551  done
  16.552  
  16.553 -lemma int_multiplicity_dvd': "(0::int) < x \<Longrightarrow> 0 <= y \<Longrightarrow>
  16.554 +lemma multiplicity_dvd'_int: "(0::int) < x \<Longrightarrow> 0 <= y \<Longrightarrow>
  16.555      \<forall>p. prime p \<longrightarrow> multiplicity p x \<le> multiplicity p y \<Longrightarrow> x dvd y"
  16.556    apply (cases "y = 0")
  16.557    apply auto
  16.558 -  apply (rule int_multiplicity_dvd, auto)
  16.559 +  apply (rule multiplicity_dvd_int, auto)
  16.560    apply (case_tac "prime p")
  16.561    apply auto
  16.562  done
  16.563  
  16.564 -lemma nat_dvd_multiplicity_eq: "0 < (x::nat) \<Longrightarrow> 0 < y \<Longrightarrow>
  16.565 +lemma dvd_multiplicity_eq_nat: "0 < (x::nat) \<Longrightarrow> 0 < y \<Longrightarrow>
  16.566      (x dvd y) = (ALL p. multiplicity p x <= multiplicity p y)"
  16.567 -  by (auto intro: nat_dvd_multiplicity nat_multiplicity_dvd)
  16.568 +  by (auto intro: dvd_multiplicity_nat multiplicity_dvd_nat)
  16.569  
  16.570 -lemma int_dvd_multiplicity_eq: "0 < (x::int) \<Longrightarrow> 0 < y \<Longrightarrow>
  16.571 +lemma dvd_multiplicity_eq_int: "0 < (x::int) \<Longrightarrow> 0 < y \<Longrightarrow>
  16.572      (x dvd y) = (ALL p >= 0. multiplicity p x <= multiplicity p y)"
  16.573 -  by (auto intro: int_dvd_multiplicity int_multiplicity_dvd)
  16.574 +  by (auto intro: dvd_multiplicity_int multiplicity_dvd_int)
  16.575  
  16.576 -lemma nat_prime_factors_altdef2: "(n::nat) > 0 \<Longrightarrow> 
  16.577 +lemma prime_factors_altdef2_nat: "(n::nat) > 0 \<Longrightarrow> 
  16.578      (p : prime_factors n) = (prime p & p dvd n)"
  16.579    apply (case_tac "prime p")
  16.580    apply auto
  16.581 -  apply (subst nat_prime_factorization [where n = n], assumption)
  16.582 +  apply (subst prime_factorization_nat [where n = n], assumption)
  16.583    apply (rule dvd_trans) 
  16.584    apply (rule dvd_power [where x = p and n = "multiplicity p n"])
  16.585 -  apply (subst (asm) nat_prime_factors_altdef, force)
  16.586 +  apply (subst (asm) prime_factors_altdef_nat, force)
  16.587    apply (rule dvd_setprod)
  16.588    apply auto  
  16.589 -  apply (subst nat_prime_factors_altdef)
  16.590 -  apply (subst (asm) nat_dvd_multiplicity_eq)
  16.591 +  apply (subst prime_factors_altdef_nat)
  16.592 +  apply (subst (asm) dvd_multiplicity_eq_nat)
  16.593    apply auto
  16.594    apply (drule spec [where x = p])
  16.595    apply auto
  16.596  done
  16.597  
  16.598 -lemma int_prime_factors_altdef2: 
  16.599 +lemma prime_factors_altdef2_int: 
  16.600    assumes "(n::int) > 0" 
  16.601    shows "(p : prime_factors n) = (prime p & p dvd n)"
  16.602  
  16.603    apply (case_tac "p >= 0")
  16.604 -  apply (rule nat_prime_factors_altdef2 [transferred])
  16.605 +  apply (rule prime_factors_altdef2_nat [transferred])
  16.606    using prems apply auto
  16.607 -  apply (auto simp add: int_prime_ge_0 int_prime_factors_ge_0)
  16.608 +  apply (auto simp add: prime_ge_0_int prime_factors_ge_0_int)
  16.609  done
  16.610  
  16.611 -lemma nat_multiplicity_eq:
  16.612 +lemma multiplicity_eq_nat:
  16.613    fixes x and y::nat 
  16.614    assumes [arith]: "x > 0" "y > 0" and
  16.615      mult_eq [simp]: "!!p. prime p \<Longrightarrow> multiplicity p x = multiplicity p y"
  16.616    shows "x = y"
  16.617  
  16.618    apply (rule dvd_anti_sym)
  16.619 -  apply (auto intro: nat_multiplicity_dvd') 
  16.620 +  apply (auto intro: multiplicity_dvd'_nat) 
  16.621  done
  16.622  
  16.623 -lemma int_multiplicity_eq:
  16.624 +lemma multiplicity_eq_int:
  16.625    fixes x and y::int 
  16.626    assumes [arith]: "x > 0" "y > 0" and
  16.627      mult_eq [simp]: "!!p. prime p \<Longrightarrow> multiplicity p x = multiplicity p y"
  16.628    shows "x = y"
  16.629  
  16.630    apply (rule dvd_anti_sym [transferred])
  16.631 -  apply (auto intro: int_multiplicity_dvd') 
  16.632 +  apply (auto intro: multiplicity_dvd'_int) 
  16.633  done
  16.634  
  16.635  
  16.636  subsection {* An application *}
  16.637  
  16.638 -lemma nat_gcd_eq: 
  16.639 +lemma gcd_eq_nat: 
  16.640    assumes pos [arith]: "x > 0" "y > 0"
  16.641    shows "gcd (x::nat) y = 
  16.642      (PROD p: prime_factors x Un prime_factors y. 
  16.643 @@ -874,26 +874,26 @@
  16.644    have aux: "!!p. prime p \<Longrightarrow> multiplicity p z = 
  16.645        min (multiplicity p x) (multiplicity p y)"
  16.646      unfolding z_def
  16.647 -    apply (subst nat_multiplicity_prod_prime_powers)
  16.648 -    apply (auto simp add: nat_multiplicity_not_factor)
  16.649 +    apply (subst multiplicity_prod_prime_powers_nat)
  16.650 +    apply (auto simp add: multiplicity_not_factor_nat)
  16.651      done
  16.652    have "z dvd x" 
  16.653 -    by (intro nat_multiplicity_dvd', auto simp add: aux)
  16.654 +    by (intro multiplicity_dvd'_nat, auto simp add: aux)
  16.655    moreover have "z dvd y" 
  16.656 -    by (intro nat_multiplicity_dvd', auto simp add: aux)
  16.657 +    by (intro multiplicity_dvd'_nat, auto simp add: aux)
  16.658    moreover have "ALL w. w dvd x & w dvd y \<longrightarrow> w dvd z"
  16.659      apply auto
  16.660      apply (case_tac "w = 0", auto)
  16.661 -    apply (erule nat_multiplicity_dvd')
  16.662 -    apply (auto intro: nat_dvd_multiplicity simp add: aux)
  16.663 +    apply (erule multiplicity_dvd'_nat)
  16.664 +    apply (auto intro: dvd_multiplicity_nat simp add: aux)
  16.665      done
  16.666    ultimately have "z = gcd x y"
  16.667 -    by (subst nat_gcd_unique [symmetric], blast)
  16.668 +    by (subst gcd_unique_nat [symmetric], blast)
  16.669    thus ?thesis
  16.670      unfolding z_def by auto
  16.671  qed
  16.672  
  16.673 -lemma nat_lcm_eq: 
  16.674 +lemma lcm_eq_nat: 
  16.675    assumes pos [arith]: "x > 0" "y > 0"
  16.676    shows "lcm (x::nat) y = 
  16.677      (PROD p: prime_factors x Un prime_factors y. 
  16.678 @@ -906,61 +906,61 @@
  16.679    have aux: "!!p. prime p \<Longrightarrow> multiplicity p z = 
  16.680        max (multiplicity p x) (multiplicity p y)"
  16.681      unfolding z_def
  16.682 -    apply (subst nat_multiplicity_prod_prime_powers)
  16.683 -    apply (auto simp add: nat_multiplicity_not_factor)
  16.684 +    apply (subst multiplicity_prod_prime_powers_nat)
  16.685 +    apply (auto simp add: multiplicity_not_factor_nat)
  16.686      done
  16.687    have "x dvd z" 
  16.688 -    by (intro nat_multiplicity_dvd', auto simp add: aux)
  16.689 +    by (intro multiplicity_dvd'_nat, auto simp add: aux)
  16.690    moreover have "y dvd z" 
  16.691 -    by (intro nat_multiplicity_dvd', auto simp add: aux)
  16.692 +    by (intro multiplicity_dvd'_nat, auto simp add: aux)
  16.693    moreover have "ALL w. x dvd w & y dvd w \<longrightarrow> z dvd w"
  16.694      apply auto
  16.695      apply (case_tac "w = 0", auto)
  16.696 -    apply (rule nat_multiplicity_dvd')
  16.697 -    apply (auto intro: nat_dvd_multiplicity simp add: aux)
  16.698 +    apply (rule multiplicity_dvd'_nat)
  16.699 +    apply (auto intro: dvd_multiplicity_nat simp add: aux)
  16.700      done
  16.701    ultimately have "z = lcm x y"
  16.702 -    by (subst nat_lcm_unique [symmetric], blast)
  16.703 +    by (subst lcm_unique_nat [symmetric], blast)
  16.704    thus ?thesis
  16.705      unfolding z_def by auto
  16.706  qed
  16.707  
  16.708 -lemma nat_multiplicity_gcd: 
  16.709 +lemma multiplicity_gcd_nat: 
  16.710    assumes [arith]: "x > 0" "y > 0"
  16.711    shows "multiplicity (p::nat) (gcd x y) = 
  16.712      min (multiplicity p x) (multiplicity p y)"
  16.713  
  16.714 -  apply (subst nat_gcd_eq)
  16.715 +  apply (subst gcd_eq_nat)
  16.716    apply auto
  16.717 -  apply (subst nat_multiplicity_prod_prime_powers)
  16.718 +  apply (subst multiplicity_prod_prime_powers_nat)
  16.719    apply auto
  16.720  done
  16.721  
  16.722 -lemma nat_multiplicity_lcm: 
  16.723 +lemma multiplicity_lcm_nat: 
  16.724    assumes [arith]: "x > 0" "y > 0"
  16.725    shows "multiplicity (p::nat) (lcm x y) = 
  16.726      max (multiplicity p x) (multiplicity p y)"
  16.727  
  16.728 -  apply (subst nat_lcm_eq)
  16.729 +  apply (subst lcm_eq_nat)
  16.730    apply auto
  16.731 -  apply (subst nat_multiplicity_prod_prime_powers)
  16.732 +  apply (subst multiplicity_prod_prime_powers_nat)
  16.733    apply auto
  16.734  done
  16.735  
  16.736 -lemma nat_gcd_lcm_distrib: "gcd (x::nat) (lcm y z) = lcm (gcd x y) (gcd x z)"
  16.737 +lemma gcd_lcm_distrib_nat: "gcd (x::nat) (lcm y z) = lcm (gcd x y) (gcd x z)"
  16.738    apply (case_tac "x = 0 | y = 0 | z = 0") 
  16.739    apply auto
  16.740 -  apply (rule nat_multiplicity_eq)
  16.741 -  apply (auto simp add: nat_multiplicity_gcd nat_multiplicity_lcm 
  16.742 -      nat_lcm_pos)
  16.743 +  apply (rule multiplicity_eq_nat)
  16.744 +  apply (auto simp add: multiplicity_gcd_nat multiplicity_lcm_nat 
  16.745 +      lcm_pos_nat)
  16.746  done
  16.747  
  16.748 -lemma int_gcd_lcm_distrib: "gcd (x::int) (lcm y z) = lcm (gcd x y) (gcd x z)"
  16.749 -  apply (subst (1 2 3) int_gcd_abs)
  16.750 -  apply (subst int_lcm_abs)
  16.751 +lemma gcd_lcm_distrib_int: "gcd (x::int) (lcm y z) = lcm (gcd x y) (gcd x z)"
  16.752 +  apply (subst (1 2 3) gcd_abs_int)
  16.753 +  apply (subst lcm_abs_int)
  16.754    apply (subst (2) abs_of_nonneg)
  16.755    apply force
  16.756 -  apply (rule nat_gcd_lcm_distrib [transferred])
  16.757 +  apply (rule gcd_lcm_distrib_nat [transferred])
  16.758    apply auto
  16.759  done
  16.760  
    17.1 --- a/src/HOL/RealDef.thy	Tue Jul 07 07:56:24 2009 +0200
    17.2 +++ b/src/HOL/RealDef.thy	Tue Jul 07 17:39:51 2009 +0200
    17.3 @@ -925,7 +925,7 @@
    17.4    have "?gcd' = 1"
    17.5    proof -
    17.6      have "?gcd * ?gcd' = gcd (?gcd * ?k) (?gcd * ?l)"
    17.7 -      by (rule nat_gcd_mult_distrib)
    17.8 +      by (rule gcd_mult_distrib_nat)
    17.9      with gcd_k gcd_l have "?gcd * ?gcd' = ?gcd" by simp
   17.10      with gcd show ?thesis by auto
   17.11    qed
    18.1 --- a/src/HOL/ex/LocaleTest2.thy	Tue Jul 07 07:56:24 2009 +0200
    18.2 +++ b/src/HOL/ex/LocaleTest2.thy	Tue Jul 07 17:39:51 2009 +0200
    18.3 @@ -599,7 +599,7 @@
    18.4      apply (rule_tac x = "gcd x y" in exI)
    18.5      apply auto [1]
    18.6      apply (rule_tac x = "lcm x y" in exI)
    18.7 -    apply (auto intro: nat_lcm_dvd1 nat_lcm_dvd2 nat_lcm_least)
    18.8 +    apply (auto intro: lcm_dvd1_nat lcm_dvd2_nat lcm_least_nat)
    18.9      done
   18.10    then interpret nat_dvd: dlat "op dvd :: [nat, nat] => bool" .
   18.11    txt {* Interpretation to ease use of definitions, which are
   18.12 @@ -613,7 +613,7 @@
   18.13      apply (unfold nat_dvd.join_def)
   18.14      apply (rule the_equality)
   18.15      apply (unfold nat_dvd.is_sup_def)
   18.16 -    by (auto intro: nat_lcm_dvd1 nat_lcm_dvd2 nat_lcm_least)
   18.17 +    by (auto intro: lcm_dvd1_nat lcm_dvd2_nat lcm_least_nat)
   18.18  qed
   18.19  
   18.20  text {* Interpreted theorems from the locales, involving defined terms. *}
    19.1 --- a/src/HOL/ex/Sqrt.thy	Tue Jul 07 07:56:24 2009 +0200
    19.2 +++ b/src/HOL/ex/Sqrt.thy	Tue Jul 07 17:39:51 2009 +0200
    19.3 @@ -34,12 +34,12 @@
    19.4    have "p dvd m \<and> p dvd n"
    19.5    proof
    19.6      from eq have "p dvd m\<twosuperior>" ..
    19.7 -    with `prime p` pos2 show "p dvd m" by (rule nat_prime_dvd_power)
    19.8 +    with `prime p` pos2 show "p dvd m" by (rule prime_dvd_power_nat)
    19.9      then obtain k where "m = p * k" ..
   19.10      with eq have "p * n\<twosuperior> = p\<twosuperior> * k\<twosuperior>" by (auto simp add: power2_eq_square mult_ac)
   19.11      with p have "n\<twosuperior> = p * k\<twosuperior>" by (simp add: power2_eq_square)
   19.12      then have "p dvd n\<twosuperior>" ..
   19.13 -    with `prime p` pos2 show "p dvd n" by (rule nat_prime_dvd_power)
   19.14 +    with `prime p` pos2 show "p dvd n" by (rule prime_dvd_power_nat)
   19.15    qed
   19.16    then have "p dvd gcd m n" ..
   19.17    with gcd have "p dvd 1" by simp
   19.18 @@ -48,7 +48,7 @@
   19.19  qed
   19.20  
   19.21  corollary "sqrt (real (2::nat)) \<notin> \<rat>"
   19.22 -  by (rule sqrt_prime_irrational) (rule nat_two_is_prime)
   19.23 +  by (rule sqrt_prime_irrational) (rule two_is_prime_nat)
   19.24  
   19.25  
   19.26  subsection {* Variations *}
   19.27 @@ -75,13 +75,13 @@
   19.28    also have "\<dots> * real (n\<twosuperior>) = real (p * n\<twosuperior>)" by simp
   19.29    finally have eq: "m\<twosuperior> = p * n\<twosuperior>" ..
   19.30    then have "p dvd m\<twosuperior>" ..
   19.31 -  with `prime p` pos2 have dvd_m: "p dvd m" by (rule nat_prime_dvd_power)
   19.32 +  with `prime p` pos2 have dvd_m: "p dvd m" by (rule prime_dvd_power_nat)
   19.33    then obtain k where "m = p * k" ..
   19.34    with eq have "p * n\<twosuperior> = p\<twosuperior> * k\<twosuperior>" by (auto simp add: power2_eq_square mult_ac)
   19.35    with p have "n\<twosuperior> = p * k\<twosuperior>" by (simp add: power2_eq_square)
   19.36    then have "p dvd n\<twosuperior>" ..
   19.37 -  with `prime p` pos2 have "p dvd n" by (rule nat_prime_dvd_power)
   19.38 -  with dvd_m have "p dvd gcd m n" by (rule nat_gcd_greatest)
   19.39 +  with `prime p` pos2 have "p dvd n" by (rule prime_dvd_power_nat)
   19.40 +  with dvd_m have "p dvd gcd m n" by (rule gcd_greatest_nat)
   19.41    with gcd have "p dvd 1" by simp
   19.42    then have "p \<le> 1" by (simp add: dvd_imp_le)
   19.43    with p show False by simp