Ask Your Question
0

Is this a bug? FiniteSetMaps??

asked 12 years ago

SLOtoSF gravatar image

These are two empty maps with two essentially equal parents:

f = FiniteSetMaps(set()).from_dict({})
g = FiniteSetMaps(set(),set()).from_dict({})
f == g

False
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 12 years ago

ppurka gravatar image

updated 12 years ago

They have different hashes

sage: f._hash_()
115435715
sage: g._hash_()
115435971

Also:

sage: f.parent()
Maps from {} to itself
sage: g.parent()
Maps from {} to {}
sage: type(f.parent())
<class 'sage.sets.finite_set_maps.FiniteSetEndoMaps_Set_with_category'>
sage: type(g.parent())
<class 'sage.sets.finite_set_maps.FiniteSetMaps_Set_with_category'>
Preview: (hide)
link

Comments

@ppurka I see that the parents are different and that they have different hashes, but ultimately they function the same, so shouldn't they be considered equal?

SLOtoSF gravatar imageSLOtoSF ( 12 years ago )

Programmatically, they probably can not be considered the same if the parents are different. Without looking at the actual source code, I presume that the computation of the hash will be different in the two different classes.

ppurka gravatar imageppurka ( 12 years ago )

Yes, I guess we have to live with this. Technically if the maps are the same with the same codomain and domain, then they should have the same parent, and because the parent is defined when the maps are created I see how this could be a problem to fix since we can't change parents once the object is created, right?

SLOtoSF gravatar imageSLOtoSF ( 12 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 12 years ago

Seen: 242 times

Last updated: Nov 28 '12