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

Theorem hashun3 12562
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 7805 . . . . . . 7  |-  ( B  e.  Fin  ->  ( B  \  A )  e. 
Fin )
21adantl 467 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( B  \  A
)  e.  Fin )
3 simpl 458 . . . . . . 7  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  A  e.  Fin )
4 inss1 3682 . . . . . . 7  |-  ( A  i^i  B )  C_  A
5 ssfi 7794 . . . . . . 7  |-  ( ( A  e.  Fin  /\  ( A  i^i  B ) 
C_  A )  -> 
( A  i^i  B
)  e.  Fin )
63, 4, 5sylancl 666 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( A  i^i  B
)  e.  Fin )
7 sslin 3688 . . . . . . . . 9  |-  ( ( A  i^i  B ) 
C_  A  ->  (
( B  \  A
)  i^i  ( A  i^i  B ) )  C_  ( ( B  \  A )  i^i  A
) )
84, 7ax-mp 5 . . . . . . . 8  |-  ( ( B  \  A )  i^i  ( A  i^i  B ) )  C_  (
( B  \  A
)  i^i  A )
9 incom 3655 . . . . . . . . 9  |-  ( ( B  \  A )  i^i  A )  =  ( A  i^i  ( B  \  A ) )
10 disjdif 3867 . . . . . . . . 9  |-  ( A  i^i  ( B  \  A ) )  =  (/)
119, 10eqtri 2451 . . . . . . . 8  |-  ( ( B  \  A )  i^i  A )  =  (/)
12 sseq0 3794 . . . . . . . 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 676 . . . . . . 7  |-  ( ( B  \  A )  i^i  ( A  i^i  B ) )  =  (/)
1413a1i 11 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( B  \  A )  i^i  ( A  i^i  B ) )  =  (/) )
15 hashun 12560 . . . . . 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 1264 . . . . 5  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  (
( B  \  A
)  u.  ( A  i^i  B ) ) )  =  ( (
# `  ( B  \  A ) )  +  ( # `  ( A  i^i  B ) ) ) )
17 incom 3655 . . . . . . . . 9  |-  ( A  i^i  B )  =  ( B  i^i  A
)
1817uneq2i 3617 . . . . . . . 8  |-  ( ( B  \  A )  u.  ( A  i^i  B ) )  =  ( ( B  \  A
)  u.  ( B  i^i  A ) )
19 uncom 3610 . . . . . . . 8  |-  ( ( B  \  A )  u.  ( B  i^i  A ) )  =  ( ( B  i^i  A
)  u.  ( B 
\  A ) )
20 inundif 3873 . . . . . . . 8  |-  ( ( B  i^i  A )  u.  ( B  \  A ) )  =  B
2118, 19, 203eqtri 2455 . . . . . . 7  |-  ( ( B  \  A )  u.  ( A  i^i  B ) )  =  B
2221a1i 11 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( B  \  A )  u.  ( A  i^i  B ) )  =  B )
2322fveq2d 5881 . . . . 5  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  (
( B  \  A
)  u.  ( A  i^i  B ) ) )  =  ( # `  B ) )
2416, 23eqtr3d 2465 . . . 4  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( # `  ( B  \  A ) )  +  ( # `  ( A  i^i  B ) ) )  =  ( # `  B ) )
25 hashcl 12537 . . . . . . 7  |-  ( B  e.  Fin  ->  ( # `
 B )  e. 
NN0 )
2625adantl 467 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  B
)  e.  NN0 )
2726nn0cnd 10927 . . . . 5  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  B
)  e.  CC )
28 hashcl 12537 . . . . . . 7  |-  ( ( A  i^i  B )  e.  Fin  ->  ( # `
 ( A  i^i  B ) )  e.  NN0 )
296, 28syl 17 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( A  i^i  B ) )  e.  NN0 )
3029nn0cnd 10927 . . . . 5  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( A  i^i  B ) )  e.  CC )
31 hashcl 12537 . . . . . . 7  |-  ( ( B  \  A )  e.  Fin  ->  ( # `
 ( B  \  A ) )  e. 
NN0 )
322, 31syl 17 . . . . . 6  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( B  \  A ) )  e.  NN0 )
3332nn0cnd 10927 . . . . 5  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( B  \  A ) )  e.  CC )
3427, 30, 33subadd2d 10005 . . . 4  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( ( # `  B )  -  ( # `
 ( A  i^i  B ) ) )  =  ( # `  ( B  \  A ) )  <-> 
( ( # `  ( B  \  A ) )  +  ( # `  ( A  i^i  B ) ) )  =  ( # `  B ) ) )
3524, 34mpbird 235 . . 3  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( # `  B
)  -  ( # `  ( A  i^i  B
) ) )  =  ( # `  ( B  \  A ) ) )
3635oveq2d 6317 . 2  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( # `  A
)  +  ( (
# `  B )  -  ( # `  ( A  i^i  B ) ) ) )  =  ( ( # `  A
)  +  ( # `  ( B  \  A
) ) ) )
37 hashcl 12537 . . . . 5  |-  ( A  e.  Fin  ->  ( # `
 A )  e. 
NN0 )
3837adantr 466 . . . 4  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  A
)  e.  NN0 )
3938nn0cnd 10927 . . 3  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  A
)  e.  CC )
4039, 27, 30addsubassd 10006 . 2  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( ( ( # `  A )  +  (
# `  B )
)  -  ( # `  ( A  i^i  B
) ) )  =  ( ( # `  A
)  +  ( (
# `  B )  -  ( # `  ( A  i^i  B ) ) ) ) )
41 undif2 3871 . . . 4  |-  ( A  u.  ( B  \  A ) )  =  ( A  u.  B
)
4241fveq2i 5880 . . 3  |-  ( # `  ( A  u.  ( B  \  A ) ) )  =  ( # `  ( A  u.  B
) )
4310a1i 11 . . . 4  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( A  i^i  ( B  \  A ) )  =  (/) )
44 hashun 12560 . . . 4  |-  ( ( A  e.  Fin  /\  ( B  \  A )  e.  Fin  /\  ( A  i^i  ( B  \  A ) )  =  (/) )  ->  ( # `  ( A  u.  ( B  \  A ) ) )  =  ( (
# `  A )  +  ( # `  ( B  \  A ) ) ) )
453, 2, 43, 44syl3anc 1264 . . 3  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( A  u.  ( B  \  A ) ) )  =  ( ( # `  A )  +  (
# `  ( B  \  A ) ) ) )
4642, 45syl5eqr 2477 . 2  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( A  u.  B )
)  =  ( (
# `  A )  +  ( # `  ( B  \  A ) ) ) )
4736, 40, 463eqtr4rd 2474 1  |-  ( ( A  e.  Fin  /\  B  e.  Fin )  ->  ( # `  ( A  u.  B )
)  =  ( ( ( # `  A
)  +  ( # `  B ) )  -  ( # `  ( A  i^i  B ) ) ) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    /\ wa 370    = wceq 1437    e. wcel 1868    \ cdif 3433    u. cun 3434    i^i cin 3435    C_ wss 3436   (/)c0 3761   ` cfv 5597  (class class class)co 6301   Fincfn 7573    + caddc 9542    - cmin 9860   NN0cn0 10869   #chash 12514
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1665  ax-4 1678  ax-5 1748  ax-6 1794  ax-7 1839  ax-8 1870  ax-9 1872  ax-10 1887  ax-11 1892  ax-12 1905  ax-13 2053  ax-ext 2400  ax-rep 4533  ax-sep 4543  ax-nul 4551  ax-pow 4598  ax-pr 4656  ax-un 6593  ax-cnex 9595  ax-resscn 9596  ax-1cn 9597  ax-icn 9598  ax-addcl 9599  ax-addrcl 9600  ax-mulcl 9601  ax-mulrcl 9602  ax-mulcom 9603  ax-addass 9604  ax-mulass 9605  ax-distr 9606  ax-i2m1 9607  ax-1ne0 9608  ax-1rid 9609  ax-rnegex 9610  ax-rrecex 9611  ax-cnre 9612  ax-pre-lttri 9613  ax-pre-lttrn 9614  ax-pre-ltadd 9615  ax-pre-mulgt0 9616
This theorem depends on definitions:  df-bi 188  df-or 371  df-an 372  df-3or 983  df-3an 984  df-tru 1440  df-ex 1660  df-nf 1664  df-sb 1787  df-eu 2269  df-mo 2270  df-clab 2408  df-cleq 2414  df-clel 2417  df-nfc 2572  df-ne 2620  df-nel 2621  df-ral 2780  df-rex 2781  df-reu 2782  df-rmo 2783  df-rab 2784  df-v 3083  df-sbc 3300  df-csb 3396  df-dif 3439  df-un 3441  df-in 3443  df-ss 3450  df-pss 3452  df-nul 3762  df-if 3910  df-pw 3981  df-sn 3997  df-pr 3999  df-tp 4001  df-op 4003  df-uni 4217  df-int 4253  df-iun 4298  df-br 4421  df-opab 4480  df-mpt 4481  df-tr 4516  df-eprel 4760  df-id 4764  df-po 4770  df-so 4771  df-fr 4808  df-we 4810  df-xp 4855  df-rel 4856  df-cnv 4857  df-co 4858  df-dm 4859  df-rn 4860  df-res 4861  df-ima 4862  df-pred 5395  df-ord 5441  df-on 5442  df-lim 5443  df-suc 5444  df-iota 5561  df-fun 5599  df-fn 5600  df-f 5601  df-f1 5602  df-fo 5603  df-f1o 5604  df-fv 5605  df-riota 6263  df-ov 6304  df-oprab 6305  df-mpt2 6306  df-om 6703  df-wrecs 7032  df-recs 7094  df-rdg 7132  df-1o 7186  df-oadd 7190  df-er 7367  df-en 7574  df-dom 7575  df-sdom 7576  df-fin 7577  df-card 8374  df-cda 8598  df-pnf 9677  df-mnf 9678  df-xr 9679  df-ltxr 9680  df-le 9681  df-sub 9862  df-neg 9863  df-nn 10610  df-n0 10870  df-z 10938  df-uz 11160  df-hash 12515
This theorem is referenced by:  incexclem  13879
  Copyright terms: Public domain W3C validator