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

Theorem cshwlen 12441
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 6103 . . . . 5  |-  ( W  =  (/)  ->  ( W cyclShift  N )  =  (
(/) cyclShift  N ) )
2 0csh0 12435 . . . . . 6  |-  ( (/) cyclShift  N
)  =  (/)
32a1i 11 . . . . 5  |-  ( W  =  (/)  ->  ( (/) cyclShift  N
)  =  (/) )
4 eqcom 2445 . . . . . 6  |-  ( W  =  (/)  <->  (/)  =  W )
54biimpi 194 . . . . 5  |-  ( W  =  (/)  ->  (/)  =  W )
61, 3, 53eqtrd 2479 . . . 4  |-  ( W  =  (/)  ->  ( W cyclShift  N )  =  W )
76fveq2d 5700 . . 3  |-  ( W  =  (/)  ->  ( # `  ( W cyclShift  N )
)  =  ( # `  W ) )
87a1d 25 . 2  |-  ( W  =  (/)  ->  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `  ( W cyclShift  N ) )  =  ( # `  W
) ) )
9 cshword 12433 . . . . . 6  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( W cyclShift  N )  =  ( ( W substr  <. ( N  mod  ( # `
 W ) ) ,  ( # `  W
) >. ) concat  ( W substr  <.
0 ,  ( N  mod  ( # `  W
) ) >. )
) )
109fveq2d 5700 . . . . 5  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `  ( W cyclShift  N ) )  =  ( # `  (
( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) concat  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) ) )
1110adantr 465 . . . 4  |-  ( ( ( W  e. Word  V  /\  N  e.  ZZ )  /\  W  =/=  (/) )  -> 
( # `  ( W cyclShift  N ) )  =  ( # `  (
( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) concat  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) ) )
12 swrdcl 12320 . . . . . . 7  |-  ( W  e. Word  V  ->  ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. )  e. Word  V )
13 swrdcl 12320 . . . . . . 7  |-  ( W  e. Word  V  ->  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >.
)  e. Word  V )
14 ccatlen 12280 . . . . . . 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 ) >. ) concat  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) )  =  ( ( # `  ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) )  +  (
# `  ( W substr  <.
0 ,  ( N  mod  ( # `  W
) ) >. )
) ) )
1512, 13, 14syl2anc 661 . . . . . 6  |-  ( W  e. Word  V  ->  ( # `
 ( ( W substr  <. ( N  mod  ( # `
 W ) ) ,  ( # `  W
) >. ) concat  ( W substr  <.
0 ,  ( N  mod  ( # `  W
) ) >. )
) )  =  ( ( # `  ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. )
)  +  ( # `  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) ) )
1615adantr 465 . . . . 5  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `  (
( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) concat  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) )  =  ( ( # `  ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) )  +  (
# `  ( W substr  <.
0 ,  ( N  mod  ( # `  W
) ) >. )
) ) )
1716adantr 465 . . . 4  |-  ( ( ( W  e. Word  V  /\  N  e.  ZZ )  /\  W  =/=  (/) )  -> 
( # `  ( ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. ) concat  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >.
) ) )  =  ( ( # `  ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. )
)  +  ( # `  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) ) )
18 lennncl 12255 . . . . . . . . . 10  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( # `
 W )  e.  NN )
19 pm3.21 448 . . . . . . . . . . 11  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( W  e. Word  V  ->  ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
) ) )
2019ex 434 . . . . . . . . . 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 434 . . . . . . . 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 432 . . . . 5  |-  ( ( ( W  e. Word  V  /\  N  e.  ZZ )  /\  W  =/=  (/) )  -> 
( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
) )
26 simpl 457 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  W  e. Word  V )
27 pm3.22 449 . . . . . . . . . 10  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( N  e.  ZZ  /\  ( # `  W
)  e.  NN ) )
2827adantl 466 . . . . . . . . 9  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( N  e.  ZZ  /\  ( # `  W )  e.  NN ) )
29 zmodfzp1 11736 . . . . . . . . 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 12254 . . . . . . . . . 10  |-  ( W  e. Word  V  ->  ( # `
 W )  e. 
NN0 )
32 nn0fz0 11530 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  NN0  <->  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )
3332biimpi 194 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )
3431, 33syl 16 . . . . . . . . 9  |-  ( W  e. Word  V  ->  ( # `
 W )  e.  ( 0 ... ( # `
 W ) ) )
3534adantr 465 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )
36 swrdlen 12324 . . . . . . . 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
) ) ) )
3726, 30, 35, 36syl3anc 1218 . . . . . . 7  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( # `  ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. )
)  =  ( (
# `  W )  -  ( N  mod  ( # `  W ) ) ) )
38 zmodcl 11732 . . . . . . . . . . 11  |-  ( ( N  e.  ZZ  /\  ( # `  W )  e.  NN )  -> 
( N  mod  ( # `
 W ) )  e.  NN0 )
3938ancoms 453 . . . . . . . . . 10  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( N  mod  ( # `
 W ) )  e.  NN0 )
4039adantl 466 . . . . . . . . 9  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( N  mod  ( # `  W
) )  e.  NN0 )
41 0elfz 11488 . . . . . . . . 9  |-  ( ( N  mod  ( # `  W ) )  e. 
NN0  ->  0  e.  ( 0 ... ( N  mod  ( # `  W
) ) ) )
4240, 41syl 16 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  0  e.  ( 0 ... ( N  mod  ( # `  W
) ) ) )
43 swrdlen 12324 . . . . . . . 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 ) )
4426, 42, 30, 43syl3anc 1218 . . . . . . 7  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( # `  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >.
) )  =  ( ( N  mod  ( # `
 W ) )  -  0 ) )
4537, 44oveq12d 6114 . . . . . 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 ) ) )
4638nn0cnd 10643 . . . . . . . . . 10  |-  ( ( N  e.  ZZ  /\  ( # `  W )  e.  NN )  -> 
( N  mod  ( # `
 W ) )  e.  CC )
4746ancoms 453 . . . . . . . . 9  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( N  mod  ( # `
 W ) )  e.  CC )
4847adantl 466 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( N  mod  ( # `  W
) )  e.  CC )
4948subid1d 9713 . . . . . . 7  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( ( N  mod  ( # `  W
) )  -  0 )  =  ( N  mod  ( # `  W
) ) )
5049oveq2d 6112 . . . . . 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 ) ) ) )
5131nn0cnd 10643 . . . . . . 7  |-  ( W  e. Word  V  ->  ( # `
 W )  e.  CC )
52 npcan 9624 . . . . . . 7  |-  ( ( ( # `  W
)  e.  CC  /\  ( N  mod  ( # `  W ) )  e.  CC )  ->  (
( ( # `  W
)  -  ( N  mod  ( # `  W
) ) )  +  ( N  mod  ( # `
 W ) ) )  =  ( # `  W ) )
5351, 47, 52syl2an 477 . . . . . 6  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( (
( # `  W )  -  ( N  mod  ( # `  W ) ) )  +  ( N  mod  ( # `  W ) ) )  =  ( # `  W
) )
5445, 50, 533eqtrd 2479 . . . . 5  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( ( # `
 ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) )  +  (
# `  ( W substr  <.
0 ,  ( N  mod  ( # `  W
) ) >. )
) )  =  (
# `  W )
)
5525, 54syl 16 . . . 4  |-  ( ( ( W  e. Word  V  /\  N  e.  ZZ )  /\  W  =/=  (/) )  -> 
( ( # `  ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. )
)  +  ( # `  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) )  =  ( # `  W
) )
5611, 17, 553eqtrd 2479 . . 3  |-  ( ( ( W  e. Word  V  /\  N  e.  ZZ )  /\  W  =/=  (/) )  -> 
( # `  ( W cyclShift  N ) )  =  ( # `  W
) )
5756expcom 435 . 2  |-  ( W  =/=  (/)  ->  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `
 ( W cyclShift  N ) )  =  ( # `  W ) ) )
588, 57pm2.61ine 2692 1  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `  ( W cyclShift  N ) )  =  ( # `  W
) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    /\ wa 369    = wceq 1369    e. wcel 1756    =/= wne 2611   (/)c0 3642   <.cop 3888   ` cfv 5423  (class class class)co 6096   CCcc 9285   0cc0 9287    + caddc 9290    - cmin 9600   NNcn 10327   NN0cn0 10584   ZZcz 10651   ...cfz 11442    mod cmo 11713   #chash 12108  Word cword 12226   concat cconcat 12228   substr csubstr 12230   cyclShift ccsh 12430
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-rep 4408  ax-sep 4418  ax-nul 4426  ax-pow 4475  ax-pr 4536  ax-un 6377  ax-cnex 9343  ax-resscn 9344  ax-1cn 9345  ax-icn 9346  ax-addcl 9347  ax-addrcl 9348  ax-mulcl 9349  ax-mulrcl 9350  ax-mulcom 9351  ax-addass 9352  ax-mulass 9353  ax-distr 9354  ax-i2m1 9355  ax-1ne0 9356  ax-1rid 9357  ax-rnegex 9358  ax-rrecex 9359  ax-cnre 9360  ax-pre-lttri 9361  ax-pre-lttrn 9362  ax-pre-ltadd 9363  ax-pre-mulgt0 9364  ax-pre-sup 9365
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 2573  df-ne 2613  df-nel 2614  df-ral 2725  df-rex 2726  df-reu 2727  df-rmo 2728  df-rab 2729  df-v 2979  df-sbc 3192  df-csb 3294  df-dif 3336  df-un 3338  df-in 3340  df-ss 3347  df-pss 3349  df-nul 3643  df-if 3797  df-pw 3867  df-sn 3883  df-pr 3885  df-tp 3887  df-op 3889  df-uni 4097  df-int 4134  df-iun 4178  df-br 4298  df-opab 4356  df-mpt 4357  df-tr 4391  df-eprel 4637  df-id 4641  df-po 4646  df-so 4647  df-fr 4684  df-we 4686  df-ord 4727  df-on 4728  df-lim 4729  df-suc 4730  df-xp 4851  df-rel 4852  df-cnv 4853  df-co 4854  df-dm 4855  df-rn 4856  df-res 4857  df-ima 4858  df-iota 5386  df-fun 5425  df-fn 5426  df-f 5427  df-f1 5428  df-fo 5429  df-f1o 5430  df-fv 5431  df-riota 6057  df-ov 6099  df-oprab 6100  df-mpt2 6101  df-om 6482  df-1st 6582  df-2nd 6583  df-recs 6837  df-rdg 6871  df-1o 6925  df-oadd 6929  df-er 7106  df-en 7316  df-dom 7317  df-sdom 7318  df-fin 7319  df-sup 7696  df-card 8114  df-pnf 9425  df-mnf 9426  df-xr 9427  df-ltxr 9428  df-le 9429  df-sub 9602  df-neg 9603  df-div 9999  df-nn 10328  df-n0 10585  df-z 10652  df-uz 10867  df-rp 10997  df-fz 11443  df-fzo 11554  df-fl 11647  df-mod 11714  df-hash 12109  df-word 12234  df-concat 12236  df-substr 12238  df-csh 12431
This theorem is referenced by:  cshwf  12442  2cshw  12452  lswcshw  12454  cshwleneq  12456  clwwisshclwwlem  30475  clwwnisshclwwn  30478  erclwwlkeqlen  30487  erclwwlkneqlen  30503
  Copyright terms: Public domain W3C validator