X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Focaml%2Fcic_omdoc%2FdoubleTypeInference.ml;h=6bfced57e2ad69ed44982773a8bdb85961372ff1;hb=acf29bdbdcdc6ad8c2d9d27e8a47500981b605cd;hp=e16aa789f2412c07af939f663478d5ac0af817e9;hpb=218c0062f93dd3221b0266cfbc26fd9cf787ad18;p=helm.git diff --git a/helm/ocaml/cic_omdoc/doubleTypeInference.ml b/helm/ocaml/cic_omdoc/doubleTypeInference.ml index e16aa789f..6bfced57e 100644 --- a/helm/ocaml/cic_omdoc/doubleTypeInference.ml +++ b/helm/ocaml/cic_omdoc/doubleTypeInference.ml @@ -272,8 +272,8 @@ let type_of_constant uri = raise (NotWellTyped "Reference to an unchecked constant") in match cobj with - C.Constant (_,_,ty,_) -> ty - | C.CurrentProof (_,_,_,ty,_) -> ty + C.Constant (_,_,ty,_,_) -> ty + | C.CurrentProof (_,_,_,ty,_,_) -> ty | _ -> raise (WrongUriToConstant (U.string_of_uri uri)) ;; @@ -282,7 +282,7 @@ let type_of_variable uri = let module R = CicReduction in let module U = UriManager in match CicEnvironment.is_type_checked CicUniv.empty_ugraph uri with - CicEnvironment.CheckedObj ((C.Variable (_,_,ty,_)),_) -> ty + CicEnvironment.CheckedObj ((C.Variable (_,_,ty,_,_)),_) -> ty | CicEnvironment.UncheckedObj (C.Variable _) -> raise (NotWellTyped "Reference to an unchecked variable") | _ -> raise (WrongUriToVariable (UriManager.string_of_uri uri)) @@ -299,7 +299,7 @@ let type_of_mutual_inductive_defs uri i = raise (NotWellTyped "Reference to an unchecked inductive type") in match cobj with - C.InductiveDefinition (dl,_,_) -> + C.InductiveDefinition (dl,_,_,_) -> let (_,_,arity,_) = List.nth dl i in arity | _ -> raise (WrongUriToMutualInductiveDefinitions (U.string_of_uri uri)) @@ -316,7 +316,7 @@ let type_of_mutual_inductive_constr uri i j = raise (NotWellTyped "Reference to an unchecked constructor") in match cobj with - C.InductiveDefinition (dl,_,_) -> + C.InductiveDefinition (dl,_,_,_) -> let (_,_,_,cl) = List.nth dl i in let (_,ty) = List.nth cl (j-1) in ty @@ -367,9 +367,9 @@ let rec type_of_aux' subterms_to_types metasenv context t expectedty = function [] -> [] | (Some (n,C.Decl t))::tl -> - (Some (n,C.Decl (S.lift_meta l (S.lift i t))))::(aux (i+1) tl) + (Some (n,C.Decl (S.subst_meta l (S.lift i t))))::(aux (i+1) tl) | (Some (n,C.Def (t,None)))::tl -> - (Some (n,C.Def ((S.lift_meta l (S.lift i t)),None))):: + (Some (n,C.Def ((S.subst_meta l (S.lift i t)),None))):: (aux (i+1) tl) | None::tl -> None::(aux (i+1) tl) | (Some (_,C.Def (_,Some _)))::_ -> assert false @@ -398,7 +398,7 @@ let rec type_of_aux' subterms_to_types metasenv context t expectedty = in let (_,canonical_context,ty) = CicUtil.lookup_meta n metasenv in (* Checks suppressed *) - CicSubstitution.lift_meta l ty + CicSubstitution.subst_meta l ty | C.Sort (C.Type t) -> (* TASSI: CONSTRAINT *) C.Sort (C.Type (CicUniv.fresh())) | C.Sort _ -> C.Sort (C.Type (CicUniv.fresh())) (* TASSI: CONSTRAINT *) @@ -543,7 +543,7 @@ let rec type_of_aux' subterms_to_types metasenv context t expectedty = with Not_found -> assert false in match obj with - C.InductiveDefinition (tl,_,parsno) -> + C.InductiveDefinition (tl,_,parsno,_) -> let (_,_,_,cl) = List.nth tl i in (cl,parsno) | _ -> raise (WrongUriToMutualInductiveDefinitions (U.string_of_uri uri)) @@ -645,22 +645,18 @@ let rec type_of_aux' subterms_to_types metasenv context t expectedty = CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri with Not_found -> assert false in - match obj with - Cic.Constant (_,_,_,params) - | Cic.CurrentProof (_,_,_,_,params) - | Cic.Variable (_,_,_,params) - | Cic.InductiveDefinition (_,params,_) -> - List.map - (function uri -> - let obj,_ = - try - CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri - with Not_found -> assert false - in - match obj with - Cic.Variable (_,None,ty,_) -> uri,ty - | _ -> assert false (* the theorem is well-typed *) - ) params + let params = CicUtil.params_of_obj obj in + List.map + (function uri -> + let obj,_ = + try + CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri + with Not_found -> assert false + in + match obj with + Cic.Variable (_,None,ty,_,_) -> uri,ty + | _ -> assert false (* the theorem is well-typed *) + ) params in let rec check uris_and_types subst = match uris_and_types,subst with