(* * Tactics for [Fin.t] *)
(* Author: Maximilian Wuttke and Fabian Kunze *)
From Undecidability.Shared.Libs.PSL Require Import Base.
Ltac destruct_fin i :=
lazymatch type of i with
| Fin.t (S ?n) =>
let i' := fresh i in
pose proof fin_destruct_S i as [ (i'&->) | -> ];
[ destruct_fin i'
| idtac]
| Fin.t O =>
pose proof fin_destruct_O i as []
| Fin.t (_ + _) =>
let i' := fresh i in
pose proof fin_destruct_add i as [ (i'&->) | (i'&->)];destruct_fin i'
| Fin.t _ => idtac
end.
Goal True.
assert (i : Fin.t 4) by repeat constructor.
enough (i = i) by tauto.
destruct_fin i.
all: reflexivity.
Qed.

Lemma Fin_eqb_R_R  m n (i i' : Fin.t n):
Fin.eqb (Fin.R m i) (Fin.R m i') = Fin.eqb i i'.