(try
match List.nth context (n - 1) with
Some (_,C.Decl t) -> S.lift n t,subst,metasenv
- | Some (_,C.Def bo) ->
+ | Some (_,C.Def (_,Some ty)) -> S.lift n ty,subst,metasenv
+ | Some (_,C.Def (bo,None)) ->
+ prerr_endline "##### DA INVESTIGARE E CAPIRE" ;
type_of_aux subst metasenv context (S.lift n bo)
| None -> raise RelToHiddenHypothesis
with
C.Prod (n,s,type2),subst'''',metasenv''''
| C.LetIn (n,s,t) ->
(* only to check if s is well-typed *)
- let _,subst',metasenv' = type_of_aux subst metasenv context s in
+ let ty,subst',metasenv' = type_of_aux subst metasenv context s in
let inferredty,subst'',metasenv'' =
- type_of_aux subst' metasenv' ((Some (n,(C.Def s)))::context) t
+ type_of_aux subst' metasenv' ((Some (n,(C.Def (s,Some ty))))::context) t
in
(* One-step LetIn reduction. Even faster than the previous solution.
Moreover the inferred type is closer to the expected one. *)
[] -> []
| (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.Def t))::tl ->
- (Some (n,C.Def (S.lift_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)))::(aux (i+1) tl)
| None::tl -> None::(aux (i+1) tl)
+ | (Some (_,C.Def (_,Some _)))::_ -> assert false
in
aux 1 canonical_context
in
(fun (subst,metasenv) t ct ->
match (t,ct) with
_,None -> subst,metasenv
- | Some t,Some (_,C.Def ct) ->
+ | Some t,Some (_,C.Def (ct,_)) ->
(try
CicUnification.fo_unif_subst subst context metasenv t ct
with _ -> raise MetasenvInconsistency)