Metamath Proof Explorer


Theorem 2swrd2eqwrdeq

Description: Two words of length at least two are equal if and only if they have the same prefix and the same two single symbols suffix. (Contributed by AV, 24-Sep-2018) (Revised by AV, 12-Oct-2022)

Ref Expression
Assertion 2swrd2eqwrdeq WWordVUWordV1<WW=UW=UWprefixW2=UprefixW2WW2=UW2lastSW=lastSU

Proof

Step Hyp Ref Expression
1 lencl WWordVW0
2 1z 1
3 nn0z W0W
4 zltp1le 1W1<W1+1W
5 2 3 4 sylancr W01<W1+1W
6 1p1e2 1+1=2
7 6 a1i W01+1=2
8 7 breq1d W01+1W2W
9 8 biimpd W01+1W2W
10 5 9 sylbid W01<W2W
11 10 imp W01<W2W
12 2nn0 20
13 simpl W01<WW0
14 nn0sub 20W02WW20
15 12 13 14 sylancr W01<W2WW20
16 11 15 mpbid W01<WW20
17 3 adantr W01<WW
18 0red W00
19 1red W01
20 nn0re W0W
21 18 19 20 3jca W001W
22 0lt1 0<1
23 lttr 01W0<11<W0<W
24 23 expd 01W0<11<W0<W
25 21 22 24 mpisyl W01<W0<W
26 25 imp W01<W0<W
27 elnnz WW0<W
28 17 26 27 sylanbrc W01<WW
29 2rp 2+
30 29 a1i W02+
31 20 30 ltsubrpd W0W2<W
32 31 adantr W01<WW2<W
33 elfzo0 W20..^WW20WW2<W
34 16 28 32 33 syl3anbrc W01<WW20..^W
35 1 34 sylan WWordV1<WW20..^W
36 35 3adant2 WWordVUWordV1<WW20..^W
37 pfxsuffeqwrdeq WWordVUWordVW20..^WW=UW=UWprefixW2=UprefixW2WsubstrW2W=UsubstrW2W
38 36 37 syld3an3 WWordVUWordV1<WW=UW=UWprefixW2=UprefixW2WsubstrW2W=UsubstrW2W
39 swrd2lsw WWordV1<WWsubstrW2W=⟨“WW2lastSW”⟩
40 39 3adant2 WWordVUWordV1<WWsubstrW2W=⟨“WW2lastSW”⟩
41 40 adantr WWordVUWordV1<WW=UWsubstrW2W=⟨“WW2lastSW”⟩
42 breq2 W=U1<W1<U
43 42 3anbi3d W=UWWordVUWordV1<WWWordVUWordV1<U
44 swrd2lsw UWordV1<UUsubstrU2U=⟨“UU2lastSU”⟩
45 44 3adant1 WWordVUWordV1<UUsubstrU2U=⟨“UU2lastSU”⟩
46 43 45 syl6bi W=UWWordVUWordV1<WUsubstrU2U=⟨“UU2lastSU”⟩
47 46 impcom WWordVUWordV1<WW=UUsubstrU2U=⟨“UU2lastSU”⟩
48 oveq1 W=UW2=U2
49 id W=UW=U
50 48 49 opeq12d W=UW2W=U2U
51 50 oveq2d W=UUsubstrW2W=UsubstrU2U
52 51 eqeq1d W=UUsubstrW2W=⟨“UU2lastSU”⟩UsubstrU2U=⟨“UU2lastSU”⟩
53 52 adantl WWordVUWordV1<WW=UUsubstrW2W=⟨“UU2lastSU”⟩UsubstrU2U=⟨“UU2lastSU”⟩
54 47 53 mpbird WWordVUWordV1<WW=UUsubstrW2W=⟨“UU2lastSU”⟩
55 41 54 eqeq12d WWordVUWordV1<WW=UWsubstrW2W=UsubstrW2W⟨“WW2lastSW”⟩=⟨“UU2lastSU”⟩
56 fvexd WWordVUWordV1<WW=UWW2V
57 fvexd WWordVUWordV1<WW=UlastSWV
58 fvexd WWordVUWordV1<WW=UUU2V
59 fvexd WWordVUWordV1<WW=UlastSUV
60 s2eq2s1eq WW2VlastSWVUU2VlastSUV⟨“WW2lastSW”⟩=⟨“UU2lastSU”⟩⟨“WW2”⟩=⟨“UU2”⟩⟨“lastSW”⟩=⟨“lastSU”⟩
61 56 57 58 59 60 syl22anc WWordVUWordV1<WW=U⟨“WW2lastSW”⟩=⟨“UU2lastSU”⟩⟨“WW2”⟩=⟨“UU2”⟩⟨“lastSW”⟩=⟨“lastSU”⟩
62 fvex WW2V
63 s111 WW2VUU2V⟨“WW2”⟩=⟨“UU2”⟩WW2=UU2
64 62 58 63 sylancr WWordVUWordV1<WW=U⟨“WW2”⟩=⟨“UU2”⟩WW2=UU2
65 fvoveq1 U=WUU2=UW2
66 65 eqcoms W=UUU2=UW2
67 66 adantl WWordVUWordV1<WW=UUU2=UW2
68 67 eqeq2d WWordVUWordV1<WW=UWW2=UU2WW2=UW2
69 64 68 bitrd WWordVUWordV1<WW=U⟨“WW2”⟩=⟨“UU2”⟩WW2=UW2
70 fvex lastSWV
71 s111 lastSWVlastSUV⟨“lastSW”⟩=⟨“lastSU”⟩lastSW=lastSU
72 70 59 71 sylancr WWordVUWordV1<WW=U⟨“lastSW”⟩=⟨“lastSU”⟩lastSW=lastSU
73 69 72 anbi12d WWordVUWordV1<WW=U⟨“WW2”⟩=⟨“UU2”⟩⟨“lastSW”⟩=⟨“lastSU”⟩WW2=UW2lastSW=lastSU
74 55 61 73 3bitrd WWordVUWordV1<WW=UWsubstrW2W=UsubstrW2WWW2=UW2lastSW=lastSU
75 74 anbi2d WWordVUWordV1<WW=UWprefixW2=UprefixW2WsubstrW2W=UsubstrW2WWprefixW2=UprefixW2WW2=UW2lastSW=lastSU
76 3anass WprefixW2=UprefixW2WW2=UW2lastSW=lastSUWprefixW2=UprefixW2WW2=UW2lastSW=lastSU
77 75 76 bitr4di WWordVUWordV1<WW=UWprefixW2=UprefixW2WsubstrW2W=UsubstrW2WWprefixW2=UprefixW2WW2=UW2lastSW=lastSU
78 77 pm5.32da WWordVUWordV1<WW=UWprefixW2=UprefixW2WsubstrW2W=UsubstrW2WW=UWprefixW2=UprefixW2WW2=UW2lastSW=lastSU
79 38 78 bitrd WWordVUWordV1<WW=UW=UWprefixW2=UprefixW2WW2=UW2lastSW=lastSU