src/HOL/Library/Binomial.thy
changeset 32960 69916a850301
parent 32161 abda97d2deea
child 35372 ca158c7b1144
equal deleted inserted replaced
32959:23a8c5ac35f8 32960:69916a850301
   396 lemma binomial_gbinomial: "of_nat (n choose k) = of_nat n gchoose k"
   396 lemma binomial_gbinomial: "of_nat (n choose k) = of_nat n gchoose k"
   397 proof-
   397 proof-
   398   {assume kn: "k > n" 
   398   {assume kn: "k > n" 
   399     from kn binomial_eq_0[OF kn] have ?thesis 
   399     from kn binomial_eq_0[OF kn] have ?thesis 
   400       by (simp add: gbinomial_pochhammer field_simps
   400       by (simp add: gbinomial_pochhammer field_simps
   401 	pochhammer_of_nat_eq_0_iff)}
   401         pochhammer_of_nat_eq_0_iff)}
   402   moreover
   402   moreover
   403   {assume "k=0" then have ?thesis by simp}
   403   {assume "k=0" then have ?thesis by simp}
   404   moreover
   404   moreover
   405   {assume kn: "k \<le> n" and k0: "k\<noteq> 0"
   405   {assume kn: "k \<le> n" and k0: "k\<noteq> 0"
   406     from k0 obtain h where h: "k = Suc h" by (cases k, auto)
   406     from k0 obtain h where h: "k = Suc h" by (cases k, auto)
   418     have th0: "finite {1..n - Suc h}" "finite {n - h .. n}" 
   418     have th0: "finite {1..n - Suc h}" "finite {n - h .. n}" 
   419 "{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
   419 "{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
   420     from eq[symmetric]
   420     from eq[symmetric]
   421     have ?thesis using kn
   421     have ?thesis using kn
   422       apply (simp add: binomial_fact[OF kn, where ?'a = 'a] 
   422       apply (simp add: binomial_fact[OF kn, where ?'a = 'a] 
   423 	gbinomial_pochhammer field_simps pochhammer_Suc_setprod)
   423         gbinomial_pochhammer field_simps pochhammer_Suc_setprod)
   424       apply (simp add: pochhammer_Suc_setprod fact_altdef_nat h of_nat_setprod setprod_timesf[symmetric] eq' del: One_nat_def power_Suc)
   424       apply (simp add: pochhammer_Suc_setprod fact_altdef_nat h of_nat_setprod setprod_timesf[symmetric] eq' del: One_nat_def power_Suc)
   425       unfolding setprod_Un_disjoint[OF th0, unfolded eq3, of "of_nat:: nat \<Rightarrow> 'a"] eq[unfolded h]
   425       unfolding setprod_Un_disjoint[OF th0, unfolded eq3, of "of_nat:: nat \<Rightarrow> 'a"] eq[unfolded h]
   426       unfolding mult_assoc[symmetric] 
   426       unfolding mult_assoc[symmetric] 
   427       unfolding setprod_timesf[symmetric]
   427       unfolding setprod_timesf[symmetric]
   428       apply simp
   428       apply simp