# HG changeset patch # User paulson # Date 1715552619 -3600 # Node ID 7fefa7839ac684949d60dc4cf12b13e55f12ecfa # Parent 200107cdd3ace94795120c67770f74402ab1903e syntax of gchoose now the same as choose diff -r 200107cdd3ac -r 7fefa7839ac6 src/HOL/Binomial.thy --- a/src/HOL/Binomial.thy Mon May 06 14:39:33 2024 +0100 +++ b/src/HOL/Binomial.thy Sun May 12 23:23:39 2024 +0100 @@ -362,7 +362,7 @@ subsection \Generalized binomial coefficients\ -definition gbinomial :: "'a::{semidom_divide,semiring_char_0} \ nat \ 'a" (infixl "gchoose" 65) +definition gbinomial :: "'a::{semidom_divide,semiring_char_0} \ nat \ 'a" (infix "gchoose" 64) where gbinomial_prod_rev: "a gchoose k = prod (\i. a - of_nat i) {0..i = 0.. = (a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\i=0..Suc h. a - of_nat i)" - apply (simp only: gbinomial_mult_fact field_simps mult.left_commute [of _ "2"]) - apply (simp del: fact_Suc add: fact_Suc [of "Suc h"] field_simps gbinomial_mult_fact - mult.left_commute [of _ "2"] atLeastLessThanSuc_atLeastAtMost) - done + by (metis atLeastLessThanSuc_atLeastAtMost fact_Suc gbinomial_mult_fact mult.commute of_nat_fact of_nat_mult) also have "\ = (fact (Suc h) * (a gchoose Suc h)) * of_nat (Suc (Suc h)) + (\i=0..Suc h. a - of_nat i)" by (simp only: fact_Suc mult.commute mult.left_commute of_nat_fact of_nat_id of_nat_mult) @@ -526,7 +526,7 @@ using fact_nonzero [of "Suc k"] by auto qed -lemma gbinomial_reduce_nat: "0 < k \ a gchoose k = (a - 1) gchoose (k - 1) + ((a - 1) gchoose k)" +lemma gbinomial_reduce_nat: "0 < k \ a gchoose k = (a-1 gchoose k-1) + (a-1 gchoose k)" for a :: "'a::field_char_0" by (metis Suc_pred' diff_add_cancel gbinomial_Suc_Suc)