src/HOL/Predicate_Compile_Examples/List_Examples.thy
author bulwahn
Tue Sep 07 11:51:53 2010 +0200 (2010-09-07)
changeset 39184 71f3f194b962
child 39189 d183bf90dabd
permissions -rw-r--r--
adding a List example (challenge from Tobias) for counterexample search
bulwahn@39184
     1
theory List_Examples
bulwahn@39184
     2
imports Main "Predicate_Compile_Quickcheck" "Code_Prolog"
bulwahn@39184
     3
begin
bulwahn@39184
     4
bulwahn@39184
     5
setup {* 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@39184
     9
   limited_types = [(@{typ nat}, 2), (@{typ "nat list"}, 4)],
bulwahn@39184
    10
   limited_predicates = [(["appendP"], 4), (["revP"], 4)],
bulwahn@39184
    11
   replacing =
bulwahn@39184
    12
     [(("appendP", "limited_appendP"), "quickcheck"),
bulwahn@39184
    13
      (("revP", "limited_revP"), "quickcheck"),
bulwahn@39184
    14
      (("appendP", "limited_appendP"), "lim_revP")],
bulwahn@39184
    15
   manual_reorder = [],
bulwahn@39184
    16
   prolog_system = Code_Prolog.SWI_PROLOG}) *}
bulwahn@39184
    17
bulwahn@39184
    18
lemma "(xs :: nat list) = ys @ ys --> rev xs = xs"
bulwahn@39184
    19
quickcheck[generator = code, iterations = 200000, expect = counterexample]
bulwahn@39184
    20
quickcheck[generator = predicate_compile_wo_ff, iterations = 1, expect = counterexample]
bulwahn@39184
    21
quickcheck[generator = prolog, expect = counterexample]
bulwahn@39184
    22
oops
bulwahn@39184
    23
bulwahn@39184
    24
end