src/HOL/ex/mesontest.ML
author wenzelm
Tue, 27 May 1997 15:45:07 +0200
changeset 3362 0b268cff9344
parent 2715 79c35a051196
child 3842 b55686a7b22c
permissions -rw-r--r--
NJ 1.09.2x as factory default!
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
     1
(*  Title:      HOL/ex/mesontest
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     5
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     6
Test data for the MESON proof procedure
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     7
   (Excludes the equality problems 51, 52, 56, 58)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     8
2059
d08998a11d44 New comment in header
paulson
parents: 2031
diff changeset
     9
Use the "mesonlog" shell script to process logs.
d08998a11d44 New comment in header
paulson
parents: 2031
diff changeset
    10
1718
eaecc8be539b updated comments for handling derivations
paulson
parents: 1600
diff changeset
    11
show_hyps := false;
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    12
1718
eaecc8be539b updated comments for handling derivations
paulson
parents: 1600
diff changeset
    13
keep_derivs := MinDeriv;
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    14
by (rtac ccontr 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    15
val [prem] = gethyps 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    16
val nnf = make_nnf prem;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    17
val xsko = skolemize nnf;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    18
by (cut_facts_tac [xsko] 1 THEN REPEAT (etac exE 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    19
val [_,sko] = gethyps 1;
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
    20
val clauses = make_clauses [sko];       
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    21
val horns = make_horns clauses;
1600
901579c25021 Examples call gocls to make goal clauses
paulson
parents: 1586
diff changeset
    22
val goes = gocls clauses;
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    23
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    24
goal HOL.thy "False";
1600
901579c25021 Examples call gocls to make goal clauses
paulson
parents: 1586
diff changeset
    25
by (resolve_tac goes 1);
1718
eaecc8be539b updated comments for handling derivations
paulson
parents: 1600
diff changeset
    26
keep_derivs := FullDeriv;
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    27
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    28
by (prolog_step_tac horns 1);
1600
901579c25021 Examples call gocls to make goal clauses
paulson
parents: 1586
diff changeset
    29
by (iter_deepen_prolog_tac horns);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    30
by (depth_prolog_tac horns);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    31
by (best_prolog_tac size_of_subgoals horns);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    32
*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    33
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    34
writeln"File HOL/ex/meson-test.";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    35
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    36
(*Deep unifications can be required, esp. during transformation to clauses*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    37
val orig_trace_bound = !Unify.trace_bound
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    38
and orig_search_bound = !Unify.search_bound;
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    39
Unify.trace_bound := 20;
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    40
Unify.search_bound := 40;
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    41
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    42
(**** Interactive examples ****)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    43
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    44
(*Generate nice names for Skolem functions*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    45
Logic.auto_rename := true; Logic.set_rename_prefix "a";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    46
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    47
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    48
writeln"Problem 25";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    49
goal HOL.thy "(? x. P x) &  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    50
\       (! x. L x --> ~ (M x & R x)) &  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    51
\       (! x. P x --> (M x & L x)) &   \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    52
\       ((! x. P x --> Q x) | (? x. P x & R x))  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    53
\   --> (? x. Q x & P x)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    54
by (rtac ccontr 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    55
val [prem25] = gethyps 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    56
val nnf25 = make_nnf prem25;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    57
val xsko25 = skolemize nnf25;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    58
by (cut_facts_tac [xsko25] 1 THEN REPEAT (etac exE 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    59
val [_,sko25] = gethyps 1;
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
    60
val clauses25 = make_clauses [sko25];   (*7 clauses*)
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
    61
val horns25 = make_horns clauses25;     (*16 Horn clauses*)
1600
901579c25021 Examples call gocls to make goal clauses
paulson
parents: 1586
diff changeset
    62
val go25::_ = gocls clauses25;
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    63
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    64
goal HOL.thy "False";
1600
901579c25021 Examples call gocls to make goal clauses
paulson
parents: 1586
diff changeset
    65
by (rtac go25 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    66
by (depth_prolog_tac horns25);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    67
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    68
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    69
writeln"Problem 26";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    70
goal HOL.thy "((? x. p x) = (? x. q x)) &     \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    71
\     (! x. ! y. p x & q y --> (r x = s y)) \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    72
\ --> ((! x. p x --> r x) = (! x. q x --> s x))";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    73
by (rtac ccontr 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    74
val [prem26] = gethyps 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    75
val nnf26 = make_nnf prem26;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    76
val xsko26 = skolemize nnf26;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    77
by (cut_facts_tac [xsko26] 1 THEN REPEAT (etac exE 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    78
val [_,sko26] = gethyps 1;
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
    79
val clauses26 = make_clauses [sko26];                   (*9 clauses*)
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
    80
val horns26 = make_horns clauses26;                     (*24 Horn clauses*)
1600
901579c25021 Examples call gocls to make goal clauses
paulson
parents: 1586
diff changeset
    81
val go26::_ = gocls clauses26;
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    82
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    83
goal HOL.thy "False";
1600
901579c25021 Examples call gocls to make goal clauses
paulson
parents: 1586
diff changeset
    84
by (rtac go26 1);
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    85
by (depth_prolog_tac horns26);  (*1.4 secs*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    86
(*Proof is of length 107!!*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    87
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    88
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
    89
writeln"Problem 43  NOW PROVED AUTOMATICALLY!!";  (*16 Horn clauses*)
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
    90
goal HOL.thy "(! x. ! y. q x y = (! z. p z x = (p z y::bool)))  \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    91
\         --> (! x. (! y. q x y = (q y x::bool)))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    92
by (rtac ccontr 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    93
val [prem43] = gethyps 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    94
val nnf43 = make_nnf prem43;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    95
val xsko43 = skolemize nnf43;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    96
by (cut_facts_tac [xsko43] 1 THEN REPEAT (etac exE 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    97
val [_,sko43] = gethyps 1;
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
    98
val clauses43 = make_clauses [sko43];   (*6*)
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
    99
val horns43 = make_horns clauses43;     (*16*)
1600
901579c25021 Examples call gocls to make goal clauses
paulson
parents: 1586
diff changeset
   100
val go43::_ = gocls clauses43;
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   101
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   102
goal HOL.thy "False";
1600
901579c25021 Examples call gocls to make goal clauses
paulson
parents: 1586
diff changeset
   103
by (rtac go43 1);
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   104
by (best_prolog_tac size_of_subgoals horns43);   (*1.6 secs*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   105
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   106
(* 
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   107
#1  (q x xa ==> ~ q x xa) ==> q xa x
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   108
#2  (q xa x ==> ~ q xa x) ==> q x xa
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   109
#3  (~ q x xa ==> q x xa) ==> ~ q xa x
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   110
#4  (~ q xa x ==> q xa x) ==> ~ q x xa
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   111
#5  [| ~ q ?U ?V ==> q ?U ?V; ~ p ?W ?U ==> p ?W ?U |] ==> p ?W ?V
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   112
#6  [| ~ p ?W ?U ==> p ?W ?U; p ?W ?V ==> ~ p ?W ?V |] ==> ~ q ?U ?V
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   113
#7  [| p ?W ?V ==> ~ p ?W ?V; ~ q ?U ?V ==> q ?U ?V |] ==> ~ p ?W ?U
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   114
#8  [| ~ q ?U ?V ==> q ?U ?V; ~ p ?W ?V ==> p ?W ?V |] ==> p ?W ?U
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   115
#9  [| ~ p ?W ?V ==> p ?W ?V; p ?W ?U ==> ~ p ?W ?U |] ==> ~ q ?U ?V
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   116
#10 [| p ?W ?U ==> ~ p ?W ?U; ~ q ?U ?V ==> q ?U ?V |] ==> ~ p ?W ?V
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   117
#11 [| p (xb ?U ?V) ?U ==> ~ p (xb ?U ?V) ?U;
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   118
       p (xb ?U ?V) ?V ==> ~ p (xb ?U ?V) ?V |] ==> q ?U ?V
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   119
#12 [| p (xb ?U ?V) ?V ==> ~ p (xb ?U ?V) ?V; q ?U ?V ==> ~ q ?U ?V |] ==>
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   120
    p (xb ?U ?V) ?U
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   121
#13 [| q ?U ?V ==> ~ q ?U ?V; p (xb ?U ?V) ?U ==> ~ p (xb ?U ?V) ?U |] ==>
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   122
    p (xb ?U ?V) ?V
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   123
#14 [| ~ p (xb ?U ?V) ?U ==> p (xb ?U ?V) ?U;
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   124
       ~ p (xb ?U ?V) ?V ==> p (xb ?U ?V) ?V |] ==> q ?U ?V
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   125
#15 [| ~ p (xb ?U ?V) ?V ==> p (xb ?U ?V) ?V; q ?U ?V ==> ~ q ?U ?V |] ==>
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   126
    ~ p (xb ?U ?V) ?U
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   127
#16 [| q ?U ?V ==> ~ q ?U ?V; ~ p (xb ?U ?V) ?U ==> p (xb ?U ?V) ?U |] ==>
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   128
    ~ p (xb ?U ?V) ?V
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   129
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   130
And here is the proof!  (Unkn is the start state after use of goal clause)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   131
[Unkn, Res ([Thm "#14"], false, 1), Res ([Thm "#5"], false, 1),
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   132
   Res ([Thm "#1"], false, 1), Asm 1, Res ([Thm "#13"], false, 1), Asm 2,
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   133
   Asm 1, Res ([Thm "#13"], false, 1), Asm 1, Res ([Thm "#10"], false, 1),
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   134
   Res ([Thm "#16"], false, 1), Asm 2, Asm 1, Res ([Thm "#1"], false, 1),
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   135
   Asm 1, Res ([Thm "#14"], false, 1), Res ([Thm "#5"], false, 1),
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   136
   Res ([Thm "#2"], false, 1), Asm 1, Res ([Thm "#13"], false, 1), Asm 2,
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   137
   Asm 1, Res ([Thm "#8"], false, 1), Res ([Thm "#2"], false, 1), Asm 1,
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   138
   Res ([Thm "#12"], false, 1), Asm 2, Asm 1] : lderiv list
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   139
*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   140
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   141
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   142
(*Restore variable name preservation*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   143
Logic.auto_rename := false; 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   144
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   145
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   146
(**** Batch test data ****)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   147
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   148
(*Sample problems from 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   149
  F. J. Pelletier, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   150
  Seventy-Five Problems for Testing Automatic Theorem Provers,
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   151
  J. Automated Reasoning 2 (1986), 191-216.
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   152
  Errata, JAR 4 (1988), 236-236.
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   153
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   154
The hardest problems -- judging by experience with several theorem provers,
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   155
including matrix ones -- are 34 and 43.
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   156
*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   157
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   158
writeln"Pelletier's examples";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   159
(*1*)
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   160
goal HOL.thy "(P --> Q)  =  (~Q --> ~P)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   161
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   162
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   163
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   164
(*2*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   165
goal HOL.thy "(~ ~ P) =  P";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   166
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   167
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   168
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   169
(*3*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   170
goal HOL.thy "~(P-->Q) --> (Q-->P)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   171
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   172
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   173
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   174
(*4*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   175
goal HOL.thy "(~P-->Q)  =  (~Q --> P)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   176
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   177
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   178
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   179
(*5*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   180
goal HOL.thy "((P|Q)-->(P|R)) --> (P|(Q-->R))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   181
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   182
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   183
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   184
(*6*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   185
goal HOL.thy "P | ~ P";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   186
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   187
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   188
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   189
(*7*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   190
goal HOL.thy "P | ~ ~ ~ P";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   191
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   192
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   193
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   194
(*8.  Peirce's law*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   195
goal HOL.thy "((P-->Q) --> P)  -->  P";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   196
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   197
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   198
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   199
(*9*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   200
goal HOL.thy "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   201
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   202
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   203
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   204
(*10*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   205
goal HOL.thy "(Q-->R) & (R-->P&Q) & (P-->Q|R) --> (P=Q)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   206
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   207
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   208
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   209
(*11.  Proved in each direction (incorrectly, says Pelletier!!)  *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   210
goal HOL.thy "P=(P::bool)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   211
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   212
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   213
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   214
(*12.  "Dijkstra's law"*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   215
goal HOL.thy "((P = Q) = R) = (P = (Q = R))";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   216
by (safe_meson_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   217
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   218
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   219
(*13.  Distributive law*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   220
goal HOL.thy "(P | (Q & R)) = ((P | Q) & (P | R))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   221
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   222
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   223
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   224
(*14*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   225
goal HOL.thy "(P = Q) = ((Q | ~P) & (~Q|P))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   226
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   227
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   228
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   229
(*15*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   230
goal HOL.thy "(P --> Q) = (~P | Q)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   231
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   232
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   233
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   234
(*16*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   235
goal HOL.thy "(P-->Q) | (Q-->P)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   236
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   237
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   238
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   239
(*17*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   240
goal HOL.thy "((P & (Q-->R))-->S)  =  ((~P | Q | S) & (~P | ~R | S))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   241
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   242
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   243
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   244
writeln"Classical Logic: examples with quantifiers";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   245
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   246
goal HOL.thy "(! x. P x & Q x) = ((! x. P x) & (! x. Q x))";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   247
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   248
result(); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   249
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   250
goal HOL.thy "(? x. P --> Q x)  =  (P --> (? x.Q x))";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   251
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   252
result(); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   253
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   254
goal HOL.thy "(? x.P x --> Q) = ((! x.P x) --> Q)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   255
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   256
result(); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   257
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   258
goal HOL.thy "((! x.P x) | Q)  =  (! x. P x | Q)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   259
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   260
result(); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   261
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   262
goal HOL.thy "(! x. P x --> P(f x))  &  P d --> P(f(f(f d)))";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   263
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   264
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   265
1259
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   266
(*Needs double instantiation of EXISTS*)
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   267
goal HOL.thy "? x. P x --> P a & P b";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   268
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   269
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   270
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   271
goal HOL.thy "? z. P z --> (! x. P x)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   272
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   273
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   274
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   275
writeln"Hard examples with quantifiers";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   276
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   277
writeln"Problem 18";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   278
goal HOL.thy "? y. ! x. P y --> P x";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   279
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   280
result(); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   281
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   282
writeln"Problem 19";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   283
goal HOL.thy "? x. ! y z. (P y --> Q z) --> (P x --> Q x)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   284
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   285
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   286
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   287
writeln"Problem 20";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   288
goal HOL.thy "(! x y. ? z. ! w. (P x & Q y --> R z & S w))     \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   289
\   --> (? x y. P x & Q y) --> (? z. R z)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   290
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   291
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   292
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   293
writeln"Problem 21";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   294
goal HOL.thy "(? x. P --> Q x) & (? x. Q x --> P) --> (? x. P=Q x)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   295
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   296
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   297
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   298
writeln"Problem 22";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   299
goal HOL.thy "(! x. P = Q x)  -->  (P = (! x. Q x))";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   300
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   301
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   302
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   303
writeln"Problem 23";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   304
goal HOL.thy "(! x. P | Q x)  =  (P | (! x. Q x))";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   305
by (safe_meson_tac 1);  
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   306
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   307
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   308
writeln"Problem 24";  (*The first goal clause is useless*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   309
goal HOL.thy "~(? x. S x & Q x) & (! x. P x --> Q x | R x) &  \
2575
65abf447151b Correction to Problem 24
paulson
parents: 2059
diff changeset
   310
\    (~(? x.P x) --> (? x.Q x)) & (! x. Q x | R x --> S x)  \
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   311
\   --> (? x. P x & R x)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   312
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   313
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   314
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   315
writeln"Problem 25";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   316
goal HOL.thy "(? x. P x) &  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   317
\       (! x. L x --> ~ (M x & R x)) &  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   318
\       (! x. P x --> (M x & L x)) &   \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   319
\       ((! x. P x --> Q x) | (? x. P x & R x))  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   320
\   --> (? x. Q x & P x)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   321
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   322
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   323
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   324
writeln"Problem 26";  (*24 Horn clauses*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   325
goal HOL.thy "((? x. p x) = (? x. q x)) &     \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   326
\     (! x. ! y. p x & q y --> (r x = s y)) \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   327
\ --> ((! x. p x --> r x) = (! x. q x --> s x))";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   328
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   329
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   330
2031
03a843f0f447 Ran expandshort
paulson
parents: 1718
diff changeset
   331
writeln"Problem 27";    (*13 Horn clauses*)
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   332
goal HOL.thy "(? x. P x & ~Q x) &   \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   333
\             (! x. P x --> R x) &   \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   334
\             (! x. M x & L x --> P x) &   \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   335
\             ((? x. R x & ~ Q x) --> (! x. L x --> ~ R x))  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   336
\         --> (! x. M x --> ~L x)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   337
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   338
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   339
2031
03a843f0f447 Ran expandshort
paulson
parents: 1718
diff changeset
   340
writeln"Problem 28.  AMENDED";  (*14 Horn clauses*)
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   341
goal HOL.thy "(! x. P x --> (! x. Q x)) &   \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   342
\       ((! x. Q x | R x) --> (? x. Q x & S x)) &  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   343
\       ((? x.S x) --> (! x. L x --> M x))  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   344
\   --> (! x. P x & L x --> M x)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   345
by (safe_meson_tac 1);  
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   346
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   347
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   348
writeln"Problem 29.  Essentially the same as Principia Mathematica *11.71";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1718
diff changeset
   349
        (*62 Horn clauses*)
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   350
goal HOL.thy "(? x. F x) & (? y. G y)  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   351
\   --> ( ((! x. F x --> H x) & (! y. G y --> J y))  =   \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   352
\         (! x y. F x & G y --> H x & J y))";
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   353
by (safe_meson_tac 1);          (*0.7 secs*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   354
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   355
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   356
writeln"Problem 30";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   357
goal HOL.thy "(! x. P x | Q x --> ~ R x) & \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   358
\       (! x. (Q x --> ~ S x) --> P x & R x)  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   359
\   --> (! x. S x)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   360
by (safe_meson_tac 1);  
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   361
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   362
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   363
writeln"Problem 31";  (*10 Horn clauses; first negative clauses is useless*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   364
goal HOL.thy "~(? x.P x & (Q x | R x)) & \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   365
\       (? x. L x & P x) & \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   366
\       (! x. ~ R x --> M x)  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   367
\   --> (? x. L x & M x)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   368
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   369
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   370
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   371
writeln"Problem 32";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   372
goal HOL.thy "(! x. P x & (Q x | R x)-->S x) & \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   373
\       (! x. S x & R x --> L x) & \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   374
\       (! x. M x --> R x)  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   375
\   --> (! x. P x & M x --> L x)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   376
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   377
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   378
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   379
writeln"Problem 33";  (*55 Horn clauses*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   380
goal HOL.thy "(! x. P a & (P x --> P b)-->P c)  =    \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   381
\    (! x. (~P a | P x | P c) & (~P a | ~P b | P c))";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
   382
by (safe_meson_tac 1);          (*5.6 secs*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   383
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   384
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   385
writeln"Problem 34  AMENDED (TWICE!!)"; (*924 Horn clauses*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   386
(*Andrews's challenge*)
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   387
goal HOL.thy "((? x. ! y. p x = p y)  =               \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   388
\              ((? x. q x) = (! y. p y)))     =       \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   389
\             ((? x. ! y. q x = q y)  =               \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   390
\              ((? x. p x) = (! y. q y)))";
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   391
by (safe_meson_tac 1);          (*13 secs*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   392
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   393
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   394
writeln"Problem 35";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   395
goal HOL.thy "? x y. P x y -->  (! u v. P u v)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   396
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   397
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   398
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   399
writeln"Problem 36";  (*15 Horn clauses*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   400
goal HOL.thy "(! x. ? y. J x y) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   401
\       (! x. ? y. G x y) & \
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
   402
\       (! x y. J x y | G x y -->       \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   403
\       (! z. J y z | G y z --> H x z))   \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   404
\   --> (! x. ? y. H x y)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   405
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   406
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   407
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   408
writeln"Problem 37";  (*10 Horn clauses*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   409
goal HOL.thy "(! z. ? w. ! x. ? y. \
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   410
\          (P x z --> P y w) & P y z & (P y w --> (? u.Q u w))) & \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   411
\       (! x z. ~P x z --> (? y. Q y z)) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   412
\       ((? x y. Q x y) --> (! x. R x x))  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   413
\   --> (! x. ? y. R x y)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   414
by (safe_meson_tac 1);   (*causes unification tracing messages*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   415
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   416
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   417
writeln"Problem 38";  (*Quite hard: 422 Horn clauses!!*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   418
goal HOL.thy
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   419
    "(! x. p a & (p x --> (? y. p y & r x y)) -->            \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   420
\          (? z. ? w. p z & r x w & r w z))  =                 \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   421
\    (! x. (~p a | p x | (? z. ? w. p z & r x w & r w z)) &  \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   422
\          (~p a | ~(? y. p y & r x y) |                      \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   423
\           (? z. ? w. p z & r x w & r w z)))";
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   424
by (safe_best_meson_tac 1);  (*10 secs; iter. deepening is slightly slower*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   425
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   426
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   427
writeln"Problem 39";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   428
goal HOL.thy "~ (? x. ! y. F y x = (~F y y))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   429
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   430
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   431
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   432
writeln"Problem 40.  AMENDED";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   433
goal HOL.thy "(? y. ! x. F x y = F x x)  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   434
\       -->  ~ (! x. ? y. ! z. F z y = (~F z x))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   435
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   436
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   437
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   438
writeln"Problem 41";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
   439
goal HOL.thy "(! z. (? y. (! x. f x y = (f x z & ~ f x x))))    \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   440
\              --> ~ (? z. ! x. f x z)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   441
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   442
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   443
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   444
writeln"Problem 42";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   445
goal HOL.thy "~ (? y. ! x. p x y = (~ (? z. p x z & p z x)))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   446
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   447
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   448
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   449
writeln"Problem 43  NOW PROVED AUTOMATICALLY!!";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
   450
goal HOL.thy "(! x. ! y. q x y = (! z. p z x = (p z y::bool)))  \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   451
\         --> (! x. (! y. q x y = (q y x::bool)))";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1718
diff changeset
   452
by (safe_best_meson_tac 1);     
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   453
(*1.6 secs; iter. deepening is slightly slower*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   454
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   455
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   456
writeln"Problem 44";  (*13 Horn clauses; 7-step proof*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   457
goal HOL.thy "(! x. f x -->                                    \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   458
\             (? y. g y & h x y & (? y. g y & ~ h x y)))  &   \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   459
\             (? x. j x & (! y. g y --> h x y))               \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   460
\             --> (? x. j x & ~f x)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   461
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   462
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   463
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   464
writeln"Problem 45";  (*27 Horn clauses; 54-step proof*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   465
goal HOL.thy "(! x. f x & (! y. g y & h x y --> j x y)        \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   466
\                     --> (! y. g y & h x y --> k y)) &       \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   467
\     ~ (? y. l y & k y) &                                    \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   468
\     (? x. f x & (! y. h x y --> l y)                        \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   469
\                  & (! y. g y & h x y --> j x y))             \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   470
\     --> (? x. f x & ~ (? y. g y & h x y))";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1718
diff changeset
   471
by (safe_best_meson_tac 1);     
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   472
(*1.6 secs; iter. deepening is slightly slower*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   473
result();
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   474
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   475
writeln"Problem 46";  (*26 Horn clauses; 21-step proof*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   476
goal HOL.thy
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   477
    "(! x. f x & (! y. f y & h y x --> g y) --> g x) &      \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   478
\    ((? x.f x & ~g x) -->                                    \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   479
\     (? x. f x & ~g x & (! y. f y & ~g y --> j x y))) &    \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   480
\    (! x y. f x & f y & h x y --> ~j y x)                    \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   481
\     --> (! x. f x --> g x)";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1718
diff changeset
   482
by (safe_best_meson_tac 1);     
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   483
(*1.7 secs; iter. deepening is slightly slower*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   484
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   485
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   486
writeln"Problem 47.  Schubert's Steamroller";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1718
diff changeset
   487
        (*26 clauses; 63 Horn clauses*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   488
goal HOL.thy
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   489
    "(! x. P1 x --> P0 x) & (? x.P1 x) &     \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   490
\    (! x. P2 x --> P0 x) & (? x.P2 x) &     \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   491
\    (! x. P3 x --> P0 x) & (? x.P3 x) &     \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   492
\    (! x. P4 x --> P0 x) & (? x.P4 x) &     \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   493
\    (! x. P5 x --> P0 x) & (? x.P5 x) &     \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   494
\    (! x. Q1 x --> Q0 x) & (? x.Q1 x) &     \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   495
\    (! x. P0 x --> ((! y.Q0 y-->R x y) |    \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   496
\                     (! y.P0 y & S y x &     \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   497
\                          (? z.Q0 z&R y z) --> R x y))) &   \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   498
\    (! x y. P3 y & (P5 x|P4 x) --> S x y) &        \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   499
\    (! x y. P3 x & P2 y --> S x y) &        \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   500
\    (! x y. P2 x & P1 y --> S x y) &        \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   501
\    (! x y. P1 x & (P2 y|Q1 y) --> ~R x y) &       \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   502
\    (! x y. P3 x & P4 y --> R x y) &        \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   503
\    (! x y. P3 x & P5 y --> ~R x y) &       \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   504
\    (! x. (P4 x|P5 x) --> (? y.Q0 y & R x y))      \
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   505
\    --> (? x y. P0 x & P0 y & (? z. Q1 z & R y z & R x y))";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1718
diff changeset
   506
by (safe_meson_tac 1);   (*119 secs*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   507
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   508
1259
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   509
(*The Los problem?  Circulated by John Harrison*)
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
   510
goal HOL.thy "(! x y z. P x y & P y z --> P x z) &      \
2615
99df9182f5a5 Tidying and a corrected comment
paulson
parents: 2575
diff changeset
   511
\      (! x y z. Q x y & Q y z --> Q x z) &             \
99df9182f5a5 Tidying and a corrected comment
paulson
parents: 2575
diff changeset
   512
\      (! x y. P x y --> P y x) &                       \
99df9182f5a5 Tidying and a corrected comment
paulson
parents: 2575
diff changeset
   513
\      (! x y. P x y | Q x y)                           \
1259
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   514
\      --> (! x y. P x y) | (! x y. Q x y)";
2615
99df9182f5a5 Tidying and a corrected comment
paulson
parents: 2575
diff changeset
   515
by (safe_best_meson_tac 1);     (*2.3 secs; iter. deepening is VERY slow*)
1259
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   516
result();
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   517
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   518
(*A similar example, suggested by Johannes Schumann and credited to Pelletier*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   519
goal HOL.thy "(!x y z. P x y --> P y z --> P x z) --> \
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
   520
\       (!x y z. Q x y --> Q y z --> Q x z) --> \
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
   521
\       (!x y.Q x y --> Q y x) -->  (!x y. P x y | Q x y) --> \
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
   522
\       (!x y.P x y) | (!x y.Q x y)";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   523
by (safe_best_meson_tac 1);          (*2.7 secs*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   524
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   525
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   526
writeln"Problem 50";  
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   527
(*What has this to do with equality?*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   528
goal HOL.thy "(! x. P a x | (! y.P x y)) --> (? x. ! y.P x y)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   529
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   530
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   531
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   532
writeln"Problem 55";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   533
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   534
(*Non-equational version, from Manthey and Bry, CADE-9 (Springer, 1988).
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   535
  meson_tac cannot report who killed Agatha. *)
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   536
goal HOL.thy "lives agatha & lives butler & lives charles & \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   537
\  (killed agatha agatha | killed butler agatha | killed charles agatha) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   538
\  (!x y. killed x y --> hates x y & ~richer x y) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   539
\  (!x. hates agatha x --> ~hates charles x) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   540
\  (hates agatha agatha & hates agatha charles) & \
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   541
\  (!x. lives x & ~richer x agatha --> hates butler x) & \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   542
\  (!x. hates agatha x --> hates butler x) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   543
\  (!x. ~hates x agatha | ~hates x butler | ~hates x charles) --> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   544
\  (? x. killed x agatha)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   545
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   546
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   547
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   548
writeln"Problem 57";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   549
goal HOL.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   550
    "P (f a b) (f b c) & P (f b c) (f a c) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   551
\    (! x y z. P x y & P y z --> P x z)    -->   P (f a b) (f a c)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   552
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   553
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   554
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   555
writeln"Problem 58";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   556
(* Challenge found on info-hol *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   557
goal HOL.thy
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   558
    "! P Q R x. ? v w. ! y z. P x & Q y --> (P v | R w) & (R z --> Q v)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   559
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   560
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   561
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   562
writeln"Problem 59";
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   563
goal HOL.thy "(! x. P x = (~P(f x))) --> (? x. P x & ~P(f x))";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   564
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   565
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   566
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   567
writeln"Problem 60";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   568
goal HOL.thy "! x. P x (f x) = (? y. (! z. P z y --> P z (f x)) & P x y)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   569
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   570
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   571
2715
79c35a051196 Updated reference to Pelletier erratum
paulson
parents: 2615
diff changeset
   572
writeln"Problem 62 as corrected in JAR 18 (1997), page 135";
1404
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 1259
diff changeset
   573
goal HOL.thy
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
   574
    "(ALL x. p a & (p x --> p(f x)) --> p(f(f x)))  =   \
5d7a7e439cec expanded tabs
clasohm
parents: 1404
diff changeset
   575
\    (ALL x. (~ p a | p x | p(f(f x))) &                        \
1404
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 1259
diff changeset
   576
\            (~ p a | ~ p(f x) | p(f(f x))))";
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 1259
diff changeset
   577
by (safe_meson_tac 1);
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 1259
diff changeset
   578
result();
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 1259
diff changeset
   579
1586
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   580
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   581
(** Charles Morgan's problems **)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   582
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   583
val axa = "! x y.   T(i x(i y x))";
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   584
val axb = "! x y z. T(i(i x(i y z))(i(i x y)(i x z)))";
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   585
val axc = "! x y.   T(i(i(n x)(n y))(i y x))";
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   586
val axd = "! x y.   T(i x y) & T x --> T y";
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   587
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   588
fun axjoin ([],   q) = q
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   589
  | axjoin (p::ps, q) = "(" ^ p ^ ") --> (" ^ axjoin(ps,q) ^ ")";
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   590
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   591
goal HOL.thy (axjoin([axa,axb,axd], "! x. T(i x x)"));
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   592
by (safe_meson_tac 1);  
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   593
result();
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   594
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   595
writeln"Problem 66";  
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   596
goal HOL.thy (axjoin([axa,axb,axc,axd], "! x. T(i x(n(n x)))"));
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   597
(*TOO SLOW: more than 24 minutes!
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   598
by (safe_meson_tac 1);
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   599
result();
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   600
*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   601
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   602
writeln"Problem 67";  
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   603
goal HOL.thy (axjoin([axa,axb,axc,axd], "! x. T(i(n(n x)) x)"));
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   604
(*TOO SLOW: more than 3 minutes!
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   605
by (safe_meson_tac 1);
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   606
result();
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   607
*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   608
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   609
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   610
(*Restore original values*)
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   611
Unify.trace_bound := orig_trace_bound;
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   612
Unify.search_bound := orig_search_bound;
d91296e4deb3 New safe_meson_tac proves some harder theorems
paulson
parents: 1465
diff changeset
   613
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   614
writeln"Reached end of file.";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   615
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   616
(*26 August 1992: loaded in 277 secs.  New Jersey v 75*)