(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(* (C) Pierre Castéran , LaBRI, Universite Bordeaux 1, Inria Futurs Dictionaries (after Paulson : ML for the working programmer) *)
Set Asymmetric Patterns.
Unset Standard Proposition Elimination Names.
(* Dictionaries : a dictionary is roughly a partial maping from keys to values  *)
Module Type DICT.
Parameter key : Set.
Parameter data : Set. (* data associated with keys *)
Parameter dict : Set. (* the type associated with dictionaries *)
Parameter empty : dict. (* dictionary without any entry *)
Parameter add : key -> data -> dict -> dict. (* add an entry to a dictionary *)
Parameter find : key -> dict -> option data. (* get the value from the key  *)
(* relationships between find, add and empty *)

Axiom empty_def : forall k : key, find k empty = None.
Axiom
success :
forall (d : dict) (k : key) (v : data), find k (add k v d) = Some v.