;;
let rec type_of_constant uri ugraph =
- let module C = Cic in
- let module R = CicReduction in
- let module U = UriManager in
- (*
- let obj =
- try
- CicEnvironment.get_cooked_obj uri
- with Not_found -> assert false
- in
- *)
- let obj,u= CicEnvironment.get_obj ugraph uri in
- match obj with
- C.Constant (_,_,ty,_,_) -> ty,u
- | C.CurrentProof (_,_,_,ty,_,_) -> ty,u
- | _ ->
- raise
- (RefineFailure ("Unknown constant definition " ^ U.string_of_uri uri))
+ let module C = Cic in
+ let module R = CicReduction in
+ let module U = UriManager in
+ let _ = CicTypeChecker.typecheck uri in
+ let obj,u =
+ try
+ CicEnvironment.get_cooked_obj ugraph uri
+ with Not_found -> assert false
+ in
+ match obj with
+ C.Constant (_,_,ty,_,_) -> ty,u
+ | C.CurrentProof (_,_,_,ty,_,_) -> ty,u
+ | _ ->
+ raise
+ (RefineFailure ("Unknown constant definition " ^ U.string_of_uri uri))
and type_of_variable uri ugraph =
let module C = Cic in
let module R = CicReduction in
let module U = UriManager in
- (*
- let obj =
- try
- CicEnvironment.get_cooked_obj uri
- with Not_found -> assert false
- in
- *)
- let obj,u = CicEnvironment.get_obj ugraph uri in
- match obj with
- C.Variable (_,_,ty,_,_) -> ty,u
- | _ ->
- raise
- (RefineFailure
- ("Unknown variable definition " ^ UriManager.string_of_uri uri))
+ let _ = CicTypeChecker.typecheck uri in
+ let obj,u =
+ try
+ CicEnvironment.get_cooked_obj ugraph uri
+ with Not_found -> assert false
+ in
+ match obj with
+ C.Variable (_,_,ty,_,_) -> ty,u
+ | _ ->
+ raise
+ (RefineFailure
+ ("Unknown variable definition " ^ UriManager.string_of_uri uri))
and type_of_mutual_inductive_defs uri i ugraph =
let module C = Cic in
let module R = CicReduction in
let module U = UriManager in
- (*
- let obj =
- try
- CicEnvironment.get_cooked_obj uri
- with Not_found -> assert false
- in
- *)
- let obj,u = CicEnvironment.get_obj ugraph uri in
- match obj with
- C.InductiveDefinition (dl,_,_,_) ->
- let (_,_,arity,_) = List.nth dl i in
- arity,u
- | _ ->
- raise
- (RefineFailure
- ("Unknown mutual inductive definition " ^ U.string_of_uri uri))
+ let _ = CicTypeChecker.typecheck uri in
+ let obj,u =
+ try
+ CicEnvironment.get_cooked_obj ugraph uri
+ with Not_found -> assert false
+ in
+ match obj with
+ C.InductiveDefinition (dl,_,_,_) ->
+ let (_,_,arity,_) = List.nth dl i in
+ arity,u
+ | _ ->
+ raise
+ (RefineFailure
+ ("Unknown mutual inductive definition " ^ U.string_of_uri uri))
and type_of_mutual_inductive_constr uri i j ugraph =
let module C = Cic in
let module R = CicReduction in
let module U = UriManager in
- (*
- let obj =
- try
- CicEnvironment.get_cooked_obj uri
- with Not_found -> assert false
- in
- *)
- let obj,u = CicEnvironment.get_obj ugraph uri in
+ let _ = CicTypeChecker.typecheck uri in
+ let obj,u =
+ try
+ CicEnvironment.get_cooked_obj ugraph uri
+ with Not_found -> assert false
+ in
match obj with
C.InductiveDefinition (dl,_,_,_) ->
let (_,_,_,cl) = List.nth dl i in
(* first, get the inductive type (and noparams)
* in the environment *)
let (_,b,arity,constructors), expl_params, no_left_params,ugraph =
- let obj,u = CicEnvironment.get_obj ugraph uri in
+ let _ = CicTypeChecker.typecheck uri in
+ let obj,u = CicEnvironment.get_cooked_obj ugraph uri in
match obj with
C.InductiveDefinition (l,expl_params,parsno,_) ->
List.nth l i , expl_params, parsno, u
(let candidate,ugraph5,metasenv,subst =
let exp_name_subst, metasenv =
let o,_ =
- CicEnvironment.get_obj CicUniv.empty_ugraph uri
+ CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri
in
let uris = CicUtil.params_of_obj o in
List.fold_right (