Require FinFun.
Section FinStuff.
Fixpoint Fin n : Type :=
match n with
| 0%nat => Empty_set
| S m => unit + Fin m
end.
Global Instance Fin_EqDec {n} : EqDec (Fin n).

Lemma from_to_fin_sum {m n} : forall s : Fin m + Fin n, from_fin_sum (to_fin_sum s) = s.
Fixpoint to_fin_mult {m n} : Fin m * Fin n -> Fin (m * n) :=
match m with
| 0 => fun p =>
match fst p with
end
| S k => fun p =>
match fst p with
| inl tt => to_fin_sum (inl (snd p))
| inr j => to_fin_sum (inr (to_fin_mult (j, snd p)))
end
end.