Metamath Proof Explorer


Theorem splval2

Description: Value of a splice, assuming the input word S has already been decomposed into its pieces. (Contributed by Mario Carneiro, 1-Oct-2015) (Proof shortened by AV, 15-Oct-2022)

Ref Expression
Hypotheses splval2.a φ A Word X
splval2.b φ B Word X
splval2.c φ C Word X
splval2.r φ R Word X
splval2.s φ S = A ++ B ++ C
splval2.f φ F = A
splval2.t φ T = F + B
Assertion splval2 φ S splice F T R = A ++ R ++ C

Proof

Step Hyp Ref Expression
1 splval2.a φ A Word X
2 splval2.b φ B Word X
3 splval2.c φ C Word X
4 splval2.r φ R Word X
5 splval2.s φ S = A ++ B ++ C
6 splval2.f φ F = A
7 splval2.t φ T = F + B
8 ccatcl A Word X B Word X A ++ B Word X
9 1 2 8 syl2anc φ A ++ B Word X
10 ccatcl A ++ B Word X C Word X A ++ B ++ C Word X
11 9 3 10 syl2anc φ A ++ B ++ C Word X
12 5 11 eqeltrd φ S Word X
13 lencl A Word X A 0
14 1 13 syl φ A 0
15 6 14 eqeltrd φ F 0
16 lencl B Word X B 0
17 2 16 syl φ B 0
18 15 17 nn0addcld φ F + B 0
19 7 18 eqeltrd φ T 0
20 splval S Word X F 0 T 0 R Word X S splice F T R = S prefix F ++ R ++ S substr T S
21 12 15 19 4 20 syl13anc φ S splice F T R = S prefix F ++ R ++ S substr T S
22 nn0uz 0 = 0
23 15 22 eleqtrdi φ F 0
24 15 nn0zd φ F
25 24 uzidd φ F F
26 uzaddcl F F B 0 F + B F
27 25 17 26 syl2anc φ F + B F
28 7 27 eqeltrd φ T F
29 elfzuzb F 0 T F 0 T F
30 23 28 29 sylanbrc φ F 0 T
31 19 22 eleqtrdi φ T 0
32 ccatlen A ++ B Word X C Word X A ++ B ++ C = A ++ B + C
33 9 3 32 syl2anc φ A ++ B ++ C = A ++ B + C
34 5 fveq2d φ S = A ++ B ++ C
35 6 oveq1d φ F + B = A + B
36 ccatlen A Word X B Word X A ++ B = A + B
37 1 2 36 syl2anc φ A ++ B = A + B
38 35 7 37 3eqtr4d φ T = A ++ B
39 38 oveq1d φ T + C = A ++ B + C
40 33 34 39 3eqtr4d φ S = T + C
41 19 nn0zd φ T
42 41 uzidd φ T T
43 lencl C Word X C 0
44 3 43 syl φ C 0
45 uzaddcl T T C 0 T + C T
46 42 44 45 syl2anc φ T + C T
47 40 46 eqeltrd φ S T
48 elfzuzb T 0 S T 0 S T
49 31 47 48 sylanbrc φ T 0 S
50 ccatpfx S Word X F 0 T T 0 S S prefix F ++ S substr F T = S prefix T
51 12 30 49 50 syl3anc φ S prefix F ++ S substr F T = S prefix T
52 lencl S Word X S 0
53 12 52 syl φ S 0
54 53 22 eleqtrdi φ S 0
55 eluzfz2 S 0 S 0 S
56 54 55 syl φ S 0 S
57 ccatpfx S Word X T 0 S S 0 S S prefix T ++ S substr T S = S prefix S
58 12 49 56 57 syl3anc φ S prefix T ++ S substr T S = S prefix S
59 pfxid S Word X S prefix S = S
60 12 59 syl φ S prefix S = S
61 58 60 5 3eqtrd φ S prefix T ++ S substr T S = A ++ B ++ C
62 pfxcl S Word X S prefix T Word X
63 12 62 syl φ S prefix T Word X
64 swrdcl S Word X S substr T S Word X
65 12 64 syl φ S substr T S Word X
66 pfxlen S Word X T 0 S S prefix T = T
67 12 49 66 syl2anc φ S prefix T = T
68 67 38 eqtrd φ S prefix T = A ++ B
69 ccatopth S prefix T Word X S substr T S Word X A ++ B Word X C Word X S prefix T = A ++ B S prefix T ++ S substr T S = A ++ B ++ C S prefix T = A ++ B S substr T S = C
70 63 65 9 3 68 69 syl221anc φ S prefix T ++ S substr T S = A ++ B ++ C S prefix T = A ++ B S substr T S = C
71 61 70 mpbid φ S prefix T = A ++ B S substr T S = C
72 71 simpld φ S prefix T = A ++ B
73 51 72 eqtrd φ S prefix F ++ S substr F T = A ++ B
74 pfxcl S Word X S prefix F Word X
75 12 74 syl φ S prefix F Word X
76 swrdcl S Word X S substr F T Word X
77 12 76 syl φ S substr F T Word X
78 uztrn S T T F S F
79 47 28 78 syl2anc φ S F
80 elfzuzb F 0 S F 0 S F
81 23 79 80 sylanbrc φ F 0 S
82 pfxlen S Word X F 0 S S prefix F = F
83 12 81 82 syl2anc φ S prefix F = F
84 83 6 eqtrd φ S prefix F = A
85 ccatopth S prefix F Word X S substr F T Word X A Word X B Word X S prefix F = A S prefix F ++ S substr F T = A ++ B S prefix F = A S substr F T = B
86 75 77 1 2 84 85 syl221anc φ S prefix F ++ S substr F T = A ++ B S prefix F = A S substr F T = B
87 73 86 mpbid φ S prefix F = A S substr F T = B
88 87 simpld φ S prefix F = A
89 88 oveq1d φ S prefix F ++ R = A ++ R
90 71 simprd φ S substr T S = C
91 89 90 oveq12d φ S prefix F ++ R ++ S substr T S = A ++ R ++ C
92 21 91 eqtrd φ S splice F T R = A ++ R ++ C