# HG changeset patch # User haftmann # Date 1467654379 -7200 # Node ID 487d764fca4a471ee292336d20291b1983051164 # Parent 492b495350940f3927a4eac4a7f3251174334424 tuned sections diff -r 492b49535094 -r 487d764fca4a src/HOL/Binomial.thy --- a/src/HOL/Binomial.thy Mon Jul 04 19:46:19 2016 +0200 +++ b/src/HOL/Binomial.thy Mon Jul 04 19:46:19 2016 +0200 @@ -6,7 +6,7 @@ Additional binomial identities by Chaitanya Mangla and Manuel Eberl *) -section\Factorial Function, Binomial Coefficients and Binomial Theorem\ +section \Combinatorial Functions: Factorial Function, Rising Factorials, Binomial Coefficients and Binomial Theorem\ theory Binomial imports Main @@ -170,7 +170,8 @@ text \This development is based on the work of Andy Gordon and Florian Kammueller.\ -subsection \Basic definitions and lemmas\ + +subsection \Binomial coefficients\ text \Combinatorial definition\ @@ -471,7 +472,8 @@ finally show ?thesis . qed -subsection\Pochhammer's symbol : generalized rising factorial\ + +subsection \Pochhammer's symbol : generalized rising factorial\ text \See @{url "http://en.wikipedia.org/wiki/Pochhammer_symbol"}\ @@ -1136,7 +1138,7 @@ thus ?case using gbinomial_Suc_Suc[of "(r + of_nat m + 1)" m] by (simp add: add_ac) qed auto -subsection \Summation on the upper index\ +subsubsection \Summation on the upper index\ text \ Another summation formula is equation 5.10 of the reference material \cite[p.~160]{GKP}, aptly named \emph{summation on the upper index}:\[\sum_{0 \leq k \leq n} {k \choose m} = @@ -1383,7 +1385,7 @@ by simp -subsection \Binomial coefficients\ +subsection \More on Binomial Coefficients\ lemma choose_one: "(n::nat) choose 1 = n" by simp @@ -1585,6 +1587,9 @@ (simp_all only: ac_simps diff_Suc_Suc Suc_diff_le diff_add_inverse fact_Suc of_nat_id) qed + +subsection \Misc\ + lemma fact_code [code]: "fact n = (of_nat (fold_atLeastAtMost_nat (op *) 2 n 1) :: 'a :: semiring_char_0)" proof - @@ -1600,7 +1605,6 @@ "setprod f {.. f) 0 n 1" by (simp add: lessThan_Suc_atMost atLeast0AtMost [symmetric] setprod_atLeastAtMost_code comp_def) - lemma pochhammer_code [code]: "pochhammer a n = (if n = 0 then 1 else fold_atLeastAtMost_nat (\n acc. (a + of_nat n) * acc) 0 (n - 1) 1)"