(* destruct a Fin n for n statically known into n branches *)
Ltac fin_destruct i :=
  match goal with
  | [ i : Fin 0 |- _ ] => destruct i
  | [ i : Fin (S ?n) |- _ ] => destruct i as [[]|j]; [|fin_destruct j]
  | _ => fail "no match"
  end.Definition enum {X} `{Finite X} : list X :=
  map from_fin (Fin_enum (card X)).

Lemma enum_correct {X} `{Finite X} : forall (x : X), In x enum.