| 3210 |      1 | (*  Title:      HOL/Modelcheck/MuCalculus.ML
 | 
|  |      2 |     ID:         $Id$
 | 
|  |      3 |     Author:     Olaf Mueller, Jan Philipps, Robert Sandner
 | 
|  |      4 |     Copyright   1997  TU Muenchen
 | 
|  |      5 | *)
 | 
|  |      6 | 
 | 
|  |      7 | exception MCOracleExn of term;
 | 
|  |      8 | exception MCFailureExn of string;
 | 
|  |      9 | 
 | 
|  |     10 | 
 | 
|  |     11 | val trace_mc = ref false;
 | 
|  |     12 | 
 | 
| 3818 |     13 | local
 | 
| 3210 |     14 | 
 | 
|  |     15 | fun termtext sign term =
 | 
|  |     16 |   setmp print_mode ["Eindhoven"]
 | 
|  |     17 |     (Sign.string_of_term sign) term;
 | 
|  |     18 | 
 | 
|  |     19 | fun call_mc s =
 | 
|  |     20 |   execute ( "echo \"" ^ s ^ "\" | pmu -w" );
 | 
|  |     21 | 
 | 
| 3818 |     22 | in
 | 
| 3210 |     23 | 
 | 
|  |     24 | fun mk_mc_oracle (sign, MCOracleExn trm) =
 | 
|  |     25 |   let
 | 
|  |     26 |     val tmtext = termtext sign trm;
 | 
|  |     27 |     val debug = writeln ("MC debugger: " ^ tmtext);
 | 
|  |     28 |     val result = call_mc tmtext;
 | 
|  |     29 |   in
 | 
|  |     30 |     if ! trace_mc then
 | 
|  |     31 |       (writeln tmtext; writeln("----"); writeln result)
 | 
|  |     32 |     else ();
 | 
|  |     33 |     (case result of
 | 
|  |     34 |       "TRUE\n"  =>  trm |
 | 
|  |     35 |       "FALSE\n" => (error "MC oracle yields FALSE") |
 | 
|  |     36 |     _ => (error ("MC syntax error: " ^ result)))
 | 
|  |     37 |   end;
 | 
| 3818 |     38 | 
 | 
|  |     39 | end;
 |