src/Sequents/LK/quant.ML
changeset 17481 75166ebb619b
parent 6252 935f183bf406
child 18678 dd0c569fa43d
     1.1 --- a/src/Sequents/LK/quant.ML	Sun Sep 18 14:25:48 2005 +0200
     1.2 +++ b/src/Sequents/LK/quant.ML	Sun Sep 18 15:20:08 2005 +0200
     1.3 @@ -1,4 +1,4 @@
     1.4 -(*  Title:      LK/ex/quant
     1.5 +(*  Title:      LK/ex/quant.ML
     1.6      ID:         $Id$
     1.7      Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     1.8      Copyright   1992  University of Cambridge
     1.9 @@ -6,155 +6,151 @@
    1.10  Classical sequent calculus: examples with quantifiers.
    1.11  *)
    1.12  
    1.13 -
    1.14 -writeln"LK/ex/quant: Examples with quantifiers";
    1.15 -
    1.16 -goal LK.thy "|- (ALL x. P)  <->  P";
    1.17 +goal (theory "LK") "|- (ALL x. P)  <->  P";
    1.18  by (fast_tac LK_pack 1);
    1.19 -result(); 
    1.20 +result();
    1.21  
    1.22 -goal LK.thy "|- (ALL x y. P(x,y))  <->  (ALL y x. P(x,y))";
    1.23 +goal (theory "LK") "|- (ALL x y. P(x,y))  <->  (ALL y x. P(x,y))";
    1.24  by (fast_tac LK_pack 1);
    1.25 -result(); 
    1.26 +result();
    1.27  
    1.28 -goal LK.thy "ALL u. P(u), ALL v. Q(v) |- ALL u v. P(u) & Q(v)";
    1.29 +goal (theory "LK") "ALL u. P(u), ALL v. Q(v) |- ALL u v. P(u) & Q(v)";
    1.30  by (fast_tac LK_pack 1);
    1.31 -result(); 
    1.32 +result();
    1.33  
    1.34  writeln"Permutation of existential quantifier.";
    1.35 -goal LK.thy "|- (EX x y. P(x,y)) <-> (EX y x. P(x,y))";
    1.36 +goal (theory "LK") "|- (EX x y. P(x,y)) <-> (EX y x. P(x,y))";
    1.37  by (fast_tac LK_pack 1);
    1.38 -result(); 
    1.39 +result();
    1.40  
    1.41 -goal LK.thy "|- (ALL x. P(x) & Q(x)) <-> (ALL x. P(x)) & (ALL x. Q(x))";
    1.42 +goal (theory "LK") "|- (ALL x. P(x) & Q(x)) <-> (ALL x. P(x)) & (ALL x. Q(x))";
    1.43  by (fast_tac LK_pack 1);
    1.44 -result(); 
    1.45 +result();
    1.46  
    1.47  
    1.48  (*Converse is invalid*)
    1.49 -goal LK.thy "|- (ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x)|Q(x))";
    1.50 +goal (theory "LK") "|- (ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x)|Q(x))";
    1.51  by (fast_tac LK_pack 1);
    1.52 -result(); 
    1.53 +result();
    1.54  
    1.55  
    1.56  writeln"Pushing ALL into an implication.";
    1.57 -goal LK.thy "|- (ALL x. P --> Q(x))  <->  (P --> (ALL x. Q(x)))";
    1.58 +goal (theory "LK") "|- (ALL x. P --> Q(x))  <->  (P --> (ALL x. Q(x)))";
    1.59  by (fast_tac LK_pack 1);
    1.60 -result(); 
    1.61 +result();
    1.62  
    1.63  
    1.64 -goal LK.thy "|- (ALL x. P(x)-->Q)  <->  ((EX x. P(x)) --> Q)";
    1.65 +goal (theory "LK") "|- (ALL x. P(x)-->Q)  <->  ((EX x. P(x)) --> Q)";
    1.66  by (fast_tac LK_pack 1);
    1.67 -result(); 
    1.68 +result();
    1.69  
    1.70  
    1.71 -goal LK.thy "|- (EX x. P)  <->  P";
    1.72 +goal (theory "LK") "|- (EX x. P)  <->  P";
    1.73  by (fast_tac LK_pack 1);
    1.74 -result(); 
    1.75 +result();
    1.76  
    1.77  
    1.78  writeln"Distribution of EX over disjunction.";
    1.79 -goal LK.thy "|- (EX x. P(x) | Q(x)) <-> (EX x. P(x))  |  (EX x. Q(x))";
    1.80 +goal (theory "LK") "|- (EX x. P(x) | Q(x)) <-> (EX x. P(x))  |  (EX x. Q(x))";
    1.81  by (fast_tac LK_pack 1);
    1.82 -result(); 
    1.83 +result();
    1.84  (*5 secs*)
    1.85  
    1.86  (*Converse is invalid*)
    1.87 -goal LK.thy "|- (EX x. P(x) & Q(x))  -->  (EX x. P(x))  &  (EX x. Q(x))";
    1.88 +goal (theory "LK") "|- (EX x. P(x) & Q(x))  -->  (EX x. P(x))  &  (EX x. Q(x))";
    1.89  by (fast_tac LK_pack 1);
    1.90 -result(); 
    1.91 +result();
    1.92  
    1.93  
    1.94  writeln"Harder examples: classical theorems.";
    1.95  
    1.96 -goal LK.thy "|- (EX x. P-->Q(x))  <->  (P --> (EX x. Q(x)))";
    1.97 +goal (theory "LK") "|- (EX x. P-->Q(x))  <->  (P --> (EX x. Q(x)))";
    1.98  by (fast_tac LK_pack 1);
    1.99 -result(); 
   1.100 +result();
   1.101  (*3 secs*)
   1.102  
   1.103  
   1.104 -goal LK.thy "|- (EX x. P(x)-->Q)  <->  (ALL x. P(x)) --> Q";
   1.105 +goal (theory "LK") "|- (EX x. P(x)-->Q)  <->  (ALL x. P(x)) --> Q";
   1.106  by (fast_tac LK_pack 1);
   1.107 -result(); 
   1.108 +result();
   1.109  (*5 secs*)
   1.110  
   1.111  
   1.112 -goal LK.thy "|- (ALL x. P(x)) | Q  <->  (ALL x. P(x) | Q)";
   1.113 +goal (theory "LK") "|- (ALL x. P(x)) | Q  <->  (ALL x. P(x) | Q)";
   1.114  by (fast_tac LK_pack 1);
   1.115 -result(); 
   1.116 +result();
   1.117  
   1.118  
   1.119  writeln"Basic test of quantifier reasoning";
   1.120 -goal LK.thy
   1.121 +goal (theory "LK")
   1.122     "|- (EX y. ALL x. Q(x,y)) --> (ALL x. EX y. Q(x,y))";
   1.123  by (fast_tac LK_pack 1);
   1.124 -result();  
   1.125 +result();
   1.126  
   1.127  
   1.128 -goal LK.thy "|- (ALL x. Q(x))  -->  (EX x. Q(x))";
   1.129 +goal (theory "LK") "|- (ALL x. Q(x))  -->  (EX x. Q(x))";
   1.130  by (fast_tac LK_pack 1);
   1.131 -result();  
   1.132 +result();
   1.133  
   1.134  
   1.135  writeln"The following are invalid!";
   1.136  
   1.137  (*INVALID*)
   1.138 -goal LK.thy "|- (ALL x. EX y. Q(x,y))  -->  (EX y. ALL x. Q(x,y))";
   1.139 -by (fast_tac LK_pack 1) handle ERROR => writeln"Failed, as expected"; 
   1.140 +goal (theory "LK") "|- (ALL x. EX y. Q(x,y))  -->  (EX y. ALL x. Q(x,y))";
   1.141 +by (fast_tac LK_pack 1) handle ERROR => writeln"Failed, as expected";
   1.142  (*Check that subgoals remain: proof failed.*)
   1.143 -getgoal 1; 
   1.144 +getgoal 1;
   1.145  
   1.146  (*INVALID*)
   1.147 -goal LK.thy "|- (EX x. Q(x))  -->  (ALL x. Q(x))";
   1.148 +goal (theory "LK") "|- (EX x. Q(x))  -->  (ALL x. Q(x))";
   1.149  by (fast_tac LK_pack 1) handle ERROR => writeln"Failed, as expected";
   1.150 -getgoal 1; 
   1.151 +getgoal 1;
   1.152  
   1.153 -goal LK.thy "|- P(?a) --> (ALL x. P(x))";
   1.154 +goal (theory "LK") "|- P(?a) --> (ALL x. P(x))";
   1.155  by (fast_tac LK_pack 1) handle ERROR => writeln"Failed, as expected";
   1.156  (*Check that subgoals remain: proof failed.*)
   1.157 -getgoal 1;  
   1.158 +getgoal 1;
   1.159  
   1.160 -goal LK.thy "|- (P(?a) --> (ALL x. Q(x))) --> (ALL x. P(x) --> Q(x))";
   1.161 +goal (theory "LK") "|- (P(?a) --> (ALL x. Q(x))) --> (ALL x. P(x) --> Q(x))";
   1.162  by (fast_tac LK_pack 1) handle ERROR => writeln"Failed, as expected";
   1.163 -getgoal 1;  
   1.164 +getgoal 1;
   1.165  
   1.166  
   1.167  writeln"Back to things that are provable...";
   1.168  
   1.169 -goal LK.thy "|- (ALL x. P(x)-->Q(x)) & (EX x. P(x)) --> (EX x. Q(x))";
   1.170 -by (fast_tac LK_pack 1); 
   1.171 -result();  
   1.172 +goal (theory "LK") "|- (ALL x. P(x)-->Q(x)) & (EX x. P(x)) --> (EX x. Q(x))";
   1.173 +by (fast_tac LK_pack 1);
   1.174 +result();
   1.175  
   1.176  (*An example of why exR should be delayed as long as possible*)
   1.177 -goal LK.thy "|- (P--> (EX x. Q(x))) & P--> (EX x. Q(x))";
   1.178 +goal (theory "LK") "|- (P--> (EX x. Q(x))) & P--> (EX x. Q(x))";
   1.179  by (fast_tac LK_pack 1);
   1.180 -result();  
   1.181 +result();
   1.182  
   1.183  writeln"Solving for a Var";
   1.184 -goal LK.thy 
   1.185 +goal (theory "LK")
   1.186     "|- (ALL x. P(x)-->Q(f(x))) & (ALL x. Q(x)-->R(g(x))) & P(d) --> R(?a)";
   1.187  by (fast_tac LK_pack 1);
   1.188  result();
   1.189  
   1.190  
   1.191  writeln"Principia Mathematica *11.53";
   1.192 -goal LK.thy 
   1.193 +goal (theory "LK")
   1.194      "|- (ALL x y. P(x) --> Q(y)) <-> ((EX x. P(x)) --> (ALL y. Q(y)))";
   1.195  by (fast_tac LK_pack 1);
   1.196  result();
   1.197  
   1.198  
   1.199  writeln"Principia Mathematica *11.55";
   1.200 -goal LK.thy "|- (EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX y. Q(x,y)))";
   1.201 +goal (theory "LK") "|- (EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX y. Q(x,y)))";
   1.202  by (fast_tac LK_pack 1);
   1.203  result();
   1.204  
   1.205  writeln"Principia Mathematica *11.61";
   1.206 -goal LK.thy
   1.207 +goal (theory "LK")
   1.208     "|- (EX y. ALL x. P(x) --> Q(x,y)) --> (ALL x. P(x) --> (EX y. Q(x,y)))";
   1.209  by (fast_tac LK_pack 1);
   1.210  result();
   1.211  
   1.212 -writeln"Reached end of file.";
   1.213 -
   1.214  (*21 August 88: loaded in 45.7 secs*)
   1.215 +(*18 September 2005: loaded in 0.114 secs*)