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

Theorem cshwmodn 12882
Description: Cyclically shifting a word is invariant regarding modulo the word's length. (Contributed by AV, 26-Oct-2018.)
Assertion
Ref Expression
cshwmodn  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( W cyclShift  N )  =  ( W cyclShift  ( N  mod  ( # `  W
) ) ) )

Proof of Theorem cshwmodn
StepHypRef Expression
1 0csh0 12880 . . . 4  |-  ( (/) cyclShift  N
)  =  (/)
2 oveq1 6312 . . . 4  |-  ( W  =  (/)  ->  ( W cyclShift  N )  =  (
(/) cyclShift  N ) )
3 oveq1 6312 . . . . 5  |-  ( W  =  (/)  ->  ( W cyclShift  ( N  mod  ( # `  W ) ) )  =  ( (/) cyclShift  ( N  mod  ( # `  W
) ) ) )
4 0csh0 12880 . . . . 5  |-  ( (/) cyclShift  ( N  mod  ( # `  W ) ) )  =  (/)
53, 4syl6eq 2486 . . . 4  |-  ( W  =  (/)  ->  ( W cyclShift  ( N  mod  ( # `  W ) ) )  =  (/) )
61, 2, 53eqtr4a 2496 . . 3  |-  ( W  =  (/)  ->  ( W cyclShift  N )  =  ( W cyclShift  ( N  mod  ( # `
 W ) ) ) )
76a1d 26 . 2  |-  ( W  =  (/)  ->  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( W cyclShift  N )  =  ( W cyclShift  ( N  mod  ( # `  W
) ) ) ) )
8 lennncl 12675 . . . . . . 7  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( # `
 W )  e.  NN )
9 zre 10941 . . . . . . . . . . . 12  |-  ( N  e.  ZZ  ->  N  e.  RR )
10 nnrp 11311 . . . . . . . . . . . 12  |-  ( (
# `  W )  e.  NN  ->  ( # `  W
)  e.  RR+ )
11 modabs2 12128 . . . . . . . . . . . 12  |-  ( ( N  e.  RR  /\  ( # `  W )  e.  RR+ )  ->  (
( N  mod  ( # `
 W ) )  mod  ( # `  W
) )  =  ( N  mod  ( # `  W ) ) )
129, 10, 11syl2anr 480 . . . . . . . . . . 11  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( ( N  mod  ( # `  W ) )  mod  ( # `  W ) )  =  ( N  mod  ( # `
 W ) ) )
1312opeq1d 4196 . . . . . . . . . 10  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  -> 
<. ( ( N  mod  ( # `  W ) )  mod  ( # `  W ) ) ,  ( # `  W
) >.  =  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. )
1413oveq2d 6321 . . . . . . . . 9  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( W substr  <. (
( N  mod  ( # `
 W ) )  mod  ( # `  W
) ) ,  (
# `  W ) >. )  =  ( W substr  <. ( N  mod  ( # `
 W ) ) ,  ( # `  W
) >. ) )
1512opeq2d 4197 . . . . . . . . . 10  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  -> 
<. 0 ,  ( ( N  mod  ( # `
 W ) )  mod  ( # `  W
) ) >.  =  <. 0 ,  ( N  mod  ( # `  W
) ) >. )
1615oveq2d 6321 . . . . . . . . 9  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( W substr  <. 0 ,  ( ( N  mod  ( # `  W
) )  mod  ( # `
 W ) )
>. )  =  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >.
) )
1714, 16oveq12d 6323 . . . . . . . 8  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( ( W substr  <. (
( N  mod  ( # `
 W ) )  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( ( N  mod  ( # `  W
) )  mod  ( # `
 W ) )
>. ) )  =  ( ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) )
1817ex 435 . . . . . . 7  |-  ( (
# `  W )  e.  NN  ->  ( N  e.  ZZ  ->  ( ( W substr  <. ( ( N  mod  ( # `  W
) )  mod  ( # `
 W ) ) ,  ( # `  W
) >. ) ++  ( W substr  <. 0 ,  ( ( N  mod  ( # `  W ) )  mod  ( # `  W
) ) >. )
)  =  ( ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `
 W ) )
>. ) ) ) )
198, 18syl 17 . . . . . 6  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( N  e.  ZZ  ->  ( ( W substr  <. (
( N  mod  ( # `
 W ) )  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( ( N  mod  ( # `  W
) )  mod  ( # `
 W ) )
>. ) )  =  ( ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) ) )
2019impancom 441 . . . . 5  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( W  =/=  (/)  ->  (
( W substr  <. ( ( N  mod  ( # `  W ) )  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( ( N  mod  ( # `  W
) )  mod  ( # `
 W ) )
>. ) )  =  ( ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) ) )
2120impcom 431 . . . 4  |-  ( ( W  =/=  (/)  /\  ( W  e. Word  V  /\  N  e.  ZZ ) )  -> 
( ( W substr  <. (
( N  mod  ( # `
 W ) )  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( ( N  mod  ( # `  W
) )  mod  ( # `
 W ) )
>. ) )  =  ( ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) )
22 simprl 762 . . . . 5  |-  ( ( W  =/=  (/)  /\  ( W  e. Word  V  /\  N  e.  ZZ ) )  ->  W  e. Word  V )
23 simprr 764 . . . . . . 7  |-  ( ( W  =/=  (/)  /\  ( W  e. Word  V  /\  N  e.  ZZ ) )  ->  N  e.  ZZ )
248ex 435 . . . . . . . . 9  |-  ( W  e. Word  V  ->  ( W  =/=  (/)  ->  ( # `  W
)  e.  NN ) )
2524adantr 466 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( W  =/=  (/)  ->  ( # `
 W )  e.  NN ) )
2625impcom 431 . . . . . . 7  |-  ( ( W  =/=  (/)  /\  ( W  e. Word  V  /\  N  e.  ZZ ) )  -> 
( # `  W )  e.  NN )
2723, 26zmodcld 12114 . . . . . 6  |-  ( ( W  =/=  (/)  /\  ( W  e. Word  V  /\  N  e.  ZZ ) )  -> 
( N  mod  ( # `
 W ) )  e.  NN0 )
2827nn0zd 11038 . . . . 5  |-  ( ( W  =/=  (/)  /\  ( W  e. Word  V  /\  N  e.  ZZ ) )  -> 
( N  mod  ( # `
 W ) )  e.  ZZ )
29 cshword 12878 . . . . 5  |-  ( ( W  e. Word  V  /\  ( N  mod  ( # `  W ) )  e.  ZZ )  ->  ( W cyclShift  ( N  mod  ( # `
 W ) ) )  =  ( ( W substr  <. ( ( N  mod  ( # `  W
) )  mod  ( # `
 W ) ) ,  ( # `  W
) >. ) ++  ( W substr  <. 0 ,  ( ( N  mod  ( # `  W ) )  mod  ( # `  W
) ) >. )
) )
3022, 28, 29syl2anc 665 . . . 4  |-  ( ( W  =/=  (/)  /\  ( W  e. Word  V  /\  N  e.  ZZ ) )  -> 
( W cyclShift  ( N  mod  ( # `  W ) ) )  =  ( ( W substr  <. (
( N  mod  ( # `
 W ) )  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( ( N  mod  ( # `  W
) )  mod  ( # `
 W ) )
>. ) ) )
31 cshword 12878 . . . . 5  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( W cyclShift  N )  =  ( ( W substr  <. ( N  mod  ( # `
 W ) ) ,  ( # `  W
) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W
) ) >. )
) )
3231adantl 467 . . . 4  |-  ( ( W  =/=  (/)  /\  ( W  e. Word  V  /\  N  e.  ZZ ) )  -> 
( W cyclShift  N )  =  ( ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) )
3321, 30, 323eqtr4rd 2481 . . 3  |-  ( ( W  =/=  (/)  /\  ( W  e. Word  V  /\  N  e.  ZZ ) )  -> 
( W cyclShift  N )  =  ( W cyclShift  ( N  mod  ( # `  W
) ) ) )
3433ex 435 . 2  |-  ( W  =/=  (/)  ->  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( W cyclShift  N )  =  ( W cyclShift  ( N  mod  ( # `
 W ) ) ) ) )
357, 34pm2.61ine 2744 1  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( W cyclShift  N )  =  ( W cyclShift  ( N  mod  ( # `  W
) ) ) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    /\ wa 370    = wceq 1437    e. wcel 1870    =/= wne 2625   (/)c0 3767   <.cop 4008   ` cfv 5601  (class class class)co 6305   RRcr 9537   0cc0 9538   NNcn 10609   ZZcz 10937   RR+crp 11302    mod cmo 12093   #chash 12512  Word cword 12643   ++ cconcat 12645   substr csubstr 12647   cyclShift ccsh 12875
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 1751  ax-6 1797  ax-7 1841  ax-8 1872  ax-9 1874  ax-10 1889  ax-11 1894  ax-12 1907  ax-13 2055  ax-ext 2407  ax-rep 4538  ax-sep 4548  ax-nul 4556  ax-pow 4603  ax-pr 4661  ax-un 6597  ax-cnex 9594  ax-resscn 9595  ax-1cn 9596  ax-icn 9597  ax-addcl 9598  ax-addrcl 9599  ax-mulcl 9600  ax-mulrcl 9601  ax-mulcom 9602  ax-addass 9603  ax-mulass 9604  ax-distr 9605  ax-i2m1 9606  ax-1ne0 9607  ax-1rid 9608  ax-rnegex 9609  ax-rrecex 9610  ax-cnre 9611  ax-pre-lttri 9612  ax-pre-lttrn 9613  ax-pre-ltadd 9614  ax-pre-mulgt0 9615  ax-pre-sup 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 1790  df-eu 2270  df-mo 2271  df-clab 2415  df-cleq 2421  df-clel 2424  df-nfc 2579  df-ne 2627  df-nel 2628  df-ral 2787  df-rex 2788  df-reu 2789  df-rmo 2790  df-rab 2791  df-v 3089  df-sbc 3306  df-csb 3402  df-dif 3445  df-un 3447  df-in 3449  df-ss 3456  df-pss 3458  df-nul 3768  df-if 3916  df-pw 3987  df-sn 4003  df-pr 4005  df-tp 4007  df-op 4009  df-uni 4223  df-int 4259  df-iun 4304  df-br 4427  df-opab 4485  df-mpt 4486  df-tr 4521  df-eprel 4765  df-id 4769  df-po 4775  df-so 4776  df-fr 4813  df-we 4815  df-xp 4860  df-rel 4861  df-cnv 4862  df-co 4863  df-dm 4864  df-rn 4865  df-res 4866  df-ima 4867  df-pred 5399  df-ord 5445  df-on 5446  df-lim 5447  df-suc 5448  df-iota 5565  df-fun 5603  df-fn 5604  df-f 5605  df-f1 5606  df-fo 5607  df-f1o 5608  df-fv 5609  df-riota 6267  df-ov 6308  df-oprab 6309  df-mpt2 6310  df-om 6707  df-1st 6807  df-2nd 6808  df-wrecs 7036  df-recs 7098  df-rdg 7136  df-1o 7190  df-oadd 7194  df-er 7371  df-en 7578  df-dom 7579  df-sdom 7580  df-fin 7581  df-sup 7962  df-card 8372  df-cda 8596  df-pnf 9676  df-mnf 9677  df-xr 9678  df-ltxr 9679  df-le 9680  df-sub 9861  df-neg 9862  df-div 10269  df-nn 10610  df-2 10668  df-n0 10870  df-z 10938  df-uz 11160  df-rp 11303  df-fz 11783  df-fzo 11914  df-fl 12025  df-mod 12094  df-hash 12513  df-word 12651  df-concat 12653  df-substr 12655  df-csh 12876
This theorem is referenced by:  cshwsublen  12883  cshwn  12884
  Copyright terms: Public domain W3C validator