Metamath Proof Explorer


Theorem cshw1s2

Description: Cyclically shifting a length 2 word swaps its symbols. (Contributed by Thierry Arnoux, 19-Sep-2023)

Ref Expression
Assertion cshw1s2 AVBV⟨“AB”⟩cyclShift1=⟨“BA”⟩

Proof

Step Hyp Ref Expression
1 s2len ⟨“AB”⟩=2
2 1 oveq2i 1mod⟨“AB”⟩=1mod2
3 1re 1
4 2rp 2+
5 0le1 01
6 1lt2 1<2
7 modid 12+011<21mod2=1
8 3 4 5 6 7 mp4an 1mod2=1
9 2 8 eqtri 1mod⟨“AB”⟩=1
10 9 1 opeq12i 1mod⟨“AB”⟩⟨“AB”⟩=12
11 10 oveq2i ⟨“AB”⟩substr1mod⟨“AB”⟩⟨“AB”⟩=⟨“AB”⟩substr12
12 s2cl AVBV⟨“AB”⟩WordV
13 tpid2g 11012
14 3 13 ax-mp 1012
15 fz0tp 02=012
16 14 15 eleqtrri 102
17 tpid3g 2+2012
18 4 17 ax-mp 2012
19 18 15 eleqtrri 202
20 1 oveq2i 0⟨“AB”⟩=02
21 19 20 eleqtrri 20⟨“AB”⟩
22 swrdval2 ⟨“AB”⟩WordV10220⟨“AB”⟩⟨“AB”⟩substr12=i0..^21⟨“AB”⟩i+1
23 16 21 22 mp3an23 ⟨“AB”⟩WordV⟨“AB”⟩substr12=i0..^21⟨“AB”⟩i+1
24 12 23 syl AVBV⟨“AB”⟩substr12=i0..^21⟨“AB”⟩i+1
25 2m1e1 21=1
26 25 oveq2i 0..^21=0..^1
27 fzo01 0..^1=0
28 26 27 eqtri 0..^21=0
29 28 a1i AVBV0..^21=0
30 simpr AVBVi0..^21i0..^21
31 30 28 eleqtrdi AVBVi0..^21i0
32 elsni i0i=0
33 31 32 syl AVBVi0..^21i=0
34 33 oveq1d AVBVi0..^21i+1=0+1
35 0p1e1 0+1=1
36 34 35 eqtrdi AVBVi0..^21i+1=1
37 36 fveq2d AVBVi0..^21⟨“AB”⟩i+1=⟨“AB”⟩1
38 s2fv1 BV⟨“AB”⟩1=B
39 38 ad2antlr AVBVi0..^21⟨“AB”⟩1=B
40 37 39 eqtrd AVBVi0..^21⟨“AB”⟩i+1=B
41 29 40 mpteq12dva AVBVi0..^21⟨“AB”⟩i+1=i0B
42 fconstmpt 0×B=i0B
43 0nn0 00
44 simpr AVBVBV
45 xpsng 00BV0×B=0B
46 43 44 45 sylancr AVBV0×B=0B
47 s1val BV⟨“B”⟩=0B
48 47 adantl AVBV⟨“B”⟩=0B
49 46 48 eqtr4d AVBV0×B=⟨“B”⟩
50 42 49 eqtr3id AVBVi0B=⟨“B”⟩
51 24 41 50 3eqtrd AVBV⟨“AB”⟩substr12=⟨“B”⟩
52 11 51 eqtrid AVBV⟨“AB”⟩substr1mod⟨“AB”⟩⟨“AB”⟩=⟨“B”⟩
53 9 oveq2i ⟨“AB”⟩prefix1mod⟨“AB”⟩=⟨“AB”⟩prefix1
54 pfx1s2 AVBV⟨“AB”⟩prefix1=⟨“A”⟩
55 53 54 eqtrid AVBV⟨“AB”⟩prefix1mod⟨“AB”⟩=⟨“A”⟩
56 52 55 oveq12d AVBV⟨“AB”⟩substr1mod⟨“AB”⟩⟨“AB”⟩++⟨“AB”⟩prefix1mod⟨“AB”⟩=⟨“B”⟩++⟨“A”⟩
57 1z 1
58 cshword ⟨“AB”⟩WordV1⟨“AB”⟩cyclShift1=⟨“AB”⟩substr1mod⟨“AB”⟩⟨“AB”⟩++⟨“AB”⟩prefix1mod⟨“AB”⟩
59 12 57 58 sylancl AVBV⟨“AB”⟩cyclShift1=⟨“AB”⟩substr1mod⟨“AB”⟩⟨“AB”⟩++⟨“AB”⟩prefix1mod⟨“AB”⟩
60 df-s2 ⟨“BA”⟩=⟨“B”⟩++⟨“A”⟩
61 60 a1i AVBV⟨“BA”⟩=⟨“B”⟩++⟨“A”⟩
62 56 59 61 3eqtr4d AVBV⟨“AB”⟩cyclShift1=⟨“BA”⟩