(* 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 finfunc_correct (A: finType) B (f: A -> B) a  def: lookup (finfunc_table f) a def = f a.