Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Perl is not Dynamically Parseable

by blokhead (Monsignor)
on Oct 12, 2009 at 15:41 UTC ( #800741=note: print w/replies, xml ) Need Help??

in reply to Perl is not Dynamically Parseable

Perhaps a clearer distinction is the following:
It is easy to determine whether a defined sub has a nullary prototype.
Indeed, your runtime_nullary sub determines just that. And "defined" here is important, as we will see below. On the other hand,
It is undecidable to determine whether an arbitrary computation (say, the BEGIN phase of a perl script) results in defining a sub with nullary prototype.
This is demonstrated by your previous undecidability posts. I agree with ikegami in terms of how things are worded. Your "fallacious conclusion" is not fallacious. Its wording makes it sound like the hard part is: given a code ref, determine its prototype. But you can always determine the prototype of a Perl sub. What you can't do is determine whether an arbitrary piece of code will result in defining a nullary prototyped sub. Update: it is this "given arbitrary code" part that I think is not formally exposited in your post.

The thing about "reaching" the determining code is a red herring. It's just part of one (bad?) method of trying to determine the outcome of an arbitrary computation -- by running the computation and then (when it is done) looking for its result. Of course we know that can't work, but it's not saying much more than "you can't wait for a computation to finish, when you're not sure whether the computation will finish".

You could say that this is directly analogous to the halting problem itself. It is easy to determine whether a Turing Machine that has already halted has halted with 0 or 1 on its output tape -- just look at the tape! However, it is undecidable to determine, given a Turing machine, whether it will eventually halt with 0 or 1.

In our context, the sub's prototype is just a place to store the outcome of an arbitrary Turing Machine computation. The problem of reading or interpreting the computation's outcome (determining the sub's prototype) is not undecidable, it's the problem of determining what that outcome of an arbitrary computation will be.

I hope this helps making the distinction clearer & more precise.


Replies are listed 'Best First'.
Re^2: Perl is not Dynamically Parseable
by Jeffrey Kegler (Hermit) on Oct 12, 2009 at 19:26 UTC

    Thanks for the feedback. In response, I've revised the original post in a way that I hope improves it.

    An alternative approach would be to simply state the result and that it is a direct and almost trivial consequence of Rice's Theorem. This result is indeed so trivial mathematically that it is unpublishable, but in a math journal, that's how it would be presented. The article would be very short.

    Because of the significance of these results, I've labored to present them to readers who are Perl-literate, but not fluent in Theory of Computation. The risk is always that a translation from math-speak will seem sloppy to those who understand it and unconvincing to those who don't.

      Concerning your update:

      So therefore, Fallacious Conclusion: We can determine, for arbitrary Perl code, whether any Perl function has a nullary prototype or not.

      It's not clear what that means. Are you talking about a function declaration in the source, a function instance produced by a given parser instance, or the function instances produced by every parser instance.

      First, let me concede that the Fallacious Conclusion does follow from Observations 1-4.

      You can't concede the validity of an argument. You are making an assertion.

      And your assertion is false. The conclusion doesn't follow from the premises (anymore?).

      Perl's compile phase does have Turing machine power,

      You can't use that premise. That's the conclusion of the argument you're trying to verify.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://800741]
[choroba]: :-)

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2017-10-23 16:21 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (281 votes). Check out past polls.