Fixpoint hlist_rev' ls ls' (h : hlist ls) : hlist ls' -> hlist (rev ls ++ ls') :=
match h in hlist ls return hlist ls' -> hlist (rev ls ++ ls') with
| Hnil => fun h => h
| Hcons l ls0 x h' => fun hacc =>
match app_ass_trans (rev ls0) (l :: nil) ls' in _ = t
return hlist t -> hlist _
with
| eq_refl => fun x => x
end (@hlist_rev' _ (l :: ls') h' (Hcons x hacc))
end.
Definition hlist_rev ls (h : hlist ls) : hlist (rev ls) :=
match app_nil_r_trans (rev ls) in _ = t return hlist t with
| eq_refl => hlist_rev' h Hnil
end.

(* Specifications: *)
Lemma hlist_rev_nil : hlist_rev Hnil = Hnil.
Section equiv.