Emacs regular-expression replacements to change "goal" proofs to
    "prove_goal" proofs ...
    These do not work in "sed" since they involve multiple lines 
    NOT COMPLETELY TESTED!


STEP 1: delimiting the identifier in "val ... = result()":
QUERY REPLACE REGEXP (note the leading newline character!*)
val \([^ ]*\)  *= *result();
WITH THE TEXT
\1


STEP 2: inserting the final result() identifier as val ... = prove_goal ...]);:
QUERY REPLACE REGEXP
val prems = goal \([^]*\)\([^]*\)
WITH THE TEXT
val \2 = prove_goal \1 ]);


STEP 3: replacing the final semicolon in "goal" with "(fn prems => [ "
QUERY REPLACE REGEXP
";\([^!-~]*\)by *\([^;]*\);
WITH THE TEXT
"\1 (fn prems =>
  [ \2,


STEP 4: replacing lines beginning "by ...;" with "...,"
QUERY REPLACE REGEXP
^by *\([^;]*\);
WITH THE TEXT
    \1,


STEP 5: removing the extra commas
QUERY REPLACE REGEXP
, *
 ])
WITH THE TEXT
 ])

