src/HOL/ex/mesontest.ML
author paulson
Thu, 14 Dec 1995 12:49:32 +0100
changeset 1404 57c3f6d2e692
parent 1259 6f5d2d76e19b
child 1465 5d7a7e439cec
permissions -rw-r--r--
Added Pelletier's problem 62, as corrected in AAR Newletter #31
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     1
(*  Title: 	HOL/ex/meson
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
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
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     9
show_hyps:=false;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    10
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    11
by (rtac ccontr 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    12
val [prem] = gethyps 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    13
val nnf = make_nnf prem;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    14
val xsko = skolemize nnf;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    15
by (cut_facts_tac [xsko] 1 THEN REPEAT (etac exE 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    16
val [_,sko] = gethyps 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    17
val clauses = make_clauses [sko];	
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    18
val horns = make_horns clauses;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    19
val go::_ = neg_clauses clauses;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    20
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    21
goal HOL.thy "False";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    22
by (rtac (make_goal go) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    23
by (prolog_step_tac horns 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    24
by (depth_prolog_tac horns);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    25
by (best_prolog_tac size_of_subgoals horns);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    26
*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    27
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    28
writeln"File HOL/ex/meson-test.";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    29
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    30
(**** Interactive examples ****)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    31
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    32
(*Generate nice names for Skolem functions*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    33
Logic.auto_rename := true; Logic.set_rename_prefix "a";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    34
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    35
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    36
writeln"Problem 25";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    37
goal HOL.thy "(? x. P(x)) &  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    38
\       (! x. L(x) --> ~ (M(x) & R(x))) &  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    39
\       (! x. P(x) --> (M(x) & L(x))) &   \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    40
\       ((! x. P(x)-->Q(x)) | (? x. P(x)&R(x)))  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    41
\   --> (? x. Q(x)&P(x))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    42
by (rtac ccontr 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    43
val [prem25] = gethyps 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    44
val nnf25 = make_nnf prem25;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    45
val xsko25 = skolemize nnf25;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    46
by (cut_facts_tac [xsko25] 1 THEN REPEAT (etac exE 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    47
val [_,sko25] = gethyps 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    48
val clauses25 = make_clauses [sko25];	(*7 clauses*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    49
val horns25 = make_horns clauses25;	(*16 Horn clauses*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    50
val go25::_ = neg_clauses clauses25;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    51
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    52
goal HOL.thy "False";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    53
by (rtac (make_goal go25) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    54
by (depth_prolog_tac horns25);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    55
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    56
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    57
writeln"Problem 26";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    58
goal HOL.thy "((? x. p(x)) = (? x. q(x))) &	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    59
\     (! x. ! y. p(x) & q(y) --> (r(x) = s(y)))	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    60
\ --> ((! x. p(x)-->r(x)) = (! x. q(x)-->s(x)))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    61
by (rtac ccontr 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    62
val [prem26] = gethyps 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    63
val nnf26 = make_nnf prem26;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    64
val xsko26 = skolemize nnf26;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    65
by (cut_facts_tac [xsko26] 1 THEN REPEAT (etac exE 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    66
val [_,sko26] = gethyps 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    67
val clauses26 = make_clauses [sko26];			(*9 clauses*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    68
val horns26 = make_horns clauses26;			(*24 Horn clauses*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    69
val go26::_ = neg_clauses clauses26;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    70
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    71
goal HOL.thy "False";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    72
by (rtac (make_goal go26) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    73
by (depth_prolog_tac horns26);	(*6 secs*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    74
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    75
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    76
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    77
writeln"Problem 43  NOW PROVED AUTOMATICALLY!!";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    78
goal HOL.thy "(! x. ! y. q x y = (! z. p z x = (p z y::bool)))	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    79
\         --> (! x. (! y. q x y = (q y x::bool)))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    80
by (rtac ccontr 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    81
val [prem43] = gethyps 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    82
val nnf43 = make_nnf prem43;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    83
val xsko43 = skolemize nnf43;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    84
by (cut_facts_tac [xsko43] 1 THEN REPEAT (etac exE 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    85
val [_,sko43] = gethyps 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    86
val clauses43 = make_clauses [sko43];	(*6*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    87
val horns43 = make_horns clauses43;	(*16*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    88
val go43::_ = neg_clauses clauses43;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    89
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    90
goal HOL.thy "False";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    91
by (rtac (make_goal go43) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    92
by (best_prolog_tac size_of_subgoals horns43);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    93
(*8.7 secs*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    94
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    95
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    96
(*Restore variable name preservation*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    97
Logic.auto_rename := false; 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    98
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    99
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   100
(**** Batch test data ****)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   101
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   102
(*Sample problems from 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   103
  F. J. Pelletier, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   104
  Seventy-Five Problems for Testing Automatic Theorem Provers,
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   105
  J. Automated Reasoning 2 (1986), 191-216.
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   106
  Errata, JAR 4 (1988), 236-236.
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   107
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   108
The hardest problems -- judging by experience with several theorem provers,
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   109
including matrix ones -- are 34 and 43.
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   110
*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   111
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   112
writeln"Pelletier's examples";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   113
(*1*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   114
goal HOL.thy "(P-->Q)  =  (~Q --> ~P)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   115
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   116
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   117
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   118
(*2*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   119
goal HOL.thy "(~ ~ P) =  P";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   120
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   121
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   122
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   123
(*3*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   124
goal HOL.thy "~(P-->Q) --> (Q-->P)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   125
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   126
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   127
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   128
(*4*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   129
goal HOL.thy "(~P-->Q)  =  (~Q --> P)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   130
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   131
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   132
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   133
(*5*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   134
goal HOL.thy "((P|Q)-->(P|R)) --> (P|(Q-->R))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   135
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   136
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   137
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   138
(*6*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   139
goal HOL.thy "P | ~ P";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   140
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   141
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   142
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   143
(*7*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   144
goal HOL.thy "P | ~ ~ ~ P";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   145
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   146
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   147
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   148
(*8.  Peirce's law*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   149
goal HOL.thy "((P-->Q) --> P)  -->  P";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   150
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   151
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   152
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   153
(*9*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   154
goal HOL.thy "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   155
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   156
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   157
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   158
(*10*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   159
goal HOL.thy "(Q-->R) & (R-->P&Q) & (P-->Q|R) --> (P=Q)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   160
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   161
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   162
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   163
(*11.  Proved in each direction (incorrectly, says Pelletier!!)  *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   164
goal HOL.thy "P=(P::bool)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   165
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   166
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   167
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   168
(*12.  "Dijkstra's law"*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   169
goal HOL.thy "((P = Q) = R) = (P = (Q = R))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   170
by (best_meson_tac size_of_subgoals 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   171
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   172
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   173
(*13.  Distributive law*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   174
goal HOL.thy "(P | (Q & R)) = ((P | Q) & (P | R))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   175
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   176
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   177
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   178
(*14*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   179
goal HOL.thy "(P = Q) = ((Q | ~P) & (~Q|P))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   180
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   181
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   182
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   183
(*15*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   184
goal HOL.thy "(P --> Q) = (~P | Q)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   185
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   186
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   187
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   188
(*16*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   189
goal HOL.thy "(P-->Q) | (Q-->P)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   190
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   191
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   192
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   193
(*17*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   194
goal HOL.thy "((P & (Q-->R))-->S)  =  ((~P | Q | S) & (~P | ~R | S))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   195
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   196
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   197
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   198
writeln"Classical Logic: examples with quantifiers";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   199
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   200
goal HOL.thy "(! x. P(x) & Q(x)) = ((! x. P(x)) & (! x. Q(x)))";
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
goal HOL.thy "(? x. P-->Q(x))  =  (P --> (? x.Q(x)))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   205
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   206
result(); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   207
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   208
goal HOL.thy "(? x.P(x)-->Q) = ((! x.P(x)) --> Q)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   209
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   210
result(); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   211
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   212
goal HOL.thy "((! x.P(x)) | Q)  =  (! x. P(x) | Q)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   213
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   214
result(); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   215
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   216
goal HOL.thy "(! x. P(x)-->P(f(x)))  &  P(d)-->P(f(f(f(d))))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   217
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   218
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   219
1259
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   220
(*Needs double instantiation of EXISTS*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   221
goal HOL.thy "? x. P(x) --> P(a) & P(b)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   222
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   223
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   224
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   225
goal HOL.thy "? z. P(z) --> (! x. P(x))";
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
writeln"Hard examples with quantifiers";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   230
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   231
writeln"Problem 18";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   232
goal HOL.thy "? y. ! x. P(y)-->P(x)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   233
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   234
result(); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   235
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   236
writeln"Problem 19";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   237
goal HOL.thy "? x. ! y z. (P(y)-->Q(z)) --> (P(x)-->Q(x))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   238
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   239
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   240
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   241
writeln"Problem 20";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   242
goal HOL.thy "(! x y. ? z. ! w. (P(x)&Q(y)-->R(z)&S(w)))     \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   243
\   --> (? x y. P(x) & Q(y)) --> (? z. R(z))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   244
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   245
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   246
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   247
writeln"Problem 21";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   248
goal HOL.thy "(? x. P-->Q(x)) & (? x. Q(x)-->P) --> (? x. P=Q(x))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   249
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   250
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   251
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   252
writeln"Problem 22";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   253
goal HOL.thy "(! x. P = Q(x))  -->  (P = (! x. Q(x)))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   254
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   255
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   256
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   257
writeln"Problem 23";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   258
goal HOL.thy "(! x. P | Q(x))  =  (P | (! x. Q(x)))";
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
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   262
writeln"Problem 24";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   263
goal HOL.thy "~(? x. S(x)&Q(x)) & (! x. P(x) --> Q(x)|R(x)) &  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   264
\    ~(? x.P(x)) --> (? x.Q(x)) & (! x. Q(x)|R(x) --> S(x))  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   265
\   --> (? x. P(x)&R(x))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   266
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   267
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   268
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   269
writeln"Problem 25";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   270
goal HOL.thy "(? x. P(x)) &  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   271
\       (! x. L(x) --> ~ (M(x) & R(x))) &  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   272
\       (! x. P(x) --> (M(x) & L(x))) &   \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   273
\       ((! x. P(x)-->Q(x)) | (? x. P(x)&R(x)))  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   274
\   --> (? x. Q(x)&P(x))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   275
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   276
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   277
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   278
writeln"Problem 26";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   279
goal HOL.thy "((? x. p(x)) = (? x. q(x))) &	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   280
\     (! x. ! y. p(x) & q(y) --> (r(x) = s(y)))	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   281
\ --> ((! x. p(x)-->r(x)) = (! x. q(x)-->s(x)))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   282
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   283
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   284
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   285
writeln"Problem 27";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   286
goal HOL.thy "(? x. P(x) & ~Q(x)) &   \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   287
\             (! x. P(x) --> R(x)) &   \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   288
\             (! x. M(x) & L(x) --> P(x)) &   \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   289
\             ((? x. R(x) & ~ Q(x)) --> (! x. L(x) --> ~ R(x)))  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   290
\         --> (! x. M(x) --> ~L(x))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   291
by (safe_meson_tac 1); 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   292
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   293
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   294
writeln"Problem 28.  AMENDED";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   295
goal HOL.thy "(! x. P(x) --> (! x. Q(x))) &   \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   296
\       ((! x. Q(x)|R(x)) --> (? x. Q(x)&S(x))) &  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   297
\       ((? x.S(x)) --> (! x. L(x) --> M(x)))  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   298
\   --> (! x. P(x) & L(x) --> M(x))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   299
by (safe_meson_tac 1);  
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   300
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   301
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   302
writeln"Problem 29.  Essentially the same as Principia Mathematica *11.71";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   303
goal HOL.thy "(? x. F(x)) & (? y. G(y))  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   304
\   --> ( ((! x. F(x)-->H(x)) & (! y. G(y)-->J(y)))  =   \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   305
\         (! x y. F(x) & G(y) --> H(x) & J(y)))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   306
by (safe_meson_tac 1);		(*5 secs*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   307
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   308
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   309
writeln"Problem 30";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   310
goal HOL.thy "(! x. P(x) | Q(x) --> ~ R(x)) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   311
\       (! x. (Q(x) --> ~ S(x)) --> P(x) & R(x))  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   312
\   --> (! x. S(x))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   313
by (safe_meson_tac 1);  
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   314
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   315
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   316
writeln"Problem 31";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   317
goal HOL.thy "~(? x.P(x) & (Q(x) | R(x))) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   318
\       (? x. L(x) & P(x)) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   319
\       (! x. ~ R(x) --> M(x))  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   320
\   --> (? x. L(x) & M(x))";
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
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   324
writeln"Problem 32";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   325
goal HOL.thy "(! x. P(x) & (Q(x)|R(x))-->S(x)) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   326
\       (! x. S(x) & R(x) --> L(x)) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   327
\       (! x. M(x) --> R(x))  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   328
\   --> (! x. P(x) & M(x) --> L(x))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   329
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   330
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   331
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   332
writeln"Problem 33";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   333
goal HOL.thy "(! x. P(a) & (P(x)-->P(b))-->P(c))  =    \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   334
\    (! x. (~P(a) | P(x) | P(c)) & (~P(a) | ~P(b) | P(c)))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   335
by (safe_meson_tac 1);		(*5.6 secs*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   336
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   337
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   338
writeln"Problem 34  AMENDED (TWICE!!)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   339
(*Andrews's challenge*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   340
goal HOL.thy "((? x. ! y. p(x) = p(y))  =		\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   341
\              ((? x. q(x)) = (! y. p(y))))     =	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   342
\             ((? x. ! y. q(x) = q(y))  =		\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   343
\              ((? x. p(x)) = (! y. q(y))))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   344
by (safe_meson_tac 1);  	(*90 secs*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   345
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   346
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   347
writeln"Problem 35";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   348
goal HOL.thy "? x y. P x y -->  (! u v. P u v)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   349
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   350
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   351
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   352
writeln"Problem 36";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   353
goal HOL.thy "(! x. ? y. J x y) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   354
\       (! x. ? y. G x y) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   355
\       (! x y. J x y | G x y -->	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   356
\       (! z. J y z | G y z --> H x z))   \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   357
\   --> (! x. ? y. H x y)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   358
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   359
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   360
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   361
writeln"Problem 37";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   362
goal HOL.thy "(! z. ? w. ! x. ? y. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   363
\          (P x z-->P y w) & P y z & (P y w --> (? u.Q u w))) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   364
\       (! x z. ~P x z --> (? y. Q y z)) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   365
\       ((? x y. Q x y) --> (! x. R x x))  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   366
\   --> (! x. ? y. R x y)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   367
by (safe_meson_tac 1);   (*causes unification tracing messages*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   368
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   369
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   370
writeln"Problem 38";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   371
goal HOL.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   372
    "(! x. p(a) & (p(x) --> (? y. p(y) & r x y)) -->		\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   373
\          (? z. ? w. p(z) & r x w & r w z))  =			\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   374
\    (! x. (~p(a) | p(x) | (? z. ? w. p(z) & r x w & r w z)) &	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   375
\          (~p(a) | ~(? y. p(y) & r x y) |			\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   376
\           (? z. ? w. p(z) & r x w & r w z)))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   377
by (safe_meson_tac 1);		(*62 secs*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   378
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   379
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   380
writeln"Problem 39";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   381
goal HOL.thy "~ (? x. ! y. F y x = (~F y y))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   382
by (safe_meson_tac 1);
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
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   385
writeln"Problem 40.  AMENDED";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   386
goal HOL.thy "(? y. ! x. F x y = F x x)  \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   387
\       -->  ~ (! x. ? y. ! z. F z y = (~F z x))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   388
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   389
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   390
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   391
writeln"Problem 41";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   392
goal HOL.thy "(! z. (? y. (! x. f x y = (f x z & ~ f x x))))	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   393
\              --> ~ (? z. ! x. f x z)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   394
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   395
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   396
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   397
writeln"Problem 42";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   398
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
   399
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   400
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   401
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   402
writeln"Problem 43  NOW PROVED AUTOMATICALLY!!";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   403
goal HOL.thy "(! x. ! y. q x y = (! z. p z x = (p z y::bool)))	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   404
\         --> (! x. (! y. q x y = (q y x::bool)))";
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
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   408
writeln"Problem 44";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   409
goal HOL.thy "(! x. f(x) -->					\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   410
\             (? y. g(y) & h x y & (? y. g(y) & ~ h x y)))  &  	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   411
\             (? x. j(x) & (! y. g(y) --> h x y))		\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   412
\             --> (? x. j(x) & ~f(x))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   413
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   414
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   415
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   416
writeln"Problem 45";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   417
goal HOL.thy "(! x. f(x) & (! y. g(y) & h x y --> j x y)	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   418
\                     --> (! y. g(y) & h x y --> k(y))) &	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   419
\     ~ (? y. l(y) & k(y)) &					\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   420
\     (? x. f(x) & (! y. h x y --> l(y))			\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   421
\                  & (! y. g(y) & h x y --> j x y))		\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   422
\     --> (? x. f(x) & ~ (? y. g(y) & h x y))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   423
by (safe_meson_tac 1);  	(*11 secs*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   424
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   425
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   426
writeln"Problem 46";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   427
goal HOL.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   428
    "(! x. f(x) & (! y. f(y) & h y x --> g(y)) --> g(x)) &	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   429
\    ((? x.f(x) & ~g(x)) -->					\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   430
\     (? x. f(x) & ~g(x) & (! y. f(y) & ~g(y) --> j x y))) &	\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   431
\    (! x y. f(x) & f(y) & h x y --> ~j y x)			\
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   432
\     --> (! x. f(x) --> g(x))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   433
by (safe_meson_tac 1); 		(*11 secs*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   434
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   435
1259
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   436
(*The Los problem?  Circulated by John Harrison*)
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   437
goal HOL.thy "(! x y z. P x y & P y z --> P x z) &	\
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   438
\      (! x y z. Q x y & Q y z --> Q x z) &	\
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   439
\      (! x y. P x y --> P y x) &	\
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   440
\      (! (x::'a) y. P x y | Q x y)	\
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   441
\      --> (! x y. P x y) | (! x y. Q x y)";
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   442
by (safe_meson_tac 1);
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   443
result();
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   444
6f5d2d76e19b added new example by John Harrison
paulson
parents: 969
diff changeset
   445
(*A similar example, suggested by Johannes Schumann and credited to Pelletier*)
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   446
goal HOL.thy "(!x y z. P x y --> P y z --> P x z) --> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   447
\	(!x y z. Q x y --> Q y z --> Q x z) --> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   448
\	(!x y.Q x y --> Q y x) -->  (!x y. P x y | Q x y) --> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   449
\	(!x y.P x y) | (!x y.Q x y)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   450
by (safe_meson_tac 1);		(*32 secs*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   451
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   452
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   453
writeln"Problem 50";  
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   454
(*What has this to do with equality?*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   455
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
   456
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   457
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   458
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   459
writeln"Problem 55";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   460
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   461
(*Non-equational version, from Manthey and Bry, CADE-9 (Springer, 1988).
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   462
  meson_tac cannot report who killed Agatha. *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   463
goal HOL.thy "lives(agatha) & lives(butler) & lives(charles) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   464
\  (killed agatha agatha | killed butler agatha | killed charles agatha) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   465
\  (!x y. killed x y --> hates x y & ~richer x y) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   466
\  (!x. hates agatha x --> ~hates charles x) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   467
\  (hates agatha agatha & hates agatha charles) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   468
\  (!x. lives(x) & ~richer x agatha --> hates butler x) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   469
\  (!x. hates agatha x --> hates butler x) & \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   470
\  (!x. ~hates x agatha | ~hates x butler | ~hates x charles) --> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   471
\  (? x. killed x agatha)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   472
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   473
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   474
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   475
writeln"Problem 57";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   476
goal HOL.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   477
    "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
   478
\    (! 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
   479
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   480
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   481
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   482
writeln"Problem 58";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   483
(* Challenge found on info-hol *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   484
goal HOL.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   485
    "! P Q R x. ? v w. ! y z. P(x) & Q(y) --> (P(v) | R(w)) & (R(z) --> Q(v))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   486
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   487
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   488
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   489
writeln"Problem 59";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   490
goal HOL.thy "(! x. P(x) = (~P(f(x)))) --> (? x. P(x) & ~P(f(x)))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   491
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   492
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   493
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   494
writeln"Problem 60";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   495
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
   496
by (safe_meson_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   497
result();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   498
1404
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 1259
diff changeset
   499
writeln"Problem 62 as corrected in AAR newletter #31";
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 1259
diff changeset
   500
goal HOL.thy
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 1259
diff changeset
   501
    "(ALL x. p a & (p x --> p(f x)) --> p(f(f x)))  =	\
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 1259
diff changeset
   502
\    (ALL x. (~ p a | p x | p(f(f x))) &			\
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 1259
diff changeset
   503
\            (~ p a | ~ p(f x) | p(f(f x))))";
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 1259
diff changeset
   504
by (safe_meson_tac 1);
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 1259
diff changeset
   505
result();
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 1259
diff changeset
   506
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   507
writeln"Reached end of file.";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   508
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   509
(*26 August 1992: loaded in 277 secs.  New Jersey v 75*)