rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
matita matita.opt matitac matitac.opt \
cicbrowser cicbrowser.opt \
- matitadep matitadep.opt
+ matitadep matitadep.opt \
+ matitaclean matitaclean.opt
distclean: clean
rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
rm -f config.log config.status Makefile buildTimeConf.ml
--- /dev/null
+TODO=\
+ tests/apply.moo\
+ tests/auto.moo\
+ tests/baseuri.moo\
+ tests/coercions.moo\
+ tests/comments.moo\
+ tests/fguidi.moo\
+ tests/first.moo\
+ tests/fix_betareduction.moo\
+ tests/inversion.moo\
+ tests/letrec.moo\
+ tests/match.moo\
+ tests/match_inference.moo\
+ tests/mysql_escaping.moo\
+ tests/record.moo\
+ tests/replace.moo\
+ tests/rewrite.moo\
+ tests/second.moo\
+ tests/simpl.moo\
+ tests/test2.moo\
+ tests/test3.moo\
+ tests/test4.moo\
+ tests/third.moo
+
+DEPEND_NAME=.depend.moo
+
+all: $(TODO)
+
+clean:
+ rm -f $(DEPEND_NAME) $(TODO)
+ ./matitaclean all
+
+%.moo:%.ma
+ [ ! -e $@ ] || ./matitaclean $<
+ ./matitac $< || ./matitaclean $<
+
+$(DEPEND_NAME): $(TODO:%.moo=%.ma)
+ ./matitadep $^ > $@
+
+include $(DEPEND_NAME)
<keyword>coinductive</keyword>
<keyword>corec</keyword>
<keyword>in</keyword>
+ <keyword>on</keyword>
<keyword>inductive</keyword>
<keyword>let</keyword>
<keyword>match</keyword>
with
exn -> raise exn (* no errors should be accepted *)
+let xpointers_of_ind uri =
+ let dbd = instance () in
+ let name_tbl = MetadataTypes.name_tbl () in
+ let query = sprintf
+ "SELECT source FROM %s WHERE source LIKE '%s#xpointer%%'" name_tbl
+ (Mysql.escape (UriManager.string_of_uri uri))
+ in
+ let rc = Mysql.exec dbd query in
+ let l = ref [] in
+ Mysql.iter rc (fun a -> match a.(0) with None ->()|Some a -> l := a:: !l);
+ List.map UriManager.uri_of_string !l
val create_owner_environment : unit -> unit
val remove_uri: UriManager.uri -> string list
+val xpointers_of_ind: UriManager.uri -> UriManager.uri list
status.aliases Map.empty
let remove uri =
- let path = Http_getter.resolve' uri in
- remove_object_from_disk uri path;
- remove_coercion uri;
- ignore(MatitaDb.remove_uri uri)
+ let derived_uris_of_uri uri =
+ UriManager.innertypesuri_of_uri uri ::
+ UriManager.annuri_of_uri uri ::
+ (match UriManager.bodyuri_of_uri uri with
+ | None -> []
+ | Some u -> [u])
+ in
+ let to_remove =
+ uri ::
+ (if UriManager.uri_is_ind uri then MatitaDb.xpointers_of_ind uri else []) @
+ derived_uris_of_uri uri
+ in
+ List.iter
+ (fun uri ->
+ (try
+ let path =
+ let path = Http_getter.resolve' (UriManager.strip_xpointer uri) in
+ assert (String.sub path 0 7 = "file://");
+ String.sub path 7 (String.length path - 7)
+ in
+ remove_object_from_disk uri path;
+ with
+ Http_getter_types.Key_not_found _ -> Http_getter.unregister' uri);
+ remove_coercion uri;
+ ignore(MatitaDb.remove_uri uri))
+ to_remove
+
val alias_diff: from:MatitaTypes.status -> MatitaTypes.status ->
DisambiguateTypes.environment
- (* removes the object from DB, Disk, CoercionsDB *)
+ (* removes the object from DB, Disk, CoercionsDB, getter
+ * asserts the uri is resolved to file:// so it is only for
+ * user's objects *)
val remove: UriManager.uri -> unit
Helm_registry.load_from "matita.conf.xml";
Http_getter.init ();
MetadataTypes.ownerize_tables (Helm_registry.get "matita.owner");
+(*
MatitaDb.clean_owner_environment ();
MatitaDb.create_owner_environment ();
+*)
status := Some (ref (Lazy.force MatitaEngine.initial_status));
at_exit
(fun () ->
module HGT = Http_getter_types;;
module HG = Http_getter;;
module UM = UriManager;;
+module TA = TacticAst;;
let _ =
Helm_registry.load_from "matita.conf.xml";
exit 0
let dbd = MatitaDb.instance ()
+let cache_of_processed_baseuri = Hashtbl.create 1024
let one_step_depend suri =
- let dbg_q =
- let suri = Mysql.escape suri in
- (**** FIX FIX FIX ***)
- (****** let obj_tbl = MetadataTypes.obj_tbl () in ******)
- let obj_tbl = MetadataTypes.library_obj_tbl in
- (**** FIX FIX FIX ***)
- Printf.sprintf
- "SELECT source FROM %s WHERE h_occurrence LIKE '%s%%'" obj_tbl suri
+ let buri =
+ try
+ UM.buri_of_uri (UM.uri_of_string suri)
+ with UM.IllFormedUri _ -> suri
in
- try
- let rc = Mysql.exec dbd dbg_q in
- let l = ref [] in
- Mysql.iter rc (fun a -> match a.(0) with None ->()|Some a -> l := a:: !l);
- let l = List.sort Pervasives.compare !l in
- MatitaMisc.list_uniq l
- with
- exn -> raise exn (* no errors should be accepted *)
+ if Hashtbl.mem cache_of_processed_baseuri buri then
+ []
+ else
+ begin
+ Hashtbl.add cache_of_processed_baseuri buri true;
+ let query =
+ let buri = buri ^ "/" in
+ let buri = Mysql.escape buri in
+ let obj_tbl = MetadataTypes.obj_tbl () in
+ Printf.sprintf
+ "SELECT source FROM %s WHERE h_occurrence LIKE '%s%%'" obj_tbl buri
+ in
+ try
+ let rc = Mysql.exec dbd query in
+ let l = ref [] in
+ Mysql.iter rc (fun a -> match a.(0) with None ->()|Some a -> l:=a:: !l);
+ let l = List.sort Pervasives.compare !l in
+ MatitaMisc.list_uniq l
+ with
+ exn -> raise exn (* no errors should be accepted *)
+ end
-let cache_of_processed_baseuri = Hashtbl.create 1024
+let safe_buri_of_suri suri =
+ try
+ UM.buri_of_uri (UM.uri_of_string suri)
+ with
+ UM.IllFormedUri _ -> suri
+
let close_uri_list uri_to_remove =
(* to remove an uri you have to remove the whole script *)
let buri_to_remove =
MatitaMisc.list_uniq
(List.fast_sort Pervasives.compare
- (List.map UM.buri_of_uri uri_to_remove))
+ (List.map safe_buri_of_suri uri_to_remove))
in
(* cleand the already visided baseuris *)
let buri_to_remove =
else true)
buri_to_remove
in
- List.iter
- (fun buri -> Hashtbl.add cache_of_processed_baseuri buri true)
- buri_to_remove;
(* now calculate the list of objects that belong to these baseuris *)
let uri_to_remove =
List.fold_left
in
let inhabitants = List.map
(function
- | HGT.Ls_object e -> UM.uri_of_string (buri ^ "/" ^ e.HGT.uri)
+ | HGT.Ls_object e -> buri ^ "/" ^ e.HGT.uri
| _ -> assert false)
inhabitants
in
(* now we want the list of all uri that depend on them *)
let depend =
List.fold_left
- (fun acc u -> one_step_depend (UM.string_of_uri u) @ acc) [] uri_to_remove
+ (fun acc u -> one_step_depend u @ acc) [] uri_to_remove
in
let depend =
MatitaMisc.list_uniq
(List.fast_sort Pervasives.compare depend)
in
- let depend = List.map UM.uri_of_string depend in
uri_to_remove, depend
+let buri_of_file file =
+ let ic = open_in file in
+ let stms = CicTextualParser2.parse_statements (Stream.of_channel ic) in
+ close_in ic;
+ let uri = ref "" in
+ List.iter
+ (function
+ | TA.Executable (_, TA.Command (_, TA.Set (_, "baseuri", buri))) ->
+ uri := MatitaMisc.strip_trailing_slash buri
+ | _ -> ())
+ stms;
+ !uri
+
let main uri_to_remove =
let rec fix uris next =
match next with
prerr_endline "";
prerr_endline "usage:";
prerr_endline "\tmatitaclean all";
- prerr_endline "\tmatitaclean dry uris...";
- prerr_endline "\tmatitaclean uris...";
+ prerr_endline "\tmatitaclean dry (uri|file)+";
+ prerr_endline "\tmatitaclean (uri|file)+";
prerr_endline "";
exit 1
if Sys.argv.(1) = "dry" then 2, true else 1, false
in
let uri_to_remove =ref [] in
- try
+ (try
for i = start to Array.length Sys.argv - 1 do
let suri = Sys.argv.(i) in
- let uri = UM.uri_of_string suri in
+ let uri =
+ try
+ UM.buri_of_uri (UM.uri_of_string suri)
+ with
+ UM.IllFormedUri _ -> buri_of_file suri
+ in
uri_to_remove := uri :: !uri_to_remove
done
with
- Invalid_argument _ -> usage ();
+ Invalid_argument _ -> usage ());
let l = main !uri_to_remove in
if dry then
begin
- List.iter (fun x -> let u = UM.string_of_uri x in prerr_endline u) l;
+ List.iter prerr_endline l;
exit 0
end
else
List.iter
(fun u ->
- prerr_endline ("Removing " ^ UM.string_of_uri u);
- MatitaSync.remove u)
+ prerr_endline ("Removing " ^ u);
+ try
+ MatitaSync.remove (UM.uri_of_string u)
+ with Sys_error _ -> ())
l
for i = 1 to Array.length Sys.argv - 1 do
let file = Sys.argv.(i) in
let ic = open_in file in
- let stms = CicTextualParser2.parse_statements (Stream.of_channel ic) in
- close_in ic;
- let stms =
- List.iter
- (function
- | TA.Executable (_, TA.Command (_, TA.Set (_, "baseuri", uri))) ->
- let uri = MatitaMisc.strip_trailing_slash uri in
- baseuri := (uri, file) :: !baseuri
- | TA.Executable (_, TA.Command
- (_, TA.Alias (_, TA.Ident_alias(_, uri)))) ->
- Hashtbl.add aliases file uri
- | _ -> ())
- stms
+ let stms =
+ try
+ CicTextualParser2.parse_statements (Stream.of_channel ic)
+ with
+ (CicTextualParser2.Parse_error _) as exc ->
+ prerr_endline ("Unable to parse: " ^ file);
+ prerr_endline (MatitaExcPp.to_string exc);
+ exit 1
in
+ close_in ic;
+ List.iter
+ (function
+ | TA.Executable (_, TA.Command (_, TA.Set (_, "baseuri", uri))) ->
+ let uri = MatitaMisc.strip_trailing_slash uri in
+ baseuri := (uri, file) :: !baseuri
+ | TA.Executable (_, TA.Command
+ (_, TA.Alias (_, TA.Ident_alias(_, uri)))) ->
+ Hashtbl.add aliases file uri
+ | _ -> ())
+ stms;
Hashtbl.iter
(fun file alias ->
let dep = resolve alias in
(* test _with_ the WHD on the apply argument *)
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/apply/".
alias id "not" = "cic:/Coq/Init/Logic/not.con".
alias id "False" = "cic:/Coq/Init/Logic/False.ind#xpointer(1/1)".
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/auto/".
alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)".
alias id "S" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)".
-set "baseuri" "cic:/matita/tests/".
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/baseuri/".
+set "baseuri" "cic:/matita/tests/baseuri/".
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/coercions/".
inductive pos: Set \def
| one : pos
(* *)
(****************************************************************************)
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/comments/".
(* commento che va nell'ast, ma non viene contato
come step perche' non e' un executable
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/fguidi/".
alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)".
alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)".
--- /dev/null
+set "baseuri" "cic:/matita/tests/first/".
+
+inductive nat : Set \def
+ | O : nat
+ | S : nat \to nat.
+
+inductive eq (A:Set): A \to A \to Prop \def
+ refl: \forall x:A.eq A x x.
+
+inductive list (A:Set) : Set \def
+ | nil : list A
+ | cons : A \to list A \to list A.
+alias symbol "cast" (instance 0) = "type cast".
+
+let rec list_len (A:Set) (l:list A) on l \def
+ [\lambda x.nat]
+ match (l:list A) with
+ [ nil \Rightarrow O
+ | (cons a tl) \Rightarrow S (list_len A tl)].
+
+theorem stupid: \forall A:Set.eq ? (list_len A (nil ?)) O.
+intros.
+normalize.
+apply refl.
+qed.
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/fix_betareduction/".
alias id "eq" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1)".
alias id "n" = "cic:/Suresnes/BDD/canonicite/Canonicity_BDT/n.con".
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/inversion/".
inductive nat : Set \def
O : nat
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/letrec/".
alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)".
(* *)
(**************************************************************************)
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/match/".
inductive True: Prop \def
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/match_inference/".
inductive pos: Set \def
| one : pos
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/mysql_escaping/".
theorem a' : Prop \to Prop.intros.assumption.qed.
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/record/".
record empty : Type \def {}.
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/rewrite/".
alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)".
alias num (instance 0) = "natural number".
--- /dev/null
+set "baseuri" "cic:/matita/tests/second/".
+alias id "nat" = "cic:/matita/tests/first/nat.ind#xpointer(1/1)".
+alias id "O" = "cic:/matita/tests/first/nat.ind#xpointer(1/1/1)".
+alias id "eq" = "cic:/matita/tests/first/eq.ind#xpointer(1/1)".
+alias id "refl" = "cic:/matita/tests/first/eq.ind#xpointer(1/1/1)".
+
+theorem ultrastupid : eq nat O O.
+apply refl.
+qed.
+
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/simpl/".
alias id "not" = "cic:/Coq/Init/Logic/not.con".
alias symbol "eq" (instance 0) = "leibnitz's equality".
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/test2/".
alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)".
alias symbol "and" (instance 0) = "logical and".
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/test3/".
alias symbol "eq" (instance 0) = "leibnitz's equality".
theorem a:\forall x.x=x.
-set "baseuri" "cic:/matita/tests/".
+set "baseuri" "cic:/matita/tests/test4/".
(* commento che va nell'ast, ma non viene contato
--- /dev/null
+set "baseuri" "cic:/matita/tests/third/".
+alias id "nat" = "cic:/matita/tests/first/nat.ind#xpointer(1/1)".
+alias id "O" = "cic:/matita/tests/first/nat.ind#xpointer(1/1/1)".
+alias id "eq" = "cic:/matita/tests/first/eq.ind#xpointer(1/1)".
+alias id "ultrastupid" = "cic:/matita/tests/second/ultrastupid.con".
+
+theorem iperstupid : eq nat O O.
+exact ultrastupid.
+qed.
+