Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Did you (incorrectly) think I said it would happen for all programs?
Nope.
I said that once one finds a program where this happens, one can prove the non-parsability of Perl.
If this example (from this previous node of yours) proves that perl is unparseable (because it sometimes defines foo, it sometimes doesn't):
BEGIN { eval "sub foo {}" if rand() < 0.5; } foo();
then this next example proves that the halting problem is undecidable (because sometimes it halts, sometimes it doesn't):
if (rand() < 0.5) { 1 while 1; }
But neither is a proof of the undecidability of anything satisfying. They assume an interpretation/model of programs that employ randomness (and by extension, any external calls) which completely trivializes the halting problem into a meaningless statement. I think this is my main objection with your examples.

Turing machines are deterministic, so if you want to model things like random choices and externally-obtained data, you model them (without loss of generality) as being provided as input on separate tapes. Indeed, this is exactly what is done in the theory of computation. For this reason, I have a gut reaction against random choices and external data being used to "prove undecidability." Those issues are red herrings and don't speak to undecidability in any meaningful way. From the perspective of undecidability, they should be considered as simply additional, different kinds of input to a program.

So in the first example above, you can confidently say that whenever the random tape contains such-and-such, the program is syntactic, and otherwise it is not. In the second example, you can confidently say that if the random tape contains such-and-such, then the program halts, and otherwise it does not. You can efficiently solve the parseability problem and the halting problem for classes of programs of this simple form, for the way of modeling a program's random choices that doesn't already trivialize the halting problem. So they are not satisfying demonstrations of undecidability.

On the other hand, it is impossible to decide the parseability problem (however you want to define it) for the class of programs of the following form:

BEGIN { my $x = "... arbitrary perl code ..."; eval "sub foo {}" if eval $x; } foo();
And this does not rely on things like external system calls, or random choices, since the halting problem is still quite meaningful when those things are not used.

blokhead


In reply to Re^6: Perl is not Dynamically Parseable by blokhead
in thread Perl is not Dynamically Parseable by Jeffrey Kegler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (11)
    As of 2014-09-19 10:37 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (135 votes), past polls