src/HOL/Mutabelle/mutabelle_extra.ML
author bulwahn
Mon Jan 25 16:19:42 2010 +0100 (2010-01-25 ago)
changeset 34965 3b4762c1052c
child 34974 18b41bba42b5
permissions -rw-r--r--
adding Mutabelle to repository
bulwahn@34965
     1
(*
bulwahn@34965
     2
    Title:      HOL/Mutabelle/mutabelle_extra.ML
bulwahn@34965
     3
    Author:     Stefan Berghofer, Jasmin Blanchette, Lukas Bulwahn, TU Muenchen
bulwahn@34965
     4
bulwahn@34965
     5
    Invokation of Counterexample generators
bulwahn@34965
     6
*)
bulwahn@34965
     7
signature MUTABELLE_EXTRA =
bulwahn@34965
     8
sig
bulwahn@34965
     9
bulwahn@34965
    10
val take_random : int -> 'a list -> 'a list
bulwahn@34965
    11
bulwahn@34965
    12
datatype outcome = GenuineCex | PotentialCex | NoCex | Donno | Timeout | Error
bulwahn@34965
    13
type mtd = string * (theory -> term -> outcome)
bulwahn@34965
    14
bulwahn@34965
    15
type mutant_subentry = term * (string * outcome) list
bulwahn@34965
    16
type detailed_entry = string * bool * term * mutant_subentry list
bulwahn@34965
    17
bulwahn@34965
    18
type subentry = string * int * int * int * int * int * int
bulwahn@34965
    19
type entry = string * bool * subentry list
bulwahn@34965
    20
type report = entry list
bulwahn@34965
    21
bulwahn@34965
    22
val quickcheck_mtd : string -> mtd
bulwahn@34965
    23
(*
bulwahn@34965
    24
val refute_mtd : mtd
bulwahn@34965
    25
val nitpick_mtd : mtd
bulwahn@34965
    26
*)
bulwahn@34965
    27
bulwahn@34965
    28
val freezeT : term -> term
bulwahn@34965
    29
val thms_of : bool -> theory -> thm list
bulwahn@34965
    30
bulwahn@34965
    31
val string_for_report : report -> string
bulwahn@34965
    32
val write_report : string -> report -> unit
bulwahn@34965
    33
val mutate_theorems_and_write_report :
bulwahn@34965
    34
  theory -> mtd list -> thm list -> string -> unit
bulwahn@34965
    35
bulwahn@34965
    36
val random_seed : real Unsynchronized.ref
bulwahn@34965
    37
end;
bulwahn@34965
    38
bulwahn@34965
    39
structure MutabelleExtra : MUTABELLE_EXTRA =
bulwahn@34965
    40
struct
bulwahn@34965
    41
bulwahn@34965
    42
(* Own seed; can't rely on the Isabelle one to stay the same *)
bulwahn@34965
    43
val random_seed = Unsynchronized.ref 1.0;
bulwahn@34965
    44
bulwahn@34965
    45
bulwahn@34965
    46
(* mutation options *)
bulwahn@34965
    47
val max_mutants = 4
bulwahn@34965
    48
val num_mutations = 1
bulwahn@34965
    49
(* soundness check: *)
bulwahn@34965
    50
val max_mutants = 1
bulwahn@34965
    51
val num_mutations = 0
bulwahn@34965
    52
bulwahn@34965
    53
(* quickcheck options *)
bulwahn@34965
    54
(*val quickcheck_generator = "SML"*)
bulwahn@34965
    55
val iterations = 100
bulwahn@34965
    56
val size = 5
bulwahn@34965
    57
bulwahn@34965
    58
exception RANDOM;
bulwahn@34965
    59
bulwahn@34965
    60
fun rmod x y = x - y * Real.realFloor (x / y);
bulwahn@34965
    61
bulwahn@34965
    62
local
bulwahn@34965
    63
  val a = 16807.0;
bulwahn@34965
    64
  val m = 2147483647.0;
bulwahn@34965
    65
in
bulwahn@34965
    66
bulwahn@34965
    67
fun random () = CRITICAL (fn () =>
bulwahn@34965
    68
  let val r = rmod (a * ! random_seed) m
bulwahn@34965
    69
  in (random_seed := r; r) end);
bulwahn@34965
    70
bulwahn@34965
    71
end;
bulwahn@34965
    72
bulwahn@34965
    73
fun random_range l h =
bulwahn@34965
    74
  if h < l orelse l < 0 then raise RANDOM
bulwahn@34965
    75
  else l + Real.floor (rmod (random ()) (real (h - l + 1)));
bulwahn@34965
    76
bulwahn@34965
    77
datatype outcome = GenuineCex | PotentialCex | NoCex | Donno | Timeout | Error
bulwahn@34965
    78
type mtd = string * (theory -> term -> outcome)
bulwahn@34965
    79
bulwahn@34965
    80
type mutant_subentry = term * (string * outcome) list
bulwahn@34965
    81
type detailed_entry = string * bool * term * mutant_subentry list
bulwahn@34965
    82
bulwahn@34965
    83
bulwahn@34965
    84
type subentry = string * int * int * int * int * int * int
bulwahn@34965
    85
type entry = string * bool * subentry list
bulwahn@34965
    86
type report = entry list
bulwahn@34965
    87
bulwahn@34965
    88
fun inst_type insts (Type (s, Ts)) = Type (s, map (inst_type insts) Ts)
bulwahn@34965
    89
  | inst_type insts T = the_default HOLogic.intT (AList.lookup op = insts T)
bulwahn@34965
    90
bulwahn@34965
    91
fun preprocess thy insts t = ObjectLogic.atomize_term thy
bulwahn@34965
    92
 (map_types (inst_type insts) (Mutabelle.freeze t));
bulwahn@34965
    93
bulwahn@34965
    94
fun invoke_quickcheck quickcheck_generator thy t =
bulwahn@34965
    95
  TimeLimit.timeLimit (Time.fromSeconds (! Auto_Counterexample.time_limit))
bulwahn@34965
    96
      (fn _ =>
bulwahn@34965
    97
          case Quickcheck.test_term (ProofContext.init thy) false (SOME quickcheck_generator)
bulwahn@34965
    98
                                    size iterations (preprocess thy [] t) of
bulwahn@34965
    99
            NONE => NoCex
bulwahn@34965
   100
          | SOME _ => GenuineCex) ()
bulwahn@34965
   101
  handle TimeLimit.TimeOut => Timeout
bulwahn@34965
   102
bulwahn@34965
   103
fun quickcheck_mtd quickcheck_generator =
bulwahn@34965
   104
  ("quickcheck_" ^ quickcheck_generator, invoke_quickcheck quickcheck_generator)
bulwahn@34965
   105
bulwahn@34965
   106
  (*
bulwahn@34965
   107
fun invoke_refute thy t =
bulwahn@34965
   108
  let
bulwahn@34965
   109
    val res = MyRefute.refute_term thy [] t
bulwahn@34965
   110
    val _ = priority ("Refute: " ^ res)
bulwahn@34965
   111
  in
bulwahn@34965
   112
    case res of
bulwahn@34965
   113
      "genuine" => GenuineCex
bulwahn@34965
   114
    | "likely_genuine" => GenuineCex
bulwahn@34965
   115
    | "potential" => PotentialCex
bulwahn@34965
   116
    | "none" => NoCex
bulwahn@34965
   117
    | "unknown" => Donno
bulwahn@34965
   118
    | _ => Error
bulwahn@34965
   119
  end
bulwahn@34965
   120
  handle MyRefute.REFUTE (loc, details) =>
bulwahn@34965
   121
         (error ("Unhandled Refute error (" ^ quote loc ^ "): " ^ details ^
bulwahn@34965
   122
                   "."))
bulwahn@34965
   123
val refute_mtd = ("refute", invoke_refute)
bulwahn@34965
   124
*)
bulwahn@34965
   125
bulwahn@34965
   126
(*
bulwahn@34965
   127
open Nitpick_Util
bulwahn@34965
   128
open Nitpick_Rep
bulwahn@34965
   129
open Nitpick_Nut
bulwahn@34965
   130
bulwahn@34965
   131
fun invoke_nitpick thy t =
bulwahn@34965
   132
  let
bulwahn@34965
   133
    val ctxt = ProofContext.init thy
bulwahn@34965
   134
    val state = Proof.init ctxt
bulwahn@34965
   135
  in
bulwahn@34965
   136
    let
bulwahn@34965
   137
      val (res, _) = Nitpick.pick_nits_in_term state (Nitpick_Isar.default_params thy []) false [] t
bulwahn@34965
   138
      val _ = priority ("Nitpick: " ^ res)
bulwahn@34965
   139
    in
bulwahn@34965
   140
      case res of
bulwahn@34965
   141
        "genuine" => GenuineCex
bulwahn@34965
   142
      | "likely_genuine" => GenuineCex
bulwahn@34965
   143
      | "potential" => PotentialCex
bulwahn@34965
   144
      | "none" => NoCex
bulwahn@34965
   145
      | "unknown" => Donno
bulwahn@34965
   146
      | _ => Error
bulwahn@34965
   147
    end
bulwahn@34965
   148
    handle ARG (loc, details) =>
bulwahn@34965
   149
           (error ("Bad argument(s) to " ^ quote loc ^ ": " ^ details ^ "."))
bulwahn@34965
   150
         | BAD (loc, details) =>
bulwahn@34965
   151
           (error ("Internal error (" ^ quote loc ^ "): " ^ details ^ "."))
bulwahn@34965
   152
         | LIMIT (_, details) =>
bulwahn@34965
   153
           (warning ("Limit reached: " ^ details ^ "."); Donno)
bulwahn@34965
   154
         | NOT_SUPPORTED details =>
bulwahn@34965
   155
           (warning ("Unsupported case: " ^ details ^ "."); Donno)
bulwahn@34965
   156
         | NUT (loc, us) =>
bulwahn@34965
   157
           (error ("Invalid nut" ^ plural_s_for_list us ^
bulwahn@34965
   158
                   " (" ^ quote loc ^ "): " ^
bulwahn@34965
   159
                  commas (map (string_for_nut ctxt) us) ^ "."))
bulwahn@34965
   160
         | REP (loc, Rs) =>
bulwahn@34965
   161
           (error ("Invalid representation" ^ plural_s_for_list Rs ^
bulwahn@34965
   162
                   " (" ^ quote loc ^ "): " ^
bulwahn@34965
   163
                   commas (map string_for_rep Rs) ^ "."))
bulwahn@34965
   164
         | TERM (loc, ts) =>
bulwahn@34965
   165
           (error ("Invalid term" ^ plural_s_for_list ts ^
bulwahn@34965
   166
                   " (" ^ quote loc ^ "): " ^
bulwahn@34965
   167
                   commas (map (Syntax.string_of_term ctxt) ts) ^ "."))
bulwahn@34965
   168
         | TYPE (loc, Ts, ts) =>
bulwahn@34965
   169
           (error ("Invalid type" ^ plural_s_for_list Ts ^
bulwahn@34965
   170
                   (if null ts then
bulwahn@34965
   171
                      ""
bulwahn@34965
   172
                    else
bulwahn@34965
   173
                      " for term" ^ plural_s_for_list ts ^ " " ^
bulwahn@34965
   174
                      commas (map (quote o Syntax.string_of_term ctxt) ts)) ^
bulwahn@34965
   175
                   " (" ^ quote loc ^ "): " ^
bulwahn@34965
   176
                   commas (map (Syntax.string_of_typ ctxt) Ts) ^ "."))
bulwahn@34965
   177
         | Kodkod.SYNTAX (_, details) =>
bulwahn@34965
   178
           (warning ("Ill-formed Kodkodi output: " ^ details ^ "."); Error)
bulwahn@34965
   179
         | Refute.REFUTE (loc, details) =>
bulwahn@34965
   180
           (error ("Unhandled Refute error (" ^ quote loc ^ "): " ^ details ^
bulwahn@34965
   181
                   "."))
bulwahn@34965
   182
         | Exn.Interrupt => raise Exn.Interrupt
bulwahn@34965
   183
         | _ => (priority ("Unknown error in Nitpick"); Error)
bulwahn@34965
   184
  end
bulwahn@34965
   185
val nitpick_mtd = ("nitpick", invoke_nitpick)
bulwahn@34965
   186
*)
bulwahn@34965
   187
bulwahn@34965
   188
val comms = [@{const_name "op ="}, @{const_name "op |"}, @{const_name "op &"}]
bulwahn@34965
   189
bulwahn@34965
   190
val forbidden =
bulwahn@34965
   191
 [(* (@{const_name "power"}, "'a"), *)
bulwahn@34965
   192
  ("HOL.induct_equal", "'a"),
bulwahn@34965
   193
  ("HOL.induct_implies", "'a"),
bulwahn@34965
   194
  ("HOL.induct_conj", "'a"),
bulwahn@34965
   195
  (@{const_name "undefined"}, "'a"),
bulwahn@34965
   196
  (@{const_name "default"}, "'a"),
bulwahn@34965
   197
  (@{const_name "dummy_pattern"}, "'a::{}") (*,
bulwahn@34965
   198
  (@{const_name "uminus"}, "'a"),
bulwahn@34965
   199
  (@{const_name "Nat.size"}, "'a"),
bulwahn@34965
   200
  (@{const_name "HOL.abs"}, "'a") *)]
bulwahn@34965
   201
bulwahn@34965
   202
val forbidden_thms =
bulwahn@34965
   203
 ["finite_intvl_succ_class",
bulwahn@34965
   204
  "nibble"]
bulwahn@34965
   205
bulwahn@34965
   206
val forbidden_consts =
bulwahn@34965
   207
 [@{const_name nibble_pair_of_char}]
bulwahn@34965
   208
bulwahn@34965
   209
fun is_forbidden_theorem (s, th) =
bulwahn@34965
   210
  let val consts = Term.add_const_names (prop_of th) [] in
bulwahn@34965
   211
    exists (fn s' => s' mem space_explode "." s) forbidden_thms orelse
bulwahn@34965
   212
    exists (fn s' => s' mem forbidden_consts) consts orelse
bulwahn@34965
   213
    length (space_explode "." s) <> 2 orelse
bulwahn@34965
   214
    String.isPrefix "type_definition" (List.last (space_explode "." s)) orelse
bulwahn@34965
   215
    String.isSuffix "_def" s orelse
bulwahn@34965
   216
    String.isSuffix "_raw" s
bulwahn@34965
   217
  end
bulwahn@34965
   218
bulwahn@34965
   219
fun is_forbidden_mutant t =
bulwahn@34965
   220
  let val consts = Term.add_const_names t [] in
bulwahn@34965
   221
    exists (String.isPrefix "Nitpick") consts orelse
bulwahn@34965
   222
    exists (String.isSubstring "_sumC") consts (* internal function *)
bulwahn@34965
   223
  end
bulwahn@34965
   224
bulwahn@34965
   225
fun is_executable_term thy t = can (TimeLimit.timeLimit (Time.fromMilliseconds 2000) (Quickcheck.test_term
bulwahn@34965
   226
 (ProofContext.init thy) false (SOME "SML") 1 0)) (preprocess thy [] t)
bulwahn@34965
   227
fun is_executable_thm thy th = is_executable_term thy (prop_of th)
bulwahn@34965
   228
bulwahn@34965
   229
val freezeT =
bulwahn@34965
   230
  map_types (map_type_tvar (fn ((a, i), S) =>
bulwahn@34965
   231
    TFree (if i = 0 then a else a ^ "_" ^ string_of_int i, S)))
bulwahn@34965
   232
bulwahn@34965
   233
fun thms_of all thy =
bulwahn@34965
   234
  filter
bulwahn@34965
   235
    (fn th => (all orelse Context.theory_name (theory_of_thm th) = Context.theory_name thy)
bulwahn@34965
   236
      (* andalso is_executable_thm thy th *))
bulwahn@34965
   237
    (map snd (filter_out is_forbidden_theorem (Mutabelle.all_unconcealed_thms_of thy)))
bulwahn@34965
   238
bulwahn@34965
   239
val count = length oo filter o equal
bulwahn@34965
   240
bulwahn@34965
   241
fun take_random 0 _ = []
bulwahn@34965
   242
  | take_random _ [] = []
bulwahn@34965
   243
  | take_random n xs =
bulwahn@34965
   244
    let val j = random_range 0 (length xs - 1) in
bulwahn@34965
   245
      Library.nth xs j :: take_random (n - 1) (nth_drop j xs)
bulwahn@34965
   246
    end
bulwahn@34965
   247
bulwahn@34965
   248
fun safe_invoke_mtd thy (mtd_name, invoke_mtd) t =
bulwahn@34965
   249
  let
bulwahn@34965
   250
    val _ = priority ("Invoking " ^ mtd_name)
bulwahn@34965
   251
    val res = case try (invoke_mtd thy) t of
bulwahn@34965
   252
                SOME res => res
bulwahn@34965
   253
              | NONE => (priority ("**** PROBLEMS WITH " ^
bulwahn@34965
   254
                                 Syntax.string_of_term_global thy t); Error)
bulwahn@34965
   255
    val _ = priority (" Done")
bulwahn@34965
   256
  in res end
bulwahn@34965
   257
bulwahn@34965
   258
(* theory -> term list -> mtd -> subentry *)
bulwahn@34965
   259
fun test_mutants_using_one_method thy mutants (mtd_name, invoke_mtd) =
bulwahn@34965
   260
  let
bulwahn@34965
   261
     val res = map (safe_invoke_mtd thy (mtd_name, invoke_mtd)) mutants
bulwahn@34965
   262
  in
bulwahn@34965
   263
    (mtd_name, count GenuineCex res, count PotentialCex res, count NoCex res,
bulwahn@34965
   264
     count Donno res, count Timeout res, count Error res)
bulwahn@34965
   265
  end
bulwahn@34965
   266
bulwahn@34965
   267
fun create_entry thy thm exec mutants mtds =
bulwahn@34965
   268
  (Thm.get_name thm, exec, map (test_mutants_using_one_method thy mutants) mtds)
bulwahn@34965
   269
bulwahn@34965
   270
fun create_detailed_entry thy thm exec mutants mtds =
bulwahn@34965
   271
  let
bulwahn@34965
   272
    fun create_mutant_subentry mutant = (mutant,
bulwahn@34965
   273
      map (fn (mtd_name, invoke_mtd) =>
bulwahn@34965
   274
        (mtd_name, safe_invoke_mtd thy (mtd_name, invoke_mtd) mutant)) mtds)
bulwahn@34965
   275
  in
bulwahn@34965
   276
    (Thm.get_name thm, exec, prop_of thm, map create_mutant_subentry mutants)
bulwahn@34965
   277
  end
bulwahn@34965
   278
bulwahn@34965
   279
(* (theory -> thm -> bool -> term list -> mtd list -> 'a) -> theory -> mtd list -> thm -> 'a *)
bulwahn@34965
   280
fun mutate_theorem create_entry thy mtds thm =
bulwahn@34965
   281
  let
bulwahn@34965
   282
    val pp = Syntax.pp_global thy
bulwahn@34965
   283
    val exec = is_executable_thm thy thm
bulwahn@34965
   284
    val _ = priority (if exec then "EXEC" else "NOEXEC")
bulwahn@34965
   285
    val mutants =
bulwahn@34965
   286
          (if num_mutations = 0 then
bulwahn@34965
   287
             [Thm.prop_of thm]
bulwahn@34965
   288
           else
bulwahn@34965
   289
             Mutabelle.mutate_mix (Thm.prop_of thm) thy comms forbidden
bulwahn@34965
   290
                                  num_mutations)
bulwahn@34965
   291
             |> filter_out is_forbidden_mutant
bulwahn@34965
   292
    val mutants =
bulwahn@34965
   293
      if exec then
bulwahn@34965
   294
        let
bulwahn@34965
   295
          val _ = priority ("BEFORE PARTITION OF " ^
bulwahn@34965
   296
                            Int.toString (length mutants) ^ " MUTANTS")
bulwahn@34965
   297
          val (execs, noexecs) = List.partition (is_executable_term thy) (take_random (20 * max_mutants) mutants)
bulwahn@34965
   298
          val _ = tracing ("AFTER PARTITION (" ^ Int.toString (length execs) ^
bulwahn@34965
   299
                           " vs " ^ Int.toString (length noexecs) ^ ")")
bulwahn@34965
   300
        in
bulwahn@34965
   301
          execs @ take_random (Int.max (0, max_mutants - length execs)) noexecs
bulwahn@34965
   302
        end
bulwahn@34965
   303
      else
bulwahn@34965
   304
        mutants
bulwahn@34965
   305
    val mutants = mutants
bulwahn@34965
   306
          |> take_random max_mutants
bulwahn@34965
   307
          |> map Mutabelle.freeze |> map freezeT
bulwahn@34965
   308
(*          |> filter (not o is_forbidden_mutant) *)
bulwahn@34965
   309
          |> List.mapPartial (try (Sign.cert_term thy))
bulwahn@34965
   310
    val _ = map (fn t => priority ("MUTANT: " ^ Pretty.string_of (Pretty.term pp t))) mutants
bulwahn@34965
   311
  in
bulwahn@34965
   312
    create_entry thy thm exec mutants mtds
bulwahn@34965
   313
  end
bulwahn@34965
   314
bulwahn@34965
   315
(* theory -> mtd list -> thm list -> report *)
bulwahn@34965
   316
val mutate_theorems = map ooo mutate_theorem
bulwahn@34965
   317
bulwahn@34965
   318
fun string_of_outcome GenuineCex = "GenuineCex"
bulwahn@34965
   319
  | string_of_outcome PotentialCex = "PotentialCex"
bulwahn@34965
   320
  | string_of_outcome NoCex = "NoCex"
bulwahn@34965
   321
  | string_of_outcome Donno = "Donno"
bulwahn@34965
   322
  | string_of_outcome Timeout = "Timeout"
bulwahn@34965
   323
  | string_of_outcome Error = "Error"
bulwahn@34965
   324
bulwahn@34965
   325
fun string_of_mutant_subentry thy (t, results) =
bulwahn@34965
   326
  "mutant: " ^ Syntax.string_of_term_global thy t ^ "\n" ^
bulwahn@34965
   327
  space_implode "; " (map (fn (mtd_name, outcome) => mtd_name ^ ": " ^ string_of_outcome outcome) results) ^
bulwahn@34965
   328
  "\n"
bulwahn@34965
   329
bulwahn@34965
   330
fun string_of_detailed_entry thy (thm_name, exec, t, mutant_subentries) = 
bulwahn@34965
   331
   thm_name ^ " " ^ (if exec then "[exe]" else "[noexe]") ^ ": " ^
bulwahn@34965
   332
   Syntax.string_of_term_global thy t ^ "\n" ^
bulwahn@34965
   333
   cat_lines (map (string_of_mutant_subentry thy) mutant_subentries) ^ "\n"
bulwahn@34965
   334
bulwahn@34965
   335
(* subentry -> string *)
bulwahn@34965
   336
fun string_for_subentry (mtd_name, genuine_cex, potential_cex, no_cex, donno,
bulwahn@34965
   337
                         timeout, error) =
bulwahn@34965
   338
  "    " ^ mtd_name ^ ": " ^ Int.toString genuine_cex ^ "+ " ^
bulwahn@34965
   339
  Int.toString potential_cex ^ "= " ^ Int.toString no_cex ^ "- " ^
bulwahn@34965
   340
  Int.toString donno ^ "? " ^ Int.toString timeout ^ "T " ^
bulwahn@34965
   341
  Int.toString error ^ "!"
bulwahn@34965
   342
(* entry -> string *)
bulwahn@34965
   343
fun string_for_entry (thm_name, exec, subentries) =
bulwahn@34965
   344
  thm_name ^ " " ^ (if exec then "[exe]" else "[noexe]") ^ ":\n" ^
bulwahn@34965
   345
  cat_lines (map string_for_subentry subentries) ^ "\n"
bulwahn@34965
   346
(* report -> string *)
bulwahn@34965
   347
fun string_for_report report = cat_lines (map string_for_entry report)
bulwahn@34965
   348
bulwahn@34965
   349
(* string -> report -> unit *)
bulwahn@34965
   350
fun write_report file_name =
bulwahn@34965
   351
  File.write (Path.explode file_name) o string_for_report
bulwahn@34965
   352
bulwahn@34965
   353
(* theory -> mtd list -> thm list -> string -> unit *)
bulwahn@34965
   354
fun mutate_theorems_and_write_report thy mtds thms file_name =
bulwahn@34965
   355
  let
bulwahn@34965
   356
    val _ = priority "Starting Mutabelle..."
bulwahn@34965
   357
    val path = Path.explode file_name
bulwahn@34965
   358
    (* for normal report: *)
bulwahn@34965
   359
    (*val (gen_create_entry, gen_string_for_entry) = (create_entry, string_for_entry)*)
bulwahn@34965
   360
    (*for detailled report: *)
bulwahn@34965
   361
    val (gen_create_entry, gen_string_for_entry) =
bulwahn@34965
   362
      (create_detailed_entry, string_of_detailed_entry thy)
bulwahn@34965
   363
  in
bulwahn@34965
   364
    File.write path (
bulwahn@34965
   365
    "Mutation options = "  ^
bulwahn@34965
   366
      "max_mutants: " ^ string_of_int max_mutants ^
bulwahn@34965
   367
      "; num_mutations: " ^ string_of_int num_mutations ^ "\n" ^
bulwahn@34965
   368
    "QC options = " ^
bulwahn@34965
   369
      (*"quickcheck_generator: " ^ quickcheck_generator ^ ";*)
bulwahn@34965
   370
      "size: " ^ string_of_int size ^
bulwahn@34965
   371
      "; iterations: " ^ string_of_int iterations ^ "\n");
bulwahn@34965
   372
    map (File.append path o gen_string_for_entry o mutate_theorem gen_create_entry thy mtds) thms;
bulwahn@34965
   373
    ()
bulwahn@34965
   374
  end
bulwahn@34965
   375
bulwahn@34965
   376
end;