(* Require Import Vector. *)
(* Definition vector X Y := Vector.t Y (|elem X|). *)
Definition finfunc_table (A : finType) (B: Type) (f: A -> B) :=
List.map (fun x => (x, f x)) (elem A).
(* Now we prove that the tranformation of a function of finite domain to a table is correct *)
Definition lookup (A : eqType) (B : Type) (l : list (A * B)) (a : A) (def : B) : B :=
match (filter (fun p => Dec (fst p = a)) l) with
List.nil => def
| p :: _ => snd p
end.

Lemma lookup_sound (A: eqType) (B: Type) (L : list (prod A B)) a b def :
(forall a' b1 b2, (a',b1) el L -> (a',b2) el L -> b1=b2) -> (a,b) el L -> lookup L a def = b.