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

Theorem bcval 10507
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 10508 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 3479 . . . . 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 518 . . . . . . 7  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  N  e.  NN0 )
43faccld 10494 . . . . . 6  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ! `  N )  e.  NN )
54nnzd 9184 . . . . 5  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ! `  N )  e.  ZZ )
6 fznn0sub 9849 . . . . . . . 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 10494 . . . . . 6  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ! `  ( N  -  K
) )  e.  NN )
9 elfznn0 9906 . . . . . . . 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 10494 . . . . . 6  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ! `  K )  e.  NN )
128, 11nnmulcld 8781 . . . . 5  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ( ! `  ( N  -  K ) )  x.  ( ! `  K
) )  e.  NN )
13 znq 9428 . . . . 5  |-  ( ( ( ! `  N
)  e.  ZZ  /\  ( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
)  e.  NN )  ->  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) )  e.  QQ )
145, 12, 13syl2anc 408 . . . 4  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ( ! `  N )  /  ( ( ! `
 ( N  -  K ) )  x.  ( ! `  K
) ) )  e.  QQ )
152, 14eqeltrd 2216 . . 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 3482 . . . . 5  |-  ( -.  K  e.  ( 0 ... N )  ->  if ( K  e.  ( 0 ... N ) ,  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) ) ,  0 )  =  0 )
17 0z 9077 . . . . . 6  |-  0  e.  ZZ
18 zq 9430 . . . . . 6  |-  ( 0  e.  ZZ  ->  0  e.  QQ )
1917, 18ax-mp 5 . . . . 5  |-  0  e.  QQ
2016, 19eqeltrdi 2230 . . . 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 9078 . . . . 5  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  0  e.  ZZ )
24 simpl 108 . . . . . 6  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  N  e.  NN0 )
2524nn0zd 9183 . . . . 5  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  N  e.  ZZ )
26 fzdcel 9832 . . . . 5  |-  ( ( K  e.  ZZ  /\  0  e.  ZZ  /\  N  e.  ZZ )  -> DECID  K  e.  (
0 ... N ) )
2722, 23, 25, 26syl3anc 1216 . . . 4  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  -> DECID  K  e.  ( 0 ... N ) )
28 exmiddc 821 . . . 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 787 . 2  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  if ( K  e.  ( 0 ... N
) ,  ( ( ! `  N )  /  ( ( ! `
 ( N  -  K ) )  x.  ( ! `  K
) ) ) ,  0 )  e.  QQ )
31 oveq2 5782 . . . . 5  |-  ( n  =  N  ->  (
0 ... n )  =  ( 0 ... N
) )
3231eleq2d 2209 . . . 4  |-  ( n  =  N  ->  (
k  e.  ( 0 ... n )  <->  k  e.  ( 0 ... N
) ) )
33 fveq2 5421 . . . . 5  |-  ( n  =  N  ->  ( ! `  n )  =  ( ! `  N ) )
34 oveq1 5781 . . . . . . 7  |-  ( n  =  N  ->  (
n  -  k )  =  ( N  -  k ) )
3534fveq2d 5425 . . . . . 6  |-  ( n  =  N  ->  ( ! `  ( n  -  k ) )  =  ( ! `  ( N  -  k
) ) )
3635oveq1d 5789 . . . . 5  |-  ( n  =  N  ->  (
( ! `  (
n  -  k ) )  x.  ( ! `
 k ) )  =  ( ( ! `
 ( N  -  k ) )  x.  ( ! `  k
) ) )
3733, 36oveq12d 5792 . . . 4  |-  ( n  =  N  ->  (
( ! `  n
)  /  ( ( ! `  ( n  -  k ) )  x.  ( ! `  k ) ) )  =  ( ( ! `
 N )  / 
( ( ! `  ( N  -  k
) )  x.  ( ! `  k )
) ) )
3832, 37ifbieq1d 3494 . . 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 2202 . . . 4  |-  ( k  =  K  ->  (
k  e.  ( 0 ... N )  <->  K  e.  ( 0 ... N
) ) )
40 oveq2 5782 . . . . . . 7  |-  ( k  =  K  ->  ( N  -  k )  =  ( N  -  K ) )
4140fveq2d 5425 . . . . . 6  |-  ( k  =  K  ->  ( ! `  ( N  -  k ) )  =  ( ! `  ( N  -  K
) ) )
42 fveq2 5421 . . . . . 6  |-  ( k  =  K  ->  ( ! `  k )  =  ( ! `  K ) )
4341, 42oveq12d 5792 . . . . 5  |-  ( k  =  K  ->  (
( ! `  ( N  -  k )
)  x.  ( ! `
 k ) )  =  ( ( ! `
 ( N  -  K ) )  x.  ( ! `  K
) ) )
4443oveq2d 5790 . . . 4  |-  ( k  =  K  ->  (
( ! `  N
)  /  ( ( ! `  ( N  -  k ) )  x.  ( ! `  k ) ) )  =  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) ) )
4539, 44ifbieq1d 3494 . . 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 10506 . . 3  |-  _C  =  ( n  e.  NN0 ,  k  e.  ZZ  |->  if ( k  e.  ( 0 ... n ) ,  ( ( ! `
 n )  / 
( ( ! `  ( n  -  k
) )  x.  ( ! `  k )
) ) ,  0 ) )
4738, 45, 46ovmpog 5905 . 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 1316 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 697  DECID wdc 819    = wceq 1331    e. wcel 1480   ifcif 3474   ` cfv 5123  (class class class)co 5774   0cc0 7632    x. cmul 7637    - cmin 7945    / cdiv 8444   NNcn 8732   NN0cn0 8989   ZZcz 9066   QQcq 9423   ...cfz 9802   !cfa 10483    _C cbc 10505
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 603  ax-in2 604  ax-io 698  ax-5 1423  ax-7 1424  ax-gen 1425  ax-ie1 1469  ax-ie2 1470  ax-8 1482  ax-10 1483  ax-11 1484  ax-i12 1485  ax-bndl 1486  ax-4 1487  ax-13 1491  ax-14 1492  ax-17 1506  ax-i9 1510  ax-ial 1514  ax-i5r 1515  ax-ext 2121  ax-coll 4043  ax-sep 4046  ax-nul 4054  ax-pow 4098  ax-pr 4131  ax-un 4355  ax-setind 4452  ax-iinf 4502  ax-cnex 7723  ax-resscn 7724  ax-1cn 7725  ax-1re 7726  ax-icn 7727  ax-addcl 7728  ax-addrcl 7729  ax-mulcl 7730  ax-mulrcl 7731  ax-addcom 7732  ax-mulcom 7733  ax-addass 7734  ax-mulass 7735  ax-distr 7736  ax-i2m1 7737  ax-0lt1 7738  ax-1rid 7739  ax-0id 7740  ax-rnegex 7741  ax-precex 7742  ax-cnre 7743  ax-pre-ltirr 7744  ax-pre-ltwlin 7745  ax-pre-lttrn 7746  ax-pre-apti 7747  ax-pre-ltadd 7748  ax-pre-mulgt0 7749  ax-pre-mulext 7750
This theorem depends on definitions:  df-bi 116  df-dc 820  df-3or 963  df-3an 964  df-tru 1334  df-fal 1337  df-nf 1437  df-sb 1736  df-eu 2002  df-mo 2003  df-clab 2126  df-cleq 2132  df-clel 2135  df-nfc 2270  df-ne 2309  df-nel 2404  df-ral 2421  df-rex 2422  df-reu 2423  df-rmo 2424  df-rab 2425  df-v 2688  df-sbc 2910  df-csb 3004  df-dif 3073  df-un 3075  df-in 3077  df-ss 3084  df-nul 3364  df-if 3475  df-pw 3512  df-sn 3533  df-pr 3534  df-op 3536  df-uni 3737  df-int 3772  df-iun 3815  df-br 3930  df-opab 3990  df-mpt 3991  df-tr 4027  df-id 4215  df-po 4218  df-iso 4219  df-iord 4288  df-on 4290  df-ilim 4291  df-suc 4293  df-iom 4505  df-xp 4545  df-rel 4546  df-cnv 4547  df-co 4548  df-dm 4549  df-rn 4550  df-res 4551  df-ima 4552  df-iota 5088  df-fun 5125  df-fn 5126  df-f 5127  df-f1 5128  df-fo 5129  df-f1o 5130  df-fv 5131  df-riota 5730  df-ov 5777  df-oprab 5778  df-mpo 5779  df-1st 6038  df-2nd 6039  df-recs 6202  df-frec 6288  df-pnf 7814  df-mnf 7815  df-xr 7816  df-ltxr 7817  df-le 7818  df-sub 7947  df-neg 7948  df-reap 8349  df-ap 8356  df-div 8445  df-inn 8733  df-n0 8990  df-z 9067  df-uz 9339  df-q 9424  df-fz 9803  df-seqfrec 10231  df-fac 10484  df-bc 10506
This theorem is referenced by:  bcval2  10508  bcval3  10509
  Copyright terms: Public domain W3C validator