### comment on

 Need Help??
Guys & gulls, --
I'm playing with The unknowable (hereby recommended :) and on the way casting the LISP programs to Perl.

In the statement (from the Gödel proof):
I expect eval to return :
\$is_unprovable('\$value_of('&\$g('&\$g')')')
-- but I get a '1'.

How come?
```#!/usr/bin/perl -w
use strict;
use warnings;

# ====================================================================
+==========
# Fixpoint
# f(x): x -> (('x)('x))
# In LISP:
# define (f x)
#    let y [be] cons "' cons x nil [y is ('x) ]
#    [return] cons y cons y nil    [return (('x)('x))]

# In Perl:
my \$f = sub { my \$x = \$_[0]; return "\$x('\$x')"; };

print &\$f('x'), "\n";
print &\$f('&\$f'), "\n";
print eval &\$f('&\$f'), "\n";
print eval eval eval eval eval &\$f('&\$f'), "\n";
print '&\$f(\'&\$f\')' eq eval eval eval eval eval &\$f('&\$f'), "\n";

# Run :
# x('x')
# &\$f('&\$f')
# &\$f('&\$f')
# &\$f('&\$f')
# 1

# ====================================================================
+==========
# Gödel
# g(x): x -> (is-unprovable (value-of (('x)('x))))]
# In LISP:
# define (g x)
#   let (L x y) cons x cons y nil  [Makes x and y into list]
#   (L is-unprovable
#   (L value-of (L (L "' x) (L "' x))))

# In Perl:
my \$is_unprovable = '\$is_unprovable';
my \$value_of      = '\$value_of';
sub cadr { return (\$_[0]) =~ /\(\'(.*)\'\)/; };

my \$L = sub {  my (\$x, \$y) = @_; return "\$x('\$y')"; };
my \$g = sub {  my \$x = \$_[0];
&\$L(\$is_unprovable, &\$L(\$value_of, "\$x('\$x')")); };

print '&\$g(\'x\')   -> ', &\$g('x'), "\n";
print '&\$g(\'&\$g\') -> ', &\$g('&\$g'), "\n";
### \$is_unprovable('\$value_o
+f('&\$g('&\$g')')')

# Run :
# &\$g('x')   -> \$is_unprovable('\$value_of('x('x')')')
# &\$g('&\$g') -> \$is_unprovable('\$value_of('&\$g('&\$g')')')
# &\$g('&\$g')
# 1                                       ### but it returns 1 ???

Best regards,
Allan dystrup

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

• Are you posting in the right place? Check out Where do I post X? to know for sure.
• Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
• Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
• Want more info? How to link or How to display code and escape characters are good places to start.

Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2022-12-10 05:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?

No recent polls found

Notices?