type 'a eval_from_moo =
{ efm_go: GT.status -> string -> GT.status }
-let coercion_moo_statement_of uri =
- GrafiteAst.Coercion (HExtlib.dummy_floc, uri, false)
+let coercion_moo_statement_of arity uri =
+ GrafiteAst.Coercion (HExtlib.dummy_floc, uri, false, arity)
let refinement_toolkit = {
RefinementTool.type_of_aux' =
RefinementTool.pack_coercion_obj = CicRefine.pack_coercion_obj;
}
-let eval_coercion status ~add_composites uri =
+let eval_coercion status ~add_composites uri arity =
let status,compounds =
- GrafiteSync.add_coercion ~add_composites refinement_toolkit status uri in
+ GrafiteSync.add_coercion ~add_composites refinement_toolkit status uri arity
+ in
let moo_content =
- List.map coercion_moo_statement_of (uri::compounds)
+ List.map (coercion_moo_statement_of arity) (uri::compounds)
in
let status = GT.add_moo_content moo_content status in
{status with GT.proof_status = GT.No_proof},
let obj,_ =
CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri in
let attrs = CicUtil.attributes_of_obj obj in
- List.mem (`Class `Coercion) attrs
+ try
+ match List.find
+ (function `Class (`Coercion _) -> true | _-> false) attrs
+ with `Class (`Coercion n) -> true,n | _ -> assert false
+ with Not_found -> false,0
with Not_found -> assert false
in
(* looking at the fields we can know the 'wanted' coercions, but not the
let wanted_coercions =
HExtlib.filter_map
(function
- | (name,true) ->
+ | (name,true,arity) ->
Some
- (UriManager.uri_of_string
+ (arity, UriManager.uri_of_string
(GT.qualify status name ^ ".con"))
| _ -> None)
fields
List.split
(HExtlib.filter_map
(fun uri ->
- let is_a_wanted_coercion =
- List.exists (UriManager.eq uri) wanted_coercions
+ let is_a_wanted_coercion,arity_wanted =
+ try
+ let arity,_ =
+ List.find (fun (n,u) -> UriManager.eq u uri)
+ wanted_coercions
+ in
+ true, arity
+ with Not_found -> false, 0
in
- if is_a_coercion uri || is_a_wanted_coercion then
- Some (uri, coercion_moo_statement_of uri)
+ let is_a_coercion, arity_coercion = is_a_coercion uri in
+ if is_a_coercion then
+ Some (uri, coercion_moo_statement_of arity_coercion uri)
+ else if is_a_wanted_coercion then
+ Some (uri, coercion_moo_statement_of arity_wanted uri)
else
- None)
+ None)
lemmas)
in
(*prerr_endline "actual coercions:";
let status, lemmas = add_obj uri obj status in
{status with GT.proof_status = GT.No_proof},
uri::lemmas
- | GrafiteAst.Coercion (loc, uri, add_composites) ->
- eval_coercion status ~add_composites uri
+ | GrafiteAst.Coercion (loc, uri, add_composites, arity) ->
+ eval_coercion status ~add_composites uri arity
| GrafiteAst.Obj (loc,obj) ->
let ext,name =
match obj with