X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=blobdiff_plain;f=helm%2Focaml%2Fcic_annotations%2FcicXPath.ml;fp=helm%2Focaml%2Fcic_annotations%2FcicXPath.ml;h=0000000000000000000000000000000000000000;hp=75a598d91990728b4361452e750bc7669778cd6c;hb=1696761e4b8576e8ed81caa905fd108717019226;hpb=5325734bc2e4927ed7ec146e35a6f0f2b49f50c1 diff --git a/helm/ocaml/cic_annotations/cicXPath.ml b/helm/ocaml/cic_annotations/cicXPath.ml deleted file mode 100644 index 75a598d91..000000000 --- a/helm/ocaml/cic_annotations/cicXPath.ml +++ /dev/null @@ -1,146 +0,0 @@ -(* Copyright (C) 2000, HELM Team. - * - * This file is part of HELM, an Hypertextual, Electronic - * Library of Mathematics, developed at the Computer Science - * Department, University of Bologna, Italy. - * - * HELM is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * HELM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with HELM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - * For details, see the HELM World-Wide-Web page, - * http://cs.unibo.it/helm/. - *) - -(******************************************************************************) -(* *) -(* PROJECT HELM *) -(* *) -(* Claudio Sacerdoti Coen *) -(* 14/06/2000 *) -(* *) -(* *) -(******************************************************************************) - -let get_annotation ids_to_annotations xpath = - try - Some (Hashtbl.find ids_to_annotations xpath) - with - Not_found -> None -;; - -exception MoreThanOneTargetFor of Cic.id;; - -(* creates a hashtable mapping each unique id to a node of the annotated -object *) -let get_ids_to_targets annobj = - let module C = Cic in - let ids_to_targets = Hashtbl.create 503 in - let set_target id target = - try - ignore (Hashtbl.find ids_to_targets id) ; - raise (MoreThanOneTargetFor id) - with - Not_found -> Hashtbl.add ids_to_targets id target - in - let rec add_target_term t = - match t with - C.ARel (id,_,_,_) - | C.AMeta (id,_,_) - | C.ASort (id,_) - | C.AImplicit (id, _) -> - set_target id (C.Term t) - | C.ACast (id,va,ty) -> - set_target id (C.Term t) ; - add_target_term va ; - add_target_term ty - | C.AProd (id,_,so,ta) - | C.ALambda (id,_,so,ta) - | C.ALetIn (id,_,so,ta) -> - set_target id (C.Term t) ; - add_target_term so ; - add_target_term ta - | C.AAppl (id,l) -> - set_target id (C.Term t) ; - List.iter add_target_term l - | C.AVar (id,_,exp_named_subst) - | C.AConst (id,_,exp_named_subst) - | C.AMutInd (id,_,_,exp_named_subst) - | C.AMutConstruct (id,_,_,_,exp_named_subst) -> - set_target id (C.Term t) ; - List.iter (function (_,t) -> add_target_term t) exp_named_subst - | C.AMutCase (id,_,_,ot,it,pl) -> - set_target id (C.Term t) ; - List.iter add_target_term (ot::it::pl) - | C.AFix (id,_,ifl) -> - set_target id (C.Term t) ; - List.iter - (function (_,_,_,ty,bo) -> - add_target_term ty ; - add_target_term bo - ) ifl - | C.ACoFix (id,_,cfl) -> - set_target id (C.Term t) ; - List.iter - (function (_,_,ty,bo) -> - add_target_term ty ; - add_target_term bo - ) cfl - in - let add_target_obj annobj = - match annobj with - C.AConstant (id,idbody,_,bo,ty,_) -> - set_target id (C.Object annobj) ; - (match idbody,bo with - Some idbody,Some bo -> - set_target idbody (C.ConstantBody annobj) ; - add_target_term bo - | None, None -> () - | _,_ -> assert false - ) ; - add_target_term ty - | C.AVariable (id,_,None,ty,_) -> - set_target id (C.Object annobj) ; - add_target_term ty - | C.AVariable (id,_,Some bo,ty,_) -> - set_target id (C.Object annobj) ; - add_target_term bo ; - add_target_term ty - | C.ACurrentProof (id,idbody,_,cl,bo,ty,_) -> - set_target id (C.Object annobj) ; - set_target idbody (C.ConstantBody annobj) ; - List.iter (function (cid,_,context, t) as annconj -> - set_target cid (C.Conjecture annconj) ; - List.iter - (function ((hid,h) as annhyp) -> - set_target hid (C.Hypothesis annhyp) ; - match h with - Some (_,C.ADecl at) -> add_target_term at - | Some (_,C.ADef at) -> add_target_term at - | None -> () - ) context; - add_target_term t) cl ; - add_target_term bo ; - add_target_term ty - | C.AInductiveDefinition (id,itl,_,_) -> - set_target id (C.Object annobj) ; - List.iter - (function (_,_,_,arity,cl) -> - add_target_term arity ; - List.iter (function (_,ty) -> add_target_term ty) cl - ) itl - in - add_target_obj annobj ; - ids_to_targets -;;