in reply to Re: If I was forced to use only one kind of loop for the rest of my days it would be a in thread If I was forced to use only one kind of loop for the rest of my days it would be a
I certainly wouldn't choose foreach as the single looping construct, as I've learnt that it wouldn't give me a Turingcomplete language. In logician terms, we say that you can build constructive languages from foreach, which is a true subset of the set of recursively enumerable languages.
Who cares about Turing completeness? You're running on a machine with a finite number of states; so a DFA language is all you can really implement in real life. Turing complete languages can't be implemented; just approximated.
Godel's theorem implies that any language you design is by definition incomplete; no matter how big you make the field of numbers that it enumerates, you can make an infinite number of infinitely more expressive languages (which is unsurprising, since Cantor proved that there are an infinite number of magnitudes of infinities, making the whole thing hard to talk about...)
It's silly to stop with a Turing machine; why not work over a bigger field than the integers, if you're just doing abstract math for the fun of it? And if you're not just doing abstract math for the fun of it, why are you bothering to talk about infinity at all?

AC
Re^3: If I was forced to use only one kind of loop for the rest of my days it would be a
by ambrus (Abbot) on Oct 01, 2005 at 15:00 UTC

Who cares about
Turing completeness? You're running on a machine with a finite
number of states; so a DFA language is all you can really
implement in real life. Turing complete languages can't be
implemented; just approximated.
I could attack this statement from the theocretical side.
Computer hardware is developping in a very fast pace.
Let's imagine you have a system where
the state of the program can be saved and reloaded on a
machine with more memory,
or one that runs on a transparent
cluster of machines where new nodes can be added dynamically
and old nodes discarded.
Such a system could run forever, if you keep updating it with
new hardware.
While my lifetime or the lifetime of the computer I'm typing
on right now is certainly finite, such an advanced system
could live forever, if the civilisation doesn't end in
some catastrophe.
(In fact, Paul Davies argues in his book
The Last Three Minutes that a superentity
could do an infinite number of calculations,
and discusses this in the two cases of whether the Universe
will expand forever and end in a Big Chill, or
gravitation will win and the Universe will end in a
Big Crunch.)
However, even if a DFA is all you can implement in the
realworld
(there are some steps between the DFA and a Turing
machine in power of course),
I am a mathematician, and I'd like to at least imagine that
I have a Turingcomplete machine.
I use it even if it's only a theocretical construction.
I am not an engineer, who uses a ruler to draw straight line,
and uses large plastic templates to be able to draw any
kind of ellipse.
I just draw a bumpy line or a potato by hand, and say it's
a straight line (moreover,
an infinitely extending straight line that has no width or
thickness) or an ellipse.
This is a very pleasant, almost godlike state,
because I can create objects engineers can't even dream of
just by the power of my mind.
Naturally, this is not the real reason I wouldn't rely on
foreach loops.
The reason is simply that they're often difficult to use.
It's not easy to convert while loops to foreach loops.
It's even more difficult to do it if you care about efficency
(because I don't just have any DFA, but a DFA with a
limited number of states and limited speed of execution).
Foreach loops require to use sideeffects even if I
don't want to, and you could easily avoid it with do loops.
Foreach loops come in different versions
in each programming language.
But the deciding reason is that C doesn't have a
foreach loops, so if I decided on foreach, I couldn't use
C anymore.
Update: "it's silly to stop with a Turingmachine"  you're
right with this part.
"Why not use a bigger field(?) than the integers"  indeed, why not:
Symbolic calculations with operator overload, Re^3: Illegal Modulus zero.
 [reply] 

I could attack this statement from the theocretical side. Computer hardware is developping in a very fast pace. Let's imagine you have a system where the state of the program can be saved and reloaded on a machine with more memory, or one that runs on a transparent cluster of machines where new nodes can be added dynamically and old nodes discarded. Such a system could run forever, if you keep updating it with new hardware.
Nope, not even theoretically possible, unless you're much more theoretical than me. You need infinite memory as well as infinite time; where are you going to get infinite matter? It would take infinite energy to assemble it all. It would take infinite space to put it, and we're pretty sure the universe is finite, even if constantly expanding.
Worse yet, any system we can concieve of has some critical component with nonzero probability of failure. Over infinite time, that nonzero failure probability becomes a certainty. To my mind, anything that requires perfect anything as a theoretical condition of it's existance is just a mathematical excercise, and there are more interesting ones out there.
Update: "it's silly to stop with a Turingmachine"  you're right with this part. "Why not use a bigger field(?) than the integers"  indeed, why not: Symbolic calculations with operator overload, Re^3: Illegal Modulus zero.
I wasn't trying to argue for computer implementation of various fields (the most basic being simple polynomials), nor was I looking for a first year primer on group theory. Thanks, but I've been to school once already. :)
My point was, if you're just in it for the complex mathematical abstraction, you can carry a Turing machine as far as you like. Cantor's theorems (together with some others) imply that you can make fields as arbitrarilly large as you like: for any field you care to name, there's a field extension that will make it infinitely bigger, even if the field already was infinite in size. Godel's theorem states that the field extension can never be large enough; for any field with basic, interesting properties, there is always a proposition which has a truth or falsehood which is expressable in a given field, but the truth or falsehood of that statement is not resolvable within that field, but only (possibly) in some field extension.
You can build an infinite number of metaTuring machine models in your head, and use them to do transfinite arithmetic if you so choose. None of it means anything, though; you're stuck with boring old DFAs when it comes down to what you can really ever build, so trotting out Intro To Theoretical Computing is nice and all, but in the real world, we can't even factor million digit numbers, let alone infinitely large ones. It would be nice to solve the optimal Travelling Salesman problem for all the cities on the planet, but we can't even do a single country. It's a long, long way to infinity!

AC
 [reply] 

