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

Theorem bcval 9617
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 9618 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 3364 . . . . 5  |-  ( K  e.  ( 0 ... N )  ->  if ( K  e.  (
0 ... N ) ,  ( ( ! `  N )  /  (
( ! `  ( N  -  K )
)  x.  ( ! `
 K ) ) ) ,  0 )  =  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) ) )
21adantl 266 . . . 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 489 . . . . . . 7  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  N  e.  NN0 )
43faccld 9604 . . . . . 6  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ! `  N )  e.  NN )
54nnzd 8418 . . . . 5  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ! `  N )  e.  ZZ )
6 fznn0sub 9022 . . . . . . . 8  |-  ( K  e.  ( 0 ... N )  ->  ( N  -  K )  e.  NN0 )
76adantl 266 . . . . . . 7  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( N  -  K )  e.  NN0 )
87faccld 9604 . . . . . 6  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ! `  ( N  -  K
) )  e.  NN )
9 elfznn0 9077 . . . . . . . 8  |-  ( K  e.  ( 0 ... N )  ->  K  e.  NN0 )
109adantl 266 . . . . . . 7  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  K  e.  NN0 )
1110faccld 9604 . . . . . 6  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ! `  K )  e.  NN )
128, 11nnmulcld 8038 . . . . 5  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ( ! `  ( N  -  K ) )  x.  ( ! `  K
) )  e.  NN )
13 znq 8656 . . . . 5  |-  ( ( ( ! `  N
)  e.  ZZ  /\  ( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
)  e.  NN )  ->  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) )  e.  QQ )
145, 12, 13syl2anc 397 . . . 4  |-  ( ( ( N  e.  NN0  /\  K  e.  ZZ )  /\  K  e.  ( 0 ... N ) )  ->  ( ( ! `  N )  /  ( ( ! `
 ( N  -  K ) )  x.  ( ! `  K
) ) )  e.  QQ )
152, 14eqeltrd 2130 . . 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 3367 . . . . 5  |-  ( -.  K  e.  ( 0 ... N )  ->  if ( K  e.  ( 0 ... N ) ,  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) ) ,  0 )  =  0 )
17 0z 8313 . . . . . 6  |-  0  e.  ZZ
18 zq 8658 . . . . . 6  |-  ( 0  e.  ZZ  ->  0  e.  QQ )
1917, 18ax-mp 7 . . . . 5  |-  0  e.  QQ
2016, 19syl6eqel 2144 . . . 4  |-  ( -.  K  e.  ( 0 ... N )  ->  if ( K  e.  ( 0 ... N ) ,  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) ) ,  0 )  e.  QQ )
2120adantl 266 . . 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 107 . . . . 5  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  K  e.  ZZ )
23 0zd 8314 . . . . 5  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  0  e.  ZZ )
24 simpl 106 . . . . . 6  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  N  e.  NN0 )
2524nn0zd 8417 . . . . 5  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  N  e.  ZZ )
26 fzdcel 9006 . . . . 5  |-  ( ( K  e.  ZZ  /\  0  e.  ZZ  /\  N  e.  ZZ )  -> DECID  K  e.  (
0 ... N ) )
2722, 23, 25, 26syl3anc 1146 . . . 4  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  -> DECID  K  e.  ( 0 ... N ) )
28 exmiddc 755 . . . 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 722 . 2  |-  ( ( N  e.  NN0  /\  K  e.  ZZ )  ->  if ( K  e.  ( 0 ... N
) ,  ( ( ! `  N )  /  ( ( ! `
 ( N  -  K ) )  x.  ( ! `  K
) ) ) ,  0 )  e.  QQ )
31 oveq2 5548 . . . . 5  |-  ( n  =  N  ->  (
0 ... n )  =  ( 0 ... N
) )
3231eleq2d 2123 . . . 4  |-  ( n  =  N  ->  (
k  e.  ( 0 ... n )  <->  k  e.  ( 0 ... N
) ) )
33 fveq2 5206 . . . . 5  |-  ( n  =  N  ->  ( ! `  n )  =  ( ! `  N ) )
34 oveq1 5547 . . . . . . 7  |-  ( n  =  N  ->  (
n  -  k )  =  ( N  -  k ) )
3534fveq2d 5210 . . . . . 6  |-  ( n  =  N  ->  ( ! `  ( n  -  k ) )  =  ( ! `  ( N  -  k
) ) )
3635oveq1d 5555 . . . . 5  |-  ( n  =  N  ->  (
( ! `  (
n  -  k ) )  x.  ( ! `
 k ) )  =  ( ( ! `
 ( N  -  k ) )  x.  ( ! `  k
) ) )
3733, 36oveq12d 5558 . . . 4  |-  ( n  =  N  ->  (
( ! `  n
)  /  ( ( ! `  ( n  -  k ) )  x.  ( ! `  k ) ) )  =  ( ( ! `
 N )  / 
( ( ! `  ( N  -  k
) )  x.  ( ! `  k )
) ) )
3832, 37ifbieq1d 3378 . . 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 2116 . . . 4  |-  ( k  =  K  ->  (
k  e.  ( 0 ... N )  <->  K  e.  ( 0 ... N
) ) )
40 oveq2 5548 . . . . . . 7  |-  ( k  =  K  ->  ( N  -  k )  =  ( N  -  K ) )
4140fveq2d 5210 . . . . . 6  |-  ( k  =  K  ->  ( ! `  ( N  -  k ) )  =  ( ! `  ( N  -  K
) ) )
42 fveq2 5206 . . . . . 6  |-  ( k  =  K  ->  ( ! `  k )  =  ( ! `  K ) )
4341, 42oveq12d 5558 . . . . 5  |-  ( k  =  K  ->  (
( ! `  ( N  -  k )
)  x.  ( ! `
 k ) )  =  ( ( ! `
 ( N  -  K ) )  x.  ( ! `  K
) ) )
4443oveq2d 5556 . . . 4  |-  ( k  =  K  ->  (
( ! `  N
)  /  ( ( ! `  ( N  -  k ) )  x.  ( ! `  k ) ) )  =  ( ( ! `
 N )  / 
( ( ! `  ( N  -  K
) )  x.  ( ! `  K )
) ) )
4539, 44ifbieq1d 3378 . . 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 9616 . . 3  |-  _C  =  ( n  e.  NN0 ,  k  e.  ZZ  |->  if ( k  e.  ( 0 ... n ) ,  ( ( ! `
 n )  / 
( ( ! `  ( n  -  k
) )  x.  ( ! `  k )
) ) ,  0 ) )
4738, 45, 46ovmpt2g 5663 . 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 1244 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 101    \/ wo 639  DECID wdc 753    = wceq 1259    e. wcel 1409   ifcif 3359   ` cfv 4930  (class class class)co 5540   0cc0 6947    x. cmul 6952    - cmin 7245    / cdiv 7725   NNcn 7990   NN0cn0 8239   ZZcz 8302   QQcq 8651   ...cfz 8976   !cfa 9593    _C cbc 9615
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-mp 7  ax-ia1 103  ax-ia2 104  ax-ia3 105  ax-in1 554  ax-in2 555  ax-io 640  ax-5 1352  ax-7 1353  ax-gen 1354  ax-ie1 1398  ax-ie2 1399  ax-8 1411  ax-10 1412  ax-11 1413  ax-i12 1414  ax-bndl 1415  ax-4 1416  ax-13 1420  ax-14 1421  ax-17 1435  ax-i9 1439  ax-ial 1443  ax-i5r 1444  ax-ext 2038  ax-coll 3900  ax-sep 3903  ax-nul 3911  ax-pow 3955  ax-pr 3972  ax-un 4198  ax-setind 4290  ax-iinf 4339  ax-cnex 7033  ax-resscn 7034  ax-1cn 7035  ax-1re 7036  ax-icn 7037  ax-addcl 7038  ax-addrcl 7039  ax-mulcl 7040  ax-mulrcl 7041  ax-addcom 7042  ax-mulcom 7043  ax-addass 7044  ax-mulass 7045  ax-distr 7046  ax-i2m1 7047  ax-1rid 7049  ax-0id 7050  ax-rnegex 7051  ax-precex 7052  ax-cnre 7053  ax-pre-ltirr 7054  ax-pre-ltwlin 7055  ax-pre-lttrn 7056  ax-pre-apti 7057  ax-pre-ltadd 7058  ax-pre-mulgt0 7059  ax-pre-mulext 7060
This theorem depends on definitions:  df-bi 114  df-dc 754  df-3or 897  df-3an 898  df-tru 1262  df-fal 1265  df-nf 1366  df-sb 1662  df-eu 1919  df-mo 1920  df-clab 2043  df-cleq 2049  df-clel 2052  df-nfc 2183  df-ne 2221  df-nel 2315  df-ral 2328  df-rex 2329  df-reu 2330  df-rmo 2331  df-rab 2332  df-v 2576  df-sbc 2788  df-csb 2881  df-dif 2948  df-un 2950  df-in 2952  df-ss 2959  df-nul 3253  df-if 3360  df-pw 3389  df-sn 3409  df-pr 3410  df-op 3412  df-uni 3609  df-int 3644  df-iun 3687  df-br 3793  df-opab 3847  df-mpt 3848  df-tr 3883  df-eprel 4054  df-id 4058  df-po 4061  df-iso 4062  df-iord 4131  df-on 4133  df-suc 4136  df-iom 4342  df-xp 4379  df-rel 4380  df-cnv 4381  df-co 4382  df-dm 4383  df-rn 4384  df-res 4385  df-ima 4386  df-iota 4895  df-fun 4932  df-fn 4933  df-f 4934  df-f1 4935  df-fo 4936  df-f1o 4937  df-fv 4938  df-riota 5496  df-ov 5543  df-oprab 5544  df-mpt2 5545  df-1st 5795  df-2nd 5796  df-recs 5951  df-irdg 5988  df-frec 6009  df-1o 6032  df-2o 6033  df-oadd 6036  df-omul 6037  df-er 6137  df-ec 6139  df-qs 6143  df-ni 6460  df-pli 6461  df-mi 6462  df-lti 6463  df-plpq 6500  df-mpq 6501  df-enq 6503  df-nqqs 6504  df-plqqs 6505  df-mqqs 6506  df-1nqqs 6507  df-rq 6508  df-ltnqqs 6509  df-enq0 6580  df-nq0 6581  df-0nq0 6582  df-plq0 6583  df-mq0 6584  df-inp 6622  df-i1p 6623  df-iplp 6624  df-iltp 6626  df-enr 6869  df-nr 6870  df-ltr 6873  df-0r 6874  df-1r 6875  df-0 6954  df-1 6955  df-r 6957  df-lt 6960  df-pnf 7121  df-mnf 7122  df-xr 7123  df-ltxr 7124  df-le 7125  df-sub 7247  df-neg 7248  df-reap 7640  df-ap 7647  df-div 7726  df-inn 7991  df-n0 8240  df-z 8303  df-uz 8570  df-q 8652  df-fz 8977  df-iseq 9376  df-fac 9594  df-bc 9616
This theorem is referenced by:  bcval2  9618  bcval3  9619
  Copyright terms: Public domain W3C validator