atomspace
atomspace copied to clipboard
Abelian Merkle tree hash in scope link is incorrect
As per discussion in issue #2329, the following code is suspect, and may be unnecessarily weak. The comment in the hash code: https://github.com/opencog/atomspace/blob/26f73776dd689f6b6db0c7642a29c0f9f2374189/opencog/atoms/core/ScopeLink.cc#L230-L234 is suspect: unordered links do maintain a specific order. Although conceptually "abelian", they are not actually so in the representation. This means that the plus sign in
https://github.com/opencog/atomspace/blob/26f73776dd689f6b6db0c7642a29c0f9f2374189/opencog/atoms/core/ScopeLink.cc#L248 https://github.com/opencog/atomspace/blob/26f73776dd689f6b6db0c7642a29c0f9f2374189/opencog/atoms/core/ScopeLink.cc#L254 https://github.com/opencog/atomspace/blob/26f73776dd689f6b6db0c7642a29c0f9f2374189/opencog/atoms/core/ScopeLink.cc#L259
is probably wrong, or at least is unnecessarily weak: it could be/should be replaced by an order-dependent hash.
I'd have to look carefully at the code but the following comment makes me think it does need to be abelian https://github.com/opencog/atomspace/blob/26f73776dd689f6b6db0c7642a29c0f9f2374189/opencog/atoms/core/ScopeLink.cc#L242-L244
yeah, it all made sense when I wrote it. Now I'm less sure. Clearly I'm confused about something.
Closing. I think this was opened by mistake, due to confusion.