# HG changeset patch # User Lars Hupel # Date 1510672199 -3600 # Node ID fc877448602e585c3fc7ab94de32803306d7e76b # Parent f11486d3158630349ae9ef9b6e6221f4dabb2c58 instantiation char :: full_exhaustive by Andreas Lochbihler diff -r f11486d31586 -r fc877448602e src/HOL/Quickcheck_Exhaustive.thy --- a/src/HOL/Quickcheck_Exhaustive.thy Mon Nov 13 15:07:03 2017 +0100 +++ b/src/HOL/Quickcheck_Exhaustive.thy Tue Nov 14 16:09:59 2017 +0100 @@ -714,25 +714,23 @@ ML_file "Tools/Quickcheck/abstract_generators.ML" -(* FIXME instantiation char :: full_exhaustive +instantiation char :: full_exhaustive begin definition full_exhaustive_char where - "full_exhaustive f i = - (if 0 < i then full_exhaustive_class.full_exhaustive - (\(a, b). full_exhaustive_class.full_exhaustive - (\(c, d). - f (char_of_nat (nat_of_nibble a * 16 + nat_of_nibble c), - \_. Code_Evaluation.App (Code_Evaluation.App - (Code_Evaluation.Const (STR ''String.char.Char'') - (TYPEREP(nibble \ nibble \ char))) - (b ())) (d ()))) (i - 1)) (i - 1) - else None)" + "full_exhaustive_char f i = + (if 0 < i then + case f (0, \_ :: unit. Code_Evaluation.Const (STR ''Groups.zero_class.zero'') (TYPEREP(char))) of + Some x \ Some x + | None \ full_exhaustive_class.full_exhaustive + (\(num, t). f (char_of_nat (nat_of_num num), \_ :: unit. Code_Evaluation.App (Code_Evaluation.Const (STR ''String.Char'') TYPEREP(num \ char)) (t ()))) + (min (i - 1) 8) (* generate at most 8 bits *) + else None)" instance .. -end *) +end hide_fact (open) orelse_def no_notation orelse (infixr "orelse" 55)