src/HOL/Predicate_Compile_Examples/List_Examples.thy
author wenzelm
Sat, 27 Nov 2010 14:32:08 +0100
changeset 40742 dc6439c0b8b1
parent 40137 9eabcb1bfe50
child 40924 a9be7f26b4e6
permissions -rw-r--r--
prefer Synchronized.var over CRITICAL/Unsynchronized.ref;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39184
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
     1
theory List_Examples
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
     2
imports Main "Predicate_Compile_Quickcheck" "Code_Prolog"
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
     3
begin
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
     4
39463
7ce0ed8dc4d6 adapting examples
bulwahn
parents: 39189
diff changeset
     5
setup {* Context.theory_map (Quickcheck.add_generator ("prolog", Code_Prolog.quickcheck)) *}
39184
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
     6
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
     7
setup {* Code_Prolog.map_code_options (K 
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
     8
  {ensure_groundness = true,
39800
17e29ddd538e adapting manual configuration in examples
bulwahn
parents: 39463
diff changeset
     9
   limit_globally = NONE,
39184
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
    10
   limited_types = [(@{typ nat}, 2), (@{typ "nat list"}, 4)],
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
    11
   limited_predicates = [(["appendP"], 4), (["revP"], 4)],
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
    12
   replacing =
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
    13
     [(("appendP", "limited_appendP"), "quickcheck"),
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
    14
      (("revP", "limited_revP"), "quickcheck"),
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
    15
      (("appendP", "limited_appendP"), "lim_revP")],
39463
7ce0ed8dc4d6 adapting examples
bulwahn
parents: 39189
diff changeset
    16
   manual_reorder = []}) *}
39184
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
    17
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
    18
lemma "(xs :: nat list) = ys @ ys --> rev xs = xs"
40137
9eabcb1bfe50 changing test parameters in examples to get to a result within the global timelimit
bulwahn
parents: 39800
diff changeset
    19
quickcheck[generator = code, iterations = 10000]
39184
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
    20
quickcheck[generator = predicate_compile_wo_ff, iterations = 1, expect = counterexample]
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
    21
quickcheck[generator = prolog, expect = counterexample]
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
    22
oops
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
    23
71f3f194b962 adding a List example (challenge from Tobias) for counterexample search
bulwahn
parents:
diff changeset
    24
end