Metamath Proof Explorer


Theorem tmachfullfin

Description: Folk theorem. For any algorithm deterministically processing a stream of data (essentially, an infinite tape with cell indices I and finite alphabet U ), if it terminates on every possible input, then it never looks beyond a finite portion U. ran S of the input.

Termination is expressed here with a weaker condition: that an execution may only look at a finite number of cells. Obviously, a program which finishes in a finite number of steps can only scan finite set of cells.

This theorem has many corollaries, such as: any encoding scheme able to represent all integers has at least one non-decodable tape (in other terms, encoding of the infinity).

I no longer have the source for this theorem but I believe I first read about it on LessWrong. My gratitude to Grok for suggesting that this theorem will require Axiom of Choice, and to DeepSeek for suggesting the topology-based proof route. (Contributed by Ender Ting, 28-Jul-2026)

Ref Expression
Hypotheses tmach.finalph
|- ( ph -> U e. Fin )
tmach.exindex
|- ( ph -> I e. _V )
tmach.tapelist
|- ( ph -> T = ( U ^m I ) )
tmach.scanmap
|- ( ph -> S : T --> ( ~P I i^i Fin ) )
tmach.agreemap
|- ( ph -> A = ( z e. T |-> { y e. T | ( y |` ( S ` z ) ) = ( z |` ( S ` z ) ) } ) )
tmach.agreement
|- ( ph -> A. z e. T A. y e. ( A ` z ) ( S ` y ) = ( S ` z ) )
Assertion tmachfullfin
|- ( ph -> U. ran S e. Fin )

Proof

Step Hyp Ref Expression
1 tmach.finalph
 |-  ( ph -> U e. Fin )
2 tmach.exindex
 |-  ( ph -> I e. _V )
3 tmach.tapelist
 |-  ( ph -> T = ( U ^m I ) )
4 tmach.scanmap
 |-  ( ph -> S : T --> ( ~P I i^i Fin ) )
5 tmach.agreemap
 |-  ( ph -> A = ( z e. T |-> { y e. T | ( y |` ( S ` z ) ) = ( z |` ( S ` z ) ) } ) )
6 tmach.agreement
 |-  ( ph -> A. z e. T A. y e. ( A ` z ) ( S ` y ) = ( S ` z ) )
7 1 2 3 4 5 6 tmachlem-franscan
 |-  ( ph -> ran S e. Fin )
8 1 2 3 4 5 6 tmachlem-fssscan
 |-  ( ph -> ran S C_ Fin )
9 unifi
 |-  ( ( ran S e. Fin /\ ran S C_ Fin ) -> U. ran S e. Fin )
10 7 8 9 syl2anc
 |-  ( ph -> U. ran S e. Fin )