This page is dedicated to the paper Characterization of some binary words with few squares by Golnaz Badkobeh and Pascal Ochem.

morphisms.txt contains the morphisms defining the (pure) morphic words considered in the paper.
forbidden.txt contains the forbidden factors of the words considered in the paper.
mor.c writes in mor_mode_lim_l.txt the list of factors of length l contained in the prefix of length lim of the (pure) morphic word mode using the morphisms in morphisms.txt.
pat.c writes in pat_mode_tt_l.txt the list of factors of length l that appear in the middle of a word w avoiding SQ_t and the factors in forbidden.txt , such that |w|=(2tt+1)*l.

Usage:
./mor mode lim l
./pat mode tt l

Example:
We want to prove the new characterization for ternary words avoiding {AA} and {010,020}, which corresponds to mode=m1.
We choose a sufficient factor length, say l=80.
The parameter lim must be sufficiently large so that the prefix of length lim of the morphic word contains all the factors of length 80 of the morphic word. We take lim=1000.
As we are told in the paper, we choose tt=4. This is sufficient to ensure that factors that are not recurrent in a word avoiding {AA} and {010,020} are discarded.
We run the programs:
./mor m1 1000 80
./pat m1 4 80
They produce the files mor_m1_1000_80.txt and pat_m1_4_80.txt.
The factors in both files are lexicographically sorted, so we check that the files contain the same factors by running
diff mor_m1_1000_80.txt pat_m1_4_80.txt
which outputs nothing. This gives the proof.

We use mor.c and pat.c only to check the characterization. Another program is needed to find the small morphisms in the paper:
map.c outputs the morphisms that map a pure morphic word mode_in to a morphic word mode_out such that the length of the image of every letter is in [0,..,mmx-1].

Usage:
./map mode_in mode_out mmx

To compile:
gcc -O3 -o mor mor.c
gcc -O3 -o pat pat.c
gcc -O3 -o map map.c