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

Theorem cshwlen 12847
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 6256 . . . . 5  |-  ( W  =  (/)  ->  ( W cyclShift  N )  =  (
(/) cyclShift  N ) )
2 0csh0 12841 . . . . . 6  |-  ( (/) cyclShift  N
)  =  (/)
32a1i 11 . . . . 5  |-  ( W  =  (/)  ->  ( (/) cyclShift  N
)  =  (/) )
4 eqcom 2435 . . . . . 6  |-  ( W  =  (/)  <->  (/)  =  W )
54biimpi 197 . . . . 5  |-  ( W  =  (/)  ->  (/)  =  W )
61, 3, 53eqtrd 2466 . . . 4  |-  ( W  =  (/)  ->  ( W cyclShift  N )  =  W )
76fveq2d 5829 . . 3  |-  ( W  =  (/)  ->  ( # `  ( W cyclShift  N )
)  =  ( # `  W ) )
87a1d 26 . 2  |-  ( W  =  (/)  ->  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `  ( W cyclShift  N ) )  =  ( # `  W
) ) )
9 cshword 12839 . . . . . 6  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( W cyclShift  N )  =  ( ( W substr  <. ( N  mod  ( # `
 W ) ) ,  ( # `  W
) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W
) ) >. )
) )
109fveq2d 5829 . . . . 5  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `  ( W cyclShift  N ) )  =  ( # `  (
( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) ) )
1110adantr 466 . . . 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 12721 . . . . . . 7  |-  ( W  e. Word  V  ->  ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. )  e. Word  V )
13 swrdcl 12721 . . . . . . 7  |-  ( W  e. Word  V  ->  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >.
)  e. Word  V )
14 ccatlen 12669 . . . . . . 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 665 . . . . . 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 466 . . . . 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 466 . . . 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 12636 . . . . . . . . . 10  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( # `
 W )  e.  NN )
19 pm3.21 449 . . . . . . . . . . 11  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( W  e. Word  V  ->  ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
) ) )
2019ex 435 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN  ->  ( N  e.  ZZ  ->  ( W  e. Word  V  ->  ( W  e. Word  V  /\  ( (
# `  W )  e.  NN  /\  N  e.  ZZ ) ) ) ) )
2118, 20syl 17 . . . . . . . . 9  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( N  e.  ZZ  ->  ( W  e. Word  V  -> 
( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
) ) ) )
2221ex 435 . . . . . . . 8  |-  ( W  e. Word  V  ->  ( W  =/=  (/)  ->  ( N  e.  ZZ  ->  ( W  e. Word  V  ->  ( W  e. Word  V  /\  ( (
# `  W )  e.  NN  /\  N  e.  ZZ ) ) ) ) ) )
2322com24 90 . . . . . . 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 49 . . . . . 6  |-  ( W  e. Word  V  ->  ( N  e.  ZZ  ->  ( W  =/=  (/)  ->  ( W  e. Word  V  /\  (
( # `  W )  e.  NN  /\  N  e.  ZZ ) ) ) ) )
2524imp31 433 . . . . 5  |-  ( ( ( W  e. Word  V  /\  N  e.  ZZ )  /\  W  =/=  (/) )  -> 
( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
) )
26 simpl 458 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  W  e. Word  V )
27 pm3.22 450 . . . . . . . . . 10  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( N  e.  ZZ  /\  ( # `  W
)  e.  NN ) )
2827adantl 467 . . . . . . . . 9  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( N  e.  ZZ  /\  ( # `  W )  e.  NN ) )
29 zmodfzp1 12070 . . . . . . . . 9  |-  ( ( N  e.  ZZ  /\  ( # `  W )  e.  NN )  -> 
( N  mod  ( # `
 W ) )  e.  ( 0 ... ( # `  W
) ) )
3028, 29syl 17 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( N  mod  ( # `  W
) )  e.  ( 0 ... ( # `  W ) ) )
31 lencl 12635 . . . . . . . . . 10  |-  ( W  e. Word  V  ->  ( # `
 W )  e. 
NN0 )
32 nn0fz0 11841 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  <->  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )
3331, 32sylib 199 . . . . . . . . 9  |-  ( W  e. Word  V  ->  ( # `
 W )  e.  ( 0 ... ( # `
 W ) ) )
3433adantr 466 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )
35 swrdlen 12725 . . . . . . . 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 1264 . . . . . . 7  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( # `  ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. )
)  =  ( (
# `  W )  -  ( N  mod  ( # `  W ) ) ) )
37 zmodcl 12066 . . . . . . . . . . 11  |-  ( ( N  e.  ZZ  /\  ( # `  W )  e.  NN )  -> 
( N  mod  ( # `
 W ) )  e.  NN0 )
3837ancoms 454 . . . . . . . . . 10  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( N  mod  ( # `
 W ) )  e.  NN0 )
3938adantl 467 . . . . . . . . 9  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( N  mod  ( # `  W
) )  e.  NN0 )
40 0elfz 11840 . . . . . . . . 9  |-  ( ( N  mod  ( # `  W ) )  e. 
NN0  ->  0  e.  ( 0 ... ( N  mod  ( # `  W
) ) ) )
4139, 40syl 17 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  0  e.  ( 0 ... ( N  mod  ( # `  W
) ) ) )
42 swrdlen 12725 . . . . . . . 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 1264 . . . . . . 7  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( # `  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >.
) )  =  ( ( N  mod  ( # `
 W ) )  -  0 ) )
4436, 43oveq12d 6267 . . . . . 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 10878 . . . . . . . . . 10  |-  ( ( N  e.  ZZ  /\  ( # `  W )  e.  NN )  -> 
( N  mod  ( # `
 W ) )  e.  CC )
4645ancoms 454 . . . . . . . . 9  |-  ( ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )  ->  ( N  mod  ( # `
 W ) )  e.  CC )
4746adantl 467 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( N  mod  ( # `  W
) )  e.  CC )
4847subid1d 9926 . . . . . . 7  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( ( N  mod  ( # `  W
) )  -  0 )  =  ( N  mod  ( # `  W
) ) )
4948oveq2d 6265 . . . . . 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 10878 . . . . . . 7  |-  ( W  e. Word  V  ->  ( # `
 W )  e.  CC )
51 npcan 9835 . . . . . . 7  |-  ( ( ( # `  W
)  e.  CC  /\  ( N  mod  ( # `  W ) )  e.  CC )  ->  (
( ( # `  W
)  -  ( N  mod  ( # `  W
) ) )  +  ( N  mod  ( # `
 W ) ) )  =  ( # `  W ) )
5250, 46, 51syl2an 479 . . . . . 6  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  e.  NN  /\  N  e.  ZZ )
)  ->  ( (
( # `  W )  -  ( N  mod  ( # `  W ) ) )  +  ( N  mod  ( # `  W ) ) )  =  ( # `  W
) )
5344, 49, 523eqtrd 2466 . . . . 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 17 . . . 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 2466 . . 3  |-  ( ( ( W  e. Word  V  /\  N  e.  ZZ )  /\  W  =/=  (/) )  -> 
( # `  ( W cyclShift  N ) )  =  ( # `  W
) )
5655expcom 436 . 2  |-  ( W  =/=  (/)  ->  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `
 ( W cyclShift  N ) )  =  ( # `  W ) ) )
578, 56pm2.61ine 2684 1  |-  ( ( W  e. Word  V  /\  N  e.  ZZ )  ->  ( # `  ( W cyclShift  N ) )  =  ( # `  W
) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    /\ wa 370    = wceq 1437    e. wcel 1872    =/= wne 2599   (/)c0 3704   <.cop 3947   ` cfv 5544  (class class class)co 6249   CCcc 9488   0cc0 9490    + caddc 9493    - cmin 9811   NNcn 10560   NN0cn0 10820   ZZcz 10888   ...cfz 11735    mod cmo 12046   #chash 12465  Word cword 12604   ++ cconcat 12606   substr csubstr 12608   cyclShift ccsh 12836
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1663  ax-4 1676  ax-5 1752  ax-6 1798  ax-7 1843  ax-8 1874  ax-9 1876  ax-10 1891  ax-11 1896  ax-12 1909  ax-13 2063  ax-ext 2408  ax-rep 4479  ax-sep 4489  ax-nul 4498  ax-pow 4545  ax-pr 4603  ax-un 6541  ax-cnex 9546  ax-resscn 9547  ax-1cn 9548  ax-icn 9549  ax-addcl 9550  ax-addrcl 9551  ax-mulcl 9552  ax-mulrcl 9553  ax-mulcom 9554  ax-addass 9555  ax-mulass 9556  ax-distr 9557  ax-i2m1 9558  ax-1ne0 9559  ax-1rid 9560  ax-rnegex 9561  ax-rrecex 9562  ax-cnre 9563  ax-pre-lttri 9564  ax-pre-lttrn 9565  ax-pre-ltadd 9566  ax-pre-mulgt0 9567  ax-pre-sup 9568
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 1658  df-nf 1662  df-sb 1791  df-eu 2280  df-mo 2281  df-clab 2415  df-cleq 2421  df-clel 2424  df-nfc 2558  df-ne 2601  df-nel 2602  df-ral 2719  df-rex 2720  df-reu 2721  df-rmo 2722  df-rab 2723  df-v 3024  df-sbc 3243  df-csb 3339  df-dif 3382  df-un 3384  df-in 3386  df-ss 3393  df-pss 3395  df-nul 3705  df-if 3855  df-pw 3926  df-sn 3942  df-pr 3944  df-tp 3946  df-op 3948  df-uni 4163  df-int 4199  df-iun 4244  df-br 4367  df-opab 4426  df-mpt 4427  df-tr 4462  df-eprel 4707  df-id 4711  df-po 4717  df-so 4718  df-fr 4755  df-we 4757  df-xp 4802  df-rel 4803  df-cnv 4804  df-co 4805  df-dm 4806  df-rn 4807  df-res 4808  df-ima 4809  df-pred 5342  df-ord 5388  df-on 5389  df-lim 5390  df-suc 5391  df-iota 5508  df-fun 5546  df-fn 5547  df-f 5548  df-f1 5549  df-fo 5550  df-f1o 5551  df-fv 5552  df-riota 6211  df-ov 6252  df-oprab 6253  df-mpt2 6254  df-om 6651  df-1st 6751  df-2nd 6752  df-wrecs 6983  df-recs 7045  df-rdg 7083  df-1o 7137  df-oadd 7141  df-er 7318  df-en 7525  df-dom 7526  df-sdom 7527  df-fin 7528  df-sup 7909  df-inf 7910  df-card 8325  df-cda 8549  df-pnf 9628  df-mnf 9629  df-xr 9630  df-ltxr 9631  df-le 9632  df-sub 9813  df-neg 9814  df-div 10221  df-nn 10561  df-2 10619  df-n0 10821  df-z 10889  df-uz 11111  df-rp 11254  df-fz 11736  df-fzo 11867  df-fl 11978  df-mod 12047  df-hash 12466  df-word 12612  df-concat 12614  df-substr 12616  df-csh 12837
This theorem is referenced by:  cshwf  12848  2cshw  12858  lswcshw  12860  cshwleneq  12862  clwwisshclwwlem  25476  clwwnisshclwwn  25479  erclwwlkeqlen  25482  erclwwlkneqlen  25494
  Copyright terms: Public domain W3C validator