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

Theorem swrdval 11466
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 11428 . . 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 5541 . . . . 5  |-  ( b  =  <. F ,  L >.  ->  ( 1st `  b
)  =  ( 1st `  <. F ,  L >. ) )
54adantl 452 . . . 4  |-  ( ( s  =  S  /\  b  =  <. F ,  L >. )  ->  ( 1st `  b )  =  ( 1st `  <. F ,  L >. )
)
6 op1stg 6148 . . . . 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 2350 . . 3  |-  ( ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  /\  ( s  =  S  /\  b  = 
<. F ,  L >. ) )  ->  ( 1st `  b )  =  F )
9 fveq2 5541 . . . . 5  |-  ( b  =  <. F ,  L >.  ->  ( 2nd `  b
)  =  ( 2nd `  <. F ,  L >. ) )
109adantl 452 . . . 4  |-  ( ( s  =  S  /\  b  =  <. F ,  L >. )  ->  ( 2nd `  b )  =  ( 2nd `  <. F ,  L >. )
)
11 op2ndg 6149 . . . . 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 2350 . . 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 5892 . . . . 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 4897 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  dom  s  =  dom  S )
1916, 18sseq12d 3220 . . . 4  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
( ( 1st `  b
)..^ ( 2nd `  b
) )  C_  dom  s 
<->  ( F..^ L ) 
C_  dom  S )
)
2015, 14oveq12d 5892 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
( 2nd `  b
)  -  ( 1st `  b ) )  =  ( L  -  F
) )
2120oveq2d 5890 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
0..^ ( ( 2nd `  b )  -  ( 1st `  b ) ) )  =  ( 0..^ ( L  -  F
) ) )
2214oveq2d 5890 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
x  +  ( 1st `  b ) )  =  ( x  +  F
) )
2317, 22fveq12d 5547 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
s `  ( x  +  ( 1st `  b
) ) )  =  ( S `  (
x  +  F ) ) )
2421, 23mpteq12dv 4114 . . . 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 2297 . . . 4  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (/)  =  (/) )
2619, 24, 25ifbieq12d 3600 . . 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 2809 . . 3  |-  ( S  e.  V  ->  S  e.  _V )
29283ad2ant1 976 . 2  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  S  e.  _V )
30 opelxpi 4737 . . 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 5899 . . . . 5  |-  ( 0..^ ( L  -  F
) )  e.  _V
3332mptex 5762 . . . 4  |-  ( x  e.  ( 0..^ ( L  -  F ) )  |->  ( S `  ( x  +  F
) ) )  e. 
_V
34 0ex 4166 . . . 4  |-  (/)  e.  _V
3533, 34ifex 3636 . . 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 5991 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 1632    e. wcel 1696   _Vcvv 2801    C_ wss 3165   (/)c0 3468   ifcif 3578   <.cop 3656    e. cmpt 4093    X. cxp 4703   dom cdm 4705   ` cfv 5271  (class class class)co 5874    e. cmpt2 5876   1stc1st 6136   2ndc2nd 6137   0cc0 8753    + caddc 8756    - cmin 9053   ZZcz 10040  ..^cfzo 10886   substr csubstr 11422
This theorem is referenced by:  swrd00  11467  swrdcl  11468  swrdval2  11469
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1536  ax-5 1547  ax-17 1606  ax-9 1644  ax-8 1661  ax-13 1698  ax-14 1700  ax-6 1715  ax-7 1720  ax-11 1727  ax-12 1878  ax-ext 2277  ax-rep 4147  ax-sep 4157  ax-nul 4165  ax-pow 4204  ax-pr 4230  ax-un 4528
This theorem depends on definitions:  df-bi 177  df-or 359  df-an 360  df-3an 936  df-tru 1310  df-ex 1532  df-nf 1535  df-sb 1639  df-eu 2160  df-mo 2161  df-clab 2283  df-cleq 2289  df-clel 2292  df-nfc 2421  df-ne 2461  df-ral 2561  df-rex 2562  df-reu 2563  df-rab 2565  df-v 2803  df-sbc 3005  df-csb 3095  df-dif 3168  df-un 3170  df-in 3172  df-ss 3179  df-nul 3469  df-if 3579  df-sn 3659  df-pr 3660  df-op 3662  df-uni 3844  df-iun 3923  df-br 4040  df-opab 4094  df-mpt 4095  df-id 4325  df-xp 4711  df-rel 4712  df-cnv 4713  df-co 4714  df-dm 4715  df-rn 4716  df-res 4717  df-ima 4718  df-iota 5235  df-fun 5273  df-fn 5274  df-f 5275  df-f1 5276  df-fo 5277  df-f1o 5278  df-fv 5279  df-ov 5877  df-oprab 5878  df-mpt2 5879  df-1st 6138  df-2nd 6139  df-substr 11428
  Copyright terms: Public domain W3C validator