src/FOLP/ex/Intuitionistic.thy
author wenzelm
Fri Apr 23 23:35:43 2010 +0200 (2010-04-23)
changeset 36319 8feb2c4bef1a
parent 35762 af3ff2ba4c54
child 58963 26bf09b95dda
permissions -rw-r--r--
mark schematic statements explicitly;
wenzelm@26322
     1
(*  Title:      FOLP/ex/Intuitionistic.thy
wenzelm@26322
     2
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
wenzelm@26322
     3
    Copyright   1991  University of Cambridge
wenzelm@26322
     4
wenzelm@26322
     5
Intuitionistic First-Order Logic.
wenzelm@26322
     6
wenzelm@26322
     7
Single-step commands:
wenzelm@26322
     8
by (IntPr.step_tac 1)
wenzelm@26322
     9
by (biresolve_tac safe_brls 1);
wenzelm@26322
    10
by (biresolve_tac haz_brls 1);
wenzelm@26322
    11
by (assume_tac 1);
wenzelm@26322
    12
by (IntPr.safe_tac 1);
wenzelm@26322
    13
by (IntPr.mp_tac 1);
wenzelm@26322
    14
by (IntPr.fast_tac 1);
wenzelm@26322
    15
*)
wenzelm@26322
    16
wenzelm@26322
    17
(*Note: for PROPOSITIONAL formulae...
wenzelm@26322
    18
  ~A is classically provable iff it is intuitionistically provable.  
wenzelm@26322
    19
  Therefore A is classically provable iff ~~A is intuitionistically provable.
wenzelm@26322
    20
wenzelm@26322
    21
Let Q be the conjuction of the propositions A|~A, one for each atom A in
wenzelm@26322
    22
P.  If P is provable classically, then clearly P&Q is provable
wenzelm@26322
    23
intuitionistically, so ~~(P&Q) is also provable intuitionistically.
wenzelm@26322
    24
The latter is intuitionistically equivalent to ~~P&~~Q, hence to ~~P,
wenzelm@26322
    25
since ~~Q is intuitionistically provable.  Finally, if P is a negation then
wenzelm@26322
    26
~~P is intuitionstically equivalent to P.  [Andy Pitts]
wenzelm@26322
    27
*)
wenzelm@26322
    28
wenzelm@26322
    29
theory Intuitionistic
wenzelm@26322
    30
imports IFOLP
wenzelm@26322
    31
begin
wenzelm@26322
    32
wenzelm@36319
    33
schematic_lemma "?p : ~~(P&Q) <-> ~~P & ~~Q"
wenzelm@26322
    34
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    35
wenzelm@36319
    36
schematic_lemma "?p : ~~~P <-> ~P"
wenzelm@26322
    37
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    38
wenzelm@36319
    39
schematic_lemma "?p : ~~((P --> Q | R)  -->  (P-->Q) | (P-->R))"
wenzelm@26322
    40
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    41
wenzelm@36319
    42
schematic_lemma "?p : (P<->Q) <-> (Q<->P)"
wenzelm@26322
    43
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    44
wenzelm@26322
    45
wenzelm@26322
    46
subsection {* Lemmas for the propositional double-negation translation *}
wenzelm@26322
    47
wenzelm@36319
    48
schematic_lemma "?p : P --> ~~P"
wenzelm@26322
    49
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    50
wenzelm@36319
    51
schematic_lemma "?p : ~~(~~P --> P)"
wenzelm@26322
    52
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    53
wenzelm@36319
    54
schematic_lemma "?p : ~~P & ~~(P --> Q) --> ~~Q"
wenzelm@26322
    55
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    56
wenzelm@26322
    57
wenzelm@26322
    58
subsection {* The following are classically but not constructively valid *}
wenzelm@26322
    59
wenzelm@26322
    60
(*The attempt to prove them terminates quickly!*)
wenzelm@36319
    61
schematic_lemma "?p : ((P-->Q) --> P)  -->  P"
wenzelm@26322
    62
  apply (tactic {* IntPr.fast_tac 1 *})?
wenzelm@26322
    63
  oops
wenzelm@26322
    64
wenzelm@36319
    65
schematic_lemma "?p : (P&Q-->R)  -->  (P-->R) | (Q-->R)"
wenzelm@26322
    66
  apply (tactic {* IntPr.fast_tac 1 *})?
wenzelm@26322
    67
  oops
wenzelm@26322
    68
wenzelm@26322
    69
wenzelm@26322
    70
subsection {* Intuitionistic FOL: propositional problems based on Pelletier *}
wenzelm@26322
    71
wenzelm@26322
    72
text "Problem ~~1"
wenzelm@36319
    73
schematic_lemma "?p : ~~((P-->Q)  <->  (~Q --> ~P))"
wenzelm@26322
    74
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    75
wenzelm@26322
    76
text "Problem ~~2"
wenzelm@36319
    77
schematic_lemma "?p : ~~(~~P  <->  P)"
wenzelm@26322
    78
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    79
wenzelm@26322
    80
text "Problem 3"
wenzelm@36319
    81
schematic_lemma "?p : ~(P-->Q) --> (Q-->P)"
wenzelm@26322
    82
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    83
wenzelm@26322
    84
text "Problem ~~4"
wenzelm@36319
    85
schematic_lemma "?p : ~~((~P-->Q)  <->  (~Q --> P))"
wenzelm@26322
    86
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    87
wenzelm@26322
    88
text "Problem ~~5"
wenzelm@36319
    89
schematic_lemma "?p : ~~((P|Q-->P|R) --> P|(Q-->R))"
wenzelm@26322
    90
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    91
wenzelm@26322
    92
text "Problem ~~6"
wenzelm@36319
    93
schematic_lemma "?p : ~~(P | ~P)"
wenzelm@26322
    94
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    95
wenzelm@26322
    96
text "Problem ~~7"
wenzelm@36319
    97
schematic_lemma "?p : ~~(P | ~~~P)"
wenzelm@26322
    98
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
    99
wenzelm@26322
   100
text "Problem ~~8.  Peirce's law"
wenzelm@36319
   101
schematic_lemma "?p : ~~(((P-->Q) --> P)  -->  P)"
wenzelm@26322
   102
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   103
wenzelm@26322
   104
text "Problem 9"
wenzelm@36319
   105
schematic_lemma "?p : ((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)"
wenzelm@26322
   106
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   107
wenzelm@26322
   108
text "Problem 10"
wenzelm@36319
   109
schematic_lemma "?p : (Q-->R) --> (R-->P&Q) --> (P-->(Q|R)) --> (P<->Q)"
wenzelm@26322
   110
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   111
wenzelm@26322
   112
text "11.  Proved in each direction (incorrectly, says Pelletier!!) "
wenzelm@36319
   113
schematic_lemma "?p : P<->P"
wenzelm@26322
   114
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   115
wenzelm@26322
   116
text "Problem ~~12.  Dijkstra's law  "
wenzelm@36319
   117
schematic_lemma "?p : ~~(((P <-> Q) <-> R)  <->  (P <-> (Q <-> R)))"
wenzelm@26322
   118
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   119
wenzelm@36319
   120
schematic_lemma "?p : ((P <-> Q) <-> R)  -->  ~~(P <-> (Q <-> R))"
wenzelm@26322
   121
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   122
wenzelm@26322
   123
text "Problem 13.  Distributive law"
wenzelm@36319
   124
schematic_lemma "?p : P | (Q & R)  <-> (P | Q) & (P | R)"
wenzelm@26322
   125
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   126
wenzelm@26322
   127
text "Problem ~~14"
wenzelm@36319
   128
schematic_lemma "?p : ~~((P <-> Q) <-> ((Q | ~P) & (~Q|P)))"
wenzelm@26322
   129
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   130
wenzelm@26322
   131
text "Problem ~~15"
wenzelm@36319
   132
schematic_lemma "?p : ~~((P --> Q) <-> (~P | Q))"
wenzelm@26322
   133
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   134
wenzelm@26322
   135
text "Problem ~~16"
wenzelm@36319
   136
schematic_lemma "?p : ~~((P-->Q) | (Q-->P))"
wenzelm@26322
   137
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   138
wenzelm@26322
   139
text "Problem ~~17"
wenzelm@36319
   140
schematic_lemma "?p : ~~(((P & (Q-->R))-->S) <-> ((~P | Q | S) & (~P | ~R | S)))"
wenzelm@26322
   141
  by (tactic {* IntPr.fast_tac 1 *})  -- slow
wenzelm@26322
   142
wenzelm@26322
   143
wenzelm@26322
   144
subsection {* Examples with quantifiers *}
wenzelm@26322
   145
wenzelm@26322
   146
text "The converse is classical in the following implications..."
wenzelm@26322
   147
wenzelm@36319
   148
schematic_lemma "?p : (EX x. P(x)-->Q)  -->  (ALL x. P(x)) --> Q"
wenzelm@26322
   149
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   150
wenzelm@36319
   151
schematic_lemma "?p : ((ALL x. P(x))-->Q) --> ~ (ALL x. P(x) & ~Q)"
wenzelm@26322
   152
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   153
wenzelm@36319
   154
schematic_lemma "?p : ((ALL x. ~P(x))-->Q)  -->  ~ (ALL x. ~ (P(x)|Q))"
wenzelm@26322
   155
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   156
wenzelm@36319
   157
schematic_lemma "?p : (ALL x. P(x)) | Q  -->  (ALL x. P(x) | Q)"
wenzelm@26322
   158
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   159
wenzelm@36319
   160
schematic_lemma "?p : (EX x. P --> Q(x)) --> (P --> (EX x. Q(x)))"
wenzelm@26322
   161
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   162
wenzelm@26322
   163
wenzelm@26322
   164
text "The following are not constructively valid!"
wenzelm@26322
   165
text "The attempt to prove them terminates quickly!"
wenzelm@26322
   166
wenzelm@36319
   167
schematic_lemma "?p : ((ALL x. P(x))-->Q) --> (EX x. P(x)-->Q)"
wenzelm@26322
   168
  apply (tactic {* IntPr.fast_tac 1 *})?
wenzelm@26322
   169
  oops
wenzelm@26322
   170
wenzelm@36319
   171
schematic_lemma "?p : (P --> (EX x. Q(x))) --> (EX x. P-->Q(x))"
wenzelm@26322
   172
  apply (tactic {* IntPr.fast_tac 1 *})?
wenzelm@26322
   173
  oops
wenzelm@26322
   174
wenzelm@36319
   175
schematic_lemma "?p : (ALL x. P(x) | Q) --> ((ALL x. P(x)) | Q)"
wenzelm@26322
   176
  apply (tactic {* IntPr.fast_tac 1 *})?
wenzelm@26322
   177
  oops
wenzelm@26322
   178
wenzelm@36319
   179
schematic_lemma "?p : (ALL x. ~~P(x)) --> ~~(ALL x. P(x))"
wenzelm@26322
   180
  apply (tactic {* IntPr.fast_tac 1 *})?
wenzelm@26322
   181
  oops
wenzelm@26322
   182
wenzelm@26322
   183
(*Classically but not intuitionistically valid.  Proved by a bug in 1986!*)
wenzelm@36319
   184
schematic_lemma "?p : EX x. Q(x) --> (ALL x. Q(x))"
wenzelm@26322
   185
  apply (tactic {* IntPr.fast_tac 1 *})?
wenzelm@26322
   186
  oops
wenzelm@26322
   187
wenzelm@26322
   188
wenzelm@26322
   189
subsection "Hard examples with quantifiers"
wenzelm@26322
   190
wenzelm@26322
   191
text {*
wenzelm@26322
   192
  The ones that have not been proved are not known to be valid!
wenzelm@26322
   193
  Some will require quantifier duplication -- not currently available.
wenzelm@26322
   194
*}
wenzelm@26322
   195
wenzelm@26322
   196
text "Problem ~~18"
wenzelm@36319
   197
schematic_lemma "?p : ~~(EX y. ALL x. P(y)-->P(x))" oops
wenzelm@26322
   198
(*NOT PROVED*)
wenzelm@26322
   199
wenzelm@26322
   200
text "Problem ~~19"
wenzelm@36319
   201
schematic_lemma "?p : ~~(EX x. ALL y z. (P(y)-->Q(z)) --> (P(x)-->Q(x)))" oops
wenzelm@26322
   202
(*NOT PROVED*)
wenzelm@26322
   203
wenzelm@26322
   204
text "Problem 20"
wenzelm@36319
   205
schematic_lemma "?p : (ALL x y. EX z. ALL w. (P(x)&Q(y)-->R(z)&S(w)))      
wenzelm@26322
   206
    --> (EX x y. P(x) & Q(y)) --> (EX z. R(z))"
wenzelm@26322
   207
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   208
wenzelm@26322
   209
text "Problem 21"
wenzelm@36319
   210
schematic_lemma "?p : (EX x. P-->Q(x)) & (EX x. Q(x)-->P) --> ~~(EX x. P<->Q(x))" oops
wenzelm@26322
   211
(*NOT PROVED*)
wenzelm@26322
   212
wenzelm@26322
   213
text "Problem 22"
wenzelm@36319
   214
schematic_lemma "?p : (ALL x. P <-> Q(x))  -->  (P <-> (ALL x. Q(x)))"
wenzelm@26322
   215
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   216
wenzelm@26322
   217
text "Problem ~~23"
wenzelm@36319
   218
schematic_lemma "?p : ~~ ((ALL x. P | Q(x))  <->  (P | (ALL x. Q(x))))"
wenzelm@26322
   219
  by (tactic {* IntPr.fast_tac 1 *})
wenzelm@26322
   220
wenzelm@26322
   221
text "Problem 24"
wenzelm@36319
   222
schematic_lemma "?p : ~(EX x. S(x)&Q(x)) & (ALL x. P(x) --> Q(x)|R(x)) &   
wenzelm@26322
   223
     (~(EX x. P(x)) --> (EX x. Q(x))) & (ALL x. Q(x)|R(x) --> S(x))   
wenzelm@26322
   224
    --> ~~(EX x. P(x)&R(x))"
wenzelm@26322
   225
(*Not clear why fast_tac, best_tac, ASTAR and ITER_DEEPEN all take forever*)
wenzelm@26322
   226
  apply (tactic "IntPr.safe_tac")
wenzelm@26322
   227
  apply (erule impE)
wenzelm@26322
   228
   apply (tactic "IntPr.fast_tac 1")
wenzelm@26322
   229
  apply (tactic "IntPr.fast_tac 1")
wenzelm@26322
   230
  done
wenzelm@26322
   231
wenzelm@26322
   232
text "Problem 25"
wenzelm@36319
   233
schematic_lemma "?p : (EX x. P(x)) &   
wenzelm@26322
   234
        (ALL x. L(x) --> ~ (M(x) & R(x))) &   
wenzelm@26322
   235
        (ALL x. P(x) --> (M(x) & L(x))) &    
wenzelm@26322
   236
        ((ALL x. P(x)-->Q(x)) | (EX x. P(x)&R(x)))   
wenzelm@26322
   237
    --> (EX x. Q(x)&P(x))"
wenzelm@26322
   238
  by (tactic "IntPr.best_tac 1")
wenzelm@26322
   239
wenzelm@26322
   240
text "Problem 29.  Essentially the same as Principia Mathematica *11.71"
wenzelm@36319
   241
schematic_lemma "?p : (EX x. P(x)) & (EX y. Q(y))   
wenzelm@26322
   242
    --> ((ALL x. P(x)-->R(x)) & (ALL y. Q(y)-->S(y))   <->      
wenzelm@26322
   243
         (ALL x y. P(x) & Q(y) --> R(x) & S(y)))"
wenzelm@26322
   244
  by (tactic "IntPr.fast_tac 1")
wenzelm@26322
   245
wenzelm@26322
   246
text "Problem ~~30"
wenzelm@36319
   247
schematic_lemma "?p : (ALL x. (P(x) | Q(x)) --> ~ R(x)) &  
wenzelm@26322
   248
        (ALL x. (Q(x) --> ~ S(x)) --> P(x) & R(x))   
wenzelm@26322
   249
    --> (ALL x. ~~S(x))"
wenzelm@26322
   250
  by (tactic "IntPr.fast_tac 1")
wenzelm@26322
   251
wenzelm@26322
   252
text "Problem 31"
wenzelm@36319
   253
schematic_lemma "?p : ~(EX x. P(x) & (Q(x) | R(x))) &  
wenzelm@26322
   254
        (EX x. L(x) & P(x)) &  
wenzelm@26322
   255
        (ALL x. ~ R(x) --> M(x))   
wenzelm@26322
   256
    --> (EX x. L(x) & M(x))"
wenzelm@26322
   257
  by (tactic "IntPr.fast_tac 1")
wenzelm@26322
   258
wenzelm@26322
   259
text "Problem 32"
wenzelm@36319
   260
schematic_lemma "?p : (ALL x. P(x) & (Q(x)|R(x))-->S(x)) &  
wenzelm@26322
   261
        (ALL x. S(x) & R(x) --> L(x)) &  
wenzelm@26322
   262
        (ALL x. M(x) --> R(x))   
wenzelm@26322
   263
    --> (ALL x. P(x) & M(x) --> L(x))"
wenzelm@26322
   264
  by (tactic "IntPr.best_tac 1") -- slow
wenzelm@26322
   265
wenzelm@26322
   266
text "Problem 39"
wenzelm@36319
   267
schematic_lemma "?p : ~ (EX x. ALL y. F(y,x) <-> ~F(y,y))"
wenzelm@26322
   268
  by (tactic "IntPr.best_tac 1")
wenzelm@26322
   269
wenzelm@26322
   270
text "Problem 40.  AMENDED"
wenzelm@36319
   271
schematic_lemma "?p : (EX y. ALL x. F(x,y) <-> F(x,x)) -->   
wenzelm@26322
   272
              ~(ALL x. EX y. ALL z. F(z,y) <-> ~ F(z,x))"
wenzelm@26322
   273
  by (tactic "IntPr.best_tac 1") -- slow
wenzelm@26322
   274
wenzelm@26322
   275
text "Problem 44"
wenzelm@36319
   276
schematic_lemma "?p : (ALL x. f(x) -->                                    
wenzelm@26322
   277
              (EX y. g(y) & h(x,y) & (EX y. g(y) & ~ h(x,y))))  &        
wenzelm@26322
   278
              (EX x. j(x) & (ALL y. g(y) --> h(x,y)))                    
wenzelm@26322
   279
              --> (EX x. j(x) & ~f(x))"
wenzelm@26322
   280
  by (tactic "IntPr.best_tac 1")
wenzelm@26322
   281
wenzelm@26322
   282
text "Problem 48"
wenzelm@36319
   283
schematic_lemma "?p : (a=b | c=d) & (a=c | b=d) --> a=d | b=c"
wenzelm@26322
   284
  by (tactic "IntPr.best_tac 1")
wenzelm@26322
   285
wenzelm@26322
   286
text "Problem 51"
wenzelm@36319
   287
schematic_lemma
wenzelm@26322
   288
    "?p : (EX z w. ALL x y. P(x,y) <->  (x=z & y=w)) -->   
wenzelm@26322
   289
     (EX z. ALL x. EX w. (ALL y. P(x,y) <-> y=w) <-> x=z)"
wenzelm@26322
   290
  by (tactic "IntPr.best_tac 1") -- {*60 seconds*}
wenzelm@26322
   291
wenzelm@26322
   292
text "Problem 56"
wenzelm@36319
   293
schematic_lemma "?p : (ALL x. (EX y. P(y) & x=f(y)) --> P(x)) <-> (ALL x. P(x) --> P(f(x)))"
wenzelm@26322
   294
  by (tactic "IntPr.best_tac 1")
wenzelm@26322
   295
wenzelm@26322
   296
text "Problem 57"
wenzelm@36319
   297
schematic_lemma
wenzelm@26322
   298
    "?p : P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) &  
wenzelm@26322
   299
     (ALL x y z. P(x,y) & P(y,z) --> P(x,z))    -->   P(f(a,b), f(a,c))"
wenzelm@26322
   300
  by (tactic "IntPr.best_tac 1")
wenzelm@26322
   301
wenzelm@26322
   302
text "Problem 60"
wenzelm@36319
   303
schematic_lemma "?p : ALL x. P(x,f(x)) <-> (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))"
wenzelm@26322
   304
  by (tactic "IntPr.best_tac 1")
wenzelm@26322
   305
wenzelm@26322
   306
end