1: \begin{abstract} We prove new results concerning the relation between
2: bifix codes, episturmian words and subgroups of free groups. We
3: study bifix codes in factorial sets of words. We generalize most
4: properties of ordinary maximal bifix codes to bifix codes maximal in
5: a recurrent set $F$ of words ($F$-maximal bifix codes). In the case
6: of bifix codes contained in Sturmian sets of words, we obtain
7: several new results. Let $F$ be a Sturmian set of words, defined as
8: the set of factors of a strict episturmian word. Our results
9: express the fact that an $F$-maximal bifix code of degree $d$
10: behaves just as the set of words of $F$ of length $d$. An
11: $F$-maximal bifix code of degree $d$ in a Sturmian set of words on
12: an alphabet with $k$ letters has $(k-1)d+1$ elements. This
13: generalizes the fact that a Sturmian set contains $(k-1)d+1$ words
14: of length $d$. Moreover, given an infinite word $x$, if there is a
15: finite maximal bifix code $X$ of degree $d$ such that $x$ has at
16: most $d$ factors of length $d$ in $X$, then $x$ is ultimately
17: periodic. Our main result states that any $F$-maximal bifix code of
18: degree $d$ on the alphabet $A$ is the basis of a subgroup of index
19: $d$ of the free group on~$A$.
20: \end{abstract}
21: