]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/ng_kernel/nCicTypeChecker.ml
Refinement of inductive type implemented.
[helm.git] / helm / software / components / ng_kernel / nCicTypeChecker.ml
index 61cda8a336235e70c66cc14ed72f17e78a1679c6..f459c602432ae5888539bca809925da3ae49f775 100644 (file)
@@ -96,16 +96,6 @@ let fixed_args bos j n nn =
    (let rec f = function 0 -> [] | n -> true :: f (n-1) in f j) bos
 ;;
 
-(* 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"))
-;;
-
 let debruijn uri number_of_types context = 
  let rec aux k t =
   match t with
@@ -722,7 +712,7 @@ and is_non_informative ~metasenv ~subst paramsno c =
        let s = typeof ~metasenv ~subst context so in
        s = C.Sort C.Prop && aux ((n,(C.Decl so))::context) de
     | _ -> true in
- let context',dx = split_prods ~subst [] paramsno c in
+ let context',dx = NCicReduction.split_prods ~subst [] paramsno c in
   aux context' dx
 
 and check_mutual_inductive_defs uri ~metasenv ~subst leftno tyl = 
@@ -734,13 +724,13 @@ and check_mutual_inductive_defs uri ~metasenv ~subst leftno tyl =
   ignore
    (List.fold_right
     (fun (it_relev,_,ty,cl) i ->
-       let context,ty_sort = split_prods ~subst [] ~-1 ty in
+       let context,ty_sort = NCicReduction.split_prods ~subst [] ~-1 ty in
        let sx_context_ty_rev,_ = HExtlib.split_nth leftno (List.rev context) in
        List.iter
          (fun (k_relev,_,te) ->
           let _,k_relev = HExtlib.split_nth leftno k_relev in
            let te = debruijn uri len [] te in
-           let context,te = split_prods ~subst tys leftno te in
+           let context,te = NCicReduction.split_prods ~subst tys leftno te in
            let _,chopped_context_rev =
             HExtlib.split_nth (List.length tys) (List.rev context) in
            let sx_context_te_rev,_ =