src/HOL/Int.thy
changeset 71616 a9de39608b1a
parent 70927 cc204e10385c
child 71837 dca11678c495
equal deleted inserted replaced
71615:74c874b5aed0 71616:a9de39608b1a
   134   case (Suc k)
   134   case (Suc k)
   135   then show ?case
   135   then show ?case
   136     by (cases "k = 0") (simp_all add: distrib_right add_strict_mono)
   136     by (cases "k = 0") (simp_all add: distrib_right add_strict_mono)
   137 qed
   137 qed
   138 
   138 
   139 lemma zero_le_imp_eq_int: "0 \<le> k \<Longrightarrow> \<exists>n. k = int n"
   139 lemma zero_le_imp_eq_int:
   140   for k :: int
   140   assumes "k \<ge> (0::int)" shows "\<exists>n. k = int n"
   141   apply transfer
   141 proof -
   142   apply clarsimp
   142   have "b \<le> a \<Longrightarrow> \<exists>n::nat. a = n + b" for a b
   143   apply (rule_tac x="a - b" in exI)
   143     by (rule_tac x="a - b" in exI) simp
   144   apply simp
   144   with assms show ?thesis
   145   done
   145     by transfer auto
   146 
   146 qed
   147 lemma zero_less_imp_eq_int: "0 < k \<Longrightarrow> \<exists>n>0. k = int n"
   147 
   148   for k :: int
   148 lemma zero_less_imp_eq_int:
   149   apply transfer
   149   assumes "k > (0::int)" shows "\<exists>n>0. k = int n"
   150   apply clarsimp
   150 proof -
   151   apply (rule_tac x="a - b" in exI)
   151   have "b < a \<Longrightarrow> \<exists>n::nat. n>0 \<and> a = n + b" for a b
   152   apply simp
   152     by (rule_tac x="a - b" in exI) simp
   153   done
   153   with assms show ?thesis
       
   154     by transfer auto
       
   155 qed
   154 
   156 
   155 lemma zmult_zless_mono2: "i < j \<Longrightarrow> 0 < k \<Longrightarrow> k * i < k * j"
   157 lemma zmult_zless_mono2: "i < j \<Longrightarrow> 0 < k \<Longrightarrow> k * i < k * j"
   156   for i j k :: int
   158   for i j k :: int
   157   by (drule zero_less_imp_eq_int) (auto simp add: zmult_zless_mono2_lemma)
   159   by (drule zero_less_imp_eq_int) (auto simp add: zmult_zless_mono2_lemma)
   158 
   160 
   183   for w z :: int
   185   for w z :: int
   184   by transfer clarsimp
   186   by transfer clarsimp
   185 
   187 
   186 lemma zless_iff_Suc_zadd: "w < z \<longleftrightarrow> (\<exists>n. z = w + int (Suc n))"
   188 lemma zless_iff_Suc_zadd: "w < z \<longleftrightarrow> (\<exists>n. z = w + int (Suc n))"
   187   for w z :: int
   189   for w z :: int
   188   apply transfer
   190 proof -
   189   apply auto
   191   have "\<And>a b c d. a + d < c + b \<Longrightarrow> \<exists>n. c + b = Suc (a + n + d)"
   190   apply (rename_tac a b c d)
   192     by (rule_tac x="c+b - Suc(a+d)" in exI) arith
   191   apply (rule_tac x="c+b - Suc(a+d)" in exI)
   193   then show ?thesis
   192   apply arith
   194     by transfer auto
   193   done
   195 qed
   194 
   196 
   195 lemma zabs_less_one_iff [simp]: "\<bar>z\<bar> < 1 \<longleftrightarrow> z = 0" (is "?lhs \<longleftrightarrow> ?rhs")
   197 lemma zabs_less_one_iff [simp]: "\<bar>z\<bar> < 1 \<longleftrightarrow> z = 0" (is "?lhs \<longleftrightarrow> ?rhs")
   196   for z :: int
   198   for z :: int
   197 proof
   199 proof
   198   assume ?rhs
   200   assume ?rhs
   469   show "of_int z = id z" for z
   471   show "of_int z = id z" for z
   470     by (cases z rule: int_diff_cases) simp
   472     by (cases z rule: int_diff_cases) simp
   471 qed
   473 qed
   472 
   474 
   473 instance int :: no_top
   475 instance int :: no_top
   474   apply standard
   476 proof
   475   apply (rule_tac x="x + 1" in exI)
   477   show "\<And>x::int. \<exists>y. x < y"
   476   apply simp
   478     by (rule_tac x="x + 1" in exI) simp
   477   done
   479 qed
   478 
   480 
   479 instance int :: no_bot
   481 instance int :: no_bot
   480   apply standard
   482 proof
   481   apply (rule_tac x="x - 1" in exI)
   483   show "\<And>x::int. \<exists>y. y < x"
   482   apply simp
   484     by (rule_tac x="x - 1" in exI) simp
   483   done
   485 qed
   484 
   486 
   485 
   487 
   486 subsection \<open>Magnitude of an Integer, as a Natural Number: \<open>nat\<close>\<close>
   488 subsection \<open>Magnitude of an Integer, as a Natural Number: \<open>nat\<close>\<close>
   487 
   489 
   488 lift_definition nat :: "int \<Rightarrow> nat" is "\<lambda>(x, y). x - y"
   490 lift_definition nat :: "int \<Rightarrow> nat" is "\<lambda>(x, y). x - y"
   730 \<close>
   732 \<close>
   731 lemma abs_split [arith_split, no_atp]: "P \<bar>a\<bar> \<longleftrightarrow> (0 \<le> a \<longrightarrow> P a) \<and> (a < 0 \<longrightarrow> P (- a))"
   733 lemma abs_split [arith_split, no_atp]: "P \<bar>a\<bar> \<longleftrightarrow> (0 \<le> a \<longrightarrow> P a) \<and> (a < 0 \<longrightarrow> P (- a))"
   732   for a :: "'a::linordered_idom"
   734   for a :: "'a::linordered_idom"
   733   by (force dest: order_less_le_trans simp add: abs_if linorder_not_less)
   735   by (force dest: order_less_le_trans simp add: abs_if linorder_not_less)
   734 
   736 
   735 lemma negD: "x < 0 \<Longrightarrow> \<exists>n. x = - (int (Suc n))"
   737 lemma negD:
   736   apply transfer
   738   assumes "x < 0" shows "\<exists>n. x = - (int (Suc n))"
   737   apply clarsimp
   739 proof -
   738   apply (rule_tac x="b - Suc a" in exI)
   740   have "\<And>a b. a < b \<Longrightarrow> \<exists>n. Suc (a + n) = b"
   739   apply arith
   741     by (rule_tac x="b - Suc a" in exI) arith
   740   done
   742   with assms show ?thesis
       
   743     by transfer auto
       
   744 qed
   741 
   745 
   742 
   746 
   743 subsection \<open>Cases and induction\<close>
   747 subsection \<open>Cases and induction\<close>
   744 
   748 
   745 text \<open>
   749 text \<open>
   752   "(\<And>n. z = int n \<Longrightarrow> P) \<Longrightarrow> (\<And>n. z = - (int n) \<Longrightarrow> P) \<Longrightarrow> P"
   756   "(\<And>n. z = int n \<Longrightarrow> P) \<Longrightarrow> (\<And>n. z = - (int n) \<Longrightarrow> P) \<Longrightarrow> P"
   753   by (cases "z < 0") (auto simp add: linorder_not_less dest!: negD nat_0_le [THEN sym])
   757   by (cases "z < 0") (auto simp add: linorder_not_less dest!: negD nat_0_le [THEN sym])
   754 
   758 
   755 text \<open>This is the default, with a negative case.\<close>
   759 text \<open>This is the default, with a negative case.\<close>
   756 lemma int_cases [case_names nonneg neg, cases type: int]:
   760 lemma int_cases [case_names nonneg neg, cases type: int]:
   757   "(\<And>n. z = int n \<Longrightarrow> P) \<Longrightarrow> (\<And>n. z = - (int (Suc n)) \<Longrightarrow> P) \<Longrightarrow> P"
   761   assumes pos: "\<And>n. z = int n \<Longrightarrow> P" and neg: "\<And>n. z = - (int (Suc n)) \<Longrightarrow> P"
   758   apply (cases "z < 0")
   762   shows P
   759    apply (blast dest!: negD)
   763 proof (cases "z < 0")
   760   apply (simp add: linorder_not_less del: of_nat_Suc)
   764   case True
   761   apply auto
   765   with neg show ?thesis
   762   apply (blast dest: nat_0_le [THEN sym])
   766     by (blast dest!: negD)
   763   done
   767 next
       
   768   case False
       
   769   with pos show ?thesis
       
   770     by (force simp add: linorder_not_less dest: nat_0_le [THEN sym])
       
   771 qed
   764 
   772 
   765 lemma int_cases3 [case_names zero pos neg]:
   773 lemma int_cases3 [case_names zero pos neg]:
   766   fixes k :: int
   774   fixes k :: int
   767   assumes "k = 0 \<Longrightarrow> P" and "\<And>n. k = int n \<Longrightarrow> n > 0 \<Longrightarrow> P"
   775   assumes "k = 0 \<Longrightarrow> P" and "\<And>n. k = int n \<Longrightarrow> n > 0 \<Longrightarrow> P"
   768     and "\<And>n. k = - int n \<Longrightarrow> n > 0 \<Longrightarrow> P"
   776     and "\<And>n. k = - int n \<Longrightarrow> n > 0 \<Longrightarrow> P"
   889 
   897 
   890 lemma Ints_numeral [simp]: "numeral n \<in> \<int>"
   898 lemma Ints_numeral [simp]: "numeral n \<in> \<int>"
   891   by (subst of_nat_numeral [symmetric], rule Ints_of_nat)
   899   by (subst of_nat_numeral [symmetric], rule Ints_of_nat)
   892 
   900 
   893 lemma Ints_add [simp]: "a \<in> \<int> \<Longrightarrow> b \<in> \<int> \<Longrightarrow> a + b \<in> \<int>"
   901 lemma Ints_add [simp]: "a \<in> \<int> \<Longrightarrow> b \<in> \<int> \<Longrightarrow> a + b \<in> \<int>"
   894   apply (auto simp add: Ints_def)
   902   by (force simp add: Ints_def simp flip: of_int_add intro: range_eqI)
   895   apply (rule range_eqI)
       
   896   apply (rule of_int_add [symmetric])
       
   897   done
       
   898 
   903 
   899 lemma Ints_minus [simp]: "a \<in> \<int> \<Longrightarrow> -a \<in> \<int>"
   904 lemma Ints_minus [simp]: "a \<in> \<int> \<Longrightarrow> -a \<in> \<int>"
   900   apply (auto simp add: Ints_def)
   905   by (force simp add: Ints_def simp flip: of_int_minus intro: range_eqI)
   901   apply (rule range_eqI)
       
   902   apply (rule of_int_minus [symmetric])
       
   903   done
       
   904 
   906 
   905 lemma minus_in_Ints_iff: "-x \<in> \<int> \<longleftrightarrow> x \<in> \<int>"
   907 lemma minus_in_Ints_iff: "-x \<in> \<int> \<longleftrightarrow> x \<in> \<int>"
   906   using Ints_minus[of x] Ints_minus[of "-x"] by auto
   908   using Ints_minus[of x] Ints_minus[of "-x"] by auto
   907 
   909 
   908 lemma Ints_diff [simp]: "a \<in> \<int> \<Longrightarrow> b \<in> \<int> \<Longrightarrow> a - b \<in> \<int>"
   910 lemma Ints_diff [simp]: "a \<in> \<int> \<Longrightarrow> b \<in> \<int> \<Longrightarrow> a - b \<in> \<int>"
   909   apply (auto simp add: Ints_def)
   911   by (force simp add: Ints_def simp flip: of_int_diff intro: range_eqI)
   910   apply (rule range_eqI)
       
   911   apply (rule of_int_diff [symmetric])
       
   912   done
       
   913 
   912 
   914 lemma Ints_mult [simp]: "a \<in> \<int> \<Longrightarrow> b \<in> \<int> \<Longrightarrow> a * b \<in> \<int>"
   913 lemma Ints_mult [simp]: "a \<in> \<int> \<Longrightarrow> b \<in> \<int> \<Longrightarrow> a * b \<in> \<int>"
   915   apply (auto simp add: Ints_def)
   914   by (force simp add: Ints_def simp flip: of_int_mult intro: range_eqI)
   916   apply (rule range_eqI)
       
   917   apply (rule of_int_mult [symmetric])
       
   918   done
       
   919 
   915 
   920 lemma Ints_power [simp]: "a \<in> \<int> \<Longrightarrow> a ^ n \<in> \<int>"
   916 lemma Ints_power [simp]: "a \<in> \<int> \<Longrightarrow> a ^ n \<in> \<int>"
   921   by (induct n) simp_all
   917   by (induct n) simp_all
   922 
   918 
   923 lemma Ints_cases [cases set: Ints]:
   919 lemma Ints_cases [cases set: Ints]:
  1232     by (rule injD [of "of_nat :: nat \<Rightarrow> int", OF inj_of_nat])
  1228     by (rule injD [of "of_nat :: nat \<Rightarrow> int", OF inj_of_nat])
  1233       (simp only: of_nat_mult of_nat_nat [OF True]
  1229       (simp only: of_nat_mult of_nat_nat [OF True]
  1234          of_nat_nat [OF assms] of_nat_nat [OF ge_0], simp)
  1230          of_nat_nat [OF assms] of_nat_nat [OF ge_0], simp)
  1235 qed
  1231 qed
  1236 
  1232 
  1237 lemma nat_mult_distrib_neg: "z \<le> 0 \<Longrightarrow> nat (z * z') = nat (- z) * nat (- z')"
  1233 lemma nat_mult_distrib_neg:
  1238   for z z' :: int
  1234   assumes "z \<le> (0::int)" shows "nat (z * z') = nat (- z) * nat (- z')" (is "?L = ?R")
  1239   apply (rule trans)
  1235 proof -
  1240    apply (rule_tac [2] nat_mult_distrib)
  1236   have "?L = nat (- z * - z')"
  1241    apply auto
  1237     using assms by auto
  1242   done
  1238   also have "... = ?R"
       
  1239     by (rule nat_mult_distrib) (use assms in auto)
       
  1240   finally show ?thesis .
       
  1241 qed
  1243 
  1242 
  1244 lemma nat_abs_mult_distrib: "nat \<bar>w * z\<bar> = nat \<bar>w\<bar> * nat \<bar>z\<bar>"
  1243 lemma nat_abs_mult_distrib: "nat \<bar>w * z\<bar> = nat \<bar>w\<bar> * nat \<bar>z\<bar>"
  1245   by (cases "z = 0 \<or> w = 0")
  1244   by (cases "z = 0 \<or> w = 0")
  1246     (auto simp add: abs_if nat_mult_distrib [symmetric]
  1245     (auto simp add: abs_if nat_mult_distrib [symmetric]
  1247       nat_mult_distrib_neg [symmetric] mult_less_0_iff)
  1246       nat_mult_distrib_neg [symmetric] mult_less_0_iff)
  1330 qed
  1329 qed
  1331 
  1330 
  1332 (* `set:int': dummy construction *)
  1331 (* `set:int': dummy construction *)
  1333 theorem int_gr_induct [case_names base step, induct set: int]:
  1332 theorem int_gr_induct [case_names base step, induct set: int]:
  1334   fixes i k :: int
  1333   fixes i k :: int
  1335   assumes gr: "k < i"
  1334   assumes "k < i" "P (k + 1)" "\<And>i. k < i \<Longrightarrow> P i \<Longrightarrow> P (i + 1)"
  1336     and base: "P (k + 1)"
       
  1337     and step: "\<And>i. k < i \<Longrightarrow> P i \<Longrightarrow> P (i + 1)"
       
  1338   shows "P i"
  1335   shows "P i"
  1339   apply (rule int_ge_induct[of "k + 1"])
  1336 proof -
  1340   using gr apply arith
  1337   have "k+1 \<le> i"
  1341    apply (rule base)
  1338     using assms by auto
  1342   apply (rule step)
  1339   then show ?thesis
  1343    apply simp_all
  1340     by (induction i rule: int_ge_induct) (auto simp: assms)
  1344   done
  1341 qed
  1345 
  1342 
  1346 theorem int_le_induct [consumes 1, case_names base step]:
  1343 theorem int_le_induct [consumes 1, case_names base step]:
  1347   fixes i k :: int
  1344   fixes i k :: int
  1348   assumes le: "i \<le> k"
  1345   assumes le: "i \<le> k"
  1349     and base: "P k"
  1346     and base: "P k"
  1365   with le show ?thesis by fast
  1362   with le show ?thesis by fast
  1366 qed
  1363 qed
  1367 
  1364 
  1368 theorem int_less_induct [consumes 1, case_names base step]:
  1365 theorem int_less_induct [consumes 1, case_names base step]:
  1369   fixes i k :: int
  1366   fixes i k :: int
  1370   assumes less: "i < k"
  1367   assumes "i < k" "P (k - 1)" "\<And>i. i < k \<Longrightarrow> P i \<Longrightarrow> P (i - 1)"
  1371     and base: "P (k - 1)"
       
  1372     and step: "\<And>i. i < k \<Longrightarrow> P i \<Longrightarrow> P (i - 1)"
       
  1373   shows "P i"
  1368   shows "P i"
  1374   apply (rule int_le_induct[of _ "k - 1"])
  1369 proof -
  1375   using less apply arith
  1370   have "i \<le> k-1"
  1376    apply (rule base)
  1371     using assms by auto
  1377   apply (rule step)
  1372   then show ?thesis
  1378    apply simp_all
  1373     by (induction i rule: int_le_induct) (auto simp: assms)
  1379   done
  1374 qed
  1380 
  1375 
  1381 theorem int_induct [case_names base step1 step2]:
  1376 theorem int_induct [case_names base step1 step2]:
  1382   fixes k :: int
  1377   fixes k :: int
  1383   assumes base: "P k"
  1378   assumes base: "P k"
  1384     and step1: "\<And>i. k \<le> i \<Longrightarrow> P i \<Longrightarrow> P (i + 1)"
  1379     and step1: "\<And>i. k \<le> i \<Longrightarrow> P i \<Longrightarrow> P (i + 1)"
  1399 qed
  1394 qed
  1400 
  1395 
  1401 
  1396 
  1402 subsection \<open>Intermediate value theorems\<close>
  1397 subsection \<open>Intermediate value theorems\<close>
  1403 
  1398 
       
  1399 lemma nat_ivt_aux: 
       
  1400   "\<lbrakk>\<forall>i<n. \<bar>f (Suc i) - f i\<bar> \<le> 1; f 0 \<le> k; k \<le> f n\<rbrakk> \<Longrightarrow> \<exists>i \<le> n. f i = k"
       
  1401   for m n :: nat and k :: int
       
  1402 proof (induct n)
       
  1403   case (Suc n)
       
  1404   show ?case
       
  1405   proof (cases "k = f (Suc n)")
       
  1406     case False
       
  1407     with Suc have "k \<le> f n"
       
  1408       by auto
       
  1409     with Suc show ?thesis
       
  1410       by (auto simp add: abs_if split: if_split_asm intro: le_SucI)
       
  1411   qed (use Suc in auto)
       
  1412 qed auto
       
  1413 
  1404 lemma nat_intermed_int_val:
  1414 lemma nat_intermed_int_val:
  1405   "\<exists>i. m \<le> i \<and> i \<le> n \<and> f i = k"
  1415   fixes m n :: nat and k :: int
  1406   if "\<forall>i. m \<le> i \<and> i < n \<longrightarrow> \<bar>f (Suc i) - f i\<bar> \<le> 1"
  1416   assumes "\<forall>i. m \<le> i \<and> i < n \<longrightarrow> \<bar>f (Suc i) - f i\<bar> \<le> 1" "m \<le> n" "f m \<le> k" "k \<le> f n"
  1407     "m \<le> n" "f m \<le> k" "k \<le> f n"
  1417   shows "\<exists>i. m \<le> i \<and> i \<le> n \<and> f i = k"
  1408   for m n :: nat and k :: int
  1418 proof -
  1409 proof -
  1419   obtain i where "i \<le> n - m" "k = f (m + i)"
  1410   have "(\<forall>i<n. \<bar>f (Suc i) - f i\<bar> \<le> 1) \<Longrightarrow> f 0 \<le> k \<Longrightarrow> k \<le> f n
  1420     using nat_ivt_aux [of "n - m" "f \<circ> plus m" k] assms by auto
  1411     \<Longrightarrow> (\<exists>i \<le> n. f i = k)"
  1421   with assms show ?thesis
  1412   for n :: nat and f
  1422     by (rule_tac x = "m + i" in exI) auto
  1413     apply (induct n)
       
  1414      apply auto
       
  1415     apply (erule_tac x = n in allE)
       
  1416     apply (case_tac "k = f (Suc n)")
       
  1417      apply (auto simp add: abs_if split: if_split_asm intro: le_SucI)
       
  1418     done
       
  1419   from this [of "n - m" "f \<circ> plus m"] that show ?thesis
       
  1420     apply auto
       
  1421     apply (rule_tac x = "m + i" in exI)
       
  1422     apply auto
       
  1423     done
       
  1424 qed
  1423 qed
  1425 
  1424 
  1426 lemma nat0_intermed_int_val:
  1425 lemma nat0_intermed_int_val:
  1427   "\<exists>i\<le>n. f i = k"
  1426   "\<exists>i\<le>n. f i = k"
  1428   if "\<forall>i<n. \<bar>f (i + 1) - f i\<bar> \<le> 1" "f 0 \<le> k" "k \<le> f n"
  1427   if "\<forall>i<n. \<bar>f (i + 1) - f i\<bar> \<le> 1" "f 0 \<le> k" "k \<le> f n"
  1463     by (auto dest: pos_zmult_eq_1_iff_lemma)
  1462     by (auto dest: pos_zmult_eq_1_iff_lemma)
  1464   then show ?thesis
  1463   then show ?thesis
  1465     by (auto dest: pos_zmult_eq_1_iff_lemma)
  1464     by (auto dest: pos_zmult_eq_1_iff_lemma)
  1466 qed
  1465 qed
  1467 
  1466 
  1468 lemma zmult_eq_1_iff: "m * n = 1 \<longleftrightarrow> (m = 1 \<and> n = 1) \<or> (m = - 1 \<and> n = - 1)"
  1467 lemma zmult_eq_1_iff: "m * n = 1 \<longleftrightarrow> (m = 1 \<and> n = 1) \<or> (m = - 1 \<and> n = - 1)" (is "?L = ?R")
  1469   for m n :: int
  1468   for m n :: int
  1470   apply (rule iffI)
  1469 proof
  1471    apply (frule pos_zmult_eq_1_iff_lemma)
  1470   assume L: ?L show ?R
  1472    apply (simp add: mult.commute [of m])
  1471     using pos_zmult_eq_1_iff_lemma [OF L] L by force
  1473    apply (frule pos_zmult_eq_1_iff_lemma)
  1472 qed auto
  1474    apply auto
       
  1475   done
       
  1476 
  1473 
  1477 lemma infinite_UNIV_int [simp]: "\<not> finite (UNIV::int set)"
  1474 lemma infinite_UNIV_int [simp]: "\<not> finite (UNIV::int set)"
  1478 proof
  1475 proof
  1479   assume "finite (UNIV::int set)"
  1476   assume "finite (UNIV::int set)"
  1480   moreover have "inj (\<lambda>i::int. 2 * i)"
  1477   moreover have "inj (\<lambda>i::int. 2 * i)"
  1675 lemma nat_less_numeral_power_cancel_iff [simp]:
  1672 lemma nat_less_numeral_power_cancel_iff [simp]:
  1676   "nat a < numeral x ^ n \<longleftrightarrow> a < numeral x ^ n"
  1673   "nat a < numeral x ^ n \<longleftrightarrow> a < numeral x ^ n"
  1677   using nat_less_eq_zless[of a "numeral x ^ n"]
  1674   using nat_less_eq_zless[of a "numeral x ^ n"]
  1678   by (cases "a < 0") (auto simp: nat_power_eq less_le_trans[where y=0])
  1675   by (cases "a < 0") (auto simp: nat_power_eq less_le_trans[where y=0])
  1679 
  1676 
  1680 lemma zdvd_imp_le: "z dvd n \<Longrightarrow> 0 < n \<Longrightarrow> z \<le> n"
  1677 lemma zdvd_imp_le: "z \<le> n" if "z dvd n" "0 < n" for n z :: int
  1681   for n z :: int
  1678 proof (cases n)
  1682   apply (cases n)
  1679   case (nonneg n)
  1683   apply auto
  1680   show ?thesis
  1684   apply (cases z)
  1681     by (cases z) (use nonneg dvd_imp_le that in auto)
  1685    apply (auto simp add: dvd_imp_le)
  1682 qed (use that in auto)
  1686   done
       
  1687 
  1683 
  1688 lemma zdvd_period:
  1684 lemma zdvd_period:
  1689   fixes a d :: int
  1685   fixes a d :: int
  1690   assumes "a dvd d"
  1686   assumes "a dvd d"
  1691   shows "a dvd (x + t) \<longleftrightarrow> a dvd ((x + c * d) + t)"
  1687   shows "a dvd (x + t) \<longleftrightarrow> a dvd ((x + c * d) + t)"