I was just told that the equality of computable functions of type

is decidable. I was a bit confused about this at first, since trivially, the equality of functions

is undecidable: Let
![[.]](/latex?n=09b46f550cd3dadb8caf3fd5f4d355ddb4f344bc9e6378d65c711a805132780f)
be the a complete enumeration of all proofs in our meta-theory

, then define
![g(n)=\left\{\begin{array}{l} 1 \mbox{ if } [n] \mbox{ proves }\bot \\ 0 \mbox{ otherwise}\end{array}\right.](/latex?n=e3c9910da49aff4cbdb67c8b248fc1a96a2d64f7cb803c19333713b152848c28)
, then by Gödel's second incompleteness theorem, we cannot decide whether

.
However, even though the question whether two computable functions

are equal seems harder than the same question for

, it is not. A first step in understanding why is maybe that every terminating algorithm is finite, and therefore can only use finitely many elements of a sequence in

.
Of course, having this information without any proofs I tried to prove it myself. I noticed that this should be strongly related to the
compactness theorem. And here is the outcome:
Lemma 1: Let a computable

be given, and

. Then there is some initial subsequence

of

, such that for all sequences

,

.
Proof: A terminating turing machine can, for every given sequence

, only read finitely many elements of

, thus, there is an upper bound

such that the program is only dependent of elements

. Set

and

. Then

for all sequences

, since the program does not depend on an elements not in

.
□
We say that a computable
depends only on a
sequence

when for every

we have

, and it
depends exactly on

when it depends only on

but this is not the case for subsequences

.
By Lemma 1 it is trivial to proof that two functions

are not equal: Just find a sequence

on that both of them depend only, and for which

. The more interesting part is the case when they are equal.
Using Lemma 1, we can encode such functions

in the following way: Let

be predicate constants, and denote by

the first-order
Peano arithmetic. If

where

depends only on

, then let

, where

is a term constant, and

can be expressed in the form

as usual. Now define

. Obviously,
![f(a)=k \Leftrightarrow (Mod_{f,c}[A_i:\Leftrightarrow(a_i=1)]\models c=k)](/latex?n=842a3df29c5606b5a566f616b3c4ed43e0933afd9d18719973629937a01adc9e)
. Now, if two functions

are equal, we know that

is not satisfiable, and therefore,

. By the
completeness theorem, we therefore know that

, and hence, the equality

is provable.
Nice.