Library MetaRocq.Utils.MRTactics.Head

find the head of the given expression
Ltac head expr :=
  match expr with
  | ?f _head f
  | _expr
  end.

Ltac head_hnf expr := let expr' := eval hnf in expr in head expr'.