Metamath Proof Explorer


Theorem swrdccat

Description: The subword of a concatenation of two words as concatenation of subwords of the two concatenated words. (Contributed by Alexander van der Vekens, 29-May-2018)

Ref Expression
Hypothesis swrdccatin2.l L = A
Assertion swrdccat A Word V B Word V M 0 N N 0 L + B A ++ B substr M N = A substr M if N L N L ++ B substr if 0 M L M L 0 N L

Proof

Step Hyp Ref Expression
1 swrdccatin2.l L = A
2 1 pfxccat3 A Word V B Word V M 0 N N 0 L + B A ++ B substr M N = if N L A substr M N if L M B substr M L N L A substr M L ++ B prefix N L
3 2 imp A Word V B Word V M 0 N N 0 L + B A ++ B substr M N = if N L A substr M N if L M B substr M L N L A substr M L ++ B prefix N L
4 lencl A Word V A 0
5 4 adantr A Word V B Word V A 0
6 1 eqcomi A = L
7 6 eleq1i A 0 L 0
8 elfz2nn0 M 0 N M 0 N 0 M N
9 iftrue N L if N L N L = N
10 9 adantl A Word V B Word V M 0 N 0 L 0 N L if N L N L = N
11 10 opeq2d A Word V B Word V M 0 N 0 L 0 N L M if N L N L = M N
12 11 oveq2d A Word V B Word V M 0 N 0 L 0 N L A substr M if N L N L = A substr M N
13 iftrue 0 M L if 0 M L M L 0 = M L
14 13 opeq1d 0 M L if 0 M L M L 0 N L = M L N L
15 14 oveq2d 0 M L B substr if 0 M L M L 0 N L = B substr M L N L
16 15 adantr 0 M L A Word V B Word V M 0 N 0 L 0 N L B substr if 0 M L M L 0 N L = B substr M L N L
17 simpr A Word V B Word V B Word V
18 nn0z L 0 L
19 nn0z M 0 M
20 19 adantr M 0 N 0 M
21 zsubcl M L M L
22 20 21 sylan M 0 N 0 L M L
23 nn0z N 0 N
24 23 adantl M 0 N 0 N
25 zsubcl N L N L
26 24 25 sylan M 0 N 0 L N L
27 22 26 jca M 0 N 0 L M L N L
28 18 27 sylan2 M 0 N 0 L 0 M L N L
29 17 28 anim12i A Word V B Word V M 0 N 0 L 0 B Word V M L N L
30 3anass B Word V M L N L B Word V M L N L
31 29 30 sylibr A Word V B Word V M 0 N 0 L 0 B Word V M L N L
32 31 ad2antrl 0 M L A Word V B Word V M 0 N 0 L 0 N L B Word V M L N L
33 nn0re M 0 M
34 nn0re N 0 N
35 33 34 anim12i M 0 N 0 M N
36 nn0re L 0 L
37 subge0 M L 0 M L L M
38 37 adantlr M N L 0 M L L M
39 simpr M N N
40 39 adantr M N L N
41 simpr M N L L
42 simpl M N M
43 42 adantr M N L M
44 letr N L M N L L M N M
45 40 41 43 44 syl3anc M N L N L L M N M
46 45 expcomd M N L L M N L N M
47 38 46 sylbid M N L 0 M L N L N M
48 47 com23 M N L N L 0 M L N M
49 35 36 48 syl2an M 0 N 0 L 0 N L 0 M L N M
50 49 adantl A Word V B Word V M 0 N 0 L 0 N L 0 M L N M
51 50 imp A Word V B Word V M 0 N 0 L 0 N L 0 M L N M
52 51 impcom 0 M L A Word V B Word V M 0 N 0 L 0 N L N M
53 34 adantl M 0 N 0 N
54 53 adantr M 0 N 0 L 0 N
55 33 adantr M 0 N 0 M
56 55 adantr M 0 N 0 L 0 M
57 36 adantl M 0 N 0 L 0 L
58 54 56 57 3jca M 0 N 0 L 0 N M L
59 58 adantl A Word V B Word V M 0 N 0 L 0 N M L
60 59 ad2antrl 0 M L A Word V B Word V M 0 N 0 L 0 N L N M L
61 lesub1 N M L N M N L M L
62 60 61 syl 0 M L A Word V B Word V M 0 N 0 L 0 N L N M N L M L
63 52 62 mpbid 0 M L A Word V B Word V M 0 N 0 L 0 N L N L M L
64 swrdlend B Word V M L N L N L M L B substr M L N L =
65 32 63 64 sylc 0 M L A Word V B Word V M 0 N 0 L 0 N L B substr M L N L =
66 16 65 eqtrd 0 M L A Word V B Word V M 0 N 0 L 0 N L B substr if 0 M L M L 0 N L =
67 iffalse ¬ 0 M L if 0 M L M L 0 = 0
68 67 opeq1d ¬ 0 M L if 0 M L M L 0 N L = 0 N L
69 68 oveq2d ¬ 0 M L B substr if 0 M L M L 0 N L = B substr 0 N L
70 17 adantr A Word V B Word V M 0 N 0 L 0 B Word V
71 70 adantr A Word V B Word V M 0 N 0 L 0 N L B Word V
72 0zd A Word V B Word V M 0 N 0 L 0 N L 0
73 24 18 25 syl2an M 0 N 0 L 0 N L
74 73 adantl A Word V B Word V M 0 N 0 L 0 N L
75 74 adantr A Word V B Word V M 0 N 0 L 0 N L N L
76 71 72 75 3jca A Word V B Word V M 0 N 0 L 0 N L B Word V 0 N L
77 53 36 anim12i M 0 N 0 L 0 N L
78 77 adantl A Word V B Word V M 0 N 0 L 0 N L
79 suble0 N L N L 0 N L
80 78 79 syl A Word V B Word V M 0 N 0 L 0 N L 0 N L
81 80 biimpar A Word V B Word V M 0 N 0 L 0 N L N L 0
82 swrdlend B Word V 0 N L N L 0 B substr 0 N L =
83 76 81 82 sylc A Word V B Word V M 0 N 0 L 0 N L B substr 0 N L =
84 69 83 sylan9eq ¬ 0 M L A Word V B Word V M 0 N 0 L 0 N L B substr if 0 M L M L 0 N L =
85 66 84 pm2.61ian A Word V B Word V M 0 N 0 L 0 N L B substr if 0 M L M L 0 N L =
86 12 85 oveq12d A Word V B Word V M 0 N 0 L 0 N L A substr M if N L N L ++ B substr if 0 M L M L 0 N L = A substr M N ++
87 swrdcl A Word V A substr M N Word V
88 ccatrid A substr M N Word V A substr M N ++ = A substr M N
89 87 88 syl A Word V A substr M N ++ = A substr M N
90 89 adantr A Word V B Word V A substr M N ++ = A substr M N
91 90 adantr A Word V B Word V M 0 N 0 L 0 A substr M N ++ = A substr M N
92 91 adantr A Word V B Word V M 0 N 0 L 0 N L A substr M N ++ = A substr M N
93 86 92 eqtrd A Word V B Word V M 0 N 0 L 0 N L A substr M if N L N L ++ B substr if 0 M L M L 0 N L = A substr M N
94 iffalse ¬ N L if N L N L = L
95 94 3ad2ant2 A Word V B Word V M 0 N 0 L 0 ¬ N L L M if N L N L = L
96 95 opeq2d A Word V B Word V M 0 N 0 L 0 ¬ N L L M M if N L N L = M L
97 96 oveq2d A Word V B Word V M 0 N 0 L 0 ¬ N L L M A substr M if N L N L = A substr M L
98 simpl A Word V B Word V A Word V
99 98 20 18 3anim123i A Word V B Word V M 0 N 0 L 0 A Word V M L
100 99 3expb A Word V B Word V M 0 N 0 L 0 A Word V M L
101 swrdlend A Word V M L L M A substr M L =
102 100 101 syl A Word V B Word V M 0 N 0 L 0 L M A substr M L =
103 102 imp A Word V B Word V M 0 N 0 L 0 L M A substr M L =
104 103 3adant2 A Word V B Word V M 0 N 0 L 0 ¬ N L L M A substr M L =
105 97 104 eqtrd A Word V B Word V M 0 N 0 L 0 ¬ N L L M A substr M if N L N L =
106 55 36 37 syl2an M 0 N 0 L 0 0 M L L M
107 106 biimprd M 0 N 0 L 0 L M 0 M L
108 107 adantl A Word V B Word V M 0 N 0 L 0 L M 0 M L
109 108 imp A Word V B Word V M 0 N 0 L 0 L M 0 M L
110 109 3adant2 A Word V B Word V M 0 N 0 L 0 ¬ N L L M 0 M L
111 110 14 syl A Word V B Word V M 0 N 0 L 0 ¬ N L L M if 0 M L M L 0 N L = M L N L
112 111 oveq2d A Word V B Word V M 0 N 0 L 0 ¬ N L L M B substr if 0 M L M L 0 N L = B substr M L N L
113 105 112 oveq12d A Word V B Word V M 0 N 0 L 0 ¬ N L L M A substr M if N L N L ++ B substr if 0 M L M L 0 N L = ++ B substr M L N L
114 swrdcl B Word V B substr M L N L Word V
115 114 adantl A Word V B Word V B substr M L N L Word V
116 ccatlid B substr M L N L Word V ++ B substr M L N L = B substr M L N L
117 115 116 syl A Word V B Word V ++ B substr M L N L = B substr M L N L
118 117 adantr A Word V B Word V M 0 N 0 L 0 ++ B substr M L N L = B substr M L N L
119 118 3ad2ant1 A Word V B Word V M 0 N 0 L 0 ¬ N L L M ++ B substr M L N L = B substr M L N L
120 113 119 eqtrd A Word V B Word V M 0 N 0 L 0 ¬ N L L M A substr M if N L N L ++ B substr if 0 M L M L 0 N L = B substr M L N L
121 94 3ad2ant2 A Word V B Word V M 0 N 0 L 0 ¬ N L ¬ L M if N L N L = L
122 121 opeq2d A Word V B Word V M 0 N 0 L 0 ¬ N L ¬ L M M if N L N L = M L
123 122 oveq2d A Word V B Word V M 0 N 0 L 0 ¬ N L ¬ L M A substr M if N L N L = A substr M L
124 33 36 37 syl2an M 0 L 0 0 M L L M
125 124 adantlr M 0 N 0 L 0 0 M L L M
126 125 adantl A Word V B Word V M 0 N 0 L 0 0 M L L M
127 126 biimpd A Word V B Word V M 0 N 0 L 0 0 M L L M
128 127 con3dimp A Word V B Word V M 0 N 0 L 0 ¬ L M ¬ 0 M L
129 128 3adant2 A Word V B Word V M 0 N 0 L 0 ¬ N L ¬ L M ¬ 0 M L
130 129 67 syl A Word V B Word V M 0 N 0 L 0 ¬ N L ¬ L M if 0 M L M L 0 = 0
131 130 opeq1d A Word V B Word V M 0 N 0 L 0 ¬ N L ¬ L M if 0 M L M L 0 N L = 0 N L
132 131 oveq2d A Word V B Word V M 0 N 0 L 0 ¬ N L ¬ L M B substr if 0 M L M L 0 N L = B substr 0 N L
133 70 3ad2ant1 A Word V B Word V M 0 N 0 L 0 ¬ N L ¬ L M B Word V
134 simplrr A Word V B Word V M 0 N 0 L 0 ¬ N L L 0
135 simprlr A Word V B Word V M 0 N 0 L 0 N 0
136 135 adantr A Word V B Word V M 0 N 0 L 0 ¬ N L N 0
137 ltnle L N L < N ¬ N L
138 ltle L N L < N L N
139 137 138 sylbird L N ¬ N L L N
140 36 53 139 syl2anr M 0 N 0 L 0 ¬ N L L N
141 140 adantl A Word V B Word V M 0 N 0 L 0 ¬ N L L N
142 141 imp A Word V B Word V M 0 N 0 L 0 ¬ N L L N
143 nn0sub2 L 0 N 0 L N N L 0
144 134 136 142 143 syl3anc A Word V B Word V M 0 N 0 L 0 ¬ N L N L 0
145 144 3adant3 A Word V B Word V M 0 N 0 L 0 ¬ N L ¬ L M N L 0
146 133 145 jca A Word V B Word V M 0 N 0 L 0 ¬ N L ¬ L M B Word V N L 0
147 pfxval B Word V N L 0 B prefix N L = B substr 0 N L
148 146 147 syl A Word V B Word V M 0 N 0 L 0 ¬ N L ¬ L M B prefix N L = B substr 0 N L
149 132 148 eqtr4d A Word V B Word V M 0 N 0 L 0 ¬ N L ¬ L M B substr if 0 M L M L 0 N L = B prefix N L
150 123 149 oveq12d A Word V B Word V M 0 N 0 L 0 ¬ N L ¬ L M A substr M if N L N L ++ B substr if 0 M L M L 0 N L = A substr M L ++ B prefix N L
151 93 120 150 2if2 A Word V B Word V M 0 N 0 L 0 A substr M if N L N L ++ B substr if 0 M L M L 0 N L = if N L A substr M N if L M B substr M L N L A substr M L ++ B prefix N L
152 151 exp32 A Word V B Word V M 0 N 0 L 0 A substr M if N L N L ++ B substr if 0 M L M L 0 N L = if N L A substr M N if L M B substr M L N L A substr M L ++ B prefix N L
153 152 com12 M 0 N 0 A Word V B Word V L 0 A substr M if N L N L ++ B substr if 0 M L M L 0 N L = if N L A substr M N if L M B substr M L N L A substr M L ++ B prefix N L
154 153 3adant3 M 0 N 0 M N A Word V B Word V L 0 A substr M if N L N L ++ B substr if 0 M L M L 0 N L = if N L A substr M N if L M B substr M L N L A substr M L ++ B prefix N L
155 8 154 sylbi M 0 N A Word V B Word V L 0 A substr M if N L N L ++ B substr if 0 M L M L 0 N L = if N L A substr M N if L M B substr M L N L A substr M L ++ B prefix N L
156 155 adantr M 0 N N 0 L + B A Word V B Word V L 0 A substr M if N L N L ++ B substr if 0 M L M L 0 N L = if N L A substr M N if L M B substr M L N L A substr M L ++ B prefix N L
157 156 com13 L 0 A Word V B Word V M 0 N N 0 L + B A substr M if N L N L ++ B substr if 0 M L M L 0 N L = if N L A substr M N if L M B substr M L N L A substr M L ++ B prefix N L
158 7 157 sylbi A 0 A Word V B Word V M 0 N N 0 L + B A substr M if N L N L ++ B substr if 0 M L M L 0 N L = if N L A substr M N if L M B substr M L N L A substr M L ++ B prefix N L
159 5 158 mpcom A Word V B Word V M 0 N N 0 L + B A substr M if N L N L ++ B substr if 0 M L M L 0 N L = if N L A substr M N if L M B substr M L N L A substr M L ++ B prefix N L
160 159 imp A Word V B Word V M 0 N N 0 L + B A substr M if N L N L ++ B substr if 0 M L M L 0 N L = if N L A substr M N if L M B substr M L N L A substr M L ++ B prefix N L
161 3 160 eqtr4d A Word V B Word V M 0 N N 0 L + B A ++ B substr M N = A substr M if N L N L ++ B substr if 0 M L M L 0 N L
162 161 ex A Word V B Word V M 0 N N 0 L + B A ++ B substr M N = A substr M if N L N L ++ B substr if 0 M L M L 0 N L