src/FOL/ex/Classical.thy
author wenzelm
Fri, 13 May 2011 14:39:55 +0200
changeset 42789 3a84b6947932
parent 36319 8feb2c4bef1a
child 51717 9e7d1c139569
permissions -rw-r--r--
tuned proof;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31974
e81979a703a4 removed obsolete CVS Ids;
wenzelm
parents: 27148
diff changeset
     1
(*  Title:      FOL/ex/Classical.thy
14236
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
     2
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
     3
    Copyright   1994  University of Cambridge
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
     4
*)
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
     5
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
     6
header{*Classical Predicate Calculus Problems*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
     7
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 14236
diff changeset
     8
theory Classical imports FOL begin
14236
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
     9
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    10
lemma "(P --> Q | R) --> (P-->Q) | (P-->R)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    11
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    12
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    13
text{*If and only if*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    14
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    15
lemma "(P<->Q) <-> (Q<->P)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    16
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    17
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    18
lemma "~ (P <-> ~P)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    19
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    20
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    21
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    22
text{*Sample problems from 
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    23
  F. J. Pelletier, 
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    24
  Seventy-Five Problems for Testing Automatic Theorem Provers,
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    25
  J. Automated Reasoning 2 (1986), 191-216.
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    26
  Errata, JAR 4 (1988), 236-236.
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    27
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    28
The hardest problems -- judging by experience with several theorem provers,
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    29
including matrix ones -- are 34 and 43.
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    30
*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    31
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    32
subsection{*Pelletier's examples*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    33
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    34
text{*1*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    35
lemma "(P-->Q)  <->  (~Q --> ~P)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    36
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    37
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    38
text{*2*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    39
lemma "~ ~ P  <->  P"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    40
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    41
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    42
text{*3*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    43
lemma "~(P-->Q) --> (Q-->P)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    44
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    45
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    46
text{*4*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    47
lemma "(~P-->Q)  <->  (~Q --> P)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    48
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    49
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    50
text{*5*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    51
lemma "((P|Q)-->(P|R)) --> (P|(Q-->R))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    52
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    53
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    54
text{*6*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    55
lemma "P | ~ P"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    56
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    57
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    58
text{*7*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    59
lemma "P | ~ ~ ~ P"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    60
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    61
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    62
text{*8.  Peirce's law*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    63
lemma "((P-->Q) --> P)  -->  P"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    64
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    65
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    66
text{*9*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    67
lemma "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    68
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    69
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    70
text{*10*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    71
lemma "(Q-->R) & (R-->P&Q) & (P-->Q|R) --> (P<->Q)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    72
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    73
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    74
text{*11.  Proved in each direction (incorrectly, says Pelletier!!)  *}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    75
lemma "P<->P"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    76
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    77
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    78
text{*12.  "Dijkstra's law"*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    79
lemma "((P <-> Q) <-> R)  <->  (P <-> (Q <-> R))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    80
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    81
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    82
text{*13.  Distributive law*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    83
lemma "P | (Q & R)  <-> (P | Q) & (P | R)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    84
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    85
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    86
text{*14*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    87
lemma "(P <-> Q) <-> ((Q | ~P) & (~Q|P))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    88
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    89
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    90
text{*15*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    91
lemma "(P --> Q) <-> (~P | Q)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    92
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    93
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    94
text{*16*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    95
lemma "(P-->Q) | (Q-->P)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    96
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    97
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    98
text{*17*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
    99
lemma "((P & (Q-->R))-->S) <-> ((~P | Q | S) & (~P | ~R | S))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   100
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   101
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   102
subsection{*Classical Logic: examples with quantifiers*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   103
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   104
lemma "(\<forall>x. P(x) & Q(x)) <-> (\<forall>x. P(x))  &  (\<forall>x. Q(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   105
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   106
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   107
lemma "(\<exists>x. P-->Q(x))  <->  (P --> (\<exists>x. Q(x)))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   108
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   109
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   110
lemma "(\<exists>x. P(x)-->Q)  <->  (\<forall>x. P(x)) --> Q"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   111
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   112
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   113
lemma "(\<forall>x. P(x)) | Q  <->  (\<forall>x. P(x) | Q)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   114
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   115
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   116
text{*Discussed in Avron, Gentzen-Type Systems, Resolution and Tableaux,
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   117
  JAR 10 (265-281), 1993.  Proof is trivial!*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   118
lemma "~((\<exists>x.~P(x)) & ((\<exists>x. P(x)) | (\<exists>x. P(x) & Q(x))) & ~ (\<exists>x. P(x)))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   119
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   120
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   121
subsection{*Problems requiring quantifier duplication*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   122
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   123
text{*Theorem B of Peter Andrews, Theorem Proving via General Matings, 
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   124
  JACM 28 (1981).*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   125
lemma "(\<exists>x. \<forall>y. P(x) <-> P(y)) --> ((\<exists>x. P(x)) <-> (\<forall>y. P(y)))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   126
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   127
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   128
text{*Needs multiple instantiation of ALL.*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   129
lemma "(\<forall>x. P(x)-->P(f(x)))  &  P(d)-->P(f(f(f(d))))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   130
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   131
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   132
text{*Needs double instantiation of the quantifier*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   133
lemma "\<exists>x. P(x) --> P(a) & P(b)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   134
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   135
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   136
lemma "\<exists>z. P(z) --> (\<forall>x. P(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   137
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   138
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   139
lemma "\<exists>x. (\<exists>y. P(y)) --> P(x)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   140
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   141
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   142
text{*V. Lifschitz, What Is the Inverse Method?, JAR 5 (1989), 1--23.  NOT PROVED*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   143
lemma "\<exists>x x'. \<forall>y. \<exists>z z'.  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   144
                (~P(y,y) | P(x,x) | ~S(z,x)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   145
                (S(x,y) | ~S(y,z) | Q(z',z'))  &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   146
                (Q(x',y) | ~Q(y,z') | S(x',x'))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   147
oops
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   148
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   149
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   150
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   151
subsection{*Hard examples with quantifiers*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   152
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   153
text{*18*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   154
lemma "\<exists>y. \<forall>x. P(y)-->P(x)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   155
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   156
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   157
text{*19*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   158
lemma "\<exists>x. \<forall>y z. (P(y)-->Q(z)) --> (P(x)-->Q(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   159
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   160
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   161
text{*20*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   162
lemma "(\<forall>x y. \<exists>z. \<forall>w. (P(x)&Q(y)-->R(z)&S(w)))      
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   163
    --> (\<exists>x y. P(x) & Q(y)) --> (\<exists>z. R(z))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   164
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   165
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   166
text{*21*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   167
lemma "(\<exists>x. P-->Q(x)) & (\<exists>x. Q(x)-->P) --> (\<exists>x. P<->Q(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   168
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   169
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   170
text{*22*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   171
lemma "(\<forall>x. P <-> Q(x))  -->  (P <-> (\<forall>x. Q(x)))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   172
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   173
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   174
text{*23*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   175
lemma "(\<forall>x. P | Q(x))  <->  (P | (\<forall>x. Q(x)))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   176
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   177
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   178
text{*24*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   179
lemma "~(\<exists>x. S(x)&Q(x)) & (\<forall>x. P(x) --> Q(x)|R(x)) &   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   180
      (~(\<exists>x. P(x)) --> (\<exists>x. Q(x))) & (\<forall>x. Q(x)|R(x) --> S(x))   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   181
    --> (\<exists>x. P(x)&R(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   182
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   183
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   184
text{*25*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   185
lemma "(\<exists>x. P(x)) &   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   186
      (\<forall>x. L(x) --> ~ (M(x) & R(x))) &   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   187
      (\<forall>x. P(x) --> (M(x) & L(x))) &    
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   188
      ((\<forall>x. P(x)-->Q(x)) | (\<exists>x. P(x)&R(x)))   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   189
    --> (\<exists>x. Q(x)&P(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   190
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   191
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   192
text{*26*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   193
lemma "((\<exists>x. p(x)) <-> (\<exists>x. q(x))) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   194
      (\<forall>x. \<forall>y. p(x) & q(y) --> (r(x) <-> s(y)))    
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   195
  --> ((\<forall>x. p(x)-->r(x)) <-> (\<forall>x. q(x)-->s(x)))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   196
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   197
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   198
text{*27*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   199
lemma "(\<exists>x. P(x) & ~Q(x)) &    
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   200
      (\<forall>x. P(x) --> R(x)) &    
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   201
      (\<forall>x. M(x) & L(x) --> P(x)) &    
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   202
      ((\<exists>x. R(x) & ~ Q(x)) --> (\<forall>x. L(x) --> ~ R(x)))   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   203
  --> (\<forall>x. M(x) --> ~L(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   204
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   205
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   206
text{*28.  AMENDED*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   207
lemma "(\<forall>x. P(x) --> (\<forall>x. Q(x))) &    
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   208
        ((\<forall>x. Q(x)|R(x)) --> (\<exists>x. Q(x)&S(x))) &   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   209
        ((\<exists>x. S(x)) --> (\<forall>x. L(x) --> M(x)))   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   210
    --> (\<forall>x. P(x) & L(x) --> M(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   211
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   212
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   213
text{*29.  Essentially the same as Principia Mathematica *11.71*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   214
lemma "(\<exists>x. P(x)) & (\<exists>y. Q(y))   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   215
    --> ((\<forall>x. P(x)-->R(x)) & (\<forall>y. Q(y)-->S(y))   <->      
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   216
         (\<forall>x y. P(x) & Q(y) --> R(x) & S(y)))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   217
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   218
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   219
text{*30*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   220
lemma "(\<forall>x. P(x) | Q(x) --> ~ R(x)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   221
      (\<forall>x. (Q(x) --> ~ S(x)) --> P(x) & R(x))   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   222
    --> (\<forall>x. S(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   223
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   224
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   225
text{*31*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   226
lemma "~(\<exists>x. P(x) & (Q(x) | R(x))) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   227
        (\<exists>x. L(x) & P(x)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   228
        (\<forall>x. ~ R(x) --> M(x))   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   229
    --> (\<exists>x. L(x) & M(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   230
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   231
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   232
text{*32*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   233
lemma "(\<forall>x. P(x) & (Q(x)|R(x))-->S(x)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   234
      (\<forall>x. S(x) & R(x) --> L(x)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   235
      (\<forall>x. M(x) --> R(x))   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   236
      --> (\<forall>x. P(x) & M(x) --> L(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   237
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   238
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   239
text{*33*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   240
lemma "(\<forall>x. P(a) & (P(x)-->P(b))-->P(c))  <->     
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   241
      (\<forall>x. (~P(a) | P(x) | P(c)) & (~P(a) | ~P(b) | P(c)))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   242
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   243
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   244
text{*34  AMENDED (TWICE!!).  Andrews's challenge*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   245
lemma "((\<exists>x. \<forall>y. p(x) <-> p(y))  <->                 
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   246
       ((\<exists>x. q(x)) <-> (\<forall>y. p(y))))     <->         
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   247
      ((\<exists>x. \<forall>y. q(x) <-> q(y))  <->                 
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   248
       ((\<exists>x. p(x)) <-> (\<forall>y. q(y))))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   249
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   250
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   251
text{*35*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   252
lemma "\<exists>x y. P(x,y) -->  (\<forall>u v. P(u,v))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   253
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   254
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   255
text{*36*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   256
lemma "(\<forall>x. \<exists>y. J(x,y)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   257
      (\<forall>x. \<exists>y. G(x,y)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   258
      (\<forall>x y. J(x,y) | G(x,y) --> (\<forall>z. J(y,z) | G(y,z) --> H(x,z)))    
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   259
  --> (\<forall>x. \<exists>y. H(x,y))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   260
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   261
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   262
text{*37*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   263
lemma "(\<forall>z. \<exists>w. \<forall>x. \<exists>y.  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   264
           (P(x,z)-->P(y,w)) & P(y,z) & (P(y,w) --> (\<exists>u. Q(u,w)))) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   265
      (\<forall>x z. ~P(x,z) --> (\<exists>y. Q(y,z))) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   266
      ((\<exists>x y. Q(x,y)) --> (\<forall>x. R(x,x)))   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   267
      --> (\<forall>x. \<exists>y. R(x,y))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   268
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   269
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   270
text{*38*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   271
lemma "(\<forall>x. p(a) & (p(x) --> (\<exists>y. p(y) & r(x,y))) -->         
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   272
             (\<exists>z. \<exists>w. p(z) & r(x,w) & r(w,z)))  <->          
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   273
      (\<forall>x. (~p(a) | p(x) | (\<exists>z. \<exists>w. p(z) & r(x,w) & r(w,z))) &     
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   274
              (~p(a) | ~(\<exists>y. p(y) & r(x,y)) |                           
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   275
              (\<exists>z. \<exists>w. p(z) & r(x,w) & r(w,z))))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   276
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   277
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   278
text{*39*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   279
lemma "~ (\<exists>x. \<forall>y. F(y,x) <-> ~F(y,y))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   280
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   281
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   282
text{*40.  AMENDED*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   283
lemma "(\<exists>y. \<forall>x. F(x,y) <-> F(x,x)) -->   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   284
              ~(\<forall>x. \<exists>y. \<forall>z. F(z,y) <-> ~ F(z,x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   285
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   286
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   287
text{*41*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   288
lemma "(\<forall>z. \<exists>y. \<forall>x. f(x,y) <-> f(x,z) & ~ f(x,x))         
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   289
          --> ~ (\<exists>z. \<forall>x. f(x,z))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   290
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   291
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   292
text{*42*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   293
lemma "~ (\<exists>y. \<forall>x. p(x,y) <-> ~ (\<exists>z. p(x,z) & p(z,x)))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   294
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   295
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   296
text{*43*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   297
lemma "(\<forall>x. \<forall>y. q(x,y) <-> (\<forall>z. p(z,x) <-> p(z,y)))      
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   298
          --> (\<forall>x. \<forall>y. q(x,y) <-> q(y,x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   299
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   300
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   301
(*Other proofs: Can use auto, which cheats by using rewriting!  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   302
  Deepen_tac alone requires 253 secs.  Or
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   303
  by (mini_tac 1 THEN Deepen_tac 5 1) *)
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   304
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   305
text{*44*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   306
lemma "(\<forall>x. f(x) --> (\<exists>y. g(y) & h(x,y) & (\<exists>y. g(y) & ~ h(x,y)))) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   307
      (\<exists>x. j(x) & (\<forall>y. g(y) --> h(x,y)))                    
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   308
      --> (\<exists>x. j(x) & ~f(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   309
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   310
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   311
text{*45*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   312
lemma "(\<forall>x. f(x) & (\<forall>y. g(y) & h(x,y) --> j(x,y))   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   313
                      --> (\<forall>y. g(y) & h(x,y) --> k(y))) &     
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   314
      ~ (\<exists>y. l(y) & k(y)) &                                    
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   315
      (\<exists>x. f(x) & (\<forall>y. h(x,y) --> l(y))                     
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   316
                  & (\<forall>y. g(y) & h(x,y) --> j(x,y)))           
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   317
      --> (\<exists>x. f(x) & ~ (\<exists>y. g(y) & h(x,y)))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   318
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   319
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   320
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   321
text{*46*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   322
lemma "(\<forall>x. f(x) & (\<forall>y. f(y) & h(y,x) --> g(y)) --> g(x)) &       
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   323
      ((\<exists>x. f(x) & ~g(x)) -->                                     
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   324
       (\<exists>x. f(x) & ~g(x) & (\<forall>y. f(y) & ~g(y) --> j(x,y)))) &     
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   325
      (\<forall>x y. f(x) & f(y) & h(x,y) --> ~j(y,x))                     
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   326
       --> (\<forall>x. f(x) --> g(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   327
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   328
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   329
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   330
subsection{*Problems (mainly) involving equality or functions*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   331
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   332
text{*48*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   333
lemma "(a=b | c=d) & (a=c | b=d) --> a=d | b=c"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   334
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   335
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   336
text{*49  NOT PROVED AUTOMATICALLY.  Hard because it involves substitution
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   337
  for Vars
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   338
  the type constraint ensures that x,y,z have the same type as a,b,u. *}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   339
lemma "(\<exists>x y::'a. \<forall>z. z=x | z=y) & P(a) & P(b) & a~=b  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   340
                --> (\<forall>u::'a. P(u))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   341
apply safe
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   342
apply (rule_tac x = a in allE, assumption)
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   343
apply (rule_tac x = b in allE, assumption, fast)
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   344
       --{*blast's treatment of equality can't do it*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   345
done
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   346
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   347
text{*50.  (What has this to do with equality?) *}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   348
lemma "(\<forall>x. P(a,x) | (\<forall>y. P(x,y))) --> (\<exists>x. \<forall>y. P(x,y))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   349
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   350
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   351
text{*51*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   352
lemma "(\<exists>z w. \<forall>x y. P(x,y) <->  (x=z & y=w)) -->   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   353
      (\<exists>z. \<forall>x. \<exists>w. (\<forall>y. P(x,y) <-> y=w) <-> x=z)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   354
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   355
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   356
text{*52*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   357
text{*Almost the same as 51. *}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   358
lemma "(\<exists>z w. \<forall>x y. P(x,y) <->  (x=z & y=w)) -->   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   359
      (\<exists>w. \<forall>y. \<exists>z. (\<forall>x. P(x,y) <-> x=z) <-> y=w)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   360
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   361
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   362
text{*55*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   363
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   364
text{*Non-equational version, from Manthey and Bry, CADE-9 (Springer, 1988).
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   365
  fast DISCOVERS who killed Agatha. *}
36319
8feb2c4bef1a mark schematic statements explicitly;
wenzelm
parents: 32960
diff changeset
   366
schematic_lemma "lives(agatha) & lives(butler) & lives(charles) &  
14236
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   367
   (killed(agatha,agatha) | killed(butler,agatha) | killed(charles,agatha)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   368
   (\<forall>x y. killed(x,y) --> hates(x,y) & ~richer(x,y)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   369
   (\<forall>x. hates(agatha,x) --> ~hates(charles,x)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   370
   (hates(agatha,agatha) & hates(agatha,charles)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   371
   (\<forall>x. lives(x) & ~richer(x,agatha) --> hates(butler,x)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   372
   (\<forall>x. hates(agatha,x) --> hates(butler,x)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   373
   (\<forall>x. ~hates(x,agatha) | ~hates(x,butler) | ~hates(x,charles)) -->  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   374
    killed(?who,agatha)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   375
by fast --{*MUCH faster than blast*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   376
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   377
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   378
text{*56*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   379
lemma "(\<forall>x. (\<exists>y. P(y) & x=f(y)) --> P(x)) <-> (\<forall>x. P(x) --> P(f(x)))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   380
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   381
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   382
text{*57*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   383
lemma "P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   384
     (\<forall>x y z. P(x,y) & P(y,z) --> P(x,z))    -->   P(f(a,b), f(a,c))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   385
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   386
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   387
text{*58  NOT PROVED AUTOMATICALLY*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   388
lemma "(\<forall>x y. f(x)=g(y)) --> (\<forall>x y. f(f(x))=f(g(y)))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   389
by (slow elim: subst_context)
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   390
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   391
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   392
text{*59*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   393
lemma "(\<forall>x. P(x) <-> ~P(f(x))) --> (\<exists>x. P(x) & ~P(f(x)))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   394
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   395
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   396
text{*60*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   397
lemma "\<forall>x. P(x,f(x)) <-> (\<exists>y. (\<forall>z. P(z,y) --> P(z,f(x))) & P(x,y))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   398
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   399
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   400
text{*62 as corrected in JAR 18 (1997), page 135*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   401
lemma "(\<forall>x. p(a) & (p(x) --> p(f(x))) --> p(f(f(x))))  <->      
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   402
      (\<forall>x. (~p(a) | p(x) | p(f(f(x)))) &                       
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   403
              (~p(a) | ~p(f(x)) | p(f(f(x)))))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   404
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   405
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   406
text{*From Davis, Obvious Logical Inferences, IJCAI-81, 530-531
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   407
  fast indeed copes!*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   408
lemma "(\<forall>x. F(x) & ~G(x) --> (\<exists>y. H(x,y) & J(y))) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   409
              (\<exists>x. K(x) & F(x) & (\<forall>y. H(x,y) --> K(y))) &    
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   410
              (\<forall>x. K(x) --> ~G(x))  -->  (\<exists>x. K(x) & J(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   411
by fast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   412
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   413
text{*From Rudnicki, Obvious Inferences, JAR 3 (1987), 383-393.  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   414
  It does seem obvious!*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   415
lemma "(\<forall>x. F(x) & ~G(x) --> (\<exists>y. H(x,y) & J(y))) &         
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   416
      (\<exists>x. K(x) & F(x) & (\<forall>y. H(x,y) --> K(y)))  &         
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   417
      (\<forall>x. K(x) --> ~G(x))   -->   (\<exists>x. K(x) --> ~G(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   418
by fast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   419
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   420
text{*Halting problem: Formulation of Li Dafa (AAR Newsletter 27, Oct 1994.)
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31974
diff changeset
   421
  author U. Egly*}
14236
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   422
lemma "((\<exists>x. A(x) & (\<forall>y. C(y) --> (\<forall>z. D(x,y,z)))) -->                
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   423
   (\<exists>w. C(w) & (\<forall>y. C(y) --> (\<forall>z. D(w,y,z)))))                   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   424
  &                                                                      
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   425
  (\<forall>w. C(w) & (\<forall>u. C(u) --> (\<forall>v. D(w,u,v))) -->                 
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   426
        (\<forall>y z.                                                        
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   427
            (C(y) &  P(y,z) --> Q(w,y,z) & OO(w,g)) &                    
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   428
            (C(y) & ~P(y,z) --> Q(w,y,z) & OO(w,b))))                    
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   429
  &                                                                      
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   430
  (\<forall>w. C(w) &                                                         
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   431
    (\<forall>y z.                                                            
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   432
        (C(y) & P(y,z) --> Q(w,y,z) & OO(w,g)) &                         
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   433
        (C(y) & ~P(y,z) --> Q(w,y,z) & OO(w,b))) -->                     
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   434
    (\<exists>v. C(v) &                                                        
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   435
          (\<forall>y. ((C(y) & Q(w,y,y)) & OO(w,g) --> ~P(v,y)) &            
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   436
                  ((C(y) & Q(w,y,y)) & OO(w,b) --> P(v,y) & OO(v,b)))))  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   437
   -->                   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   438
   ~ (\<exists>x. A(x) & (\<forall>y. C(y) --> (\<forall>z. D(x,y,z))))"
42789
3a84b6947932 tuned proof;
wenzelm
parents: 36319
diff changeset
   439
by (blast 12)
14236
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   440
   --{*Needed because the search for depths below 12 is very slow*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   441
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   442
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   443
text{*Halting problem II: credited to M. Bruschi by Li Dafa in JAR 18(1), p.105*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   444
lemma "((\<exists>x. A(x) & (\<forall>y. C(y) --> (\<forall>z. D(x,y,z)))) -->        
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   445
   (\<exists>w. C(w) & (\<forall>y. C(y) --> (\<forall>z. D(w,y,z)))))           
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   446
  &                                                              
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   447
  (\<forall>w. C(w) & (\<forall>u. C(u) --> (\<forall>v. D(w,u,v))) -->         
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   448
        (\<forall>y z.                                                
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   449
            (C(y) &  P(y,z) --> Q(w,y,z) & OO(w,g)) &           
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   450
            (C(y) & ~P(y,z) --> Q(w,y,z) & OO(w,b))))          
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   451
  &                                                              
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   452
  ((\<exists>w. C(w) & (\<forall>y. (C(y) &  P(y,y) --> Q(w,y,y) & OO(w,g)) & 
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   453
                         (C(y) & ~P(y,y) --> Q(w,y,y) & OO(w,b))))  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   454
   -->                                                             
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   455
   (\<exists>v. C(v) & (\<forall>y. (C(y) &  P(y,y) --> P(v,y) & OO(v,g)) &   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   456
                         (C(y) & ~P(y,y) --> P(v,y) & OO(v,b)))))  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   457
  -->                                                              
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   458
  ((\<exists>v. C(v) & (\<forall>y. (C(y) &  P(y,y) --> P(v,y) & OO(v,g)) &   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   459
                         (C(y) & ~P(y,y) --> P(v,y) & OO(v,b))))   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   460
   -->                                                             
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   461
   (\<exists>u. C(u) & (\<forall>y. (C(y) &  P(y,y) --> ~P(u,y)) &     
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   462
                         (C(y) & ~P(y,y) --> P(u,y) & OO(u,b)))))  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   463
   -->                                                             
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   464
   ~ (\<exists>x. A(x) & (\<forall>y. C(y) --> (\<forall>z. D(x,y,z))))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   465
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   466
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   467
text{* Challenge found on info-hol *}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   468
lemma "\<forall>x. \<exists>v w. \<forall>y z. P(x) & Q(y) --> (P(v) | R(w)) & (R(z) --> Q(v))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   469
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   470
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   471
text{*Attributed to Lewis Carroll by S. G. Pulman.  The first or last assumption
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   472
can be deleted.*}
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   473
lemma "(\<forall>x. honest(x) & industrious(x) --> healthy(x)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   474
      ~ (\<exists>x. grocer(x) & healthy(x)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   475
      (\<forall>x. industrious(x) & grocer(x) --> honest(x)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   476
      (\<forall>x. cyclist(x) --> industrious(x)) &  
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   477
      (\<forall>x. ~healthy(x) & cyclist(x) --> ~honest(x))   
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   478
      --> (\<forall>x. grocer(x) --> ~cyclist(x))"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   479
by blast
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   480
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   481
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   482
(*Runtimes for old versions of this file:
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   483
Thu Jul 23 1992: loaded in 467s using iffE [on SPARC2] 
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   484
Mon Nov 14 1994: loaded in 144s [on SPARC10, with deepen_tac] 
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   485
Wed Nov 16 1994: loaded in 138s [after addition of norm_term_skip] 
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   486
Mon Nov 21 1994: loaded in 131s [DEPTH_FIRST suppressing repetitions] 
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   487
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   488
Further runtimes on a Sun-4
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   489
Tue Mar  4 1997: loaded in 93s (version 94-7) 
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   490
Tue Mar  4 1997: loaded in 89s
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   491
Thu Apr  3 1997: loaded in 44s--using mostly Blast_tac
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   492
Thu Apr  3 1997: loaded in 96s--addition of two Halting Probs
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   493
Thu Apr  3 1997: loaded in 98s--using lim-1 for all haz rules
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   494
Tue Dec  2 1997: loaded in 107s--added 46; new equalSubst
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   495
Fri Dec 12 1997: loaded in 91s--faster proof reconstruction
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   496
Thu Dec 18 1997: loaded in 94s--two new "obvious theorems" (??)
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   497
*)
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   498
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   499
end
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents:
diff changeset
   500