# Semi-Thue system

In theoretical computer science and mathematical logic a string rewriting system (SRS), historically called a semi-Thue system, is a rewriting system over strings from a (usually finite) alphabet. Given a binary relation $R$ between fixed strings in the alphabet, called rewrite rules, denoted by $s\rightarrow t$ , an SRS extends the rewriting relation to all strings in which the left- and right-hand side of the rules appear as substrings, that is $usv\rightarrow utv$ , where $s$ , $t$ , $u$ , and $v$ are strings.

The notion of a semi-Thue system essentially coincides with the presentation of a monoid. Thus they constitute a natural framework for solving the word problem for monoids and groups.

An SRS can be defined directly as an abstract rewriting system. It can also be seen as a restricted kind of a term rewriting system. As a formalism, string rewriting systems are Turing complete. The semi-Thue name comes from the Norwegian mathematician Axel Thue, who introduced systematic treatment of string rewriting systems in a 1914 paper. Thue introduced this notion hoping to solve the word problem for finitely presented semigroups. It wasn't until 1947 the problem was shown to be undecidable— this result was obtained independently by Emil Post and A. A. Markov Jr.

## Definition

A string rewriting system or semi-Thue system is a tuple $(\Sigma ,R)$ where

If the relation $R$ is symmetric, then the system is called a Thue system.

$s\rightarrow _{R}t$ if and only if there exist $x$ , $y$ , $u$ , $v$ in $\Sigma ^{*}$ such that $s=xuy$ , $t=xvy$ , and $u\rightarrow v$ .

Clearly in a semi-Thue system we can form a (finite or infinite) sequence of strings produced by starting with an initial string $s_{0}\in \Sigma ^{*}$ and repeatedly rewriting it by making one substring-replacement at a time:

$s_{0}\ \rightarrow _{R}\ s_{1}\ \rightarrow _{R}\ s_{2}\ \rightarrow _{R}\ \ldots$ ## Factor monoid and monoid presentations

We immediately get some very useful connections with other areas of algebra. For example, the alphabet {a, b} with the rules { ab → ε, ba → ε }, where ε is the empty string, is a presentation of the free group on one generator. If instead the rules are just { ab → ε }, then we obtain a presentation of the bicyclic monoid.

The importance of semi-Thue systems as presentation of monoids is made stronger by the following:

Theorem: Every monoid has a presentation of the form $(\Sigma ,R)$ , thus it may be always be presented by a semi-Thue system, possibly over an infinite alphabet.

## The word problem for semi-Thue systems

The word problem for semi-Thue systems can be stated as follows: Given a semi-Thue system $T:=(\Sigma ,R)$ and two words (strings) $u,v\in \Sigma ^{*}$ , can $u$ be transformed into $v$ by applying rules from $R$ ? This problem is undecidable, i.e. there is no general algorithm for solving this problem. This even holds if we limit the input to finite systems.

Martin Davis offers the lay reader a two-page proof in his article "What is a Computation?" pp. 258–259 with commentary p. 257. Davis casts the proof in this manner: "Invent [a word problem] whose solution would lead to a solution to the halting problem."

## Connections with other notions

A semi-Thue system is also a term-rewriting system—one that has monadic words (functions) ending in the same variable as left- and right-hand side terms, e.g. a term rule $f_{2}(f_{1}(x))\rightarrow g(x)$ is equivalent with the string rule $f_{1}f_{2}\rightarrow g$ .

A semi-Thue system is also a special type of Post canonical system, but every Post canonical system can also be reduced to an SRS. Both formalism are Turing complete, and thus equivalent to Noam Chomsky's unrestricted grammars, which are sometimes called semi-Thue grammars. A formal grammar only differs from a semi-Thue system by the separation of the alphabet in terminals and non-terminals, and the fixation of a starting symbol amongst non-terminals. A minority of authors actually define a semi-Thue system as a triple $(\Sigma ,A,R)$ , where $A\subseteq \Sigma ^{*}$ is called the set of axioms. Under this "generative" definition of semi-Thue system, an unrestricted grammar is just a semi-Thue system with a single axiom in which one partitions the alphabet in terminals and non-terminals, and makes the axiom a nonterminal. The simple artifice of partitioning the alphabet in terminals and non-terminals is a powerful one; it allows the definition of the Chomsky hierarchy based on the what combination of terminals and non-terminals rules contain. This was a crucial development in the theory of formal languages.

## History and importance

Semi-Thue systems were developed as part of a program to add additional constructs to logic, so as to create systems such as propositional logic, that would allow general mathematical theorems to be expressed in a formal language, and then proven and verified in an automatic, mechanical fashion. The hope was that the act of theorem proving could then be reduced to a set of defined manipulations on a set of strings. It was subsequently realized that semi-Thue systems are isomorphic to unrestricted grammars, which in turn are known to be isomorphic to Turing machines. This method of research succeeded and now computers can be used to verify the proofs of mathematic and logical theorems.

At the suggestion of Alonzo Church, Emil Post in a paper published in 1947, first proved "a certain Problem of Thue" to be unsolvable, what Martin Davis states as "...the first unsolvability proof for a problem from classical mathematics -- in this case the word problem for semigroups." (Undecidable p. 292)

Davis [ibid] asserts that the proof was offered independently by A. A. Markov (C. R. (Doklady) Acad. Sci. U.S.S.R. (n.s.) 55(1947), pp. 583–586.