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.
Require Equalities.

Set Implicit Arguments.
Unset Strict Implicit.
NB: This file is here only for compatibility with earlier version of FSets and FMap. Please use Structures/Equalities.v directly now.

Types with Equalities, and nothing more (for subtyping purpose)

Module Type EqualityType := Equalities.EqualityTypeOrig.

Types with decidable Equalities (but no ordering)

Module Type DecidableType := Equalities.DecidableTypeOrig.

Additional notions about keys and datas used in FMap

Module KeyDecidableType(D:DecidableType).
 Import D.

 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').

  Hint Unfold eqk eqke : core.
  Hint Extern 2 (eqke ?a ?b) => split : core.

   (* eqke is stricter than eqk *)

   
elt:Type

forall x x' : key * elt, eqke x x' -> eqk x x'
elt:Type

forall x x' : key * elt, eqke x x' -> eqk x x'
unfold eqk, eqke; intuition. Qed. (* eqk, eqke are equalities *)
elt:Type

forall e : key * elt, eqk e e
elt:Type

forall e : key * elt, eqk e e
auto. Qed.
elt:Type

forall e : key * elt, eqke e e
elt:Type

forall e : key * elt, eqke e e
auto. Qed.
elt:Type

forall e e' : key * elt, eqk e e' -> eqk e' e
elt:Type

forall e e' : key * elt, eqk e e' -> eqk e' e
auto. Qed.
elt:Type

forall e e' : key * elt, eqke e e' -> eqke e' e
elt:Type

forall e e' : key * elt, eqke e e' -> eqke e' e
unfold eqke; intuition. Qed.
elt:Type

forall e e' e'' : key * elt, eqk e e' -> eqk e' e'' -> eqk e e''
elt:Type

forall e e' e'' : key * elt, eqk e e' -> eqk e' e'' -> eqk e e''
eauto. Qed.
elt:Type

forall e e' e'' : key * elt, eqke e e' -> eqke e' e'' -> eqke e e''
elt:Type

forall e e' e'' : key * elt, eqke e e' -> eqke e' e'' -> eqke e e''
unfold eqke; intuition; [ eauto | congruence ]. Qed. Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl : core. Hint Immediate eqk_sym eqke_sym : core.
elt:Type

Equivalence eqk
elt:Type

Equivalence eqk
split; eauto. Qed.
elt:Type

Equivalence eqke
elt:Type

Equivalence eqke
split; eauto. Qed.
elt:Type

forall (x : key * elt) (m : list (key * elt)), InA eqke x m -> InA eqk x m
elt:Type

forall (x : key * elt) (m : list (key * elt)), InA eqke x m -> InA eqk x m
unfold eqke; induction 1; intuition. Qed. Hint Resolve InA_eqke_eqk : core.
elt:Type

forall (p q : key * elt) (m : list (key * elt)), eqk p q -> InA eqk p m -> InA eqk q m
elt:Type

forall (p q : key * elt) (m : list (key * elt)), eqk p q -> InA eqk p m -> InA eqk q m
intros; apply InA_eqA with p; auto using eqk_equiv. Qed. Definition MapsTo (k:key)(e:elt):= InA eqke (k,e). Definition In k m := exists e:elt, MapsTo k e m. Hint Unfold MapsTo In : core. (* An alternative formulation for [In k l] is [exists e, InA eqk (k,e) l] *)
elt:Type

forall (k : key) (l : list (key * elt)), In k l <-> (exists e : elt, InA eqk (k, e) l)
elt:Type

forall (k : key) (l : list (key * elt)), In k l <-> (exists e : elt, InA eqk (k, e) l)
elt:Type
k:key
l:list (key * elt)
x:elt
H:MapsTo k x l

exists e : elt, InA eqk (k, e) l
elt:Type
k:key
l:list (key * elt)
x:elt
H:InA eqk (k, x) l
In k l
elt:Type
k:key
l:list (key * elt)
x:elt
H:InA eqk (k, x) l

In k l
elt:Type
k:key
x:elt
y:(key * elt)%type
l:list (key * elt)
H:eqk (k, x) y

In k (y :: l)
elt:Type
k:key
x:elt
y:(key * elt)%type
l:list (key * elt)
H:InA eqk (k, x) l
IHInA:In k l
In k (y :: l)
elt:Type
k:key
x:elt
t0:key
e:elt
l:list (key * elt)
H:eqk (k, x) (t0, e)

In k ((t0, e) :: l)
elt:Type
k:key
x:elt
y:(key * elt)%type
l:list (key * elt)
H:InA eqk (k, x) l
IHInA:In k l
In k (y :: l)
elt:Type
k:key
x:elt
y:(key * elt)%type
l:list (key * elt)
H:InA eqk (k, x) l
IHInA:In k l

In k (y :: l)
elt:Type
k:key
x:elt
y:(key * elt)%type
l:list (key * elt)
H:InA eqk (k, x) l
e:elt
H0:MapsTo k e l

In k (y :: l)
exists e; auto. Qed.
elt:Type

forall (l : list (key * elt)) (x y : key) (e : elt), eq x y -> MapsTo x e l -> MapsTo y e l
elt:Type

forall (l : list (key * elt)) (x y : key) (e : elt), eq x y -> MapsTo x e l -> MapsTo y e l
intros; unfold MapsTo in *; apply InA_eqA with (x,e); auto using eqke_equiv. Qed.
elt:Type

forall (l : list (key * elt)) (x y : key), eq x y -> In x l -> In y l
elt:Type

forall (l : list (key * elt)) (x y : key), eq x y -> In x l -> In y l
destruct 2 as (e,E); exists e; eapply MapsTo_eq; eauto. Qed.
elt:Type

forall (k k' : key) (e : elt) (l : list (key * elt)), In k ((k', e) :: l) -> eq k k' \/ In k l
elt:Type

forall (k k' : key) (e : elt) (l : list (key * elt)), In k ((k', e) :: l) -> eq k k' \/ In k l
elt:Type
k, k':key
e:elt
l:list (key * elt)
H:In k ((k', e) :: l)
x:elt
H0:MapsTo k x ((k', e) :: l)

eq k k' \/ In k l
elt:Type
k, k':key
e:elt
l:list (key * elt)
H:In k ((k', e) :: l)
x:elt
H1:eqke (k, x) (k', e)

eq k k' \/ In k l
destruct H1; simpl in *; intuition. Qed.
elt:Type

forall (k k' : key) (e e' : elt) (l : list (key * elt)), InA eqk (k, e) ((k', e') :: l) -> ~ eq k k' -> InA eqk (k, e) l
elt:Type

forall (k k' : key) (e e' : elt) (l : list (key * elt)), InA eqk (k, e) ((k', e') :: l) -> ~ eq k k' -> InA eqk (k, e) l
inversion_clear 1; compute in H0; intuition. Qed.
elt:Type

forall (x x' : key * elt) (l : list (key * elt)), InA eqke x (x' :: l) -> ~ eqk x x' -> InA eqke x l
elt:Type

forall (x x' : key * elt) (l : list (key * elt)), InA eqke x (x' :: l) -> ~ eqk x x' -> InA eqke x l
inversion_clear 1; compute in H0; intuition. Qed. End Elt. Hint Unfold eqk eqke : core. Hint Extern 2 (eqke ?a ?b) => split : core. Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl : core. Hint Immediate eqk_sym eqke_sym : core. Hint Resolve InA_eqke_eqk : core. Hint Unfold MapsTo In : core. Hint Resolve In_inv_2 In_inv_3 : core. End KeyDecidableType.