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

Theorem cshwlen 12681
Description: The length of a cyclically shifted word is the same as the length of the original word. (Contributed by AV, 16-May-2018.) (Revised by AV, 20-May-2018.) (Revised by AV, 27-Oct-2018.)
Assertion
Ref Expression
cshwlen  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `  ( W cyclShift  N ) )  =  ( # `  W
) )

Proof of Theorem cshwlen
StepHypRef Expression
1 oveq1 6203 . . . . 5  |-  ( W  =  (/)  ->  ( W cyclShift  N )  =  (
(/) cyclShift  N ) )
2 0csh0 12675 . . . . . 6  |-  ( (/) cyclShift  N
)  =  (/)
32a1i 11 . . . . 5  |-  ( W  =  (/)  ->  ( (/) cyclShift  N
)  =  (/) )
4 eqcom 2391 . . . . . 6  |-  ( W  =  (/)  <->  (/)  =  W )
54biimpi 194 . . . . 5  |-  ( W  =  (/)  ->  (/)  =  W )
61, 3, 53eqtrd 2427 . . . 4  |-  ( W  =  (/)  ->  ( W cyclShift  N )  =  W )
76fveq2d 5778 . . 3  |-  ( W  =  (/)  ->  ( # `  ( W cyclShift  N )
)  =  ( # `  W ) )
87a1d 25 . 2  |-  ( W  =  (/)  ->  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `  ( W cyclShift  N ) )  =  ( # `  W
) ) )
9 cshword 12673 . . . . . 6  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( W cyclShift  N )  =  ( ( W substr  <. ( N  mod  ( # `
 W ) ) ,  ( # `  W
) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W
) ) >. )
) )
109fveq2d 5778 . . . . 5  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `  ( W cyclShift  N ) )  =  ( # `  (
( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) ) )
1110adantr 463 . . . 4  |-  ( ( ( W  e. Word  V  /\  N  e.  ZZ )  /\  W  =/=  (/) )  -> 
( # `  ( W cyclShift  N ) )  =  ( # `  (
( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) ) )
12 swrdcl 12555 . . . . . . 7  |-  ( W  e. Word  V  ->  ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. )  e. Word  V )
13 swrdcl 12555 . . . . . . 7  |-  ( W  e. Word  V  ->  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >.
)  e. Word  V )
14 ccatlen 12503 . . . . . . 7  |-  ( ( ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. )  e. Word  V  /\  ( W substr  <. 0 ,  ( N  mod  ( # `
 W ) )
>. )  e. Word  V )  ->  ( # `  (
( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) )  =  ( ( # `  ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) )  +  (
# `  ( W substr  <.
0 ,  ( N  mod  ( # `  W
) ) >. )
) ) )
1512, 13, 14syl2anc 659 . . . . . 6  |-  ( W  e. Word  V  ->  ( # `
 ( ( W substr  <. ( N  mod  ( # `
 W ) ) ,  ( # `  W
) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W
) ) >. )
) )  =  ( ( # `  ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. )
)  +  ( # `  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) ) )
1615adantr 463 . . . . 5  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `  (
( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) )  =  ( ( # `  ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) )  +  (
# `  ( W substr  <.
0 ,  ( N  mod  ( # `  W
) ) >. )
) ) )
1716adantr 463 . . . 4  |-  ( ( ( W  e. Word  V  /\  N  e.  ZZ )  /\  W  =/=  (/) )  -> 
( # `  ( ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `
 W ) )
>. ) ) )  =  ( ( # `  ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. )
)  +  ( # `  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) ) )
18 lennncl 12470 . . . . . . . . . 10  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( # `
 W )  e.  NN )
19 pm3.21 446 . . . . . . . . . . 11  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( W  e. Word  V  ->  ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
) ) )
2019ex 432 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN  ->  ( N  e.  ZZ  ->  ( W  e. Word  V  ->  ( W  e. Word  V  /\  ( (
# `  W )  e.  NN  /\  N  e.  ZZ ) ) ) ) )
2118, 20syl 16 . . . . . . . . 9  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( N  e.  ZZ  ->  ( W  e. Word  V  -> 
( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
) ) ) )
2221ex 432 . . . . . . . 8  |-  ( W  e. Word  V  ->  ( W  =/=  (/)  ->  ( N  e.  ZZ  ->  ( W  e. Word  V  ->  ( W  e. Word  V  /\  ( (
# `  W )  e.  NN  /\  N  e.  ZZ ) ) ) ) ) )
2322com24 87 . . . . . . 7  |-  ( W  e. Word  V  ->  ( W  e. Word  V  ->  ( N  e.  ZZ  ->  ( W  =/=  (/)  ->  ( W  e. Word  V  /\  (
( # `  W )  e.  NN  /\  N  e.  ZZ ) ) ) ) ) )
2423pm2.43i 47 . . . . . 6  |-  ( W  e. Word  V  ->  ( N  e.  ZZ  ->  ( W  =/=  (/)  ->  ( W  e. Word  V  /\  (
( # `  W )  e.  NN  /\  N  e.  ZZ ) ) ) ) )
2524imp31 430 . . . . 5  |-  ( ( ( W  e. Word  V  /\  N  e.  ZZ )  /\  W  =/=  (/) )  -> 
( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
) )
26 simpl 455 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  W  e. Word  V )
27 pm3.22 447 . . . . . . . . . 10  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( N  e.  ZZ  /\  ( # `  W
)  e.  NN ) )
2827adantl 464 . . . . . . . . 9  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( N  e.  ZZ  /\  ( # `  W )  e.  NN ) )
29 zmodfzp1 11920 . . . . . . . . 9  |-  ( ( N  e.  ZZ  /\  ( # `  W )  e.  NN )  -> 
( N  mod  ( # `
 W ) )  e.  ( 0 ... ( # `  W
) ) )
3028, 29syl 16 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( N  mod  ( # `  W
) )  e.  ( 0 ... ( # `  W ) ) )
31 lencl 12469 . . . . . . . . . 10  |-  ( W  e. Word  V  ->  ( # `
 W )  e. 
NN0 )
32 nn0fz0 11696 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  <->  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )
3331, 32sylib 196 . . . . . . . . 9  |-  ( W  e. Word  V  ->  ( # `
 W )  e.  ( 0 ... ( # `
 W ) ) )
3433adantr 463 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )
35 swrdlen 12559 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( N  mod  ( # `  W ) )  e.  ( 0 ... ( # `
 W ) )  /\  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )  -> 
( # `  ( W substr  <. ( N  mod  ( # `
 W ) ) ,  ( # `  W
) >. ) )  =  ( ( # `  W
)  -  ( N  mod  ( # `  W
) ) ) )
3626, 30, 34, 35syl3anc 1226 . . . . . . 7  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( # `  ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. )
)  =  ( (
# `  W )  -  ( N  mod  ( # `  W ) ) ) )
37 zmodcl 11916 . . . . . . . . . . 11  |-  ( ( N  e.  ZZ  /\  ( # `  W )  e.  NN )  -> 
( N  mod  ( # `
 W ) )  e.  NN0 )
3837ancoms 451 . . . . . . . . . 10  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( N  mod  ( # `
 W ) )  e.  NN0 )
3938adantl 464 . . . . . . . . 9  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( N  mod  ( # `  W
) )  e.  NN0 )
40 0elfz 11695 . . . . . . . . 9  |-  ( ( N  mod  ( # `  W ) )  e. 
NN0  ->  0  e.  ( 0 ... ( N  mod  ( # `  W
) ) ) )
4139, 40syl 16 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  0  e.  ( 0 ... ( N  mod  ( # `  W
) ) ) )
42 swrdlen 12559 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  0  e.  ( 0 ... ( N  mod  ( # `  W ) ) )  /\  ( N  mod  ( # `  W
) )  e.  ( 0 ... ( # `  W ) ) )  ->  ( # `  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >.
) )  =  ( ( N  mod  ( # `
 W ) )  -  0 ) )
4326, 41, 30, 42syl3anc 1226 . . . . . . 7  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( # `  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >.
) )  =  ( ( N  mod  ( # `
 W ) )  -  0 ) )
4436, 43oveq12d 6214 . . . . . 6  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( ( # `
 ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) )  +  (
# `  ( W substr  <.
0 ,  ( N  mod  ( # `  W
) ) >. )
) )  =  ( ( ( # `  W
)  -  ( N  mod  ( # `  W
) ) )  +  ( ( N  mod  ( # `  W ) )  -  0 ) ) )
4537nn0cnd 10771 . . . . . . . . . 10  |-  ( ( N  e.  ZZ  /\  ( # `  W )  e.  NN )  -> 
( N  mod  ( # `
 W ) )  e.  CC )
4645ancoms 451 . . . . . . . . 9  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( N  mod  ( # `
 W ) )  e.  CC )
4746adantl 464 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( N  mod  ( # `  W
) )  e.  CC )
4847subid1d 9833 . . . . . . 7  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( ( N  mod  ( # `  W
) )  -  0 )  =  ( N  mod  ( # `  W
) ) )
4948oveq2d 6212 . . . . . 6  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( (
( # `  W )  -  ( N  mod  ( # `  W ) ) )  +  ( ( N  mod  ( # `
 W ) )  -  0 ) )  =  ( ( (
# `  W )  -  ( N  mod  ( # `  W ) ) )  +  ( N  mod  ( # `  W ) ) ) )
5031nn0cnd 10771 . . . . . . 7  |-  ( W  e. Word  V  ->  ( # `
 W )  e.  CC )
51 npcan 9742 . . . . . . 7  |-  ( ( ( # `  W
)  e.  CC  /\  ( N  mod  ( # `  W ) )  e.  CC )  ->  (
( ( # `  W
)  -  ( N  mod  ( # `  W
) ) )  +  ( N  mod  ( # `
 W ) ) )  =  ( # `  W ) )
5250, 46, 51syl2an 475 . . . . . 6  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( (
( # `  W )  -  ( N  mod  ( # `  W ) ) )  +  ( N  mod  ( # `  W ) ) )  =  ( # `  W
) )
5344, 49, 523eqtrd 2427 . . . . 5  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( ( # `
 ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) )  +  (
# `  ( W substr  <.
0 ,  ( N  mod  ( # `  W
) ) >. )
) )  =  (
# `  W )
)
5425, 53syl 16 . . . 4  |-  ( ( ( W  e. Word  V  /\  N  e.  ZZ )  /\  W  =/=  (/) )  -> 
( ( # `  ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. )
)  +  ( # `  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) )  =  ( # `  W
) )
5511, 17, 543eqtrd 2427 . . 3  |-  ( ( ( W  e. Word  V  /\  N  e.  ZZ )  /\  W  =/=  (/) )  -> 
( # `  ( W cyclShift  N ) )  =  ( # `  W
) )
5655expcom 433 . 2  |-  ( W  =/=  (/)  ->  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `
 ( W cyclShift  N ) )  =  ( # `  W ) ) )
578, 56pm2.61ine 2695 1  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `  ( W cyclShift  N ) )  =  ( # `  W
) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    /\ wa 367    = wceq 1399    e. wcel 1826    =/= wne 2577   (/)c0 3711   <.cop 3950   ` cfv 5496  (class class class)co 6196   CCcc 9401   0cc0 9403    + caddc 9406    - cmin 9718   NNcn 10452   NN0cn0 10712   ZZcz 10781   ...cfz 11593    mod cmo 11896   #chash 12307  Word cword 12438   ++ cconcat 12440   substr csubstr 12442   cyclShift ccsh 12670
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1626  ax-4 1639  ax-5 1712  ax-6 1755  ax-7 1798  ax-8 1828  ax-9 1830  ax-10 1845  ax-11 1850  ax-12 1862  ax-13 2006  ax-ext 2360  ax-rep 4478  ax-sep 4488  ax-nul 4496  ax-pow 4543  ax-pr 4601  ax-un 6491  ax-cnex 9459  ax-resscn 9460  ax-1cn 9461  ax-icn 9462  ax-addcl 9463  ax-addrcl 9464  ax-mulcl 9465  ax-mulrcl 9466  ax-mulcom 9467  ax-addass 9468  ax-mulass 9469  ax-distr 9470  ax-i2m1 9471  ax-1ne0 9472  ax-1rid 9473  ax-rnegex 9474  ax-rrecex 9475  ax-cnre 9476  ax-pre-lttri 9477  ax-pre-lttrn 9478  ax-pre-ltadd 9479  ax-pre-mulgt0 9480  ax-pre-sup 9481
This theorem depends on definitions:  df-bi 185  df-or 368  df-an 369  df-3or 972  df-3an 973  df-tru 1402  df-ex 1621  df-nf 1625  df-sb 1748  df-eu 2222  df-mo 2223  df-clab 2368  df-cleq 2374  df-clel 2377  df-nfc 2532  df-ne 2579  df-nel 2580  df-ral 2737  df-rex 2738  df-reu 2739  df-rmo 2740  df-rab 2741  df-v 3036  df-sbc 3253  df-csb 3349  df-dif 3392  df-un 3394  df-in 3396  df-ss 3403  df-pss 3405  df-nul 3712  df-if 3858  df-pw 3929  df-sn 3945  df-pr 3947  df-tp 3949  df-op 3951  df-uni 4164  df-int 4200  df-iun 4245  df-br 4368  df-opab 4426  df-mpt 4427  df-tr 4461  df-eprel 4705  df-id 4709  df-po 4714  df-so 4715  df-fr 4752  df-we 4754  df-ord 4795  df-on 4796  df-lim 4797  df-suc 4798  df-xp 4919  df-rel 4920  df-cnv 4921  df-co 4922  df-dm 4923  df-rn 4924  df-res 4925  df-ima 4926  df-iota 5460  df-fun 5498  df-fn 5499  df-f 5500  df-f1 5501  df-fo 5502  df-f1o 5503  df-fv 5504  df-riota 6158  df-ov 6199  df-oprab 6200  df-mpt2 6201  df-om 6600  df-1st 6699  df-2nd 6700  df-recs 6960  df-rdg 6994  df-1o 7048  df-oadd 7052  df-er 7229  df-en 7436  df-dom 7437  df-sdom 7438  df-fin 7439  df-sup 7816  df-card 8233  df-cda 8461  df-pnf 9541  df-mnf 9542  df-xr 9543  df-ltxr 9544  df-le 9545  df-sub 9720  df-neg 9721  df-div 10124  df-nn 10453  df-2 10511  df-n0 10713  df-z 10782  df-uz 11002  df-rp 11140  df-fz 11594  df-fzo 11718  df-fl 11828  df-mod 11897  df-hash 12308  df-word 12446  df-concat 12448  df-substr 12450  df-csh 12671
This theorem is referenced by:  cshwf  12682  2cshw  12692  lswcshw  12694  cshwleneq  12696  clwwisshclwwlem  24927  clwwnisshclwwn  24930  erclwwlkeqlen  24933  erclwwlkneqlen  24945
  Copyright terms: Public domain W3C validator