src/HOL/Tools/ATP/watcher.ML
author paulson
Fri, 02 Sep 2005 15:25:44 +0200
changeset 17231 f42bc4f7afdf
parent 17216 df66d8feec63
child 17234 12a9393c5d77
permissions -rw-r--r--
tidying up the Isabelle/ATP interface
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15789
4cb16144c81b added hearder lines and deleted some redundant material
paulson
parents: 15787
diff changeset
     1
(*  Title:      Watcher.ML
4cb16144c81b added hearder lines and deleted some redundant material
paulson
parents: 15787
diff changeset
     2
    ID:         $Id$
4cb16144c81b added hearder lines and deleted some redundant material
paulson
parents: 15787
diff changeset
     3
    Author:     Claire Quigley
4cb16144c81b added hearder lines and deleted some redundant material
paulson
parents: 15787
diff changeset
     4
    Copyright   2004  University of Cambridge
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
     5
 *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
     6
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
     7
 (***************************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
     8
 (*  The watcher process starts a resolution process when it receives a     *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
     9
(*  message from Isabelle                                                  *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    10
(*  Signals Isabelle, puts output of child into pipe to Isabelle,          *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    11
(*  and removes dead processes.  Also possible to kill all the resolution  *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    12
(*  processes currently running.                                           *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    13
(*  Hardwired version of where to pick up the tptp files for the moment    *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    14
(***************************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    15
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    16
(*use "Proof_Transfer";
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    17
use "VampireCommunication";
16089
9169bdf930f8 trying to set up portable calling sequences for SPASS and tptp2X
paulson
parents: 16061
diff changeset
    18
use "SpassCommunication";*)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    19
(*use "/homes/clq20/Jia_Code/TransStartIsar";*)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    20
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    21
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    22
structure Watcher: WATCHER =
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    23
  struct
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    24
16805
fadf80952202 open ReconPrelim Recon_Transfer;
wenzelm
parents: 16767
diff changeset
    25
open ReconPrelim Recon_Transfer
fadf80952202 open ReconPrelim Recon_Transfer;
wenzelm
parents: 16767
diff changeset
    26
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    27
val goals_being_watched = ref 0;
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    28
16039
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    29
(*****************************************)
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    30
(*  The result of calling createWatcher  *)
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    31
(*****************************************)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
    32
16039
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    33
datatype proc = PROC of {
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    34
        pid : Posix.Process.pid,
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    35
        instr : TextIO.instream,
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    36
        outstr : TextIO.outstream
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    37
      };
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    38
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    39
(*****************************************)
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    40
(*  The result of calling executeToList  *)
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    41
(*****************************************)
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    42
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    43
datatype cmdproc = CMDPROC of {
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    44
        prover: string,             (* Name of the resolution prover used, e.g. Vampire, SPASS *)
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    45
        cmd:  string,              (* The file containing the goal for res prover to prove *)     
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    46
        thmstring: string,         (* string representation of subgoal after negation, skolemization*) 
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    47
        goalstring: string,         (* string representation of subgoal*) 
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    48
        proc_handle : (TextIO.instream,TextIO.outstream) Unix.proc,
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    49
        instr : TextIO.instream,   (*  Input stream to child process *)
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    50
        outstr : TextIO.outstream  (*  Output stream from child process *)
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    51
      };
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    52
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    53
type signal = Posix.Signal.signal
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    54
datatype exit_status = datatype Posix.Process.exit_status
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    55
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    56
val fromStatus = Posix.Process.fromStatus
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    57
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    58
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    59
fun reap(pid, instr, outstr) =
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    60
        let
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    61
		val u = TextIO.closeIn instr;
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    62
	        val u = TextIO.closeOut outstr;
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    63
	
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    64
		val (_, status) =
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    65
			Posix.Process.waitpid(Posix.Process.W_CHILD pid, [])
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    66
	in
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    67
		status
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    68
	end
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    69
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    70
fun fdReader (name : string, fd : Posix.IO.file_desc) =
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    71
	  Posix.IO.mkTextReader {initBlkMode = true,name = name,fd = fd };
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    72
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    73
fun fdWriter (name, fd) =
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    74
          Posix.IO.mkTextWriter {
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    75
	      appendMode = false,
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    76
              initBlkMode = true,
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    77
              name = name,  
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    78
              chunkSize=4096,
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    79
              fd = fd
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    80
            };
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    81
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    82
fun openOutFD (name, fd) =
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    83
	  TextIO.mkOutstream (
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    84
	    TextIO.StreamIO.mkOutstream (
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    85
	      fdWriter (name, fd), IO.BLOCK_BUF));
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    86
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    87
fun openInFD (name, fd) =
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    88
	  TextIO.mkInstream (
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    89
	    TextIO.StreamIO.mkInstream (
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    90
	      fdReader (name, fd), ""));
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    91
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    92
fun killChild child_handle = Unix.reap child_handle 
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    93
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    94
fun childInfo (PROC{pid,instr,outstr }) = (pid,(instr,outstr));
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    95
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    96
fun cmdstreamsOf (CMDPROC{instr,outstr,...}) = (instr, outstr);
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    97
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    98
fun cmdInStream (CMDPROC{instr,outstr,...}) = (instr);
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
    99
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   100
fun cmdchildInfo (CMDPROC{prover,cmd,thmstring,proc_handle,goalstring,instr,outstr}) = (prover,(cmd, (instr,outstr)));
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   101
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   102
fun cmdchildHandle (CMDPROC{prover,cmd,thmstring,goalstring,proc_handle,instr,outstr})  = proc_handle;
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   103
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   104
fun cmdProver (CMDPROC{prover,cmd,thmstring,goalstring,proc_handle,instr,outstr})  = (prover);
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   105
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   106
fun cmdThm (CMDPROC{prover,cmd,thmstring,goalstring,proc_handle,instr,outstr})  = (thmstring);
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   107
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   108
fun cmdGoal (CMDPROC{prover,cmd,thmstring,goalstring,proc_handle,instr,outstr})  = (goalstring);
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   109
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   110
fun sendOutput (outstr,str) = (TextIO.outputSubstr (outstr, (Substring.all str));TextIO.flushOut outstr);
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   111
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   112
(********************************************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   113
(*  takes a list of arguments and sends them individually to the watcher process by pipe    *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   114
(********************************************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   115
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   116
fun outputArgs (toWatcherStr, []) = ()
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   117
|   outputArgs (toWatcherStr, (x::xs)) = (TextIO.output (toWatcherStr, x); 
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   118
                                          TextIO.flushOut toWatcherStr;
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   119
                                         outputArgs (toWatcherStr, xs))
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   120
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   121
(********************************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   122
(*    gets individual args from instream and concatenates them into a list      *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   123
(********************************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   124
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   125
fun getArgs (fromParentStr, toParentStr,ys) =  let 
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   126
                                       val thisLine = TextIO.input fromParentStr
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   127
                                    in
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   128
                                        ((ys@[thisLine]))
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   129
                                    end
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   130
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   131
(********************************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   132
(*  Remove the \n character from the end of each filename                       *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   133
(********************************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   134
16478
d0a1f6231e2f Added VampCommunication.ML.
quigley
parents: 16475
diff changeset
   135
(*fun getCmd cmdStr = let val backList = ((rev(explode cmdStr))) 
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   136
                    in
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   137
                        if (String.isPrefix "\n"  (implode backList )) 
16089
9169bdf930f8 trying to set up portable calling sequences for SPASS and tptp2X
paulson
parents: 16061
diff changeset
   138
                        then (implode (rev ((tl backList))))
9169bdf930f8 trying to set up portable calling sequences for SPASS and tptp2X
paulson
parents: 16061
diff changeset
   139
                        else cmdStr
16478
d0a1f6231e2f Added VampCommunication.ML.
quigley
parents: 16475
diff changeset
   140
                    end*)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   141
                            
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   142
(********************************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   143
(*  Send request to Watcher for a vampire to be called for filename in arg      *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   144
(********************************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   145
                    
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   146
fun callResProver (toWatcherStr,  arg) = 
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   147
      (sendOutput (toWatcherStr, arg^"\n"); 
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   148
       TextIO.flushOut toWatcherStr)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   149
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   150
(*****************************************************************************************)
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   151
(*  Send request to Watcher for multiple provers to be called for filenames in arg       *)
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   152
(*  need to do the dfg stuff in the watcher, not here! send over the clasimp and stuff files too*)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   153
(*****************************************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   154
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   155
    
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   156
(* need to modify to send over hyps file too *)
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   157
fun callResProvers (toWatcherStr,  []) = 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   158
      (sendOutput (toWatcherStr, "End of calls\n");  TextIO.flushOut toWatcherStr)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   159
|   callResProvers (toWatcherStr,
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   160
                    (prover,thmstring,goalstring, proverCmd,settings,clasimpfile, 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   161
                     axfile, hypsfile,probfile)  ::  args) =
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   162
      let val _ = File.write (File.tmp_path (Path.basic "tog_comms"))
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   163
                             (prover^thmstring^goalstring^proverCmd^settings^
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   164
                              clasimpfile^hypsfile^probfile)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   165
      in sendOutput (toWatcherStr,    
16675
96bdc59afc05 Streamlined the signal handler in watcher.ML
quigley
parents: 16561
diff changeset
   166
            (prover^"$"^thmstring^"$"^goalstring^"$"^proverCmd^"$"^
96bdc59afc05 Streamlined the signal handler in watcher.ML
quigley
parents: 16561
diff changeset
   167
             settings^"$"^clasimpfile^"$"^hypsfile^"$"^probfile^"\n"));
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   168
         goals_being_watched := (!goals_being_watched) + 1;
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   169
	 TextIO.flushOut toWatcherStr;
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   170
	 callResProvers (toWatcherStr,args)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   171
      end   
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   172
                                                
16156
2f6fc19aba1e Fixed array containing clasimpset rules. Added flags to turn on and off reconstruction and full spass
quigley
parents: 16100
diff changeset
   173
15782
a1863ea9052b Corrected the problem with the ATP directory.
quigley
parents: 15774
diff changeset
   174
(*
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   175
fun callResProversStr (toWatcherStr,  []) =  "End of calls\n" 
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   176
                                     
15782
a1863ea9052b Corrected the problem with the ATP directory.
quigley
parents: 15774
diff changeset
   177
|   callResProversStr (toWatcherStr,(prover,thmstring,goalstring, proverCmd,settings,clasimpfile, axfile, hypsfile, probfile)::args) =
a1863ea9052b Corrected the problem with the ATP directory.
quigley
parents: 15774
diff changeset
   178
                                            ((prover^"*"^thmstring^"*"^goalstring^"*"^proverCmd^"*"^settings^"*"^clasimpfile^"*"^axfile^"*"^hypsfile^"*"^probfile^"\n")
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   179
                                            
15782
a1863ea9052b Corrected the problem with the ATP directory.
quigley
parents: 15774
diff changeset
   180
     *)                                      
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   181
 
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   182
(**************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   183
(* Send message to watcher to kill currently running vampires *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   184
(**************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   185
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   186
fun callSlayer (toWatcherStr) = (sendOutput (toWatcherStr, "Kill vampires\n"); 
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   187
                            TextIO.flushOut toWatcherStr)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   188
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   189
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   190
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   191
(**************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   192
(* Remove \n token from a vampire goal filename and extract   *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   193
(* prover, proverCmd, settings and file from input string     *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   194
(**************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   195
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   196
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   197
 fun takeUntil ch [] res  = (res, [])
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   198
 |   takeUntil ch (x::xs) res = 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   199
        if   x = ch then (res, xs)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   200
	else takeUntil ch xs (res@[x])
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   201
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   202
 fun getSettings [] settings = settings
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   203
|    getSettings (xs) settings = 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   204
       let val (set, rest ) = takeUntil "%" xs []
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   205
       in
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   206
	   getSettings rest (settings@[(implode set)])
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   207
       end
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   208
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   209
fun separateFields str =
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   210
  let val  outfile = TextIO.openAppend(*("sep_field")*)(File.platform_path(File.tmp_path (Path.basic "sep_field")))                                                                         
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   211
      val _ = TextIO.output (outfile,("In separateFields, str is: "^(implode str)^"\n\n") )
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   212
      val _ =  TextIO.closeOut outfile
16675
96bdc59afc05 Streamlined the signal handler in watcher.ML
quigley
parents: 16561
diff changeset
   213
      val (prover, rest) = takeUntil "$" str []
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   214
      val prover = implode prover
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   215
16675
96bdc59afc05 Streamlined the signal handler in watcher.ML
quigley
parents: 16561
diff changeset
   216
      val (thmstring, rest) =  takeUntil "$" rest []
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   217
      val thmstring = implode thmstring
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   218
16675
96bdc59afc05 Streamlined the signal handler in watcher.ML
quigley
parents: 16561
diff changeset
   219
      val (goalstring, rest) =  takeUntil "$" rest []
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   220
      val goalstring = implode goalstring
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   221
16675
96bdc59afc05 Streamlined the signal handler in watcher.ML
quigley
parents: 16561
diff changeset
   222
      val (proverCmd, rest ) =  takeUntil "$" rest []
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   223
      val proverCmd = implode proverCmd
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   224
      
16675
96bdc59afc05 Streamlined the signal handler in watcher.ML
quigley
parents: 16561
diff changeset
   225
      val (settings, rest) =  takeUntil "$" rest []
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   226
      val settings = getSettings settings []
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   227
16675
96bdc59afc05 Streamlined the signal handler in watcher.ML
quigley
parents: 16561
diff changeset
   228
      val (clasimpfile, rest ) =  takeUntil "$" rest []
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   229
      val clasimpfile = implode clasimpfile
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   230
      
16675
96bdc59afc05 Streamlined the signal handler in watcher.ML
quigley
parents: 16561
diff changeset
   231
      val (hypsfile, rest ) =  takeUntil "$" rest []
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   232
      val hypsfile = implode hypsfile
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   233
16675
96bdc59afc05 Streamlined the signal handler in watcher.ML
quigley
parents: 16561
diff changeset
   234
      val (file, rest) =  takeUntil "$" rest []
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   235
      val file = implode file
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   236
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   237
      val _ = File.append (File.tmp_path (Path.basic "sep_comms"))                                                                                
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   238
                  ("Sep comms are: "^(implode str)^"**"^
16675
96bdc59afc05 Streamlined the signal handler in watcher.ML
quigley
parents: 16561
diff changeset
   239
                   prover^" thmstring: "^thmstring^"\n goalstr:  "^goalstring^" \n provercmd: "^proverCmd^" \n  clasimp "^clasimpfile^" \n hyps "^hypsfile^"\n prob  "^file^"\n\n")
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   240
  in
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   241
     (prover,thmstring,goalstring, proverCmd, settings, clasimpfile, hypsfile, file)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   242
  end
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   243
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   244
                      
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   245
(***********************************************************************************)
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   246
(* do tptp2x and cat to turn clasimpfile, hypsfile and probfile into one .dfg file *)
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   247
(***********************************************************************************)
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   248
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   249
fun formatCmd (prover,thmstring,goalstring, proverCmd, settings, clasimpfile, hypsfile ,probfile) = 
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   250
  let
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   251
    (*** want to cat clasimp ax hyps prob, then send the resulting file to tptp2x ***)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   252
    val probID = List.last(explode probfile)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   253
    val wholefile = File.tmp_path (Path.basic ("ax_prob_" ^ probID))
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   254
    
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   255
    (*** only include problem and clasimp for the moment, not sure 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   256
	 how to refer to hyps/local axioms just now ***)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   257
    val whole_prob_file = Unix.execute("/bin/cat", 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   258
	     [clasimpfile,(*axfile, hypsfile,*)probfile,  ">",
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   259
	      File.platform_path wholefile])
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   260
    
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   261
    val dfg_dir = File.tmp_path (Path.basic "dfg"); 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   262
    val dfg_path = File.platform_path dfg_dir;
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   263
    
16561
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   264
    (*** want to cat clasimp ax hyps prob, then send the resulting file to tptp2x ***)
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   265
    val probID = List.last(explode probfile)
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   266
    val wholefile = File.tmp_path (Path.basic ("ax_prob_"^probID))
16478
d0a1f6231e2f Added VampCommunication.ML.
quigley
parents: 16475
diff changeset
   267
16561
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   268
    (*** only include problem and clasimp for the moment, not sure how to refer to ***)
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   269
    (*** hyps/local axioms just now                                                ***)
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   270
    val whole_prob_file = Unix.execute("/bin/cat", [clasimpfile,(*axfile, hypsfile,*)probfile,  ">", (File.platform_path wholefile)])
17150
ce2a1aeb42aa DFG output now works for untyped rules (ML "ResClause.untyped();")
quigley
parents: 17121
diff changeset
   271
ce2a1aeb42aa DFG output now works for untyped rules (ML "ResClause.untyped();")
quigley
parents: 17121
diff changeset
   272
    (* if using spass prob_n already contains whole DFG file, otherwise need to mash axioms*)
ce2a1aeb42aa DFG output now works for untyped rules (ML "ResClause.untyped();")
quigley
parents: 17121
diff changeset
   273
    (* from clasimpset onto problem file *)
ce2a1aeb42aa DFG output now works for untyped rules (ML "ResClause.untyped();")
quigley
parents: 17121
diff changeset
   274
    val newfile =   if !SpassComm.spass 
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   275
		    then probfile
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   276
                    else (File.platform_path wholefile)
17150
ce2a1aeb42aa DFG output now works for untyped rules (ML "ResClause.untyped();")
quigley
parents: 17121
diff changeset
   277
16561
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   278
    val _ =  File.append (File.tmp_path (Path.basic"thmstring_in_watcher"))
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   279
	       (thmstring^"\n goals_watched"^(string_of_int(!goals_being_watched))^newfile^"\n")
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   280
  in
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   281
    (prover,thmstring,goalstring, proverCmd, settings,newfile)	
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   282
  end;
16478
d0a1f6231e2f Added VampCommunication.ML.
quigley
parents: 16475
diff changeset
   283
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   284
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   285
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   286
(* remove \n from end of command and put back into tuple format *)
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   287
             
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   288
16478
d0a1f6231e2f Added VampCommunication.ML.
quigley
parents: 16475
diff changeset
   289
(*  val cmdStr = "spass*((ALL xa. (~ P x | P xa) & (~ P xa | P x)) & (P xa | (ALL x. P x)) & ((ALL x. ~ P x) | ~ P xb) [.])*(EX x. ALL y. P x = P y) --> (EX x. P x) = (ALL y. P y)*/homes/clq20/bin/SPASS*-DocProof*/local/scratch/clq20/27023/clasimp*/local/scratch/clq20/27023/hyps*/local/scratch/clq20/27023/prob_1\n"
d0a1f6231e2f Added VampCommunication.ML.
quigley
parents: 16475
diff changeset
   290
d0a1f6231e2f Added VampCommunication.ML.
quigley
parents: 16475
diff changeset
   291
val cmdStr = "vampire*(length (rev xs) = length xs  [.]) & (length (rev (a # xs)) ~= length (a # xs) [.])*length (rev []) = length []*/homes/jm318/Vampire8/vkernel*-t 300%-m 100000*/local/scratch/clq20/23523/clasimp*/local/scratch/clq20/23523/hyps*/local/scratch/clq20/23523/prob_1\n"
d0a1f6231e2f Added VampCommunication.ML.
quigley
parents: 16475
diff changeset
   292
 *)
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   293
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   294
(*FIX:  are the two getCmd procs getting confused?  Why do I have two anyway? *)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   295
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   296
 fun getCmd cmdStr = 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   297
       let val backList = rev(explode cmdStr)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   298
	   val _ = File.append (File.tmp_path (Path.basic"cmdStr")) cmdStr
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   299
       in
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   300
	   if (String.isPrefix "\n"  (implode backList )) 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   301
	   then 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   302
	       let val newCmdStr = (rev(tl backList))
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   303
	       in  File.write (File.tmp_path (Path.basic"backlist")) 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   304
	                      ("about to call sepfields with "^(implode newCmdStr));
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   305
		   formatCmd (separateFields newCmdStr)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   306
	       end
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   307
	   else formatCmd (separateFields (explode cmdStr))
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   308
       end
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   309
                      
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   310
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   311
fun getProofCmd (a,b,c,d,e,f) = d
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   312
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   313
                        
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   314
(**************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   315
(* Get commands from Isabelle                                 *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   316
(**************************************************************)
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   317
(* FIX: or perhaps do the tptp2x stuff here - so it's get commands and then format them, before passing them to spass *)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   318
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   319
fun getCmds (toParentStr,fromParentStr, cmdList) = 
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   320
  let val thisLine = TextIO.inputLine fromParentStr 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   321
      val _ = File.append (File.tmp_path (Path.basic "parent_comms")) thisLine
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   322
  in
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   323
     if (thisLine = "End of calls\n") 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   324
     then cmdList
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   325
     else if (thisLine = "Kill children\n") 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   326
     then 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   327
	 (   TextIO.output (toParentStr,thisLine ); 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   328
	     TextIO.flushOut toParentStr;
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   329
	   (("","","","Kill children",[],"")::cmdList)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   330
	  )
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   331
     else  let val thisCmd = getCmd (thisLine) 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   332
	       (*********************************************************)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   333
	       (* thisCmd = (prover,thmstring,proverCmd, settings, file)*)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   334
	       (* i.e. put back into tuple format                       *)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   335
	       (*********************************************************)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   336
	   in
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   337
	     (*TextIO.output (toParentStr, thisCmd); 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   338
	       TextIO.flushOut toParentStr;*)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   339
	       getCmds (toParentStr,fromParentStr, (thisCmd::cmdList))
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   340
	   end
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   341
  end
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   342
	    
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   343
                                                                  
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   344
(**************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   345
(*  Get Io-descriptor for polling of an input stream          *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   346
(**************************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   347
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   348
fun getInIoDesc someInstr = 
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   349
    let val (rd, buf) = TextIO.StreamIO.getReader(TextIO.getInstream someInstr)
15702
2677db44c795 new signalling primmitives for sml/nj compatibility
paulson
parents: 15684
diff changeset
   350
        val _ = TextIO.output (TextIO.stdOut, buf)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   351
        val ioDesc = 
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   352
	    case rd
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   353
	      of TextPrimIO.RD{ioDesc = SOME iod, ...} =>SOME iod
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   354
	       | _ => NONE
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   355
     in (* since getting the reader will have terminated the stream, we need
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   356
	 * to build a new stream. *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   357
	TextIO.setInstream(someInstr, TextIO.StreamIO.mkInstream(rd, buf));
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   358
	ioDesc
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   359
    end
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   360
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   361
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   362
(*************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   363
(*  Set up a Watcher Process         *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   364
(*************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   365
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   366
fun setupWatcher (thm,clause_arr, num_of_clauses) = 
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   367
  let
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   368
    (** pipes for communication between parent and watcher **)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   369
    val p1 = Posix.IO.pipe ()
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   370
    val p2 = Posix.IO.pipe ()
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   371
    fun closep () = (
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   372
	  Posix.IO.close (#outfd p1); 
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   373
	  Posix.IO.close (#infd p1);
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   374
	  Posix.IO.close (#outfd p2); 
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   375
	  Posix.IO.close (#infd p2)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   376
	)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   377
    (***********************************************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   378
    (****** fork a watcher process and get it set up and going *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   379
    (***********************************************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   380
    fun startWatcher (procList) =
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   381
	     (case  Posix.Process.fork() (***************************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   382
	   of SOME pid =>  pid           (* parent - i.e. main Isabelle process *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   383
					 (***************************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   384
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   385
					   (*************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   386
	    | NONE => let                  (* child - i.e. watcher  *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   387
		val oldchildin = #infd p1  (*************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   388
		val fromParent = Posix.FileSys.wordToFD 0w0
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   389
		val oldchildout = #outfd p2
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   390
		val toParent = Posix.FileSys.wordToFD 0w1
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   391
		val fromParentIOD = Posix.FileSys.fdToIOD fromParent
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   392
		val fromParentStr = openInFD ("_exec_in_parent", fromParent)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   393
		val toParentStr = openOutFD ("_exec_out_parent", toParent)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   394
		val sign = sign_of_thm thm
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   395
		val prems = prems_of thm
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   396
		val prems_string =  Meson.concat_with_and (map (Sign.string_of_term sign) prems) 
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   397
		val _ = (warning ("subgoals forked to startWatcher: "^prems_string));
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   398
	       (* tracing *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   399
	      (*val tenth_ax = fst( Array.sub(clause_arr, 1))  
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   400
		val tenth_ax_thms = memo_find_clause (tenth_ax, clause_tab)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   401
		val clause_str = Meson.concat_with_and (map string_of_thm tenth_ax_thms)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   402
		val _ = (warning ("tenth axiom in array in watcher is: "^tenth_ax))         
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   403
		val _ = (warning ("tenth axiom in table in watcher is: "^clause_str))         
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   404
		val _ = (warning ("num_of_clauses in watcher is: "^(string_of_int (num_of_clauses))) )       
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   405
			 *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   406
		(*val goalstr = string_of_thm (the_goal)
16260
4a1f36eafe17 File.platform_path vs. File.shell_path;
wenzelm
parents: 16185
diff changeset
   407
		 val  outfile = TextIO.openOut(File.platform_path(File.tmp_path (Path.basic "goal_in_watcher")));  
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   408
		val _ = TextIO.output (outfile,goalstr )
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   409
		val _ =  TextIO.closeOut outfile*)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   410
		fun killChildren [] = ()
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   411
	     |      killChildren  (child_handle::children) = (killChild child_handle; killChildren children)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   412
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   413
	      (*************************************************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   414
	      (* take an instream and poll its underlying reader for input *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   415
	      (*************************************************************)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   416
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   417
	      fun pollParentInput () = 
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   418
		 let val pd = OS.IO.pollDesc (fromParentIOD)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   419
		 in 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   420
		   if (isSome pd ) then 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   421
		       let val pd' = OS.IO.pollIn (valOf pd)
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   422
			   val pdl = OS.IO.poll ([pd'], SOME (Time.fromMilliseconds 2000)) 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   423
			   val _ = File.append (File.tmp_path (Path.basic "parent_poll")) 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   424
			     ("In parent_poll\n")	
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   425
		       in
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   426
			  if null pdl 
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   427
			  then
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   428
			     NONE
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   429
			  else if (OS.IO.isIn (hd pdl)) 
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   430
			       then SOME (getCmds (toParentStr, fromParentStr, []))
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   431
			       else NONE
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   432
		       end
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   433
		     else NONE
16475
8f3ba52a7937 using TPTP2X_HOME; indentation, etc
paulson
parents: 16357
diff changeset
   434
		 end
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   435
		      
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   436
	       fun pollChildInput (fromStr) = 
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   437
		 let val _ = File.append (File.tmp_path (Path.basic "child_poll")) 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   438
			       ("In child_poll\n")
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   439
		     val iod = getInIoDesc fromStr
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   440
		 in 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   441
		   if isSome iod 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   442
		   then 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   443
		     let val pd = OS.IO.pollDesc (valOf iod)
16478
d0a1f6231e2f Added VampCommunication.ML.
quigley
parents: 16475
diff changeset
   444
		     in 
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   445
		     if (isSome pd ) then 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   446
			 let val pd' = OS.IO.pollIn (valOf pd)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   447
			     val pdl = OS.IO.poll ([pd'], SOME (Time.fromMilliseconds 2000)) 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   448
			 in
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   449
			    if null pdl 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   450
			    then
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   451
			      ( File.append (File.tmp_path (Path.basic "child_poll_res")) 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   452
			       ("Null pdl \n");NONE)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   453
			    else if (OS.IO.isIn (hd pdl)) 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   454
				 then
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   455
				     (let val inval =  (TextIO.inputLine fromStr)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   456
					  val _ = File.append (File.tmp_path (Path.basic "child_poll_res")) (inval^"\n")
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   457
				      in
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   458
					    SOME inval
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   459
				      end)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   460
				 else
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   461
				       ( File.append (File.tmp_path (Path.basic "child_poll_res")) 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   462
			       ("Null pdl \n");NONE)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   463
			 end
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   464
		       else  NONE
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   465
		       end
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   466
		   else NONE
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   467
	     end
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   468
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   469
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   470
	     (****************************************************************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   471
	     (* Check all vampire processes currently running for output                 *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   472
	     (****************************************************************************) 
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   473
							(*********************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   474
	      fun checkChildren ([], toParentStr) = []  (*** no children to check ********)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   475
							(*********************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   476
	      |   checkChildren ((childProc::otherChildren), toParentStr) = 
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   477
		    let val _ = File.append (File.tmp_path (Path.basic "child_check")) 
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   478
			           ("In check child, length of queue:"^(string_of_int (length (childProc::otherChildren)))^"\n")
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   479
                        val (childInput,childOutput) =  cmdstreamsOf childProc
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   480
			val child_handle= cmdchildHandle childProc
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   481
			(* childCmd is the .dfg file that the problem is in *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   482
			val childCmd = fst(snd (cmdchildInfo childProc))
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   483
                        val _ = File.append (File.tmp_path (Path.basic "child_command")) 
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   484
			           (childCmd^"\n")
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   485
			(* now get the number of the subgoal from the filename *)
17150
ce2a1aeb42aa DFG output now works for untyped rules (ML "ResClause.untyped();")
quigley
parents: 17121
diff changeset
   486
			val sg_num = (*if (!SpassComm.spass )
16520
7a9cda53bfa2 Integrated vampire lemma code.
quigley
parents: 16515
diff changeset
   487
				     then 
7a9cda53bfa2 Integrated vampire lemma code.
quigley
parents: 16515
diff changeset
   488
					int_of_string(ReconOrderClauses.get_nth 5 (rev(explode childCmd)))
17150
ce2a1aeb42aa DFG output now works for untyped rules (ML "ResClause.untyped();")
quigley
parents: 17121
diff changeset
   489
				     else*)
16520
7a9cda53bfa2 Integrated vampire lemma code.
quigley
parents: 16515
diff changeset
   490
					int_of_string(hd (rev(explode childCmd)))
7a9cda53bfa2 Integrated vampire lemma code.
quigley
parents: 16515
diff changeset
   491
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   492
			val childIncoming = pollChildInput childInput
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   493
 			val _ = File.append (File.tmp_path (Path.basic "child_check_polled")) 
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   494
			           ("finished polling child \n")
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   495
			val parentID = Posix.ProcEnv.getppid()
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   496
			val prover = cmdProver childProc
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   497
			val thmstring = cmdThm childProc
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   498
			val sign = sign_of_thm thm
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   499
			val prems = prems_of thm
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   500
			val prems_string =  Meson.concat_with_and (map (Sign.string_of_term sign) prems) 
16100
f80fc4bff933 Now uses File.write and File.append
paulson
parents: 16091
diff changeset
   501
			val _ = warning("subgoals forked to checkChildren: "^prems_string)
f80fc4bff933 Now uses File.write and File.append
paulson
parents: 16091
diff changeset
   502
			val goalstring = cmdGoal childProc							
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   503
			val _ = File.append (File.tmp_path (Path.basic "child_comms")) 
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   504
			           (prover^thmstring^goalstring^childCmd^"\n")
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   505
		    in 
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   506
		      if (isSome childIncoming) 
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   507
		      then 
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   508
			  (* check here for prover label on child*)
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   509
			  let val _ = File.write (File.tmp_path (Path.basic "child_incoming")) 
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   510
			             ("subgoals forked to checkChildren:"^
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   511
			             prems_string^prover^thmstring^goalstring^childCmd) 
16478
d0a1f6231e2f Added VampCommunication.ML.
quigley
parents: 16475
diff changeset
   512
		              val childDone = (case prover of
d0a1f6231e2f Added VampCommunication.ML.
quigley
parents: 16475
diff changeset
   513
	                          "vampire" => (VampComm.checkVampProofFound(childInput, toParentStr, parentID,thmstring,goalstring, childCmd, thm, sg_num,clause_arr, num_of_clauses) )                                              
d0a1f6231e2f Added VampCommunication.ML.
quigley
parents: 16475
diff changeset
   514
                                 |"spass" => (SpassComm.checkSpassProofFound(childInput, toParentStr, parentID,thmstring,goalstring, childCmd, thm, sg_num,clause_arr, num_of_clauses)     ) )
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   515
			   in
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   516
			    if childDone      (**********************************************)
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   517
			    then (* child has found a proof and transferred it *)
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   518
			       (* Remove this child and go on to check others*)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   519
			       (**********************************************)
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   520
			       (Unix.reap child_handle;
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   521
				checkChildren(otherChildren, toParentStr))
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   522
			    else 
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   523
			       (**********************************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   524
			       (* Keep this child and go on to check others  *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   525
			       (**********************************************)
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   526
			      (childProc::(checkChildren (otherChildren, toParentStr)))
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   527
			 end
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   528
		       else
16100
f80fc4bff933 Now uses File.write and File.append
paulson
parents: 16091
diff changeset
   529
			 (File.append (File.tmp_path (Path.basic "child_incoming")) "No child output ";
f80fc4bff933 Now uses File.write and File.append
paulson
parents: 16091
diff changeset
   530
			  childProc::(checkChildren (otherChildren, toParentStr)))
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   531
		    end
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   532
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   533
	     
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   534
	  (********************************************************************)                  
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   535
	  (* call resolution processes                                        *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   536
	  (* settings should be a list of strings                             *)
16520
7a9cda53bfa2 Integrated vampire lemma code.
quigley
parents: 16515
diff changeset
   537
	  (* e.g. ["-t 300", "-m 100000"]         (TextIO.input instr)^                            *)
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   538
	  (* takes list of (string, string, string list, string)list proclist *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   539
	  (********************************************************************)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   540
16039
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   541
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   542
(*** add subgoal id num to this *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   543
	     fun execCmds  [] procList = procList
16561
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   544
	     |   execCmds  ((prover, thmstring,goalstring,proverCmd,settings,file)::cmds) procList  =             let val _ = File.append (File.tmp_path (Path.basic "pre_exec_child"))  ("\nAbout to execute command for goal:\n"^goalstring^proverCmd^(concat settings)^file^" at "^(Date.toString(Date.fromTimeLocal(Time.now()))))
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   545
	       in 
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   546
		 if (prover = "spass") 
16561
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   547
		 then 
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   548
		   let val childhandle:(TextIO.instream,TextIO.outstream) Unix.proc  = 
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   549
		            (Unix.execute(proverCmd, (["-FullRed=0"]@settings@[file])))
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   550
		       val (instr, outstr) = Unix.streamsOf childhandle
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   551
		       val newProcList =    (((CMDPROC{
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   552
					    prover = prover,
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   553
					    cmd = file,
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   554
					    thmstring = thmstring,
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   555
					    goalstring = goalstring,
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   556
					    proc_handle = childhandle,
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   557
					    instr = instr,
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   558
					    outstr = outstr })::procList))
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   559
			val _ = File.append (File.tmp_path (Path.basic "exec_child"))  
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   560
			     ("\nexecuting command for goal:\n"^
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   561
			      goalstring^proverCmd^(concat settings)^file^" at "^(Date.toString(Date.fromTimeLocal(Time.now()))))
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   562
		   in
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   563
		      Posix.Process.sleep (Time.fromSeconds 1);execCmds cmds newProcList
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   564
		   end
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   565
		 else 
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   566
		   let val childhandle:(TextIO.instream,TextIO.outstream) Unix.proc  = 
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   567
		            (Unix.execute(proverCmd, (settings@[file])))
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   568
		       val (instr, outstr) = Unix.streamsOf childhandle
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   569
		       
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   570
		       val newProcList = (CMDPROC{
16561
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   571
					    prover = prover,
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   572
					    cmd = file,
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   573
					    thmstring = thmstring,
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   574
					    goalstring = goalstring,
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   575
					    proc_handle = childhandle,
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   576
					    instr = instr,
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   577
					    outstr = outstr }) :: procList
16561
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   578
	  
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   579
		       val _ = File.append (File.tmp_path (Path.basic "exec_child")) 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   580
		                 ("executing command for goal:\n"^
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   581
		                  goalstring^proverCmd^(concat settings)^file^
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   582
		                  " at "^(Date.toString(Date.fromTimeLocal(Time.now()))))
16561
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   583
		   in
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   584
		     Posix.Process.sleep (Time.fromSeconds 1); execCmds cmds newProcList
2bc33f0cfe9a tidying
paulson
parents: 16548
diff changeset
   585
		   end
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   586
		end
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   587
16039
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   588
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   589
	  (****************************************)                  
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   590
	  (* call resolution processes remotely   *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   591
	  (* settings should be a list of strings *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   592
	  (* e.g. ["-t 300", "-m 100000"]         *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   593
	  (****************************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   594
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   595
	   (*  fun execRemoteCmds  [] procList = procList
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   596
	     |   execRemoteCmds ((prover, thmstring,goalstring,proverCmd ,settings,file)::cmds) procList  =  
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   597
				       let val  newProcList =  mySshExecuteToList ("/usr/bin/ssh",([prover,thmstring,goalstring,"-t", "shep"]@[proverCmd]@settings@[file]), procList)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   598
					   in
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   599
						execRemoteCmds  cmds newProcList
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   600
					   end
16039
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   601
*)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   602
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   603
	     fun printList (outStr, []) = ()
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   604
	     |   printList (outStr, (x::xs)) = (TextIO.output (outStr, x);TextIO.flushOut outStr; printList (outStr,xs))                  
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   605
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   606
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   607
	  (**********************************************)                  
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   608
	  (* Watcher Loop                               *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   609
	  (**********************************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   610
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   611
	      fun keepWatching (toParentStr, fromParentStr,procList) = 
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   612
		let fun loop (procList) =  
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   613
		     let val cmdsFromIsa = pollParentInput ()
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   614
			 fun killchildHandler (n:int)  = 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   615
			       (TextIO.output(toParentStr, "Killing child proof processes!\n");
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   616
				TextIO.flushOut toParentStr;
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   617
				killChildren (map (cmdchildHandle) procList);
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   618
				())
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   619
		     in 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   620
			(*Signal.signal (Posix.Signal.usr2, Signal.SIG_HANDLE killchildHandler);*)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   621
									   (**********************************)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   622
			if (isSome cmdsFromIsa) 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   623
			then (*  deal with input from Isabelle *)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   624
			  if (getProofCmd(hd(valOf cmdsFromIsa)) = "Kill children" )
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   625
			  then 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   626
			    let val child_handles = map cmdchildHandle procList 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   627
			    in
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   628
			       killChildren child_handles;
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   629
			       (*Posix.Process.kill(Posix.Process.K_PROC (Posix.ProcEnv.getppid()), Posix.Signal.usr2);*)    
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   630
			       loop ([])
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   631
			    end
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   632
			  else
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   633
			    if ((length procList)<10)    (********************)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   634
			    then                        (* Execute locally  *)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   635
			      let 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   636
				val newProcList = execCmds (valOf cmdsFromIsa) procList
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   637
				val parentID = Posix.ProcEnv.getppid()
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   638
				   val _ = (File.append (File.tmp_path (Path.basic "prekeep_watch")) "Just execed a child\n ")
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   639
				val newProcList' =checkChildren (newProcList, toParentStr) 
16357
f1275d2a1dee All subgoals sent to the watcher at once now.
quigley
parents: 16260
diff changeset
   640
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   641
				val _ = warning("off to keep watching...")
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   642
			       val _ = (File.append (File.tmp_path (Path.basic "keep_watch")) "Off to keep watching...\n ")
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   643
			      in
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   644
				(*Posix.Process.sleep (Time.fromSeconds 1);*)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   645
				loop (newProcList') 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   646
			      end
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   647
			    else  (* Execute remotely              *)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   648
                                  (* (actually not remote for now )*)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   649
			      let 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   650
				val newProcList = execCmds (valOf cmdsFromIsa) procList
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   651
				val parentID = Posix.ProcEnv.getppid()
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   652
				val newProcList' =checkChildren (newProcList, toParentStr) 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   653
			      in
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   654
				(*Posix.Process.sleep (Time.fromSeconds 1);*)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   655
				loop (newProcList') 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   656
			      end
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   657
			else (* No new input from Isabelle *)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   658
			  let val newProcList = checkChildren ((procList), toParentStr)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   659
			  in
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   660
			    (*Posix.Process.sleep (Time.fromSeconds 1);*)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   661
			   (File.append (File.tmp_path (Path.basic "keep_watch")) "Off to keep watching.2..\n ");
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   662
			    loop (newProcList)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   663
			  end
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   664
		      end
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   665
		in  
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   666
		    loop (procList)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   667
		end
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   668
		
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   669
    
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   670
		in
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   671
		 (***************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   672
		 (*** Sort out pipes ********)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   673
		 (***************************)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   674
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   675
		  Posix.IO.close (#outfd p1);
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   676
		  Posix.IO.close (#infd p2);
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   677
		  Posix.IO.dup2{old = oldchildin, new = fromParent};
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   678
		  Posix.IO.close oldchildin;
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   679
		  Posix.IO.dup2{old = oldchildout, new = toParent};
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   680
		  Posix.IO.close oldchildout;
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   681
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   682
		  (***************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   683
		  (* start the watcher loop  *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   684
		  (***************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   685
		  keepWatching (toParentStr, fromParentStr, procList);
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   686
		  (****************************************************************************)
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   687
   (* fake return value - actually want the watcher to loop until killed *)
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   688
		  (****************************************************************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   689
		  Posix.Process.wordToPid 0w0
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   690
		end);
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   691
	  (* end case *)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   692
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   693
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   694
    val _ = TextIO.flushOut TextIO.stdOut
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   695
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   696
    (*******************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   697
    (***  set watcher going ********)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   698
    (*******************************)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   699
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   700
    val procList = []
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   701
    val pid = startWatcher (procList)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   702
    (**************************************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   703
    (* communication streams to watcher               *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   704
    (**************************************************)
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   705
16061
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   706
    val instr = openInFD ("_exec_in", #infd p2)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   707
    val outstr = openOutFD ("_exec_out", #outfd p1)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   708
    
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   709
    in
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   710
     (*******************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   711
     (* close the child-side fds    *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   712
     (*******************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   713
      Posix.IO.close (#outfd p2);
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   714
      Posix.IO.close (#infd p1);
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   715
      (* set the fds close on exec *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   716
      Posix.IO.setfd (#infd p2, Posix.IO.FD.flags [Posix.IO.FD.cloexec]);
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   717
      Posix.IO.setfd (#outfd p1, Posix.IO.FD.flags [Posix.IO.FD.cloexec]);
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   718
       
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   719
     (*******************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   720
     (* return value                *)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   721
     (*******************************)
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   722
      PROC{pid = pid,
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   723
	instr = instr,
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   724
	outstr = outstr
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   725
      }
8a139c1557bf A new structure and reduced indentation
paulson
parents: 16039
diff changeset
   726
   end;
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   727
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   728
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   729
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   730
(**********************************************************)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   731
(* Start a watcher and set up signal handlers             *)
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   732
(**********************************************************)
16039
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   733
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   734
fun killWatcher pid= Posix.Process.kill(Posix.Process.K_PROC pid, Posix.Signal.kill);
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   735
dfe264950511 Moved some of the clausify functions from ATP/res_clasimpset.ML to res_axioms.ML.
quigley
parents: 15919
diff changeset
   736
fun reapWatcher(pid, instr, outstr) =
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   737
  let val u = TextIO.closeIn instr;
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   738
      val u = TextIO.closeOut outstr;
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   739
      val (_, status) = Posix.Process.waitpid(Posix.Process.W_CHILD pid, [])
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   740
  in
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   741
	  status
16100
f80fc4bff933 Now uses File.write and File.append
paulson
parents: 16091
diff changeset
   742
  end
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   743
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   744
fun createWatcher (thm,clause_arr, ( num_of_clauses:int)) =
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   745
 let val mychild = childInfo (setupWatcher(thm,clause_arr,  num_of_clauses))
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   746
     val streams = snd mychild
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   747
     val childin = fst streams
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   748
     val childout = snd streams
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   749
     val childpid = fst mychild
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   750
     val sign = sign_of_thm thm
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   751
     val prems = prems_of thm
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   752
     val prems_string =  Meson.concat_with_and (map (Sign.string_of_term sign) prems) 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   753
     val _ = (warning ("subgoals forked to createWatcher: "^prems_string));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   754
     fun vampire_proofHandler (n) =
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   755
	(Pretty.writeln(Pretty.str ( (concat[(oct_char "360"), (oct_char "377")])));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   756
	 VampComm.getVampInput childin; Pretty.writeln(Pretty.str (oct_char "361")))               
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   757
     fun spass_proofHandler (n) = (
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   758
       let val  outfile = TextIO.openAppend(File.platform_path(File.tmp_path (Path.basic "foo_signal1")));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   759
	   val _ = TextIO.output (outfile, ("In signal handler now\n"))
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   760
	   val _ =  TextIO.closeOut outfile
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   761
	   val (reconstr, goalstring, thmstring) = SpassComm.getSpassInput childin
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   762
	   val  outfile = TextIO.openAppend(File.platform_path(File.tmp_path (Path.basic "foo_signal")));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   763
   
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   764
	   val _ = TextIO.output (outfile, ("In signal handler  "^reconstr^thmstring^goalstring^"goals_being_watched is: "^(string_of_int (!goals_being_watched))))
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   765
	   val _ =  TextIO.closeOut outfile
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   766
       in (* if a proof has been found and sent back as a reconstruction proof *)
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   767
	 if substring (reconstr, 0,1) = "["
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   768
	 then (Pretty.writeln(Pretty.str ( (concat[(oct_char "360"), (oct_char "377")])));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   769
	       Recon_Transfer.apply_res_thm reconstr goalstring;
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   770
	       Pretty.writeln(Pretty.str  (oct_char "361"));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   771
	       
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   772
	       goals_being_watched := ((!goals_being_watched) - 1);
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   773
       
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   774
	       if (!goals_being_watched) = 0
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   775
	       then 
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   776
		  let val _ = File.write (File.tmp_path (Path.basic "foo_reap_found"))
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   777
                                   ("Reaping a watcher, goals watched is: "^
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   778
                                    (string_of_int (!goals_being_watched))^"\n")
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   779
		   in
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   780
		       killWatcher (childpid); reapWatcher (childpid,childin, childout); ()
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   781
		   end
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   782
		else () )
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   783
	 (* if there's no proof, but a message from Spass *)
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   784
	 else if substring (reconstr, 0,5) = "SPASS"
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   785
	 then (goals_being_watched := (!goals_being_watched) -1;
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   786
	       Pretty.writeln(Pretty.str ( (concat[(oct_char "360"), (oct_char "377")])));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   787
	       Pretty.writeln(Pretty.str ((Recon_Transfer.restore_linebreaks goalstring)^reconstr));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   788
	       Pretty.writeln(Pretty.str  (oct_char "361"));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   789
	       if (!goals_being_watched = 0)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   790
	       then (File.write (File.tmp_path (Path.basic "foo_reap_comp"))
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   791
	              ("Reaping a watcher, goals watched is: " ^
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   792
	                 (string_of_int (!goals_being_watched))^"\n");
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   793
	             killWatcher (childpid); reapWatcher (childpid,childin, childout); ())
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   794
		else () ) 
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   795
	(* print out a list of rules used from clasimpset*)
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   796
	 else if substring (reconstr, 0,5) = "Rules"
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   797
	 then (goals_being_watched := (!goals_being_watched) -1;
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   798
	       Pretty.writeln(Pretty.str ( (concat[(oct_char "360"), (oct_char "377")])));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   799
	       Pretty.writeln(Pretty.str (goalstring^reconstr));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   800
	       Pretty.writeln(Pretty.str  (oct_char "361"));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   801
	       if (!goals_being_watched = 0)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   802
	       then (File.write (File.tmp_path (Path.basic "foo_reap_comp"))
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   803
	              ("Reaping a watcher, goals watched is: " ^
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   804
	                 (string_of_int (!goals_being_watched))^"\n");
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   805
	             killWatcher (childpid);  reapWatcher (childpid,childin, childout);()
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   806
		     )
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   807
	       else () )
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   808
	  (* if proof translation failed *)
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   809
	 else if substring (reconstr, 0,5) = "Proof"
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   810
	 then (goals_being_watched := (!goals_being_watched) -1;
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   811
	       Pretty.writeln(Pretty.str ( (concat[(oct_char "360"), (oct_char "377")])));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   812
	       Pretty.writeln(Pretty.str (goalstring^(Recon_Transfer.restore_linebreaks reconstr)));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   813
	       Pretty.writeln(Pretty.str  (oct_char "361"));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   814
	       if (!goals_being_watched = 0)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   815
	       then (File.write (File.tmp_path (Path.basic "foo_reap_comp"))
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   816
	              ("Reaping a watcher, goals watched is: " ^
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   817
	                 (string_of_int (!goals_being_watched))^"\n");
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   818
	             killWatcher (childpid);  reapWatcher (childpid,childin, childout);()
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   819
		     )
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   820
	       else () )
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   821
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   822
	 else if substring (reconstr, 0,1) = "%"
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   823
	 then (goals_being_watched := (!goals_being_watched) -1;
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   824
	       Pretty.writeln(Pretty.str ( (concat[(oct_char "360"), (oct_char "377")])));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   825
	       Pretty.writeln(Pretty.str (goalstring^(Recon_Transfer.restore_linebreaks reconstr)));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   826
	       Pretty.writeln(Pretty.str  (oct_char "361"));
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   827
	       if (!goals_being_watched = 0)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   828
	       then (File.write (File.tmp_path (Path.basic "foo_reap_comp"))
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   829
	              ("Reaping a watcher, goals watched is: " ^
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   830
	                 (string_of_int (!goals_being_watched))^"\n");
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   831
	             killWatcher (childpid);  reapWatcher (childpid,childin, childout);()
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   832
		     )
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   833
	       else () )
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   834
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   835
	 else  (* add something here ?*)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   836
	      (goals_being_watched := (!goals_being_watched) -1;
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   837
	       Pretty.writeln(Pretty.str ( (concat[(oct_char "360"), (oct_char "377")])));
17231
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   838
	       Pretty.writeln(Pretty.str ("Ran out of options in handler"));
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   839
	       Pretty.writeln(Pretty.str  (oct_char "361"));
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   840
	       if (!goals_being_watched = 0)
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   841
	       then (File.write (File.tmp_path (Path.basic "foo_reap_comp"))
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   842
		     ("Reaping a watcher, goals watched is: " ^
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   843
			(string_of_int (!goals_being_watched))^"\n");
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   844
		    killWatcher (childpid);  reapWatcher (childpid,childin, childout);()
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   845
		    )
f42bc4f7afdf tidying up the Isabelle/ATP interface
paulson
parents: 17216
diff changeset
   846
	       else () )
17216
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   847
       end)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   848
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   849
 in IsaSignal.signal (IsaSignal.usr1, IsaSignal.SIG_HANDLE vampire_proofHandler);
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   850
    IsaSignal.signal (IsaSignal.usr2, IsaSignal.SIG_HANDLE spass_proofHandler);
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   851
    (childin, childout, childpid)
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   852
df66d8feec63 improved formatting
paulson
parents: 17150
diff changeset
   853
  end
15642
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   854
028059faa963 *** empty log message ***
quigley
parents:
diff changeset
   855
end (* structure Watcher *)