src/HOL/Fact.thy
changeset 57129 7edb7550663e
parent 57113 7e95523302e6
child 57418 6ab1c7cb0b8d
equal deleted inserted replaced
57128:4874411752fe 57129:7edb7550663e
   306 lemma inv_of_nat_fact_ge_zero [simp]: "(0::'a::linordered_field) \<le> inverse (of_nat (fact n))"
   306 lemma inv_of_nat_fact_ge_zero [simp]: "(0::'a::linordered_field) \<le> inverse (of_nat (fact n))"
   307 by (auto intro: order_less_imp_le)
   307 by (auto intro: order_less_imp_le)
   308 
   308 
   309 lemma fact_eq_rev_setprod_nat: "fact (k::nat) = (\<Prod>i<k. k - i)"
   309 lemma fact_eq_rev_setprod_nat: "fact (k::nat) = (\<Prod>i<k. k - i)"
   310   unfolding fact_altdef_nat
   310   unfolding fact_altdef_nat
   311 proof (rule strong_setprod_reindex_cong)
   311   by (rule setprod.reindex_bij_witness[where i="\<lambda>i. k - i" and j="\<lambda>i. k - i"]) auto
   312   { fix i assume "Suc 0 \<le> i" "i \<le> k" then have "\<exists>j\<in>{..<k}. i = k - j"
       
   313       by (intro bexI[of _ "k - i"]) simp_all }
       
   314   then show "{1..k} = (\<lambda>i. k - i) ` {..<k}"
       
   315     by (auto simp: image_iff)
       
   316 qed (auto intro: inj_onI)
       
   317 
   312 
   318 lemma fact_div_fact_le_pow:
   313 lemma fact_div_fact_le_pow:
   319   assumes "r \<le> n" shows "fact n div fact (n - r) \<le> n ^ r"
   314   assumes "r \<le> n" shows "fact n div fact (n - r) \<le> n ^ r"
   320 proof -
   315 proof -
   321   have "\<And>r. r \<le> n \<Longrightarrow> \<Prod>{n - r..n} = (n - r) * \<Prod>{Suc (n - r)..n}"
   316   have "\<And>r. r \<le> n \<Longrightarrow> \<Prod>{n - r..n} = (n - r) * \<Prod>{Suc (n - r)..n}"