- MatitaLog.message (sprintf "%s constant defined" suri);
- { status with objects = new_stuff @ status.objects }
- end
-
-let split_obj = function
- | Cic.Constant (name, body, ty, _, attrs)
- | Cic.Variable (name, body, ty, _, attrs) -> (name, body, ty, attrs)
- | _ -> assert false
-
-let add_inductive_def
- ~uri ~types ?(params = []) ?(leftno = 0) ?(attrs = []) ~ugraph status
-=
- let dbd = MatitaDb.instance () in
- let suri = UriManager.string_of_uri uri in
- if CicEnvironment.in_library uri then
- command_error (sprintf "%s inductive type already defined" suri)
- else begin
- let name = UriManager.name_of_uri uri in
- let obj = Cic.InductiveDefinition (types, params, leftno, attrs) in
- let ugraph = CicUnivUtils.clean_and_fill uri obj ugraph in
- CicEnvironment.put_inductive_definition uri (obj, ugraph);
- MetadataDb.index_obj ~dbd ~uri; (* must be in the env *)
- let new_stuff = save_object_to_disk status uri obj in
- MatitaLog.message (sprintf "%s inductive type defined" suri);
- let status = { status with objects = new_stuff @ status.objects } in
- let elim sort status =
- try
- let obj = CicElim.elim_of ~sort uri 0 in
- let (name, body, ty, attrs) = split_obj obj in
- let suri = MatitaMisc.qualify status name ^ ".con" in
- let uri = UriManager.uri_of_string suri in
- (* TODO Zack: make CicElim returns a universe *)
- let ugraph = CicUniv.empty_ugraph in
- add_constant ~uri ?body ~ty ~attrs ~ugraph status;
- with CicElim.Can_t_eliminate -> status
- in
- List.fold_left
- (fun status sort -> elim sort status)
- status
- [ Cic.Prop; Cic.Set; (Cic.Type (CicUniv.fresh ())) ];