# Embedding a θ-invariant code into a complete one

Let A be a finite or countable alphabet and let θ be a literal (anti)morphism onto A * (by definition, such a correspondence is determinated by a permutation of the alphabet). This paper deals with sets which are invariant under θ (θ-invariant for short). We establish a formula which allows to embed any non-complete θ-invariant code into a complete one: this brings a positive answer to the open question that was stated in [[Néraud J. and Selmi C. Invariance: a theoretical approach for coding sets of words modulo literal (anti)morphisms. In S. Brlek, F. Dolce, C. Reutenauer, and E. Vandomme, editors, Combinatorics on Words, volume 10432, pages 214-227. Lect. Notes in Comp. Sci., sept 2017].

## Authors

• 4 publications
• 1 publication
• ### Abelian Anti-Powers in Infinite Words

An abelian anti-power of order k (or simply an abelian k-anti-power) is ...
10/29/2018 ∙ by Gabriele Fici, et al. ∙ 0

• ### Regularizing Towards Permutation Invariance in Recurrent Models

In many machine learning problems the output should not depend on the or...
10/25/2020 ∙ by Edo Cohen-Karlik, et al. ∙ 0

• ### Permutation-invariant quantum coding for quantum deletion channels

Quantum deletions, which are harder to correct than erasure errors, occu...
02/04/2021 ∙ by Yingkai Ouyang, et al. ∙ 0

• ### On Representing (Anti)Symmetric Functions

Permutation-invariant, -equivariant, and -covariant functions and anti-s...
07/30/2020 ∙ by Marcus Hutter, et al. ∙ 13

• ### A Unique Extension of Rich Words

A word w is called rich if it contains | w|+1 palindromic factors, inclu...
10/02/2019 ∙ by Josef Rukavicka, et al. ∙ 0

• ### F_q[G]-modules and G-invariant codes

If F_q is a finite field and G is a subgroup of the linear automorphisms...
11/29/2017 ∙ by Elias Javier Garcia Claro, et al. ∙ 0

• ### A strongly universal cellular automaton with four states

In this paper, we prove that there is a strongly universal cellular auto...
07/10/2021 ∙ by Maurice Margenstern, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

In the free monoid theory, during the last decade, research involving one-to-one morphic or antimorphic substitutions has played a particularly important part: this is due to the powerful applications of these objects, in particular in the framework of DNA-computing. In the case of automorphisms or anti-automorphisms -for short we write (anti-)automorphisms- given an arbitrary alphabet, say , any such mapping is completely determined by extending a unique permutation of to , the free monoid that is generated by .

In the special case of involutive (anti-)automorphisms, lots of successful investigations have been done for extending most of the now classical combinatorial properties on words. The topics of the so-called pseudo-palindromes dD06 , that of -episturmian words BdZD11 , and the one of pseudo-repetitions ARVS14 ; GMRMNT13 have been particularly involved. The framework of some peculiar families of variable-length codes KM06 and that of equations in words CCKS11 ; DFMN17 ; KM08 ; MMNS14 have been concerned. Generalizations of the famous theorem of Fine and Wilf (FW65 ,(Lo1983, , Proposition 1.3.5)) were also established CKS10 ; MMN11 .

Equations in words are also the starting point of the study in the present paper, which consists in some full version of NS17 . Let be an arbitrary alphabet and let be an (anti-)automorphism of ; we adopt the point of view from (Lo1983, , Ch. 9), by considering a finite collection of unknown words, say . We assume that a (minimum) positive integer (i.e. the so-called order of ) exists such that . This condition is particularly satisfied by every (anti-)automorphism whenever is finite. In view of making the present forward more easily readable, in the first instance let us take as an involutive (anti-)automorphism (that is, ). We assign that the words in and their images by to satisfy a given equation, and we ask for the computation of a finite set of words, say , such that all the words of can be expressed as a concatenation of words in . Actually, such a question appears more complex than in the classical configuration, where does not interfer: in this classical case, according to the famous defect theorem (Lo1983, , Theorem 1.2.5), it is well known that at most words allow to compute the words in . At the contrary, due to the interference of (anti-)automorphisms, in KM08 , examples where are provided by the authors.

Along the way, for solving our problem, applying the defect theorem to the set might appear natural. Such a methodology garantees the existence of a set , with and whose elements allow by concatenation to rebuild all the words in . It is also well known that can be chosen in such a way that only trivial equations may hold among its elements: with the terminology of BPR10 ; Lo1983 ; Lo2002 , is a code, or equivalently , the submonoid that it generates, is free. Unfortunately, since both the words in and are expressed as concatenations of words in , among the words of non-trivial equations can still hold. In other words, by applying that methodology, the initial problem would be transferred among the words in .

An alternative methodology will consist in asking for codes which are invariant under (-invariant for short) that is, satisfying . Returning to the general case, where is an arbitrary (anti-)automorphism, this is equivalent to say that the union of the sets , for all , is -invariant. By the way, it is straightforward to show that the intersection of an arbitrary family of free -invariant submonoids is itself a free -invariant submonoid. In the present paper we prove the following result:

Theorem 1. Let be an (anti-)automorphism of and let be a finite -invariant set. If it is not a code, then the smallest -invariant free submonoid of containing is generated by a -invariant code , which furthermore satisfies .

For illustrating this result in terms of equation, we refer to CCKS11 ; MMNS14 , where the authors considered generalizations of the famous three unknown variables equation of Lyndon-Shützenberger (Lo1983, , § 9.2). They proved that, an involutive (anti-)automorphism being fixed, given such an equation with sufficiently long members, a word exists such that any 3-uple of “solutions" can be expressed as a concatenation of words in . With the notation of Theorem 1, the elements of the -invariant set are and those of are and : we verify that, in every case is a -invariant code, furthermore we have .

With regard to the theory of codes, completeness is one of the most challenging notions: a subset of the free monoid is complete if any word is a factor of some word in . Maximality is another important notion: a code is maximal if it cannot be strictly included in some other code of . Actually, according to Zorn’s Lemma, any code is included in a maximal one moreover, a famous result due to Schützenberger states that, for the family of the so-called thin codes (which contains the regular codes), maximality and completeness are two equivalent notions (BPR10, , Theorem 2.5.16). From this point of view, in the second part of our study we are interested in complete -invariant codes. It is natural to prealably examine the case of finite codes. Clearly, the well-known complete uniform codes that is, the codes (with ), are invariant under every (anti-)automorphism. Beside that, non-trivial finite complete -invariant codes exist: for instance, take for the binary alphabet , choose for the anti-automorphism that swaps the letters and , and consider the complete code which was introduced in C72 :

 X={a3,ab,a2ba,a2b2,ba2,baba,bab2,b2a,b3}.

It is straightforward to verify that is -invariant. In our paper, we provide some other examples: each of the classes of bifix codes, prefix codes, and non-prefix non-suffix codes is concerned.

Despite that, the question of describing a general structure for finite complete -invariant codes remains largely open: this is not surprizing since, with the exception of certain special families (e.g. DF89 ; DFR85 ; RSS89 ), no general structure that could embrace finite complete codes is described in the literature.

Another issue could consist in developing methods for embedding a code into a complete one. However, in R75 , the author presents a class of codes that cannot be embedded into any finite complete one. With regard to -invariance, as far as we know, the question of embedding finite codes into complete ones remains open.

Actually, in R75 , the question whether any finite code can be embedded into a regular one was implicitely asked: a positive answer was brought in ER85 , where the authors provided a now classical formula for embedding any regular code into a complete one. In the present paper, we put a corresponding problem in the framework of -invariant codes. Actually, by establishing the following result, we bring a positive answer:

Theorem 2. Any non-complete -invariant code , can be embedded into a complete one. Moreover, if is finite and regular, then can be embedded into a regular complete -invariant code.

As a consequence, we obtain the following result: it states that, in the framework of -invariant codes, a property similar to a famous one due to Schützenberger (BPR10, , Theorem 2.5.16) holds:

Theorem 3. Given a thin -invariant code , the five following conditions are equivalent:

(i) is complete.

(ii) is a maximal code.

(iii) is maximal in the family of the -invariant codes.

(iv) A positive Bernoulli distribution exists such that .

(v) For any positive Bernoulli distribution , we have .

We now describe the contents of our paper. Section 2 contains the preliminaries: the terminology of the free monoid is settled, and we recall some classical notions and results concerning the codes. The preceding Theorem 1 is established in Section 3, where an original example of equation is studied. In Section 4, we present several examples of finite complete -invariant codes. The problem of embedding a finite -invariant code into a complete one is also discussed: this ensures a transition to the question of embedding a regular -invariant code into a complete one. This last question is studied in Section 5, where the preceding Theorem 2 and Theorem 3 are established.

## 2 Preliminaries

### 2.1 Words and free monoid

We adopt the notation of the free monoid theory. In the whole paper, we consider an alphabet , and we denote by the free monoid that it generates. Given a word , we denote by its length, the empty word, which we denote by , being the word with length . Given a subset of , we denote by the submonoid of that is generated by , moreover we set .

Let and . We say that is a prefix (suffix) of if a word exists such that (). Similarly, is a factor of if two words exist such that . Given a non-empty set , we denote by (, ) the set of the words that are prefix (suffix, factor) of some word in . Clearly, we have (). Given a pair of non-empty words , we say that it overlaps if words exist such that or , with and ; otherwise, the pair is overlapping-free (in such a case, if , we simply say that is overlapping-free).

### 2.2 Variable length codes

It is assumed that the reader has a fundamental understanding with the main concepts of the theory of variable-length codes: we only recall some of the main definitions and we suggest, if necessary, that he (she) report to BPR10 . A subset of is a variable-length code (a code for short) if any equation among the words of is trivial that is, for any pair of sequences of words in , say , , the equation implies and , for each integer . By definition is a free submonoid of .

In the present paper the so-called prefix, suffix and bifix codes play an noticeable part: a code is prefix (suffix) if (). A code is bifix if it is both prefix and suffix.

A code is maximal if it is not strictly included in some other code of . Given a set , it is complete if ; is thin if . Regular codes are well known examples of thin codes (BPR10, , Proposition 2.5.20).

A positive Bernoulli distribution is a morphism from the free monoid onto the multiplicative monoid , such that we have for every , and such that . The uniform distribution corresponds to , for every letter . For any subset of , we set . Clearly, the last sum may be finite or not, however if is a thin subset we have (BPR10, , Proposition 2.5.12); moreover for every code , we have . From this point of view, the following result was established by Shützenberger (e.g. (BPR10, , Theorem 2.5.16)):

###### Theorem 2.1.

Given a thin code , the four following conditions are equivalent:

(i) is complete.

(ii) is a maximal code.

(iii) A positive Bernoulli distribution exists such that .

(iv) For any positive Bernoulli distribution , we have .

### 2.3 (Anti-)automorphisms

In the whole paper, we fix an alphabet and a mapping onto which is either an automorphism or an anti-automorphism: it is an anti-automorphism if it is one-to-one, with and , for any pair of words . For short in any case we write that is an (anti-)automorphism.

We say that the (anti-)automorphism is of finite order if some positive integer exist such that , the smallest one being the so-called order of (trivially is of order ). It is well known that such a condition is satisfied whenever is a finite set; in particular, over a two letter alphabet, any non-trivial (anti-)automorphism is of order that is, it is involutive.

In the whole paper, we are interested in the family of sets that are invariant under (-invariant for short) that is, which satisfy ; the mapping being one-to-one, this is equivalent to . Let . Consider the (unique) anti-automorphism that is defined by . It is straightforward to verify that the mapping is involutive, moreover the sets and are -invariant. In the spirit of the families of codes that were introduced in KM06 , given an (anti-)automorphism , define a -code as a set such that is a code. Clearly, with this definition any -code is a code; the converse is false, as attested below by Example 2.3.

Actually, any -code that is a maximal code, is necessarily -invariant. Indeed, assuming not -invariant, we have , thus is strictly included in the code .

A similar argument proves that if is maximal as a -code, then it is -invariant (indeed, itself is a -code).

Taking account of the fundamental importance of the concept of maximality in the theory of codes, such properties reinforces the relevance of the notion of -invariant code. Let and be the so-called mirror antimorphism: , . Take for the finite (prefix) code . We have , which is not a code ().

## 3 A defect effect for invariant sets

We start with some considerations about -invariant submonoids of . Clearly the intersection of a non-empty family of -invariant free submonoids of is itself a -invariant free submonoid. Given a submonoid of , recall that its minimal generating set is . The following property holds:

###### Proposition 3.1.

Given an alphabet and given an (anti-)automorphism of , let be a submonoid of and let such that . Then the two following properties hold:

(i) If is -invariant then the same holds for .

(ii) If is the minimal generating set of and if is -invariant then is -invariant.

potA-1Proof (i) Assume that the set is -invariant, and let . Since , a finite sequence of words in , namely , exists such that . Since is an (anti-)automorphism, in every case is some concatenation of the words (), therefore we have . Consequently is -invariant.

(ii) Assume that is -invariant and let . It follows from that we have therefore, a sequence of words in , namely , exists such that . Since is an (anti-)automorphism, is in fact some concatenation of the words . Moreover, for each integer , we have , with (). It follows from the definition of that we have and , thus . As a consequence, itself is -invariant.

Informally, the famous defect theorem says that if some words in a set satisfy a non-trivial equation, then these words can be written upon an alphabet of smaller size. In this section, we will examine whether a corresponding result may be stated in the framework of -invariant sets.

###### Theorem 3.2.

Given an alphabet and given an (anti-)automorphism of , let be a -invariant set. Let be the minimal generating set of the smallest -invariant free submonoid of that contains . If is not a code, then we have .

With the notation of Theorem 3.2, since is a code, each word has a unique factorization upon the words of , namely , with (). In a classical way, we say that () is the initial (terminal) factor of (with respect to such a factorization). From this point of view, before to prove Theorem 3.2, we need to establish the following statement:

###### Lemma 3.3.

With the preceding notation, each word in is the initial (terminal) factor of some word in .

potA0Proof By contradiction, assume that a word that is never initial of any word in exists. Set and , for each integer . In a classical way (see e.g. (Lo1983, , p. 7)), since is a code, itself is a code.
For each integer , since is itself an (anti-)automorphism, is a code that is, is a free submonoid of . Consequently, the intersection, say , of the family is itself a free submonoid of .
Let . For each integer , we have , thus . Consequently we have , whence we have therefore, since is onto, we obtain .
Let be an arbitrary word in . Since , and according to the definition of , we have , with , and . Consequently belongs to , therefore we have . Since is -invariant, this implies , for each , thus .
But the word belongs to and does not belong to thus, it doesn’t belong to . This implies : a contradiction with the minimality of . Clearly, similar arguments may be applied to words that are never terminal of any word in : this completes the proof.

potABProof of Theorem 3.2 Let be the mapping from onto which, with every word , associates the initial factor of in its (unique) factorization over . According to Lemma 3.3, is onto. We will prove that it is not one-to-one. Classically, since is not a code, a non-trivial equation may be written among its words, say: Since is a code, a unique sequence of words in , namely () exists such that: This implies and completes the proof.            In what follows we discuss some interpretation of Theorem 3.2 with regard to equations in words. For this purpose, we assume that is finite, being of order , and we consider a finite set of words, say . Let be the union of the sets , for , and assume that a non-trivial equation holds among the words of , namely . By construction is -invariant therefore, according to Theorem 3.2, a -invariant code exists such that , with . This means that each of the words in can be expressed by making use of at most words of type , with and . It will be easily verified that the examples from CCKS11 ; KM08 ; MMNS14 corroborate this fact; moreover, below we mention an original one: Let be an anti-automorphism of order . Consider two different words , with , satisfying the equation: With this condition, a pair of words exists such that , , , thus . It follows from that , thus and . This implies and . Moreover, we have , : we obtain thus, ; hence we have . Consequently, a non-empty word and integers exist such that , . With the preceding notation, we have , , . We verify that .

## 4 Finite complete θ-invariant codes

In this section we are interested in finite complete -invariant codes over an alphabet . Given an arbitrary letter , since for every non-negative integer , we have , necessarily a (unique) positive integer exists such that ; therefore, is necessarily finite. Several examples of finite complete -invariant codes will be presented. We start with prefix codes, which certainly constitute the best-known class of them.

### 4.1 Finite complete prefix θ-invariant codes

Actually finite complete prefix codes play a peculiar part in the framework of codes. A famous result due to Schützenberger S66 (cf. also Br92 ) states that any finite complete code with a finite deciphering delay (e.g. (BPR10, , Ch. 5)) is necessarily a prefix code. In particular, over only one finite complete circular code (or, equivalently, finite complete uniformly synchronized code) can exist, namely the alphabet itself (cf. (BPR10, , Ch. 7, Ch. 10), L76 ).

It is well-known that each prefix set, say , can be represented by a tree, say , of arity : in this representation, each node (i.e. vertice) is a prefix of some word in (i.e. an element of ), the root being , the empty word. Moreover, given two nodes , and a letter , an edge with label exists from to in if, and only if, we have : we denote such a labeled edge by and we say that is a successor of . In that representation, complete prefix codes correspond to complete trees, in the sense where each interior node has exactly successors.

We start with the case where is an automorphism of . Given a prefix set , we say that the corresponding tree is invariant under whenever is an edge of if, and only if, is an edge of . With this notion, a characterization of -invariant prefix codes may be stated:

###### Claim 1.

Let be a finite alphabet, let be an automorphism of and let be a prefix code. Then is -invariant if, and only if, the tree itself is invariant under .

pot-000Proof Assume that is -invariant, and let an arbitrary edge in . By construction a word exists such that . Since is a -invariant set, this implies , thus and . Consequently, is an edge of , therefore is invariant under .

Conversely, assume that is invariant under . Let , with (). By construction, the following sequence of edges exists in (for , we set ):

 (w1⋯wi,wi+1,w1⋯wi+1)    (0≤i≤n−1),

moreover the node has no successor. Since is invariant under , a corresponding sequence of edges exists in , namely:

 (θ(w1)⋯θ(wi),θ(wi+1),θ(w1)⋯θ(wi+1))    (0≤i≤n−1).

Since the node has no successor, the same holds for the corresponding node : this implies .            Let , and be the automorphism defined by , . Given an arbitrary integer , consider the following set:

 X=⋃1≤i≤n−1{aib,bia}∪{an,bn}.

By construction, is a prefix code. Moreover, is complete: this can be directly verified by examining (an alternative method consists in applying Theorem 2.1 (iii), with the uniform Bernoulli distribution). It is also straightforward to verify that is -invariant.

Note that is not bifix: indeed, for each integer , the word is a suffix of . Figure 1 illustrates the corresponding tree for .

In the case where is an anti-automorphism, the following property is noticeable:

###### Claim 2.

Let be an anti-automorphism onto and let be a finite -invariant code. If is prefix, then it is necessarily bifix.

pot00Proof By contradiction, assume not bifix, thus not suffix: words , exist such that . Since is -invariant, we have , thus : this contradicts the fact that is a prefix code.           The result of Claim 2 directly leads to examine the behavior of finite complete bifix codes with regard to (anti-)automorphisms.

### 4.2 Finite complete bifix θ-invariant codes

At first, it is worth mentioning a well-known class of finite bifix codes: A set is uniform if a positive integer exists such that . Trivially, such a set is a bifix code moreover, it is complete if, and only if, we have . It is straightforward to verify that is invariant under every (anti-)automorphism of : indeed, the restriction of such a mapping on words of length induces a permutation of . It is a natural question to ask whether non-uniform finite complete bifix -invariant codes exist. By exhibiting infinite classes of convenient codes, the three following examples allow to bring a positive answer. Actually, the two first families of codes have been constructed by applying a famous internal transformation to some uniform code C72 (cf. also (BPR10, , § 6.2)) Let and be the anti-automorphism of that is defined by , .
Let , with . Consider the following set:

 X=(An∖(Aakbk∪akbkA))∪{akbk}∪AakbkA.

The set is a (uniform) bifix code. Since the condition () necessarily implies (), is a finite (non-uniform) bifix code. The code is complete: indeed, we have therefore, given an arbitrary positive Bernoulli distribution over , we have:

 π(X)=π(An∖(Aakbk∪akbkA))+π(akbk)+π(AakbkA)=1−2π(akbk)+2π(akbk)=1.

Furthermore, since we have and , is -invariant.
For , the preceding construction leads to the following finite complete bifix -invariant code (C72, , (1)):

 X={a3,ba2,b2a,b3,ab,a2ba,a2b2,baba,bab2}.

Let and be the so-called mirror-image, which is in fact the anti-automorphism defined by , .
Take , with . We have ; therefore an examination similar to the one we applied at Example 4.2 leads to verify that the following set is a finite complete bifix -invariant code:

 X=(An∖(Aakbkak∪akbkakA))∪{akbkak}∪AakbkakA.

For (i.e. ) the corresponding binary tree is represented in Figure 2. We observe that, in view of constructing arbitrarily large non-uniform finite bifix -invariant codes over arbitrarily large finite alphabets, the two last constructions can be generalized, as illustrated by the following example: 1) Let and be the anti-automorphism defined by , , .

Take , with , and

 W=⋃i∈Z{θi(akbk)}={akbk,ckbk,ckak,bkak,bkck,akck}.

By construction we have therefore, the following set is a -invariant finite bifix code:

 X=(An∖(AW∪WA))∪W∪AWA. (1)

Moreover, is complete: indeed, by construction we have therefore, for any positive Bernoulli distribution over , we have .

2) Similarly, over take for the anti-automorphism onto defined by , , . Set and

 W=⋃i∈Z{θi(akbkak)}={akbkak,bkckbk,ckakck}.

Applying the construction from (1) also leads to obtain a finite complete bifix -invariant code.

### 4.3 Non-prefix non-suffix finite complete θ-invariant codes

In the most general case, given an (anti-)automorphism of , we are looking to finite codes which are both complete and -invariant. With regard to the last condition, the following statement brings some characterization:

###### Claim 3.

Let be an (anti-)automorphism onto and let be a finite subset of . Then is -invariant if, and only if, it is the disjoint union of a finite family of uniform -invariant codes.

prf1Proof Let be the unique increasing finite sequence of the lengths of the words in . For each , set . By construction, each set is a uniform code, moreover we have:

 X=⋃1≤i≤nXi.

Clearly, the set is -invariant if, and only if, for each integer , induces a permutation of itself.           When is a required to be a code, Claim 3 only leads to some necessary condition. For instance, the set , which satisfies the condition of the claim, is -invariant, but clearly it is not a code. Actually, despite that in any case -invariance is preserved with respect to the union of sets, the main obstacle is that, given two (disjoint) codes, there is no characterization that can guarantee that their union remains a code.

Of course, one can wonder about the impact of -invariance itself on the structure of a finite complete code. Indeed, in view of the above, such an influence is very strong with regard to two special families of codes: the uniform ones and, with respect to automorphisms, the family of prefix non-suffix codes. However, the part of -invariance appeared in fact of lesser importance in the construction of our families of bifix codes, where it essentially involved the structure of a few convenient words (e.g. the elements of ).

Things become even more complex when attempting to construct finite complete -invariant codes that are neither prefix nor suffix. Indeed, with regard to finite complete codes, although that some famous families have been exhibited (e.g. DF89 ; DFR85 ), no general structure is known. However, finite complete -invariant codes that are neither prefix nor suffix exist as attested by the following example: With the anti-automorphism that was introduced in Example 4.2 (which swaps the letters and ), consider the classical finite complete code (RSS89, , Example 2), which is neither prefix, nor suffix. It is straightforward to verify that it is -invariant (we have ).

### 4.4 Toward the construction of regular complete θ-invariant codes

In R75 , by making use of factorizations of the so-called cyclotomic polynomials, the author provided a family of non-finitely completable codes. It is therefore a natural question to ask whether corresponding objects exist in the framework of -invariant codes.

Let be a finite alphabet, and let be an (anti)-automorphism of . Given a finite code , if is embeddable into a complete -invariant code, say , then, with the terminology of Remark 2.3, it has to be a -code. Indeed the set is necessarily a -invariant code that is included in . Therefore, our problem comes down to wonder whether a given finite -invariant code can be embedded into a complete one.

We begin by strictly restraining the problem to the framework of prefix codes. Given a (non-trivial) automorphism , according to the preceding Claim 1 any -invariant prefix code can be embedded into a -invariant complete one. Informally, if suffices to complete the corresponding tree with convenient ones of arity that are invariant under .

In the case of anti-automorphisms, according to Claim 2, for being embeddable into a complete one, a finite prefix -invariant code has to be bifix. However, the converse is false; indeed there are finite bifix -invariant codes that cannot be included into any complete one, as attested by the following example: 1) Let , and be be the mirror anti-automorphism of Example 4.2.
At first, we observe that the finite -invariant bifix code cannot embed into any finite complete bifix (not necessarily -invariant) code. Indeed, assume that such a complete code, say , exists: necessarily is prefix and complete, hence for any positive integer , we have . Therefore a positive integer exists such that belongs to ; since belongs to this contradicts the fact that is bifix.
As a consequence cannot be included in any finite complete prefix -invariant code. Indeed, according to Claim 2, such a code should be bifix.

2) Note that the infinite (regular) set is a -invariant bifix code which contains . Moreover, taking for the uniform Bernoulli distribution, it is straightforward to verify that we have , thus is complete. We do not know whether there are finite -invariant complete codes that contain the code of Example 4.4. Actually, as far as we know, the question of embedding a finite -invariant code into a complete one remains open.

From another angle, the study in R75 led its author to conclude that the study of all finite codes requires also investigations on the infinite ones. From that, the question of embedding a finite code into a regular one was open. A positive answer was given in ER85 , where a now famous method for embedding a regular code into a complete one was published.

From this last point of view, in the next section, we will interest in the problem of embedding a regular -invariant code into a regular complete one.

## 5 Embedding a regular θ-invariant code into a complete one

### 5.1 Some notation

In this section we consider an (anti-)automorphism of , and a non-complete -invariant code . We ask for a complete regular -invariant code such that . We will bring a positive answer: let’s begin by describing our construction.

Let be a non-complete -invariant code, and let . Necessarily, we have (otherwise, should be complete). Without loss of generality, we may assume that the initial and the terminal letters of are different (otherwise, substitute to the word , with and ): in particular, we have . Set:

 z=¯¯¯a|y|ya|y|   (with  y∈aA∗¯¯¯a). (2)

Since is an (anti-)automorphism, for each integer , two different letters exist such that the following property holds:

 θi(z)=¯¯b|y|θi(y)b|y|   (with  θi(y)∈bA∗¯¯b). (3)

Finally, we introduce the three following sets:

 Z=⋃i∈Z{θi(z)}, (4)
 W=ZA∗∩A∗Z, (5)
 T=W∖(W∪X)(W∪X)+. (6)

By construction, the following inclusion holds:

 W⊆(X∪T)+. (7)

### 5.2 Basic properties of Z

By construction, each element of the preceding set has length . Given two (not necessarily different) integers , we will accurately study how the two words may overlap.

###### Lemma 5.1.

With the notation in (3), let , such that and . Then we have , moreover a letter and a unique positive integer (depending of ) exist such that we have , , with .

pot01Proof According to (3), we set and , with , and . Since is an (anti-)automorphism, we have , thus ; since we have , exactly one of the following cases occurs:
Case 1: . With this condition, we have ( and , which contradicts .
Case 2: . This condition implies and , which contradicts .
Case 3: . We obtain and which contradicts .
Case 4: . With this condition, necessarily we have , therefore an integer exists such that and .

###### Lemma 5.2.

With the preceding notation, we have .

pot02Proof By contradiction, assume that , and exist such that . By comparing the lengths of with , exactly one of the three following cases occurs:
Case 1: and . With this condition, we have and , therefore the word is a factor of : this contradicts .
Case 2: . We have in fact and . We are in the condition of Lemma 5.1: the words , overlap. Consequently, and exist such that and , with and . But, by construction, we have . Since we assume , this implies , hence we obtain