From: Enrico Tassi Date: Mon, 21 Sep 2009 12:09:14 +0000 (+0000) Subject: new implementation of delift_type_wrt_term, that call delift directly X-Git-Tag: make_still_working~3454 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=849c15ec9cc74737cbf5d392fa565e0630f903d7;p=helm.git new implementation of delift_type_wrt_term, that call delift directly --- diff --git a/helm/software/components/ng_refiner/nCicUnification.ml b/helm/software/components/ng_refiner/nCicUnification.ml index dff242970..ce109f2af 100644 --- a/helm/software/components/ng_refiner/nCicUnification.ml +++ b/helm/software/components/ng_refiner/nCicUnification.ml @@ -154,11 +154,16 @@ let rec lambda_intros rdb metasenv subst context t args = in metasenv, subst, bo | (arg,ty)::tail -> + pp(lazy("arg{ " ^ + NCicPp.ppterm ~metasenv ~subst ~context:context_of_args arg ^ ":" ^ + NCicPp.ppterm ~metasenv ~subst ~context:context_of_args ty)); let metasenv, subst, telescopic_ty = -(* XXX if processed_args = [] then metasenv, subst, ty else *) + if processed_args = [] then metasenv, subst, ty else + let _ = pp(lazy("delift")) in delift_type_wrt_terms rdb metasenv subst context_of_args ty (List.rev processed_args) in + pp(lazy("arg}")); let name = "HBeta"^string_of_int n in let metasenv, subst, bo = mk_lambda metasenv subst ((name,NCic.Decl telescopic_ty)::context) (n+1) @@ -166,7 +171,12 @@ let rec lambda_intros rdb metasenv subst context t args = in metasenv, subst, NCic.Lambda (name, telescopic_ty, bo) in + pp(lazy("LAMBDA_INTROS{ " ^ + NCicPp.ppterm ~metasenv ~subst ~context t ^ ":" ^ + NCicPp.ppterm ~metasenv ~subst ~context tty ^ " over " ^ + String.concat "," (List.map (NCicPp.ppterm ~metasenv ~subst ~context)args))); let rc = mk_lambda metasenv subst context 0 [] argsty in + pp(lazy("LAMBDA_INTROS}")); rc and instantiate rdb test_eq_only metasenv subst context n lc t swap = @@ -666,17 +676,20 @@ pp (lazy (string_of_bool norm1 ^ " ?? " ^ string_of_bool norm2)); (*D*) in outside(); rc with exn -> outside (); raise exn and delift_type_wrt_terms rdb metasenv subst context t args = - let metasenv, _, instance, _ = - NCicMetaSubst.mk_meta metasenv context `Type in - let meta_applied = NCicUntrusted.mk_appl instance args in - let metasenv,subst,meta_applied,_ = - !refiner_typeof ((rdb:> NRstatus.status)#set_coerc_db NCicCoercion.empty_db) - metasenv subst context meta_applied None + let (metasenv, subst), t = + try + NCicMetaSubst.delift + ~unify:(fun m s c t1 t2 -> + let ind = !indent in + let res = + try Some (unify rdb false m s c t1 t2 ) + with UnificationFailure _ | Uncertain _ -> None + in + indent := ind; res) + metasenv subst context 0 (0,NCic.Ctx (args @ + List.rev (mk_irl (List.length context)))) t + with NCicMetaSubst.MetaSubstFailure _ -> (metasenv, subst), t in - let metasenv, subst = - unify rdb true metasenv subst context meta_applied t in - let t = NCicSubstitution.lift (List.length args) instance in - let t = NCicUntrusted.mk_appl t (mk_irl (List.length args)) in metasenv, subst, t ;;