src/HOL/Predicate_Compile_Examples/List_Examples.thy
author haftmann
Fri Oct 10 19:55:32 2014 +0200 (2014-10-10)
changeset 58646 cd63a4b12a33
parent 52666 391913d17d15
child 62390 842917225d56
permissions -rw-r--r--
specialized specification: avoid trivial instances
bulwahn@39184
     1
theory List_Examples
wenzelm@41956
     2
imports
wenzelm@41956
     3
  Main
wenzelm@41956
     4
  "~~/src/HOL/Library/Predicate_Compile_Quickcheck"
wenzelm@41956
     5
  "~~/src/HOL/Library/Code_Prolog"
bulwahn@39184
     6
begin
bulwahn@39184
     7
wenzelm@52666
     8
setup {*
wenzelm@52666
     9
  Context.theory_map
wenzelm@52666
    10
    (Quickcheck.add_tester ("prolog", (Code_Prolog.active, Code_Prolog.test_goals)))
wenzelm@52666
    11
*}
bulwahn@39184
    12
bulwahn@39184
    13
setup {* Code_Prolog.map_code_options (K 
bulwahn@39184
    14
  {ensure_groundness = true,
bulwahn@39800
    15
   limit_globally = NONE,
bulwahn@39184
    16
   limited_types = [(@{typ nat}, 2), (@{typ "nat list"}, 4)],
bulwahn@39184
    17
   limited_predicates = [(["appendP"], 4), (["revP"], 4)],
bulwahn@39184
    18
   replacing =
bulwahn@39184
    19
     [(("appendP", "limited_appendP"), "quickcheck"),
bulwahn@39184
    20
      (("revP", "limited_revP"), "quickcheck"),
bulwahn@39184
    21
      (("appendP", "limited_appendP"), "lim_revP")],
bulwahn@39463
    22
   manual_reorder = []}) *}
bulwahn@39184
    23
bulwahn@39184
    24
lemma "(xs :: nat list) = ys @ ys --> rev xs = xs"
bulwahn@40924
    25
quickcheck[tester = random, iterations = 10000]
bulwahn@45451
    26
quickcheck[tester = smart_exhaustive, iterations = 1, expect = counterexample]
bulwahn@40924
    27
quickcheck[tester = prolog, expect = counterexample]
bulwahn@39184
    28
oops
bulwahn@39184
    29
bulwahn@39184
    30
end