implemented duplication checking (for LHS only)

The statement from commit b9112cf that we only need to check the
right-hand side was wrong. We only need to check the left-hand side!
This implementation uses the original result from Elem to check for
duplicates. The reason for doing it like this is that implementing it
directly on signatures is very slow.