Is nan in (nan,) correct?

Rustom Mody rustompmody at gmail.com
Fri Mar 6 12:36:56 EST 2015


On Friday, March 6, 2015 at 10:48:07 PM UTC+5:30, Chris Angelico wrote:
> On Sat, Mar 7, 2015 at 4:04 AM, Rustom Mody  wrote:
> > You dont grok your theory of computation very well do you?
> >
> > def foo(x): return x + x
> > def bar(x): return x + x
> > def baz(x): return 2*x
> >
> > One can imagine an implementation where
> > id(foo) == id(bar)
> > [I am assuming that id is a good enough approx to bit_representation]
> >
> > Can you imagine an implementation where
> > id(bar) == id(baz)
> > ?
> 
> No, I cannot imagine either. Those functions have different
> identities. They may be considered *equal* but they should not be
> *identical*. I can imagine a language in which they are considered
> indistinguishable and optimized down to one, but if you consider them
> to be the same function, then you've abolished all concept of
> identity.

Treat id as the python version of bit_representation.
Now we have two things (worlds really)
in-python entities like foo/bar/baz
Their mathematical semantics -- the infinite sets of (domain,range)
pairs that they are intended to capture.
[Jargon note: The id-equal is called intensional-equality the math-equality is
called extensional-equality]

To get foo == bar one can imagine something like
1. Hash the dis of every function
2. If a new function being defined is hash-equal to an old one:
     If dis(new) == dis(old)
        make new_name point to old implementation

To make bar == baz we need more and more heavy-duty theorem provers
And will invariably hit halting-problem in some guise or other

> 
> Also, I have no idea what any of this has to do with nans and
> container membership.

⊥ in semantics is the prototypical example of reifying an undefined entity.
As are all the other examples nil/None/nul/nan.

It buys a bigger problem for a smaller one -- Steven's (other thread) example of
"Should I know whether an asteroid the size of Texas is earth bound?"

To take a less apocalyptic example: 
I am holding a bomb in my hand.
Is it good to know that? DOes it help any?
Does the statement "We have a problem!!" make the 'problem' vanish?
⊥/nul/nil/nan are all 'bombs/problems' in some sense



More information about the Python-list mailing list