We prove the intermediate
claim HfiR:
apply_fun f i ∈ R.
rewrite the current goal using Hhi (from left to right).
rewrite the current goal using
(If_i_1 (i ∈ n) (apply_fun f i) 0 Hin) (from left to right).
An exact proof term for the current goal is HfiR.