Fine and Wilf's Theorem Proof Verification

404 Views Asked by At

I've started looking at Lothaire's Algebraic Combinatorics on Words (I assumed that I could skip the two preceding books, Combinatorics on Words, and Applied Combinatorics on Words, though if I'm mistaken, please let me know)- and I came across Fine and Wilf's theorem. After doing some googling on that theorem, I found an alternative statement of it as:

Let $w$ be a word on an alphabet $A$ having periods $p$ and $q$. If |$w|\geq p+q−\gcd(p,q)$, then $w$ has period $\gcd(p,q)$. The value $p+q−\gcd(p,q)$ is the smallest one that makes the theorem true."

I've been trying to formulate a proof of this theorem, but it often ends up messy. Let $d=\gcd(p,q)$. This is obvious when $p|q$ or $q|p$ (i.e. $d=p$ or $q$ respectively). Then, WLOG, let $p<q$, so $w=a_1a_2...a_pa_1a_2...a_p...$ Now let $rp$ be the greatest multiple of $p$ less than $q$. Then $q-rp$ is some multiple of $d$, say $nd$. By starting at the $q+1$-th letter, we get some sequence $a_{nd+1}a_{nd+2}...a_{(n-1)d+p}$ (where our indices are taken mod $p$). We can do this because we have at least $p-d$ letters after the $q$-th. By our period of $q$, we have that this is equal to $a_1a_2...a_{p-d}$, by which I mean that $a_{nd+1}=a_1,a_{nd+2}=a_2...a_{(n-1)d+p}=a_{p-d}$. Since we have $p-d$ equations, each with $2$ variables, it's easy to show that $p-2d$ of our letters appear exactly once amongst all of these equations, while our $2d$ other letters appear exactly twice. The idea I was getting as was that if I aligned my words like so:

$a_1\;\;\;\; a_2...\;\;\;\;\;a_n$

$a_{nd+1}a_{nd+2}...a_{(n-1)d+p}$

I would bounce back and forth between the two words using the ones that appear multiple times so that I could partition the whole $p$ length word into classes where the letters are equal and show that this is just congruence mod $d$. This is easy to imagine, but harder to formalize. I also suspect that I'm overcomplicating this proof, but this is the most direct approach that I can think of.