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

Theorem 2swrdeqwrdeq 12809
Description: Two words are equal if and only if they have the same prefix and the same suffix. (Contributed by Alexander van der Vekens, 23-Sep-2018.)
Assertion
Ref Expression
2swrdeqwrdeq  |-  ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W ) ) )  ->  ( W  =  S  <->  ( ( # `  W )  =  (
# `  S )  /\  ( ( W substr  <. 0 ,  I >. )  =  ( S substr  <. 0 ,  I >. )  /\  ( W substr  <. I ,  ( # `  W ) >. )  =  ( S substr  <. I ,  ( # `  W
) >. ) ) ) ) )

Proof of Theorem 2swrdeqwrdeq
Dummy variable  i is distinct from all other variables.
StepHypRef Expression
1 eqwrd 12708 . . 3  |-  ( ( W  e. Word  V  /\  S  e. Word  V )  ->  ( W  =  S  <-> 
( ( # `  W
)  =  ( # `  S )  /\  A. i  e.  ( 0..^ ( # `  W
) ) ( W `
 i )  =  ( S `  i
) ) ) )
213adant3 1028 . 2  |-  ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W ) ) )  ->  ( W  =  S  <->  ( ( # `  W )  =  (
# `  S )  /\  A. i  e.  ( 0..^ ( # `  W
) ) ( W `
 i )  =  ( S `  i
) ) ) )
3 elfzofz 11935 . . . . . . . . 9  |-  ( I  e.  ( 0..^ (
# `  W )
)  ->  I  e.  ( 0 ... ( # `
 W ) ) )
4 fzosplit 11951 . . . . . . . . 9  |-  ( I  e.  ( 0 ... ( # `  W
) )  ->  (
0..^ ( # `  W
) )  =  ( ( 0..^ I )  u.  ( I..^ (
# `  W )
) ) )
53, 4syl 17 . . . . . . . 8  |-  ( I  e.  ( 0..^ (
# `  W )
)  ->  ( 0..^ ( # `  W
) )  =  ( ( 0..^ I )  u.  ( I..^ (
# `  W )
) ) )
653ad2ant3 1031 . . . . . . 7  |-  ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W ) ) )  ->  ( 0..^ (
# `  W )
)  =  ( ( 0..^ I )  u.  ( I..^ ( # `  W ) ) ) )
76adantr 467 . . . . . 6  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  (
0..^ ( # `  W
) )  =  ( ( 0..^ I )  u.  ( I..^ (
# `  W )
) ) )
87raleqdv 2993 . . . . 5  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  ( A. i  e.  (
0..^ ( # `  W
) ) ( W `
 i )  =  ( S `  i
)  <->  A. i  e.  ( ( 0..^ I )  u.  ( I..^ (
# `  W )
) ) ( W `
 i )  =  ( S `  i
) ) )
9 ralunb 3615 . . . . 5  |-  ( A. i  e.  ( (
0..^ I )  u.  ( I..^ ( # `  W ) ) ) ( W `  i
)  =  ( S `
 i )  <->  ( A. i  e.  ( 0..^ I ) ( W `
 i )  =  ( S `  i
)  /\  A. i  e.  ( I..^ ( # `  W ) ) ( W `  i )  =  ( S `  i ) ) )
108, 9syl6bb 265 . . . 4  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  ( A. i  e.  (
0..^ ( # `  W
) ) ( W `
 i )  =  ( S `  i
)  <->  ( A. i  e.  ( 0..^ I ) ( W `  i
)  =  ( S `
 i )  /\  A. i  e.  ( I..^ ( # `  W
) ) ( W `
 i )  =  ( S `  i
) ) ) )
11 3simpa 1005 . . . . . . 7  |-  ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W ) ) )  ->  ( W  e. Word  V  /\  S  e. Word  V
) )
1211adantr 467 . . . . . 6  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  ( W  e. Word  V  /\  S  e. Word  V ) )
13 elfzonn0 11960 . . . . . . . . 9  |-  ( I  e.  ( 0..^ (
# `  W )
)  ->  I  e.  NN0 )
14133ad2ant3 1031 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W ) ) )  ->  I  e.  NN0 )
1514adantr 467 . . . . . . 7  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  I  e.  NN0 )
16 0nn0 10884 . . . . . . 7  |-  0  e.  NN0
1715, 16jctil 540 . . . . . 6  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  (
0  e.  NN0  /\  I  e.  NN0 ) )
18 elfzo0le 11959 . . . . . . . 8  |-  ( I  e.  ( 0..^ (
# `  W )
)  ->  I  <_  (
# `  W )
)
19183ad2ant3 1031 . . . . . . 7  |-  ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W ) ) )  ->  I  <_  ( # `
 W ) )
2019adantr 467 . . . . . 6  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  I  <_  ( # `  W
) )
21 breq2 4406 . . . . . . . 8  |-  ( (
# `  W )  =  ( # `  S
)  ->  ( I  <_  ( # `  W
)  <->  I  <_  ( # `  S ) ) )
2221adantl 468 . . . . . . 7  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  (
I  <_  ( # `  W
)  <->  I  <_  ( # `  S ) ) )
2320, 22mpbid 214 . . . . . 6  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  I  <_  ( # `  S
) )
24 swrdspsleq 12805 . . . . . . 7  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V )  /\  ( 0  e. 
NN0  /\  I  e.  NN0 )  /\  ( I  <_  ( # `  W
)  /\  I  <_  (
# `  S )
) )  ->  (
( W substr  <. 0 ,  I >. )  =  ( S substr  <. 0 ,  I >. )  <->  A. i  e.  ( 0..^ I ) ( W `  i )  =  ( S `  i ) ) )
2524bicomd 205 . . . . . 6  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V )  /\  ( 0  e. 
NN0  /\  I  e.  NN0 )  /\  ( I  <_  ( # `  W
)  /\  I  <_  (
# `  S )
) )  ->  ( A. i  e.  (
0..^ I ) ( W `  i )  =  ( S `  i )  <->  ( W substr  <.
0 ,  I >. )  =  ( S substr  <. 0 ,  I >. ) ) )
2612, 17, 20, 23, 25syl112anc 1272 . . . . 5  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  ( A. i  e.  (
0..^ I ) ( W `  i )  =  ( S `  i )  <->  ( W substr  <.
0 ,  I >. )  =  ( S substr  <. 0 ,  I >. ) ) )
27 lencl 12687 . . . . . . . . 9  |-  ( W  e. Word  V  ->  ( # `
 W )  e. 
NN0 )
28273ad2ant1 1029 . . . . . . . 8  |-  ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W ) ) )  ->  ( # `  W
)  e.  NN0 )
2914, 28jca 535 . . . . . . 7  |-  ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W ) ) )  ->  ( I  e. 
NN0  /\  ( # `  W
)  e.  NN0 )
)
3029adantr 467 . . . . . 6  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  (
I  e.  NN0  /\  ( # `  W )  e.  NN0 ) )
31 nn0re 10878 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( # `  W
)  e.  RR )
3231leidd 10180 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( # `  W
)  <_  ( # `  W
) )
3327, 32syl 17 . . . . . . . 8  |-  ( W  e. Word  V  ->  ( # `
 W )  <_ 
( # `  W ) )
34333ad2ant1 1029 . . . . . . 7  |-  ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W ) ) )  ->  ( # `  W
)  <_  ( # `  W
) )
3534adantr 467 . . . . . 6  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  ( # `
 W )  <_ 
( # `  W ) )
36 breq2 4406 . . . . . . . 8  |-  ( (
# `  W )  =  ( # `  S
)  ->  ( ( # `
 W )  <_ 
( # `  W )  <-> 
( # `  W )  <_  ( # `  S
) ) )
3736adantl 468 . . . . . . 7  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  (
( # `  W )  <_  ( # `  W
)  <->  ( # `  W
)  <_  ( # `  S
) ) )
3835, 37mpbid 214 . . . . . 6  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  ( # `
 W )  <_ 
( # `  S ) )
39 swrdspsleq 12805 . . . . . . 7  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V )  /\  ( I  e. 
NN0  /\  ( # `  W
)  e.  NN0 )  /\  ( ( # `  W
)  <_  ( # `  W
)  /\  ( # `  W
)  <_  ( # `  S
) ) )  -> 
( ( W substr  <. I ,  ( # `  W
) >. )  =  ( S substr  <. I ,  (
# `  W ) >. )  <->  A. i  e.  ( I..^ ( # `  W
) ) ( W `
 i )  =  ( S `  i
) ) )
4039bicomd 205 . . . . . 6  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V )  /\  ( I  e. 
NN0  /\  ( # `  W
)  e.  NN0 )  /\  ( ( # `  W
)  <_  ( # `  W
)  /\  ( # `  W
)  <_  ( # `  S
) ) )  -> 
( A. i  e.  ( I..^ ( # `  W ) ) ( W `  i )  =  ( S `  i )  <->  ( W substr  <.
I ,  ( # `  W ) >. )  =  ( S substr  <. I ,  ( # `  W
) >. ) ) )
4112, 30, 35, 38, 40syl112anc 1272 . . . . 5  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  ( A. i  e.  (
I..^ ( # `  W
) ) ( W `
 i )  =  ( S `  i
)  <->  ( W substr  <. I ,  ( # `  W
) >. )  =  ( S substr  <. I ,  (
# `  W ) >. ) ) )
4226, 41anbi12d 717 . . . 4  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  (
( A. i  e.  ( 0..^ I ) ( W `  i
)  =  ( S `
 i )  /\  A. i  e.  ( I..^ ( # `  W
) ) ( W `
 i )  =  ( S `  i
) )  <->  ( ( W substr  <. 0 ,  I >. )  =  ( S substr  <. 0 ,  I >. )  /\  ( W substr  <. I ,  ( # `  W
) >. )  =  ( S substr  <. I ,  (
# `  W ) >. ) ) ) )
4310, 42bitrd 257 . . 3  |-  ( ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W
) ) )  /\  ( # `  W )  =  ( # `  S
) )  ->  ( A. i  e.  (
0..^ ( # `  W
) ) ( W `
 i )  =  ( S `  i
)  <->  ( ( W substr  <. 0 ,  I >. )  =  ( S substr  <. 0 ,  I >. )  /\  ( W substr  <. I ,  (
# `  W ) >. )  =  ( S substr  <. I ,  ( # `  W ) >. )
) ) )
4443pm5.32da 647 . 2  |-  ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W ) ) )  ->  ( ( (
# `  W )  =  ( # `  S
)  /\  A. i  e.  ( 0..^ ( # `  W ) ) ( W `  i )  =  ( S `  i ) )  <->  ( ( # `
 W )  =  ( # `  S
)  /\  ( ( W substr  <. 0 ,  I >. )  =  ( S substr  <. 0 ,  I >. )  /\  ( W substr  <. I ,  ( # `  W
) >. )  =  ( S substr  <. I ,  (
# `  W ) >. ) ) ) ) )
452, 44bitrd 257 1  |-  ( ( W  e. Word  V  /\  S  e. Word  V  /\  I  e.  ( 0..^ ( # `  W ) ) )  ->  ( W  =  S  <->  ( ( # `  W )  =  (
# `  S )  /\  ( ( W substr  <. 0 ,  I >. )  =  ( S substr  <. 0 ,  I >. )  /\  ( W substr  <. I ,  ( # `  W ) >. )  =  ( S substr  <. I ,  ( # `  W
) >. ) ) ) ) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    <-> wb 188    /\ wa 371    /\ w3a 985    = wceq 1444    e. wcel 1887   A.wral 2737    u. cun 3402   <.cop 3974   class class class wbr 4402   ` cfv 5582  (class class class)co 6290   0cc0 9539    <_ cle 9676   NN0cn0 10869   ...cfz 11784  ..^cfzo 11915   #chash 12515  Word cword 12656   substr csubstr 12660
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1669  ax-4 1682  ax-5 1758  ax-6 1805  ax-7 1851  ax-8 1889  ax-9 1896  ax-10 1915  ax-11 1920  ax-12 1933  ax-13 2091  ax-ext 2431  ax-rep 4515  ax-sep 4525  ax-nul 4534  ax-pow 4581  ax-pr 4639  ax-un 6583  ax-cnex 9595  ax-resscn 9596  ax-1cn 9597  ax-icn 9598  ax-addcl 9599  ax-addrcl 9600  ax-mulcl 9601  ax-mulrcl 9602  ax-mulcom 9603  ax-addass 9604  ax-mulass 9605  ax-distr 9606  ax-i2m1 9607  ax-1ne0 9608  ax-1rid 9609  ax-rnegex 9610  ax-rrecex 9611  ax-cnre 9612  ax-pre-lttri 9613  ax-pre-lttrn 9614  ax-pre-ltadd 9615  ax-pre-mulgt0 9616
This theorem depends on definitions:  df-bi 189  df-or 372  df-an 373  df-3or 986  df-3an 987  df-tru 1447  df-fal 1450  df-ex 1664  df-nf 1668  df-sb 1798  df-eu 2303  df-mo 2304  df-clab 2438  df-cleq 2444  df-clel 2447  df-nfc 2581  df-ne 2624  df-nel 2625  df-ral 2742  df-rex 2743  df-reu 2744  df-rmo 2745  df-rab 2746  df-v 3047  df-sbc 3268  df-csb 3364  df-dif 3407  df-un 3409  df-in 3411  df-ss 3418  df-pss 3420  df-nul 3732  df-if 3882  df-pw 3953  df-sn 3969  df-pr 3971  df-tp 3973  df-op 3975  df-uni 4199  df-int 4235  df-iun 4280  df-br 4403  df-opab 4462  df-mpt 4463  df-tr 4498  df-eprel 4745  df-id 4749  df-po 4755  df-so 4756  df-fr 4793  df-we 4795  df-xp 4840  df-rel 4841  df-cnv 4842  df-co 4843  df-dm 4844  df-rn 4845  df-res 4846  df-ima 4847  df-pred 5380  df-ord 5426  df-on 5427  df-lim 5428  df-suc 5429  df-iota 5546  df-fun 5584  df-fn 5585  df-f 5586  df-f1 5587  df-fo 5588  df-f1o 5589  df-fv 5590  df-riota 6252  df-ov 6293  df-oprab 6294  df-mpt2 6295  df-om 6693  df-1st 6793  df-2nd 6794  df-wrecs 7028  df-recs 7090  df-rdg 7128  df-1o 7182  df-oadd 7186  df-er 7363  df-en 7570  df-dom 7571  df-sdom 7572  df-fin 7573  df-card 8373  df-cda 8598  df-pnf 9677  df-mnf 9678  df-xr 9679  df-ltxr 9680  df-le 9681  df-sub 9862  df-neg 9863  df-nn 10610  df-2 10668  df-n0 10870  df-z 10938  df-uz 11160  df-fz 11785  df-fzo 11916  df-hash 12516  df-word 12664  df-substr 12668
This theorem is referenced by:  2swrd1eqwrdeq  12810  2swrd2eqwrdeq  13028
  Copyright terms: Public domain W3C validator