- (match status.GrafiteTypes.ng_status with
- | GrafiteTypes.ProofMode estatus ->
- let uri,height,menv,subst,obj_kind = estatus#obj in
- if menv <> [] then
- raise
- (GrafiteTypes.Command_error"You can't Qed an incomplete theorem")
- else
- let obj_kind =
- NCicUntrusted.map_obj_kind
- (NCicUntrusted.apply_subst subst []) obj_kind in
- let height = NCicTypeChecker.height_of_obj_kind uri obj_kind in
- (* fix the height inside the object *)
- let rec fix () = function
- | NCic.Const (NReference.Ref (u,spec)) when NUri.eq u uri ->
- NCic.Const (NReference.reference_of_spec u
- (match spec with
- | NReference.Def _ -> NReference.Def height
- | NReference.Fix (i,j,_) -> NReference.Fix(i,j,height)
- | NReference.CoFix _ -> NReference.CoFix height
- | NReference.Ind _ | NReference.Con _
- | NReference.Decl as s -> s))
- | t -> NCicUtils.map (fun _ () -> ()) () fix t
- in
- let obj_kind =
- match obj_kind with
- | NCic.Fixpoint _ ->
- NCicUntrusted.map_obj_kind (fix ()) obj_kind
- | _ -> obj_kind
- in
- let obj = uri,height,[],[],obj_kind in
- NCicTypeChecker.typecheck_obj obj;
- let estatus = NCicLibrary.add_obj estatus uri obj in
- let objs = NCicElim.mk_elims obj in
- let timestamp,uris_rev =
- List.fold_left
- (fun (estatus,uris_rev) (uri,_,_,_,_) as obj ->
- NCicTypeChecker.typecheck_obj obj;
- let estatus = NCicLibrary.add_obj estatus uri obj in
- estatus,uri::uris_rev
- ) (estatus,[]) objs in
- let uris = uri::List.rev uris_rev in
- {status with
- GrafiteTypes.ng_status =
- GrafiteTypes.CommandMode (estatus :> NEstatus.status)},`New uris
- | _ -> raise (GrafiteTypes.Command_error "Not in proof mode"))
+ if status#ng_mode <> `ProofMode then
+ raise (GrafiteTypes.Command_error "Not in proof mode")
+ else
+ let uri,height,menv,subst,obj_kind = status#obj in
+ if menv <> [] then
+ raise
+ (GrafiteTypes.Command_error"You can't Qed an incomplete theorem")
+ else
+ let obj_kind =
+ NCicUntrusted.map_obj_kind
+ (NCicUntrusted.apply_subst subst []) obj_kind in
+ let height = NCicTypeChecker.height_of_obj_kind uri obj_kind in
+ (* fix the height inside the object *)
+ let rec fix () = function
+ | NCic.Const (NReference.Ref (u,spec)) when NUri.eq u uri ->
+ NCic.Const (NReference.reference_of_spec u
+ (match spec with
+ | NReference.Def _ -> NReference.Def height
+ | NReference.Fix (i,j,_) -> NReference.Fix(i,j,height)
+ | NReference.CoFix _ -> NReference.CoFix height
+ | NReference.Ind _ | NReference.Con _
+ | NReference.Decl as s -> s))
+ | t -> NCicUtils.map (fun _ () -> ()) () fix t
+ in
+ let obj_kind =
+ match obj_kind with
+ | NCic.Fixpoint _ ->
+ NCicUntrusted.map_obj_kind (fix ()) obj_kind
+ | _ -> obj_kind
+ in
+ let obj = uri,height,[],[],obj_kind in
+ let status = NCicLibrary.add_obj status obj in
+ let objs = NCicElim.mk_elims obj 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
+ status#set_ng_mode `CommandMode,`New uris