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