Live data from Hacker News

A proof that Unix utility sed is Turing complete

catonmat.net

11–20 of 109 posts

Re: A proof that Unix utility sed is Turing complete

#11
post #5

sed really is a powerful utility. I once wrote a tool in sed that strips HTML tags leaving just plain text as a fun exercise. Naturally it can't handle complicated cases but for many simple use cases it works. The code, though, is basically unreadable.

I used to write web scrapers with curl/grep/sed back in the day. Fun times.

Re: A proof that Unix utility sed is Turing complete

#12

Has anyone written a kind of Turing machine gateway API, where people write an adaptor to the API and you can then use the gateway to use any Turing machine backend to run any other(Turing complete) program. Would be interesting to see e.g. how fast Microsoft Word runs on a sed based backend.

This that you describe is essentially a Universal Turing Machine.

Re: A proof that Unix utility sed is Turing complete

#13
In a course on algorithms I took in Moscow State Uni (Russia), we were told there are two ways to describe a Turing machine:

- One with a tape & state transition table - A string & a list of string replacements

Then we proved this two definitions being equal.

And programmed for each ‘system’ a little. I must admit, programming with ‘string replacements’ is much much more fun than doing ‘tape & table’.

Is this just some Russian quirk or the same in the West CS courses, too?

Re: A proof that Unix utility sed is Turing complete

#15

Has anyone written a kind of Turing machine gateway API, where people write an adaptor to the API and you can then use the gateway to use any Turing machine backend to run any other(Turing complete) program. Would be interesting to see e.g. how fast Microsoft Word runs on a sed based backend.

You're basically describing compilers. Microsoft Word probably wouldn't run on sed because it requires things outside of the capabilities of a Turing machine, like being able to produce a GUI.

Re: A proof that Unix utility sed is Turing complete

#16
post #13

In a course on algorithms I took in Moscow State Uni (Russia), we were told there are two ways to describe a Turing machine: - One with a tape & state transition table - A string & a list of string replacements Then we proved this two definitions being equal. And programmed for each ‘system’ a little. I must admit, programming with ‘string replacements’ is much much more fun than doing ‘tape & table’. Is this just so…

I think the other formalism you're talking about is

https://en.wikipedia.org/wiki/Markov_algorithm

There are a number of different models of universal computation that were formulated in the 1930s or soon afterward and can all be proven to be equivalent in power. In CS courses in the U.S., people might learn about more than one of these and also prove that they're equivalent. But only the one with the tape and symbols is referred to as a "Turing machine" here; the other ones might be called "computation models", "computation formalisms", or something similar.

I don't think that the string-rewriting model is as commonly taught over here, although I'm sure it's alluded to in discussions of rewriting in formal grammars

https://en.wikipedia.org/wiki/Rewriting

Interestingly, the Markov who devised this model of computation is apparently the son of the Markov who studied Markov chains and Markov processes.

Re: A proof that Unix utility sed is Turing complete

#17
post #16
post #13

In a course on algorithms I took in Moscow State Uni (Russia), we were told there are two ways to describe a Turing machine: - One with a tape & state transition table - A string & a list of string replacements Then we proved this two definitions being equal. And programmed for each ‘system’ a little. I must admit, programming with ‘string replacements’ is much much more fun than doing ‘tape & table’. Is this just so…

I think the other formalism you're talking about is https://en.wikipedia.org/wiki/Markov_algorithm There are a number of different models of universal computation that were formulated in the 1930s or soon afterward and can all be proven to be equivalent in power. In CS courses in the U.S., people might learn about more than one of these and also prove that they're equivalent. But only the one with the tape and symbol…

You are right. In Romania we also prove that different computational models are equivalent (Turing machine, lambda calculus, Markov machine, logic programming)

Re: A proof that Unix utility sed is Turing complete

#20
post #8

Earlier quoted context omitted.

I vouched for this because even though it's somewhat misguided, I want to know how this person came to this conclusion. This is the event referenced: https://scroll.in/magazine/864603/desperate-for-whatsapp-ten... He was unintentionally DDoSed. He made it right. What's the problem?

Interesting article! He definitely came across as incredibly ignorant about India in the beginning, and started out with a negative viewpoint. Ultimately he finally figured out what was going on and corrected his views, and was finally able to help indians use whatsapp from their JIO phones. He was almost too honest in the article, since it kind of makes him look bad. But I appreciate that honesty.

I don’t think he was negative at all. I think his response was one that most everyone would have had.

What do you think he could have done better?

Post reply on HN