Commit be2bf69d by Lawrence Paulson

renamings to use generic sum/prod lemmas from their locale

parent 8d513a937b50
 ... ... @@ -391,7 +391,7 @@ next apply (unfold poly_y_x_def) apply (unfold degree_monom_eq) apply (subst(2) lessThan_Suc_atMost[symmetric]) apply (unfold sum_lessThan_Suc) apply (unfold sum.lessThan_Suc) apply (subst sum.neutral,force) apply (subst(14) poly_as_sum_of_monoms[symmetric]) apply (unfold smult_as_map_poly) ... ...
 ... ... @@ -39,7 +39,7 @@ proof(intro antisym[OF degree_mult_le] le_degree, unfold coeff_mult) then show ?thesis by (intro sum.neutral, auto) qed also have "sum ?f {..degree p} = sum ?f {..
 ... ... @@ -139,7 +139,7 @@ proof - also have "\ = (\i = Suc 0..n. (n choose i) * Stirling i m)" by (intro sum.mono_neutral_right) auto also have "\ = real (\i = 0..n. Stirling i m * (n choose i)) - real (Stirling 0 m)" by (simp add: sum_head_Suc mult_ac) by (simp add: sum.atLeast_Suc_atMost mult_ac) also have "real (\i = 0..n. Stirling i m * (n choose i)) = real (Stirling (Suc n) (Suc m))" by (rule Suc.IH [symmetric]) also have "real (\i = 0..n. (n choose i) * Stirling (Suc i) m) = ... ...
 ... ... @@ -1093,10 +1093,10 @@ proof - from psi_odd_def have "psi_odd n = (\d=1..n. mangoldt_odd d)" by simp also from * have "\ = psi_odd_2 n" by (cases "n \ 1") (simp_all add: eval_nat_numeral sum_head_Suc) by (cases "n \ 1") (simp_all add: eval_nat_numeral sum.atLeast_Suc_atMost) also from psi_residues_compare_2 have "\ \ psi_even_2 n" . also from ** have "\ = psi_even n" by (cases "n \ 1") (simp_all add: eval_nat_numeral sum_head_Suc psi_even_def) by (cases "n \ 1") (simp_all add: eval_nat_numeral sum.atLeast_Suc_atMost psi_even_def) finally show ?thesis . qed ... ... @@ -1436,7 +1436,7 @@ next \ (\d = 1..3. (- 1) ^ (d + 1) * psi (n div d))" by simp also have "\ = psi n - psi (n div 2) + psi (n div 3)" by (simp add: sum_head_Suc numeral_2_eq_2) by (simp add: sum.atLeast_Suc_atMost numeral_2_eq_2) finally show "ln (fact n) - 2 * ln (fact (n div 2)) \ psi n - psi (n div 2) + psi (n div 3)" . qed ... ... @@ -1742,7 +1742,7 @@ next also have "\ = (\p | prime p \ p \ {1..n}. (\k = 1..n. ln p / p^k))" by (subst sum.Sigma) auto also have "\ = ?L + (\p | prime p \ p \ {1..n}. (\k = 2..n. ln p / p^k))" by (simp add: comm_monoid_add_class.sum.distrib sum_head_Suc numeral_2_eq_2) by (simp add: comm_monoid_add_class.sum.distrib sum.atLeast_Suc_atMost numeral_2_eq_2) finally have "?M - ?L \ (\p | prime p \ p \ {1..n}. (\k = 2..n. ln p / p^k))" by (simp add: algebra_simps) also have "\ = (\p | prime p \ p \ {1..n}. ln p * (\k = 2..n. inverse p ^ k))" ... ... @@ -1826,7 +1826,7 @@ next also have "\ \ 3 - ln 2" using ln_2_less_1 by (simp add: algebra_simps) finally show ?thesis using True by (simp add: algebra_simps sum_head_Suc [of 2 n]) using True by (simp add: algebra_simps sum.atLeast_Suc_atMost [of 2 n]) qed finally show ?thesis . qed ... ...
 ... ... @@ -4502,7 +4502,7 @@ next (auto simp add: LCons image_iff less_Suc_eq_0_disj) also have "llength xs + \ = (\ii < m + length xss'. llength (lnth xss i)) = (\i < length xss'. llength (lnth xss i)) + (\i = length xss'..i < length xss'. llength (lnth xss i)) = 0" by simp also have "{length xss'..i = 0 + length xss'.. = (\i = 0.. = eSuc (llength xs') + (\i = Suc 0.. {Suc 0..i = Suc 0.. = 1 + (llength (lnth (LCons xs' xss'') 0) + \)" by(simp add: eSuc_plus_1 ac_simps) also note sum_head_upt_Suc[symmetric, OF \0 < m\] also note sum.atLeast_Suc_lessThan[symmetric, OF \0 < m\] finally have "enat (Suc n) = (\i
 ... ... @@ -54,10 +54,10 @@ lemma all1_vec_scalar_prod: shows "all1_vec (length xs) \ (vec_of_list xs) = sum_list xs" proof - have "all1_vec (length xs) \ (vec_of_list xs) = (\i = 0..i = 0..
 ... ... @@ -128,11 +128,11 @@ proof (induction xs arbitrary: n rule: psums.induct[case_names Nil sng rec]) also from rec.prems Suc have "\ = (\i\m. ((x+y) # xs) ! i)" by (intro rec.IH) simp_all also have "\ = x + y + (\i=1..m. (y#xs) ! i)" by (auto simp: atLeast0AtMost [symmetric] sum_head_Suc[of 0]) by (auto simp: atLeast0AtMost [symmetric] sum.atLeast_Suc_atMost[of 0]) also have "(\i=1..m. (y#xs) ! i) = (\i=Suc 1..Suc m. (x#y#xs) ! i)" by (subst sum_shift_bounds_cl_Suc_ivl) simp also from Suc have "x + y + \ = (\i\n. (x#y#xs) ! i)" by (auto simp: atLeast0AtMost [symmetric] sum_head_Suc add_ac) by (auto simp: atLeast0AtMost [symmetric] sum.atLeast_Suc_atMost add_ac) finally show ?thesis . qed simp qed simp_all ... ...
 ... ... @@ -265,7 +265,7 @@ next have "(\k = 0..n. of_nat (Stirling n k) * (of_nat k * ffact k a)) = (\k = 0..n+2. of_nat (Stirling n k) * (of_nat k * ffact k a))" by simp also have "\ = (\k = Suc 0 .. Suc (Suc n). of_nat (Stirling n k) * (of_nat k * ffact k a)) " by (simp only: sum_head_Suc [of 0 "n + 2"]) simp by (simp only: sum.atLeast_Suc_atMost [of 0 "n + 2"]) simp also have "\ = (\k = 0 .. Suc n. of_nat (Stirling n (Suc k)) * (of_nat (Suc k) * ffact (Suc k) a))" by (simp only: image_Suc_atLeastAtMost sum_shift_bounds_cl_Suc_ivl) also have "\ = (\k = 0 .. Suc n. of_nat ((Suc k) * Stirling n (Suc k)) * ffact (Suc k) a)" ... ... @@ -280,7 +280,7 @@ next also have "\ = (\k = Suc 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)" by (simp only: image_Suc_atLeastAtMost sum_shift_bounds_cl_Suc_ivl) also have "\ = (\k = 0..Suc n. of_nat (Stirling (Suc n) k) * ffact k a)" by (simp only: sum_head_Suc [of "0" "Suc n"]) simp by (simp only: sum.atLeast_Suc_atMost [of "0" "Suc n"]) simp finally show ?case by simp qed ... ... @@ -303,7 +303,7 @@ next (\k = 0..n. (- 1) ^ (Suc n - k) * of_nat (n * stirling n k) * a ^ k)" by (simp add: Suc_diff_le) also have "\ = (\k = Suc 0..Suc n. (- 1) ^ (Suc n - k) * of_nat (n * stirling n k) * a ^ k)" by (simp add: sum_head_Suc) (cases n; simp) by (simp add: sum.atLeast_Suc_atMost) (cases n; simp) also have "\ = (\k = 0..n. (- 1) ^ (Suc n - Suc k) * of_nat (n * stirling n (Suc k)) * a ^ Suc k)" by (simp only: sum_shift_bounds_cl_Suc_ivl) finally show ?thesis by simp ... ... @@ -315,7 +315,7 @@ next also have "\ = (\k = Suc 0..Suc n. (- 1) ^ (Suc n - k) * of_nat (stirling (Suc n) k) * a ^ k)" by (simp only: sum_shift_bounds_cl_Suc_ivl) also have "\ = (\k = 0..Suc n. (- 1) ^ (Suc n - k) * of_nat (stirling (Suc n) k) * a ^ k)" by (simp add: sum_head_Suc) by (simp add: sum.atLeast_Suc_atMost) finally show ?case . qed ... ...
 ... ... @@ -336,11 +336,11 @@ proof - also have "(\j=0..m. poly (df (Suc j)) 0) = (\j=Suc 0..Suc m. poly (df j) 0)" by (rule sum_shift_bounds_cl_Suc_ivl [symmetric]) also have "\ = (\j=0..Suc m. poly (df j) 0) - poly f 0" by (subst (2) sum_head_Suc) (simp_all add: df_def) by (subst (2) sum.atLeast_Suc_atMost) (simp_all add: df_def) also have "(\j=0..m. poly (df (Suc j)) u) = (\j=Suc 0..Suc m. poly (df j) u)" by (rule sum_shift_bounds_cl_Suc_ivl [symmetric]) also have "\ = (\j=0..Suc m. poly (df j) u) - poly f u" by (subst (2) sum_head_Suc) (simp_all add: df_def) by (subst (2) sum.atLeast_Suc_atMost) (simp_all add: df_def) finally have "((\t. - (exp (u - t *\<^sub>R u) * u * poly (pderiv f) (t *\<^sub>R u))) has_integral -(exp u * ((\j = 0..Suc m. poly (df j) 0) - poly f 0) - ((\j = 0..Suc m. poly (df j) u) - poly f u))) {0..1}" ... ...
 ... ... @@ -439,7 +439,7 @@ proof - have "(\i (\i (\in\1\ lessThan_Suc_atMost sum_lessThan_Suc[where ?n = "n-1" and ?f = "\i. abs(u s ((T^^(i* s+t))x))" , symmetric] by auto using \n\1\ lessThan_Suc_atMost sum.lessThan_Suc[where ?n = "n-1" and ?f = "\i. abs(u s ((T^^(i* s+t))x))" , symmetric] by auto finally have ***: "(\i (\i (\j \ {(n-1) * s+t..j \ {m..j \ {(n-1) * s+t.. (\j \ {(n-1) * s+t.. (\j \ {p* s+t..j \ {m-l..<(p+1)* s+t}. abs(u 1 ((T^^j) x)))" by auto also have "... = (\j \ {p* s+t..<(p+1)* s+t}. abs(u 1 ((T^^j) x)))" apply (rule sum_add_nat_ivl) using p1 p2 by auto apply (rule sum.atLeastLessThan_concat) using p1 p2 by auto finally have *: "birkhoff_sum (u 1) (m-l - (p* s+t)) ((T^^(p* s+t)) x) \ (\j \ {p* s+t..<(p+1)* s+t}. abs(u 1 ((T^^j) x)))" by auto ... ... @@ -559,7 +559,7 @@ proof - also have "... \ 2* K * s + (\i \ {p* s+t..<(n-1) * s+t}. F ((T^^i) x)) + (\i \{(n-1) * s+t..(p+1)* s+t\(n-1) * s+t\ F_pos by auto also have "... = 2* K * s + (\i \ {p* s+t..p\n-1\ by auto apply (auto, rule sum.atLeastLessThan_concat) using \p\n-1\ by auto finally have A0: "(\i \ {p* s+t..<(p+1)* s+t}. abs(u 1 ((T^^i) x))) + (\i \ {(n-1) * s+t.. 2* K * s + (\i \ {p* s+t..p\n-1\ by auto have A4: "birkhoff_sum F (p * s + t) x + (\i \ {p* s+t..p\n-1\ by auto have "u (n * s+t) x \ u m x + (\i \ {(n-1) * s+t..
 ... ... @@ -236,7 +236,7 @@ proof - finally show ?thesis by auto qed have "(\jjj\{n-2*N..a*N \ n - 2*N\, of 0 "\j. u N ((T^^j) x)", symmetric] atLeast0LessThan by simp using sum.atLeastLessThan_concat[OF _ \a*N \ n - 2*N\, of 0 "\j. u N ((T^^j) x)", symmetric] atLeast0LessThan by simp also have "... \ (\j\{n-2*N.. N * E2" using \(a*N - (n-2*N)) \ N\ \E2 \ 0\ by (simp add: mult_right_mono) ... ...
 ... ... @@ -835,7 +835,7 @@ proof - add.commute add.left_neutral by auto finally have *: "birkhoff_sum f m ((T^^n)x) = (\j\{n..< m+n}. f ((T ^^j) x))" unfolding birkhoff_sum_def by auto have "birkhoff_sum f (n+m) x = (\ii\{n..i\{n..
 ... ... @@ -256,7 +256,7 @@ proof (unfold_locales) then have "finite (range u)" using finite_nat_iff_bounded by auto then have "\i j. (i (u i = u j)" by (metis finite_imageD infinite_UNIV_nat injI less_linear) then obtain i k where "k>0" "u i = u (i+k)" using less_imp_add_positive by blast moreover have "s 0 (i+k) = s 0 i + s i k" unfolding s_def by (simp add: sum_add_nat_ivl) moreover have "s 0 (i+k) = s 0 i + s i k" unfolding s_def by (simp add: sum.atLeastLessThan_concat) ultimately have "(s i k) mod n = 0" using u_def nat_mod_cong by metis then obtain r where "s i k = n * r" by auto moreover have "s i k > 0" unfolding s_def ... ... @@ -1261,7 +1261,7 @@ proof ultimately have "n = (\i\{0..<1}. return_time_function A (((induced_map A)^^i) y)) + (\i \ {1..n \ m\ by simp then have "n = (\i\{0.. n" using \N0 \ n-m\ \n - m < n\ by linarith ultimately show ?thesis by (metis atLeast0LessThan) qed ... ...
 ... ... @@ -242,7 +242,7 @@ proof (induction n) exp (- x\<^sup>2) / sqrt pi * (\i
 ... ... @@ -65,7 +65,7 @@ lemma sum_add_split_nat_ivl: and g: "!!i. [| m <= i; i < k |] ==> g i = f i" and h: "!!i. [| k <= i; i < n |] ==> h i = f i" shows "sum g {m.. ((%i. Suc (2*i)) ` {0..
 ... ... @@ -51,7 +51,7 @@ next finally show ?thesis . qed from this show ?thesis by (simp add: sum_head_Suc[of _ _ "\k. (n choose k) * ?t k"]) by (simp add: sum.atLeast_Suc_atMost[of _ _ "\k. (n choose k) * ?t k"]) qed also have "\ = ?t 0 + (\k = 0..n. (n choose k + (n choose Suc k)) * ?u k)" by (simp add: distrib_right sum.distrib) ... ... @@ -65,7 +65,7 @@ next also have "\ = ?v 0 + (\k = Suc 0..Suc n. ?v k)" by (simp only: sum_shift_bounds_cl_Suc_ivl diff_Suc_Suc mult.assoc) also have "\ = (\k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)" by (simp add: sum_head_Suc) by (simp add: sum.atLeast_Suc_atMost) finally show ?thesis . qed finally show ?case . ... ... @@ -123,7 +123,7 @@ next finally show ?thesis . qed from this show ?thesis by (simp add: sum_head_Suc[of _ _ "\k. of_nat (n choose k) * ?t k"]) by (simp add: sum.atLeast_Suc_atMost[of _ _ "\k. of_nat (n choose k) * ?t k"]) qed also have "\ = ?t 0 + (\k = 0..n. of_nat (n choose k + (n choose Suc k)) * ?u k)" by (simp add: distrib_right sum.distrib) ... ... @@ -137,7 +137,7 @@ next also have "\ = ?v 0 + (\k = Suc 0..Suc n. ?v k)" by (simp only: sum_shift_bounds_cl_Suc_ivl diff_Suc_Suc mult.assoc) also have "\ = (\k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)" by (simp add: sum_head_Suc) by (simp add: sum.atLeast_Suc_atMost) finally show ?thesis . qed finally show ?case . ... ...
 ... ... @@ -192,7 +192,7 @@ proof - proof (cases "S = 0") case True have "(\i = Suc 0..i = 0..n > 0\, of "\i. f (u i) (u (Suc i))"] by simp using sum.atLeast_Suc_lessThan[OF \n > 0\, of "\i. f (u i) (u (Suc i))"] by simp also have "... \ S/2" using True S_def nonneg by auto finally have "0 < n \ (\i = 0..<0. f (u i) (u (Suc i))) \ S/2 \ (\i = Suc 0.. S/2" using \n > 0\ \S = 0\ by auto ... ...
 ... ... @@ -507,7 +507,7 @@ qed lemma sum_upto_add_nat: "a \ b \ sum f {..<(a :: nat)} + sum f {a.. nat" ... ...
 ... ... @@ -636,7 +636,7 @@ proof(rule thread_start_actions_okI) let ?i = "length ?start_heap_obs + ?i'" from \i < m\ have "(\isnd (lnth E' i)\\<^bsub>o\<^esub>) = ?i' + (\i=i..snd (lnth E' i)\\<^bsub>o\<^esub>)" unfolding atLeast0LessThan[symmetric] by(subst sum_add_nat_ivl) simp_all unfolding atLeast0LessThan[symmetric] by(subst sum.atLeastLessThan_concat) simp_all hence "?i' \ ?a" unfolding a_conv by simp hence "?i \ a" using \a \ length ?start_heap_obs\ by arith ... ... @@ -666,18 +666,18 @@ proof(rule thread_start_actions_okI) assume "i < k" hence "(\isnd (lnth E' i)\\<^bsub>o\<^esub>) = (\isnd (lnth E' i)\\<^bsub>o\<^esub>) + (\i=i..snd (lnth E' i)\\<^bsub>o\<^esub>)" unfolding atLeast0LessThan[symmetric] by(subst sum_add_nat_ivl) simp_all unfolding atLeast0LessThan[symmetric] by(subst sum.atLeastLessThan_concat) simp_all with i_conv have "(\i=i..snd (lnth E' i)\\<^bsub>o\<^esub>) = l" "l = 0" by simp_all moreover have "(\i=i..snd (lnth E' i)\\<^bsub>o\<^esub>) \ length \snd (lnth E' i)\\<^bsub>o\<^esub>" by(subst sum_head_upt_Suc[OF \i < k\]) simp by(subst sum.atLeast_Suc_lessThan[OF \i < k\]) simp ultimately show False using nth_i by simp next assume "k < i" hence "?i' = (\isnd (lnth E' i)\\<^bsub>o\<^esub>) + (\i=k..snd (lnth E' i)\\<^bsub>o\<^esub>)" unfolding atLeast0LessThan[symmetric] by(subst sum_add_nat_ivl) simp_all unfolding atLeast0LessThan[symmetric] by(subst sum.atLeastLessThan_concat) simp_all with i_conv have "(\i=k..snd (lnth E' i)\\<^bsub>o\<^esub>) = l" by simp moreover have "(\i=k..snd (lnth E' i)\\<^bsub>o\<^esub>) \ length \snd (lnth E' k)\\<^bsub>o\<^esub>" by(subst sum_head_upt_Suc[OF \k < i\]) simp by(subst sum.atLeast_Suc_lessThan[OF \k < i\]) simp ultimately show False using l by simp qed qed ... ... @@ -1021,7 +1021,7 @@ next hence "(\isnd (lnth E' i)\\<^bsub>o\<^esub>) = (\isnd (lnth E' i)\\<^bsub>o\<^esub>) + (\i = a'_m..snd (lnth E' i)\\<^bsub>o\<^esub>)" by(simp add: sum_upto_add_nat) hence "a' - n < a - n" using \a'_m < a_m\ a'_n E'_a'_m unfolding a_conv a'_conv by(subst (asm) sum_head_upt_Suc) simp_all by(subst (asm) sum.atLeast_Suc_lessThan) simp_all with a_a' show False by simp qed ... ... @@ -1090,7 +1090,7 @@ next hence "(\isnd (lnth E' i)\\<^bsub>o\<^esub>) = (\isnd (lnth E' i)\\<^bsub>o\<^esub>) + (\i = a_m..snd (lnth E' i)\\<^bsub>o\<^esub>)" by(simp add: sum_upto_add_nat) with a'_less \a_m < a'_m\ E'_a_m a_n a'_n show False unfolding a'_conv a_conv by(subst (asm) sum_head_upt_Suc) simp_all unfolding a'_conv a_conv by(subst (asm) sum.atLeast_Suc_lessThan) simp_all qed qed with E'_a_m E'_a'_m have [simp]: "t_a' = t_a" "ta_a' = ta_a" by simp_all ... ...
 ... ... @@ -101,7 +101,7 @@ lemma vec_conjugate_sprod_comm: fixes v w :: "'a :: {conjugatable_ring, comm_ring} vec" assumes "v : carrier_vec n" and "w : carrier_vec n" shows "v \c w = (conjugate\<^sub>v w \ v)" unfolding scalar_prod_def using assms by(subst sum_ivl_cong, auto simp: ac_simps) unfolding scalar_prod_def using assms by(subst sum.ivl_cong, auto simp: ac_simps) lemma vec_conjugate_square_zero: fixes v :: "'a :: {conjugatable_ordered_ring,semiring_no_zero_divisors} vec" ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!