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

Theorem swrdval 12318
Description: Value of a subword. (Contributed by Stefan O'Rear, 15-Aug-2015.)
Assertion
Ref Expression
swrdval  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  ( S substr  <. F ,  L >. )  =  if ( ( F..^ L ) 
C_  dom  S , 
( x  e.  ( 0..^ ( L  -  F ) )  |->  ( S `  ( x  +  F ) ) ) ,  (/) ) )
Distinct variable groups:    x, S    x, F    x, L    x, V

Proof of Theorem swrdval
Dummy variables  s 
b are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 df-substr 12238 . . 3  |- substr  =  ( s  e.  _V , 
b  e.  ( ZZ 
X.  ZZ )  |->  if ( ( ( 1st `  b )..^ ( 2nd `  b ) )  C_  dom  s ,  ( x  e.  ( 0..^ ( ( 2nd `  b
)  -  ( 1st `  b ) ) ) 
|->  ( s `  (
x  +  ( 1st `  b ) ) ) ) ,  (/) ) )
21a1i 11 . 2  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  -> substr  =  ( s  e.  _V , 
b  e.  ( ZZ 
X.  ZZ )  |->  if ( ( ( 1st `  b )..^ ( 2nd `  b ) )  C_  dom  s ,  ( x  e.  ( 0..^ ( ( 2nd `  b
)  -  ( 1st `  b ) ) ) 
|->  ( s `  (
x  +  ( 1st `  b ) ) ) ) ,  (/) ) ) )
3 simprl 755 . . 3  |-  ( ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  /\  ( s  =  S  /\  b  = 
<. F ,  L >. ) )  ->  s  =  S )
4 fveq2 5696 . . . . 5  |-  ( b  =  <. F ,  L >.  ->  ( 1st `  b
)  =  ( 1st `  <. F ,  L >. ) )
54adantl 466 . . . 4  |-  ( ( s  =  S  /\  b  =  <. F ,  L >. )  ->  ( 1st `  b )  =  ( 1st `  <. F ,  L >. )
)
6 op1stg 6594 . . . . 5  |-  ( ( F  e.  ZZ  /\  L  e.  ZZ )  ->  ( 1st `  <. F ,  L >. )  =  F )
763adant1 1006 . . . 4  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  ( 1st `  <. F ,  L >. )  =  F )
85, 7sylan9eqr 2497 . . 3  |-  ( ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  /\  ( s  =  S  /\  b  = 
<. F ,  L >. ) )  ->  ( 1st `  b )  =  F )
9 fveq2 5696 . . . . 5  |-  ( b  =  <. F ,  L >.  ->  ( 2nd `  b
)  =  ( 2nd `  <. F ,  L >. ) )
109adantl 466 . . . 4  |-  ( ( s  =  S  /\  b  =  <. F ,  L >. )  ->  ( 2nd `  b )  =  ( 2nd `  <. F ,  L >. )
)
11 op2ndg 6595 . . . . 5  |-  ( ( F  e.  ZZ  /\  L  e.  ZZ )  ->  ( 2nd `  <. F ,  L >. )  =  L )
12113adant1 1006 . . . 4  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  ( 2nd `  <. F ,  L >. )  =  L )
1310, 12sylan9eqr 2497 . . 3  |-  ( ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  /\  ( s  =  S  /\  b  = 
<. F ,  L >. ) )  ->  ( 2nd `  b )  =  L )
14 simp2 989 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  ( 1st `  b )  =  F )
15 simp3 990 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  ( 2nd `  b )  =  L )
1614, 15oveq12d 6114 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
( 1st `  b
)..^ ( 2nd `  b
) )  =  ( F..^ L ) )
17 simp1 988 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  s  =  S )
1817dmeqd 5047 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  dom  s  =  dom  S )
1916, 18sseq12d 3390 . . . 4  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
( ( 1st `  b
)..^ ( 2nd `  b
) )  C_  dom  s 
<->  ( F..^ L ) 
C_  dom  S )
)
2015, 14oveq12d 6114 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
( 2nd `  b
)  -  ( 1st `  b ) )  =  ( L  -  F
) )
2120oveq2d 6112 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
0..^ ( ( 2nd `  b )  -  ( 1st `  b ) ) )  =  ( 0..^ ( L  -  F
) ) )
2214oveq2d 6112 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
x  +  ( 1st `  b ) )  =  ( x  +  F
) )
2317, 22fveq12d 5702 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
s `  ( x  +  ( 1st `  b
) ) )  =  ( S `  (
x  +  F ) ) )
2421, 23mpteq12dv 4375 . . . 4  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
x  e.  ( 0..^ ( ( 2nd `  b
)  -  ( 1st `  b ) ) ) 
|->  ( s `  (
x  +  ( 1st `  b ) ) ) )  =  ( x  e.  ( 0..^ ( L  -  F ) )  |->  ( S `  ( x  +  F
) ) ) )
2519, 24ifbieq1d 3817 . . 3  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  if ( ( ( 1st `  b )..^ ( 2nd `  b ) )  C_  dom  s ,  ( x  e.  ( 0..^ ( ( 2nd `  b
)  -  ( 1st `  b ) ) ) 
|->  ( s `  (
x  +  ( 1st `  b ) ) ) ) ,  (/) )  =  if ( ( F..^ L )  C_  dom  S ,  ( x  e.  ( 0..^ ( L  -  F ) ) 
|->  ( S `  (
x  +  F ) ) ) ,  (/) ) )
263, 8, 13, 25syl3anc 1218 . 2  |-  ( ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  /\  ( s  =  S  /\  b  = 
<. F ,  L >. ) )  ->  if (
( ( 1st `  b
)..^ ( 2nd `  b
) )  C_  dom  s ,  ( x  e.  ( 0..^ ( ( 2nd `  b )  -  ( 1st `  b
) ) )  |->  ( s `  ( x  +  ( 1st `  b
) ) ) ) ,  (/) )  =  if ( ( F..^ L
)  C_  dom  S , 
( x  e.  ( 0..^ ( L  -  F ) )  |->  ( S `  ( x  +  F ) ) ) ,  (/) ) )
27 elex 2986 . . 3  |-  ( S  e.  V  ->  S  e.  _V )
28273ad2ant1 1009 . 2  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  S  e.  _V )
29 opelxpi 4876 . . 3  |-  ( ( F  e.  ZZ  /\  L  e.  ZZ )  -> 
<. F ,  L >.  e.  ( ZZ  X.  ZZ ) )
30293adant1 1006 . 2  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  <. F ,  L >.  e.  ( ZZ 
X.  ZZ ) )
31 ovex 6121 . . . . 5  |-  ( 0..^ ( L  -  F
) )  e.  _V
3231mptex 5953 . . . 4  |-  ( x  e.  ( 0..^ ( L  -  F ) )  |->  ( S `  ( x  +  F
) ) )  e. 
_V
33 0ex 4427 . . . 4  |-  (/)  e.  _V
3432, 33ifex 3863 . . 3  |-  if ( ( F..^ L ) 
C_  dom  S , 
( x  e.  ( 0..^ ( L  -  F ) )  |->  ( S `  ( x  +  F ) ) ) ,  (/) )  e. 
_V
3534a1i 11 . 2  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  if ( ( F..^ L
)  C_  dom  S , 
( x  e.  ( 0..^ ( L  -  F ) )  |->  ( S `  ( x  +  F ) ) ) ,  (/) )  e. 
_V )
362, 26, 28, 30, 35ovmpt2d 6223 1  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  ( S substr  <. F ,  L >. )  =  if ( ( F..^ L ) 
C_  dom  S , 
( x  e.  ( 0..^ ( L  -  F ) )  |->  ( S `  ( x  +  F ) ) ) ,  (/) ) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    /\ wa 369    /\ w3a 965    = wceq 1369    e. wcel 1756   _Vcvv 2977    C_ wss 3333   (/)c0 3642   ifcif 3796   <.cop 3888    e. cmpt 4355    X. cxp 4843   dom cdm 4845   ` cfv 5423  (class class class)co 6096    e. cmpt2 6098   1stc1st 6580   2ndc2nd 6581   0cc0 9287    + caddc 9290    - cmin 9600   ZZcz 10651  ..^cfzo 11553   substr csubstr 12230
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
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  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-ral 2725  df-rex 2726  df-reu 2727  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-nul 3643  df-if 3797  df-sn 3883  df-pr 3885  df-op 3889  df-uni 4097  df-iun 4178  df-br 4298  df-opab 4356  df-mpt 4357  df-id 4641  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-ov 6099  df-oprab 6100  df-mpt2 6101  df-1st 6582  df-2nd 6583  df-substr 12238
This theorem is referenced by:  swrd00  12319  swrdcl  12320  swrdval2  12321  swrdlend  12330  swrdnd  12331  swrd0  12332  swrdvalodm2  12338  swrdvalodm  12339  repswswrd  12427
  Copyright terms: Public domain W3C validator