Metamath Proof Explorer


Theorem pfxccat3

Description: The subword of a concatenation is either a subword of the first concatenated word or a subword of the second concatenated word or a concatenation of a suffix of the first word with a prefix of the second word. (Contributed by Alexander van der Vekens, 30-Mar-2018) (Revised by AV, 10-May-2020)

Ref Expression
Hypothesis swrdccatin2.l L = A
Assertion 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

Proof

Step Hyp Ref Expression
1 swrdccatin2.l L = A
2 simpll A Word V B Word V M 0 N N 0 L + B N L A Word V B Word V
3 simplrl A Word V B Word V M 0 N N 0 L + B N L M 0 N
4 lencl A Word V A 0
5 elfznn0 N 0 L + B N 0
6 5 adantr N 0 L + B A 0 N 0
7 6 adantr N 0 L + B A 0 N L N 0
8 simplr N 0 L + B A 0 N L A 0
9 1 breq2i N L N A
10 9 biimpi N L N A
11 10 adantl N 0 L + B A 0 N L N A
12 elfz2nn0 N 0 A N 0 A 0 N A
13 7 8 11 12 syl3anbrc N 0 L + B A 0 N L N 0 A
14 13 exp31 N 0 L + B A 0 N L N 0 A
15 14 adantl M 0 N N 0 L + B A 0 N L N 0 A
16 4 15 syl5com A Word V M 0 N N 0 L + B N L N 0 A
17 16 adantr A Word V B Word V M 0 N N 0 L + B N L N 0 A
18 17 imp A Word V B Word V M 0 N N 0 L + B N L N 0 A
19 18 imp A Word V B Word V M 0 N N 0 L + B N L N 0 A
20 3 19 jca A Word V B Word V M 0 N N 0 L + B N L M 0 N N 0 A
21 swrdccatin1 A Word V B Word V M 0 N N 0 A A ++ B substr M N = A substr M N
22 2 20 21 sylc A Word V B Word V M 0 N N 0 L + B N L A ++ B substr M N = A substr M N
23 simp1l A Word V B Word V M 0 N N 0 L + B ¬ N L L M A Word V B Word V
24 1 eleq1i L 0 A 0
25 elfz2nn0 M 0 N M 0 N 0 M N
26 nn0z L 0 L
27 26 adantl M 0 N 0 M N L 0 L
28 nn0z N 0 N
29 28 3ad2ant2 M 0 N 0 M N N
30 29 adantr M 0 N 0 M N L 0 N
31 nn0z M 0 M
32 31 3ad2ant1 M 0 N 0 M N M
33 32 adantr M 0 N 0 M N L 0 M
34 27 30 33 3jca M 0 N 0 M N L 0 L N M
35 34 adantr M 0 N 0 M N L 0 L M L N M
36 simpl3 M 0 N 0 M N L 0 M N
37 36 anim1ci M 0 N 0 M N L 0 L M L M M N
38 elfz2 M L N L N M L M M N
39 35 37 38 sylanbrc M 0 N 0 M N L 0 L M M L N
40 39 exp31 M 0 N 0 M N L 0 L M M L N
41 25 40 sylbi M 0 N L 0 L M M L N
42 41 adantr M 0 N N 0 L + B L 0 L M M L N
43 42 com12 L 0 M 0 N N 0 L + B L M M L N
44 24 43 sylbir A 0 M 0 N N 0 L + B L M M L N
45 4 44 syl A Word V M 0 N N 0 L + B L M M L N
46 45 adantr A Word V B Word V M 0 N N 0 L + B L M M L N
47 46 imp A Word V B Word V M 0 N N 0 L + B L M M L N
48 47 a1d A Word V B Word V M 0 N N 0 L + B ¬ N L L M M L N
49 48 3imp A Word V B Word V M 0 N N 0 L + B ¬ N L L M M L N
50 elfz2nn0 N 0 L + B N 0 L + B 0 N L + B
51 nn0z A 0 A
52 1 51 eqeltrid A 0 L
53 52 adantr A 0 ¬ N L L
54 53 adantl N 0 L + B 0 N L + B A 0 ¬ N L L
55 nn0z L + B 0 L + B
56 55 3ad2ant2 N 0 L + B 0 N L + B L + B
57 56 adantr N 0 L + B 0 N L + B A 0 ¬ N L L + B
58 28 3ad2ant1 N 0 L + B 0 N L + B N
59 58 adantr N 0 L + B 0 N L + B A 0 ¬ N L N
60 54 57 59 3jca N 0 L + B 0 N L + B A 0 ¬ N L L L + B N
61 1 eqcomi A = L
62 61 eleq1i A 0 L 0
63 nn0re L 0 L
64 nn0re N 0 N
65 ltnle L N L < N ¬ N L
66 63 64 65 syl2anr N 0 L 0 L < N ¬ N L
67 66 bicomd N 0 L 0 ¬ N L L < N
68 ltle L N L < N L N
69 63 64 68 syl2anr N 0 L 0 L < N L N
70 67 69 sylbid N 0 L 0 ¬ N L L N
71 70 ex N 0 L 0 ¬ N L L N
72 62 71 syl5bi N 0 A 0 ¬ N L L N
73 72 3ad2ant1 N 0 L + B 0 N L + B A 0 ¬ N L L N
74 73 imp32 N 0 L + B 0 N L + B A 0 ¬ N L L N
75 simpl3 N 0 L + B 0 N L + B A 0 ¬ N L N L + B
76 74 75 jca N 0 L + B 0 N L + B A 0 ¬ N L L N N L + B
77 elfz2 N L L + B L L + B N L N N L + B
78 60 76 77 sylanbrc N 0 L + B 0 N L + B A 0 ¬ N L N L L + B
79 78 exp32 N 0 L + B 0 N L + B A 0 ¬ N L N L L + B
80 50 79 sylbi N 0 L + B A 0 ¬ N L N L L + B
81 80 adantl M 0 N N 0 L + B A 0 ¬ N L N L L + B
82 4 81 syl5com A Word V M 0 N N 0 L + B ¬ N L N L L + B
83 82 adantr A Word V B Word V M 0 N N 0 L + B ¬ N L N L L + B
84 83 imp A Word V B Word V M 0 N N 0 L + B ¬ N L N L L + B
85 84 a1dd A Word V B Word V M 0 N N 0 L + B ¬ N L L M N L L + B
86 85 3imp A Word V B Word V M 0 N N 0 L + B ¬ N L L M N L L + B
87 49 86 jca A Word V B Word V M 0 N N 0 L + B ¬ N L L M M L N N L L + B
88 1 swrdccatin2 A Word V B Word V M L N N L L + B A ++ B substr M N = B substr M L N L
89 23 87 88 sylc A Word V B Word V M 0 N N 0 L + B ¬ N L L M A ++ B substr M N = B substr M L N L
90 simp1l A Word V B Word V M 0 N N 0 L + B ¬ N L ¬ L M A Word V B Word V
91 nn0re M 0 M
92 91 adantr M 0 N 0 M
93 ltnle M L M < L ¬ L M
94 92 63 93 syl2anr L 0 M 0 N 0 M < L ¬ L M
95 94 bicomd L 0 M 0 N 0 ¬ L M M < L
96 simpll M 0 L 0 M < L M 0
97 simplr M 0 L 0 M < L L 0
98 ltle M L M < L M L
99 91 63 98 syl2an M 0 L 0 M < L M L
100 99 imp M 0 L 0 M < L M L
101 elfz2nn0 M 0 L M 0 L 0 M L
102 96 97 100 101 syl3anbrc M 0 L 0 M < L M 0 L
103 102 exp31 M 0 L 0 M < L M 0 L
104 103 adantr M 0 N 0 L 0 M < L M 0 L
105 104 impcom L 0 M 0 N 0 M < L M 0 L
106 95 105 sylbid L 0 M 0 N 0 ¬ L M M 0 L
107 106 expcom M 0 N 0 L 0 ¬ L M M 0 L
108 107 3adant3 M 0 N 0 M N L 0 ¬ L M M 0 L
109 25 108 sylbi M 0 N L 0 ¬ L M M 0 L
110 62 109 syl5bi M 0 N A 0 ¬ L M M 0 L
111 110 adantr M 0 N N 0 L + B A 0 ¬ L M M 0 L
112 4 111 syl5com A Word V M 0 N N 0 L + B ¬ L M M 0 L
113 112 adantr A Word V B Word V M 0 N N 0 L + B ¬ L M M 0 L
114 113 imp A Word V B Word V M 0 N N 0 L + B ¬ L M M 0 L
115 114 a1d A Word V B Word V M 0 N N 0 L + B ¬ N L ¬ L M M 0 L
116 115 3imp A Word V B Word V M 0 N N 0 L + B ¬ N L ¬ L M M 0 L
117 64 3ad2ant1 N 0 L + B 0 N L + B N
118 65 bicomd L N ¬ N L L < N
119 63 117 118 syl2an L 0 N 0 L + B 0 N L + B ¬ N L L < N
120 26 adantr L 0 N 0 L + B 0 N L + B L
121 56 adantl L 0 N 0 L + B 0 N L + B L + B
122 58 adantl L 0 N 0 L + B 0 N L + B N
123 120 121 122 3jca L 0 N 0 L + B 0 N L + B L L + B N
124 123 adantr L 0 N 0 L + B 0 N L + B L < N L L + B N
125 63 117 68 syl2an L 0 N 0 L + B 0 N L + B L < N L N
126 125 imp L 0 N 0 L + B 0 N L + B L < N L N
127 simplr3 L 0 N 0 L + B 0 N L + B L < N N L + B
128 126 127 jca L 0 N 0 L + B 0 N L + B L < N L N N L + B
129 124 128 77 sylanbrc L 0 N 0 L + B 0 N L + B L < N N L L + B
130 129 ex L 0 N 0 L + B 0 N L + B L < N N L L + B
131 119 130 sylbid L 0 N 0 L + B 0 N L + B ¬ N L N L L + B
132 131 ex L 0 N 0 L + B 0 N L + B ¬ N L N L L + B
133 62 132 sylbi A 0 N 0 L + B 0 N L + B ¬ N L N L L + B
134 4 133 syl A Word V N 0 L + B 0 N L + B ¬ N L N L L + B
135 134 adantr A Word V B Word V N 0 L + B 0 N L + B ¬ N L N L L + B
136 135 com12 N 0 L + B 0 N L + B A Word V B Word V ¬ N L N L L + B
137 50 136 sylbi N 0 L + B A Word V B Word V ¬ N L N L L + B
138 137 adantl M 0 N N 0 L + B A Word V B Word V ¬ N L N L L + B
139 138 impcom A Word V B Word V M 0 N N 0 L + B ¬ N L N L L + B
140 139 a1dd A Word V B Word V M 0 N N 0 L + B ¬ N L ¬ L M N L L + B
141 140 3imp A Word V B Word V M 0 N N 0 L + B ¬ N L ¬ L M N L L + B
142 116 141 jca A Word V B Word V M 0 N N 0 L + B ¬ N L ¬ L M M 0 L N L L + B
143 1 pfxccatin12 A Word V B Word V M 0 L N L L + B A ++ B substr M N = A substr M L ++ B prefix N L
144 90 142 143 sylc A Word V B Word V M 0 N N 0 L + B ¬ N L ¬ L M A ++ B substr M N = A substr M L ++ B prefix N L
145 22 89 144 2if2 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
146 145 ex 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