Table of Contents
Fetching ...

Turing Completeness of GNU find: From mkdir-assisted Loops to Standalone Computation

Keigo Oka

TL;DR

It is demonstrated that \texttt{find} possesses unexpected computational power, establishing three Turing completeness results using the GNU implementation (a standard in Linux distributions), and placing it among the ``surprisingly Turing-complete'' systems.

Abstract

The Unix command \texttt{find} is among the first commands taught to beginners, yet remains indispensable for experienced engineers. In this paper, we demonstrate that \texttt{find} possesses unexpected computational power, establishing three Turing completeness results using the GNU implementation (a standard in Linux distributions). (1) \texttt{find} + \texttt{mkdir} (a system that has only \texttt{find} and \texttt{mkdir}) is Turing complete: by encoding computational states as directory paths and using regex back-references to copy substrings, we simulate 2-tag systems. (2) GNU \texttt{find} 4.9.0+ alone is Turing complete: by reading and writing to files during traversal, we simulate a two-counter machine without \texttt{mkdir}. (3) \texttt{find} + \texttt{mkdir} without regex back-references is still Turing complete: by a trick of encoding regex patterns directly into directory names, we achieve the same power. These results place \texttt{find} among the ``surprisingly Turing-complete'' systems, highlighting the hidden complexity within seemingly simple standard utilities.

Turing Completeness of GNU find: From mkdir-assisted Loops to Standalone Computation

TL;DR

It is demonstrated that \texttt{find} possesses unexpected computational power, establishing three Turing completeness results using the GNU implementation (a standard in Linux distributions), and placing it among the ``surprisingly Turing-complete'' systems.

Abstract

The Unix command \texttt{find} is among the first commands taught to beginners, yet remains indispensable for experienced engineers. In this paper, we demonstrate that \texttt{find} possesses unexpected computational power, establishing three Turing completeness results using the GNU implementation (a standard in Linux distributions). (1) \texttt{find} + \texttt{mkdir} (a system that has only \texttt{find} and \texttt{mkdir}) is Turing complete: by encoding computational states as directory paths and using regex back-references to copy substrings, we simulate 2-tag systems. (2) GNU \texttt{find} 4.9.0+ alone is Turing complete: by reading and writing to files during traversal, we simulate a two-counter machine without \texttt{mkdir}. (3) \texttt{find} + \texttt{mkdir} without regex back-references is still Turing complete: by a trick of encoding regex patterns directly into directory names, we achieve the same power. These results place \texttt{find} among the ``surprisingly Turing-complete'' systems, highlighting the hidden complexity within seemingly simple standard utilities.
Paper Structure (15 sections, 3 theorems, 12 equations, 2 tables)

This paper contains 15 sections, 3 theorems, 12 equations, 2 tables.

Key Result

Theorem 3.1

GNU find + mkdir is Turing complete for find version $\ge$ 4.2.12 (as of this writing when 4.10.0 is the latest), assuming the resource model in Definition def:resource-model.

Theorems & Definitions (10)

  • Definition 2.1
  • Definition 2.2: Resource model
  • Theorem 3.1
  • Definition 3.2
  • proof
  • Theorem 4.1
  • Definition 4.2
  • proof : Proof for Theorem \ref{['thm:gnu_find_tc']}
  • Theorem 5.1
  • proof