X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Flibrary%2FcicElim.ml;h=282383d7853ae344ecbb75e09ca45e9d586202c7;hb=4dfb1305a9c4a7c292f4b1957de1454d46c1ab8a;hp=3cb5ee4e8bad090f7cc162c23ab32da318148aa4;hpb=8d2fe36efcace8af46c8b478061c3fa8bb72bc04;p=helm.git diff --git a/helm/software/components/library/cicElim.ml b/helm/software/components/library/cicElim.ml index 3cb5ee4e8..282383d78 100644 --- a/helm/software/components/library/cicElim.ml +++ b/helm/software/components/library/cicElim.ml @@ -150,14 +150,20 @@ let rec mk_rels consno = function | 0 -> [] | n -> Cic.Rel (n+consno) :: mk_rels consno (n-1) -let rec strip_pi = function - | Cic.Prod (_, _, tgt) -> strip_pi tgt +let rec strip_pi ctx t = + match CicReduction.whd ~delta:true ctx t with + | Cic.Prod (n, s, tgt) -> strip_pi (Some (n,Cic.Decl s) :: ctx) tgt | t -> t -let rec count_pi = function - | Cic.Prod (_, _, tgt) -> count_pi tgt + 1 +let strip_pi t = strip_pi [] t + +let rec count_pi ctx t = + match CicReduction.whd ~delta:true ctx t with + | Cic.Prod (n, s, tgt) -> count_pi (Some (n,Cic.Decl s)::ctx) tgt + 1 | t -> 0 +let count_pi t = count_pi [] t + let rec type_of_p sort dependent leftno indty = function | Cic.Prod (n, src, tgt) when leftno = 0 -> let n = @@ -259,7 +265,7 @@ let branch (uri, typeno) insource liftno paramsno t fix head args = let elim_of ~sort uri typeno = counter := ~-1; - let (obj, univ) = (CicEnvironment.get_obj CicUniv.empty_ugraph uri) in + let (obj, univ) = (CicEnvironment.get_obj CicUniv.oblivion_ugraph uri) in match obj with | Cic.InductiveDefinition (indTypes, params, leftno, _) -> let (name, inductive, ty, constructors) = @@ -394,7 +400,8 @@ debug_print (lazy (CicPp.ppterm eliminator_body)); *) let (computed_type, ugraph) = try - CicTypeChecker.type_of_aux' [] [] eliminator_body CicUniv.empty_ugraph + CicTypeChecker.type_of_aux' [] [] eliminator_body + CicUniv.oblivion_ugraph with CicTypeChecker.TypeCheckerFailure msg -> raise (Elim_failure (lazy (sprintf "type checker failure while type checking:\n%s\nerror:\n%s"