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

Theorem swrdval 11693
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 11655 . . 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 733 . . 3  |-  ( ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  /\  ( s  =  S  /\  b  = 
<. F ,  L >. ) )  ->  s  =  S )
4 fveq2 5670 . . . . 5  |-  ( b  =  <. F ,  L >.  ->  ( 1st `  b
)  =  ( 1st `  <. F ,  L >. ) )
54adantl 453 . . . 4  |-  ( ( s  =  S  /\  b  =  <. F ,  L >. )  ->  ( 1st `  b )  =  ( 1st `  <. F ,  L >. )
)
6 op1stg 6300 . . . . 5  |-  ( ( F  e.  ZZ  /\  L  e.  ZZ )  ->  ( 1st `  <. F ,  L >. )  =  F )
763adant1 975 . . . 4  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  ( 1st `  <. F ,  L >. )  =  F )
85, 7sylan9eqr 2443 . . 3  |-  ( ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  /\  ( s  =  S  /\  b  = 
<. F ,  L >. ) )  ->  ( 1st `  b )  =  F )
9 fveq2 5670 . . . . 5  |-  ( b  =  <. F ,  L >.  ->  ( 2nd `  b
)  =  ( 2nd `  <. F ,  L >. ) )
109adantl 453 . . . 4  |-  ( ( s  =  S  /\  b  =  <. F ,  L >. )  ->  ( 2nd `  b )  =  ( 2nd `  <. F ,  L >. )
)
11 op2ndg 6301 . . . . 5  |-  ( ( F  e.  ZZ  /\  L  e.  ZZ )  ->  ( 2nd `  <. F ,  L >. )  =  L )
12113adant1 975 . . . 4  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  ( 2nd `  <. F ,  L >. )  =  L )
1310, 12sylan9eqr 2443 . . 3  |-  ( ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  /\  ( s  =  S  /\  b  = 
<. F ,  L >. ) )  ->  ( 2nd `  b )  =  L )
14 simp2 958 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  ( 1st `  b )  =  F )
15 simp3 959 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  ( 2nd `  b )  =  L )
1614, 15oveq12d 6040 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
( 1st `  b
)..^ ( 2nd `  b
) )  =  ( F..^ L ) )
17 simp1 957 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  s  =  S )
1817dmeqd 5014 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  dom  s  =  dom  S )
1916, 18sseq12d 3322 . . . 4  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
( ( 1st `  b
)..^ ( 2nd `  b
) )  C_  dom  s 
<->  ( F..^ L ) 
C_  dom  S )
)
2015, 14oveq12d 6040 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
( 2nd `  b
)  -  ( 1st `  b ) )  =  ( L  -  F
) )
2120oveq2d 6038 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
0..^ ( ( 2nd `  b )  -  ( 1st `  b ) ) )  =  ( 0..^ ( L  -  F
) ) )
2214oveq2d 6038 . . . . . 6  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
x  +  ( 1st `  b ) )  =  ( x  +  F
) )
2317, 22fveq12d 5676 . . . . 5  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (
s `  ( x  +  ( 1st `  b
) ) )  =  ( S `  (
x  +  F ) ) )
2421, 23mpteq12dv 4230 . . . 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 2390 . . . 4  |-  ( ( s  =  S  /\  ( 1st `  b )  =  F  /\  ( 2nd `  b )  =  L )  ->  (/)  =  (/) )
2619, 24, 25ifbieq12d 3706 . . 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 1184 . 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 2909 . . 3  |-  ( S  e.  V  ->  S  e.  _V )
29283ad2ant1 978 . 2  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  S  e.  _V )
30 opelxpi 4852 . . 3  |-  ( ( F  e.  ZZ  /\  L  e.  ZZ )  -> 
<. F ,  L >.  e.  ( ZZ  X.  ZZ ) )
31303adant1 975 . 2  |-  ( ( S  e.  V  /\  F  e.  ZZ  /\  L  e.  ZZ )  ->  <. F ,  L >.  e.  ( ZZ 
X.  ZZ ) )
32 ovex 6047 . . . . 5  |-  ( 0..^ ( L  -  F
) )  e.  _V
3332mptex 5907 . . . 4  |-  ( x  e.  ( 0..^ ( L  -  F ) )  |->  ( S `  ( x  +  F
) ) )  e. 
_V
34 0ex 4282 . . . 4  |-  (/)  e.  _V
3533, 34ifex 3742 . . 3  |-  if ( ( F..^ L ) 
C_  dom  S , 
( x  e.  ( 0..^ ( L  -  F ) )  |->  ( S `  ( x  +  F ) ) ) ,  (/) )  e. 
_V
3635a1i 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 )
372, 27, 29, 31, 36ovmpt2d 6142 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 359    /\ w3a 936    = wceq 1649    e. wcel 1717   _Vcvv 2901    C_ wss 3265   (/)c0 3573   ifcif 3684   <.cop 3762    e. cmpt 4209    X. cxp 4818   dom cdm 4820   ` cfv 5396  (class class class)co 6022    e. cmpt2 6024   1stc1st 6288   2ndc2nd 6289   0cc0 8925    + caddc 8928    - cmin 9225   ZZcz 10216  ..^cfzo 11067   substr csubstr 11649
This theorem is referenced by:  swrd00  11694  swrdcl  11695  swrdval2  11696
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1552  ax-5 1563  ax-17 1623  ax-9 1661  ax-8 1682  ax-13 1719  ax-14 1721  ax-6 1736  ax-7 1741  ax-11 1753  ax-12 1939  ax-ext 2370  ax-rep 4263  ax-sep 4273  ax-nul 4281  ax-pow 4320  ax-pr 4346  ax-un 4643
This theorem depends on definitions:  df-bi 178  df-or 360  df-an 361  df-3an 938  df-tru 1325  df-ex 1548  df-nf 1551  df-sb 1656  df-eu 2244  df-mo 2245  df-clab 2376  df-cleq 2382  df-clel 2385  df-nfc 2514  df-ne 2554  df-ral 2656  df-rex 2657  df-reu 2658  df-rab 2660  df-v 2903  df-sbc 3107  df-csb 3197  df-dif 3268  df-un 3270  df-in 3272  df-ss 3279  df-nul 3574  df-if 3685  df-sn 3765  df-pr 3766  df-op 3768  df-uni 3960  df-iun 4039  df-br 4156  df-opab 4210  df-mpt 4211  df-id 4441  df-xp 4826  df-rel 4827  df-cnv 4828  df-co 4829  df-dm 4830  df-rn 4831  df-res 4832  df-ima 4833  df-iota 5360  df-fun 5398  df-fn 5399  df-f 5400  df-f1 5401  df-fo 5402  df-f1o 5403  df-fv 5404  df-ov 6025  df-oprab 6026  df-mpt2 6027  df-1st 6290  df-2nd 6291  df-substr 11655
  Copyright terms: Public domain W3C validator