D M ] 2 A ug 2 01 4 The finite index basis property

We describe in this paper a connection between bifix codes, symbolic dynamical systems and free groups. This is in the spirit of the connection established previously for the symbolic systems corresponding to Sturmian words. We introduce a class of sets of factors of an infinite word with linear factor complexity containing Sturmian sets and regular interval exchange sets, namely the class of tree sets. We prove as a main result that for a uniformly recurrent tree set S, a finite bifix code X on the alphabet A is S-maximal of S-degree d if and only if it is the basis of a subgroup of index d of the free group on A.