X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fcic_unification%2FcicRefine.ml;h=bc14681263b80497477efc5294ea38f710d9b11f;hb=c9995e146dc70bed25b9fe2913f3d5d31a4f9086;hp=8935d867c570628f4f80d70eac72e9c30ce564cd;hpb=c1a5a672088af4ff926e5848396c810c2539c2f5;p=helm.git diff --git a/helm/ocaml/cic_unification/cicRefine.ml b/helm/ocaml/cic_unification/cicRefine.ml index 8935d867c..bc1468126 100644 --- a/helm/ocaml/cic_unification/cicRefine.ml +++ b/helm/ocaml/cic_unification/cicRefine.ml @@ -185,17 +185,19 @@ and type_of_aux' metasenv context t = sort_of_prod subst'' metasenv'' context (name,s) (sort1,sort2) | C.Lambda (n,s,t) -> let sort1,subst',metasenv' = type_of_aux subst metasenv context s in + (match CicMetaSubst.whd subst' context sort1 with + C.Meta _ + | C.Sort _ -> () + | _ -> + raise (NotRefinable (sprintf + "Not well-typed lambda-abstraction: the source %s should be a type; + instead it is a term of type %s" (CicPp.ppterm s) + (CicPp.ppterm sort1))) + ) ; let type2,subst'',metasenv'' = type_of_aux subst' metasenv' ((Some (n,(C.Decl s)))::context) t in - let sort2,subst''',metasenv''' = - type_of_aux subst'' metasenv''((Some (n,(C.Decl s)))::context) type2 - in - (* only to check if the product is well-typed *) - let _,subst'''',metasenv'''' = - sort_of_prod subst''' metasenv''' context (n,s) (sort1,sort2) - in - C.Prod (n,s,type2),subst'''',metasenv'''' + C.Prod (n,s,type2),subst'',metasenv'' | C.LetIn (n,s,t) -> (* only to check if s is well-typed *) let ty,subst',metasenv' = type_of_aux subst metasenv context s in