Implement difference histogram, with lemma code pending