src/HOL/Tools/Quickcheck/narrowing_generators.ML
changeset 48272 db75b4005d9a
parent 48270 9cfd3e7ad5c8
child 48565 7c497a239007
equal deleted inserted replaced
48271:b28defd0b5a5 48272:db75b4005d9a
    58     |> Class.prove_instantiation_exit (K (Class.intro_classes_tac []))
    58     |> Class.prove_instantiation_exit (K (Class.intro_classes_tac []))
    59   end;
    59   end;
    60 
    60 
    61 fun ensure_partial_term_of (tyco, (raw_vs, _)) thy =
    61 fun ensure_partial_term_of (tyco, (raw_vs, _)) thy =
    62   let
    62   let
    63     val need_inst = not (can (Sorts.mg_domain (Sign.classes_of thy) tyco) @{sort partial_term_of})
    63     val need_inst = not (Sorts.has_instance (Sign.classes_of thy) tyco @{sort partial_term_of})
    64       andalso can (Sorts.mg_domain (Sign.classes_of thy) tyco) @{sort typerep};
    64       andalso Sorts.has_instance (Sign.classes_of thy) tyco @{sort typerep};
    65   in if need_inst then add_partial_term_of tyco raw_vs thy else thy end;
    65   in if need_inst then add_partial_term_of tyco raw_vs thy else thy end;
    66 
    66 
    67 
    67 
    68 (** code equations for datatypes **)
    68 (** code equations for datatypes **)
    69 
    69 
   109     |> fold Code.add_eqn eqs
   109     |> fold Code.add_eqn eqs
   110   end;
   110   end;
   111 
   111 
   112 fun ensure_partial_term_of_code (tyco, (raw_vs, cs)) thy =
   112 fun ensure_partial_term_of_code (tyco, (raw_vs, cs)) thy =
   113   let
   113   let
   114     val has_inst = can (Sorts.mg_domain (Sign.classes_of thy) tyco) @{sort partial_term_of};
   114     val has_inst = Sorts.has_instance (Sign.classes_of thy) tyco @{sort partial_term_of};
   115   in if has_inst then add_partial_term_of_code tyco raw_vs cs thy else thy end;
   115   in if has_inst then add_partial_term_of_code tyco raw_vs cs thy else thy end;
   116 
   116 
   117 
   117 
   118 (* narrowing generators *)
   118 (* narrowing generators *)
   119 
   119