src/HOL/Quickcheck_Exhaustive.thy
author bulwahn
Thu, 12 Jan 2012 10:19:33 +0100
changeset 46193 55a4769d0abe
parent 45925 cd4243c025bb
child 46305 8ea02e499d53
permissions -rw-r--r--
adding exhaustive instances for type constructor set
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40420
552563ea3304 adding code and theory for smallvalue generators, but do not setup the interpretation yet
bulwahn
parents:
diff changeset
     1
(* Author: Lukas Bulwahn, TU Muenchen *)
552563ea3304 adding code and theory for smallvalue generators, but do not setup the interpretation yet
bulwahn
parents:
diff changeset
     2
41916
80060d5f864a renaming constants in Quickcheck_Exhaustive theory
bulwahn
parents: 41915
diff changeset
     3
header {* A simple counterexample generator performing exhaustive testing *}
40420
552563ea3304 adding code and theory for smallvalue generators, but do not setup the interpretation yet
bulwahn
parents:
diff changeset
     4
41918
d2ab869f8b0b replacing naming of small by exhaustive
bulwahn
parents: 41916
diff changeset
     5
theory Quickcheck_Exhaustive
40420
552563ea3304 adding code and theory for smallvalue generators, but do not setup the interpretation yet
bulwahn
parents:
diff changeset
     6
imports Quickcheck
45925
cd4243c025bb quickcheck generators for abstract types; tuned
bulwahn
parents: 45818
diff changeset
     7
uses
cd4243c025bb quickcheck generators for abstract types; tuned
bulwahn
parents: 45818
diff changeset
     8
  ("Tools/Quickcheck/exhaustive_generators.ML")
cd4243c025bb quickcheck generators for abstract types; tuned
bulwahn
parents: 45818
diff changeset
     9
  ("Tools/Quickcheck/abstract_generators.ML")
40420
552563ea3304 adding code and theory for smallvalue generators, but do not setup the interpretation yet
bulwahn
parents:
diff changeset
    10
begin
552563ea3304 adding code and theory for smallvalue generators, but do not setup the interpretation yet
bulwahn
parents:
diff changeset
    11
41916
80060d5f864a renaming constants in Quickcheck_Exhaustive theory
bulwahn
parents: 41915
diff changeset
    12
subsection {* basic operations for exhaustive generators *}
41105
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
    13
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
    14
definition orelse :: "'a option => 'a option => 'a option" (infixr "orelse" 55)
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
    15
where
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
    16
  [code_unfold]: "x orelse y = (case x of Some x' => Some x' | None => y)"
40420
552563ea3304 adding code and theory for smallvalue generators, but do not setup the interpretation yet
bulwahn
parents:
diff changeset
    17
41916
80060d5f864a renaming constants in Quickcheck_Exhaustive theory
bulwahn
parents: 41915
diff changeset
    18
subsection {* exhaustive generator type classes *}
40420
552563ea3304 adding code and theory for smallvalue generators, but do not setup the interpretation yet
bulwahn
parents:
diff changeset
    19
41916
80060d5f864a renaming constants in Quickcheck_Exhaustive theory
bulwahn
parents: 41915
diff changeset
    20
class exhaustive = term_of +
45724
1f5fc44254d7 the simple exhaustive compilation also indicates if counterexample is potentially spurious;
bulwahn
parents: 45722
diff changeset
    21
  fixes exhaustive :: "('a \<Rightarrow> (bool * term list) option) \<Rightarrow> code_numeral \<Rightarrow> (bool * term list) option"
42310
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    22
  
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    23
class full_exhaustive = term_of +
45722
63b42a7db003 changing the exhaustive generator signatures;
bulwahn
parents: 45718
diff changeset
    24
  fixes full_exhaustive :: "('a * (unit => term) \<Rightarrow> (bool * term list) option) \<Rightarrow> code_numeral \<Rightarrow> (bool * term list) option"
40420
552563ea3304 adding code and theory for smallvalue generators, but do not setup the interpretation yet
bulwahn
parents:
diff changeset
    25
42310
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    26
instantiation code_numeral :: full_exhaustive
40639
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
    27
begin
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
    28
45722
63b42a7db003 changing the exhaustive generator signatures;
bulwahn
parents: 45718
diff changeset
    29
function full_exhaustive_code_numeral' :: "(code_numeral * (unit => term) => (bool * term list) option) => code_numeral => code_numeral => (bool * term list) option"
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    30
  where "full_exhaustive_code_numeral' f d i =
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    31
    (if d < i then None
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    32
    else (f (i, %_. Code_Evaluation.term_of i)) orelse (full_exhaustive_code_numeral' f d (i + 1)))"
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    33
by pat_completeness auto
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    34
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    35
termination
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    36
  by (relation "measure (%(_, d, i). Code_Numeral.nat_of (d + 1 - i))") auto
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    37
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    38
definition "full_exhaustive f d = full_exhaustive_code_numeral' f d 0"
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    39
42310
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    40
instance ..
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    41
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    42
end
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    43
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    44
instantiation code_numeral :: exhaustive
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    45
begin
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    46
45724
1f5fc44254d7 the simple exhaustive compilation also indicates if counterexample is potentially spurious;
bulwahn
parents: 45722
diff changeset
    47
function exhaustive_code_numeral' :: "(code_numeral => (bool * term list) option) => code_numeral => code_numeral => (bool * term list) option"
41916
80060d5f864a renaming constants in Quickcheck_Exhaustive theory
bulwahn
parents: 41915
diff changeset
    48
  where "exhaustive_code_numeral' f d i =
80060d5f864a renaming constants in Quickcheck_Exhaustive theory
bulwahn
parents: 41915
diff changeset
    49
    (if d < i then None
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    50
    else (f i orelse exhaustive_code_numeral' f d (i + 1)))"
41231
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    51
by pat_completeness auto
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    52
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    53
termination
41231
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    54
  by (relation "measure (%(_, d, i). Code_Numeral.nat_of (d + 1 - i))") auto
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    55
41916
80060d5f864a renaming constants in Quickcheck_Exhaustive theory
bulwahn
parents: 41915
diff changeset
    56
definition "exhaustive f d = exhaustive_code_numeral' f d 0"
41231
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    57
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    58
instance ..
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    59
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    60
end
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    61
41916
80060d5f864a renaming constants in Quickcheck_Exhaustive theory
bulwahn
parents: 41915
diff changeset
    62
instantiation nat :: exhaustive
41231
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    63
begin
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    64
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    65
definition "exhaustive f d = exhaustive (%x. f (Code_Numeral.nat_of x)) d"
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    66
42310
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    67
instance ..
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    68
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    69
end
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    70
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    71
instantiation nat :: full_exhaustive
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    72
begin
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    73
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    74
definition "full_exhaustive f d = full_exhaustive (%(x, xt). f (Code_Numeral.nat_of x, %_. Code_Evaluation.term_of (Code_Numeral.nat_of x))) d"
41231
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    75
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    76
instance ..
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    77
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    78
end
2e901158675e adding exhaustive tester instances for numeric types: code_numeral, nat, rat and real
bulwahn
parents: 41178
diff changeset
    79
41916
80060d5f864a renaming constants in Quickcheck_Exhaustive theory
bulwahn
parents: 41915
diff changeset
    80
instantiation int :: exhaustive
40639
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
    81
begin
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
    82
45724
1f5fc44254d7 the simple exhaustive compilation also indicates if counterexample is potentially spurious;
bulwahn
parents: 45722
diff changeset
    83
function exhaustive' :: "(int => (bool * term list) option) => int => int => (bool * term list) option"
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
    84
  where "exhaustive' f d i = (if d < i then None else (f i orelse exhaustive' f d (i + 1)))"
40639
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
    85
by pat_completeness auto
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
    86
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
    87
termination 
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
    88
  by (relation "measure (%(_, d, i). nat (d + 1 - i))") auto
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
    89
41916
80060d5f864a renaming constants in Quickcheck_Exhaustive theory
bulwahn
parents: 41915
diff changeset
    90
definition "exhaustive f d = exhaustive' f (Code_Numeral.int_of d) (- (Code_Numeral.int_of d))"
40639
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
    91
42310
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    92
instance ..
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    93
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    94
end
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    95
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    96
instantiation int :: full_exhaustive
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    97
begin
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
    98
45722
63b42a7db003 changing the exhaustive generator signatures;
bulwahn
parents: 45718
diff changeset
    99
function full_exhaustive' :: "(int * (unit => term) => (bool * term list) option) => int => int => (bool * term list) option"
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   100
  where "full_exhaustive' f d i = (if d < i then None else (case f (i, %_. Code_Evaluation.term_of i) of Some t => Some t | None => full_exhaustive' f d (i + 1)))"
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   101
by pat_completeness auto
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   102
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   103
termination 
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   104
  by (relation "measure (%(_, d, i). nat (d + 1 - i))") auto
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   105
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   106
definition "full_exhaustive f d = full_exhaustive' f (Code_Numeral.int_of d) (- (Code_Numeral.int_of d))"
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   107
40639
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   108
instance ..
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   109
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   110
end
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   111
41916
80060d5f864a renaming constants in Quickcheck_Exhaustive theory
bulwahn
parents: 41915
diff changeset
   112
instantiation prod :: (exhaustive, exhaustive) exhaustive
40639
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   113
begin
40899
ef6fde932f4c improving readability of Smallcheck theory; adding constant orelse to improve performance of the function package
bulwahn
parents: 40639
diff changeset
   114
40639
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   115
definition
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   116
  "exhaustive f d = exhaustive (%x. exhaustive (%y. f ((x, y))) d) d"
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   117
42310
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
   118
instance ..
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
   119
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
   120
end
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
   121
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
   122
instantiation prod :: (full_exhaustive, full_exhaustive) full_exhaustive
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
   123
begin
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
   124
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   125
definition
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   126
  "full_exhaustive f d = full_exhaustive (%(x, t1). full_exhaustive (%(y, t2). f ((x, y),
41719
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   127
    %u. let T1 = (Typerep.typerep (TYPE('a)));
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   128
            T2 = (Typerep.typerep (TYPE('b)))
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   129
    in Code_Evaluation.App (Code_Evaluation.App (
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   130
      Code_Evaluation.Const (STR ''Product_Type.Pair'') 
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   131
      (Typerep.Typerep (STR ''fun'') [T1, Typerep.Typerep (STR ''fun'') [T2, Typerep.Typerep (STR ''Product_Type.prod'') [T1, T2]]]))
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   132
      (t1 ())) (t2 ()))) d) d"
40639
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   133
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   134
instance ..
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   135
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   136
end
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   137
46193
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   138
instantiation set :: (exhaustive) exhaustive
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   139
begin
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   140
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   141
fun exhaustive_set
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   142
where
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   143
  "exhaustive_set f i = (if i = 0 then None else (f {} orelse exhaustive_set (%A. f A orelse Quickcheck_Exhaustive.exhaustive (%x. if x \<in> A then None else f (insert x A)) (i - 1)) (i - 1)))"
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   144
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   145
instance ..
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   146
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   147
end
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   148
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   149
definition (in term_syntax) "valterm_emptyset = Code_Evaluation.valtermify ({} :: ('a :: typerep) set)"
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   150
definition (in term_syntax) "valtermify_insert x s = Code_Evaluation.valtermify insert {\<cdot>} (x :: ('a :: typerep * _)) {\<cdot>} s"
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   151
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   152
instantiation set :: (full_exhaustive) full_exhaustive
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   153
begin
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   154
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   155
fun full_exhaustive_set 
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   156
where
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   157
  "full_exhaustive_set f i = (if i = 0 then None else (f valterm_emptyset orelse full_exhaustive_set (%A. f A orelse Quickcheck_Exhaustive.full_exhaustive (%x. if fst x \<in> fst A then None else f (valtermify_insert x A)) (i - 1)) (i - 1)))"
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   158
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   159
instance ..
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   160
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   161
end
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   162
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   163
hide_const valterm_emptyset valtermify_insert
55a4769d0abe adding exhaustive instances for type constructor set
bulwahn
parents: 45925
diff changeset
   164
41916
80060d5f864a renaming constants in Quickcheck_Exhaustive theory
bulwahn
parents: 41915
diff changeset
   165
instantiation "fun" :: ("{equal, exhaustive}", exhaustive) exhaustive
40639
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   166
begin
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   167
45724
1f5fc44254d7 the simple exhaustive compilation also indicates if counterexample is potentially spurious;
bulwahn
parents: 45722
diff changeset
   168
fun exhaustive_fun' :: "(('a => 'b) => (bool * term list) option) => code_numeral => code_numeral => (bool * term list) option"
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   169
where
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   170
  "exhaustive_fun' f i d = (exhaustive (%b. f (%_. b)) d)
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   171
   orelse (if i > 1 then
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   172
     exhaustive_fun' (%g. exhaustive (%a. exhaustive (%b.
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   173
       f (g(a := b))) d) d) (i - 1) d else None)"
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   174
45724
1f5fc44254d7 the simple exhaustive compilation also indicates if counterexample is potentially spurious;
bulwahn
parents: 45722
diff changeset
   175
definition exhaustive_fun :: "(('a => 'b) => (bool * term list) option) => code_numeral => (bool * term list) option"
40639
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   176
where
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   177
  "exhaustive_fun f d = exhaustive_fun' f d d" 
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   178
42310
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
   179
instance ..
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
   180
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
   181
end
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
   182
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
   183
instantiation "fun" :: ("{equal, full_exhaustive}", full_exhaustive) full_exhaustive
c664cc5cc5e9 splitting exhaustive and full_exhaustive into separate type classes
bulwahn
parents: 42305
diff changeset
   184
begin
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   185
45722
63b42a7db003 changing the exhaustive generator signatures;
bulwahn
parents: 45718
diff changeset
   186
fun full_exhaustive_fun' :: "(('a => 'b) * (unit => term) => (bool * term list) option) => code_numeral => code_numeral => (bool * term list) option"
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   187
where
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   188
  "full_exhaustive_fun' f i d = (full_exhaustive (%(b, t). f (%_. b, %_. Code_Evaluation.Abs (STR ''x'') (Typerep.typerep TYPE('a)) (t ()))) d)
42117
306713ec55c3 changing iteration scheme of functions to use minimal number of function updates for exhaustive testing
bulwahn
parents: 41920
diff changeset
   189
   orelse (if i > 1 then
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   190
     full_exhaustive_fun' (%(g, gt). full_exhaustive (%(a, at). full_exhaustive (%(b, bt).
42117
306713ec55c3 changing iteration scheme of functions to use minimal number of function updates for exhaustive testing
bulwahn
parents: 41920
diff changeset
   191
       f (g(a := b),
306713ec55c3 changing iteration scheme of functions to use minimal number of function updates for exhaustive testing
bulwahn
parents: 41920
diff changeset
   192
         (%_. let A = (Typerep.typerep (TYPE('a)));
306713ec55c3 changing iteration scheme of functions to use minimal number of function updates for exhaustive testing
bulwahn
parents: 41920
diff changeset
   193
                  B = (Typerep.typerep (TYPE('b)));
306713ec55c3 changing iteration scheme of functions to use minimal number of function updates for exhaustive testing
bulwahn
parents: 41920
diff changeset
   194
                  fun = (%T U. Typerep.Typerep (STR ''fun'') [T, U])
306713ec55c3 changing iteration scheme of functions to use minimal number of function updates for exhaustive testing
bulwahn
parents: 41920
diff changeset
   195
              in
306713ec55c3 changing iteration scheme of functions to use minimal number of function updates for exhaustive testing
bulwahn
parents: 41920
diff changeset
   196
                Code_Evaluation.App (Code_Evaluation.App (Code_Evaluation.App
306713ec55c3 changing iteration scheme of functions to use minimal number of function updates for exhaustive testing
bulwahn
parents: 41920
diff changeset
   197
                  (Code_Evaluation.Const (STR ''Fun.fun_upd'') (fun (fun A B) (fun A (fun B (fun A B)))))
306713ec55c3 changing iteration scheme of functions to use minimal number of function updates for exhaustive testing
bulwahn
parents: 41920
diff changeset
   198
                (gt ())) (at ())) (bt ())))) d) d) (i - 1) d else None)"
40639
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   199
45722
63b42a7db003 changing the exhaustive generator signatures;
bulwahn
parents: 45718
diff changeset
   200
definition full_exhaustive_fun :: "(('a => 'b) * (unit => term) => (bool * term list) option) => code_numeral => (bool * term list) option"
40639
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   201
where
42304
34366f39d32d new compilation for exhaustive quickcheck
bulwahn
parents: 42274
diff changeset
   202
  "full_exhaustive_fun f d = full_exhaustive_fun' f d d" 
40639
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   203
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   204
instance ..
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   205
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   206
end
f1f0e6adca0a adding function generation to SmallCheck; activating exhaustive search space testing
bulwahn
parents: 40620
diff changeset
   207
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   208
subsubsection {* A smarter enumeration scheme for functions over finite datatypes *}
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   209
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   210
class check_all = enum + term_of +
45722
63b42a7db003 changing the exhaustive generator signatures;
bulwahn
parents: 45718
diff changeset
   211
  fixes check_all :: "('a * (unit \<Rightarrow> term) \<Rightarrow> (bool * term list) option) \<Rightarrow> (bool * term list) option"
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   212
  fixes enum_term_of :: "'a itself \<Rightarrow> unit \<Rightarrow> term list"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   213
  
45722
63b42a7db003 changing the exhaustive generator signatures;
bulwahn
parents: 45718
diff changeset
   214
fun check_all_n_lists :: "(('a :: check_all) list * (unit \<Rightarrow> term list) \<Rightarrow> (bool * term list) option) \<Rightarrow> code_numeral \<Rightarrow> (bool * term list) option"
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   215
where
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   216
  "check_all_n_lists f n =
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   217
     (if n = 0 then f ([], (%_. [])) else check_all (%(x, xt). check_all_n_lists (%(xs, xst). f ((x # xs), (%_. (xt () # xst ())))) (n - 1)))"
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   218
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   219
definition mk_map_term :: " (unit \<Rightarrow> typerep) \<Rightarrow> (unit \<Rightarrow> typerep) \<Rightarrow> (unit \<Rightarrow> term list) \<Rightarrow> (unit \<Rightarrow> term list) \<Rightarrow> unit \<Rightarrow> term"
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   220
where
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   221
  "mk_map_term T1 T2 domm rng =
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   222
     (%_. let T1 = T1 ();
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   223
              T2 = T2 ();
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   224
              update_term = (%g (a, b).
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   225
                Code_Evaluation.App (Code_Evaluation.App (Code_Evaluation.App
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   226
                 (Code_Evaluation.Const (STR ''Fun.fun_upd'')
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   227
                   (Typerep.Typerep (STR ''fun'') [Typerep.Typerep (STR ''fun'') [T1, T2],
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   228
                      Typerep.Typerep (STR ''fun'') [T1,
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   229
                        Typerep.Typerep (STR ''fun'') [T2, Typerep.Typerep (STR ''fun'') [T1, T2]]]]))
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   230
                        g) a) b)
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   231
          in
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   232
             List.foldl update_term (Code_Evaluation.Abs (STR ''x'') T1 (Code_Evaluation.Const (STR ''HOL.undefined'') T2)) (zip (domm ()) (rng ())))"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   233
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   234
instantiation "fun" :: ("{equal, check_all}", check_all) check_all
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   235
begin
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   236
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   237
definition
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   238
  "check_all f =
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   239
    (let
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   240
      mk_term = mk_map_term (%_. Typerep.typerep (TYPE('a))) (%_. Typerep.typerep (TYPE('b))) (enum_term_of (TYPE('a)));
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   241
      enum = (Enum.enum :: 'a list)
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   242
    in check_all_n_lists (\<lambda>(ys, yst). f (the o map_of (zip enum ys), mk_term yst)) (Code_Numeral.of_nat (length enum)))"
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   243
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   244
definition enum_term_of_fun :: "('a => 'b) itself => unit => term list"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   245
where
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   246
  "enum_term_of_fun = (%_ _. let
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   247
    enum_term_of_a = enum_term_of (TYPE('a));
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   248
    mk_term = mk_map_term (%_. Typerep.typerep (TYPE('a))) (%_. Typerep.typerep (TYPE('b))) enum_term_of_a
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   249
  in map (%ys. mk_term (%_. ys) ()) (Enum.n_lists (length (enum_term_of_a ())) (enum_term_of (TYPE('b)) ())))"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   250
 
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   251
instance ..
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   252
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   253
end
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   254
41105
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   255
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   256
instantiation unit :: check_all
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   257
begin
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   258
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   259
definition
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   260
  "check_all f = f (Code_Evaluation.valtermify ())"
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   261
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   262
definition enum_term_of_unit :: "unit itself => unit => term list"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   263
where
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   264
  "enum_term_of_unit = (%_ _. [Code_Evaluation.term_of ()])"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   265
41105
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   266
instance ..
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   267
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   268
end
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   269
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   270
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   271
instantiation bool :: check_all
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   272
begin
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   273
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   274
definition
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   275
  "check_all f = (case f (Code_Evaluation.valtermify False) of Some x' \<Rightarrow> Some x' | None \<Rightarrow> f (Code_Evaluation.valtermify True))"
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   276
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   277
definition enum_term_of_bool :: "bool itself => unit => term list"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   278
where
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   279
  "enum_term_of_bool = (%_ _. map Code_Evaluation.term_of (Enum.enum :: bool list))"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   280
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   281
instance ..
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   282
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   283
end
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   284
41105
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   285
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   286
instantiation prod :: (check_all, check_all) check_all
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   287
begin
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   288
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   289
definition
41719
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   290
  "check_all f = check_all (%(x, t1). check_all (%(y, t2). f ((x, y),
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   291
    %u. let T1 = (Typerep.typerep (TYPE('a)));
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   292
            T2 = (Typerep.typerep (TYPE('b)))
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   293
    in Code_Evaluation.App (Code_Evaluation.App (
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   294
      Code_Evaluation.Const (STR ''Product_Type.Pair'') 
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   295
      (Typerep.Typerep (STR ''fun'') [T1, Typerep.Typerep (STR ''fun'') [T2, Typerep.Typerep (STR ''Product_Type.prod'') [T1, T2]]]))
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   296
      (t1 ())) (t2 ()))))"
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   297
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   298
definition enum_term_of_prod :: "('a * 'b) itself => unit => term list"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   299
where
41719
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   300
  "enum_term_of_prod = (%_ _. map (%(x, y).
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   301
       let T1 = (Typerep.typerep (TYPE('a)));
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   302
           T2 = (Typerep.typerep (TYPE('b)))
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   303
       in Code_Evaluation.App (Code_Evaluation.App (
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   304
         Code_Evaluation.Const (STR ''Product_Type.Pair'') 
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   305
           (Typerep.Typerep (STR ''fun'') [T1, Typerep.Typerep (STR ''fun'') [T2, Typerep.Typerep (STR ''Product_Type.prod'') [T1, T2]]])) x) y)
91c2510e19c5 improving term construction of product types in Smallcheck which enables correct presentation of counterexamples
bulwahn
parents: 41231
diff changeset
   306
     (Enum.product (enum_term_of (TYPE('a)) ()) (enum_term_of (TYPE('b)) ())))  "
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   307
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   308
instance ..
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   309
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   310
end
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   311
41105
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   312
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   313
instantiation sum :: (check_all, check_all) check_all
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   314
begin
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   315
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   316
definition
41722
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   317
  "check_all f = (case check_all (%(a, t). f (Inl a, %_. 
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   318
     let T1 = (Typerep.typerep (TYPE('a)));
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   319
         T2 = (Typerep.typerep (TYPE('b)))
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   320
       in Code_Evaluation.App (Code_Evaluation.Const (STR ''Sum_Type.Inl'') 
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   321
           (Typerep.Typerep (STR ''fun'') [T1, Typerep.Typerep (STR ''Sum_Type.sum'') [T1, T2]])) (t ()))) of Some x' => Some x'
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   322
             | None => check_all (%(b, t). f (Inr b, %_. let
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   323
                 T1 = (Typerep.typerep (TYPE('a)));
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   324
                 T2 = (Typerep.typerep (TYPE('b)))
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   325
               in Code_Evaluation.App (Code_Evaluation.Const (STR ''Sum_Type.Inr'') 
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   326
                 (Typerep.Typerep (STR ''fun'') [T2, Typerep.Typerep (STR ''Sum_Type.sum'') [T1, T2]])) (t ()))))"
41105
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   327
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   328
definition enum_term_of_sum :: "('a + 'b) itself => unit => term list"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   329
where
41722
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   330
  "enum_term_of_sum = (%_ _.
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   331
     let
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   332
       T1 = (Typerep.typerep (TYPE('a)));
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   333
       T2 = (Typerep.typerep (TYPE('b)))
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   334
     in
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   335
       map (Code_Evaluation.App (Code_Evaluation.Const (STR ''Sum_Type.Inl'') 
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   336
             (Typerep.Typerep (STR ''fun'') [T1, Typerep.Typerep (STR ''Sum_Type.sum'') [T1, T2]])))
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   337
             (enum_term_of (TYPE('a)) ()) @
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   338
       map (Code_Evaluation.App (Code_Evaluation.Const (STR ''Sum_Type.Inr'') 
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   339
             (Typerep.Typerep (STR ''fun'') [T2, Typerep.Typerep (STR ''Sum_Type.sum'') [T1, T2]])))
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   340
             (enum_term_of (TYPE('b)) ()))"
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   341
41105
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   342
instance ..
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   343
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   344
end
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   345
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   346
instantiation nibble :: check_all
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   347
begin
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   348
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   349
definition
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   350
  "check_all f =
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   351
    f (Code_Evaluation.valtermify Nibble0) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   352
    f (Code_Evaluation.valtermify Nibble1) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   353
    f (Code_Evaluation.valtermify Nibble2) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   354
    f (Code_Evaluation.valtermify Nibble3) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   355
    f (Code_Evaluation.valtermify Nibble4) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   356
    f (Code_Evaluation.valtermify Nibble5) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   357
    f (Code_Evaluation.valtermify Nibble6) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   358
    f (Code_Evaluation.valtermify Nibble7) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   359
    f (Code_Evaluation.valtermify Nibble8) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   360
    f (Code_Evaluation.valtermify Nibble9) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   361
    f (Code_Evaluation.valtermify NibbleA) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   362
    f (Code_Evaluation.valtermify NibbleB) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   363
    f (Code_Evaluation.valtermify NibbleC) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   364
    f (Code_Evaluation.valtermify NibbleD) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   365
    f (Code_Evaluation.valtermify NibbleE) orelse
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   366
    f (Code_Evaluation.valtermify NibbleF)"
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   367
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   368
definition enum_term_of_nibble :: "nibble itself => unit => term list"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   369
where
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   370
  "enum_term_of_nibble = (%_ _. map Code_Evaluation.term_of (Enum.enum :: nibble list))"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   371
41105
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   372
instance ..
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   373
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   374
end
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   375
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   376
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   377
instantiation char :: check_all
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   378
begin
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   379
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   380
definition
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   381
  "check_all f = check_all (%(x, t1). check_all (%(y, t2). f (Char x y, %_. Code_Evaluation.App (Code_Evaluation.App (Code_Evaluation.term_of Char) (t1 ())) (t2 ()))))"
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   382
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   383
definition enum_term_of_char :: "char itself => unit => term list"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   384
where
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   385
  "enum_term_of_char = (%_ _. map Code_Evaluation.term_of (Enum.enum :: char list))"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   386
41105
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   387
instance ..
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   388
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   389
end
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   390
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   391
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   392
instantiation option :: (check_all) check_all
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   393
begin
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   394
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   395
definition
41178
f4d3acf0c4cc adding postprocessing for maps in term construction of quickcheck; fixed check_all_option definition
bulwahn
parents: 41177
diff changeset
   396
  "check_all f = f (Code_Evaluation.valtermify (None :: 'a option)) orelse check_all (%(x, t). f (Some x, %_. Code_Evaluation.App
f4d3acf0c4cc adding postprocessing for maps in term construction of quickcheck; fixed check_all_option definition
bulwahn
parents: 41177
diff changeset
   397
    (Code_Evaluation.Const (STR ''Option.option.Some'')
f4d3acf0c4cc adding postprocessing for maps in term construction of quickcheck; fixed check_all_option definition
bulwahn
parents: 41177
diff changeset
   398
      (Typerep.Typerep (STR ''fun'') [Typerep.typerep TYPE('a),  Typerep.Typerep (STR ''Option.option'') [Typerep.typerep TYPE('a)]])) (t ())))"
41105
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   399
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   400
definition enum_term_of_option :: "'a option itself => unit => term list"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   401
where
41722
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   402
  "enum_term_of_option = (% _ _. (Code_Evaluation.term_of (None :: 'a option)) # (map (Code_Evaluation.App (Code_Evaluation.Const (STR ''Option.option.Some'')
9575694d2da5 improving sum type and option type term constructions for correct presentation in Smallcheck
bulwahn
parents: 41719
diff changeset
   403
      (Typerep.Typerep (STR ''fun'') [Typerep.typerep TYPE('a),  Typerep.Typerep (STR ''Option.option'') [Typerep.typerep TYPE('a)]]))) (enum_term_of (TYPE('a)) ())))"
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   404
41105
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   405
instance ..
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   406
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   407
end
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   408
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   409
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   410
instantiation Enum.finite_1 :: check_all
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   411
begin
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   412
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   413
definition
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   414
  "check_all f = f (Code_Evaluation.valtermify Enum.finite_1.a\<^isub>1)"
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   415
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   416
definition enum_term_of_finite_1 :: "Enum.finite_1 itself => unit => term list"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   417
where
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   418
  "enum_term_of_finite_1 = (%_ _. [Code_Evaluation.term_of Enum.finite_1.a\<^isub>1])"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   419
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   420
instance ..
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   421
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   422
end
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   423
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   424
instantiation Enum.finite_2 :: check_all
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   425
begin
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   426
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   427
definition
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   428
  "check_all f = (case f (Code_Evaluation.valtermify Enum.finite_2.a\<^isub>1) of Some x' \<Rightarrow> Some x' | None \<Rightarrow> f (Code_Evaluation.valtermify Enum.finite_2.a\<^isub>2))"
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   429
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   430
definition enum_term_of_finite_2 :: "Enum.finite_2 itself => unit => term list"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   431
where
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   432
  "enum_term_of_finite_2 = (%_ _. map Code_Evaluation.term_of (Enum.enum :: Enum.finite_2 list))"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   433
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   434
instance ..
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   435
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   436
end
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   437
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   438
instantiation Enum.finite_3 :: check_all
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   439
begin
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   440
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   441
definition
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   442
  "check_all f = (case f (Code_Evaluation.valtermify Enum.finite_3.a\<^isub>1) of Some x' \<Rightarrow> Some x' | None \<Rightarrow> (case f (Code_Evaluation.valtermify Enum.finite_3.a\<^isub>2) of Some x' \<Rightarrow> Some x' | None \<Rightarrow> f (Code_Evaluation.valtermify Enum.finite_3.a\<^isub>3)))"
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   443
41177
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   444
definition enum_term_of_finite_3 :: "Enum.finite_3 itself => unit => term list"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   445
where
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   446
  "enum_term_of_finite_3 = (%_ _. map Code_Evaluation.term_of (Enum.enum :: Enum.finite_3 list))"
810a885decee added enum_term_of to correct present nested functions
bulwahn
parents: 41105
diff changeset
   447
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   448
instance ..
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   449
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   450
end
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   451
42195
1e7b62c93f5d adding an exhaustive validator for quickcheck's batch validating; moving strip_imp; minimal setup for bounded_forall
bulwahn
parents: 42117
diff changeset
   452
subsection {* Bounded universal quantifiers *}
41085
a549ff1d4070 adding a smarter enumeration scheme for finite functions
bulwahn
parents: 40915
diff changeset
   453
42195
1e7b62c93f5d adding an exhaustive validator for quickcheck's batch validating; moving strip_imp; minimal setup for bounded_forall
bulwahn
parents: 42117
diff changeset
   454
class bounded_forall =
1e7b62c93f5d adding an exhaustive validator for quickcheck's batch validating; moving strip_imp; minimal setup for bounded_forall
bulwahn
parents: 42117
diff changeset
   455
  fixes bounded_forall :: "('a \<Rightarrow> bool) \<Rightarrow> code_numeral \<Rightarrow> bool"
1e7b62c93f5d adding an exhaustive validator for quickcheck's batch validating; moving strip_imp; minimal setup for bounded_forall
bulwahn
parents: 42117
diff changeset
   456
42305
494c31fdec95 theory definitions for fast exhaustive quickcheck compilation
bulwahn
parents: 42304
diff changeset
   457
subsection {* Fast exhaustive combinators *}
494c31fdec95 theory definitions for fast exhaustive quickcheck compilation
bulwahn
parents: 42304
diff changeset
   458
494c31fdec95 theory definitions for fast exhaustive quickcheck compilation
bulwahn
parents: 42304
diff changeset
   459
class fast_exhaustive = term_of +
494c31fdec95 theory definitions for fast exhaustive quickcheck compilation
bulwahn
parents: 42304
diff changeset
   460
  fixes fast_exhaustive :: "('a \<Rightarrow> unit) \<Rightarrow> code_numeral \<Rightarrow> unit"
494c31fdec95 theory definitions for fast exhaustive quickcheck compilation
bulwahn
parents: 42304
diff changeset
   461
45818
53a697f5454a hiding constants and facts in the Quickcheck_Exhaustive and Quickcheck_Narrowing theory;
bulwahn
parents: 45750
diff changeset
   462
axiomatization throw_Counterexample :: "term list => unit"
53a697f5454a hiding constants and facts in the Quickcheck_Exhaustive and Quickcheck_Narrowing theory;
bulwahn
parents: 45750
diff changeset
   463
axiomatization catch_Counterexample :: "unit => term list option"
42305
494c31fdec95 theory definitions for fast exhaustive quickcheck compilation
bulwahn
parents: 42304
diff changeset
   464
494c31fdec95 theory definitions for fast exhaustive quickcheck compilation
bulwahn
parents: 42304
diff changeset
   465
code_const throw_Counterexample
494c31fdec95 theory definitions for fast exhaustive quickcheck compilation
bulwahn
parents: 42304
diff changeset
   466
  (Quickcheck "raise (Exhaustive'_Generators.Counterexample _)")
494c31fdec95 theory definitions for fast exhaustive quickcheck compilation
bulwahn
parents: 42304
diff changeset
   467
code_const catch_Counterexample
494c31fdec95 theory definitions for fast exhaustive quickcheck compilation
bulwahn
parents: 42304
diff changeset
   468
  (Quickcheck "(((_); NONE) handle Exhaustive'_Generators.Counterexample ts => SOME ts)")
494c31fdec95 theory definitions for fast exhaustive quickcheck compilation
bulwahn
parents: 42304
diff changeset
   469
45450
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   470
subsection {* Continuation passing style functions as plus monad *}
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   471
  
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   472
type_synonym 'a cps = "('a => term list option) => term list option"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   473
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   474
definition cps_empty :: "'a cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   475
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   476
  "cps_empty = (%cont. None)"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   477
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   478
definition cps_single :: "'a => 'a cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   479
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   480
  "cps_single v = (%cont. cont v)"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   481
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   482
definition cps_bind :: "'a cps => ('a => 'b cps) => 'b cps" 
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   483
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   484
  "cps_bind m f = (%cont. m (%a. (f a) cont))"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   485
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   486
definition cps_plus :: "'a cps => 'a cps => 'a cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   487
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   488
  "cps_plus a b = (%c. case a c of None => b c | Some x => Some x)"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   489
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   490
definition cps_if :: "bool => unit cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   491
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   492
  "cps_if b = (if b then cps_single () else cps_empty)"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   493
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   494
definition cps_not :: "unit cps => unit cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   495
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   496
  "cps_not n = (%c. case n (%u. Some []) of None => c () | Some _ => None)"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   497
45750
17100f4ce0b5 adding genuine flag to predicate_compile_quickcheck and prolog_quickcheck (cf. 5e46c225370e);
bulwahn
parents: 45733
diff changeset
   498
type_synonym 'a pos_bound_cps = "('a => (bool * term list) option) => code_numeral => (bool * term list) option"
45450
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   499
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   500
definition pos_bound_cps_empty :: "'a pos_bound_cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   501
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   502
  "pos_bound_cps_empty = (%cont i. None)"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   503
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   504
definition pos_bound_cps_single :: "'a => 'a pos_bound_cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   505
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   506
  "pos_bound_cps_single v = (%cont i. cont v)"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   507
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   508
definition pos_bound_cps_bind :: "'a pos_bound_cps => ('a => 'b pos_bound_cps) => 'b pos_bound_cps" 
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   509
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   510
  "pos_bound_cps_bind m f = (%cont i. if i = 0 then None else (m (%a. (f a) cont i) (i - 1)))"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   511
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   512
definition pos_bound_cps_plus :: "'a pos_bound_cps => 'a pos_bound_cps => 'a pos_bound_cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   513
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   514
  "pos_bound_cps_plus a b = (%c i. case a c i of None => b c i | Some x => Some x)"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   515
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   516
definition pos_bound_cps_if :: "bool => unit pos_bound_cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   517
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   518
  "pos_bound_cps_if b = (if b then pos_bound_cps_single () else pos_bound_cps_empty)"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   519
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   520
datatype 'a unknown = Unknown | Known 'a
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   521
datatype 'a three_valued = Unknown_value | Value 'a | No_value
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   522
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   523
type_synonym 'a neg_bound_cps = "('a unknown => term list three_valued) => code_numeral => term list three_valued"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   524
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   525
definition neg_bound_cps_empty :: "'a neg_bound_cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   526
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   527
  "neg_bound_cps_empty = (%cont i. No_value)"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   528
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   529
definition neg_bound_cps_single :: "'a => 'a neg_bound_cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   530
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   531
  "neg_bound_cps_single v = (%cont i. cont (Known v))"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   532
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   533
definition neg_bound_cps_bind :: "'a neg_bound_cps => ('a => 'b neg_bound_cps) => 'b neg_bound_cps" 
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   534
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   535
  "neg_bound_cps_bind m f = (%cont i. if i = 0 then cont Unknown else m (%a. case a of Unknown => cont Unknown | Known a' => f a' cont i) (i - 1))"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   536
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   537
definition neg_bound_cps_plus :: "'a neg_bound_cps => 'a neg_bound_cps => 'a neg_bound_cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   538
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   539
  "neg_bound_cps_plus a b = (%c i. case a c i of No_value => b c i | Value x => Value x | Unknown_value => (case b c i of No_value => Unknown_value | Value x => Value x | Unknown_value => Unknown_value))"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   540
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   541
definition neg_bound_cps_if :: "bool => unit neg_bound_cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   542
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   543
  "neg_bound_cps_if b = (if b then neg_bound_cps_single () else neg_bound_cps_empty)"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   544
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   545
definition neg_bound_cps_not :: "unit pos_bound_cps => unit neg_bound_cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   546
where
45750
17100f4ce0b5 adding genuine flag to predicate_compile_quickcheck and prolog_quickcheck (cf. 5e46c225370e);
bulwahn
parents: 45733
diff changeset
   547
  "neg_bound_cps_not n = (%c i. case n (%u. Some (True, [])) i of None => c (Known ()) | Some _ => No_value)"
45450
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   548
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   549
definition pos_bound_cps_not :: "unit neg_bound_cps => unit pos_bound_cps"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   550
where
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   551
  "pos_bound_cps_not n = (%c i. case n (%u. Value []) i of No_value => c () | Value _ => None | Unknown_value => None)"
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   552
45925
cd4243c025bb quickcheck generators for abstract types; tuned
bulwahn
parents: 45818
diff changeset
   553
subsection {* Defining generators for any first-order data type *}
40420
552563ea3304 adding code and theory for smallvalue generators, but do not setup the interpretation yet
bulwahn
parents:
diff changeset
   554
45697
3b7c35a08723 more stable introduction of the internally used unknown term
bulwahn
parents: 45684
diff changeset
   555
axiomatization unknown :: 'a
3b7c35a08723 more stable introduction of the internally used unknown term
bulwahn
parents: 45684
diff changeset
   556
3b7c35a08723 more stable introduction of the internally used unknown term
bulwahn
parents: 45684
diff changeset
   557
notation (output) unknown  ("?")
45684
3d6ee9c7d7ef adding a exception-safe term reification step in quickcheck; adding examples
bulwahn
parents: 45450
diff changeset
   558
 
41920
d4fb7a418152 moving exhaustive_generators.ML to Quickcheck directory
bulwahn
parents: 41918
diff changeset
   559
use "Tools/Quickcheck/exhaustive_generators.ML"
40420
552563ea3304 adding code and theory for smallvalue generators, but do not setup the interpretation yet
bulwahn
parents:
diff changeset
   560
41918
d2ab869f8b0b replacing naming of small by exhaustive
bulwahn
parents: 41916
diff changeset
   561
setup {* Exhaustive_Generators.setup *}
40420
552563ea3304 adding code and theory for smallvalue generators, but do not setup the interpretation yet
bulwahn
parents:
diff changeset
   562
43882
05d5696f177f renaming quickcheck_tester to quickcheck_batch_tester; tuned
bulwahn
parents: 42310
diff changeset
   563
declare [[quickcheck_batch_tester = exhaustive]]
40915
a4c956d1f91f declaring quickcheck testers as default after their setup
bulwahn
parents: 40914
diff changeset
   564
45925
cd4243c025bb quickcheck generators for abstract types; tuned
bulwahn
parents: 45818
diff changeset
   565
subsection {* Defining generators for abstract types *}
cd4243c025bb quickcheck generators for abstract types; tuned
bulwahn
parents: 45818
diff changeset
   566
cd4243c025bb quickcheck generators for abstract types; tuned
bulwahn
parents: 45818
diff changeset
   567
use "Tools/Quickcheck/abstract_generators.ML"
cd4243c025bb quickcheck generators for abstract types; tuned
bulwahn
parents: 45818
diff changeset
   568
45733
6bb30ae1abfe hiding internal constants and facts more properly
bulwahn
parents: 45732
diff changeset
   569
hide_fact orelse_def
41105
a76ee71c3313 adding check_all instances for a few more finite types in smallcheck
bulwahn
parents: 41104
diff changeset
   570
no_notation orelse (infixr "orelse" 55)
45818
53a697f5454a hiding constants and facts in the Quickcheck_Exhaustive and Quickcheck_Narrowing theory;
bulwahn
parents: 45750
diff changeset
   571
53a697f5454a hiding constants and facts in the Quickcheck_Exhaustive and Quickcheck_Narrowing theory;
bulwahn
parents: 45750
diff changeset
   572
hide_fact
53a697f5454a hiding constants and facts in the Quickcheck_Exhaustive and Quickcheck_Narrowing theory;
bulwahn
parents: 45750
diff changeset
   573
  exhaustive'_def
53a697f5454a hiding constants and facts in the Quickcheck_Exhaustive and Quickcheck_Narrowing theory;
bulwahn
parents: 45750
diff changeset
   574
  exhaustive_code_numeral'_def
53a697f5454a hiding constants and facts in the Quickcheck_Exhaustive and Quickcheck_Narrowing theory;
bulwahn
parents: 45750
diff changeset
   575
53a697f5454a hiding constants and facts in the Quickcheck_Exhaustive and Quickcheck_Narrowing theory;
bulwahn
parents: 45750
diff changeset
   576
hide_const (open)
53a697f5454a hiding constants and facts in the Quickcheck_Exhaustive and Quickcheck_Narrowing theory;
bulwahn
parents: 45750
diff changeset
   577
  exhaustive full_exhaustive exhaustive' exhaustive_code_numeral' full_exhaustive_code_numeral'
53a697f5454a hiding constants and facts in the Quickcheck_Exhaustive and Quickcheck_Narrowing theory;
bulwahn
parents: 45750
diff changeset
   578
  throw_Counterexample catch_Counterexample
53a697f5454a hiding constants and facts in the Quickcheck_Exhaustive and Quickcheck_Narrowing theory;
bulwahn
parents: 45750
diff changeset
   579
  check_all enum_term_of
53a697f5454a hiding constants and facts in the Quickcheck_Exhaustive and Quickcheck_Narrowing theory;
bulwahn
parents: 45750
diff changeset
   580
  orelse unknown mk_map_term check_all_n_lists
40420
552563ea3304 adding code and theory for smallvalue generators, but do not setup the interpretation yet
bulwahn
parents:
diff changeset
   581
45450
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   582
hide_type (open) cps pos_bound_cps neg_bound_cps unknown three_valued
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   583
hide_const (open) cps_empty cps_single cps_bind cps_plus cps_if cps_not
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   584
  pos_bound_cps_empty pos_bound_cps_single pos_bound_cps_bind pos_bound_cps_plus pos_bound_cps_if pos_bound_cps_not
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   585
  neg_bound_cps_empty neg_bound_cps_single neg_bound_cps_bind neg_bound_cps_plus neg_bound_cps_if neg_bound_cps_not
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   586
  Unknown Known Unknown_value Value No_value
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   587
dc2236b19a3d adding CPS compilation to predicate compiler;
bulwahn
parents: 43882
diff changeset
   588
end