status)
;;
-let basic_eval_add_constraint (u1,u2) status =
- NCicLibrary.add_constraint status u1 u2
-;;
-
let inject_constraint =
let basic_eval_add_constraint (u1,u2)
~refresh_uri_in_universe ~refresh_uri_in_term ~refresh_uri_in_reference
if not alias_only then
let u1 = refresh_uri_in_universe u1 in
let u2 = refresh_uri_in_universe u2 in
- basic_eval_add_constraint (u1,u2) status
+ (* NCicLibrary.add_constraint adds the constraint to the NCicEnvironment
+ * and also to the storage (for undo/redo). During inclusion of compiled
+ * files the storage must not be touched. *)
+ NCicEnvironment.add_lt_constraint u1 u2;
+ status
else
status
in
;;
let eval_add_constraint status u1 u2 =
- let status = basic_eval_add_constraint (u1,u2) status in
+ let status = NCicLibrary.add_constraint status u1 u2 in
NCicLibrary.dump_obj status (inject_constraint (u1,u2))
;;
(*prerr_endline (NCicPp.ppobj obj);*)
let boxml = NCicElim.mk_elims obj in
let boxml = boxml @ NCicElim.mk_projections obj in
-(*
- let objs = [] in
- let timestamp,uris_rev =
- List.fold_left
- (fun (status,uris_rev) (uri,_,_,_,_) as obj ->
- let status = NCicLibrary.add_obj status obj in
- status,uri::uris_rev
- ) (status,[]) objs in
- let uris = uri::List.rev uris_rev in
-*)
let status = status#set_ng_mode `CommandMode in
let xxaliases = GrafiteDisambiguate.aliases_for_objs [uri] in
let mode = GrafiteAst.WithPreferences in (* MATITA 1.0: fixme *)
end
;;
+(* CSC: old code that performs recursive invalidation; to be removed
+ * once we understand what we really want. Once we removed it, we can
+ * also remove the !history
let invalidate_item item =
let item_eq a b =
match a, b with
| `Constr _ -> assert false
) to_be_deleted
;;
+*)
+
+let invalidate_item =
+ function
+ `Obj (uri,_) -> NUri.UriHash.remove cache uri
+ | `Constr ([_,u1],[_,u2]) ->
+ let w = u1,u2 in
+ lt_constraints := List.filter ((<>) w) !lt_constraints;
+ | `Constr _ -> assert false
+;;
exception Propagate of NUri.uri * exn;;
let saved_frozen_list = !frozen_list in
try
frozen_list := (u,obj)::saved_frozen_list;
+ HLog.warn ("Typechecking of " ^ NUri.string_of_uri u);
!typecheck_obj obj;
frozen_list := saved_frozen_list;
let obj' = `WellTyped obj in
NReference.reference ->
NCic.inductiveFun list * NCic.f_attr * int
-(* invalidate the object and all those that entered the environment after it *)
val invalidate_item:
[ `Obj of NUri.uri * NCic.obj
| `Constr of NCic.universe * NCic.universe ] -> unit
let diff_len = List.length !storage - List.length sto in
let to_be_deleted,_ = HExtlib.split_nth diff_len !storage in
if List.length to_be_deleted > 0 then
- NCicEnvironment.invalidate_item (HExtlib.list_last to_be_deleted);
+ List.iter NCicEnvironment.invalidate_item to_be_deleted;
storage := sto; local_aliases := ali
;;
;;
let add_constraint status u1 u2 =
+ if
+ List.exists
+ (function `Constr (u1',u2') when u1=u1' && u2=u2' -> true | _ -> false)
+ !storage
+ then
+ (*CSC: raise an exception here! *)
+ (prerr_endline "CANNOT ADD A CONSTRAINT TWICE"; assert false);
NCicEnvironment.add_lt_constraint u1 u2;
storage := (`Constr (u1,u2)) :: !storage;
status#set_timestamp (!storage,!local_aliases)