1 let cache = NUri.UriHash.create 313;;
3 let get_checked_obj u =
4 try NUri.UriHash.find cache u
6 let ouri = NUri.ouri_of_nuri u in
8 CicEnvironment.get_cooked_obj ~trust:false CicUniv.oblivion_ugraph
10 (* FIX: add all objects to the environment and give back the last one *)
11 let no = HExtlib.list_last (OCic2NCic.convert_obj ouri o) in
12 NUri.UriHash.add cache u no;
16 let get_checked_def = function
17 | NReference.Ref (_, uri, NReference.Def) ->
18 (match get_checked_obj uri with
19 | _,height,_,_, NCic.Constant (rlv,name,Some bo,ty,att) ->
20 rlv,name,bo,ty,att,height
21 | _,_,_,_, NCic.Constant (_,_,None,_,_) ->
22 prerr_endline "get_checked_def on an axiom"; assert false
23 | _ -> prerr_endline "get_checked_def on a non def 2"; assert false)
24 | _ -> prerr_endline "get_checked_def on a non def"; assert false
27 let get_checked_indtys = function
28 | NReference.Ref (_, uri, NReference.Ind n) ->
29 (match get_checked_obj uri with
30 | _,_,_,_, NCic.Inductive (inductive,leftno,tys,att) ->
31 inductive,leftno,tys,att,n
32 | _ -> prerr_endline "get_checked_indtys on a non ind 2"; assert false)
33 | _ -> prerr_endline "get_checked_indtys on a non ind"; assert false
36 let get_checked_fix_or_cofix b = function
37 | NReference.Ref (_, uri, NReference.Fix (fixno,_)) ->
38 (match get_checked_obj uri with
39 | _,height,_,_, NCic.Fixpoint (is_fix,funcs,att) when is_fix = b ->
40 let rlv, name, _, ty, bo = List.nth funcs fixno in
41 rlv, name, bo, ty, att, height
42 | _ ->prerr_endline "get_checked_(co)fix on a non (co)fix 2";assert false)
43 | _ -> prerr_endline "get_checked_(co)fix on a non (co)fix"; assert false
45 let get_checked_fix r = get_checked_fix_or_cofix true r;;
46 let get_checked_cofix r = get_checked_fix_or_cofix false r;;
48 let get_indty_leftno = function
49 | NReference.Ref (_, uri, NReference.Ind _)
50 | NReference.Ref (_, uri, NReference.Con _) ->
51 (match get_checked_obj uri with
52 | _,_,_,_, NCic.Inductive (_,left,_,_) -> left
53 | _ ->prerr_endline "get_indty_leftno called on a non ind 2";assert false)
54 | _ -> prerr_endline "get_indty_leftno called on a non indty";assert false