pdm-book / community

75 stars 0 forks source link

Correctness issue in Algorithm 11 #8

Open danipozo opened 6 months ago

danipozo commented 6 months ago

Algorithm 11 in the current version claims to implement a selection operator based on a trie iterator: image However it is easy to see that for non-trivial ā it is not correct:

  1. If arity(ā) = depth(T_R), then the algorithm returns ā whether it is in the relation or not.
  2. If arity(ā) = d < depth(T_R), then it returns all tuples of the relation with the first d elements substituted by ā.
  3. In the case of arity(ā) = 0, then it enumerates all tuples of the relation.

As far as I can tell, case 3 is the only one where the description of the inputs and outputs of the algorithm match the actual output, and it is also the only one in which the latter leapfrog triejoin algorithm relies.