Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: sci.logic,sci.math,comp.theory Subject: Re: This is how I solved the Halting Problem Date: Mon, 08 Jul 2019 14:40:56 -0700 Organization: None to speak of Lines: 43 Message-ID: References: <9qGdnS9HpPQroWjBnZ2dnUU7-XmdnZ2d@giganews.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="8b6004560db64a51ff6b4764e0175b72"; logging-data="21305"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19BDYp0wRxkFIcHVvb/+Jqg" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:FRnD18Lf3RU0B55M4z1iGICXD7s= sha1:b/6vZ9Oz19X7Kql+NqIbbNVqFQM= Xref: csiph.com sci.logic:207141 sci.math:448958 comp.theory:18692 André G. Isaak writes: [...] > So why don't you demonstrate how your actual method works. Show how your > method determines whether the following function halts: > > void DoIHalt { > > unsigned long x = 14; > > while (x != 982353739) { > > x = x * 144; > x += 17; > x = x/57; > > }; > > return; > > }; Whether that function halts or not is likely to depend on the C implementation. unsigned long is required to have an upper bound of at least 2**32-1, but it can be bigger, and 2**64-1 is common. Using a fixed-width type uint32_t or uint64_t doesn't *quite* resolve this, since there could be issues with integer promotions on implementations where int is very large. I suggest either assuming a particular value for ULONG_MAX, or modifying the program so its behavior is portable. I believe adding x &= 0xffffffff; after each of the three assignments would do that (and would have no effect on systems with 32-bit unsigned long). (Also, "void DoIHalt" should be "void DoIHalt(void)", the return statement is unnecessary but harmless, and the semicolon on the final "}" is incorrect.) -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */