Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isequal violates transitive property #132

Open
glennmoy opened this issue Oct 26, 2022 · 1 comment
Open

isequal violates transitive property #132

glennmoy opened this issue Oct 26, 2022 · 1 comment

Comments

@glennmoy
Copy link
Contributor

glennmoy commented Oct 26, 2022

Bit of technicality but according to the docs for isequal

isequal is an equivalence relation - it is reflexive (=== implies isequal), symmetric (isequal(a, b) implies isequal(b, a))
and transitive (isequal(a, b) and isequal(b, c) implies isequal(a, c)).

but one can easily violate this last property in AxisKeys

julia> A = ones(3);

julia> KA1 = wrapdims(ones(3), 'a':'c');

julia> KA2 = wrapdims(ones(3), 'd':'f');

julia> isequal(A, KA1)
true

julia> isequal(A, KA2)
true

julia> isequal(KA1, KA2)
false

I guess isequal is overloaded to account for floats and missings when comparing the underlying arrays but it means we violate this property of the function when comparing between keyed arrays. I'm wondering if this is indeed intended behaviour or an oversight when overloading the function?

@glennmoy glennmoy changed the title isequal violates transitive propery isequal violates transitive property Oct 26, 2022
@mcabbott
Copy link
Owner

Almost certainly an oversight, sorry. (IIRC hash was also broken for quite a while.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants