Word Operation Definable in the Typed lambda-Calculus

A λ-language over a simple type structure is considered. Type B = (O → O) → ((O → O) → (O → O)) is called a binary word type because of the isomorphism between words over a binary alphabet and closed terms of this type. Therefore, any term of type B → (B → ⋯ → (B → B) ⋯) represents an n-ary word function. The problem is: what class of word functions are represented by the closed terms of the examined type. It is proved that there exists a finite base of word functions such that any λ-definable word function is some composition of functions from the base. The algorithm which, for every closed term, returns the function in the form of a composition of basic operations is given. The main result is proved for a binary alphabet only, but can be easily extended to any finite alphabet. This result is a natural extension of the Schwichtenberg theorem (see Schwichtenberg (1975) and Statman (1979)) which solves the same problem for the natural number type N = (O → O) → (O → O).