1 (* Copyright (C) 2000, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://cs.unibo.it/helm/.
28 exception Impossible of int;;
29 exception NotWellTyped of string;;
30 exception WrongUriToConstant of string;;
31 exception WrongUriToVariable of string;;
32 exception WrongUriToMutualInductiveDefinitions of string;;
33 exception ListTooShort;;
34 exception RelToHiddenHypothesis;;
36 let syntactic_equality_add_time = ref 0.0;;
37 let type_of_aux'_add_time = ref 0.0;;
38 let number_new_type_of_aux'_double_work = ref 0;;
39 let number_new_type_of_aux' = ref 0;;
40 let number_new_type_of_aux'_prop = ref 0;;
42 let double_work = ref 0;;
44 let xxx_type_of_aux' m c t =
45 let t1 = Sys.time () in
46 let res,_ = CicTypeChecker.type_of_aux' m c t CicUniv.empty_ugraph in
47 let t2 = Sys.time () in
48 type_of_aux'_add_time := !type_of_aux'_add_time +. t2 -. t1 ;
52 type types = {synthesized : Cic.term ; expected : Cic.term option};;
54 (* does_not_occur n te *)
55 (* returns [true] if [Rel n] does not occur in [te] *)
56 let rec does_not_occur n =
59 C.Rel m when m = n -> false
63 | C.Implicit _ -> true
65 does_not_occur n te && does_not_occur n ty
66 | C.Prod (name,so,dest) ->
67 does_not_occur n so &&
68 does_not_occur (n + 1) dest
69 | C.Lambda (name,so,dest) ->
70 does_not_occur n so &&
71 does_not_occur (n + 1) dest
72 | C.LetIn (name,so,dest) ->
73 does_not_occur n so &&
74 does_not_occur (n + 1) dest
76 List.fold_right (fun x i -> i && does_not_occur n x) l true
77 | C.Var (_,exp_named_subst)
78 | C.Const (_,exp_named_subst)
79 | C.MutInd (_,_,exp_named_subst)
80 | C.MutConstruct (_,_,_,exp_named_subst) ->
81 List.fold_right (fun (_,x) i -> i && does_not_occur n x)
83 | C.MutCase (_,_,out,te,pl) ->
84 does_not_occur n out && does_not_occur n te &&
85 List.fold_right (fun x i -> i && does_not_occur n x) pl true
87 let len = List.length fl in
88 let n_plus_len = n + len in
91 i && does_not_occur n ty &&
92 does_not_occur n_plus_len bo
95 let len = List.length fl in
96 let n_plus_len = n + len in
99 i && does_not_occur n ty &&
100 does_not_occur n_plus_len bo
104 let rec beta_reduce =
105 let module S = CicSubstitution in
106 let module C = Cic in
109 | C.Var (uri,exp_named_subst) ->
110 let exp_named_subst' =
111 List.map (function (i,t) -> i, beta_reduce t) exp_named_subst
113 C.Var (uri,exp_named_subst')
117 (function None -> None | Some t -> Some (beta_reduce t)) l
120 | C.Implicit _ -> assert false
122 C.Cast (beta_reduce te, beta_reduce ty)
124 C.Prod (n, beta_reduce s, beta_reduce t)
125 | C.Lambda (n,s,t) ->
126 C.Lambda (n, beta_reduce s, beta_reduce t)
128 C.LetIn (n, beta_reduce s, beta_reduce t)
129 | C.Appl ((C.Lambda (name,s,t))::he::tl) ->
130 let he' = S.subst he t in
135 C.Appl l -> beta_reduce (C.Appl (l@tl))
136 | _ -> beta_reduce (C.Appl (he'::tl)))
138 C.Appl (List.map beta_reduce l)
139 | C.Const (uri,exp_named_subst) ->
140 let exp_named_subst' =
141 List.map (function (i,t) -> i, beta_reduce t) exp_named_subst
143 C.Const (uri,exp_named_subst')
144 | C.MutInd (uri,i,exp_named_subst) ->
145 let exp_named_subst' =
146 List.map (function (i,t) -> i, beta_reduce t) exp_named_subst
148 C.MutInd (uri,i,exp_named_subst')
149 | C.MutConstruct (uri,i,j,exp_named_subst) ->
150 let exp_named_subst' =
151 List.map (function (i,t) -> i, beta_reduce t) exp_named_subst
153 C.MutConstruct (uri,i,j,exp_named_subst')
154 | C.MutCase (sp,i,outt,t,pl) ->
155 C.MutCase (sp,i,beta_reduce outt,beta_reduce t,
156 List.map beta_reduce pl)
160 (function (name,i,ty,bo) ->
161 name,i,beta_reduce ty,beta_reduce bo
168 (function (name,ty,bo) ->
169 name,beta_reduce ty,beta_reduce bo
175 (* syntactic_equality up to the *)
176 (* distinction between fake dependent products *)
177 (* and non-dependent products, alfa-conversion *)
178 (*CSC: must alfa-conversion be considered or not? *)
179 let syntactic_equality t t' =
180 let module C = Cic in
181 let rec syntactic_equality t t' =
185 C.Var (uri,exp_named_subst), C.Var (uri',exp_named_subst') ->
186 UriManager.eq uri uri' &&
187 syntactic_equality_exp_named_subst exp_named_subst exp_named_subst'
188 | C.Cast (te,ty), C.Cast (te',ty') ->
189 syntactic_equality te te' &&
190 syntactic_equality ty ty'
191 | C.Prod (_,s,t), C.Prod (_,s',t') ->
192 syntactic_equality s s' &&
193 syntactic_equality t t'
194 | C.Lambda (_,s,t), C.Lambda (_,s',t') ->
195 syntactic_equality s s' &&
196 syntactic_equality t t'
197 | C.LetIn (_,s,t), C.LetIn(_,s',t') ->
198 syntactic_equality s s' &&
199 syntactic_equality t t'
200 | C.Appl l, C.Appl l' ->
201 List.fold_left2 (fun b t1 t2 -> b && syntactic_equality t1 t2) true l l'
202 | C.Const (uri,exp_named_subst), C.Const (uri',exp_named_subst') ->
203 UriManager.eq uri uri' &&
204 syntactic_equality_exp_named_subst exp_named_subst exp_named_subst'
205 | C.MutInd (uri,i,exp_named_subst), C.MutInd (uri',i',exp_named_subst') ->
206 UriManager.eq uri uri' && i = i' &&
207 syntactic_equality_exp_named_subst exp_named_subst exp_named_subst'
208 | C.MutConstruct (uri,i,j,exp_named_subst),
209 C.MutConstruct (uri',i',j',exp_named_subst') ->
210 UriManager.eq uri uri' && i = i' && j = j' &&
211 syntactic_equality_exp_named_subst exp_named_subst exp_named_subst'
212 | C.MutCase (sp,i,outt,t,pl), C.MutCase (sp',i',outt',t',pl') ->
213 UriManager.eq sp sp' && i = i' &&
214 syntactic_equality outt outt' &&
215 syntactic_equality t t' &&
217 (fun b t1 t2 -> b && syntactic_equality t1 t2) true pl pl'
218 | C.Fix (i,fl), C.Fix (i',fl') ->
221 (fun b (_,i,ty,bo) (_,i',ty',bo') ->
223 syntactic_equality ty ty' &&
224 syntactic_equality bo bo') true fl fl'
225 | C.CoFix (i,fl), C.CoFix (i',fl') ->
228 (fun b (_,ty,bo) (_,ty',bo') ->
230 syntactic_equality ty ty' &&
231 syntactic_equality bo bo') true fl fl'
232 | _, _ -> false (* we already know that t != t' *)
233 and syntactic_equality_exp_named_subst exp_named_subst1 exp_named_subst2 =
235 (fun b (_,t1) (_,t2) -> b && syntactic_equality t1 t2) true
236 exp_named_subst1 exp_named_subst2
239 syntactic_equality t t'
244 let xxx_syntactic_equality t t' =
245 let t1 = Sys.time () in
246 let res = syntactic_equality t t' in
247 let t2 = Sys.time () in
248 syntactic_equality_add_time := !syntactic_equality_add_time +. t2 -. t1 ;
256 | (he::tl, n) -> let (l1,l2) = split tl (n-1) in (he::l1,l2)
257 | (_,_) -> raise ListTooShort
260 let type_of_constant uri =
261 let module C = Cic in
262 let module R = CicReduction in
263 let module U = UriManager in
265 match CicEnvironment.is_type_checked CicUniv.empty_ugraph uri with
266 CicEnvironment.CheckedObj (cobj,_) -> cobj
267 | CicEnvironment.UncheckedObj uobj ->
268 raise (NotWellTyped "Reference to an unchecked constant")
271 C.Constant (_,_,ty,_,_) -> ty
272 | C.CurrentProof (_,_,_,ty,_,_) -> ty
273 | _ -> raise (WrongUriToConstant (U.string_of_uri uri))
276 let type_of_variable uri =
277 let module C = Cic in
278 let module R = CicReduction in
279 let module U = UriManager in
280 match CicEnvironment.is_type_checked CicUniv.empty_ugraph uri with
281 CicEnvironment.CheckedObj ((C.Variable (_,_,ty,_,_)),_) -> ty
282 | CicEnvironment.UncheckedObj (C.Variable _) ->
283 raise (NotWellTyped "Reference to an unchecked variable")
284 | _ -> raise (WrongUriToVariable (UriManager.string_of_uri uri))
287 let type_of_mutual_inductive_defs uri i =
288 let module C = Cic in
289 let module R = CicReduction in
290 let module U = UriManager in
292 match CicEnvironment.is_type_checked CicUniv.empty_ugraph uri with
293 CicEnvironment.CheckedObj (cobj,_) -> cobj
294 | CicEnvironment.UncheckedObj uobj ->
295 raise (NotWellTyped "Reference to an unchecked inductive type")
298 C.InductiveDefinition (dl,_,_,_) ->
299 let (_,_,arity,_) = List.nth dl i in
301 | _ -> raise (WrongUriToMutualInductiveDefinitions (U.string_of_uri uri))
304 let type_of_mutual_inductive_constr uri i j =
305 let module C = Cic in
306 let module R = CicReduction in
307 let module U = UriManager in
309 match CicEnvironment.is_type_checked CicUniv.empty_ugraph uri with
310 CicEnvironment.CheckedObj (cobj,_) -> cobj
311 | CicEnvironment.UncheckedObj uobj ->
312 raise (NotWellTyped "Reference to an unchecked constructor")
315 C.InductiveDefinition (dl,_,_,_) ->
316 let (_,_,_,cl) = List.nth dl i in
317 let (_,ty) = List.nth cl (j-1) in
319 | _ -> raise (WrongUriToMutualInductiveDefinitions (U.string_of_uri uri))
322 let pack_coercion = ref (fun _ _ _ -> assert false);;
324 (* type_of_aux' is just another name (with a different scope) for type_of_aux *)
325 let rec type_of_aux' subterms_to_types metasenv context t expectedty =
326 (* Coscoy's double type-inference algorithm *)
327 (* It computes the inner-types of every subterm of [t], *)
328 (* even when they are not needed to compute the types *)
329 (* of other terms. *)
330 let rec type_of_aux context t expectedty =
331 let module C = Cic in
332 let module R = CicReduction in
333 let module S = CicSubstitution in
334 let module U = UriManager in
336 match expectedty with
338 | Some t -> Some (!pack_coercion metasenv context t) in
343 match List.nth context (n - 1) with
344 Some (_,C.Decl t) -> S.lift n t
345 | Some (_,C.Def (_,Some ty)) -> S.lift n ty
346 | Some (_,C.Def (bo,None)) ->
347 type_of_aux context (S.lift n bo) expectedty
348 | None -> raise RelToHiddenHypothesis
350 _ -> raise (NotWellTyped "Not a close term")
352 | C.Var (uri,exp_named_subst) ->
353 visit_exp_named_subst context uri exp_named_subst ;
354 CicSubstitution.subst_vars exp_named_subst (type_of_variable uri)
356 (* Let's visit all the subterms that will not be visited later *)
357 let (_,canonical_context,_) = CicUtil.lookup_meta n metasenv in
358 let lifted_canonical_context =
362 | (Some (n,C.Decl t))::tl ->
363 (Some (n,C.Decl (S.subst_meta l (S.lift i t))))::(aux (i+1) tl)
364 | (Some (n,C.Def (t,None)))::tl ->
365 (Some (n,C.Def ((S.subst_meta l (S.lift i t)),None)))::
367 | None::tl -> None::(aux (i+1) tl)
368 | (Some (_,C.Def (_,Some _)))::_ -> assert false
370 aux 1 canonical_context
377 | Some t,Some (_,C.Def (ct,_)) ->
380 (xxx_type_of_aux' metasenv context ct)
382 (* Maybe I am a bit too paranoid, because *)
383 (* if the term is well-typed than t and ct *)
384 (* are convertible. Nevertheless, I compute *)
385 (* the expected type. *)
386 ignore (type_of_aux context t (Some expected_type))
387 | Some t,Some (_,C.Decl ct) ->
388 ignore (type_of_aux context t (Some ct))
389 | _,_ -> assert false (* the term is not well typed!!! *)
390 ) l lifted_canonical_context
392 let (_,canonical_context,ty) = CicUtil.lookup_meta n metasenv in
393 (* Checks suppressed *)
394 CicSubstitution.subst_meta l ty
395 | C.Sort (C.Type t) -> (* TASSI: CONSTRAINT *)
396 C.Sort (C.Type (CicUniv.fresh()))
397 | C.Sort _ -> C.Sort (C.Type (CicUniv.fresh())) (* TASSI: CONSTRAINT *)
398 | C.Implicit _ -> raise (Impossible 21)
400 (* Let's visit all the subterms that will not be visited later *)
401 let _ = type_of_aux context te (Some (beta_reduce ty)) in
402 let _ = type_of_aux context ty None in
403 (* Checks suppressed *)
405 | C.Prod (name,s,t) ->
406 let sort1 = type_of_aux context s None
407 and sort2 = type_of_aux ((Some (name,(C.Decl s)))::context) t None in
408 sort_of_prod context (name,s) (sort1,sort2)
409 | C.Lambda (n,s,t) ->
410 (* Let's visit all the subterms that will not be visited later *)
411 let _ = type_of_aux context s None in
412 let expected_target_type =
413 match expectedty with
415 | Some expectedty' ->
417 match R.whd context expectedty' with
418 C.Prod (_,_,expected_target_type) ->
419 beta_reduce expected_target_type
425 type_of_aux ((Some (n,(C.Decl s)))::context) t expected_target_type
427 (* Checks suppressed *)
430 (*CSC: What are the right expected types for the source and *)
431 (*CSC: target of a LetIn? None used. *)
432 (* Let's visit all the subterms that will not be visited later *)
433 let ty = type_of_aux context s None in
435 (* Checks suppressed *)
436 type_of_aux ((Some (n,(C.Def (s,Some ty))))::context) t None
437 in (* CicSubstitution.subst s t_typ *)
438 if does_not_occur 1 t_typ then
439 (* since [Rel 1] does not occur in typ, substituting any term *)
440 (* in place of [Rel 1] is equivalent to delifting once *)
441 CicSubstitution.subst (C.Implicit None) t_typ
444 | C.Appl (he::tl) when List.length tl > 0 ->
446 let expected_hetype =
447 (* Inefficient, the head is computed twice. But I know *)
448 (* of no other solution. *)
450 (R.whd context (xxx_type_of_aux' metasenv context he)))
452 let hetype = type_of_aux context he (Some expected_hetype) in
453 let tlbody_and_type =
457 | C.Prod (n,s,t),he::tl ->
458 (he, type_of_aux context he (Some (beta_reduce s)))::
459 (aux (R.whd context (S.subst he t), tl))
462 aux (expected_hetype, tl) *)
463 let hetype = R.whd context (type_of_aux context he None) in
464 let tlbody_and_type =
468 | C.Prod (n,s,t),he::tl ->
469 (he, type_of_aux context he (Some (beta_reduce s)))::
470 (aux (R.whd context (S.subst he t), tl))
475 eat_prods context hetype tlbody_and_type
476 | C.Appl _ -> raise (NotWellTyped "Appl: no arguments")
477 | C.Const (uri,exp_named_subst) ->
478 visit_exp_named_subst context uri exp_named_subst ;
479 CicSubstitution.subst_vars exp_named_subst (type_of_constant uri)
480 | C.MutInd (uri,i,exp_named_subst) ->
481 visit_exp_named_subst context uri exp_named_subst ;
482 CicSubstitution.subst_vars exp_named_subst
483 (type_of_mutual_inductive_defs uri i)
484 | C.MutConstruct (uri,i,j,exp_named_subst) ->
485 visit_exp_named_subst context uri exp_named_subst ;
486 CicSubstitution.subst_vars exp_named_subst
487 (type_of_mutual_inductive_constr uri i j)
488 | C.MutCase (uri,i,outtype,term,pl) ->
489 let outsort = type_of_aux context outtype None in
490 let (need_dummy, k) =
491 let rec guess_args context t =
492 match CicReduction.whd context t with
493 C.Sort _ -> (true, 0)
494 | C.Prod (name, s, t) ->
495 let (b, n) = guess_args ((Some (name,(C.Decl s)))::context) t in
497 (* last prod before sort *)
498 match CicReduction.whd context s with
499 C.MutInd (uri',i',_) when U.eq uri' uri && i' = i ->
501 | C.Appl ((C.MutInd (uri',i',_)) :: _)
502 when U.eq uri' uri && i' = i -> (false, 1)
506 | _ -> raise (NotWellTyped "MutCase: outtype ill-formed")
508 let (b, k) = guess_args context outsort in
509 if not b then (b, k - 1) else (b, k)
511 let (parameters, arguments,exp_named_subst) =
513 xxx_type_of_aux' metasenv context term
516 R.whd context (type_of_aux context term
517 (Some (beta_reduce type_of_term)))
519 (*CSC manca il caso dei CAST *)
520 C.MutInd (uri',i',exp_named_subst) ->
521 (* Checks suppressed *)
522 [],[],exp_named_subst
523 | C.Appl (C.MutInd (uri',i',exp_named_subst) :: tl) ->
525 split tl (List.length tl - k)
526 in params,args,exp_named_subst
528 raise (NotWellTyped "MutCase: the term is not an inductive one")
530 (* Checks suppressed *)
531 (* Let's visit all the subterms that will not be visited later *)
535 CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri
536 with Not_found -> assert false
539 C.InductiveDefinition (tl,_,parsno,_) ->
540 let (_,_,_,cl) = List.nth tl i in (cl,parsno)
542 raise (WrongUriToMutualInductiveDefinitions (U.string_of_uri uri))
548 if parameters = [] then
549 (C.MutConstruct (uri,i,j,exp_named_subst))
551 (C.Appl (C.MutConstruct (uri,i,j,exp_named_subst)::parameters))
554 type_of_branch context parsno need_dummy outtype cons
555 (xxx_type_of_aux' metasenv context cons)
557 ignore (type_of_aux context p
558 (Some (beta_reduce expectedtype))) ;
560 ) 1 (List.combine pl cl)
562 if not need_dummy then
563 C.Appl ((outtype::arguments)@[term])
564 else if arguments = [] then
567 C.Appl (outtype::arguments)
569 (* Let's visit all the subterms that will not be visited later *)
574 let _ = type_of_aux context ty None in
575 (Some (C.Name n,(C.Decl ty)))
584 beta_reduce (CicSubstitution.lift (List.length fl) ty)
586 ignore (type_of_aux context' bo (Some expectedty))
589 (* Checks suppressed *)
590 let (_,_,ty,_) = List.nth fl i in
593 (* Let's visit all the subterms that will not be visited later *)
598 let _ = type_of_aux context ty None in
599 (Some (C.Name n,(C.Decl ty)))
608 beta_reduce (CicSubstitution.lift (List.length fl) ty)
610 ignore (type_of_aux context' bo (Some expectedty))
613 (* Checks suppressed *)
614 let (_,ty,_) = List.nth fl i in
617 let synthesized' = beta_reduce synthesized in
618 let synthesized' = !pack_coercion metasenv context synthesized' in
620 match expectedty with
622 (* No expected type *)
623 {synthesized = synthesized' ; expected = None}, synthesized
624 | Some ty when xxx_syntactic_equality synthesized' ty ->
625 (* The expected type is synthactically equal to *)
626 (* the synthesized type. Let's forget it. *)
627 {synthesized = synthesized' ; expected = None}, synthesized
628 | Some expectedty' ->
629 {synthesized = synthesized' ; expected = Some expectedty'},
632 assert (not (Cic.CicHash.mem subterms_to_types t));
633 Cic.CicHash.add subterms_to_types t types ;
636 and visit_exp_named_subst context uri exp_named_subst =
640 CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri
641 with Not_found -> assert false
643 let params = CicUtil.params_of_obj obj in
648 CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri
649 with Not_found -> assert false
652 Cic.Variable (_,None,ty,_,_) -> uri,ty
653 | _ -> assert false (* the theorem is well-typed *)
656 let rec check uris_and_types subst =
657 match uris_and_types,subst with
659 | (uri,ty)::tytl,(uri',t)::substtl when uri = uri' ->
660 ignore (type_of_aux context t (Some ty)) ;
663 (function uri,t' -> uri,(CicSubstitution.subst_vars [uri',t] t')) tytl
666 | _,_ -> assert false (* the theorem is well-typed *)
668 check uris_and_types exp_named_subst
670 and sort_of_prod context (name,s) (t1, t2) =
671 let module C = Cic in
672 let t1' = CicReduction.whd context t1 in
673 let t2' = CicReduction.whd ((Some (name,C.Decl s))::context) t2 in
674 match (t1', t2') with
675 (C.Sort _, C.Sort s2)
676 when (s2 = C.Prop or s2 = C.Set or s2 = C.CProp) ->
677 (* different from Coq manual!!! *)
679 | (C.Sort (C.Type t1), C.Sort (C.Type t2)) ->
680 C.Sort (C.Type (CicUniv.fresh()))
681 | (C.Sort _,C.Sort (C.Type t1)) ->
682 (* TASSI: CONSRTAINTS: the same in cictypechecker,cicrefine *)
683 C.Sort (C.Type t1) (* c'e' bisogno di un fresh? *)
684 | (C.Meta _, C.Sort _) -> t2'
685 | (C.Meta _, (C.Meta (_,_) as t))
686 | (C.Sort _, (C.Meta (_,_) as t)) when CicUtil.is_closed t ->
691 ("Prod: sort1= " ^ CicPp.ppterm t1' ^ " ; sort2= " ^ CicPp.ppterm t2'))
693 and eat_prods context hetype =
694 (*CSC: siamo sicuri che le are_convertible non lavorino con termini non *)
698 | (hete, hety)::tl ->
699 (match (CicReduction.whd context hetype) with
701 (* Checks suppressed *)
702 eat_prods context (CicSubstitution.subst hete t) tl
703 | _ -> raise (NotWellTyped "Appl: wrong Prod-type")
706 and type_of_branch context argsno need_dummy outtype term constype =
707 let module C = Cic in
708 let module R = CicReduction in
709 match R.whd context constype with
714 C.Appl [outtype ; term]
715 | C.Appl (C.MutInd (_,_,_)::tl) ->
716 let (_,arguments) = split tl argsno
718 if need_dummy && arguments = [] then
721 C.Appl (outtype::arguments@(if need_dummy then [] else [term]))
722 | C.Prod (name,so,de) ->
724 match CicSubstitution.lift 1 term with
725 C.Appl l -> C.Appl (l@[C.Rel 1])
726 | t -> C.Appl [t ; C.Rel 1]
728 C.Prod (C.Anonymous,so,type_of_branch
729 ((Some (name,(C.Decl so)))::context) argsno need_dummy
730 (CicSubstitution.lift 1 outtype) term' de)
731 | _ -> raise (Impossible 20)
734 type_of_aux context t expectedty
737 let double_type_of metasenv context t expectedty =
738 let subterms_to_types = Cic.CicHash.create 503 in
739 ignore (type_of_aux' subterms_to_types metasenv context t expectedty) ;