src/FOLP/ex/int.ML
author clasohm
Thu Sep 16 12:20:38 1993 +0200 (1993-09-16)
changeset 0 a5a9c433f639
child 1459 d12da312eff4
permissions -rw-r--r--
Initial revision
     1 (*  Title: 	FOL/ex/int
     2     ID:         $Id$
     3     Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
     4     Copyright   1991  University of Cambridge
     5 
     6 Intuitionistic First-Order Logic
     7 
     8 Single-step commands:
     9 by (Int.step_tac 1);
    10 by (biresolve_tac safe_brls 1);
    11 by (biresolve_tac haz_brls 1);
    12 by (assume_tac 1);
    13 by (Int.safe_tac 1);
    14 by (Int.mp_tac 1);
    15 by (Int.fast_tac 1);
    16 *)
    17 
    18 writeln"File FOL/ex/int.";
    19 
    20 (*Note: for PROPOSITIONAL formulae...
    21   ~A is classically provable iff it is intuitionistically provable.  
    22   Therefore A is classically provable iff ~~A is intuitionistically provable.
    23 
    24 Let Q be the conjuction of the propositions A|~A, one for each atom A in
    25 P.  If P is provable classically, then clearly P&Q is provable
    26 intuitionistically, so ~~(P&Q) is also provable intuitionistically.
    27 The latter is intuitionistically equivalent to ~~P&~~Q, hence to ~~P,
    28 since ~~Q is intuitionistically provable.  Finally, if P is a negation then
    29 ~~P is intuitionstically equivalent to P.  [Andy Pitts]
    30 *)
    31 
    32 goal IFOLP.thy "?p : ~~(P&Q) <-> ~~P & ~~Q";
    33 by (Int.fast_tac 1);
    34 result();
    35 
    36 goal IFOLP.thy "?p : ~~~P <-> ~P";
    37 by (Int.fast_tac 1);
    38 result();
    39 
    40 goal IFOLP.thy "?p : ~~((P --> Q | R)  -->  (P-->Q) | (P-->R))";
    41 by (Int.fast_tac 1);
    42 result();
    43 
    44 goal IFOLP.thy "?p : (P<->Q) <-> (Q<->P)";
    45 by (Int.fast_tac 1);
    46 result();
    47 
    48 
    49 writeln"Lemmas for the propositional double-negation translation";
    50 
    51 goal IFOLP.thy "?p : P --> ~~P";
    52 by (Int.fast_tac 1);
    53 result();
    54 
    55 goal IFOLP.thy "?p : ~~(~~P --> P)";
    56 by (Int.fast_tac 1);
    57 result();
    58 
    59 goal IFOLP.thy "?p : ~~P & ~~(P --> Q) --> ~~Q";
    60 by (Int.fast_tac 1);
    61 result();
    62 
    63 
    64 writeln"The following are classically but not constructively valid.";
    65 
    66 (*The attempt to prove them terminates quickly!*)
    67 goal IFOLP.thy "?p : ((P-->Q) --> P)  -->  P";
    68 by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";  
    69 (*Check that subgoals remain: proof failed.*)
    70 getgoal 1;  
    71 
    72 goal IFOLP.thy "?p : (P&Q-->R)  -->  (P-->R) | (Q-->R)";
    73 by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";  
    74 getgoal 1;  
    75 
    76 
    77 writeln"Intuitionistic FOL: propositional problems based on Pelletier.";
    78 
    79 writeln"Problem ~~1";
    80 goal IFOLP.thy "?p : ~~((P-->Q)  <->  (~Q --> ~P))";
    81 by (Int.fast_tac 1);
    82 result();
    83 (*5 secs*)
    84 
    85 
    86 writeln"Problem ~~2";
    87 goal IFOLP.thy "?p : ~~(~~P  <->  P)";
    88 by (Int.fast_tac 1);
    89 result();
    90 (*1 secs*)
    91 
    92 
    93 writeln"Problem 3";
    94 goal IFOLP.thy "?p : ~(P-->Q) --> (Q-->P)";
    95 by (Int.fast_tac 1);
    96 result();
    97 
    98 writeln"Problem ~~4";
    99 goal IFOLP.thy "?p : ~~((~P-->Q)  <->  (~Q --> P))";
   100 by (Int.fast_tac 1);
   101 result();
   102 (*9 secs*)
   103 
   104 writeln"Problem ~~5";
   105 goal IFOLP.thy "?p : ~~((P|Q-->P|R) --> P|(Q-->R))";
   106 by (Int.fast_tac 1);
   107 result();
   108 (*10 secs*)
   109 
   110 
   111 writeln"Problem ~~6";
   112 goal IFOLP.thy "?p : ~~(P | ~P)";
   113 by (Int.fast_tac 1);
   114 result();
   115 
   116 writeln"Problem ~~7";
   117 goal IFOLP.thy "?p : ~~(P | ~~~P)";
   118 by (Int.fast_tac 1);
   119 result();
   120 
   121 writeln"Problem ~~8.  Peirce's law";
   122 goal IFOLP.thy "?p : ~~(((P-->Q) --> P)  -->  P)";
   123 by (Int.fast_tac 1);
   124 result();
   125 
   126 writeln"Problem 9";
   127 goal IFOLP.thy "?p : ((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)";
   128 by (Int.fast_tac 1);
   129 result();
   130 (*9 secs*)
   131 
   132 
   133 writeln"Problem 10";
   134 goal IFOLP.thy "?p : (Q-->R) --> (R-->P&Q) --> (P-->(Q|R)) --> (P<->Q)";
   135 by (Int.fast_tac 1);
   136 result();
   137 
   138 writeln"11.  Proved in each direction (incorrectly, says Pelletier!!) ";
   139 goal IFOLP.thy "?p : P<->P";
   140 by (Int.fast_tac 1);
   141 
   142 writeln"Problem ~~12.  Dijkstra's law  ";
   143 goal IFOLP.thy "?p : ~~(((P <-> Q) <-> R)  <->  (P <-> (Q <-> R)))";
   144 by (Int.fast_tac 1);
   145 result();
   146 
   147 goal IFOLP.thy "?p : ((P <-> Q) <-> R)  -->  ~~(P <-> (Q <-> R))";
   148 by (Int.fast_tac 1);
   149 result();
   150 
   151 writeln"Problem 13.  Distributive law";
   152 goal IFOLP.thy "?p : P | (Q & R)  <-> (P | Q) & (P | R)";
   153 by (Int.fast_tac 1);
   154 result();
   155 
   156 writeln"Problem ~~14";
   157 goal IFOLP.thy "?p : ~~((P <-> Q) <-> ((Q | ~P) & (~Q|P)))";
   158 by (Int.fast_tac 1);
   159 result();
   160 
   161 writeln"Problem ~~15";
   162 goal IFOLP.thy "?p : ~~((P --> Q) <-> (~P | Q))";
   163 by (Int.fast_tac 1);
   164 result();
   165 
   166 writeln"Problem ~~16";
   167 goal IFOLP.thy "?p : ~~((P-->Q) | (Q-->P))";
   168 by (Int.fast_tac 1);
   169 result();
   170 
   171 writeln"Problem ~~17";
   172 goal IFOLP.thy
   173   "?p : ~~(((P & (Q-->R))-->S) <-> ((~P | Q | S) & (~P | ~R | S)))";
   174 by (Int.fast_tac 1);
   175 (*over 5 minutes?? -- printing the proof term takes 40 secs!!*)
   176 result();
   177 
   178 
   179 writeln"** Examples with quantifiers **";
   180 
   181 writeln"The converse is classical in the following implications...";
   182 
   183 goal IFOLP.thy "?p : (EX x.P(x)-->Q)  -->  (ALL x.P(x)) --> Q";
   184 by (Int.fast_tac 1); 
   185 result();  
   186 
   187 goal IFOLP.thy "?p : ((ALL x.P(x))-->Q) --> ~ (ALL x. P(x) & ~Q)";
   188 by (Int.fast_tac 1); 
   189 result();  
   190 
   191 goal IFOLP.thy "?p : ((ALL x. ~P(x))-->Q)  -->  ~ (ALL x. ~ (P(x)|Q))";
   192 by (Int.fast_tac 1); 
   193 result();  
   194 
   195 goal IFOLP.thy "?p : (ALL x.P(x)) | Q  -->  (ALL x. P(x) | Q)";
   196 by (Int.fast_tac 1); 
   197 result();  
   198 
   199 goal IFOLP.thy "?p : (EX x. P --> Q(x)) --> (P --> (EX x. Q(x)))";
   200 by (Int.fast_tac 1);
   201 result();  
   202 
   203 
   204 
   205 
   206 writeln"The following are not constructively valid!";
   207 (*The attempt to prove them terminates quickly!*)
   208 
   209 goal IFOLP.thy "?p : ((ALL x.P(x))-->Q) --> (EX x.P(x)-->Q)";
   210 by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";  
   211 getgoal 1; 
   212 
   213 goal IFOLP.thy "?p : (P --> (EX x.Q(x))) --> (EX x. P-->Q(x))";
   214 by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";  
   215 getgoal 1; 
   216 
   217 goal IFOLP.thy "?p : (ALL x. P(x) | Q) --> ((ALL x.P(x)) | Q)";
   218 by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";  
   219 getgoal 1; 
   220 
   221 goal IFOLP.thy "?p : (ALL x. ~~P(x)) --> ~~(ALL x. P(x))";
   222 by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";  
   223 getgoal 1; 
   224 
   225 (*Classically but not intuitionistically valid.  Proved by a bug in 1986!*)
   226 goal IFOLP.thy "?p : EX x. Q(x) --> (ALL x. Q(x))";
   227 by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";  
   228 getgoal 1; 
   229 
   230 
   231 writeln"Hard examples with quantifiers";
   232 
   233 (*The ones that have not been proved are not known to be valid!
   234   Some will require quantifier duplication -- not currently available*)
   235 
   236 writeln"Problem ~~18";
   237 goal IFOLP.thy "?p : ~~(EX y. ALL x. P(y)-->P(x))";
   238 (*NOT PROVED*)
   239 
   240 writeln"Problem ~~19";
   241 goal IFOLP.thy "?p : ~~(EX x. ALL y z. (P(y)-->Q(z)) --> (P(x)-->Q(x)))";
   242 (*NOT PROVED*)
   243 
   244 writeln"Problem 20";
   245 goal IFOLP.thy "?p : (ALL x y. EX z. ALL w. (P(x)&Q(y)-->R(z)&S(w)))     \
   246 \   --> (EX x y. P(x) & Q(y)) --> (EX z. R(z))";
   247 by (Int.fast_tac 1); 
   248 result();
   249 
   250 writeln"Problem 21";
   251 goal IFOLP.thy
   252     "?p : (EX x. P-->Q(x)) & (EX x. Q(x)-->P) --> ~~(EX x. P<->Q(x))";
   253 (*NOT PROVED*)
   254 
   255 writeln"Problem 22";
   256 goal IFOLP.thy "?p : (ALL x. P <-> Q(x))  -->  (P <-> (ALL x. Q(x)))";
   257 by (Int.fast_tac 1); 
   258 result();
   259 
   260 writeln"Problem ~~23";
   261 goal IFOLP.thy "?p : ~~ ((ALL x. P | Q(x))  <->  (P | (ALL x. Q(x))))";
   262 by (Int.best_tac 1);  
   263 result();
   264 
   265 writeln"Problem 24";
   266 goal IFOLP.thy "?p : ~(EX x. S(x)&Q(x)) & (ALL x. P(x) --> Q(x)|R(x)) &  \
   267 \    ~(EX x.P(x)) --> (EX x.Q(x)) & (ALL x. Q(x)|R(x) --> S(x))  \
   268 \   --> (EX x. P(x)&R(x))";
   269 by (Int.fast_tac 1); 
   270 result();
   271 
   272 writeln"Problem 25";
   273 goal IFOLP.thy "?p : (EX x. P(x)) &  \
   274 \       (ALL x. L(x) --> ~ (M(x) & R(x))) &  \
   275 \       (ALL x. P(x) --> (M(x) & L(x))) &   \
   276 \       ((ALL x. P(x)-->Q(x)) | (EX x. P(x)&R(x)))  \
   277 \   --> (EX x. Q(x)&P(x))";
   278 by (Int.best_tac 1);
   279 result();
   280 
   281 writeln"Problem 29.  Essentially the same as Principia Mathematica *11.71";
   282 goal IFOLP.thy "?p : (EX x. P(x)) & (EX y. Q(y))  \
   283 \   --> ((ALL x. P(x)-->R(x)) & (ALL y. Q(y)-->S(y))   <->     \
   284 \        (ALL x y. P(x) & Q(y) --> R(x) & S(y)))";
   285 by (Int.fast_tac 1); 
   286 result();
   287 
   288 writeln"Problem ~~30";
   289 goal IFOLP.thy "?p : (ALL x. (P(x) | Q(x)) --> ~ R(x)) & \
   290 \       (ALL x. (Q(x) --> ~ S(x)) --> P(x) & R(x))  \
   291 \   --> (ALL x. ~~S(x))";
   292 by (Int.fast_tac 1);  
   293 result();
   294 
   295 writeln"Problem 31";
   296 goal IFOLP.thy "?p : ~(EX x.P(x) & (Q(x) | R(x))) & \
   297 \       (EX x. L(x) & P(x)) & \
   298 \       (ALL x. ~ R(x) --> M(x))  \
   299 \   --> (EX x. L(x) & M(x))";
   300 by (Int.fast_tac 1);
   301 result();
   302 
   303 writeln"Problem 32";
   304 goal IFOLP.thy "?p : (ALL x. P(x) & (Q(x)|R(x))-->S(x)) & \
   305 \       (ALL x. S(x) & R(x) --> L(x)) & \
   306 \       (ALL x. M(x) --> R(x))  \
   307 \   --> (ALL x. P(x) & M(x) --> L(x))";
   308 by (Int.best_tac 1);  (*SLOW*)
   309 result();
   310 
   311 writeln"Problem 39";
   312 goal IFOLP.thy "?p : ~ (EX x. ALL y. F(y,x) <-> ~F(y,y))";
   313 by (Int.fast_tac 1);
   314 result();
   315 
   316 writeln"Problem 40.  AMENDED";
   317 goal IFOLP.thy "?p : (EX y. ALL x. F(x,y) <-> F(x,x)) -->  \
   318 \             ~(ALL x. EX y. ALL z. F(z,y) <-> ~ F(z,x))";
   319 by (Int.fast_tac 1);
   320 result();
   321 
   322 writeln"Problem 44";
   323 goal IFOLP.thy "?p : (ALL x. f(x) -->					\
   324 \             (EX y. g(y) & h(x,y) & (EX y. g(y) & ~ h(x,y))))  &   	\
   325 \             (EX x. j(x) & (ALL y. g(y) --> h(x,y)))			\
   326 \             --> (EX x. j(x) & ~f(x))";
   327 by (Int.fast_tac 1);
   328 result();
   329 
   330 writeln"Problem 48";
   331 goal IFOLP.thy "?p : (a=b | c=d) & (a=c | b=d) --> a=d | b=c";
   332 by (Int.fast_tac 1);
   333 result();
   334 
   335 writeln"Problem 51";
   336 goal IFOLP.thy
   337     "?p : (EX z w. ALL x y. P(x,y) <->  (x=z & y=w)) -->  \
   338 \    (EX z. ALL x. EX w. (ALL y. P(x,y) <-> y=w) <-> x=z)";
   339 by (Int.best_tac 1);  (*60 seconds*)
   340 result();
   341 
   342 writeln"Problem 56";
   343 goal IFOLP.thy
   344     "?p : (ALL x. (EX y. P(y) & x=f(y)) --> P(x)) <-> (ALL x. P(x) --> P(f(x)))";
   345 by (Int.fast_tac 1);
   346 result();
   347 
   348 writeln"Problem 57";
   349 goal IFOLP.thy
   350     "?p : P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) & \
   351 \    (ALL x y z. P(x,y) & P(y,z) --> P(x,z))    -->   P(f(a,b), f(a,c))";
   352 by (Int.fast_tac 1);
   353 result();
   354 
   355 writeln"Problem 60";
   356 goal IFOLP.thy
   357     "?p : ALL x. P(x,f(x)) <-> (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))";
   358 by (Int.fast_tac 1);
   359 result();
   360 
   361 writeln"Reached end of file.";