Is CSS Turing Complete?
stackoverflow.com
stackoverflow.com
http://matt.might.net/articles/compiling-up-to-lambda-calcul...
and
http://matt.might.net/articles/implementing-a-programming-la...
Includes some really great links to going from (DOS) echo to a working COM executable: http://lists.canonical.org/pipermail/kragen-discuss/2011-Apr...
There does come a time when young that you can say "finally, no more education!"
What I have found when revisiting topics is that my life experience contributes into the subject for me rather than merely being a set of facts & analogies from someone else.
I only recently read The Annotated Turing by Petzold, that was the kind of eye opener that would have looked far to dry a subject to me years ago. Time has given me the ability to peek through Turing's eyes and imagine the sociological and pedagogical environment he was operating in which really adds to the material.
As far as mathematics go, I took the bare minimum classes that were required for a CS degree: Calc 1 & 2, Linear Algebra, & Discrete Mathematics/Structures. Of course, I can go through text books and online courses on my own at this point, but dedicating regular time for this seems to be the hardest part.
If you want to enjoy linear algebra without the pressure of doing any, I can heartily recommend MIT's open coursewear videos featruring Gilbert Strang
http://www.youtube.com/watch?v=ZK3O402wf1c&list=PLE7DDD91010...
In fact all the MIT stuff I have tried is fun to watch
Thanks for the book recommendation as well.
Anything that can be implemented in CSS, shouldn't be.
I'm joking that people shouldn't write Turing complete code in CSS. Add style properties for days, more power to you, but if someone posts an implementation of Git in CSS next week I will promptly jump off a bridge, laughing all the way down.
[1] https://en.wikipedia.org/wiki/Finite-state_machine [2] https://en.wikipedia.org/wiki/Turing_machine
(Actually, you only need a pushdown automata for context-free languages--I forget what the next step up in the hierarchy is, the one that does require Turing completeness)
It's trivial to demonstrate that a Turing machine with finite memory is equivalent to a FSM. Enumerate all possible memory contents. This number is, again, large for any reasonable amount of memory, but it is finite. For each possible memory content, enumerate the Turing machine states. Each memory state plus machine state becomes one FSM state. The Turing machine defines a transition from one state to another plus an action on memory, which becomes an FSM transition to the state that encodes both the new machine state and the new memory state.
The primary difference between a PDA and an FSM is a PDA has a stack which acts as memory. Thus, a PDA can remember how many parens it has seen before. Every time it sees an open paren it will push it onto the stack, when it sees a close paren it pops. When the stack is empty it matches if the input has been consumed.
The difference between a PDA and a Turing machine is the stack is now a read/writable tape which can move in either direction. Notice how in both formulations there is no limit on the memory (the PDA stack is could be infinite as can the Turing machine tape). In contrast a Finite State Machine doesn't have any memory. The finite refers to the number of states not the amount of memory. Indeed, Turing machines are traditionally formulated with finite states as well.
Thus, a FSM can never match the langauge of matching parens but a Turing machine can. It will either match or consume all of its memory if memory is limited. Memory limitations are not a statement on computational power but rather a statement on feasibility.
https://en.wikipedia.org/wiki/Pumping_lemma_for_regular_lang...
EDIT: Your second paragraph is of course correct - you could encode every possible stack as a FSM if there is a bound on the stack. HOWEVER, if you have a limit on memory but it is essentially unknown (you know memory is finite but you don't know exactly what the limit is) a PDA or a Turing machine will of course be able to match things your FSM cannot (because they can take advantage of the memory your FSM cannot assume it has in its states).
Memory limitations are in some sense an implementation detail. We could design a computer to pause while we buy more ram. Then it could use as much memory (in theory) as the human race could produce. That sounds like infinite for some definition of the word.
But this is not what the grandparent was saying. They said that the language of balanced parentheses with some depth limit d can be matched with a FSM, for any finite d. Similarly, a "Turing machine" with a bounded tape can only recognize a bounded version of the balanced parentheses language.
No, the language of balanced parens is not regular and cannot be matched by a FSM no matter how much memory you have. That's completely true. However, it also cannot be matched by a Turing machine with finite memory, no matter how much memory you have. That is because, as I showed and as you agree is "of course correct", the two machines are equivalent in their capabilities.
In short, it still has infinite memory, you just have to pick how much of it to use when you run it. This differs from an FSM or a Turing machine with finite memory in that you choose the quantity of memory when specifying the machine rather than the input.
I guess I felt that the memory limitation was a misleading way of discussing the machines. Turing machines and PDAs are usually discussed with infinite memory. In practice the input really determines how much memory the machine will use.
Furthermore, I believe that the encoding scheme you suggest will use far more space than the equivalent Turing machine or PDA it encodes. Because, for every state in the machine you have to encode every possible memory configuration for that state. That means you have an exponential explosion in the number of states. This gets to the heart of the matter for me: when memory is bounded using the finite version of a PDA will let you match a deeper nesting of parens than a FSM because it will use memory more efficiently. You have to put the states of the machine somewhere and that place is either memory or hardware which are both limited.
However, the difference is purely in practical terms when it comes time to actually build one. In the theoretical world they are equally capable and can recognize the same languages.
http://en.wikipedia.org/wiki/Chomsky_hierarchy
Incidentally, applicative parsers can parse* context-free grammar whereas monadic parsers can parse context-sensitive grammars.
https://cs.uwaterloo.ca/~plragde/842/handouts/app-mon-qiao.p...
* actually there's a cheat for getting applicative parser combinator libraries to parse a CSG, but lets put that aside for now.
https://en.wikipedia.org/wiki/Rule_110#Interesting_propertie...
Replace the user clicking a button with an automated process and it's easy to see that the CSS+HTML is what is doing the actual processing.
Alternatively, putting a button on a computer that must be pressed to have the CPU execute an instruction and move on to the next doesn't mean that programs on this computer aren't turing complete.
In which case the complete system including the "automated process" is Turing complete, but the CSS itself is not.
>Alternatively, putting a button on a computer that must be pressed to have the CPU execute an instruction and move on to the next doesn't mean that programs on this computer aren't Turing complete.
"Programs" can't be Turing complete, it's a property of computation systems. And putting the button on the computer would indeed mean it wasn't Turing complete (unless you consider the human pushing the button part of the system).