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

Theorem modaddmodup 9943
Description: The sum of an integer modulo a positive integer and another integer minus the positive integer equals the sum of the two integers modulo the positive integer if the other integer is in the upper part of the range between 0 and the positive integer. (Contributed by AV, 30-Oct-2018.)
Assertion
Ref Expression
modaddmodup  |-  ( ( A  e.  ZZ  /\  M  e.  NN )  ->  ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  ->  (
( B  +  ( A  mod  M ) )  -  M )  =  ( ( B  +  A )  mod 
M ) ) )

Proof of Theorem modaddmodup
StepHypRef Expression
1 elfzoelz 9707 . . . . . . 7  |-  ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  ->  B  e.  ZZ )
21adantr 271 . . . . . 6  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  ->  B  e.  ZZ )
3 zmodcl 9900 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  M  e.  NN )  ->  ( A  mod  M
)  e.  NN0 )
43adantl 272 . . . . . . 7  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( A  mod  M
)  e.  NN0 )
54nn0zd 8965 . . . . . 6  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( A  mod  M
)  e.  ZZ )
62, 5zaddcld 8971 . . . . 5  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( B  +  ( A  mod  M ) )  e.  ZZ )
7 zq 9210 . . . . 5  |-  ( ( B  +  ( A  mod  M ) )  e.  ZZ  ->  ( B  +  ( A  mod  M ) )  e.  QQ )
86, 7syl 14 . . . 4  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( B  +  ( A  mod  M ) )  e.  QQ )
9 simprr 500 . . . . 5  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  ->  M  e.  NN )
10 nnq 9217 . . . . 5  |-  ( M  e.  NN  ->  M  e.  QQ )
119, 10syl 14 . . . 4  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  ->  M  e.  QQ )
129nngt0d 8564 . . . 4  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
0  <  M )
13 elfzole1 9715 . . . . . 6  |-  ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  ->  ( M  -  ( A  mod  M ) )  <_  B )
1413adantr 271 . . . . 5  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( M  -  ( A  mod  M ) )  <_  B )
159nnred 8533 . . . . . 6  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  ->  M  e.  RR )
163nn0red 8825 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  M  e.  NN )  ->  ( A  mod  M
)  e.  RR )
1716adantl 272 . . . . . 6  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( A  mod  M
)  e.  RR )
181zred 8967 . . . . . . 7  |-  ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  ->  B  e.  RR )
1918adantr 271 . . . . . 6  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  ->  B  e.  RR )
2015, 17, 19lesubaddd 8116 . . . . 5  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( ( M  -  ( A  mod  M ) )  <_  B  <->  M  <_  ( B  +  ( A  mod  M ) ) ) )
2114, 20mpbid 146 . . . 4  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  ->  M  <_  ( B  +  ( A  mod  M ) ) )
22 elfzolt2 9716 . . . . . . 7  |-  ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  ->  B  <  M
)
2322adantr 271 . . . . . 6  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  ->  B  <  M )
24 zq 9210 . . . . . . . 8  |-  ( A  e.  ZZ  ->  A  e.  QQ )
2524ad2antrl 475 . . . . . . 7  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  ->  A  e.  QQ )
26 modqlt 9889 . . . . . . 7  |-  ( ( A  e.  QQ  /\  M  e.  QQ  /\  0  <  M )  ->  ( A  mod  M )  < 
M )
2725, 11, 12, 26syl3anc 1181 . . . . . 6  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( A  mod  M
)  <  M )
2819, 17, 15, 15, 23, 27lt2addd 8141 . . . . 5  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( B  +  ( A  mod  M ) )  <  ( M  +  M ) )
299nncnd 8534 . . . . . 6  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  ->  M  e.  CC )
30292timesd 8756 . . . . 5  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( 2  x.  M
)  =  ( M  +  M ) )
3128, 30breqtrrd 3893 . . . 4  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( B  +  ( A  mod  M ) )  <  ( 2  x.  M ) )
32 q2submod 9941 . . . 4  |-  ( ( ( ( B  +  ( A  mod  M ) )  e.  QQ  /\  M  e.  QQ  /\  0  <  M )  /\  ( M  <_  ( B  +  ( A  mod  M ) )  /\  ( B  +  ( A  mod  M ) )  <  (
2  x.  M ) ) )  ->  (
( B  +  ( A  mod  M ) )  mod  M )  =  ( ( B  +  ( A  mod  M ) )  -  M
) )
338, 11, 12, 21, 31, 32syl32anc 1189 . . 3  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( ( B  +  ( A  mod  M ) )  mod  M )  =  ( ( B  +  ( A  mod  M ) )  -  M
) )
34 zq 9210 . . . . 5  |-  ( B  e.  ZZ  ->  B  e.  QQ )
352, 34syl 14 . . . 4  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  ->  B  e.  QQ )
36 modqadd2mod 9930 . . . 4  |-  ( ( ( A  e.  QQ  /\  B  e.  QQ )  /\  ( M  e.  QQ  /\  0  < 
M ) )  -> 
( ( B  +  ( A  mod  M ) )  mod  M )  =  ( ( B  +  A )  mod 
M ) )
3725, 35, 11, 12, 36syl22anc 1182 . . 3  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( ( B  +  ( A  mod  M ) )  mod  M )  =  ( ( B  +  A )  mod 
M ) )
3833, 37eqtr3d 2129 . 2  |-  ( ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  /\  ( A  e.  ZZ  /\  M  e.  NN ) )  -> 
( ( B  +  ( A  mod  M ) )  -  M )  =  ( ( B  +  A )  mod 
M ) )
3938expcom 115 1  |-  ( ( A  e.  ZZ  /\  M  e.  NN )  ->  ( B  e.  ( ( M  -  ( A  mod  M ) )..^ M )  ->  (
( B  +  ( A  mod  M ) )  -  M )  =  ( ( B  +  A )  mod 
M ) ) )
Colors of variables: wff set class
Syntax hints:    -> wi 4    /\ wa 103    = wceq 1296    e. wcel 1445   class class class wbr 3867  (class class class)co 5690   RRcr 7446   0cc0 7447    + caddc 7450    x. cmul 7452    < clt 7619    <_ cle 7620    - cmin 7750   NNcn 8520   2c2 8571   NN0cn0 8771   ZZcz 8848   QQcq 9203  ..^cfzo 9702    mod cmo 9878
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-mp 7  ax-ia1 105  ax-ia2 106  ax-ia3 107  ax-in1 582  ax-in2 583  ax-io 668  ax-5 1388  ax-7 1389  ax-gen 1390  ax-ie1 1434  ax-ie2 1435  ax-8 1447  ax-10 1448  ax-11 1449  ax-i12 1450  ax-bndl 1451  ax-4 1452  ax-13 1456  ax-14 1457  ax-17 1471  ax-i9 1475  ax-ial 1479  ax-i5r 1480  ax-ext 2077  ax-sep 3978  ax-pow 4030  ax-pr 4060  ax-un 4284  ax-setind 4381  ax-cnex 7533  ax-resscn 7534  ax-1cn 7535  ax-1re 7536  ax-icn 7537  ax-addcl 7538  ax-addrcl 7539  ax-mulcl 7540  ax-mulrcl 7541  ax-addcom 7542  ax-mulcom 7543  ax-addass 7544  ax-mulass 7545  ax-distr 7546  ax-i2m1 7547  ax-0lt1 7548  ax-1rid 7549  ax-0id 7550  ax-rnegex 7551  ax-precex 7552  ax-cnre 7553  ax-pre-ltirr 7554  ax-pre-ltwlin 7555  ax-pre-lttrn 7556  ax-pre-apti 7557  ax-pre-ltadd 7558  ax-pre-mulgt0 7559  ax-pre-mulext 7560  ax-arch 7561
This theorem depends on definitions:  df-bi 116  df-3or 928  df-3an 929  df-tru 1299  df-fal 1302  df-nf 1402  df-sb 1700  df-eu 1958  df-mo 1959  df-clab 2082  df-cleq 2088  df-clel 2091  df-nfc 2224  df-ne 2263  df-nel 2358  df-ral 2375  df-rex 2376  df-reu 2377  df-rmo 2378  df-rab 2379  df-v 2635  df-sbc 2855  df-csb 2948  df-dif 3015  df-un 3017  df-in 3019  df-ss 3026  df-pw 3451  df-sn 3472  df-pr 3473  df-op 3475  df-uni 3676  df-int 3711  df-iun 3754  df-br 3868  df-opab 3922  df-mpt 3923  df-id 4144  df-po 4147  df-iso 4148  df-xp 4473  df-rel 4474  df-cnv 4475  df-co 4476  df-dm 4477  df-rn 4478  df-res 4479  df-ima 4480  df-iota 5014  df-fun 5051  df-fn 5052  df-f 5053  df-fv 5057  df-riota 5646  df-ov 5693  df-oprab 5694  df-mpt2 5695  df-1st 5949  df-2nd 5950  df-pnf 7621  df-mnf 7622  df-xr 7623  df-ltxr 7624  df-le 7625  df-sub 7752  df-neg 7753  df-reap 8149  df-ap 8156  df-div 8237  df-inn 8521  df-2 8579  df-n0 8772  df-z 8849  df-uz 9119  df-q 9204  df-rp 9234  df-fz 9574  df-fzo 9703  df-fl 9826  df-mod 9879
This theorem is referenced by: (None)
  Copyright terms: Public domain W3C validator