src/HOL/Quickcheck_Exhaustive.thy
changeset 42305 494c31fdec95
parent 42304 34366f39d32d
child 42310 c664cc5cc5e9
equal deleted inserted replaced
42304:34366f39d32d 42305:494c31fdec95
   388 subsection {* Bounded universal quantifiers *}
   388 subsection {* Bounded universal quantifiers *}
   389 
   389 
   390 class bounded_forall =
   390 class bounded_forall =
   391   fixes bounded_forall :: "('a \<Rightarrow> bool) \<Rightarrow> code_numeral \<Rightarrow> bool"
   391   fixes bounded_forall :: "('a \<Rightarrow> bool) \<Rightarrow> code_numeral \<Rightarrow> bool"
   392 
   392 
       
   393 subsection {* Fast exhaustive combinators *}
       
   394 
       
   395 
       
   396 class fast_exhaustive = term_of +
       
   397   fixes fast_exhaustive :: "('a \<Rightarrow> unit) \<Rightarrow> code_numeral \<Rightarrow> unit"
       
   398 
       
   399 consts throw_Counterexample :: "term list => unit"
       
   400 consts catch_Counterexample :: "unit => term list option"
       
   401 
       
   402 code_const throw_Counterexample
       
   403   (Quickcheck "raise (Exhaustive'_Generators.Counterexample _)")
       
   404 code_const catch_Counterexample
       
   405   (Quickcheck "(((_); NONE) handle Exhaustive'_Generators.Counterexample ts => SOME ts)")
       
   406 
   393 subsection {* Defining combinators for any first-order data type *}
   407 subsection {* Defining combinators for any first-order data type *}
   394 
   408 
   395 definition catch_match :: "term list option => term list option => term list option"
   409 definition catch_match :: "term list option => term list option => term list option"
   396 where
   410 where
   397   [code del]: "catch_match t1 t2 = (SOME t. t = t1 \<or> t = t2)"
   411   [code del]: "catch_match t1 t2 = (SOME t. t = t1 \<or> t = t2)"