From: Claudio Sacerdoti Coen Date: Sat, 30 Dec 2006 20:56:13 +0000 (+0000) Subject: Serious bug fixed: arities of coercions in the .moo files were not computed X-Git-Tag: make_still_working~6555 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=686ad41d7c9431094c12dae0fa6b84a898c38e84;p=helm.git Serious bug fixed: arities of coercions in the .moo files were not computed correctly. Thus including another file a bugged coercion graph was produced, with randomic effects quite hard to understand. (Examples in dama where it was not possible to use <= in place of le here and there because of a coercion with the wrong arity). --- diff --git a/helm/software/components/grafite_engine/grafiteEngine.ml b/helm/software/components/grafite_engine/grafiteEngine.ml index 30aa982d8..95e396003 100644 --- a/helm/software/components/grafite_engine/grafiteEngine.ml +++ b/helm/software/components/grafite_engine/grafiteEngine.ml @@ -424,7 +424,7 @@ type 'a eval_executable = type 'a eval_from_moo = { efm_go: GrafiteTypes.status -> string -> GrafiteTypes.status } -let coercion_moo_statement_of arity uri = +let coercion_moo_statement_of (uri,arity) = GrafiteAst.Coercion (HExtlib.dummy_floc, uri, false, arity) let refinement_toolkit = { @@ -456,11 +456,11 @@ let eval_coercion status ~add_composites uri arity baseuri = baseuri in let moo_content = - List.map (coercion_moo_statement_of arity) (uri::compounds) + List.map coercion_moo_statement_of ((uri,arity)::compounds) in let status = GrafiteTypes.add_moo_content moo_content status in {status with GrafiteTypes.proof_status = GrafiteTypes.No_proof}, - compounds + List.map fst compounds let eval_tactical ~disambiguate_tactic status tac = let apply_tactic = apply_tactic ~disambiguate_tactic in @@ -603,9 +603,9 @@ let add_coercions_of_record_to_moo obj lemmas status = in 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) + Some (uri, coercion_moo_statement_of (uri,arity_coercion)) else if is_a_wanted_coercion then - Some (uri, coercion_moo_statement_of arity_wanted uri) + Some (uri, coercion_moo_statement_of (uri,arity_wanted)) else None) lemmas) @@ -710,6 +710,7 @@ let rec eval_command = {ec_go = fun ~disambiguate_command opts status let status, lemmas = add_obj uri obj status in {status with GrafiteTypes.proof_status = GrafiteTypes.No_proof}, + (*CSC: I throw away the arities *) uri::lemmas | GrafiteAst.Relation (loc, id, a, aeq, refl, sym, trans) -> Setoids.add_relation id a aeq refl sym trans; diff --git a/helm/software/components/grafite_engine/grafiteSync.mli b/helm/software/components/grafite_engine/grafiteSync.mli index 571b7a91a..42b29a9fa 100644 --- a/helm/software/components/grafite_engine/grafiteSync.mli +++ b/helm/software/components/grafite_engine/grafiteSync.mli @@ -33,7 +33,7 @@ val add_coercion: add_composites:bool -> GrafiteTypes.status -> UriManager.uri -> int -> string (* baseuri *) -> - GrafiteTypes.status * UriManager.uri list + GrafiteTypes.status * (UriManager.uri * int) list (* URI and arity *) val time_travel: present:GrafiteTypes.status -> past:GrafiteTypes.status -> unit diff --git a/helm/software/components/library/librarySync.ml b/helm/software/components/library/librarySync.ml index d5eca252a..4e64e6bad 100644 --- a/helm/software/components/library/librarySync.ml +++ b/helm/software/components/library/librarySync.ml @@ -293,9 +293,10 @@ let add_coercion ~add_composites refinement_toolkit uri arity baseuri = let lemmas = if add_composites then List.fold_left - (fun acc (_,_,uri,obj) -> + (fun acc (_,tgt,uri,obj) -> add_single_obj uri obj refinement_toolkit; - uri::acc) + let arity = match tgt with CoercDb.Fun n -> n | _ -> 0 in + (uri,arity)::acc) [] new_coercions else [] @@ -358,6 +359,9 @@ let generate_projections refinement_toolkit uri fields = if coercion then begin (*prerr_endline ("composite for " ^ UriManager.string_of_uri uri);*) + (*CSC: I think there is a bug here. The composite coercions + are not remembered in the .moo file. Thus they are re-generated + every time. Right? *) let x = add_coercion ~add_composites:true refinement_toolkit uri arity (UriManager.buri_of_uri uri) @@ -366,7 +370,8 @@ let generate_projections refinement_toolkit uri fields = List.iter (fun u -> prerr_endline (UriManager.string_of_uri u)) x; prerr_endline "---"; *) - x + (*CSC: I throw the arity away. See comment above *) + List.map fst x end else [] diff --git a/helm/software/components/library/librarySync.mli b/helm/software/components/library/librarySync.mli index a836dfd57..96e923100 100644 --- a/helm/software/components/library/librarySync.mli +++ b/helm/software/components/library/librarySync.mli @@ -49,7 +49,7 @@ val add_coercion: add_composites:bool -> RefinementTool.kit -> UriManager.uri -> int (* arity *) -> string (* baseuri *) -> - UriManager.uri list + (UriManager.uri * int) list (* URI and arity *) (* inverse of add_coercion, removes both the eventually created composite *) (* coercions and the information that [uri] and the composites are coercion *)