let context = [] in
let src_uri =
let ty_src = CicReduction.whd context ty_src in
- UriManager.uri_of_string (CicUtil.uri_of_term ty_src)
+ CicUtil.uri_of_term ty_src
in
let tgt_uri =
let ty_tgt = CicReduction.whd context ty_tgt in
- UriManager.uri_of_string (CicUtil.uri_of_term ty_tgt)
+ CicUtil.uri_of_term ty_tgt
in
let new_coercions =
(* also adds them to the Db *)
{status with aliases =
DisambiguateTypes.Environment.add
(DisambiguateTypes.Id id)
- ("boh?",(fun _ _ _ -> CicUtil.term_of_uri uri))
+ ("boh?",(fun _ _ _ -> CicUtil.term_of_uri (UriManager.uri_of_string uri)))
status.aliases }
| TacticAst.Symbol_alias (symb, instance, desc) ->
{status with aliases =
) ([],0) types)
let env_of_list l env =
- let l' = List.map (fun (name,suri) -> name,suri,CicUtil.term_of_uri suri) l in
+ let l' = List.map (fun (name,suri) -> name,suri,CicUtil.term_of_uri (UriManager.uri_of_string suri)) l in
DisambiguateTypes.env_of_list l' env
let add_aliases_for_inductive_def status types suri =
let xpointer_RE = Str.regexp "\\([^#]+\\)#xpointer(\\(.*\\))"
let slash_RE = Str.regexp "/"
-let term_of_uri s =
- let uri = UriManager.uri_of_string s in
+let term_of_uri uri =
+ let s = UriManager.string_of_uri uri in
try
(if String.sub s (String.length s - 4) 4 = ".con" then
Cic.Const (uri, [])
let uri_of_term = function
| Cic.Const (uri, [])
- | Cic.Var (uri, []) -> UriManager.string_of_uri uri
+ | Cic.Var (uri, []) -> uri
| Cic.MutInd (baseuri, tyno, []) ->
- sprintf "%s#xpointer(1/%d)" (UriManager.string_of_uri baseuri) (tyno + 1)
+ UriManager.uri_of_string
+ (sprintf "%s#xpointer(1/%d)" (UriManager.string_of_uri baseuri) (tyno+1))
| Cic.MutConstruct (baseuri, tyno, consno, []) ->
- sprintf "%s#xpointer(1/%d/%d)" (UriManager.string_of_uri baseuri)
- (tyno + 1) consno
+ UriManager.uri_of_string
+ (sprintf "%s#xpointer(1/%d/%d)" (UriManager.string_of_uri baseuri)
+ (tyno + 1) consno)
| _ -> raise (Invalid_argument "uri_of_term")
let select ~term ~context =
(** conversions between terms which are fully representable as uris (Var, Const,
* Mutind, and MutConstruct) and corresponding tree representations *)
-(*CSC: horrible: the strings are URIs. To change also DisambiguateTypes.* *)
-val term_of_uri: string -> Cic.term (** @raise UriManager.IllFormedUri *)
-val uri_of_term: Cic.term -> string (** @raise Invalid_argument "uri_of_term" *)
+val term_of_uri: UriManager.uri -> Cic.term (** @raise UriManager.IllFormedUri *)
+val uri_of_term: Cic.term -> UriManager.uri (** @raise Invalid_argument "uri_of_term" *)
(*
(** packing/unpacking of several terms into a single one *)
else
(fun () -> 0)
-let choice_of_uri uri =
- let term = CicUtil.term_of_uri uri in
- (uri, (fun _ _ _ -> term))
+let choice_of_uri suri =
+ let term = CicUtil.term_of_uri (UriManager.uri_of_string suri) in
+ (suri, (fun _ _ _ -> term))
let grammar = Grammar.gcreate cic_lexer
alias: [ (* return a pair <domain_item, codomain_item> from an alias *)
[ IDENT "alias";
choice =
- [ IDENT "id"; id = IDENT; SYMBOL "="; uri = URI ->
- (Id id, choice_of_uri uri)
+ [ IDENT "id"; id = IDENT; SYMBOL "="; suri = URI ->
+ (Id id, choice_of_uri suri)
| IDENT "symbol"; symbol = QSTRING;
PAREN "("; IDENT "instance"; instance = NUM; PAREN ")";
SYMBOL "="; dsc = QSTRING ->
let cic =
if is_uri ast then (* we have the URI, build the term out of it *)
try
- CicUtil.term_of_uri name
+ CicUtil.term_of_uri (UriManager.uri_of_string name)
with UriManager.IllFormedUri _ ->
CicTextualParser2.fail loc "Ill formed URI"
else
(UriManager.string_of_uri uri,
let term =
try
- CicUtil.term_of_uri (UriManager.string_of_uri uri)
+ CicUtil.term_of_uri uri
with exn ->
debug_print (UriManager.string_of_uri uri);
debug_print (Printexc.to_string exn);
struct
type cic_mask_t =
Blob
- | Uri of string
+ | Uri of UriManager.uri
| Appl of cic_mask_t list
let uri_of_term t = CicUtil.uri_of_term (Deannotate.deannotate_term t)
Hashtbl.hash mask, tl
let mask_of_appl_pattern = function
- | Pt.UriPattern s -> Uri s, []
+ | Pt.UriPattern s -> Uri (UriManager.uri_of_string s), []
| Pt.VarPattern _ -> Blob, []
| Pt.ApplPattern pl -> Appl (List.map (fun _ -> Blob) pl), pl
and lemma =
{ lemma_id: id;
lemma_name : string;
- lemma_uri: string
+ lemma_uri: string
}
;;
with Not_found ->
prerr_endline ("Not_found in arg2cic: premise " ^ (match prem.Con.premise_binder with None -> "previous" | Some p -> p) ^ ", xref=" ^ prem.Con.premise_xref);
raise Not_found))
- | Con.Lemma lemma -> CicUtil.term_of_uri lemma.Con.lemma_uri
+ | Con.Lemma lemma ->
+ CicUtil.term_of_uri (UriManager.uri_of_string lemma.Con.lemma_uri)
| Con.Term t -> deannotate t
| Con.ArgProof p -> proof2cic [] p (* empty! *)
| Con.ArgMethod s -> raise TO_DO
(* searches a coercion fron src to tgt in the !coercions list *)
let look_for_coercion src tgt =
try
- let src = UriManager.uri_of_string (CicUtil.uri_of_term src) in
- let tgt = UriManager.uri_of_string (CicUtil.uri_of_term tgt) in
+ let src = CicUtil.uri_of_term src in
+ let tgt = CicUtil.uri_of_term tgt in
let l =
CoercDb.find_coercion
(fun (s,t) -> UriManager.eq s src && UriManager.eq t tgt)
(UriManager.name_of_uri src)
(UriManager.name_of_uri tgt)
(UriManager.name_of_uri u));
- Some (CicUtil.term_of_uri (UriManager.string_of_uri u))
+ Some (CicUtil.term_of_uri u)
with Invalid_argument s ->
debug_print (":( coercion non trovata (fallita la uri_of_term): " ^ s);
None
match l with
| [] -> assert false
| he :: tl ->
- let term_of_uri' uri =
- CicUtil.term_of_uri (UriManager.string_of_uri uri)
- in
+ let term_of_uri' uri = CicUtil.term_of_uri uri in
let first_step =
Cic.Constant ("", Some (term_of_uri' he), Cic.Sort Cic.Prop, [],
obj_attrs)
(* debug_print ("STO APPLICANDO " ^ uri); *)
PET.apply_tactic
(PrimitiveTactics.apply_tac
- ~term:(CicUtil.term_of_uri (UriManager.string_of_uri uri)))
+ ~term:(CicUtil.term_of_uri uri))
status
in
let goal_list =
let close_with_types s metasenv context =
Constr.UriManagerSet.fold
(fun e bag ->
- let t = CicUtil.term_of_uri (UriManager.string_of_uri e) in
+ let t = CicUtil.term_of_uri e in
let ty, _ =
CicTypeChecker.type_of_aux' metasenv context t CicUniv.empty_ugraph
in
| Some (main,_) ->
let ty, _ =
CicTypeChecker.type_of_aux'
- metasenv context (CicUtil.term_of_uri (UriManager.string_of_uri main)) CicUniv.empty_ugraph
+ metasenv context (CicUtil.term_of_uri main) CicUniv.empty_ugraph
in
Constr.constants_of ty
in
let (subst,(proof, goal_list)) =
(* debug_print ("STO APPLICANDO" ^ uri); *)
PrimitiveTactics.apply_tac_verbose
- ~term:(CicUtil.term_of_uri (UriManager.string_of_uri uri))
+ ~term:(CicUtil.term_of_uri uri)
status
in
let goal_list =
let map inners row =
match row.(0), row.(1), row.(2) with
| Some source, Some inner, Some index ->
- source, List.mem (int_of_string index, inner) inners
+ source,
+ List.mem
+ (int_of_string index, (UriManager.uri_of_string inner)) inners
| _ -> "", false
in
let rec rank ranks (source, ok) =
| Some (outer, inners) ->
let select = "source, h_inner, h_index" in
let from = "genLemma" in
- let where = Printf.sprintf "h_outer = \"%s\"" (Mysql.escape outer) in
+ let where =
+ Printf.sprintf "h_outer = \"%s\""
+ (Mysql.escape (UriManager.string_of_uri outer)) in
let query = Printf.sprintf "SELECT %s FROM %s WHERE %s" select from where in
let result = Mysql.exec dbd query in
let lemmas = Mysql.map result ~f:(map inners) in