Tools: DFG: Add difference algorithm for device identifiers.

The algorithm has to generate a minimal list of unified ids from a
subset of ids, without allowing ids only present in the superset to
match any of these unified ids.
If you want this explained properly, you better bring a whiteboard.