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

Theorem moddvds 13563
Description: Two ways to say  A  ==  B (  mod  N
). (Contributed by Mario Carneiro, 18-Feb-2014.)
Assertion
Ref Expression
moddvds  |-  ( ( N  e.  NN  /\  A  e.  ZZ  /\  B  e.  ZZ )  ->  (
( A  mod  N
)  =  ( B  mod  N )  <->  N  ||  ( A  -  B )
) )

Proof of Theorem moddvds
StepHypRef Expression
1 nnrp 11021 . . . . . 6  |-  ( N  e.  NN  ->  N  e.  RR+ )
21adantr 465 . . . . 5  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  N  e.  RR+ )
3 0mod 11760 . . . . 5  |-  ( N  e.  RR+  ->  ( 0  mod  N )  =  0 )
42, 3syl 16 . . . 4  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( 0  mod  N )  =  0 )
54eqeq2d 2454 . . 3  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( (
( A  -  B
)  mod  N )  =  ( 0  mod 
N )  <->  ( ( A  -  B )  mod  N )  =  0 ) )
6 zre 10671 . . . . . . 7  |-  ( A  e.  ZZ  ->  A  e.  RR )
76ad2antrl 727 . . . . . 6  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  A  e.  RR )
8 zre 10671 . . . . . . 7  |-  ( B  e.  ZZ  ->  B  e.  RR )
98ad2antll 728 . . . . . 6  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  B  e.  RR )
109renegcld 9796 . . . . . 6  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  -u B  e.  RR )
11 modadd1 11766 . . . . . . 7  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  ( -u B  e.  RR  /\  N  e.  RR+ )  /\  ( A  mod  N )  =  ( B  mod  N
) )  ->  (
( A  +  -u B )  mod  N
)  =  ( ( B  +  -u B
)  mod  N )
)
12113expia 1189 . . . . . 6  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  ( -u B  e.  RR  /\  N  e.  RR+ ) )  ->  (
( A  mod  N
)  =  ( B  mod  N )  -> 
( ( A  +  -u B )  mod  N
)  =  ( ( B  +  -u B
)  mod  N )
) )
137, 9, 10, 2, 12syl22anc 1219 . . . . 5  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( ( A  mod  N )  =  ( B  mod  N
)  ->  ( ( A  +  -u B )  mod  N )  =  ( ( B  +  -u B )  mod  N
) ) )
147recnd 9433 . . . . . . . 8  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  A  e.  CC )
159recnd 9433 . . . . . . . 8  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  B  e.  CC )
1614, 15negsubd 9746 . . . . . . 7  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( A  +  -u B )  =  ( A  -  B
) )
1716oveq1d 6127 . . . . . 6  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( ( A  +  -u B )  mod  N )  =  ( ( A  -  B )  mod  N
) )
1815negidd 9730 . . . . . . 7  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( B  +  -u B )  =  0 )
1918oveq1d 6127 . . . . . 6  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( ( B  +  -u B )  mod  N )  =  ( 0  mod  N
) )
2017, 19eqeq12d 2457 . . . . 5  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( (
( A  +  -u B )  mod  N
)  =  ( ( B  +  -u B
)  mod  N )  <->  ( ( A  -  B
)  mod  N )  =  ( 0  mod 
N ) ) )
2113, 20sylibd 214 . . . 4  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( ( A  mod  N )  =  ( B  mod  N
)  ->  ( ( A  -  B )  mod  N )  =  ( 0  mod  N ) ) )
227, 9resubcld 9797 . . . . . 6  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( A  -  B )  e.  RR )
23 0red 9408 . . . . . 6  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  0  e.  RR )
24 modadd1 11766 . . . . . . 7  |-  ( ( ( ( A  -  B )  e.  RR  /\  0  e.  RR )  /\  ( B  e.  RR  /\  N  e.  RR+ )  /\  (
( A  -  B
)  mod  N )  =  ( 0  mod 
N ) )  -> 
( ( ( A  -  B )  +  B )  mod  N
)  =  ( ( 0  +  B )  mod  N ) )
25243expia 1189 . . . . . 6  |-  ( ( ( ( A  -  B )  e.  RR  /\  0  e.  RR )  /\  ( B  e.  RR  /\  N  e.  RR+ ) )  ->  (
( ( A  -  B )  mod  N
)  =  ( 0  mod  N )  -> 
( ( ( A  -  B )  +  B )  mod  N
)  =  ( ( 0  +  B )  mod  N ) ) )
2622, 23, 9, 2, 25syl22anc 1219 . . . . 5  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( (
( A  -  B
)  mod  N )  =  ( 0  mod 
N )  ->  (
( ( A  -  B )  +  B
)  mod  N )  =  ( ( 0  +  B )  mod 
N ) ) )
2714, 15npcand 9744 . . . . . . 7  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( ( A  -  B )  +  B )  =  A )
2827oveq1d 6127 . . . . . 6  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( (
( A  -  B
)  +  B )  mod  N )  =  ( A  mod  N
) )
2915addid2d 9591 . . . . . . 7  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( 0  +  B )  =  B )
3029oveq1d 6127 . . . . . 6  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( (
0  +  B )  mod  N )  =  ( B  mod  N
) )
3128, 30eqeq12d 2457 . . . . 5  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( (
( ( A  -  B )  +  B
)  mod  N )  =  ( ( 0  +  B )  mod 
N )  <->  ( A  mod  N )  =  ( B  mod  N ) ) )
3226, 31sylibd 214 . . . 4  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( (
( A  -  B
)  mod  N )  =  ( 0  mod 
N )  ->  ( A  mod  N )  =  ( B  mod  N
) ) )
3321, 32impbid 191 . . 3  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( ( A  mod  N )  =  ( B  mod  N
)  <->  ( ( A  -  B )  mod 
N )  =  ( 0  mod  N ) ) )
34 zsubcl 10708 . . . 4  |-  ( ( A  e.  ZZ  /\  B  e.  ZZ )  ->  ( A  -  B
)  e.  ZZ )
35 dvdsval3 13560 . . . 4  |-  ( ( N  e.  NN  /\  ( A  -  B
)  e.  ZZ )  ->  ( N  ||  ( A  -  B
)  <->  ( ( A  -  B )  mod 
N )  =  0 ) )
3634, 35sylan2 474 . . 3  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( N  ||  ( A  -  B
)  <->  ( ( A  -  B )  mod 
N )  =  0 ) )
375, 33, 363bitr4d 285 . 2  |-  ( ( N  e.  NN  /\  ( A  e.  ZZ  /\  B  e.  ZZ ) )  ->  ( ( A  mod  N )  =  ( B  mod  N
)  <->  N  ||  ( A  -  B ) ) )
38373impb 1183 1  |-  ( ( N  e.  NN  /\  A  e.  ZZ  /\  B  e.  ZZ )  ->  (
( A  mod  N
)  =  ( B  mod  N )  <->  N  ||  ( A  -  B )
) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    <-> wb 184    /\ wa 369    /\ w3a 965    = wceq 1369    e. wcel 1756   class class class wbr 4313  (class class class)co 6112   RRcr 9302   0cc0 9303    + caddc 9306    - cmin 9616   -ucneg 9617   NNcn 10343   ZZcz 10667   RR+crp 11012    mod cmo 11729    || cdivides 13556
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1591  ax-4 1602  ax-5 1670  ax-6 1708  ax-7 1728  ax-8 1758  ax-9 1760  ax-10 1775  ax-11 1780  ax-12 1792  ax-13 1943  ax-ext 2423  ax-sep 4434  ax-nul 4442  ax-pow 4491  ax-pr 4552  ax-un 6393  ax-cnex 9359  ax-resscn 9360  ax-1cn 9361  ax-icn 9362  ax-addcl 9363  ax-addrcl 9364  ax-mulcl 9365  ax-mulrcl 9366  ax-mulcom 9367  ax-addass 9368  ax-mulass 9369  ax-distr 9370  ax-i2m1 9371  ax-1ne0 9372  ax-1rid 9373  ax-rnegex 9374  ax-rrecex 9375  ax-cnre 9376  ax-pre-lttri 9377  ax-pre-lttrn 9378  ax-pre-ltadd 9379  ax-pre-mulgt0 9380  ax-pre-sup 9381
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 966  df-3an 967  df-tru 1372  df-ex 1587  df-nf 1590  df-sb 1701  df-eu 2257  df-mo 2258  df-clab 2430  df-cleq 2436  df-clel 2439  df-nfc 2577  df-ne 2622  df-nel 2623  df-ral 2741  df-rex 2742  df-reu 2743  df-rmo 2744  df-rab 2745  df-v 2995  df-sbc 3208  df-csb 3310  df-dif 3352  df-un 3354  df-in 3356  df-ss 3363  df-pss 3365  df-nul 3659  df-if 3813  df-pw 3883  df-sn 3899  df-pr 3901  df-tp 3903  df-op 3905  df-uni 4113  df-iun 4194  df-br 4314  df-opab 4372  df-mpt 4373  df-tr 4407  df-eprel 4653  df-id 4657  df-po 4662  df-so 4663  df-fr 4700  df-we 4702  df-ord 4743  df-on 4744  df-lim 4745  df-suc 4746  df-xp 4867  df-rel 4868  df-cnv 4869  df-co 4870  df-dm 4871  df-rn 4872  df-res 4873  df-ima 4874  df-iota 5402  df-fun 5441  df-fn 5442  df-f 5443  df-f1 5444  df-fo 5445  df-f1o 5446  df-fv 5447  df-riota 6073  df-ov 6115  df-oprab 6116  df-mpt2 6117  df-om 6498  df-recs 6853  df-rdg 6887  df-er 7122  df-en 7332  df-dom 7333  df-sdom 7334  df-sup 7712  df-pnf 9441  df-mnf 9442  df-xr 9443  df-ltxr 9444  df-le 9445  df-sub 9618  df-neg 9619  df-div 10015  df-nn 10344  df-n0 10601  df-z 10668  df-uz 10883  df-rp 11013  df-fl 11663  df-mod 11730  df-dvds 13557
This theorem is referenced by:  dvdsmod  13611  sadadd3  13678  sadaddlem  13683  crt  13874  eulerthlem2  13878  prmdiv  13881  prmdiveq  13882  odzcllem  13885  odzdvds  13888  odzphi  13889  modprm1div  13890  pockthlem  13987  4sqlem11  14037  4sqlem12  14038  mndodcong  16066  dfod2  16086  sylow3lem6  16152  znf1o  18006  wilthlem1  22428  wilthlem2  22429  wilthlem3  22430  ppiub  22565  lgslem1  22657  lgsmod  22682  lgsdirprm  22690  lgsqrlem1  22702  lgsqrlem2  22703  lgsqr  22707  lgsdchrval  22708  lgseisenlem2  22711  lgseisenlem3  22712  lgseisenlem4  22713  m1lgs  22723  dvdsabsmod0  29361
  Copyright terms: Public domain W3C validator