Built with Alectryon, running Coq+SerAPI v8.10.0+0.7.0. Coq sources are in this panel; goals and messages will appear in the other. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus.
(************************************************************************) (* * The Coq Proof Assistant / The Coq Development Team *) (* v * INRIA, CNRS and contributors - Copyright 1999-2018 *) (* <O___,, * (see CREDITS file for the list of authors) *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (* * (see LICENSE file for the text of the license) *) (************************************************************************) Require Export SetoidList Morphisms OrdersTac. Set Implicit Arguments. Unset Strict Implicit.
NB: This file is here only for compatibility with earlier version of
FSets and FMap. Please use Structures/Orders.v directly now.
Inductive Compare (X : Type) (lt eq : X -> X -> Prop) (x y : X) : Type := | LT : lt x y -> Compare lt eq x y | EQ : eq x y -> Compare lt eq x y | GT : lt y x -> Compare lt eq x y. Arguments LT [X lt eq x y] _. Arguments EQ [X lt eq x y] _. Arguments GT [X lt eq x y] _. Module Type MiniOrderedType. Parameter Inline t : Type. Parameter Inline eq : t -> t -> Prop. Parameter Inline lt : t -> t -> Prop. Axiom eq_refl : forall x : t, eq x x. Axiom eq_sym : forall x y : t, eq x y -> eq y x. Axiom eq_trans : forall x y z : t, eq x y -> eq y z -> eq x z. Axiom lt_trans : forall x y z : t, lt x y -> lt y z -> lt x z. Axiom lt_not_eq : forall x y : t, lt x y -> ~ eq x y. Parameter compare : forall x y : t, Compare lt eq x y. Hint Immediate eq_sym : core. Hint Resolve eq_refl eq_trans lt_not_eq lt_trans : core. End MiniOrderedType. Module Type OrderedType. Include MiniOrderedType.
A eq_dec can be deduced from compare below. But adding this
redundant field allows seeing an OrderedType as a DecidableType.
Parameter eq_dec : forall x y, { eq x y } + { ~ eq x y }. End OrderedType. Module MOT_to_OT (Import O : MiniOrderedType) <: OrderedType. Include O.forall x y : t, {eq x y} + {~ eq x y}forall x y : t, {eq x y} + {~ eq x y}assert (~ eq y x); auto. Defined. End MOT_to_OT.x, y:tH:lt y x~ eq x y
Additional properties that can be derived from signature
OrderedType.
Module OrderedTypeFacts (Import O: OrderedType).Equivalence eqsplit; [ exact eq_refl | exact eq_sym | exact eq_trans ]. Qed.Equivalence eqforall x : t, ~ lt x xintros; intro; absurd (eq x x); auto. Qed.forall x : t, ~ lt x xStrictOrder ltsplit; [ exact lt_antirefl | exact lt_trans]. Qed.StrictOrder ltforall x y z : t, lt x y -> eq y z -> lt x zforall x y z : t, lt x y -> eq y z -> lt x zx, y, z:tH:lt x yH0:eq y zHeq:eq x zlt x zx, y, z:tH:lt x yH0:eq y zHlt:lt z xlt x zelim (lt_not_eq (lt_trans Hlt H)); auto. Qed.x, y, z:tH:lt x yH0:eq y zHlt:lt z xlt x zforall x y z : t, eq x y -> lt y z -> lt x zforall x y z : t, eq x y -> lt y z -> lt x zx, y, z:tH:eq x yH0:lt y zHeq:eq x zlt x zx, y, z:tH:eq x yH0:lt y zHlt:lt z xlt x zelim (lt_not_eq (lt_trans H0 Hlt)); auto. Qed.x, y, z:tH:eq x yH0:lt y zHlt:lt z xlt x zProper (eq ==> eq ==> iff) ltProper (eq ==> eq ==> iff) ltProper (eq ==> eq ==> impl) ltx, x':tHx:eq x x'y, y':tHy:eq y y'H:lt x ylt x' y'apply lt_eq with y; auto. Qed.x, x':tHx:eq x x'y, y':tHy:eq y y'H:lt x ylt x y'forall x y : t, lt x y \/ eq x y \/ lt y xintros; destruct (compare x y); auto. Qed. Module TO. Definition t := t. Definition eq := eq. Definition lt := lt. Definition le x y := lt x y \/ eq x y. End TO. Module IsTO. Definition eq_equiv := eq_equiv. Definition lt_strorder := lt_strorder. Definition lt_compat := lt_compat. Definition lt_total := lt_total.forall x y : t, lt x y \/ eq x y \/ lt y xx, y:tTO.le x y <-> lt x y \/ eq x yreflexivity. Qed. End IsTO. Module OrderTac := !MakeOrderTac TO IsTO. Ltac order := OrderTac.order.x, y:tTO.le x y <-> lt x y \/ eq x yx, y, z:t~ lt x y -> eq y z -> ~ lt x zorder. Qed.x, y, z:t~ lt x y -> eq y z -> ~ lt x zx, y, z:teq x y -> ~ lt y z -> ~ lt x zorder. Qed.x, y, z:teq x y -> ~ lt y z -> ~ lt x zx, y, z:t~ eq x y -> eq y z -> ~ eq x zorder. Qed.x, y, z:t~ eq x y -> eq y z -> ~ eq x zx, y, z:teq x y -> ~ eq y z -> ~ eq x zorder. Qed.x, y, z:teq x y -> ~ eq y z -> ~ eq x zx, y, z:t~ lt y x -> lt y z -> lt x zorder. Qed.x, y, z:t~ lt y x -> lt y z -> lt x zx, y, z:tlt x y -> ~ lt z y -> lt x zorder. Qed.x, y, z:tlt x y -> ~ lt z y -> lt x zx, y:t~ lt x y -> ~ eq x y -> lt y xorder. Qed.x, y:t~ lt x y -> ~ eq x y -> lt y xx, y, z:t~ lt y x -> ~ lt z y -> ~ lt z xorder. Qed.x, y, z:t~ lt y x -> ~ lt z y -> ~ lt z xx, y:t~ lt y x -> ~ lt x y -> eq x yorder. Qed.x, y:t~ lt y x -> ~ lt x y -> eq x yx, y:t~ eq x y -> ~ eq y xorder. Qed.x, y:t~ eq x y -> ~ eq y xx, y:tlt x y -> ~ lt y xorder. Qed.x, y:tlt x y -> ~ lt y xx, y:tlt y x -> ~ eq x yorder. Qed.x, y:tlt y x -> ~ eq x yx, y:teq x y -> ~ lt x yorder. Qed.x, y:teq x y -> ~ lt x yx, y:teq x y -> ~ lt y xorder. Qed.x, y:teq x y -> ~ lt y xx, y:tlt x y -> ~ lt y xorder. Qed. Hint Resolve gt_not_eq eq_not_lt : core. Hint Immediate eq_lt lt_eq le_eq eq_le neq_eq eq_neq : core. Hint Resolve eq_not_gt lt_antirefl lt_not_gt : core.x, y:tlt x y -> ~ lt y xforall x y : t, eq x y -> exists H : eq x y, compare x y = EQ Hforall x y : t, eq x y -> exists H : eq x y, compare x y = EQ Hexists H'; auto. Qed.x, y:tH, H':eq x yexists H0 : eq x y, EQ H' = EQ H0forall x y : t, lt x y -> exists H : lt x y, compare x y = LT Hforall x y : t, lt x y -> exists H : lt x y, compare x y = LT Hexists H'; auto. Qed.x, y:tH, H':lt x yexists H0 : lt x y, LT H' = LT H0forall x y : t, lt y x -> exists H : lt y x, compare x y = GT Hforall x y : t, lt y x -> exists H : lt y x, compare x y = GT Hexists H'; auto. Qed. Ltac elim_comp := match goal with | |- ?e => match e with | context ctx [ compare ?a ?b ] => let H := fresh in (destruct (compare a b) as [H|H|H]; try order) end end. Ltac elim_comp_eq x y := elim (elim_compare_eq (x:=x) (y:=y)); [ intros _1 _2; rewrite _2; clear _1 _2 | auto ]. Ltac elim_comp_lt x y := elim (elim_compare_lt (x:=x) (y:=y)); [ intros _1 _2; rewrite _2; clear _1 _2 | auto ]. Ltac elim_comp_gt x y := elim (elim_compare_gt (x:=x) (y:=y)); [ intros _1 _2; rewrite _2; clear _1 _2 | auto ].x, y:tH, H':lt y xexists H0 : lt y x, GT H' = GT H0
For compatibility reasons
Definition eq_dec := eq_dec.forall x y : t, {lt x y} + {~ lt x y}intros; elim (compare x y); [ left | right | right ]; auto. Defined. Definition eqb x y : bool := if eq_dec x y then true else false.forall x y : t, {lt x y} + {~ lt x y}forall x y : t, eqb x y = match compare x y with | EQ _ => true | _ => false endunfold eqb; intros; destruct (eq_dec x y); elim_comp; auto. Qed. (* Specialization of results about lists modulo. *) Section ForNotations. Notation In:=(InA eq). Notation Inf:=(lelistA lt). Notation Sort:=(sort lt). Notation NoDup:=(NoDupA eq).forall x y : t, eqb x y = match compare x y with | EQ _ => true | _ => false endforall (l : list t) (x y : t), eq x y -> In x l -> In y lexact (InA_eqA eq_equiv). Qed.forall (l : list t) (x y : t), eq x y -> In x l -> In y lforall (l : list t) (x : t), List.In x l -> In x lexact (In_InA eq_equiv). Qed.forall (l : list t) (x : t), List.In x l -> In x lforall (l : list t) (x y : t), lt x y -> Inf y l -> Inf x lexact (InfA_ltA lt_strorder). Qed.forall (l : list t) (x y : t), lt x y -> Inf y l -> Inf x lforall (l : list t) (x y : t), eq x y -> Inf y l -> Inf x lexact (InfA_eqA eq_equiv lt_compat). Qed.forall (l : list t) (x y : t), eq x y -> Inf y l -> Inf x lforall (l : list t) (x a : t), Sort l -> Inf a l -> In x l -> lt a xexact (SortA_InfA_InA eq_equiv lt_strorder lt_compat). Qed.forall (l : list t) (x a : t), Sort l -> Inf a l -> In x l -> lt a xforall (l : list t) (x : t), (forall y : t, List.In y l -> lt x y) -> Inf x lexact (@In_InfA t lt). Qed.forall (l : list t) (x : t), (forall y : t, List.In y l -> lt x y) -> Inf x lforall (l : list t) (x : t), (forall y : t, In y l -> lt x y) -> Inf x lexact (InA_InfA eq_equiv (ltA:=lt)). Qed.forall (l : list t) (x : t), (forall y : t, In y l -> lt x y) -> Inf x lforall (l : list t) (x : t), Sort l -> Inf x l <-> (forall y : t, In y l -> lt x y)exact (InfA_alt eq_equiv lt_strorder lt_compat). Qed.forall (l : list t) (x : t), Sort l -> Inf x l <-> (forall y : t, In y l -> lt x y)forall l : list t, Sort l -> NoDup lexact (SortA_NoDupA eq_equiv lt_strorder lt_compat). Qed. End ForNotations. Hint Resolve ListIn_In Sort_NoDup Inf_lt : core. Hint Immediate In_eq Inf_lt : core. End OrderedTypeFacts. Module KeyOrderedType(O:OrderedType). Import O. Module MO:=OrderedTypeFacts(O). Import MO. Section Elt. Variable elt : Type. Notation key:=t. Definition eqk (p p':key*elt) := eq (fst p) (fst p'). Definition eqke (p p':key*elt) := eq (fst p) (fst p') /\ (snd p) = (snd p'). Definition ltk (p p':key*elt) := lt (fst p) (fst p'). Hint Unfold eqk eqke ltk : core. Hint Extern 2 (eqke ?a ?b) => split : core. (* eqke is stricter than eqk *)forall l : list t, Sort l -> NoDup lelt:Typeforall x x' : key * elt, eqke x x' -> eqk x x'unfold eqk, eqke; intuition. Qed. (* ltk ignore the second components *)elt:Typeforall x x' : key * elt, eqke x x' -> eqk x x'elt:Typeforall (x : key * elt) (k : key) (e e' : elt), ltk x (k, e) -> ltk x (k, e')auto. Qed.elt:Typeforall (x : key * elt) (k : key) (e e' : elt), ltk x (k, e) -> ltk x (k, e')elt:Typeforall (x : key * elt) (k : key) (e e' : elt), ltk (k, e) x -> ltk (k, e') xauto. Qed. Hint Immediate ltk_right_r ltk_right_l : core. (* eqk, eqke are equalities, ltk is a strict order *)elt:Typeforall (x : key * elt) (k : key) (e e' : elt), ltk (k, e) x -> ltk (k, e') xelt:Typeforall e : key * elt, eqk e eauto. Qed.elt:Typeforall e : key * elt, eqk e eelt:Typeforall e : key * elt, eqke e eauto. Qed.elt:Typeforall e : key * elt, eqke e eelt:Typeforall e e' : key * elt, eqk e e' -> eqk e' eauto. Qed.elt:Typeforall e e' : key * elt, eqk e e' -> eqk e' eelt:Typeforall e e' : key * elt, eqke e e' -> eqke e' eunfold eqke; intuition. Qed.elt:Typeforall e e' : key * elt, eqke e e' -> eqke e' eelt:Typeforall e e' e'' : key * elt, eqk e e' -> eqk e' e'' -> eqk e e''eauto. Qed.elt:Typeforall e e' e'' : key * elt, eqk e e' -> eqk e' e'' -> eqk e e''elt:Typeforall e e' e'' : key * elt, eqke e e' -> eqke e' e'' -> eqke e e''unfold eqke; intuition; [ eauto | congruence ]. Qed.elt:Typeforall e e' e'' : key * elt, eqke e e' -> eqke e' e'' -> eqke e e''elt:Typeforall e e' e'' : key * elt, ltk e e' -> ltk e' e'' -> ltk e e''eauto. Qed.elt:Typeforall e e' e'' : key * elt, ltk e e' -> ltk e' e'' -> ltk e e''elt:Typeforall e e' : key * elt, ltk e e' -> ~ eqk e e'unfold eqk, ltk; auto. Qed.elt:Typeforall e e' : key * elt, ltk e e' -> ~ eqk e e'elt:Typeforall e e' : key * elt, ltk e e' -> ~ eqke e e'elt:Typeforall e e' : key * elt, ltk e e' -> ~ eqke e e'exact (lt_not_eq H H1). Qed. Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl : core. Hint Resolve ltk_trans ltk_not_eqk ltk_not_eqke : core. Hint Immediate eqk_sym eqke_sym : core.elt:Typea:keye':(key * elt)%typeH:lt a (fst e')H1:eq a (fst e')Falseelt:TypeEquivalence eqkconstructor; eauto. Qed.elt:TypeEquivalence eqkelt:TypeEquivalence eqkesplit; eauto. Qed.elt:TypeEquivalence eqkeelt:TypeStrictOrder ltkelt:TypeStrictOrder ltkintros x; apply (irreflexivity (x:=fst x)). Qed.elt:TypeIrreflexive ltkelt:TypeProper (eqk ==> eqk ==> iff) ltkelt:TypeProper (eqk ==> eqk ==> iff) ltkelt:Typex:keye:eltx':keye':eltHxx':eqk (x, e) (x', e')y:keyf:elty':keyf':eltHyy':eqk (y, f) (y', f')(lt x y -> lt x' y') /\ (lt x' y' -> lt x y)rewrite Hxx', Hyy'; auto. Qed.elt:Typex:keye:eltx':keye':eltHxx':eq x x'y:keyf:elty':keyf':eltHyy':eq y y'(lt x y -> lt x' y') /\ (lt x' y' -> lt x y)elt:TypeProper (eqke ==> eqke ==> iff) ltkelt:TypeProper (eqke ==> eqke ==> iff) ltkelt:Typex:keye:eltx':keye':eltHxx':eq (fst (x, e)) (fst (x', e'))y:keyf:elty':keyf':eltHyy':eq (fst (y, f)) (fst (y', f'))(lt x y -> lt x' y') /\ (lt x' y' -> lt x y)rewrite Hxx', Hyy'; auto. Qed. (* Additional facts *)elt:Typex:keye:eltx':keye':eltHxx':eq x x'y:keyf:elty':keyf':eltHyy':eq y y'(lt x y -> lt x' y') /\ (lt x' y' -> lt x y)elt:Typeforall x x' : key * elt, eqk x x' -> ~ ltk x x'unfold eqk, ltk; simpl; auto. Qed.elt:Typeforall x x' : key * elt, eqk x x' -> ~ ltk x x'elt:Typeforall e e' e'' : key * elt, ltk e e' -> eqk e' e'' -> ltk e e''eauto. Qed.elt:Typeforall e e' e'' : key * elt, ltk e e' -> eqk e' e'' -> ltk e e''elt:Typeforall e e' e'' : key * elt, eqk e e' -> ltk e' e'' -> ltk e e''elt:Typeforall e e' e'' : key * elt, eqk e e' -> ltk e' e'' -> ltk e e''unfold ltk, eqk; simpl; eauto. Qed. Hint Resolve eqk_not_ltk : core. Hint Immediate ltk_eqk eqk_ltk : core.elt:Typek:keye:eltk':keye':eltk'':keye'':elteqk (k, e) (k', e') -> ltk (k', e') (k'', e'') -> ltk (k, e) (k'', e'')elt:Typeforall (x : key * elt) (m : list (key * elt)), InA eqke x m -> InA eqk x munfold eqke; induction 1; intuition. Qed. Hint Resolve InA_eqke_eqk : core. Definition MapsTo (k:key)(e:elt):= InA eqke (k,e). Definition In k m := exists e:elt, MapsTo k e m. Notation Sort := (sort ltk). Notation Inf := (lelistA ltk). Hint Unfold MapsTo In : core. (* An alternative formulation for [In k l] is [exists e, InA eqk (k,e) l] *)elt:Typeforall (x : key * elt) (m : list (key * elt)), InA eqke x m -> InA eqk x melt:Typeforall (k : key) (l : list (key * elt)), In k l <-> (exists e : elt, InA eqk (k, e) l)elt:Typeforall (k : key) (l : list (key * elt)), In k l <-> (exists e : elt, InA eqk (k, e) l)elt:Typek:keyl:list (key * elt)x:eltH:MapsTo k x lexists e : elt, InA eqk (k, e) lelt:Typek:keyl:list (key * elt)x:eltH:InA eqk (k, x) lIn k lelt:Typek:keyl:list (key * elt)x:eltH:InA eqk (k, x) lIn k lelt:Typek:keyx:elty:(key * elt)%typel:list (key * elt)H:eqk (k, x) yIn k (y :: l)elt:Typek:keyx:elty:(key * elt)%typel:list (key * elt)H:InA eqk (k, x) lIHInA:In k lIn k (y :: l)elt:Typek:keyx:eltt0:keye:eltl:list (key * elt)H:eqk (k, x) (t0, e)In k ((t0, e) :: l)elt:Typek:keyx:elty:(key * elt)%typel:list (key * elt)H:InA eqk (k, x) lIHInA:In k lIn k (y :: l)elt:Typek:keyx:elty:(key * elt)%typel:list (key * elt)H:InA eqk (k, x) lIHInA:In k lIn k (y :: l)exists e; auto. Qed.elt:Typek:keyx:elty:(key * elt)%typel:list (key * elt)H:InA eqk (k, x) le:eltH0:MapsTo k e lIn k (y :: l)elt:Typeforall (l : list (key * elt)) (x y : key) (e : elt), eq x y -> MapsTo x e l -> MapsTo y e lintros; unfold MapsTo in *; apply InA_eqA with (x,e); eauto with *. Qed.elt:Typeforall (l : list (key * elt)) (x y : key) (e : elt), eq x y -> MapsTo x e l -> MapsTo y e lelt:Typeforall (l : list (key * elt)) (x y : key), eq x y -> In x l -> In y ldestruct 2 as (e,E); exists e; eapply MapsTo_eq; eauto. Qed.elt:Typeforall (l : list (key * elt)) (x y : key), eq x y -> In x l -> In y lelt:Typeforall (l : list (key * elt)) (x x' : key * elt), eqk x x' -> Inf x' l -> Inf x lexact (InfA_eqA eqk_equiv ltk_compat). Qed.elt:Typeforall (l : list (key * elt)) (x x' : key * elt), eqk x x' -> Inf x' l -> Inf x lelt:Typeforall (l : list (key * elt)) (x x' : key * elt), ltk x x' -> Inf x' l -> Inf x lexact (InfA_ltA ltk_strorder). Qed. Hint Immediate Inf_eq : core. Hint Resolve Inf_lt : core.elt:Typeforall (l : list (key * elt)) (x x' : key * elt), ltk x x' -> Inf x' l -> Inf x lelt:Typeforall (l : list (key * elt)) (p q : key * elt), Sort l -> Inf q l -> InA eqk p l -> ltk q pexact (SortA_InfA_InA eqk_equiv ltk_strorder ltk_compat). Qed.elt:Typeforall (l : list (key * elt)) (p q : key * elt), Sort l -> Inf q l -> InA eqk p l -> ltk q pelt:Typeforall (l : list (key * elt)) (k : key) (e : elt), Sort l -> Inf (k, e) l -> ~ In k lelt:Typeforall (l : list (key * elt)) (k : key) (e : elt), Sort l -> Inf (k, e) l -> ~ In k lelt:Typel:list (key * elt)k:keye:eltH:Sort lH0:Inf (k, e) lH1:In k lFalseelt:Typel:list (key * elt)k:keye:eltH:Sort lH0:Inf (k, e) le':eltH2:MapsTo k e' lFalseelt:Typel:list (key * elt)k:keye:eltH:Sort lH0:Inf (k, e) le':eltH2:MapsTo k e' lltk (k, e) (k, e')elt:Typel:list (key * elt)k:keye:eltH:Sort lH0:Inf (k, e) le':eltH2:MapsTo k e' leqk (k, e) (k, e')red; simpl; auto. Qed.elt:Typel:list (key * elt)k:keye:eltH:Sort lH0:Inf (k, e) le':eltH2:MapsTo k e' leqk (k, e) (k, e')elt:Typeforall l : list (key * elt), Sort l -> NoDupA eqk lexact (SortA_NoDupA eqk_equiv ltk_strorder ltk_compat). Qed.elt:Typeforall l : list (key * elt), Sort l -> NoDupA eqk lelt:Typeforall (e : key * elt) (l : list (key * elt)) (e' : key * elt), Sort (e :: l) -> InA eqk e' l -> ltk e e'inversion 1; intros; eapply Sort_Inf_In; eauto. Qed.elt:Typeforall (e : key * elt) (l : list (key * elt)) (e' : key * elt), Sort (e :: l) -> InA eqk e' l -> ltk e e'elt:Typeforall (l : list (key * elt)) (e e' : key * elt), Sort (e :: l) -> InA eqk e' (e :: l) -> ltk e e' \/ eqk e e'elt:Typeforall (l : list (key * elt)) (e e' : key * elt), Sort (e :: l) -> InA eqk e' (e :: l) -> ltk e e' \/ eqk e e'left; apply Sort_In_cons_1 with l; auto. Qed.elt:Typel:list (key * elt)e, e':(key * elt)%typeH:Sort (e :: l)H1:InA eqk e' lltk e e' \/ eqk e e'elt:Typeforall (x : key) (l : list (key * elt)) (k : key) (e : elt), Sort ((k, e) :: l) -> In x l -> ~ eq x kelt:Typeforall (x : key) (l : list (key * elt)) (k : key) (e : elt), Sort ((k, e) :: l) -> In x l -> ~ eq x kdestruct (Sort_Inf_NotIn H0 H1 (In_eq H2 H)). Qed.elt:Typex:keyl:list (key * elt)k:keye:eltH0:Sort lH1:Inf (k, e) lH:In x lH2:eq x kFalseelt:Typeforall (k k' : key) (e : elt) (l : list (key * elt)), In k ((k', e) :: l) -> eq k k' \/ In k lelt:Typeforall (k k' : key) (e : elt) (l : list (key * elt)), In k ((k', e) :: l) -> eq k k' \/ In k lelt:Typek, k':keye:eltl:list (key * elt)H:In k ((k', e) :: l)x:eltH0:MapsTo k x ((k', e) :: l)eq k k' \/ In k ldestruct H1; simpl in *; intuition. Qed.elt:Typek, k':keye:eltl:list (key * elt)H:In k ((k', e) :: l)x:eltH1:eqke (k, x) (k', e)eq k k' \/ In k lelt:Typeforall (k k' : key) (e e' : elt) (l : list (key * elt)), InA eqk (k, e) ((k', e') :: l) -> ~ eq k k' -> InA eqk (k, e) linversion_clear 1; compute in H0; intuition. Qed.elt:Typeforall (k k' : key) (e e' : elt) (l : list (key * elt)), InA eqk (k, e) ((k', e') :: l) -> ~ eq k k' -> InA eqk (k, e) lelt:Typeforall (x x' : key * elt) (l : list (key * elt)), InA eqke x (x' :: l) -> ~ eqk x x' -> InA eqke x linversion_clear 1; compute in H0; intuition. Qed. End Elt. Hint Unfold eqk eqke ltk : core. Hint Extern 2 (eqke ?a ?b) => split : core. Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl : core. Hint Resolve ltk_trans ltk_not_eqk ltk_not_eqke : core. Hint Immediate eqk_sym eqke_sym : core. Hint Resolve eqk_not_ltk : core. Hint Immediate ltk_eqk eqk_ltk : core. Hint Resolve InA_eqke_eqk : core. Hint Unfold MapsTo In : core. Hint Immediate Inf_eq : core. Hint Resolve Inf_lt : core. Hint Resolve Sort_Inf_NotIn : core. Hint Resolve In_inv_2 In_inv_3 : core. End KeyOrderedType.elt:Typeforall (x x' : key * elt) (l : list (key * elt)), InA eqke x (x' :: l) -> ~ eqk x x' -> InA eqke x l