src/HOL/Nitpick.thy
 changeset 33562 b1e2830ee31a parent 33235 cbe96b3cb3d0 parent 33561 ab01b72715ef child 33608 5c0024338cef
```     1.1 --- a/src/HOL/Nitpick.thy	Wed Oct 28 12:21:38 2009 +0000
1.2 +++ b/src/HOL/Nitpick.thy	Wed Oct 28 18:09:30 2009 +0100
1.3 @@ -8,7 +8,7 @@
1.4  header {* Nitpick: Yet Another Counterexample Generator for Isabelle/HOL *}
1.5
1.6  theory Nitpick
1.7 -imports Map SAT
1.8 +imports Map Quickcheck SAT
1.9  uses ("Tools/Nitpick/kodkod.ML")
1.10       ("Tools/Nitpick/kodkod_sat.ML")
1.11       ("Tools/Nitpick/nitpick_util.ML")
1.12 @@ -117,12 +117,16 @@
1.13   apply (simp only: unit.cases)
1.14  by simp
1.15
1.16 +declare unit.cases [nitpick_simp del]
1.17 +
1.18  lemma nat_case_def [nitpick_def]:
1.19  "nat_case x f n \<equiv> if n = 0 then x else f (n - 1)"
1.20  apply (rule eq_reflection)
1.21  by (case_tac n) auto
1.22
1.23 -lemmas dvd_def = dvd_eq_mod_eq_0 [THEN eq_reflection, nitpick_def]
1.24 +declare nat.cases [nitpick_simp del]
1.25 +
1.26 +lemmas [nitpick_def] = dvd_eq_mod_eq_0 [THEN eq_reflection]
1.27
1.28  lemma list_size_simp [nitpick_simp]:
1.29  "list_size f xs = (if xs = [] then 0
1.30 @@ -206,6 +210,21 @@
1.31  definition of_frac :: "'a \<Rightarrow> 'b\<Colon>{inverse,ring_1}" where
1.32  "of_frac q \<equiv> of_int (num q) / of_int (denom q)"
1.33
1.34 +(* While Nitpick normally avoids to unfold definitions for locales, it
1.35 +   unfortunately needs to unfold them when dealing with the following built-in
1.36 +   constants. A cleaner approach would be to change "Nitpick_HOL" and
1.37 +   "Nitpick_Nits" so that they handle the unexpanded overloaded constants
1.38 +   directly, but this is slightly more tricky to implement. *)
1.39 +lemmas [nitpick_def] = div_int_inst.div_int div_int_inst.mod_int
1.40 +    div_nat_inst.div_nat div_nat_inst.mod_nat lower_semilattice_fun_inst.inf_fun
1.41 +    minus_fun_inst.minus_fun minus_int_inst.minus_int minus_nat_inst.minus_nat
1.42 +    one_int_inst.one_int one_nat_inst.one_nat ord_fun_inst.less_eq_fun
1.43 +    ord_int_inst.less_eq_int ord_int_inst.less_int ord_nat_inst.less_eq_nat
1.44 +    ord_nat_inst.less_nat plus_int_inst.plus_int plus_nat_inst.plus_nat
1.45 +    times_int_inst.times_int times_nat_inst.times_nat uminus_int_inst.uminus_int
1.46 +    upper_semilattice_fun_inst.sup_fun zero_int_inst.zero_int
1.47 +    zero_nat_inst.zero_nat
1.48 +
1.49  use "Tools/Nitpick/kodkod.ML"
1.50  use "Tools/Nitpick/kodkod_sat.ML"
1.51  use "Tools/Nitpick/nitpick_util.ML"
1.52 @@ -222,6 +241,8 @@
1.53  use "Tools/Nitpick/nitpick_tests.ML"
1.54  use "Tools/Nitpick/minipick.ML"
1.55
1.56 +setup {* Nitpick_Isar.setup *}
1.57 +
1.58  hide (open) const unknown undefined_fast_The undefined_fast_Eps bisim
1.59      bisim_iterator_max Tha refl' wf' wf_wfrec wf_wfrec' wfrec' card' setsum'
1.60      fold_graph' nat_gcd nat_lcm int_gcd int_lcm Frac Abs_Frac Rep_Frac zero_frac
1.61 @@ -230,10 +251,10 @@
1.62  hide (open) type bisim_iterator pair_box fun_box
1.63  hide (open) fact If_def Ex1_def rtrancl_def rtranclp_def tranclp_def refl'_def
1.64      wf'_def wf_wfrec'_def wfrec'_def card'_def setsum'_def fold_graph'_def
1.65 -    The_psimp Eps_psimp unit_case_def nat_case_def dvd_def list_size_simp
1.66 -    nat_gcd_def nat_lcm_def int_gcd_def int_lcm_def Frac_def zero_frac_def
1.67 -    one_frac_def num_def denom_def norm_frac_def frac_def plus_frac_def
1.68 -    times_frac_def uminus_frac_def number_of_frac_def inverse_frac_def
1.69 -    less_eq_frac_def of_frac_def
1.70 +    The_psimp Eps_psimp unit_case_def nat_case_def list_size_simp nat_gcd_def
1.71 +    nat_lcm_def int_gcd_def int_lcm_def Frac_def zero_frac_def one_frac_def
1.72 +    num_def denom_def norm_frac_def frac_def plus_frac_def times_frac_def
1.73 +    uminus_frac_def number_of_frac_def inverse_frac_def less_eq_frac_def
1.74 +    of_frac_def
1.75
1.76  end
```