Metamath Proof Explorer


Theorem pfxccat3a

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

Ref Expression
Hypotheses swrdccatin2.l L = A
pfxccatpfx2.m M = B
Assertion pfxccat3a A Word V B Word V N 0 L + M A ++ B prefix N = if N L A prefix N A ++ B prefix N L

Proof

Step Hyp Ref Expression
1 swrdccatin2.l L = A
2 pfxccatpfx2.m M = B
3 simprl N L A Word V B Word V N 0 L + M A Word V B Word V
4 elfznn0 N 0 L + M N 0
5 4 adantl A Word V B Word V N 0 L + M N 0
6 5 adantl N L A Word V B Word V N 0 L + M N 0
7 lencl A Word V A 0
8 1 7 eqeltrid A Word V L 0
9 8 adantr A Word V B Word V L 0
10 9 adantr A Word V B Word V N 0 L + M L 0
11 10 adantl N L A Word V B Word V N 0 L + M L 0
12 simpl N L A Word V B Word V N 0 L + M N L
13 elfz2nn0 N 0 L N 0 L 0 N L
14 6 11 12 13 syl3anbrc N L A Word V B Word V N 0 L + M N 0 L
15 df-3an A Word V B Word V N 0 L A Word V B Word V N 0 L
16 3 14 15 sylanbrc N L A Word V B Word V N 0 L + M A Word V B Word V N 0 L
17 1 pfxccatpfx1 A Word V B Word V N 0 L A ++ B prefix N = A prefix N
18 16 17 syl N L A Word V B Word V N 0 L + M A ++ B prefix N = A prefix N
19 iftrue N L if N L A prefix N A ++ B prefix N L = A prefix N
20 19 adantr N L A Word V B Word V N 0 L + M if N L A prefix N A ++ B prefix N L = A prefix N
21 18 20 eqtr4d N L A Word V B Word V N 0 L + M A ++ B prefix N = if N L A prefix N A ++ B prefix N L
22 simprl ¬ N L A Word V B Word V N 0 L + M A Word V B Word V
23 elfz2nn0 N 0 L + M N 0 L + M 0 N L + M
24 1 eleq1i L 0 A 0
25 nn0ltp1le L 0 N 0 L < N L + 1 N
26 nn0re L 0 L
27 nn0re N 0 N
28 ltnle L N L < N ¬ N L
29 26 27 28 syl2an L 0 N 0 L < N ¬ N L
30 25 29 bitr3d L 0 N 0 L + 1 N ¬ N L
31 30 3ad2antr1 L 0 N 0 L + M 0 N L + M L + 1 N ¬ N L
32 simpr3 L 0 N 0 L + M 0 N L + M N L + M
33 32 anim1ci L 0 N 0 L + M 0 N L + M L + 1 N L + 1 N N L + M
34 nn0z N 0 N
35 34 3ad2ant1 N 0 L + M 0 N L + M N
36 35 adantl L 0 N 0 L + M 0 N L + M N
37 36 adantr L 0 N 0 L + M 0 N L + M L + 1 N N
38 peano2nn0 L 0 L + 1 0
39 38 nn0zd L 0 L + 1
40 39 adantr L 0 N 0 L + M 0 N L + M L + 1
41 40 adantr L 0 N 0 L + M 0 N L + M L + 1 N L + 1
42 nn0z L + M 0 L + M
43 42 3ad2ant2 N 0 L + M 0 N L + M L + M
44 43 adantl L 0 N 0 L + M 0 N L + M L + M
45 44 adantr L 0 N 0 L + M 0 N L + M L + 1 N L + M
46 elfz N L + 1 L + M N L + 1 L + M L + 1 N N L + M
47 37 41 45 46 syl3anc L 0 N 0 L + M 0 N L + M L + 1 N N L + 1 L + M L + 1 N N L + M
48 33 47 mpbird L 0 N 0 L + M 0 N L + M L + 1 N N L + 1 L + M
49 48 ex L 0 N 0 L + M 0 N L + M L + 1 N N L + 1 L + M
50 31 49 sylbird L 0 N 0 L + M 0 N L + M ¬ N L N L + 1 L + M
51 50 ex L 0 N 0 L + M 0 N L + M ¬ N L N L + 1 L + M
52 24 51 sylbir A 0 N 0 L + M 0 N L + M ¬ N L N L + 1 L + M
53 7 52 syl A Word V N 0 L + M 0 N L + M ¬ N L N L + 1 L + M
54 53 adantr A Word V B Word V N 0 L + M 0 N L + M ¬ N L N L + 1 L + M
55 23 54 syl5bi A Word V B Word V N 0 L + M ¬ N L N L + 1 L + M
56 55 imp A Word V B Word V N 0 L + M ¬ N L N L + 1 L + M
57 56 impcom ¬ N L A Word V B Word V N 0 L + M N L + 1 L + M
58 df-3an A Word V B Word V N L + 1 L + M A Word V B Word V N L + 1 L + M
59 22 57 58 sylanbrc ¬ N L A Word V B Word V N 0 L + M A Word V B Word V N L + 1 L + M
60 1 2 pfxccatpfx2 A Word V B Word V N L + 1 L + M A ++ B prefix N = A ++ B prefix N L
61 59 60 syl ¬ N L A Word V B Word V N 0 L + M A ++ B prefix N = A ++ B prefix N L
62 iffalse ¬ N L if N L A prefix N A ++ B prefix N L = A ++ B prefix N L
63 62 adantr ¬ N L A Word V B Word V N 0 L + M if N L A prefix N A ++ B prefix N L = A ++ B prefix N L
64 61 63 eqtr4d ¬ N L A Word V B Word V N 0 L + M A ++ B prefix N = if N L A prefix N A ++ B prefix N L
65 21 64 pm2.61ian A Word V B Word V N 0 L + M A ++ B prefix N = if N L A prefix N A ++ B prefix N L
66 65 ex A Word V B Word V N 0 L + M A ++ B prefix N = if N L A prefix N A ++ B prefix N L