Metamath Proof Explorer


Theorem spllen

Description: The length of a splice. (Contributed by Stefan O'Rear, 23-Aug-2015) (Proof shortened by AV, 15-Oct-2022)

Ref Expression
Hypotheses spllen.s φ S Word A
spllen.f φ F 0 T
spllen.t φ T 0 S
spllen.r φ R Word A
Assertion spllen φ S splice F T R = S + R - T F

Proof

Step Hyp Ref Expression
1 spllen.s φ S Word A
2 spllen.f φ F 0 T
3 spllen.t φ T 0 S
4 spllen.r φ R Word A
5 splval S Word A F 0 T T 0 S R Word A S splice F T R = S prefix F ++ R ++ S substr T S
6 1 2 3 4 5 syl13anc φ S splice F T R = S prefix F ++ R ++ S substr T S
7 6 fveq2d φ S splice F T R = S prefix F ++ R ++ S substr T S
8 pfxcl S Word A S prefix F Word A
9 1 8 syl φ S prefix F Word A
10 ccatcl S prefix F Word A R Word A S prefix F ++ R Word A
11 9 4 10 syl2anc φ S prefix F ++ R Word A
12 swrdcl S Word A S substr T S Word A
13 1 12 syl φ S substr T S Word A
14 ccatlen S prefix F ++ R Word A S substr T S Word A S prefix F ++ R ++ S substr T S = S prefix F ++ R + S substr T S
15 11 13 14 syl2anc φ S prefix F ++ R ++ S substr T S = S prefix F ++ R + S substr T S
16 lencl R Word A R 0
17 16 nn0cnd R Word A R
18 4 17 syl φ R
19 elfzelz F 0 T F
20 19 zcnd F 0 T F
21 2 20 syl φ F
22 18 21 addcld φ R + F
23 elfzel2 T 0 S S
24 23 zcnd T 0 S S
25 3 24 syl φ S
26 elfzelz T 0 S T
27 26 zcnd T 0 S T
28 3 27 syl φ T
29 22 25 28 addsub12d φ R + F + S T = S + R + F - T
30 ccatlen S prefix F Word A R Word A S prefix F ++ R = S prefix F + R
31 9 4 30 syl2anc φ S prefix F ++ R = S prefix F + R
32 elfzuz F 0 T F 0
33 2 32 syl φ F 0
34 elfzuz3 T 0 S S T
35 3 34 syl φ S T
36 elfzuz3 F 0 T T F
37 2 36 syl φ T F
38 uztrn S T T F S F
39 35 37 38 syl2anc φ S F
40 elfzuzb F 0 S F 0 S F
41 33 39 40 sylanbrc φ F 0 S
42 pfxlen S Word A F 0 S S prefix F = F
43 1 41 42 syl2anc φ S prefix F = F
44 43 oveq1d φ S prefix F + R = F + R
45 21 18 addcomd φ F + R = R + F
46 31 44 45 3eqtrd φ S prefix F ++ R = R + F
47 elfzuz2 T 0 S S 0
48 eluzfz2 S 0 S 0 S
49 3 47 48 3syl φ S 0 S
50 swrdlen S Word A T 0 S S 0 S S substr T S = S T
51 1 3 49 50 syl3anc φ S substr T S = S T
52 46 51 oveq12d φ S prefix F ++ R + S substr T S = R + F + S T
53 18 28 21 subsub3d φ R T F = R + F - T
54 53 oveq2d φ S + R - T F = S + R + F - T
55 29 52 54 3eqtr4d φ S prefix F ++ R + S substr T S = S + R - T F
56 7 15 55 3eqtrd φ S splice F T R = S + R - T F