src/HOL/Library/Binomial.thy
changeset 47108 2a1953f0d20d
parent 46757 ad878aff9c15
child 48830 72efe3e0a46b
equal deleted inserted replaced
47107:35807a5d8dc2 47108:2a1953f0d20d
   348   {assume n0: "n\<noteq>0"
   348   {assume n0: "n\<noteq>0"
   349     from n0 setprod_constant[of "{0 .. n - 1}" "- (1:: 'a)"]
   349     from n0 setprod_constant[of "{0 .. n - 1}" "- (1:: 'a)"]
   350     have eq: "(- (1\<Colon>'a)) ^ n = setprod (\<lambda>i. - 1) {0 .. n - 1}"
   350     have eq: "(- (1\<Colon>'a)) ^ n = setprod (\<lambda>i. - 1) {0 .. n - 1}"
   351       by auto
   351       by auto
   352     from n0 have ?thesis 
   352     from n0 have ?thesis 
   353       by (simp add: pochhammer_def gbinomial_def field_simps eq setprod_timesf[symmetric])}
   353       by (simp add: pochhammer_def gbinomial_def field_simps eq setprod_timesf[symmetric] del: minus_one) (* FIXME: del: minus_one *)}
   354   ultimately show ?thesis by blast
   354   ultimately show ?thesis by blast
   355 qed
   355 qed
   356 
   356 
   357 lemma binomial_fact_lemma:
   357 lemma binomial_fact_lemma:
   358   "k \<le> n \<Longrightarrow> fact k * fact (n - k) * (n choose k) = fact n"
   358   "k \<le> n \<Longrightarrow> fact k * fact (n - k) * (n choose k) = fact n"
   415     have th0: "finite {1..n - Suc h}" "finite {n - h .. n}" 
   415     have th0: "finite {1..n - Suc h}" "finite {n - h .. n}" 
   416 "{1..n - Suc h} \<inter> {n - h .. n} = {}" and eq3: "{1..n - Suc h} \<union> {n - h .. n} = {1..n}" using h kn by auto
   416 "{1..n - Suc h} \<inter> {n - h .. n} = {}" and eq3: "{1..n - Suc h} \<union> {n - h .. n} = {1..n}" using h kn by auto
   417     from eq[symmetric]
   417     from eq[symmetric]
   418     have ?thesis using kn
   418     have ?thesis using kn
   419       apply (simp add: binomial_fact[OF kn, where ?'a = 'a] 
   419       apply (simp add: binomial_fact[OF kn, where ?'a = 'a] 
   420         gbinomial_pochhammer field_simps pochhammer_Suc_setprod)
   420         gbinomial_pochhammer field_simps pochhammer_Suc_setprod del: minus_one)
   421       apply (simp add: pochhammer_Suc_setprod fact_altdef_nat h of_nat_setprod setprod_timesf[symmetric] eq' del: One_nat_def power_Suc)
   421       apply (simp add: pochhammer_Suc_setprod fact_altdef_nat h of_nat_setprod setprod_timesf[symmetric] eq' del: One_nat_def power_Suc del: minus_one)
   422       unfolding setprod_Un_disjoint[OF th0, unfolded eq3, of "of_nat:: nat \<Rightarrow> 'a"] eq[unfolded h]
   422       unfolding setprod_Un_disjoint[OF th0, unfolded eq3, of "of_nat:: nat \<Rightarrow> 'a"] eq[unfolded h]
   423       unfolding mult_assoc[symmetric] 
   423       unfolding mult_assoc[symmetric] 
   424       unfolding setprod_timesf[symmetric]
   424       unfolding setprod_timesf[symmetric]
   425       apply simp
   425       apply simp
   426       apply (rule strong_setprod_reindex_cong[where f= "op - n"])
   426       apply (rule strong_setprod_reindex_cong[where f= "op - n"])