MPE Home Metamath Proof Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >  hashun3 Unicode version

Theorem hashun3 11545
Description: The size of the union of finite sets is the sum of their sizes minus the size of the intersection. (Contributed by Mario Carneiro, 6-Aug-2017.)
Assertion
Ref Expression
hashun3  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( A  u.  B )
)  =  ( ( ( # `  A
)  +  ( # `  B ) )  -  ( # `  ( A  i^i  B ) ) ) )

Proof of Theorem hashun3
StepHypRef Expression
1 diffi 7236 . . . . . . 7  |-  ( B  e.  Fin  ->  ( B  \  A )  e. 
Fin )
21adantl 452 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( B  \  A
)  e.  Fin )
3 simpl 443 . . . . . . 7  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  A  e.  Fin )
4 inss1 3477 . . . . . . 7  |-  ( A  i^i  B )  C_  A
5 ssfi 7226 . . . . . . 7  |-  ( ( A  e.  Fin  /\  ( A  i^i  B ) 
C_  A )  -> 
( A  i^i  B
)  e.  Fin )
63, 4, 5sylancl 643 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( A  i^i  B
)  e.  Fin )
7 sslin 3483 . . . . . . . . 9  |-  ( ( A  i^i  B ) 
C_  A  ->  (
( B  \  A
)  i^i  ( A  i^i  B ) )  C_  ( ( B  \  A )  i^i  A
) )
84, 7ax-mp 8 . . . . . . . 8  |-  ( ( B  \  A )  i^i  ( A  i^i  B ) )  C_  (
( B  \  A
)  i^i  A )
9 incom 3449 . . . . . . . . 9  |-  ( ( B  \  A )  i^i  A )  =  ( A  i^i  ( B  \  A ) )
10 disjdif 3615 . . . . . . . . 9  |-  ( A  i^i  ( B  \  A ) )  =  (/)
119, 10eqtri 2386 . . . . . . . 8  |-  ( ( B  \  A )  i^i  A )  =  (/)
12 sseq0 3574 . . . . . . . 8  |-  ( ( ( ( B  \  A )  i^i  ( A  i^i  B ) ) 
C_  ( ( B 
\  A )  i^i 
A )  /\  (
( B  \  A
)  i^i  A )  =  (/) )  ->  (
( B  \  A
)  i^i  ( A  i^i  B ) )  =  (/) )
138, 11, 12mp2an 653 . . . . . . 7  |-  ( ( B  \  A )  i^i  ( A  i^i  B ) )  =  (/)
1413a1i 10 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( B  \  A )  i^i  ( A  i^i  B ) )  =  (/) )
15 hashun 11543 . . . . . 6  |-  ( ( ( B  \  A
)  e.  Fin  /\  ( A  i^i  B )  e.  Fin  /\  (
( B  \  A
)  i^i  ( A  i^i  B ) )  =  (/) )  ->  ( # `  ( ( B  \  A )  u.  ( A  i^i  B ) ) )  =  ( (
# `  ( B  \  A ) )  +  ( # `  ( A  i^i  B ) ) ) )
162, 6, 14, 15syl3anc 1183 . . . . 5  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  (
( B  \  A
)  u.  ( A  i^i  B ) ) )  =  ( (
# `  ( B  \  A ) )  +  ( # `  ( A  i^i  B ) ) ) )
17 incom 3449 . . . . . . . . 9  |-  ( A  i^i  B )  =  ( B  i^i  A
)
1817uneq2i 3414 . . . . . . . 8  |-  ( ( B  \  A )  u.  ( A  i^i  B ) )  =  ( ( B  \  A
)  u.  ( B  i^i  A ) )
19 uncom 3407 . . . . . . . 8  |-  ( ( B  \  A )  u.  ( B  i^i  A ) )  =  ( ( B  i^i  A
)  u.  ( B 
\  A ) )
20 inundif 3621 . . . . . . . 8  |-  ( ( B  i^i  A )  u.  ( B  \  A ) )  =  B
2118, 19, 203eqtri 2390 . . . . . . 7  |-  ( ( B  \  A )  u.  ( A  i^i  B ) )  =  B
2221a1i 10 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( B  \  A )  u.  ( A  i^i  B ) )  =  B )
2322fveq2d 5636 . . . . 5  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  (
( B  \  A
)  u.  ( A  i^i  B ) ) )  =  ( # `  B ) )
2416, 23eqtr3d 2400 . . . 4  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( # `  ( B  \  A ) )  +  ( # `  ( A  i^i  B ) ) )  =  ( # `  B ) )
25 hashcl 11526 . . . . . . 7  |-  ( B  e.  Fin  ->  ( # `
 B )  e. 
NN0 )
2625adantl 452 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  B
)  e.  NN0 )
2726nn0cnd 10169 . . . . 5  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  B
)  e.  CC )
28 hashcl 11526 . . . . . . 7  |-  ( ( A  i^i  B )  e.  Fin  ->  ( # `
 ( A  i^i  B ) )  e.  NN0 )
296, 28syl 15 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( A  i^i  B ) )  e.  NN0 )
3029nn0cnd 10169 . . . . 5  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( A  i^i  B ) )  e.  CC )
31 hashcl 11526 . . . . . . 7  |-  ( ( B  \  A )  e.  Fin  ->  ( # `
 ( B  \  A ) )  e. 
NN0 )
322, 31syl 15 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( B  \  A ) )  e.  NN0 )
3332nn0cnd 10169 . . . . 5  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( B  \  A ) )  e.  CC )
3427, 30, 33subadd2d 9323 . . . 4  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( ( # `  B )  -  ( # `
 ( A  i^i  B ) ) )  =  ( # `  ( B  \  A ) )  <-> 
( ( # `  ( B  \  A ) )  +  ( # `  ( A  i^i  B ) ) )  =  ( # `  B ) ) )
3524, 34mpbird 223 . . 3  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( # `  B
)  -  ( # `  ( A  i^i  B
) ) )  =  ( # `  ( B  \  A ) ) )
3635oveq2d 5997 . 2  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( # `  A
)  +  ( (
# `  B )  -  ( # `  ( A  i^i  B ) ) ) )  =  ( ( # `  A
)  +  ( # `  ( B  \  A
) ) ) )
37 hashcl 11526 . . . . 5  |-  ( A  e.  Fin  ->  ( # `
 A )  e. 
NN0 )
3837adantr 451 . . . 4  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  A
)  e.  NN0 )
3938nn0cnd 10169 . . 3  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  A
)  e.  CC )
4039, 27, 30addsubassd 9324 . 2  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( ( # `  A )  +  (
# `  B )
)  -  ( # `  ( A  i^i  B
) ) )  =  ( ( # `  A
)  +  ( (
# `  B )  -  ( # `  ( A  i^i  B ) ) ) ) )
41 undif2 3619 . . . 4  |-  ( A  u.  ( B  \  A ) )  =  ( A  u.  B
)
4241fveq2i 5635 . . 3  |-  ( # `  ( A  u.  ( B  \  A ) ) )  =  ( # `  ( A  u.  B
) )
4310a1i 10 . . . 4  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( A  i^i  ( B  \  A ) )  =  (/) )
44 hashun 11543 . . . 4  |-  ( ( A  e.  Fin  /\  ( B  \  A )  e.  Fin  /\  ( A  i^i  ( B  \  A ) )  =  (/) )  ->  ( # `  ( A  u.  ( B  \  A ) ) )  =  ( (
# `  A )  +  ( # `  ( B  \  A ) ) ) )
453, 2, 43, 44syl3anc 1183 . . 3  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( A  u.  ( B  \  A ) ) )  =  ( ( # `  A )  +  (
# `  ( B  \  A ) ) ) )
4642, 45syl5eqr 2412 . 2  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( A  u.  B )
)  =  ( (
# `  A )  +  ( # `  ( B  \  A ) ) ) )
4736, 40, 463eqtr4rd 2409 1  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( A  u.  B )
)  =  ( ( ( # `  A
)  +  ( # `  B ) )  -  ( # `  ( A  i^i  B ) ) ) )
Colors of variables: wff set class
Syntax hints:    -> wi 4    /\ wa 358    = wceq 1647    e. wcel 1715    \ cdif 3235    u. cun 3236    i^i cin 3237    C_ wss 3238   (/)c0 3543   ` cfv 5358  (class class class)co 5981   Fincfn 7006    + caddc 8887    - cmin 9184   NN0cn0 10114   #chash 11505
This theorem is referenced by:  incexclem  12503
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1551  ax-5 1562  ax-17 1621  ax-9 1659  ax-8 1680  ax-13 1717  ax-14 1719  ax-6 1734  ax-7 1739  ax-11 1751  ax-12 1937  ax-ext 2347  ax-rep 4233  ax-sep 4243  ax-nul 4251  ax-pow 4290  ax-pr 4316  ax-un 4615  ax-cnex 8940  ax-resscn 8941  ax-1cn 8942  ax-icn 8943  ax-addcl 8944  ax-addrcl 8945  ax-mulcl 8946  ax-mulrcl 8947  ax-mulcom 8948  ax-addass 8949  ax-mulass 8950  ax-distr 8951  ax-i2m1 8952  ax-1ne0 8953  ax-1rid 8954  ax-rnegex 8955  ax-rrecex 8956  ax-cnre 8957  ax-pre-lttri 8958  ax-pre-lttrn 8959  ax-pre-ltadd 8960  ax-pre-mulgt0 8961
This theorem depends on definitions:  df-bi 177  df-or 359  df-an 360  df-3or 936  df-3an 937  df-tru 1324  df-ex 1547  df-nf 1550  df-sb 1654  df-eu 2221  df-mo 2222  df-clab 2353  df-cleq 2359  df-clel 2362  df-nfc 2491  df-ne 2531  df-nel 2532  df-ral 2633  df-rex 2634  df-reu 2635  df-rmo 2636  df-rab 2637  df-v 2875  df-sbc 3078  df-csb 3168  df-dif 3241  df-un 3243  df-in 3245  df-ss 3252  df-pss 3254  df-nul 3544  df-if 3655  df-pw 3716  df-sn 3735  df-pr 3736  df-tp 3737  df-op 3738  df-uni 3930  df-int 3965  df-iun 4009  df-br 4126  df-opab 4180  df-mpt 4181  df-tr 4216  df-eprel 4408  df-id 4412  df-po 4417  df-so 4418  df-fr 4455  df-we 4457  df-ord 4498  df-on 4499  df-lim 4500  df-suc 4501  df-om 4760  df-xp 4798  df-rel 4799  df-cnv 4800  df-co 4801  df-dm 4802  df-rn 4803  df-res 4804  df-ima 4805  df-iota 5322  df-fun 5360  df-fn 5361  df-f 5362  df-f1 5363  df-fo 5364  df-f1o 5365  df-fv 5366  df-ov 5984  df-oprab 5985  df-mpt2 5986  df-riota 6446  df-recs 6530  df-rdg 6565  df-1o 6621  df-oadd 6625  df-er 6802  df-en 7007  df-dom 7008  df-sdom 7009  df-fin 7010  df-card 7719  df-cda 7941  df-pnf 9016  df-mnf 9017  df-xr 9018  df-ltxr 9019  df-le 9020  df-sub 9186  df-neg 9187  df-nn 9894  df-n0 10115  df-z 10176  df-uz 10382  df-hash 11506
  Copyright terms: Public domain W3C validator