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