(* argument parsing *)
   let depth = int "depth" params in
   let width = int "width" params in
+  let timeout = string "timeout" params in
   let paramodulation = bool "paramodulation" params in
   let full = bool "full" params in
   let superposition = bool "superposition" params in
   let subterms_only = bool "subterms_only" params in
   let caso_strano = bool "caso_strano" params in
   let demod_table = string "demod_table" params in
+  let timeout = 
+    try Some (float_of_string timeout) with Failure _ -> None
+  in
   (* the real tactic *)
   let auto_tac dbd (proof, goal) =
     let normal_auto () = 
       debug_print (lazy "USO PARAMODULATION...");
 (*       try *)
       try
-        let rc = Saturation.saturate caso_strano dbd ~depth ~width ~full (proof, goal) in
+        let rc = Saturation.saturate caso_strano dbd ~depth ~width ~full
+        ?timeout (proof, goal) in
         prerr_endline (Saturation.get_stats ());
         rc
       with exn ->
 
 
 let saturate 
     caso_strano 
-    dbd ?(full=false) ?(depth=default_depth) ?(width=default_width) status = 
+    dbd ?(full=false) ?(depth=default_depth) ?(width=default_width) 
+    ?(timeout=600.) status = 
   let module C = Cic in
   reset_refs ();
   Indexing.init_index ();
 *)
       let goals = make_goal_set goal in
       let max_iterations = 10000 in
-      let max_time = Unix.gettimeofday () +.  600. (* minutes *) in
+      let max_time = Unix.gettimeofday () +.  timeout (* minutes *) in
       given_clause 
         eq_uri env goals theorems passive active max_iterations max_time 
     in
 
   ?full:bool ->
   ?depth:int ->
   ?width:int ->
+  ?timeout:float ->
   ProofEngineTypes.proof * ProofEngineTypes.goal ->
   ProofEngineTypes.proof * ProofEngineTypes.goal list
 
 
 module A = Ast;;
 let floc = HExtlib.dummy_floc;;
 
+let paramod_timeout = ref 600;;
+
 let universe = "Univ" ;;
 
 let kw = [
                 fv)) 
            else [])@
             [GA.Executable(floc,GA.Tactical(floc, GA.Tactic(floc,
-            GA.Auto (floc,["paramodulation",""])),
+            GA.Auto (floc,["paramodulation","";"timeout",string_of_int !paramod_timeout])),
               Some (GA.Dot(floc))));
             GA.Executable(floc,GA.Tactical(floc, GA.Try(floc,
               GA.Tactic (floc, GA.Assumption floc)), Some (GA.Dot(floc))))
 ;;
 
 (* MAIN *)
-let tptp2grafite ?raw_preamble ~tptppath ~filename () =
+let tptp2grafite ?(timeout=600) ?raw_preamble ~tptppath ~filename () =
+  paramod_timeout := timeout;
   let rec aux = function
     | [] -> []
     | ((A.Inclusion (file,_)) as hd) :: tl ->
 
  *)
 
 val tptp2grafite: 
+  ?timeout:int ->
   ?raw_preamble:(string -> string) -> 
   tptppath:string -> filename:string -> unit -> 
     string 
 
             Helm_registry.get_opt_default Helm_registry.string ~default:"./"
               "matita.tptppath"
           in
-          let data = Matitaprover.p_to_ma ~filename:file ~tptppath in
+          let data = Matitaprover.p_to_ma ~filename:file ~tptppath () in
           let filename = Pcre.replace ~pat:"\\.p$" ~templ:".ma" file in
           script#assignFileName filename;
           source_view#source_buffer#begin_not_undoable_action ();
 
 (* $Id$ *)
 
 let main () =
-  match Filename.basename Sys.argv.(0) with
-  | "gragrep"     | "gragrep.opt"   -> Gragrep.main ()
-  | "matitadep"   | "matitadep.opt"   -> Matitadep.main ()
-  | "matitaclean" | "matitaclean.opt" -> Matitaclean.main ()
-  | "matitamake"  | "matitamake.opt"  -> Matitamake.main ()
-  | "matitaprover"  | "matitaprover.opt"  -> Matitaprover.main ()
-  | _ ->
+ match Filename.basename Sys.argv.(0) with
+ |"gragrep"    |"gragrep.opt"    |"gragrep.opt.static"    ->Gragrep.main()
+ |"matitadep"  |"matitadep.opt"  |"matitadep.opt.static"  ->Matitadep.main()
+ |"matitaclean"|"matitaclean.opt"|"matitaclean.opt.static"->Matitaclean.main()
+ |"matitamake" |"matitamake.opt" |"matitamake.opt.static" ->Matitamake.main()
+ |"matitaprover"|"matitaprover.opt"
+ |"matitaprover.opt.static"->Matitaprover.main()
+ | _ ->
 (*
       let _ = Paramodulation.Saturation.init () in  *)
 (* ALB to link paramodulation *)
 
 "
 ;;
 
-let p_to_ma ~tptppath ~filename = 
+let p_to_ma ?timeout ~tptppath ~filename () = 
   let data = 
-     Tptp2grafite.tptp2grafite ~filename ~tptppath:tptppath
+     Tptp2grafite.tptp2grafite ?timeout ~filename ~tptppath:tptppath
      ~raw_preamble ()
   in
   data
 let main () =
   MatitaInit.fill_registry ();
   let tptppath = ref "./" in
+  let timeout = ref 600 in
   MatitaInit.add_cmdline_spec
     ["-tptppath",Arg.String (fun s -> tptppath:= s),
-      "Where to find the Axioms/ and Problems/ directory"];
+       "Where to find the Axioms/ and Problems/ directory";
+     "-timeout", Arg.Int (fun x -> timeout := x),
+       "Timeout in seconds"];
   MatitaInit.parse_cmdline ();
   MatitaInit.load_configuration_file ();
   Helm_registry.set_bool "db.nodb" true;
     | [file] -> file
     | _ -> prerr_endline "You must specify exactly one .p file."; exit 1
   in
-  let data = p_to_ma ~filename:inputfile ~tptppath:!tptppath in
+  let data = 
+    p_to_ma ~timeout:!timeout ~filename:inputfile ~tptppath:!tptppath ()
+  in
 (*   prerr_endline data; *)
   let is = Ulexing.from_utf8_string data in
   let gs = GrafiteSync.init () in
 
 
 val main: unit -> unit
 
-val p_to_ma: tptppath:string -> filename:string -> string
+val p_to_ma: ?timeout:int -> tptppath:string -> filename:string -> unit -> string