src/HOL/Mutabelle/mutabelle.ML
changeset 40132 7ee65dbffa31
parent 39557 fe5722fce758
child 40248 2107581b404d
equal deleted inserted replaced
40131:7cbebd636e79 40132:7ee65dbffa31
   497  (map_types (inst_type insts) (freeze t));
   497  (map_types (inst_type insts) (freeze t));
   498 
   498 
   499 fun is_executable thy insts th =
   499 fun is_executable thy insts th =
   500  (Quickcheck.test_term
   500  (Quickcheck.test_term
   501     (ProofContext.init_global thy) false (SOME (!testgen_name)) 1 1 (preprocess thy insts (prop_of th));
   501     (ProofContext.init_global thy) false (SOME (!testgen_name)) 1 1 (preprocess thy insts (prop_of th));
   502   priority "executable"; true) handle ERROR s =>
   502   Output.urgent_message "executable"; true) handle ERROR s =>
   503     (priority ("not executable: " ^ s); false);
   503     (Output.urgent_message ("not executable: " ^ s); false);
   504 
   504 
   505 fun qc_recursive usedthy [] insts sz qciter acc = rev acc
   505 fun qc_recursive usedthy [] insts sz qciter acc = rev acc
   506  | qc_recursive usedthy (x::xs) insts sz qciter acc = qc_recursive usedthy xs insts sz qciter 
   506  | qc_recursive usedthy (x::xs) insts sz qciter acc = qc_recursive usedthy xs insts sz qciter 
   507      (priority ("qc_recursive: " ^ string_of_int (length xs)); ((x, pretty (the_default [] (Quickcheck.test_term
   507      (Output.urgent_message ("qc_recursive: " ^ string_of_int (length xs)); ((x, pretty (the_default [] (Quickcheck.test_term
   508        (ProofContext.init_global usedthy) false (SOME (!testgen_name)) sz qciter (preprocess usedthy insts x)))) :: acc))
   508        (ProofContext.init_global usedthy) false (SOME (!testgen_name)) sz qciter (preprocess usedthy insts x)))) :: acc))
   509           handle ERROR msg => (priority msg; qc_recursive usedthy xs insts sz qciter acc);
   509           handle ERROR msg => (Output.urgent_message msg; qc_recursive usedthy xs insts sz qciter acc);
   510 
   510 
   511 
   511 
   512 (*quickcheck-test the mutants created by function mutate with type-instantiation insts, 
   512 (*quickcheck-test the mutants created by function mutate with type-instantiation insts, 
   513 quickcheck-theory usedthy and qciter quickcheck-iterations *)
   513 quickcheck-theory usedthy and qciter quickcheck-iterations *)
   514 
   514 
   719 (*create a statistic representation of the call of function mutqc_thy*)
   719 (*create a statistic representation of the call of function mutqc_thy*)
   720 
   720 
   721 fun mutqc_thystat option p mutthy usedthy commutatives forbidden_funs iter insts sz qciter filename =
   721 fun mutqc_thystat option p mutthy usedthy commutatives forbidden_funs iter insts sz qciter filename =
   722  let
   722  let
   723    val thmlist = filter
   723    val thmlist = filter
   724      (fn (s, th) => not (p s th) andalso (priority s; is_executable mutthy insts th)) (thms_of mutthy)
   724      (fn (s, th) => not (p s th) andalso (Output.urgent_message s; is_executable mutthy insts th)) (thms_of mutthy)
   725    fun mutthmrec [] = ()
   725    fun mutthmrec [] = ()
   726    |   mutthmrec ((name,thm)::xs) =
   726    |   mutthmrec ((name,thm)::xs) =
   727      let          
   727      let          
   728        val _ = priority ("mutthmrec: " ^ name);
   728        val _ = Output.urgent_message ("mutthmrec: " ^ name);
   729        val mutated = mutate option (prop_of thm) usedthy
   729        val mutated = mutate option (prop_of thm) usedthy
   730            commutatives forbidden_funs iter
   730            commutatives forbidden_funs iter
   731        val (passednum,_,cenum,_) = qc_test mutated insts usedthy sz qciter
   731        val (passednum,_,cenum,_) = qc_test mutated insts usedthy sz qciter
   732        val thmname =  "\ntheorem " ^ name ^ ":"
   732        val thmname =  "\ntheorem " ^ name ^ ":"
   733        val pnumstring = string_of_int passednum
   733        val pnumstring = string_of_int passednum