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

Theorem modexp 11995
Description: Exponentiation property of the modulo operation. (Contributed by Mario Carneiro, 28-Feb-2014.)
Assertion
Ref Expression
modexp  |-  ( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  ( C  e. 
NN0  /\  D  e.  RR+ )  /\  ( A  mod  D )  =  ( B  mod  D
) )  ->  (
( A ^ C
)  mod  D )  =  ( ( B ^ C )  mod 
D ) )

Proof of Theorem modexp
Dummy variables  x  k are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 simp2l 1009 . 2  |-  ( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  ( C  e. 
NN0  /\  D  e.  RR+ )  /\  ( A  mod  D )  =  ( B  mod  D
) )  ->  C  e.  NN0 )
2 id 22 . . 3  |-  ( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D
)  =  ( B  mod  D ) )  ->  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) ) )
323adant2l 1207 . 2  |-  ( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  ( C  e. 
NN0  /\  D  e.  RR+ )  /\  ( A  mod  D )  =  ( B  mod  D
) )  ->  (
( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D
)  =  ( B  mod  D ) ) )
4 oveq2 6098 . . . . . 6  |-  ( x  =  0  ->  ( A ^ x )  =  ( A ^ 0 ) )
54oveq1d 6105 . . . . 5  |-  ( x  =  0  ->  (
( A ^ x
)  mod  D )  =  ( ( A ^ 0 )  mod 
D ) )
6 oveq2 6098 . . . . . 6  |-  ( x  =  0  ->  ( B ^ x )  =  ( B ^ 0 ) )
76oveq1d 6105 . . . . 5  |-  ( x  =  0  ->  (
( B ^ x
)  mod  D )  =  ( ( B ^ 0 )  mod 
D ) )
85, 7eqeq12d 2455 . . . 4  |-  ( x  =  0  ->  (
( ( A ^
x )  mod  D
)  =  ( ( B ^ x )  mod  D )  <->  ( ( A ^ 0 )  mod 
D )  =  ( ( B ^ 0 )  mod  D ) ) )
98imbi2d 316 . . 3  |-  ( x  =  0  ->  (
( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  ->  (
( A ^ x
)  mod  D )  =  ( ( B ^ x )  mod 
D ) )  <->  ( (
( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D
)  =  ( B  mod  D ) )  ->  ( ( A ^ 0 )  mod 
D )  =  ( ( B ^ 0 )  mod  D ) ) ) )
10 oveq2 6098 . . . . . 6  |-  ( x  =  k  ->  ( A ^ x )  =  ( A ^ k
) )
1110oveq1d 6105 . . . . 5  |-  ( x  =  k  ->  (
( A ^ x
)  mod  D )  =  ( ( A ^ k )  mod 
D ) )
12 oveq2 6098 . . . . . 6  |-  ( x  =  k  ->  ( B ^ x )  =  ( B ^ k
) )
1312oveq1d 6105 . . . . 5  |-  ( x  =  k  ->  (
( B ^ x
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )
1411, 13eqeq12d 2455 . . . 4  |-  ( x  =  k  ->  (
( ( A ^
x )  mod  D
)  =  ( ( B ^ x )  mod  D )  <->  ( ( A ^ k )  mod 
D )  =  ( ( B ^ k
)  mod  D )
) )
1514imbi2d 316 . . 3  |-  ( x  =  k  ->  (
( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  ->  (
( A ^ x
)  mod  D )  =  ( ( B ^ x )  mod 
D ) )  <->  ( (
( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D
)  =  ( B  mod  D ) )  ->  ( ( A ^ k )  mod 
D )  =  ( ( B ^ k
)  mod  D )
) ) )
16 oveq2 6098 . . . . . 6  |-  ( x  =  ( k  +  1 )  ->  ( A ^ x )  =  ( A ^ (
k  +  1 ) ) )
1716oveq1d 6105 . . . . 5  |-  ( x  =  ( k  +  1 )  ->  (
( A ^ x
)  mod  D )  =  ( ( A ^ ( k  +  1 ) )  mod 
D ) )
18 oveq2 6098 . . . . . 6  |-  ( x  =  ( k  +  1 )  ->  ( B ^ x )  =  ( B ^ (
k  +  1 ) ) )
1918oveq1d 6105 . . . . 5  |-  ( x  =  ( k  +  1 )  ->  (
( B ^ x
)  mod  D )  =  ( ( B ^ ( k  +  1 ) )  mod 
D ) )
2017, 19eqeq12d 2455 . . . 4  |-  ( x  =  ( k  +  1 )  ->  (
( ( A ^
x )  mod  D
)  =  ( ( B ^ x )  mod  D )  <->  ( ( A ^ ( k  +  1 ) )  mod 
D )  =  ( ( B ^ (
k  +  1 ) )  mod  D ) ) )
2120imbi2d 316 . . 3  |-  ( x  =  ( k  +  1 )  ->  (
( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  ->  (
( A ^ x
)  mod  D )  =  ( ( B ^ x )  mod 
D ) )  <->  ( (
( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D
)  =  ( B  mod  D ) )  ->  ( ( A ^ ( k  +  1 ) )  mod 
D )  =  ( ( B ^ (
k  +  1 ) )  mod  D ) ) ) )
22 oveq2 6098 . . . . . 6  |-  ( x  =  C  ->  ( A ^ x )  =  ( A ^ C
) )
2322oveq1d 6105 . . . . 5  |-  ( x  =  C  ->  (
( A ^ x
)  mod  D )  =  ( ( A ^ C )  mod 
D ) )
24 oveq2 6098 . . . . . 6  |-  ( x  =  C  ->  ( B ^ x )  =  ( B ^ C
) )
2524oveq1d 6105 . . . . 5  |-  ( x  =  C  ->  (
( B ^ x
)  mod  D )  =  ( ( B ^ C )  mod 
D ) )
2623, 25eqeq12d 2455 . . . 4  |-  ( x  =  C  ->  (
( ( A ^
x )  mod  D
)  =  ( ( B ^ x )  mod  D )  <->  ( ( A ^ C )  mod 
D )  =  ( ( B ^ C
)  mod  D )
) )
2726imbi2d 316 . . 3  |-  ( x  =  C  ->  (
( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  ->  (
( A ^ x
)  mod  D )  =  ( ( B ^ x )  mod 
D ) )  <->  ( (
( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D
)  =  ( B  mod  D ) )  ->  ( ( A ^ C )  mod 
D )  =  ( ( B ^ C
)  mod  D )
) ) )
28 zcn 10647 . . . . . . 7  |-  ( A  e.  ZZ  ->  A  e.  CC )
29 exp0 11865 . . . . . . 7  |-  ( A  e.  CC  ->  ( A ^ 0 )  =  1 )
3028, 29syl 16 . . . . . 6  |-  ( A  e.  ZZ  ->  ( A ^ 0 )  =  1 )
31 zcn 10647 . . . . . . . 8  |-  ( B  e.  ZZ  ->  B  e.  CC )
32 exp0 11865 . . . . . . . 8  |-  ( B  e.  CC  ->  ( B ^ 0 )  =  1 )
3331, 32syl 16 . . . . . . 7  |-  ( B  e.  ZZ  ->  ( B ^ 0 )  =  1 )
3433eqcomd 2446 . . . . . 6  |-  ( B  e.  ZZ  ->  1  =  ( B ^
0 ) )
3530, 34sylan9eq 2493 . . . . 5  |-  ( ( A  e.  ZZ  /\  B  e.  ZZ )  ->  ( A ^ 0 )  =  ( B ^ 0 ) )
3635oveq1d 6105 . . . 4  |-  ( ( A  e.  ZZ  /\  B  e.  ZZ )  ->  ( ( A ^
0 )  mod  D
)  =  ( ( B ^ 0 )  mod  D ) )
37363ad2ant1 1004 . . 3  |-  ( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D
)  =  ( B  mod  D ) )  ->  ( ( A ^ 0 )  mod 
D )  =  ( ( B ^ 0 )  mod  D ) )
38 simp21l 1100 . . . . . . . 8  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  ->  A  e.  ZZ )
39 simp1 983 . . . . . . . 8  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  -> 
k  e.  NN0 )
40 zexpcl 11876 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  k  e.  NN0 )  -> 
( A ^ k
)  e.  ZZ )
4138, 39, 40syl2anc 656 . . . . . . 7  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  -> 
( A ^ k
)  e.  ZZ )
42 simp21r 1101 . . . . . . . 8  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  ->  B  e.  ZZ )
43 zexpcl 11876 . . . . . . . 8  |-  ( ( B  e.  ZZ  /\  k  e.  NN0 )  -> 
( B ^ k
)  e.  ZZ )
4442, 39, 43syl2anc 656 . . . . . . 7  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  -> 
( B ^ k
)  e.  ZZ )
45 simp22 1017 . . . . . . 7  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  ->  D  e.  RR+ )
46 simp3 985 . . . . . . 7  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  -> 
( ( A ^
k )  mod  D
)  =  ( ( B ^ k )  mod  D ) )
47 simp23 1018 . . . . . . 7  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  -> 
( A  mod  D
)  =  ( B  mod  D ) )
4841, 44, 38, 42, 45, 46, 47modmul12d 11749 . . . . . 6  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  -> 
( ( ( A ^ k )  x.  A )  mod  D
)  =  ( ( ( B ^ k
)  x.  B )  mod  D ) )
4938zcnd 10744 . . . . . . . 8  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  ->  A  e.  CC )
50 expp1 11868 . . . . . . . 8  |-  ( ( A  e.  CC  /\  k  e.  NN0 )  -> 
( A ^ (
k  +  1 ) )  =  ( ( A ^ k )  x.  A ) )
5149, 39, 50syl2anc 656 . . . . . . 7  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  -> 
( A ^ (
k  +  1 ) )  =  ( ( A ^ k )  x.  A ) )
5251oveq1d 6105 . . . . . 6  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  -> 
( ( A ^
( k  +  1 ) )  mod  D
)  =  ( ( ( A ^ k
)  x.  A )  mod  D ) )
5342zcnd 10744 . . . . . . . 8  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  ->  B  e.  CC )
54 expp1 11868 . . . . . . . 8  |-  ( ( B  e.  CC  /\  k  e.  NN0 )  -> 
( B ^ (
k  +  1 ) )  =  ( ( B ^ k )  x.  B ) )
5553, 39, 54syl2anc 656 . . . . . . 7  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  -> 
( B ^ (
k  +  1 ) )  =  ( ( B ^ k )  x.  B ) )
5655oveq1d 6105 . . . . . 6  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  -> 
( ( B ^
( k  +  1 ) )  mod  D
)  =  ( ( ( B ^ k
)  x.  B )  mod  D ) )
5748, 52, 563eqtr4d 2483 . . . . 5  |-  ( ( k  e.  NN0  /\  ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  /\  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  -> 
( ( A ^
( k  +  1 ) )  mod  D
)  =  ( ( B ^ ( k  +  1 ) )  mod  D ) )
58573exp 1181 . . . 4  |-  ( k  e.  NN0  ->  ( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D
)  =  ( B  mod  D ) )  ->  ( ( ( A ^ k )  mod  D )  =  ( ( B ^
k )  mod  D
)  ->  ( ( A ^ ( k  +  1 ) )  mod 
D )  =  ( ( B ^ (
k  +  1 ) )  mod  D ) ) ) )
5958a2d 26 . . 3  |-  ( k  e.  NN0  ->  ( ( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  ->  (
( A ^ k
)  mod  D )  =  ( ( B ^ k )  mod 
D ) )  -> 
( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D )  =  ( B  mod  D
) )  ->  (
( A ^ (
k  +  1 ) )  mod  D )  =  ( ( B ^ ( k  +  1 ) )  mod 
D ) ) ) )
609, 15, 21, 27, 37, 59nn0ind 10734 . 2  |-  ( C  e.  NN0  ->  ( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  D  e.  RR+  /\  ( A  mod  D
)  =  ( B  mod  D ) )  ->  ( ( A ^ C )  mod 
D )  =  ( ( B ^ C
)  mod  D )
) )
611, 3, 60sylc 60 1  |-  ( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  ( C  e. 
NN0  /\  D  e.  RR+ )  /\  ( A  mod  D )  =  ( B  mod  D
) )  ->  (
( A ^ C
)  mod  D )  =  ( ( B ^ C )  mod 
D ) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    /\ wa 369    /\ w3a 960    = wceq 1364    e. wcel 1761  (class class class)co 6090   CCcc 9276   0cc0 9278   1c1 9279    + caddc 9281    x. cmul 9283   NN0cn0 10575   ZZcz 10642   RR+crp 10987    mod cmo 11704   ^cexp 11861
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1596  ax-4 1607  ax-5 1675  ax-6 1713  ax-7 1733  ax-8 1763  ax-9 1765  ax-10 1780  ax-11 1785  ax-12 1797  ax-13 1948  ax-ext 2422  ax-sep 4410  ax-nul 4418  ax-pow 4467  ax-pr 4528  ax-un 6371  ax-cnex 9334  ax-resscn 9335  ax-1cn 9336  ax-icn 9337  ax-addcl 9338  ax-addrcl 9339  ax-mulcl 9340  ax-mulrcl 9341  ax-mulcom 9342  ax-addass 9343  ax-mulass 9344  ax-distr 9345  ax-i2m1 9346  ax-1ne0 9347  ax-1rid 9348  ax-rnegex 9349  ax-rrecex 9350  ax-cnre 9351  ax-pre-lttri 9352  ax-pre-lttrn 9353  ax-pre-ltadd 9354  ax-pre-mulgt0 9355  ax-pre-sup 9356
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 961  df-3an 962  df-tru 1367  df-ex 1592  df-nf 1595  df-sb 1706  df-eu 2263  df-mo 2264  df-clab 2428  df-cleq 2434  df-clel 2437  df-nfc 2566  df-ne 2606  df-nel 2607  df-ral 2718  df-rex 2719  df-reu 2720  df-rmo 2721  df-rab 2722  df-v 2972  df-sbc 3184  df-csb 3286  df-dif 3328  df-un 3330  df-in 3332  df-ss 3339  df-pss 3341  df-nul 3635  df-if 3789  df-pw 3859  df-sn 3875  df-pr 3877  df-tp 3879  df-op 3881  df-uni 4089  df-iun 4170  df-br 4290  df-opab 4348  df-mpt 4349  df-tr 4383  df-eprel 4628  df-id 4632  df-po 4637  df-so 4638  df-fr 4675  df-we 4677  df-ord 4718  df-on 4719  df-lim 4720  df-suc 4721  df-xp 4842  df-rel 4843  df-cnv 4844  df-co 4845  df-dm 4846  df-rn 4847  df-res 4848  df-ima 4849  df-iota 5378  df-fun 5417  df-fn 5418  df-f 5419  df-f1 5420  df-fo 5421  df-f1o 5422  df-fv 5423  df-riota 6049  df-ov 6093  df-oprab 6094  df-mpt2 6095  df-om 6476  df-2nd 6577  df-recs 6828  df-rdg 6862  df-er 7097  df-en 7307  df-dom 7308  df-sdom 7309  df-sup 7687  df-pnf 9416  df-mnf 9417  df-xr 9418  df-ltxr 9419  df-le 9420  df-sub 9593  df-neg 9594  df-div 9990  df-nn 10319  df-n0 10576  df-z 10643  df-uz 10858  df-rp 10988  df-fl 11638  df-mod 11705  df-seq 11803  df-exp 11862
This theorem is referenced by:  fermltl  13855  odzdvds  13863  lgslem4  22581  lgsmod  22603  lgsne0  22615
  Copyright terms: Public domain W3C validator