This PR cuts some edges from the import graph. Specifically: - `TreeMap` and `HashMap` no longer depend on `String`, so now the expensive things are all in parallel instead of partially in sequence - `Omega` no longer relies on `List` lemmas - The section of the import graph between `Init.Omega` and `Init.Data.Bitvec.Lemmas` is cleaned up a bit
30 lines
891 B
Text
30 lines
891 B
Text
/-
|
||
Copyright (c) 2016 Microsoft Corporation. All rights reserved.
|
||
Released under Apache 2.0 license as described in the file LICENSE.
|
||
Authors: Leonardo de Moura
|
||
-/
|
||
module
|
||
|
||
prelude
|
||
public import Init.Core
|
||
|
||
public section
|
||
|
||
/--
|
||
The `BEq α` and `Hashable α` instances on `α` are compatible. This means that that `a == b` implies
|
||
`hash a = hash b`.
|
||
|
||
This is automatic if the `BEq` instance is lawful.
|
||
-/
|
||
class LawfulHashable (α : Type u) [BEq α] [Hashable α] where
|
||
/-- If `a == b`, then `hash a = hash b`. -/
|
||
hash_eq (a b : α) : a == b → hash a = hash b
|
||
|
||
/--
|
||
A lawful hash function respects its Boolean equality test.
|
||
-/
|
||
theorem hash_eq [BEq α] [Hashable α] [LawfulHashable α] {a b : α} : a == b → hash a = hash b :=
|
||
LawfulHashable.hash_eq a b
|
||
|
||
instance (priority := low) [BEq α] [Hashable α] [LawfulBEq α] : LawfulHashable α where
|
||
hash_eq _ _ h := eq_of_beq h ▸ rfl
|