Newsgroups: rec.arts.int-fiction
Path: news.duke.edu!newsgate.duke.edu!nntp-out.monmouth.com!newspeer.monmouth.com!news.lightlink.com!skynet.be!skynet.be!news-x2.support.nl!news2.euro.net!uunet!ash.uu.net!world!not-for-mail
From: buzzard@TheWorld.com (Sean T Barrett)
Subject: Re: Purity in Programming
Sender: news@world.std.com (Mr Usenet Himself)
Message-ID: <GqEyLK.2JG@world.std.com>
Date: Wed, 23 Jan 2002 23:00:55 GMT
References: <d4b6f29f.0201121136.235ddbc0@posting.google.com> <a2i399$cac$1@usenet.Stanford.EDU> <3c4cab77$0$79558$7f8943f3@newsreader.visi.com> <3vh38.5589$Wf1.2131029@ruti.visi.com>
NNTP-Posting-Host: shell01.theworld.com
Organization: The World Public Access UNIX, Brookline, MA
X-Newsreader: trn 4.0-test72 (19 April 1999)
Lines: 66
Xref: news.duke.edu rec.arts.int-fiction:97729

David Thornley <thornley@visi.com> wrote:
>>I would bet that you could fairly easily write a tester that verifies that,
>>say, a room, the door to which is locked, containing the key to that door,
>>and a treasure, renders an advent-style game "unwinnable".
>
>Nope; you'd lose.  In the first place, TADS and Inform are general-
>purpose programming language, so the Halting Theorem applies.  (Just
>structure the game so that being dead throws the game into a hard loop,
>so it halts only in a designated finishing state or states.)

That's not what the halting problem says at all.

Many many years ago, a fellow named Godel proved that in any
moderately powerful (and consistent) formal math system, there
are going to unprovable truths. This is unfortunate, but it didn't
stop mathematicians from looking for truths or looking for proofs
for them--even looking for proofs for things that looked awfully true
but seemed utterly resistent to proof (like, say, Fermat's LT).
Part of the reason for this is because what Godel showed was that
there are certain mathematical statements which are inherently
"about themselves" that aren't provable, and it's not clear that
any "normal" mathematical propositions are going to be in the space
of "true but not provable".

The halting theorem proof shows that there can't be a program
which can ALWAYS prove FOR ALL PROGRAMS whether it halts or not.
It does this by simply proving the existence of one program with
one input for which it will fail; and it relies on a self-reference
move vaguely like Godel's theorem does. Just like mathematicians
haven't stopped trying to prove theorems, the halting theorem
hasn't stopped compiler authors from analyzing the flow of programs
and reporting on things like unreachable code. (They don't report
much on programs with infinite loops that don't halt, but those
are perfectly acceptable programs and have been since the days
of 10 PRINT "HELLO WORLD" 20 GOTO 10.)

An automated quest-prover sort of thing has been a sort of holy
grail for me since I first interviewed at Looking Glass and asked
whether they did something like that. I've never actually had the
time to spend on one, but I still think it would be a good idea.
In those sorts of games it might be a little bit easier--things
are controlled a little bit more by data than by code, fewer
loops to deal with--but also harder since you have to analyze a
continuous map and determine where the player can reach on it using
some physics system that may not be too easy to predict.

>You can limit conditions to where the problem is guaranteed solvable
>in polynomial time, but I don't know how useful it is, compared to
>maintaining a solution and running the solution through the game,
>changing it as necessary.

The nice thing about a proving system is that it could prove "there
is no way to make this game unwinnable". It's not possible to do
that by just feeding a walkthrough into the game.

Underworld II had a bug where you could go through a conversation
twice or something, and by doing so get some internal flags into
an invalid state. This brought the "servant strike" plot to a halt
and made the game unwinnable. Automated validation of conversations
might have caught it.

I think it would be worth researching. It might, in fact, turn out
to be utterly doomed and explode exponentially as you suggest. But
it might not.

SeanB
