Comments on: program equivalence problem http://coder.cl/2012/10/program-equivalence-problem/ web developer & system programmer Wed, 17 Oct 2012 11:33:51 +0000 hourly 1 http://wordpress.org/?v=3.4.2 By: Francisco http://coder.cl/2012/10/program-equivalence-problem/#comment-514 Francisco Wed, 17 Oct 2012 11:33:51 +0000 http://coder.cl/?p=2875#comment-514 Are there any restrictions that make this treatable? If there are no restrictions, you could write the following two programs (using pseudo-code): (1) print "done" (2) n = 3 (or greater) for a,b,c taking all possible integers if a^n + b^n = c^n then print "done" and exit (1) and (2) would only be equivalent if Fermat's last theorem was wrong, and your program would be able to prove this. In a more practical scenario, you could assume that since the number of integers you can try is limited (by the type, or by the memory), (2) will finish at some point and allow you to conclude, not actually proving that there is no solution for the n you chose. If you can assume that both programs finish, it becomes easier, since you can emulate both and see the result. Another restriction that makes it tractable is to assume a memory limit for the programs. This will give a finite number of configurations, and allow you to determine it a program will finish or not. Anyways, that is quite expensive, since you have to keep track of all the possible states that arise within the acceptable parameters. Good luck with the challenge, it will be very interesting to know how the proposed solutions work under tricky cases, and which heuristics they implement :-). Are there any restrictions that make this treatable? If there are no restrictions, you could write the following two programs (using pseudo-code):

(1) print “done”

(2) n = 3 (or greater)
for a,b,c taking all possible integers
if a^n + b^n = c^n then print “done” and exit

(1) and (2) would only be equivalent if Fermat’s last theorem was wrong, and your program would be able to prove this.

In a more practical scenario, you could assume that since the number of integers you can try is limited (by the type, or by the memory), (2) will finish at some point and allow you to conclude, not actually proving that there is no solution for the n you chose.

If you can assume that both programs finish, it becomes easier, since you can emulate both and see the result.

Another restriction that makes it tractable is to assume a memory limit for the programs. This will give a finite number of configurations, and allow you to determine it a program will finish or not. Anyways, that is quite expensive, since you have to keep track of all the possible states that arise within the acceptable parameters.

Good luck with the challenge, it will be very interesting to know how the proposed solutions work under tricky cases, and which heuristics they implement :-).

]]>