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

Theorem swrdval 11450
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 11412 . . 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 10 . 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 732 . . 3  |-  ( ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  /\  ( s  =  S  /\  b  = 
<. F ,  L >. ) )  ->  s  =  S )
4 fveq2 5525 . . . . 5  |-  ( b  =  <. F ,  L >.  ->  ( 1st `  b
)  =  ( 1st `  <. F ,  L >. ) )
54adantl 452 . . . 4  |-  ( ( s  =  S  /\  b  =  <. F ,  L >. )  ->  ( 1st `  b )  =  ( 1st `  <. F ,  L >. )
)
6 op1stg 6132 . . . . 5  |-  ( ( F  e.  ZZ  /\  L  e.  ZZ )  ->  ( 1st `  <. F ,  L >. )  =  F )
763adant1 973 . . . 4  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  ( 1st `  <. F ,  L >. )  =  F )
85, 7sylan9eqr 2337 . . 3  |-  ( ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  /\  ( s  =  S  /\  b  = 
<. F ,  L >. ) )  ->  ( 1st `  b )  =  F )
9 fveq2 5525 . . . . 5  |-  ( b  =  <. F ,  L >.  ->  ( 2nd `  b
)  =  ( 2nd `  <. F ,  L >. ) )
109adantl 452 . . . 4  |-  ( ( s  =  S  /\  b  =  <. F ,  L >. )  ->  ( 2nd `  b )  =  ( 2nd `  <. F ,  L >. )
)
11 op2ndg 6133 . . . . 5  |-  ( ( F  e.  ZZ  /\  L  e.  ZZ )  ->  ( 2nd `  <. F ,  L >. )  =  L )
12113adant1 973 . . . 4  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  ( 2nd `  <. F ,  L >. )  =  L )
1310, 12sylan9eqr 2337 . . 3  |-  ( ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  /\  ( s  =  S  /\  b  = 
<. F ,  L >. ) )  ->  ( 2nd `  b )  =  L )
14 simp2 956 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  ( 1st `  b )  =  F )
15 simp3 957 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  ( 2nd `  b )  =  L )
1614, 15oveq12d 5876 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
( 1st `  b
)..^ ( 2nd `  b
) )  =  ( F..^ L ) )
17 simp1 955 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  s  =  S )
1817dmeqd 4881 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  dom  s  =  dom  S )
1916, 18sseq12d 3207 . . . 4  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
( ( 1st `  b
)..^ ( 2nd `  b
) )  C_  dom  s 
<->  ( F..^ L ) 
C_  dom  S )
)
2015, 14oveq12d 5876 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
( 2nd `  b
)  -  ( 1st `  b ) )  =  ( L  -  F
) )
2120oveq2d 5874 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
0..^ ( ( 2nd `  b )  -  ( 1st `  b ) ) )  =  ( 0..^ ( L  -  F
) ) )
2214oveq2d 5874 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
x  +  ( 1st `  b ) )  =  ( x  +  F
) )
2317, 22fveq12d 5531 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
s `  ( x  +  ( 1st `  b
) ) )  =  ( S `  (
x  +  F ) ) )
2421, 23mpteq12dv 4098 . . . 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
) ) ) )
25 eqidd 2284 . . . 4  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (/)  =  (/) )
2619, 24, 25ifbieq12d 3587 . . 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 ) ) ) ,  (/) ) )
273, 8, 13, 26syl3anc 1182 . 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 ) ) ) ,  (/) ) )
28 elex 2796 . . 3  |-  ( S  e.  V  ->  S  e.  _V )
29283ad2ant1 976 . 2  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  S  e.  _V )
30 opelxpi 4721 . . 3  |-  ( ( F  e.  ZZ  /\  L  e.  ZZ )  -> 
<. F ,  L >.  e.  ( ZZ  X.  ZZ ) )
31303adant1 973 . 2  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  <. F ,  L >.  e.  ( ZZ 
X.  ZZ ) )
32 ovex 5883 . . . . 5  |-  ( 0..^ ( L  -  F
) )  e.  _V
3332mptex 5746 . . . 4  |-  ( x  e.  ( 0..^ ( L  -  F ) )  |->  ( S `  ( x  +  F
) ) )  e. 
_V
34 0ex 4150 . . . 4  |-  (/)  e.  _V
3533, 34ifex 3623 . . 3  |-  if ( ( F..^ L ) 
C_  dom  S , 
( x  e.  ( 0..^ ( L  -  F ) )  |->  ( S `  ( x  +  F ) ) ) ,  (/) )  e. 
_V
3635a1i 10 . 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 )
372, 27, 29, 31, 36ovmpt2d 5975 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 set class
Syntax hints:    -> wi 4    /\ wa 358    /\ w3a 934    = wceq 1623    e. wcel 1684   _Vcvv 2788    C_ wss 3152   (/)c0 3455   ifcif 3565   <.cop 3643    e. cmpt 4077    X. cxp 4687   dom cdm 4689   ` cfv 5255  (class class class)co 5858    e. cmpt2 5860   1stc1st 6120   2ndc2nd 6121   0cc0 8737    + caddc 8740    - cmin 9037   ZZcz 10024  ..^cfzo 10870   substr csubstr 11406
This theorem is referenced by:  swrd00  11451  swrdcl  11452  swrdval2  11453
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1533  ax-5 1544  ax-17 1603  ax-9 1635  ax-8 1643  ax-13 1686  ax-14 1688  ax-6 1703  ax-7 1708  ax-11 1715  ax-12 1866  ax-ext 2264  ax-rep 4131  ax-sep 4141  ax-nul 4149  ax-pow 4188  ax-pr 4214  ax-un 4512
This theorem depends on definitions:  df-bi 177  df-or 359  df-an 360  df-3an 936  df-tru 1310  df-ex 1529  df-nf 1532  df-sb 1630  df-eu 2147  df-mo 2148  df-clab 2270  df-cleq 2276  df-clel 2279  df-nfc 2408  df-ne 2448  df-ral 2548  df-rex 2549  df-reu 2550  df-rab 2552  df-v 2790  df-sbc 2992  df-csb 3082  df-dif 3155  df-un 3157  df-in 3159  df-ss 3166  df-nul 3456  df-if 3566  df-sn 3646  df-pr 3647  df-op 3649  df-uni 3828  df-iun 3907  df-br 4024  df-opab 4078  df-mpt 4079  df-id 4309  df-xp 4695  df-rel 4696  df-cnv 4697  df-co 4698  df-dm 4699  df-rn 4700  df-res 4701  df-ima 4702  df-iota 5219  df-fun 5257  df-fn 5258  df-f 5259  df-f1 5260  df-fo 5261  df-f1o 5262  df-fv 5263  df-ov 5861  df-oprab 5862  df-mpt2 5863  df-1st 6122  df-2nd 6123  df-substr 11412
  Copyright terms: Public domain W3C validator