  Let $A$ be a finite or countable alphabet and let $\theta$ be 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 $\theta$ ($\theta$-invariant for short).We establish an
extension of the famous defect theorem. Moreover, we prove that for the
so-called thin $\theta$-invariant codes, maximality and completeness are two
equivalent notions. We prove that a similar property holds in the framework of
some special families of $\theta$-invariant codes such as prefix (bifix) codes,
codes with a finite deciphering delay, uniformly synchronized codes and
circular codes. For a special class of involutive antimorphisms, we prove that
any regular $\theta$-invariant code may be embedded into a complete one.
