[Math] Translate Programming code to Math

computer science

Almost all mathematical formulas functions etc can be translated to programming codes, can it be done in reverse i.e. code to math?

Is it possible to convert simple programming codes (programs that are not hardware or software specific) to mathematical formulas and functions? i.e. is it possible to translate a program which remove vowels from a string?

I think 'simple programming codes' is a vague statement so I have given the example of type of programs.

Best Answer

I'll provide an example of, say, removing the third to last letter from a string. You could first translate each letter into a number through a process similar to Godel Coding. Say you use something like ASCII, and each letter gets turned into three digits. So, "math" would become 109097116104, because 109 is ASCII for m, 097 ASCII for a, etc.

If you set $x_3 = 109$, $x_2 = 097$, $x_1 = 116$, $x_0 = 104$, and let $x = 1000^3 x_3 + 1000^2 x_2 + 1000 x_1 + x_0$, so that $x$ denotes the string "math". If we want $y$ to denote "math" with the second letter removed, we let $y = 1000^2 y_2 + 1000 y_1 + y_0$ and add the restraints $y_2 = x_3$, $y_1 = x_2$, and $y_0 = x_0$. If we restrict $0 \le x_i < 1000$ and $0 \le y_i < 1000$ for all $i$, then applying this complicated system of equations on $x,y,x_0,x_1,x_2,x_3,y_0,y_1,y_2 $ gives a system of equations that forces the string denoted by $y$ to be the string denoted by $x$, but with the second letter removed. This system of equations can be transformed easily into one huge diophantine equation.

Through a similar process, it turns out any problem solvable by a turing machine can be transformed into a huge diophantine equation. However, it is not a simple procedure.

Related Question