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 AWordVBWordVM0NN0L+BA++BsubstrMN=ifNLAsubstrMNifLMBsubstrMLNLAsubstrML++BprefixNL

Proof

Step Hyp Ref Expression
1 swrdccatin2.l L=A
2 simpll AWordVBWordVM0NN0L+BNLAWordVBWordV
3 simplrl AWordVBWordVM0NN0L+BNLM0N
4 lencl AWordVA0
5 elfznn0 N0L+BN0
6 5 adantr N0L+BA0N0
7 6 adantr N0L+BA0NLN0
8 simplr N0L+BA0NLA0
9 1 breq2i NLNA
10 9 biimpi NLNA
11 10 adantl N0L+BA0NLNA
12 elfz2nn0 N0AN0A0NA
13 7 8 11 12 syl3anbrc N0L+BA0NLN0A
14 13 exp31 N0L+BA0NLN0A
15 14 adantl M0NN0L+BA0NLN0A
16 4 15 syl5com AWordVM0NN0L+BNLN0A
17 16 adantr AWordVBWordVM0NN0L+BNLN0A
18 17 imp AWordVBWordVM0NN0L+BNLN0A
19 18 imp AWordVBWordVM0NN0L+BNLN0A
20 3 19 jca AWordVBWordVM0NN0L+BNLM0NN0A
21 swrdccatin1 AWordVBWordVM0NN0AA++BsubstrMN=AsubstrMN
22 2 20 21 sylc AWordVBWordVM0NN0L+BNLA++BsubstrMN=AsubstrMN
23 simp1l AWordVBWordVM0NN0L+B¬NLLMAWordVBWordV
24 1 eleq1i L0A0
25 elfz2nn0 M0NM0N0MN
26 nn0z L0L
27 26 adantl M0N0MNL0L
28 nn0z N0N
29 28 3ad2ant2 M0N0MNN
30 29 adantr M0N0MNL0N
31 nn0z M0M
32 31 3ad2ant1 M0N0MNM
33 32 adantr M0N0MNL0M
34 27 30 33 3jca M0N0MNL0LNM
35 34 adantr M0N0MNL0LMLNM
36 simpl3 M0N0MNL0MN
37 36 anim1ci M0N0MNL0LMLMMN
38 elfz2 MLNLNMLMMN
39 35 37 38 sylanbrc M0N0MNL0LMMLN
40 39 exp31 M0N0MNL0LMMLN
41 25 40 sylbi M0NL0LMMLN
42 41 adantr M0NN0L+BL0LMMLN
43 42 com12 L0M0NN0L+BLMMLN
44 24 43 sylbir A0M0NN0L+BLMMLN
45 4 44 syl AWordVM0NN0L+BLMMLN
46 45 adantr AWordVBWordVM0NN0L+BLMMLN
47 46 imp AWordVBWordVM0NN0L+BLMMLN
48 47 a1d AWordVBWordVM0NN0L+B¬NLLMMLN
49 48 3imp AWordVBWordVM0NN0L+B¬NLLMMLN
50 elfz2nn0 N0L+BN0L+B0NL+B
51 nn0z A0A
52 1 51 eqeltrid A0L
53 52 adantr A0¬NLL
54 53 adantl N0L+B0NL+BA0¬NLL
55 nn0z L+B0L+B
56 55 3ad2ant2 N0L+B0NL+BL+B
57 56 adantr N0L+B0NL+BA0¬NLL+B
58 28 3ad2ant1 N0L+B0NL+BN
59 58 adantr N0L+B0NL+BA0¬NLN
60 54 57 59 3jca N0L+B0NL+BA0¬NLLL+BN
61 1 eqcomi A=L
62 61 eleq1i A0L0
63 nn0re L0L
64 nn0re N0N
65 ltnle LNL<N¬NL
66 63 64 65 syl2anr N0L0L<N¬NL
67 66 bicomd N0L0¬NLL<N
68 ltle LNL<NLN
69 63 64 68 syl2anr N0L0L<NLN
70 67 69 sylbid N0L0¬NLLN
71 70 ex N0L0¬NLLN
72 62 71 biimtrid N0A0¬NLLN
73 72 3ad2ant1 N0L+B0NL+BA0¬NLLN
74 73 imp32 N0L+B0NL+BA0¬NLLN
75 simpl3 N0L+B0NL+BA0¬NLNL+B
76 74 75 jca N0L+B0NL+BA0¬NLLNNL+B
77 elfz2 NLL+BLL+BNLNNL+B
78 60 76 77 sylanbrc N0L+B0NL+BA0¬NLNLL+B
79 78 exp32 N0L+B0NL+BA0¬NLNLL+B
80 50 79 sylbi N0L+BA0¬NLNLL+B
81 80 adantl M0NN0L+BA0¬NLNLL+B
82 4 81 syl5com AWordVM0NN0L+B¬NLNLL+B
83 82 adantr AWordVBWordVM0NN0L+B¬NLNLL+B
84 83 imp AWordVBWordVM0NN0L+B¬NLNLL+B
85 84 a1dd AWordVBWordVM0NN0L+B¬NLLMNLL+B
86 85 3imp AWordVBWordVM0NN0L+B¬NLLMNLL+B
87 49 86 jca AWordVBWordVM0NN0L+B¬NLLMMLNNLL+B
88 1 swrdccatin2 AWordVBWordVMLNNLL+BA++BsubstrMN=BsubstrMLNL
89 23 87 88 sylc AWordVBWordVM0NN0L+B¬NLLMA++BsubstrMN=BsubstrMLNL
90 simp1l AWordVBWordVM0NN0L+B¬NL¬LMAWordVBWordV
91 nn0re M0M
92 91 adantr M0N0M
93 ltnle MLM<L¬LM
94 92 63 93 syl2anr L0M0N0M<L¬LM
95 94 bicomd L0M0N0¬LMM<L
96 simpll M0L0M<LM0
97 simplr M0L0M<LL0
98 ltle MLM<LML
99 91 63 98 syl2an M0L0M<LML
100 99 imp M0L0M<LML
101 elfz2nn0 M0LM0L0ML
102 96 97 100 101 syl3anbrc M0L0M<LM0L
103 102 exp31 M0L0M<LM0L
104 103 adantr M0N0L0M<LM0L
105 104 impcom L0M0N0M<LM0L
106 95 105 sylbid L0M0N0¬LMM0L
107 106 expcom M0N0L0¬LMM0L
108 107 3adant3 M0N0MNL0¬LMM0L
109 25 108 sylbi M0NL0¬LMM0L
110 62 109 biimtrid M0NA0¬LMM0L
111 110 adantr M0NN0L+BA0¬LMM0L
112 4 111 syl5com AWordVM0NN0L+B¬LMM0L
113 112 adantr AWordVBWordVM0NN0L+B¬LMM0L
114 113 imp AWordVBWordVM0NN0L+B¬LMM0L
115 114 a1d AWordVBWordVM0NN0L+B¬NL¬LMM0L
116 115 3imp AWordVBWordVM0NN0L+B¬NL¬LMM0L
117 64 3ad2ant1 N0L+B0NL+BN
118 65 bicomd LN¬NLL<N
119 63 117 118 syl2an L0N0L+B0NL+B¬NLL<N
120 26 adantr L0N0L+B0NL+BL
121 56 adantl L0N0L+B0NL+BL+B
122 58 adantl L0N0L+B0NL+BN
123 120 121 122 3jca L0N0L+B0NL+BLL+BN
124 123 adantr L0N0L+B0NL+BL<NLL+BN
125 63 117 68 syl2an L0N0L+B0NL+BL<NLN
126 125 imp L0N0L+B0NL+BL<NLN
127 simplr3 L0N0L+B0NL+BL<NNL+B
128 126 127 jca L0N0L+B0NL+BL<NLNNL+B
129 124 128 77 sylanbrc L0N0L+B0NL+BL<NNLL+B
130 129 ex L0N0L+B0NL+BL<NNLL+B
131 119 130 sylbid L0N0L+B0NL+B¬NLNLL+B
132 131 ex L0N0L+B0NL+B¬NLNLL+B
133 62 132 sylbi A0N0L+B0NL+B¬NLNLL+B
134 4 133 syl AWordVN0L+B0NL+B¬NLNLL+B
135 134 adantr AWordVBWordVN0L+B0NL+B¬NLNLL+B
136 135 com12 N0L+B0NL+BAWordVBWordV¬NLNLL+B
137 50 136 sylbi N0L+BAWordVBWordV¬NLNLL+B
138 137 adantl M0NN0L+BAWordVBWordV¬NLNLL+B
139 138 impcom AWordVBWordVM0NN0L+B¬NLNLL+B
140 139 a1dd AWordVBWordVM0NN0L+B¬NL¬LMNLL+B
141 140 3imp AWordVBWordVM0NN0L+B¬NL¬LMNLL+B
142 116 141 jca AWordVBWordVM0NN0L+B¬NL¬LMM0LNLL+B
143 1 pfxccatin12 AWordVBWordVM0LNLL+BA++BsubstrMN=AsubstrML++BprefixNL
144 90 142 143 sylc AWordVBWordVM0NN0L+B¬NL¬LMA++BsubstrMN=AsubstrML++BprefixNL
145 22 89 144 2if2 AWordVBWordVM0NN0L+BA++BsubstrMN=ifNLAsubstrMNifLMBsubstrMLNLAsubstrML++BprefixNL
146 145 ex AWordVBWordVM0NN0L+BA++BsubstrMN=ifNLAsubstrMNifLMBsubstrMLNLAsubstrML++BprefixNL