-(* if n < 0, then splits all prods from an arity, returning a sort *)
-let rec split_prods ~subst context n te =
- match (n, R.whd ~subst context te) with
- | (0, _) -> context,te
- | (n, C.Sort _) when n <= 0 -> context,te
- | (n, C.Prod (name,so,ta)) ->
- split_prods ~subst ((name,(C.Decl so))::context) (n - 1) ta
- | (_, _) -> raise (AssertFailure (lazy "split_prods"))
-;;
-