src/HOL/Predicate_Compile_Examples/List_Examples.thy
author wenzelm
Wed Dec 29 17:34:41 2010 +0100 (2010-12-29)
changeset 41413 64cd30d6b0b8
parent 40924 a9be7f26b4e6
child 41956 c15ef1b85035
permissions -rw-r--r--
explicit file specifications -- avoid secondary load path;
bulwahn@39184
     1
theory List_Examples
wenzelm@41413
     2
imports Main "~~/src/HOL/Library/Predicate_Compile_Quickcheck" "Code_Prolog"
bulwahn@39184
     3
begin
bulwahn@39184
     4
bulwahn@39463
     5
setup {* Context.theory_map (Quickcheck.add_generator ("prolog", Code_Prolog.quickcheck)) *}
bulwahn@39184
     6
bulwahn@39184
     7
setup {* Code_Prolog.map_code_options (K 
bulwahn@39184
     8
  {ensure_groundness = true,
bulwahn@39800
     9
   limit_globally = NONE,
bulwahn@39184
    10
   limited_types = [(@{typ nat}, 2), (@{typ "nat list"}, 4)],
bulwahn@39184
    11
   limited_predicates = [(["appendP"], 4), (["revP"], 4)],
bulwahn@39184
    12
   replacing =
bulwahn@39184
    13
     [(("appendP", "limited_appendP"), "quickcheck"),
bulwahn@39184
    14
      (("revP", "limited_revP"), "quickcheck"),
bulwahn@39184
    15
      (("appendP", "limited_appendP"), "lim_revP")],
bulwahn@39463
    16
   manual_reorder = []}) *}
bulwahn@39184
    17
bulwahn@39184
    18
lemma "(xs :: nat list) = ys @ ys --> rev xs = xs"
bulwahn@40924
    19
quickcheck[tester = random, iterations = 10000]
bulwahn@40924
    20
quickcheck[tester = predicate_compile_wo_ff, iterations = 1, expect = counterexample]
bulwahn@40924
    21
quickcheck[tester = prolog, expect = counterexample]
bulwahn@39184
    22
oops
bulwahn@39184
    23
bulwahn@39184
    24
end