ILE Home Intuitionistic Logic Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  ILE Home  >  Th. List  >  bcval Unicode version

Theorem bcval 10652
Description: Value of the binomial coefficient,  N choose  K. Definition of binomial coefficient in [Gleason] p. 295. As suggested by Gleason, we define it to be 0 when  0  <_  K  <_  N does not hold. See bcval2 10653 for the value in the standard domain. (Contributed by NM, 10-Jul-2005.) (Revised by Mario Carneiro, 7-Nov-2013.)
Assertion
Ref Expression
bcval  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  ( N  _C  K
)  =  if ( K  e.  ( 0 ... N ) ,  ( ( ! `  N )  /  (
( ! `  ( N  -  K )
)  x.  ( ! `
 K ) ) ) ,  0 ) )

Proof of Theorem bcval
Dummy variables  k  n are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 iftrue 3521 . . . . 5  |-  ( K  e.  ( 0 ... N )  ->  if ( K  e.  (
0 ... N ) ,  ( ( ! `  N )  /  (
( ! `  ( N  -  K )
)  x.  ( ! `
 K ) ) ) ,  0 )  =  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) ) )
21adantl 275 . . . 4  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  if ( K  e.  ( 0 ... N ) ,  ( ( ! `  N )  /  (
( ! `  ( N  -  K )
)  x.  ( ! `
 K ) ) ) ,  0 )  =  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) ) )
3 simpll 519 . . . . . . 7  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  N  e.  NN0 )
43faccld 10639 . . . . . 6  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ! `  N )  e.  NN )
54nnzd 9304 . . . . 5  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ! `  N )  e.  ZZ )
6 fznn0sub 9983 . . . . . . . 8  |-  ( K  e.  ( 0 ... N )  ->  ( N  -  K )  e.  NN0 )
76adantl 275 . . . . . . 7  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( N  -  K )  e.  NN0 )
87faccld 10639 . . . . . 6  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ! `  ( N  -  K
) )  e.  NN )
9 elfznn0 10040 . . . . . . . 8  |-  ( K  e.  ( 0 ... N )  ->  K  e.  NN0 )
109adantl 275 . . . . . . 7  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  K  e.  NN0 )
1110faccld 10639 . . . . . 6  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ! `  K )  e.  NN )
128, 11nnmulcld 8898 . . . . 5  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ( ! `  ( N  -  K ) )  x.  ( ! `  K
) )  e.  NN )
13 znq 9554 . . . . 5  |-  ( ( ( ! `  N
)  e.  ZZ  /\  ( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
)  e.  NN )  ->  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) )  e.  QQ )
145, 12, 13syl2anc 409 . . . 4  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ( ! `  N )  /  ( ( ! `
 ( N  -  K ) )  x.  ( ! `  K
) ) )  e.  QQ )
152, 14eqeltrd 2241 . . 3  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  if ( K  e.  ( 0 ... N ) ,  ( ( ! `  N )  /  (
( ! `  ( N  -  K )
)  x.  ( ! `
 K ) ) ) ,  0 )  e.  QQ )
16 iffalse 3524 . . . . 5  |-  ( -.  K  e.  ( 0 ... N )  ->  if ( K  e.  ( 0 ... N ) ,  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) ) ,  0 )  =  0 )
17 0z 9194 . . . . . 6  |-  0  e.  ZZ
18 zq 9556 . . . . . 6  |-  ( 0  e.  ZZ  ->  0  e.  QQ )
1917, 18ax-mp 5 . . . . 5  |-  0  e.  QQ
2016, 19eqeltrdi 2255 . . . 4  |-  ( -.  K  e.  ( 0 ... N )  ->  if ( K  e.  ( 0 ... N ) ,  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) ) ,  0 )  e.  QQ )
2120adantl 275 . . 3  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  -.  K  e.  ( 0 ... N
) )  ->  if ( K  e.  (
0 ... N ) ,  ( ( ! `  N )  /  (
( ! `  ( N  -  K )
)  x.  ( ! `
 K ) ) ) ,  0 )  e.  QQ )
22 simpr 109 . . . . 5  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  K  e.  ZZ )
23 0zd 9195 . . . . 5  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  0  e.  ZZ )
24 simpl 108 . . . . . 6  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  N  e.  NN0 )
2524nn0zd 9303 . . . . 5  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  N  e.  ZZ )
26 fzdcel 9966 . . . . 5  |-  ( ( K  e.  ZZ  /\  0  e.  ZZ  /\  N  e.  ZZ )  -> DECID  K  e.  (
0 ... N ) )
2722, 23, 25, 26syl3anc 1227 . . . 4  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  -> DECID  K  e.  ( 0 ... N ) )
28 exmiddc 826 . . . 4  |-  (DECID  K  e.  ( 0 ... N
)  ->  ( K  e.  ( 0 ... N
)  \/  -.  K  e.  ( 0 ... N
) ) )
2927, 28syl 14 . . 3  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  ( K  e.  ( 0 ... N )  \/  -.  K  e.  ( 0 ... N
) ) )
3015, 21, 29mpjaodan 788 . 2  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  if ( K  e.  ( 0 ... N
) ,  ( ( ! `  N )  /  ( ( ! `
 ( N  -  K ) )  x.  ( ! `  K
) ) ) ,  0 )  e.  QQ )
31 oveq2 5845 . . . . 5  |-  ( n  =  N  ->  (
0 ... n )  =  ( 0 ... N
) )
3231eleq2d 2234 . . . 4  |-  ( n  =  N  ->  (
k  e.  ( 0 ... n )  <->  k  e.  ( 0 ... N
) ) )
33 fveq2 5481 . . . . 5  |-  ( n  =  N  ->  ( ! `  n )  =  ( ! `  N ) )
34 oveq1 5844 . . . . . . 7  |-  ( n  =  N  ->  (
n  -  k )  =  ( N  -  k ) )
3534fveq2d 5485 . . . . . 6  |-  ( n  =  N  ->  ( ! `  ( n  -  k ) )  =  ( ! `  ( N  -  k
) ) )
3635oveq1d 5852 . . . . 5  |-  ( n  =  N  ->  (
( ! `  (
n  -  k ) )  x.  ( ! `
 k ) )  =  ( ( ! `
 ( N  -  k ) )  x.  ( ! `  k
) ) )
3733, 36oveq12d 5855 . . . 4  |-  ( n  =  N  ->  (
( ! `  n
)  /  ( ( ! `  ( n  -  k ) )  x.  ( ! `  k ) ) )  =  ( ( ! `
 N )  / 
( ( ! `  ( N  -  k
) )  x.  ( ! `  k )
) ) )
3832, 37ifbieq1d 3538 . . 3  |-  ( n  =  N  ->  if ( k  e.  ( 0 ... n ) ,  ( ( ! `
 n )  / 
( ( ! `  ( n  -  k
) )  x.  ( ! `  k )
) ) ,  0 )  =  if ( k  e.  ( 0 ... N ) ,  ( ( ! `  N )  /  (
( ! `  ( N  -  k )
)  x.  ( ! `
 k ) ) ) ,  0 ) )
39 eleq1 2227 . . . 4  |-  ( k  =  K  ->  (
k  e.  ( 0 ... N )  <->  K  e.  ( 0 ... N
) ) )
40 oveq2 5845 . . . . . . 7  |-  ( k  =  K  ->  ( N  -  k )  =  ( N  -  K ) )
4140fveq2d 5485 . . . . . 6  |-  ( k  =  K  ->  ( ! `  ( N  -  k ) )  =  ( ! `  ( N  -  K
) ) )
42 fveq2 5481 . . . . . 6  |-  ( k  =  K  ->  ( ! `  k )  =  ( ! `  K ) )
4341, 42oveq12d 5855 . . . . 5  |-  ( k  =  K  ->  (
( ! `  ( N  -  k )
)  x.  ( ! `
 k ) )  =  ( ( ! `
 ( N  -  K ) )  x.  ( ! `  K
) ) )
4443oveq2d 5853 . . . 4  |-  ( k  =  K  ->  (
( ! `  N
)  /  ( ( ! `  ( N  -  k ) )  x.  ( ! `  k ) ) )  =  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) ) )
4539, 44ifbieq1d 3538 . . 3  |-  ( k  =  K  ->  if ( k  e.  ( 0 ... N ) ,  ( ( ! `
 N )  / 
( ( ! `  ( N  -  k
) )  x.  ( ! `  k )
) ) ,  0 )  =  if ( K  e.  ( 0 ... N ) ,  ( ( ! `  N )  /  (
( ! `  ( N  -  K )
)  x.  ( ! `
 K ) ) ) ,  0 ) )
46 df-bc 10651 . . 3  |-  _C  =  ( n  e.  NN0 ,  k  e.  ZZ  |->  if ( k  e.  ( 0 ... n ) ,  ( ( ! `
 n )  / 
( ( ! `  ( n  -  k
) )  x.  ( ! `  k )
) ) ,  0 ) )
4738, 45, 46ovmpog 5968 . 2  |-  ( ( N  e.  NN0  /\  K  e.  ZZ  /\  if ( K  e.  (
0 ... N ) ,  ( ( ! `  N )  /  (
( ! `  ( N  -  K )
)  x.  ( ! `
 K ) ) ) ,  0 )  e.  QQ )  -> 
( N  _C  K
)  =  if ( K  e.  ( 0 ... N ) ,  ( ( ! `  N )  /  (
( ! `  ( N  -  K )
)  x.  ( ! `
 K ) ) ) ,  0 ) )
4830, 47mpd3an3 1327 1  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  ( N  _C  K
)  =  if ( K  e.  ( 0 ... N ) ,  ( ( ! `  N )  /  (
( ! `  ( N  -  K )
)  x.  ( ! `
 K ) ) ) ,  0 ) )
Colors of variables: wff set class
Syntax hints:   -. wn 3    -> wi 4    /\ wa 103    \/ wo 698  DECID wdc 824    = wceq 1342    e. wcel 2135   ifcif 3516   ` cfv 5183  (class class class)co 5837   0cc0 7745    x. cmul 7750    - cmin 8061    / cdiv 8560   NNcn 8849   NN0cn0 9106   ZZcz 9183   QQcq 9549   ...cfz 9936   !cfa 10628    _C cbc 10650
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-ia1 105  ax-ia2 106  ax-ia3 107  ax-in1 604  ax-in2 605  ax-io 699  ax-5 1434  ax-7 1435  ax-gen 1436  ax-ie1 1480  ax-ie2 1481  ax-8 1491  ax-10 1492  ax-11 1493  ax-i12 1494  ax-bndl 1496  ax-4 1497  ax-17 1513  ax-i9 1517  ax-ial 1521  ax-i5r 1522  ax-13 2137  ax-14 2138  ax-ext 2146  ax-coll 4092  ax-sep 4095  ax-nul 4103  ax-pow 4148  ax-pr 4182  ax-un 4406  ax-setind 4509  ax-iinf 4560  ax-cnex 7836  ax-resscn 7837  ax-1cn 7838  ax-1re 7839  ax-icn 7840  ax-addcl 7841  ax-addrcl 7842  ax-mulcl 7843  ax-mulrcl 7844  ax-addcom 7845  ax-mulcom 7846  ax-addass 7847  ax-mulass 7848  ax-distr 7849  ax-i2m1 7850  ax-0lt1 7851  ax-1rid 7852  ax-0id 7853  ax-rnegex 7854  ax-precex 7855  ax-cnre 7856  ax-pre-ltirr 7857  ax-pre-ltwlin 7858  ax-pre-lttrn 7859  ax-pre-apti 7860  ax-pre-ltadd 7861  ax-pre-mulgt0 7862  ax-pre-mulext 7863
This theorem depends on definitions:  df-bi 116  df-dc 825  df-3or 968  df-3an 969  df-tru 1345  df-fal 1348  df-nf 1448  df-sb 1750  df-eu 2016  df-mo 2017  df-clab 2151  df-cleq 2157  df-clel 2160  df-nfc 2295  df-ne 2335  df-nel 2430  df-ral 2447  df-rex 2448  df-reu 2449  df-rmo 2450  df-rab 2451  df-v 2724  df-sbc 2948  df-csb 3042  df-dif 3114  df-un 3116  df-in 3118  df-ss 3125  df-nul 3406  df-if 3517  df-pw 3556  df-sn 3577  df-pr 3578  df-op 3580  df-uni 3785  df-int 3820  df-iun 3863  df-br 3978  df-opab 4039  df-mpt 4040  df-tr 4076  df-id 4266  df-po 4269  df-iso 4270  df-iord 4339  df-on 4341  df-ilim 4342  df-suc 4344  df-iom 4563  df-xp 4605  df-rel 4606  df-cnv 4607  df-co 4608  df-dm 4609  df-rn 4610  df-res 4611  df-ima 4612  df-iota 5148  df-fun 5185  df-fn 5186  df-f 5187  df-f1 5188  df-fo 5189  df-f1o 5190  df-fv 5191  df-riota 5793  df-ov 5840  df-oprab 5841  df-mpo 5842  df-1st 6101  df-2nd 6102  df-recs 6265  df-frec 6351  df-pnf 7927  df-mnf 7928  df-xr 7929  df-ltxr 7930  df-le 7931  df-sub 8063  df-neg 8064  df-reap 8465  df-ap 8472  df-div 8561  df-inn 8850  df-n0 9107  df-z 9184  df-uz 9459  df-q 9550  df-fz 9937  df-seqfrec 10372  df-fac 10629  df-bc 10651
This theorem is referenced by:  bcval2  10653  bcval3  10654
  Copyright terms: Public domain W3C validator