This PR adds decidable equality to `DTreeMap`/`TreeMap`/`TreeSet` and their extensional variants. Stacked on top #11404.
28 lines
555 B
Text
28 lines
555 B
Text
import Std.Data.ExtTreeSet
|
|
|
|
open Std
|
|
|
|
instance : TransOrd Nat := inferInstance
|
|
|
|
@[ext]
|
|
structure A where
|
|
a : Nat
|
|
b : Nat
|
|
deriving Ord
|
|
|
|
instance : BEq A where
|
|
beq x y := x.b == y.b && x.a == y.a
|
|
|
|
instance : TransOrd A := sorry
|
|
|
|
instance : LawfulEqOrd A := sorry
|
|
|
|
@[simp]
|
|
theorem A.beq_eq {x y : A} : (x == y) = (x.b == y.b && x.a == y.a) := rfl
|
|
|
|
instance : LawfulBEq A where
|
|
rfl {x} := by simp
|
|
eq_of_beq {x y} := by grind [A.beq_eq, A.ext]
|
|
|
|
example : Decidable (ExtTreeSet.ofList [A.mk 1 2] = ExtTreeSet.ofList [A.mk 1 2]) := by
|
|
infer_instance
|