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

Theorem cshfn 13536
Description: Perform a cyclical shift for a function over a half-open range of nonnegative integers. (Contributed by AV, 20-May-2018.) (Revised by AV, 17-Nov-2018.)
Assertion
Ref Expression
cshfn  |-  ( ( W  e.  { f  |  E. l  e. 
NN0  f  Fn  (
0..^ l ) }  /\  N  e.  ZZ )  ->  ( W cyclShift  N )  =  if ( W  =  (/) ,  (/) ,  ( ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) ) )
Distinct variable group:    f, l
Allowed substitution hints:    N( f, l)    W( f, l)

Proof of Theorem cshfn
Dummy variables  n  w are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 eqeq1 2626 . . . 4  |-  ( w  =  W  ->  (
w  =  (/)  <->  W  =  (/) ) )
21adantr 481 . . 3  |-  ( ( w  =  W  /\  n  =  N )  ->  ( w  =  (/)  <->  W  =  (/) ) )
3 simpl 473 . . . . 5  |-  ( ( w  =  W  /\  n  =  N )  ->  w  =  W )
4 simpr 477 . . . . . . 7  |-  ( ( w  =  W  /\  n  =  N )  ->  n  =  N )
5 fveq2 6191 . . . . . . . 8  |-  ( w  =  W  ->  ( # `
 w )  =  ( # `  W
) )
65adantr 481 . . . . . . 7  |-  ( ( w  =  W  /\  n  =  N )  ->  ( # `  w
)  =  ( # `  W ) )
74, 6oveq12d 6668 . . . . . 6  |-  ( ( w  =  W  /\  n  =  N )  ->  ( n  mod  ( # `
 w ) )  =  ( N  mod  ( # `  W ) ) )
87, 6opeq12d 4410 . . . . 5  |-  ( ( w  =  W  /\  n  =  N )  -> 
<. ( n  mod  ( # `
 w ) ) ,  ( # `  w
) >.  =  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. )
93, 8oveq12d 6668 . . . 4  |-  ( ( w  =  W  /\  n  =  N )  ->  ( w substr  <. (
n  mod  ( # `  w
) ) ,  (
# `  w ) >. )  =  ( W substr  <. ( N  mod  ( # `
 W ) ) ,  ( # `  W
) >. ) )
107opeq2d 4409 . . . . 5  |-  ( ( w  =  W  /\  n  =  N )  -> 
<. 0 ,  ( n  mod  ( # `  w ) ) >.  =  <. 0 ,  ( N  mod  ( # `  W ) ) >.
)
113, 10oveq12d 6668 . . . 4  |-  ( ( w  =  W  /\  n  =  N )  ->  ( w substr  <. 0 ,  ( n  mod  ( # `  w ) ) >. )  =  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >.
) )
129, 11oveq12d 6668 . . 3  |-  ( ( w  =  W  /\  n  =  N )  ->  ( ( w substr  <. (
n  mod  ( # `  w
) ) ,  (
# `  w ) >. ) ++  ( w substr  <. 0 ,  ( n  mod  ( # `  w ) ) >. ) )  =  ( ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) )
132, 12ifbieq2d 4111 . 2  |-  ( ( w  =  W  /\  n  =  N )  ->  if ( w  =  (/) ,  (/) ,  ( ( w substr  <. ( n  mod  ( # `  w ) ) ,  ( # `  w ) >. ) ++  ( w substr  <. 0 ,  ( n  mod  ( # `
 w ) )
>. ) ) )  =  if ( W  =  (/) ,  (/) ,  ( ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `
 W ) )
>. ) ) ) )
14 df-csh 13535 . 2  |- cyclShift  =  ( w  e.  { f  |  E. l  e. 
NN0  f  Fn  (
0..^ l ) } ,  n  e.  ZZ  |->  if ( w  =  (/) ,  (/) ,  ( ( w substr  <. ( n  mod  ( # `
 w ) ) ,  ( # `  w
) >. ) ++  ( w substr  <. 0 ,  ( n  mod  ( # `  w
) ) >. )
) ) )
15 0ex 4790 . . 3  |-  (/)  e.  _V
16 ovex 6678 . . 3  |-  ( ( W substr  <. ( N  mod  ( # `  W ) ) ,  ( # `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `
 W ) )
>. ) )  e.  _V
1715, 16ifex 4156 . 2  |-  if ( W  =  (/) ,  (/) ,  ( ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) )  e.  _V
1813, 14, 17ovmpt2a 6791 1  |-  ( ( W  e.  { f  |  E. l  e. 
NN0  f  Fn  (
0..^ l ) }  /\  N  e.  ZZ )  ->  ( W cyclShift  N )  =  if ( W  =  (/) ,  (/) ,  ( ( W substr  <. ( N  mod  ( # `  W
) ) ,  (
# `  W ) >. ) ++  ( W substr  <. 0 ,  ( N  mod  ( # `  W ) ) >. ) ) ) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    <-> wb 196    /\ wa 384    = wceq 1483    e. wcel 1990   {cab 2608   E.wrex 2913   (/)c0 3915   ifcif 4086   <.cop 4183    Fn wfn 5883   ` cfv 5888  (class class class)co 6650   0cc0 9936   NN0cn0 11292   ZZcz 11377  ..^cfzo 12465    mod cmo 12668   #chash 13117   ++ cconcat 13293   substr csubstr 13295   cyclShift ccsh 13534
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1722  ax-4 1737  ax-5 1839  ax-6 1888  ax-7 1935  ax-9 1999  ax-10 2019  ax-11 2034  ax-12 2047  ax-13 2246  ax-ext 2602  ax-sep 4781  ax-nul 4789  ax-pr 4906
This theorem depends on definitions:  df-bi 197  df-or 385  df-an 386  df-3an 1039  df-tru 1486  df-ex 1705  df-nf 1710  df-sb 1881  df-eu 2474  df-mo 2475  df-clab 2609  df-cleq 2615  df-clel 2618  df-nfc 2753  df-ral 2917  df-rex 2918  df-rab 2921  df-v 3202  df-sbc 3436  df-dif 3577  df-un 3579  df-in 3581  df-ss 3588  df-nul 3916  df-if 4087  df-sn 4178  df-pr 4180  df-op 4184  df-uni 4437  df-br 4654  df-opab 4713  df-id 5024  df-xp 5120  df-rel 5121  df-cnv 5122  df-co 5123  df-dm 5124  df-iota 5851  df-fun 5890  df-fv 5896  df-ov 6653  df-oprab 6654  df-mpt2 6655  df-csh 13535
This theorem is referenced by:  cshword  13537  cshword2  41437
  Copyright terms: Public domain W3C validator