Metamath Proof Explorer


Theorem ccatpfx

Description: Concatenating a prefix with an adjacent subword makes a longer prefix. (Contributed by AV, 7-May-2020)

Ref Expression
Assertion ccatpfx SWordAY0ZZ0SSprefixY++SsubstrYZ=SprefixZ

Proof

Step Hyp Ref Expression
1 pfxcl SWordASprefixYWordA
2 swrdcl SWordASsubstrYZWordA
3 ccatcl SprefixYWordASsubstrYZWordASprefixY++SsubstrYZWordA
4 1 2 3 syl2anc SWordASprefixY++SsubstrYZWordA
5 wrdfn SprefixY++SsubstrYZWordASprefixY++SsubstrYZFn0..^SprefixY++SsubstrYZ
6 4 5 syl SWordASprefixY++SsubstrYZFn0..^SprefixY++SsubstrYZ
7 6 adantr SWordAY0ZZ0SSprefixY++SsubstrYZFn0..^SprefixY++SsubstrYZ
8 ccatlen SprefixYWordASsubstrYZWordASprefixY++SsubstrYZ=SprefixY+SsubstrYZ
9 1 2 8 syl2anc SWordASprefixY++SsubstrYZ=SprefixY+SsubstrYZ
10 9 adantr SWordAY0ZZ0SSprefixY++SsubstrYZ=SprefixY+SsubstrYZ
11 fzass4 Y0SZYSY0ZZ0S
12 11 biimpri Y0ZZ0SY0SZYS
13 12 simpld Y0ZZ0SY0S
14 pfxlen SWordAY0SSprefixY=Y
15 13 14 sylan2 SWordAY0ZZ0SSprefixY=Y
16 swrdlen SWordAY0ZZ0SSsubstrYZ=ZY
17 16 3expb SWordAY0ZZ0SSsubstrYZ=ZY
18 15 17 oveq12d SWordAY0ZZ0SSprefixY+SsubstrYZ=Y+Z-Y
19 elfzelz Y0ZY
20 19 zcnd Y0ZY
21 elfzelz Z0SZ
22 21 zcnd Z0SZ
23 pncan3 YZY+Z-Y=Z
24 20 22 23 syl2an Y0ZZ0SY+Z-Y=Z
25 24 adantl SWordAY0ZZ0SY+Z-Y=Z
26 10 18 25 3eqtrd SWordAY0ZZ0SSprefixY++SsubstrYZ=Z
27 26 oveq2d SWordAY0ZZ0S0..^SprefixY++SsubstrYZ=0..^Z
28 27 fneq2d SWordAY0ZZ0SSprefixY++SsubstrYZFn0..^SprefixY++SsubstrYZSprefixY++SsubstrYZFn0..^Z
29 7 28 mpbid SWordAY0ZZ0SSprefixY++SsubstrYZFn0..^Z
30 pfxfn SWordAZ0SSprefixZFn0..^Z
31 30 adantrl SWordAY0ZZ0SSprefixZFn0..^Z
32 id x0..^Zx0..^Z
33 19 ad2antrl SWordAY0ZZ0SY
34 fzospliti x0..^ZYx0..^YxY..^Z
35 32 33 34 syl2anr SWordAY0ZZ0Sx0..^Zx0..^YxY..^Z
36 1 ad2antrr SWordAY0ZZ0Sx0..^YSprefixYWordA
37 2 ad2antrr SWordAY0ZZ0Sx0..^YSsubstrYZWordA
38 15 oveq2d SWordAY0ZZ0S0..^SprefixY=0..^Y
39 38 eleq2d SWordAY0ZZ0Sx0..^SprefixYx0..^Y
40 39 biimpar SWordAY0ZZ0Sx0..^Yx0..^SprefixY
41 ccatval1 SprefixYWordASsubstrYZWordAx0..^SprefixYSprefixY++SsubstrYZx=SprefixYx
42 36 37 40 41 syl3anc SWordAY0ZZ0Sx0..^YSprefixY++SsubstrYZx=SprefixYx
43 simpl SWordAY0ZZ0SSWordA
44 13 adantl SWordAY0ZZ0SY0S
45 id x0..^Yx0..^Y
46 pfxfv SWordAY0Sx0..^YSprefixYx=Sx
47 43 44 45 46 syl2an3an SWordAY0ZZ0Sx0..^YSprefixYx=Sx
48 42 47 eqtrd SWordAY0ZZ0Sx0..^YSprefixY++SsubstrYZx=Sx
49 1 ad2antrr SWordAY0ZZ0SxY..^ZSprefixYWordA
50 2 ad2antrr SWordAY0ZZ0SxY..^ZSsubstrYZWordA
51 18 25 eqtrd SWordAY0ZZ0SSprefixY+SsubstrYZ=Z
52 15 51 oveq12d SWordAY0ZZ0SSprefixY..^SprefixY+SsubstrYZ=Y..^Z
53 52 eleq2d SWordAY0ZZ0SxSprefixY..^SprefixY+SsubstrYZxY..^Z
54 53 biimpar SWordAY0ZZ0SxY..^ZxSprefixY..^SprefixY+SsubstrYZ
55 ccatval2 SprefixYWordASsubstrYZWordAxSprefixY..^SprefixY+SsubstrYZSprefixY++SsubstrYZx=SsubstrYZxSprefixY
56 49 50 54 55 syl3anc SWordAY0ZZ0SxY..^ZSprefixY++SsubstrYZx=SsubstrYZxSprefixY
57 id SWordAY0ZZ0SSWordAY0ZZ0S
58 57 3expb SWordAY0ZZ0SSWordAY0ZZ0S
59 15 oveq2d SWordAY0ZZ0SxSprefixY=xY
60 59 adantr SWordAY0ZZ0SxY..^ZxSprefixY=xY
61 id xY..^ZxY..^Z
62 fzosubel xY..^ZYxYYY..^ZY
63 61 33 62 syl2anr SWordAY0ZZ0SxY..^ZxYYY..^ZY
64 20 subidd Y0ZYY=0
65 64 oveq1d Y0ZYY..^ZY=0..^ZY
66 65 eleq2d Y0ZxYYY..^ZYxY0..^ZY
67 66 ad2antrl SWordAY0ZZ0SxYYY..^ZYxY0..^ZY
68 67 adantr SWordAY0ZZ0SxY..^ZxYYY..^ZYxY0..^ZY
69 63 68 mpbid SWordAY0ZZ0SxY..^ZxY0..^ZY
70 60 69 eqeltrd SWordAY0ZZ0SxY..^ZxSprefixY0..^ZY
71 swrdfv SWordAY0ZZ0SxSprefixY0..^ZYSsubstrYZxSprefixY=Sx-SprefixY+Y
72 58 70 71 syl2an2r SWordAY0ZZ0SxY..^ZSsubstrYZxSprefixY=Sx-SprefixY+Y
73 59 oveq1d SWordAY0ZZ0Sx-SprefixY+Y=x-Y+Y
74 73 adantr SWordAY0ZZ0SxY..^Zx-SprefixY+Y=x-Y+Y
75 elfzoelz xY..^Zx
76 75 zcnd xY..^Zx
77 20 ad2antrl SWordAY0ZZ0SY
78 npcan xYx-Y+Y=x
79 76 77 78 syl2anr SWordAY0ZZ0SxY..^Zx-Y+Y=x
80 74 79 eqtrd SWordAY0ZZ0SxY..^Zx-SprefixY+Y=x
81 80 fveq2d SWordAY0ZZ0SxY..^ZSx-SprefixY+Y=Sx
82 56 72 81 3eqtrd SWordAY0ZZ0SxY..^ZSprefixY++SsubstrYZx=Sx
83 48 82 jaodan SWordAY0ZZ0Sx0..^YxY..^ZSprefixY++SsubstrYZx=Sx
84 35 83 syldan SWordAY0ZZ0Sx0..^ZSprefixY++SsubstrYZx=Sx
85 pfxfv SWordAZ0Sx0..^ZSprefixZx=Sx
86 85 3expa SWordAZ0Sx0..^ZSprefixZx=Sx
87 86 adantlrl SWordAY0ZZ0Sx0..^ZSprefixZx=Sx
88 84 87 eqtr4d SWordAY0ZZ0Sx0..^ZSprefixY++SsubstrYZx=SprefixZx
89 29 31 88 eqfnfvd SWordAY0ZZ0SSprefixY++SsubstrYZ=SprefixZ
90 89 3impb SWordAY0ZZ0SSprefixY++SsubstrYZ=SprefixZ