fact: Fixpoint insert_params fuel Params i t := let params := List.length Params in match fuel with 0 => tmFail "out of fuel in insert_params" | S fuel => match t with | tRel n => (match nth_error Params (params + i - n - 1) with Some x => ret x | _ => ret (tRel n) end) | tApp s R => s <- insert_params fuel Params i s ;; R <- monad_map (insert_params fuel Params i) R;; ret (tApp s R) | _ => ret t end end.
imports: Ascii String Undecidability.L(Util.L_facts) MetaCoq(Template.All Template.Checker) Undecidability.Shared.Libs.PSL.Base MetaCoq.Utils.bytestring