exception ObjectNotFound of string Lazy.t;;
exception BadDependency of string Lazy.t * exn;;
exception BadConstraint of string Lazy.t;;
+exception AlreadyDefined of string Lazy.t;;
let cache = NUri.UriHash.create 313;;
let history = ref [];;
let universes = ref [];;
+let get_universes () = List.map (fun x -> [false,x]) !universes;;
+
let add_constraint strict a b =
match a,b with
| [false,a2],[false,b2] ->
let get_checked_obj u = to_exn get_checked_obj u;;
-let check_and_add_obj obj = ignore (to_exn check_and_add_obj obj);;
+let check_and_add_obj ((u,_,_,_,_) as obj) =
+ if NUri.UriHash.mem cache u then
+ raise (AlreadyDefined (lazy (NUri.string_of_uri u)))
+ else
+ ignore (to_exn check_and_add_obj obj)
+;;
let get_checked_decl = function
| Ref.Ref (uri, Ref.Decl) ->
exception ObjectNotFound of string Lazy.t;;
exception BadDependency of string Lazy.t * exn;;
exception BadConstraint of string Lazy.t;;
+exception AlreadyDefined of string Lazy.t;;
val set_get_obj: (NUri.uri -> NCic.obj) -> unit
val get_relevance: NReference.reference -> bool list
val type0: NCic.universe
+val get_universes: unit -> NCic.universe list
val max: NCic.universe -> NCic.universe -> NCic.universe
(* universe_* raise BadConstraints if the second arg. is an inferred universe *)
val universe_eq: NCic.universe -> NCic.universe -> bool