Metamath Proof Explorer


Theorem cshwshashnsame

Description: If a word (not consisting of identical symbols) has a length being a prime number, the size of the set of (different!) words resulting by cyclically shifting the original word equals the length of the original word. (Contributed by AV, 19-May-2018) (Revised by AV, 10-Nov-2018)

Ref Expression
Hypothesis cshwrepswhash1.m M=wWordV|n0..^WWcyclShiftn=w
Assertion cshwshashnsame WWordVWi0..^WWiW0M=W

Proof

Step Hyp Ref Expression
1 cshwrepswhash1.m M=wWordV|n0..^WWcyclShiftn=w
2 1 cshwsiun WWordVM=n0..^WWcyclShiftn
3 2 ad2antrr WWordVWi0..^WWiW0M=n0..^WWcyclShiftn
4 3 fveq2d WWordVWi0..^WWiW0M=n0..^WWcyclShiftn
5 fzofi 0..^WFin
6 5 a1i WWordVWi0..^WWiW00..^WFin
7 snfi WcyclShiftnFin
8 7 a1i WWordVWi0..^WWiW0n0..^WWcyclShiftnFin
9 id WWordVWWWordVW
10 9 cshwsdisj WWordVWi0..^WWiW0Disjn0..^WWcyclShiftn
11 6 8 10 hashiun WWordVWi0..^WWiW0n0..^WWcyclShiftn=n0..^WWcyclShiftn
12 ovex WcyclShiftnV
13 hashsng WcyclShiftnVWcyclShiftn=1
14 12 13 mp1i WWordVWi0..^WWiW0WcyclShiftn=1
15 14 sumeq2sdv WWordVWi0..^WWiW0n0..^WWcyclShiftn=n0..^W1
16 1cnd WWordVW1
17 fsumconst 0..^WFin1n0..^W1=0..^W1
18 5 16 17 sylancr WWordVWn0..^W1=0..^W1
19 lencl WWordVW0
20 19 adantr WWordVWW0
21 hashfzo0 W00..^W=W
22 20 21 syl WWordVW0..^W=W
23 22 oveq1d WWordVW0..^W1=W1
24 prmnn WW
25 24 nnred WW
26 25 adantl WWordVWW
27 ax-1rid WW1=W
28 26 27 syl WWordVWW1=W
29 18 23 28 3eqtrd WWordVWn0..^W1=W
30 29 adantr WWordVWi0..^WWiW0n0..^W1=W
31 15 30 eqtrd WWordVWi0..^WWiW0n0..^WWcyclShiftn=W
32 4 11 31 3eqtrd WWordVWi0..^WWiW0M=W
33 32 ex WWordVWi0..^WWiW0M=W