src/HOL/Tools/Quickcheck/narrowing_generators.ML
changeset 58659 6c9821c32dd5
parent 58225 f5144942a83a
child 58826 2ed2eaabe3df
equal deleted inserted replaced
58658:9002fe021e2f 58659:6c9821c32dd5
     4 Narrowing-based counterexample generation.
     4 Narrowing-based counterexample generation.
     5 *)
     5 *)
     6 
     6 
     7 signature NARROWING_GENERATORS =
     7 signature NARROWING_GENERATORS =
     8 sig
     8 sig
     9   val narrowing_plugin: string
       
    10   val allow_existentials : bool Config.T
     9   val allow_existentials : bool Config.T
    11   val finite_functions : bool Config.T
    10   val finite_functions : bool Config.T
    12   val overlord : bool Config.T
    11   val overlord : bool Config.T
    13   val ghc_options : string Config.T  (* FIXME prefer settings, i.e. getenv (!?) *)
    12   val ghc_options : string Config.T  (* FIXME prefer settings, i.e. getenv (!?) *)
    14   val active : bool Config.T
    13   val active : bool Config.T
    20   val setup: theory -> theory
    19   val setup: theory -> theory
    21 end;
    20 end;
    22 
    21 
    23 structure Narrowing_Generators : NARROWING_GENERATORS =
    22 structure Narrowing_Generators : NARROWING_GENERATORS =
    24 struct
    23 struct
    25 
       
    26 val narrowing_plugin = "quickcheck_narrowing"
       
    27 
    24 
    28 (* configurations *)
    25 (* configurations *)
    29 
    26 
    30 val allow_existentials = Attrib.setup_config_bool @{binding quickcheck_allow_existentials} (K true)
    27 val allow_existentials = Attrib.setup_config_bool @{binding quickcheck_allow_existentials} (K true)
    31 val finite_functions = Attrib.setup_config_bool @{binding quickcheck_finite_functions} (K true)
    28 val finite_functions = Attrib.setup_config_bool @{binding quickcheck_finite_functions} (K true)
   526 val active = Attrib.setup_config_bool @{binding quickcheck_narrowing_active} (K false);
   523 val active = Attrib.setup_config_bool @{binding quickcheck_narrowing_active} (K false);
   527 
   524 
   528 val setup =
   525 val setup =
   529   Code.datatype_interpretation ensure_partial_term_of
   526   Code.datatype_interpretation ensure_partial_term_of
   530   #> Code.datatype_interpretation ensure_partial_term_of_code
   527   #> Code.datatype_interpretation ensure_partial_term_of_code
   531   #> Quickcheck_Common.datatype_interpretation narrowing_plugin
   528   #> Quickcheck_Common.datatype_interpretation @{plugin quickcheck_narrowing}
   532     (@{sort narrowing}, instantiate_narrowing_datatype)
   529     (@{sort narrowing}, instantiate_narrowing_datatype)
   533   #> Context.theory_map (Quickcheck.add_tester ("narrowing", (active, test_goals)))
   530   #> Context.theory_map (Quickcheck.add_tester ("narrowing", (active, test_goals)))
   534     
   531     
   535 end;
   532 end;