TM - / / / / / / / / Arup Guha 3/26/02 Example outlining...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// Arup Guha // 3/26/02 // Example outlining the proof by contradiction that shows that the // Halting Problem is undecidable. In essence, I have written functions // that mirror the constructions of TMs given in the proof. What you // find is that no matter what you write for the TM H, the output and // actions of this program are contradictory. This proves that it is // impossible to write a function H, or build a Turing Machine H. public class TM { // This is an example of a Turing Machine M. public static boolean M(String w) { if (w.equals("hello")) { System.out.println("M halts on input "+w+" and returns true."); return true; } else if (w.equals("byebye")) { System.out.println("M halts on input "+w+" and returns false."); return false; } else { for (int i=0; i>-1;); return false; } } // H is supposed to return true if M halts on w, false otherwise. public static boolean H(String encodeM, String w) { if (encodeM.charAt(0) == w.charAt(1)) { System.out.println("H says "+encodeM+" halts on "+w);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

TM - / / / / / / / / Arup Guha 3/26/02 Example outlining...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online