Uses Goal instead of "goal...thy" to avoid theory problems
authorpaulson
Fri, 14 Aug 1998 12:02:35 +0200
changeset 53173a9214482762
parent 5316 7a8975451a89
child 5318 72bf8039b53f
Uses Goal instead of "goal...thy" to avoid theory problems
src/HOL/ex/meson.ML
src/HOL/ex/mesontest.ML
     1.1 --- a/src/HOL/ex/meson.ML	Thu Aug 13 18:14:26 1998 +0200
     1.2 +++ b/src/HOL/ex/meson.ML	Fri Aug 14 12:02:35 1998 +0200
     1.3 @@ -13,6 +13,8 @@
     1.4  
     1.5  writeln"File HOL/ex/meson.";
     1.6  
     1.7 +context HOL.thy;
     1.8 +
     1.9  (*Prove theorems using fast_tac*)
    1.10  fun prove_fun s = 
    1.11      prove_goal HOL.thy s
    1.12 @@ -72,7 +74,7 @@
    1.13  (*** Generation of contrapositives ***)
    1.14  
    1.15  (*Inserts negated disjunct after removing the negation; P is a literal*)
    1.16 -val [major,minor] = goal HOL.thy "~P|Q ==> ((~P==>P) ==> Q)";
    1.17 +val [major,minor] = Goal "~P|Q ==> ((~P==>P) ==> Q)";
    1.18  by (rtac (major RS disjE) 1);
    1.19  by (rtac notE 1);
    1.20  by (etac minor 2);
    1.21 @@ -80,15 +82,12 @@
    1.22  qed "make_neg_rule";
    1.23  
    1.24  (*For Plaisted's "Postive refinement" of the MESON procedure*)
    1.25 -val [major,minor] = goal HOL.thy "~P|Q ==> (P ==> Q)";
    1.26 -by (rtac (major RS disjE) 1);
    1.27 -by (rtac notE 1);
    1.28 -by (rtac minor 2);
    1.29 -by (ALLGOALS assume_tac);
    1.30 +Goal "~P|Q ==> (P ==> Q)";
    1.31 +by (Blast_tac 1);
    1.32  qed "make_refined_neg_rule";
    1.33  
    1.34  (*P should be a literal*)
    1.35 -val [major,minor] = goal HOL.thy "P|Q ==> ((P==>~P) ==> Q)";
    1.36 +val [major,minor] = Goal "P|Q ==> ((P==>~P) ==> Q)";
    1.37  by (rtac (major RS disjE) 1);
    1.38  by (rtac notE 1);
    1.39  by (etac minor 1);
    1.40 @@ -97,13 +96,13 @@
    1.41  
    1.42  (*** Generation of a goal clause -- put away the final literal ***)
    1.43  
    1.44 -val [major,minor] = goal HOL.thy "~P ==> ((~P==>P) ==> False)";
    1.45 +val [major,minor] = Goal "~P ==> ((~P==>P) ==> False)";
    1.46  by (rtac notE 1);
    1.47  by (rtac minor 2);
    1.48  by (ALLGOALS (rtac major));
    1.49  qed "make_neg_goal";
    1.50  
    1.51 -val [major,minor] = goal HOL.thy "P ==> ((P==>~P) ==> False)";
    1.52 +val [major,minor] = Goal "P ==> ((P==>~P) ==> False)";
    1.53  by (rtac notE 1);
    1.54  by (rtac minor 1);
    1.55  by (ALLGOALS (rtac major));
    1.56 @@ -114,28 +113,28 @@
    1.57  
    1.58  (*NOTE: could handle conjunctions (faster?) by
    1.59      nf(th RS conjunct2) RS (nf(th RS conjunct1) RS conjI) *)
    1.60 -val major::prems = goal HOL.thy
    1.61 +val major::prems = Goal
    1.62      "[| P'&Q';  P' ==> P;  Q' ==> Q |] ==> P&Q";
    1.63  by (rtac (major RS conjE) 1);
    1.64  by (rtac conjI 1);
    1.65  by (ALLGOALS (eresolve_tac prems));
    1.66  qed "conj_forward";
    1.67  
    1.68 -val major::prems = goal HOL.thy
    1.69 +val major::prems = Goal
    1.70      "[| P'|Q';  P' ==> P;  Q' ==> Q |] ==> P|Q";
    1.71  by (rtac (major RS disjE) 1);
    1.72  by (ALLGOALS (dresolve_tac prems));
    1.73  by (ALLGOALS (eresolve_tac [disjI1,disjI2]));
    1.74  qed "disj_forward";
    1.75  
    1.76 -val major::prems = goal HOL.thy
    1.77 +val major::prems = Goal
    1.78      "[| ! x. P'(x);  !!x. P'(x) ==> P(x) |] ==> ! x. P(x)";
    1.79  by (rtac allI 1);
    1.80  by (resolve_tac prems 1);
    1.81  by (rtac (major RS spec) 1);
    1.82  qed "all_forward";
    1.83  
    1.84 -val major::prems = goal HOL.thy
    1.85 +val major::prems = Goal
    1.86      "[| ? x. P'(x);  !!x. P'(x) ==> P(x) |] ==> ? x. P(x)";
    1.87  by (rtac (major RS exE) 1);
    1.88  by (rtac exI 1);
    1.89 @@ -249,7 +248,7 @@
    1.90  (**** Removal of duplicate literals ****)
    1.91  
    1.92  (*Version for removal of duplicate literals*)
    1.93 -val major::prems = goal HOL.thy
    1.94 +val major::prems = Goal
    1.95      "[| P'|Q';  P' ==> P;  [| Q'; P==>False |] ==> Q |] ==> P|Q";
    1.96  by (rtac (major RS disjE) 1);
    1.97  by (rtac disjI1 1);
     2.1 --- a/src/HOL/ex/mesontest.ML	Thu Aug 13 18:14:26 1998 +0200
     2.2 +++ b/src/HOL/ex/mesontest.ML	Fri Aug 14 12:02:35 1998 +0200
     2.3 @@ -21,7 +21,7 @@
     2.4  val horns = make_horns clauses;
     2.5  val goes = gocls clauses;
     2.6  
     2.7 -goal HOL.thy "False";
     2.8 +Goal "False";
     2.9  by (resolve_tac goes 1);
    2.10  keep_derivs := FullDeriv;
    2.11  
    2.12 @@ -33,6 +33,8 @@
    2.13  
    2.14  writeln"File HOL/ex/meson-test.";
    2.15  
    2.16 +context Fun.thy;
    2.17 +
    2.18  (*Deep unifications can be required, esp. during transformation to clauses*)
    2.19  val orig_trace_bound = !Unify.trace_bound
    2.20  and orig_search_bound = !Unify.search_bound;
    2.21 @@ -46,7 +48,7 @@
    2.22  
    2.23  
    2.24  writeln"Problem 25";
    2.25 -goal HOL.thy "(? x. P x) &  \
    2.26 +Goal "(? x. P x) &  \
    2.27  \       (! x. L x --> ~ (M x & R x)) &  \
    2.28  \       (! x. P x --> (M x & L x)) &   \
    2.29  \       ((! x. P x --> Q x) | (? x. P x & R x))  \
    2.30 @@ -61,13 +63,13 @@
    2.31  val horns25 = make_horns clauses25;     (*16 Horn clauses*)
    2.32  val go25::_ = gocls clauses25;
    2.33  
    2.34 -goal HOL.thy "False";
    2.35 +Goal "False";
    2.36  by (rtac go25 1);
    2.37  by (depth_prolog_tac horns25);
    2.38  
    2.39  
    2.40  writeln"Problem 26";
    2.41 -goal HOL.thy "((? x. p x) = (? x. q x)) &     \
    2.42 +Goal "((? x. p x) = (? x. q x)) &     \
    2.43  \     (! x. ! y. p x & q y --> (r x = s y)) \
    2.44  \ --> ((! x. p x --> r x) = (! x. q x --> s x))";
    2.45  by (rtac ccontr 1);
    2.46 @@ -80,14 +82,14 @@
    2.47  val horns26 = make_horns clauses26;                     (*24 Horn clauses*)
    2.48  val go26::_ = gocls clauses26;
    2.49  
    2.50 -goal HOL.thy "False";
    2.51 +Goal "False";
    2.52  by (rtac go26 1);
    2.53  by (depth_prolog_tac horns26);  (*1.4 secs*)
    2.54  (*Proof is of length 107!!*)
    2.55  
    2.56  
    2.57  writeln"Problem 43  NOW PROVED AUTOMATICALLY!!";  (*16 Horn clauses*)
    2.58 -goal HOL.thy "(! x. ! y. q x y = (! z. p z x = (p z y::bool)))  \
    2.59 +Goal "(! x. ! y. q x y = (! z. p z x = (p z y::bool)))  \
    2.60  \         --> (! x. (! y. q x y = (q y x::bool)))";
    2.61  by (rtac ccontr 1);
    2.62  val [prem43] = gethyps 1;
    2.63 @@ -99,7 +101,7 @@
    2.64  val horns43 = make_horns clauses43;     (*16*)
    2.65  val go43::_ = gocls clauses43;
    2.66  
    2.67 -goal HOL.thy "False";
    2.68 +Goal "False";
    2.69  by (rtac go43 1);
    2.70  by (best_prolog_tac size_of_subgoals horns43);   (*1.6 secs*)
    2.71  
    2.72 @@ -157,163 +159,163 @@
    2.73  
    2.74  writeln"Pelletier's examples";
    2.75  (*1*)
    2.76 -goal HOL.thy "(P --> Q)  =  (~Q --> ~P)";
    2.77 +Goal "(P --> Q)  =  (~Q --> ~P)";
    2.78  by (safe_meson_tac 1);
    2.79  result();
    2.80  
    2.81  (*2*)
    2.82 -goal HOL.thy "(~ ~ P) =  P";
    2.83 +Goal "(~ ~ P) =  P";
    2.84  by (safe_meson_tac 1);
    2.85  result();
    2.86  
    2.87  (*3*)
    2.88 -goal HOL.thy "~(P-->Q) --> (Q-->P)";
    2.89 +Goal "~(P-->Q) --> (Q-->P)";
    2.90  by (safe_meson_tac 1);
    2.91  result();
    2.92  
    2.93  (*4*)
    2.94 -goal HOL.thy "(~P-->Q)  =  (~Q --> P)";
    2.95 +Goal "(~P-->Q)  =  (~Q --> P)";
    2.96  by (safe_meson_tac 1);
    2.97  result();
    2.98  
    2.99  (*5*)
   2.100 -goal HOL.thy "((P|Q)-->(P|R)) --> (P|(Q-->R))";
   2.101 +Goal "((P|Q)-->(P|R)) --> (P|(Q-->R))";
   2.102  by (safe_meson_tac 1);
   2.103  result();
   2.104  
   2.105  (*6*)
   2.106 -goal HOL.thy "P | ~ P";
   2.107 +Goal "P | ~ P";
   2.108  by (safe_meson_tac 1);
   2.109  result();
   2.110  
   2.111  (*7*)
   2.112 -goal HOL.thy "P | ~ ~ ~ P";
   2.113 +Goal "P | ~ ~ ~ P";
   2.114  by (safe_meson_tac 1);
   2.115  result();
   2.116  
   2.117  (*8.  Peirce's law*)
   2.118 -goal HOL.thy "((P-->Q) --> P)  -->  P";
   2.119 +Goal "((P-->Q) --> P)  -->  P";
   2.120  by (safe_meson_tac 1);
   2.121  result();
   2.122  
   2.123  (*9*)
   2.124 -goal HOL.thy "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)";
   2.125 +Goal "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)";
   2.126  by (safe_meson_tac 1);
   2.127  result();
   2.128  
   2.129  (*10*)
   2.130 -goal HOL.thy "(Q-->R) & (R-->P&Q) & (P-->Q|R) --> (P=Q)";
   2.131 +Goal "(Q-->R) & (R-->P&Q) & (P-->Q|R) --> (P=Q)";
   2.132  by (safe_meson_tac 1);
   2.133  result();
   2.134  
   2.135  (*11.  Proved in each direction (incorrectly, says Pelletier!!)  *)
   2.136 -goal HOL.thy "P=(P::bool)";
   2.137 +Goal "P=(P::bool)";
   2.138  by (safe_meson_tac 1);
   2.139  result();
   2.140  
   2.141  (*12.  "Dijkstra's law"*)
   2.142 -goal HOL.thy "((P = Q) = R) = (P = (Q = R))";
   2.143 +Goal "((P = Q) = R) = (P = (Q = R))";
   2.144  by (safe_meson_tac 1);
   2.145  result();
   2.146  
   2.147  (*13.  Distributive law*)
   2.148 -goal HOL.thy "(P | (Q & R)) = ((P | Q) & (P | R))";
   2.149 +Goal "(P | (Q & R)) = ((P | Q) & (P | R))";
   2.150  by (safe_meson_tac 1);
   2.151  result();
   2.152  
   2.153  (*14*)
   2.154 -goal HOL.thy "(P = Q) = ((Q | ~P) & (~Q|P))";
   2.155 +Goal "(P = Q) = ((Q | ~P) & (~Q|P))";
   2.156  by (safe_meson_tac 1);
   2.157  result();
   2.158  
   2.159  (*15*)
   2.160 -goal HOL.thy "(P --> Q) = (~P | Q)";
   2.161 +Goal "(P --> Q) = (~P | Q)";
   2.162  by (safe_meson_tac 1);
   2.163  result();
   2.164  
   2.165  (*16*)
   2.166 -goal HOL.thy "(P-->Q) | (Q-->P)";
   2.167 +Goal "(P-->Q) | (Q-->P)";
   2.168  by (safe_meson_tac 1);
   2.169  result();
   2.170  
   2.171  (*17*)
   2.172 -goal HOL.thy "((P & (Q-->R))-->S)  =  ((~P | Q | S) & (~P | ~R | S))";
   2.173 +Goal "((P & (Q-->R))-->S)  =  ((~P | Q | S) & (~P | ~R | S))";
   2.174  by (safe_meson_tac 1);
   2.175  result();
   2.176  
   2.177  writeln"Classical Logic: examples with quantifiers";
   2.178  
   2.179 -goal HOL.thy "(! x. P x & Q x) = ((! x. P x) & (! x. Q x))";
   2.180 +Goal "(! x. P x & Q x) = ((! x. P x) & (! x. Q x))";
   2.181  by (safe_meson_tac 1);
   2.182  result(); 
   2.183  
   2.184 -goal HOL.thy "(? x. P --> Q x)  =  (P --> (? x. Q x))";
   2.185 +Goal "(? x. P --> Q x)  =  (P --> (? x. Q x))";
   2.186  by (safe_meson_tac 1);
   2.187  result(); 
   2.188  
   2.189 -goal HOL.thy "(? x. P x --> Q) = ((! x. P x) --> Q)";
   2.190 +Goal "(? x. P x --> Q) = ((! x. P x) --> Q)";
   2.191  by (safe_meson_tac 1);
   2.192  result(); 
   2.193  
   2.194 -goal HOL.thy "((! x. P x) | Q)  =  (! x. P x | Q)";
   2.195 +Goal "((! x. P x) | Q)  =  (! x. P x | Q)";
   2.196  by (safe_meson_tac 1);
   2.197  result(); 
   2.198  
   2.199 -goal HOL.thy "(! x. P x --> P(f x))  &  P d --> P(f(f(f d)))";
   2.200 +Goal "(! x. P x --> P(f x))  &  P d --> P(f(f(f d)))";
   2.201  by (safe_meson_tac 1);
   2.202  result();
   2.203  
   2.204  (*Needs double instantiation of EXISTS*)
   2.205 -goal HOL.thy "? x. P x --> P a & P b";
   2.206 +Goal "? x. P x --> P a & P b";
   2.207  by (safe_meson_tac 1);
   2.208  result();
   2.209  
   2.210 -goal HOL.thy "? z. P z --> (! x. P x)";
   2.211 +Goal "? z. P z --> (! x. P x)";
   2.212  by (safe_meson_tac 1);
   2.213  result();
   2.214  
   2.215  writeln"Hard examples with quantifiers";
   2.216  
   2.217  writeln"Problem 18";
   2.218 -goal HOL.thy "? y. ! x. P y --> P x";
   2.219 +Goal "? y. ! x. P y --> P x";
   2.220  by (safe_meson_tac 1);
   2.221  result(); 
   2.222  
   2.223  writeln"Problem 19";
   2.224 -goal HOL.thy "? x. ! y z. (P y --> Q z) --> (P x --> Q x)";
   2.225 +Goal "? x. ! y z. (P y --> Q z) --> (P x --> Q x)";
   2.226  by (safe_meson_tac 1);
   2.227  result();
   2.228  
   2.229  writeln"Problem 20";
   2.230 -goal HOL.thy "(! x y. ? z. ! w. (P x & Q y --> R z & S w))     \
   2.231 +Goal "(! x y. ? z. ! w. (P x & Q y --> R z & S w))     \
   2.232  \   --> (? x y. P x & Q y) --> (? z. R z)";
   2.233  by (safe_meson_tac 1); 
   2.234  result();
   2.235  
   2.236  writeln"Problem 21";
   2.237 -goal HOL.thy "(? x. P --> Q x) & (? x. Q x --> P) --> (? x. P=Q x)";
   2.238 +Goal "(? x. P --> Q x) & (? x. Q x --> P) --> (? x. P=Q x)";
   2.239  by (safe_meson_tac 1); 
   2.240  result();
   2.241  
   2.242  writeln"Problem 22";
   2.243 -goal HOL.thy "(! x. P = Q x)  -->  (P = (! x. Q x))";
   2.244 +Goal "(! x. P = Q x)  -->  (P = (! x. Q x))";
   2.245  by (safe_meson_tac 1); 
   2.246  result();
   2.247  
   2.248  writeln"Problem 23";
   2.249 -goal HOL.thy "(! x. P | Q x)  =  (P | (! x. Q x))";
   2.250 +Goal "(! x. P | Q x)  =  (P | (! x. Q x))";
   2.251  by (safe_meson_tac 1);  
   2.252  result();
   2.253  
   2.254  writeln"Problem 24";  (*The first goal clause is useless*)
   2.255 -goal HOL.thy "~(? x. S x & Q x) & (! x. P x --> Q x | R x) &  \
   2.256 +Goal "~(? x. S x & Q x) & (! x. P x --> Q x | R x) &  \
   2.257  \    (~(? x. P x) --> (? x. Q x)) & (! x. Q x | R x --> S x)  \
   2.258  \   --> (? x. P x & R x)";
   2.259  by (safe_meson_tac 1); 
   2.260  result();
   2.261  
   2.262  writeln"Problem 25";
   2.263 -goal HOL.thy "(? x. P x) &  \
   2.264 +Goal "(? x. P x) &  \
   2.265  \       (! x. L x --> ~ (M x & R x)) &  \
   2.266  \       (! x. P x --> (M x & L x)) &   \
   2.267  \       ((! x. P x --> Q x) | (? x. P x & R x))  \
   2.268 @@ -322,14 +324,14 @@
   2.269  result();
   2.270  
   2.271  writeln"Problem 26";  (*24 Horn clauses*)
   2.272 -goal HOL.thy "((? x. p x) = (? x. q x)) &     \
   2.273 +Goal "((? x. p x) = (? x. q x)) &     \
   2.274  \     (! x. ! y. p x & q y --> (r x = s y)) \
   2.275  \ --> ((! x. p x --> r x) = (! x. q x --> s x))";
   2.276  by (safe_meson_tac 1); 
   2.277  result();
   2.278  
   2.279  writeln"Problem 27";    (*13 Horn clauses*)
   2.280 -goal HOL.thy "(? x. P x & ~Q x) &   \
   2.281 +Goal "(? x. P x & ~Q x) &   \
   2.282  \             (! x. P x --> R x) &   \
   2.283  \             (! x. M x & L x --> P x) &   \
   2.284  \             ((? x. R x & ~ Q x) --> (! x. L x --> ~ R x))  \
   2.285 @@ -338,7 +340,7 @@
   2.286  result();
   2.287  
   2.288  writeln"Problem 28.  AMENDED";  (*14 Horn clauses*)
   2.289 -goal HOL.thy "(! x. P x --> (! x. Q x)) &   \
   2.290 +Goal "(! x. P x --> (! x. Q x)) &   \
   2.291  \       ((! x. Q x | R x) --> (? x. Q x & S x)) &  \
   2.292  \       ((? x. S x) --> (! x. L x --> M x))  \
   2.293  \   --> (! x. P x & L x --> M x)";
   2.294 @@ -347,21 +349,21 @@
   2.295  
   2.296  writeln"Problem 29.  Essentially the same as Principia Mathematica *11.71";
   2.297          (*62 Horn clauses*)
   2.298 -goal HOL.thy "(? x. F x) & (? y. G y)  \
   2.299 +Goal "(? x. F x) & (? y. G y)  \
   2.300  \   --> ( ((! x. F x --> H x) & (! y. G y --> J y))  =   \
   2.301  \         (! x y. F x & G y --> H x & J y))";
   2.302  by (safe_meson_tac 1);          (*0.7 secs*)
   2.303  result();
   2.304  
   2.305  writeln"Problem 30";
   2.306 -goal HOL.thy "(! x. P x | Q x --> ~ R x) & \
   2.307 +Goal "(! x. P x | Q x --> ~ R x) & \
   2.308  \       (! x. (Q x --> ~ S x) --> P x & R x)  \
   2.309  \   --> (! x. S x)";
   2.310  by (safe_meson_tac 1);  
   2.311  result();
   2.312  
   2.313  writeln"Problem 31";  (*10 Horn clauses; first negative clauses is useless*)
   2.314 -goal HOL.thy "~(? x. P x & (Q x | R x)) & \
   2.315 +Goal "~(? x. P x & (Q x | R x)) & \
   2.316  \       (? x. L x & P x) & \
   2.317  \       (! x. ~ R x --> M x)  \
   2.318  \   --> (? x. L x & M x)";
   2.319 @@ -369,7 +371,7 @@
   2.320  result();
   2.321  
   2.322  writeln"Problem 32";
   2.323 -goal HOL.thy "(! x. P x & (Q x | R x)-->S x) & \
   2.324 +Goal "(! x. P x & (Q x | R x)-->S x) & \
   2.325  \       (! x. S x & R x --> L x) & \
   2.326  \       (! x. M x --> R x)  \
   2.327  \   --> (! x. P x & M x --> L x)";
   2.328 @@ -377,14 +379,14 @@
   2.329  result();
   2.330  
   2.331  writeln"Problem 33";  (*55 Horn clauses*)
   2.332 -goal HOL.thy "(! x. P a & (P x --> P b)-->P c)  =    \
   2.333 +Goal "(! x. P a & (P x --> P b)-->P c)  =    \
   2.334  \    (! x. (~P a | P x | P c) & (~P a | ~P b | P c))";
   2.335  by (safe_meson_tac 1);          (*5.6 secs*)
   2.336  result();
   2.337  
   2.338  writeln"Problem 34  AMENDED (TWICE!!)"; (*924 Horn clauses*)
   2.339  (*Andrews's challenge*)
   2.340 -goal HOL.thy "((? x. ! y. p x = p y)  =               \
   2.341 +Goal "((? x. ! y. p x = p y)  =               \
   2.342  \              ((? x. q x) = (! y. p y)))     =       \
   2.343  \             ((? x. ! y. q x = q y)  =               \
   2.344  \              ((? x. p x) = (! y. q y)))";
   2.345 @@ -392,12 +394,12 @@
   2.346  result();
   2.347  
   2.348  writeln"Problem 35";
   2.349 -goal HOL.thy "? x y. P x y -->  (! u v. P u v)";
   2.350 +Goal "? x y. P x y -->  (! u v. P u v)";
   2.351  by (safe_meson_tac 1);
   2.352  result();
   2.353  
   2.354  writeln"Problem 36";  (*15 Horn clauses*)
   2.355 -goal HOL.thy "(! x. ? y. J x y) & \
   2.356 +Goal "(! x. ? y. J x y) & \
   2.357  \       (! x. ? y. G x y) & \
   2.358  \       (! x y. J x y | G x y -->       \
   2.359  \       (! z. J y z | G y z --> H x z))   \
   2.360 @@ -406,7 +408,7 @@
   2.361  result();
   2.362  
   2.363  writeln"Problem 37";  (*10 Horn clauses*)
   2.364 -goal HOL.thy "(! z. ? w. ! x. ? y. \
   2.365 +Goal "(! z. ? w. ! x. ? y. \
   2.366  \          (P x z --> P y w) & P y z & (P y w --> (? u. Q u w))) & \
   2.367  \       (! x z. ~P x z --> (? y. Q y z)) & \
   2.368  \       ((? x y. Q x y) --> (! x. R x x))  \
   2.369 @@ -415,7 +417,7 @@
   2.370  result();
   2.371  
   2.372  writeln"Problem 38";  (*Quite hard: 422 Horn clauses!!*)
   2.373 -goal HOL.thy
   2.374 +Goal
   2.375      "(! x. p a & (p x --> (? y. p y & r x y)) -->            \
   2.376  \          (? z. ? w. p z & r x w & r w z))  =                 \
   2.377  \    (! x. (~p a | p x | (? z. ? w. p z & r x w & r w z)) &  \
   2.378 @@ -425,36 +427,36 @@
   2.379  result();
   2.380  
   2.381  writeln"Problem 39";
   2.382 -goal HOL.thy "~ (? x. ! y. F y x = (~F y y))";
   2.383 +Goal "~ (? x. ! y. F y x = (~F y y))";
   2.384  by (safe_meson_tac 1);
   2.385  result();
   2.386  
   2.387  writeln"Problem 40.  AMENDED";
   2.388 -goal HOL.thy "(? y. ! x. F x y = F x x)  \
   2.389 +Goal "(? y. ! x. F x y = F x x)  \
   2.390  \       -->  ~ (! x. ? y. ! z. F z y = (~F z x))";
   2.391  by (safe_meson_tac 1);
   2.392  result();
   2.393  
   2.394  writeln"Problem 41";
   2.395 -goal HOL.thy "(! z. (? y. (! x. f x y = (f x z & ~ f x x))))    \
   2.396 +Goal "(! z. (? y. (! x. f x y = (f x z & ~ f x x))))    \
   2.397  \              --> ~ (? z. ! x. f x z)";
   2.398  by (safe_meson_tac 1);
   2.399  result();
   2.400  
   2.401  writeln"Problem 42";
   2.402 -goal HOL.thy "~ (? y. ! x. p x y = (~ (? z. p x z & p z x)))";
   2.403 +Goal "~ (? y. ! x. p x y = (~ (? z. p x z & p z x)))";
   2.404  by (safe_meson_tac 1);
   2.405  result();
   2.406  
   2.407  writeln"Problem 43  NOW PROVED AUTOMATICALLY!!";
   2.408 -goal HOL.thy "(! x. ! y. q x y = (! z. p z x = (p z y::bool)))  \
   2.409 +Goal "(! x. ! y. q x y = (! z. p z x = (p z y::bool)))  \
   2.410  \         --> (! x. (! y. q x y = (q y x::bool)))";
   2.411  by (safe_best_meson_tac 1);     
   2.412  (*1.6 secs; iter. deepening is slightly slower*)
   2.413  result();
   2.414  
   2.415  writeln"Problem 44";  (*13 Horn clauses; 7-step proof*)
   2.416 -goal HOL.thy "(! x. f x -->                                    \
   2.417 +Goal "(! x. f x -->                                    \
   2.418  \             (? y. g y & h x y & (? y. g y & ~ h x y)))  &   \
   2.419  \             (? x. j x & (! y. g y --> h x y))               \
   2.420  \             --> (? x. j x & ~f x)";
   2.421 @@ -462,7 +464,7 @@
   2.422  result();
   2.423  
   2.424  writeln"Problem 45";  (*27 Horn clauses; 54-step proof*)
   2.425 -goal HOL.thy "(! x. f x & (! y. g y & h x y --> j x y)        \
   2.426 +Goal "(! x. f x & (! y. g y & h x y --> j x y)        \
   2.427  \                     --> (! y. g y & h x y --> k y)) &       \
   2.428  \     ~ (? y. l y & k y) &                                    \
   2.429  \     (? x. f x & (! y. h x y --> l y)                        \
   2.430 @@ -473,7 +475,7 @@
   2.431  result();
   2.432  
   2.433  writeln"Problem 46";  (*26 Horn clauses; 21-step proof*)
   2.434 -goal HOL.thy
   2.435 +Goal
   2.436      "(! x. f x & (! y. f y & h y x --> g y) --> g x) &      \
   2.437  \    ((? x. f x & ~g x) -->                                    \
   2.438  \     (? x. f x & ~g x & (! y. f y & ~g y --> j x y))) &    \
   2.439 @@ -485,7 +487,7 @@
   2.440  
   2.441  writeln"Problem 47.  Schubert's Steamroller";
   2.442          (*26 clauses; 63 Horn clauses*)
   2.443 -goal HOL.thy
   2.444 +Goal
   2.445      "(! x. P1 x --> P0 x) & (? x. P1 x) &     \
   2.446  \    (! x. P2 x --> P0 x) & (? x. P2 x) &     \
   2.447  \    (! x. P3 x --> P0 x) & (? x. P3 x) &     \
   2.448 @@ -507,7 +509,7 @@
   2.449  result();
   2.450  
   2.451  (*The Los problem?  Circulated by John Harrison*)
   2.452 -goal HOL.thy "(! x y z. P x y & P y z --> P x z) &      \
   2.453 +Goal "(! x y z. P x y & P y z --> P x z) &      \
   2.454  \      (! x y z. Q x y & Q y z --> Q x z) &             \
   2.455  \      (! x y. P x y --> P y x) &                       \
   2.456  \      (! x y. P x y | Q x y)                           \
   2.457 @@ -516,7 +518,7 @@
   2.458  result();
   2.459  
   2.460  (*A similar example, suggested by Johannes Schumann and credited to Pelletier*)
   2.461 -goal HOL.thy "(!x y z. P x y --> P y z --> P x z) --> \
   2.462 +Goal "(!x y z. P x y --> P y z --> P x z) --> \
   2.463  \       (!x y z. Q x y --> Q y z --> Q x z) --> \
   2.464  \       (!x y. Q x y --> Q y x) -->  (!x y. P x y | Q x y) --> \
   2.465  \       (!x y. P x y) | (!x y. Q x y)";
   2.466 @@ -525,7 +527,7 @@
   2.467  
   2.468  writeln"Problem 50";  
   2.469  (*What has this to do with equality?*)
   2.470 -goal HOL.thy "(! x. P a x | (! y. P x y)) --> (? x. ! y. P x y)";
   2.471 +Goal "(! x. P a x | (! y. P x y)) --> (? x. ! y. P x y)";
   2.472  by (safe_meson_tac 1);
   2.473  result();
   2.474  
   2.475 @@ -533,7 +535,7 @@
   2.476  
   2.477  (*Non-equational version, from Manthey and Bry, CADE-9 (Springer, 1988).
   2.478    meson_tac cannot report who killed Agatha. *)
   2.479 -goal HOL.thy "lives agatha & lives butler & lives charles & \
   2.480 +Goal "lives agatha & lives butler & lives charles & \
   2.481  \  (killed agatha agatha | killed butler agatha | killed charles agatha) & \
   2.482  \  (!x y. killed x y --> hates x y & ~richer x y) & \
   2.483  \  (!x. hates agatha x --> ~hates charles x) & \
   2.484 @@ -546,7 +548,7 @@
   2.485  result();
   2.486  
   2.487  writeln"Problem 57";
   2.488 -goal HOL.thy
   2.489 +Goal
   2.490      "P (f a b) (f b c) & P (f b c) (f a c) & \
   2.491  \    (! x y z. P x y & P y z --> P x z)    -->   P (f a b) (f a c)";
   2.492  by (safe_meson_tac 1);
   2.493 @@ -554,23 +556,23 @@
   2.494  
   2.495  writeln"Problem 58";
   2.496  (* Challenge found on info-hol *)
   2.497 -goal HOL.thy
   2.498 +Goal
   2.499      "! P Q R x. ? v w. ! y z. P x & Q y --> (P v | R w) & (R z --> Q v)";
   2.500  by (safe_meson_tac 1);
   2.501  result();
   2.502  
   2.503  writeln"Problem 59";
   2.504 -goal HOL.thy "(! x. P x = (~P(f x))) --> (? x. P x & ~P(f x))";
   2.505 +Goal "(! x. P x = (~P(f x))) --> (? x. P x & ~P(f x))";
   2.506  by (safe_meson_tac 1);
   2.507  result();
   2.508  
   2.509  writeln"Problem 60";
   2.510 -goal HOL.thy "! x. P x (f x) = (? y. (! z. P z y --> P z (f x)) & P x y)";
   2.511 +Goal "! x. P x (f x) = (? y. (! z. P z y --> P z (f x)) & P x y)";
   2.512  by (safe_meson_tac 1);
   2.513  result();
   2.514  
   2.515  writeln"Problem 62 as corrected in JAR 18 (1997), page 135";
   2.516 -goal HOL.thy
   2.517 +Goal
   2.518      "(ALL x. p a & (p x --> p(f x)) --> p(f(f x)))  =   \
   2.519  \    (ALL x. (~ p a | p x | p(f(f x))) &                        \
   2.520  \            (~ p a | ~ p(f x) | p(f(f x))))";
   2.521 @@ -588,19 +590,19 @@
   2.522  fun axjoin ([],   q) = q
   2.523    | axjoin (p::ps, q) = "(" ^ p ^ ") --> (" ^ axjoin(ps,q) ^ ")";
   2.524  
   2.525 -goal HOL.thy (axjoin([axa,axb,axd], "! x. T(i x x)"));
   2.526 +Goal (axjoin([axa,axb,axd], "! x. T(i x x)"));
   2.527  by (safe_meson_tac 1);  
   2.528  result();
   2.529  
   2.530  writeln"Problem 66";  
   2.531 -goal HOL.thy (axjoin([axa,axb,axc,axd], "! x. T(i x(n(n x)))"));
   2.532 +Goal (axjoin([axa,axb,axc,axd], "! x. T(i x(n(n x)))"));
   2.533  (*TOO SLOW: more than 24 minutes!
   2.534  by (safe_meson_tac 1);
   2.535  result();
   2.536  *)
   2.537  
   2.538  writeln"Problem 67";  
   2.539 -goal HOL.thy (axjoin([axa,axb,axc,axd], "! x. T(i(n(n x)) x)"));
   2.540 +Goal (axjoin([axa,axb,axc,axd], "! x. T(i(n(n x)) x)"));
   2.541  (*TOO SLOW: more than 3 minutes!
   2.542  by (safe_meson_tac 1);
   2.543  result();