diff -r d0f12783cd80 -r cf8d8fc23891 src/HOL/Inequalities.thy --- a/src/HOL/Inequalities.thy Sun Oct 29 19:39:03 2017 +0100 +++ b/src/HOL/Inequalities.thy Mon Oct 30 13:18:41 2017 +0000 @@ -7,49 +7,6 @@ imports Real_Vector_Spaces begin -lemma Sum_Icc_int: "(m::int) \ n \ \ {m..n} = (n*(n+1) - m*(m-1)) div 2" -proof(induct i == "nat(n-m)" arbitrary: m n) - case 0 - hence "m = n" by arith - thus ?case by (simp add: algebra_simps) -next - case (Suc i) - have 0: "i = nat((n-1) - m)" "m \ n-1" using Suc(2,3) by arith+ - have "\ {m..n} = \ {m..1+(n-1)}" by simp - also have "\ = \ {m..n-1} + n" using \m \ n\ - by(subst atLeastAtMostPlus1_int_conv) simp_all - also have "\ = ((n-1)*(n-1+1) - m*(m-1)) div 2 + n" - by(simp add: Suc(1)[OF 0]) - also have "\ = ((n-1)*(n-1+1) - m*(m-1) + 2*n) div 2" by simp - also have "\ = (n*(n+1) - m*(m-1)) div 2" by(simp add: algebra_simps) - finally show ?case . -qed - -lemma Sum_Icc_nat: assumes "(m::nat) \ n" -shows "\ {m..n} = (n*(n+1) - m*(m-1)) div 2" -proof - - have "m*(m-1) \ n*(n + 1)" - using assms by (meson diff_le_self order_trans le_add1 mult_le_mono) - hence "int(\ {m..n}) = int((n*(n+1) - m*(m-1)) div 2)" using assms - by (auto simp: Sum_Icc_int[transferred, OF assms] zdiv_int of_nat_mult simp del: of_nat_sum - split: zdiff_int_split) - thus ?thesis - using of_nat_eq_iff by blast -qed - -lemma Sum_Ico_nat: assumes "(m::nat) \ n" -shows "\ {m..{m..{m..n-1}" by simp - also have "\ = (n*(n-1) - m*(m-1)) div 2" - using assms \m < n\ by (simp add: Sum_Icc_nat mult.commute) - finally show ?thesis . -next - assume "\ m < n" with assms show ?thesis by simp -qed - lemma Chebyshev_sum_upper: fixes a b::"nat \ 'a::linordered_idom" assumes "\i j. i \ j \ j < n \ a i \ a j"