GrafiteTypes.Serializer.require
~alias_only ~baseuri ~fname:fullpath status
| GrafiteAst.UnificationHint (loc, t, n) -> eval_unification_hint status t n
- | GrafiteAst.NCoercion (loc, name, t, ty, source, target) ->
+ | GrafiteAst.NCoercion (loc, name, compose, t, ty, source, target) ->
let status, composites =
- NCicCoercDeclaration.eval_ncoercion status name t ty source target in
+ NCicCoercDeclaration.eval_ncoercion status name compose t ty source
+ target in
let mode = GrafiteAst.WithPreferences in (* MATITA 1.0: fixme *)
let aliases = GrafiteDisambiguate.aliases_for_objs status composites in
eval_alias status (mode,aliases)
let status, nuris =
NCicCoercDeclaration.
basic_eval_and_record_ncoercion_from_t_cpos_arity
- status (name,t,cpos,arity) in
+ status (name,true,t,cpos,arity) in
let aliases = GrafiteDisambiguate.aliases_for_objs status nuris in
eval_alias status (mode,aliases)
with MultiPassDisambiguator.DisambiguationError _->
;;
(* idempotent *)
-let basic_index_ncoercion (name,t,s,d,position,arity) status =
+let basic_index_ncoercion (name,_compose,t,s,d,position,arity) status =
NCicCoercion.index_coercion status name t s d arity position
;;
-let basic_eval_ncoercion (name,t,s,d,p,a) status =
+let basic_eval_ncoercion (name,compose,t,s,d,p,a) status =
let to_s =
NCicCoercion.look_for_coercion status [] [] [] skel_dummy s
in
NCicCoercion.look_for_coercion status [] [] [] d skel_dummy
in
let status = NCicCoercion.index_coercion status name t s d a p in
- let composites = close_graph name t s d to_s from_d p a status in
+ let composites =
+ if compose then close_graph name t s d to_s from_d p a status else [] in
List.fold_left
(fun (uris,infos,st) ((uri,_,_,_,_ as obj),name,t,s,d,p,a) ->
- let info = name,t,s,d,p,a in
+ let info = name,compose,t,s,d,p,a in
let st = NCicLibrary.add_obj st obj in
let st = basic_index_ncoercion info st in
uri::uris, info::infos, st)
;;
let record_ncoercion =
- let aux (name,t,s,d,p,a) ~refresh_uri_in_term =
+ let aux (name,compose,t,s,d,p,a) ~refresh_uri_in_term =
let t = refresh_uri_in_term t in
let s = refresh_uri_in_term s in
let d = refresh_uri_in_term d in
- basic_index_ncoercion (name,t,s,d,p,a)
+ basic_index_ncoercion (name,compose,t,s,d,p,a)
in
let aux_l l ~refresh_uri_in_universe ~refresh_uri_in_term
~refresh_uri_in_reference ~alias_only status
;;
let basic_eval_and_record_ncoercion_from_t_cpos_arity
- status (name,t,cpos,arity)
+ status (name,compose,t,cpos,arity)
=
let ty = NCicTypeChecker.typeof status ~subst:[] ~metasenv:[] [] t in
let src,tgt = src_tgt_of_ty_cpos_arity status ty cpos arity in
let status, uris =
- basic_eval_and_record_ncoercion (name,t,src,tgt,cpos,arity) status
+ basic_eval_and_record_ncoercion (name,compose,t,src,tgt,cpos,arity) status
in
status,uris
;;
-let eval_ncoercion (status: #GrafiteTypes.status) name t ty (id,src) tgt =
+let eval_ncoercion (status: #GrafiteTypes.status) name compose t ty (id,src) tgt =
let metasenv,subst,status,ty =
GrafiteDisambiguate.disambiguate_nterm status None [] [] [] ("",0,ty) in
assert (metasenv=[]);
let status, src, tgt, cpos, arity =
src_tgt_cpos_arity_of_ty_id_src_tgt status ty id src tgt in
let status, uris =
- basic_eval_and_record_ncoercion (name,t,src,tgt,cpos,arity) status
+ basic_eval_and_record_ncoercion (name,compose,t,src,tgt,cpos,arity) status
in
status,uris
;;
| IDENT "coercion"; name = IDENT; SYMBOL ":"; ty = term;
SYMBOL <:unicode<def>>; t = term; "on";
id = [ IDENT | PIDENT ]; SYMBOL ":"; source = term;
- "to"; target = term ->
- G.NCoercion(loc,name,t,ty,(id,source),target)
+ "to"; target = term; compose = OPT [ IDENT "nocomposites" -> () ] ->
+ let compose = compose = None in
+ G.NCoercion(loc,name,compose,t,ty,(id,source),target)
| IDENT "record" ; (params,name,ty,fields) = record_spec ->
G.NObj (loc, N.Record (params,name,ty,fields))
| IDENT "copy" ; s = IDENT; IDENT "from"; u = URI; "with";