src/HOL/ex/Classical.thy
author hoelzl
Mon, 03 Dec 2012 18:19:08 +0100
changeset 50328 25b1e8686ce0
parent 41959 b460124855b8
child 58889 5b7a9633cfa8
permissions -rw-r--r--
tuned proof
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41959
b460124855b8 tuned headers;
wenzelm
parents: 36319
diff changeset
     1
(*  Title:      HOL/ex/Classical.thy
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
     2
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
     3
    Copyright   1994  University of Cambridge
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
     4
*)
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
     5
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
     6
header{*Classical Predicate Calculus Problems*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
     7
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 16011
diff changeset
     8
theory Classical imports Main begin
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
     9
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    10
subsection{*Traditional Classical Reasoner*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    11
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
    12
text{*The machine "griffon" mentioned below is a 2.5GHz Power Mac G5.*}
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
    13
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
    14
text{*Taken from @{text "FOL/Classical.thy"}. When porting examples from
05382e257d95 tidying
paulson
parents: 14220
diff changeset
    15
first-order logic, beware of the precedence of @{text "="} versus @{text
05382e257d95 tidying
paulson
parents: 14220
diff changeset
    16
"\<leftrightarrow>"}.*}
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    17
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    18
lemma "(P --> Q | R) --> (P-->Q) | (P-->R)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    19
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    20
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    21
text{*If and only if*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    22
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    23
lemma "(P=Q) = (Q = (P::bool))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    24
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    25
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    26
lemma "~ (P = (~P))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    27
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    28
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    29
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
    30
text{*Sample problems from
05382e257d95 tidying
paulson
parents: 14220
diff changeset
    31
  F. J. Pelletier,
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    32
  Seventy-Five Problems for Testing Automatic Theorem Provers,
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    33
  J. Automated Reasoning 2 (1986), 191-216.
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    34
  Errata, JAR 4 (1988), 236-236.
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    35
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    36
The hardest problems -- judging by experience with several theorem provers,
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    37
including matrix ones -- are 34 and 43.
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    38
*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    39
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    40
subsubsection{*Pelletier's examples*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    41
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    42
text{*1*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    43
lemma "(P-->Q)  =  (~Q --> ~P)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    44
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    45
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    46
text{*2*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    47
lemma "(~ ~ P) =  P"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    48
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    49
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    50
text{*3*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    51
lemma "~(P-->Q) --> (Q-->P)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    52
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    53
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    54
text{*4*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    55
lemma "(~P-->Q)  =  (~Q --> P)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    56
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    57
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    58
text{*5*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    59
lemma "((P|Q)-->(P|R)) --> (P|(Q-->R))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    60
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    61
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    62
text{*6*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    63
lemma "P | ~ P"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    64
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    65
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    66
text{*7*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    67
lemma "P | ~ ~ ~ P"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    68
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    69
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    70
text{*8.  Peirce's law*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    71
lemma "((P-->Q) --> P)  -->  P"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    72
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    73
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    74
text{*9*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    75
lemma "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    76
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    77
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    78
text{*10*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    79
lemma "(Q-->R) & (R-->P&Q) & (P-->Q|R) --> (P=Q)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    80
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    81
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    82
text{*11.  Proved in each direction (incorrectly, says Pelletier!!)  *}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    83
lemma "P=(P::bool)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    84
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    85
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    86
text{*12.  "Dijkstra's law"*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    87
lemma "((P = Q) = R) = (P = (Q = R))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    88
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    89
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    90
text{*13.  Distributive law*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    91
lemma "(P | (Q & R)) = ((P | Q) & (P | R))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    92
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    93
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    94
text{*14*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    95
lemma "(P = Q) = ((Q | ~P) & (~Q|P))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    96
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    97
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    98
text{*15*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
    99
lemma "(P --> Q) = (~P | Q)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   100
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   101
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   102
text{*16*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   103
lemma "(P-->Q) | (Q-->P)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   104
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   105
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   106
text{*17*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   107
lemma "((P & (Q-->R))-->S)  =  ((~P | Q | S) & (~P | ~R | S))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   108
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   109
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   110
subsubsection{*Classical Logic: examples with quantifiers*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   111
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   112
lemma "(\<forall>x. P(x) & Q(x)) = ((\<forall>x. P(x)) & (\<forall>x. Q(x)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   113
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   114
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   115
lemma "(\<exists>x. P-->Q(x))  =  (P --> (\<exists>x. Q(x)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   116
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   117
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   118
lemma "(\<exists>x. P(x)-->Q) = ((\<forall>x. P(x)) --> Q)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   119
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   120
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   121
lemma "((\<forall>x. P(x)) | Q)  =  (\<forall>x. P(x) | Q)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   122
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   123
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   124
text{*From Wishnu Prasetya*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   125
lemma "(\<forall>s. q(s) --> r(s)) & ~r(s) & (\<forall>s. ~r(s) & ~q(s) --> p(t) | q(t))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   126
    --> p(t) | r(t)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   127
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   128
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   129
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   130
subsubsection{*Problems requiring quantifier duplication*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   131
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   132
text{*Theorem B of Peter Andrews, Theorem Proving via General Matings,
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   133
  JACM 28 (1981).*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   134
lemma "(\<exists>x. \<forall>y. P(x) = P(y)) --> ((\<exists>x. P(x)) = (\<forall>y. P(y)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   135
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   136
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   137
text{*Needs multiple instantiation of the quantifier.*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   138
lemma "(\<forall>x. P(x)-->P(f(x)))  &  P(d)-->P(f(f(f(d))))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   139
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   140
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   141
text{*Needs double instantiation of the quantifier*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   142
lemma "\<exists>x. P(x) --> P(a) & P(b)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   143
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   144
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   145
lemma "\<exists>z. P(z) --> (\<forall>x. P(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   146
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   147
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   148
lemma "\<exists>x. (\<exists>y. P(y)) --> P(x)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   149
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   150
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   151
subsubsection{*Hard examples with quantifiers*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   152
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   153
text{*Problem 18*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   154
lemma "\<exists>y. \<forall>x. P(y)-->P(x)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   155
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   156
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   157
text{*Problem 19*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   158
lemma "\<exists>x. \<forall>y z. (P(y)-->Q(z)) --> (P(x)-->Q(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   159
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   160
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   161
text{*Problem 20*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   162
lemma "(\<forall>x y. \<exists>z. \<forall>w. (P(x)&Q(y)-->R(z)&S(w)))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   163
    --> (\<exists>x y. P(x) & Q(y)) --> (\<exists>z. R(z))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   164
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   165
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   166
text{*Problem 21*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   167
lemma "(\<exists>x. P-->Q(x)) & (\<exists>x. Q(x)-->P) --> (\<exists>x. P=Q(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   168
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   169
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   170
text{*Problem 22*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   171
lemma "(\<forall>x. P = Q(x))  -->  (P = (\<forall>x. Q(x)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   172
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   173
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   174
text{*Problem 23*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   175
lemma "(\<forall>x. P | Q(x))  =  (P | (\<forall>x. Q(x)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   176
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   177
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   178
text{*Problem 24*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   179
lemma "~(\<exists>x. S(x)&Q(x)) & (\<forall>x. P(x) --> Q(x)|R(x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   180
     (~(\<exists>x. P(x)) --> (\<exists>x. Q(x))) & (\<forall>x. Q(x)|R(x) --> S(x))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   181
    --> (\<exists>x. P(x)&R(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   182
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   183
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   184
text{*Problem 25*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   185
lemma "(\<exists>x. P(x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   186
        (\<forall>x. L(x) --> ~ (M(x) & R(x))) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   187
        (\<forall>x. P(x) --> (M(x) & L(x))) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   188
        ((\<forall>x. P(x)-->Q(x)) | (\<exists>x. P(x)&R(x)))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   189
    --> (\<exists>x. Q(x)&P(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   190
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   191
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   192
text{*Problem 26*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   193
lemma "((\<exists>x. p(x)) = (\<exists>x. q(x))) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   194
      (\<forall>x. \<forall>y. p(x) & q(y) --> (r(x) = s(y)))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   195
  --> ((\<forall>x. p(x)-->r(x)) = (\<forall>x. q(x)-->s(x)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   196
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   197
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   198
text{*Problem 27*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   199
lemma "(\<exists>x. P(x) & ~Q(x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   200
              (\<forall>x. P(x) --> R(x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   201
              (\<forall>x. M(x) & L(x) --> P(x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   202
              ((\<exists>x. R(x) & ~ Q(x)) --> (\<forall>x. L(x) --> ~ R(x)))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   203
          --> (\<forall>x. M(x) --> ~L(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   204
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   205
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   206
text{*Problem 28.  AMENDED*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   207
lemma "(\<forall>x. P(x) --> (\<forall>x. Q(x))) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   208
        ((\<forall>x. Q(x)|R(x)) --> (\<exists>x. Q(x)&S(x))) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   209
        ((\<exists>x. S(x)) --> (\<forall>x. L(x) --> M(x)))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   210
    --> (\<forall>x. P(x) & L(x) --> M(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   211
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   212
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   213
text{*Problem 29.  Essentially the same as Principia Mathematica *11.71*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   214
lemma "(\<exists>x. F(x)) & (\<exists>y. G(y))
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   215
    --> ( ((\<forall>x. F(x)-->H(x)) & (\<forall>y. G(y)-->J(y)))  =
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   216
          (\<forall>x y. F(x) & G(y) --> H(x) & J(y)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   217
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   218
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   219
text{*Problem 30*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   220
lemma "(\<forall>x. P(x) | Q(x) --> ~ R(x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   221
        (\<forall>x. (Q(x) --> ~ S(x)) --> P(x) & R(x))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   222
    --> (\<forall>x. S(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   223
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   224
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   225
text{*Problem 31*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   226
lemma "~(\<exists>x. P(x) & (Q(x) | R(x))) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   227
        (\<exists>x. L(x) & P(x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   228
        (\<forall>x. ~ R(x) --> M(x))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   229
    --> (\<exists>x. L(x) & M(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   230
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   231
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   232
text{*Problem 32*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   233
lemma "(\<forall>x. P(x) & (Q(x)|R(x))-->S(x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   234
        (\<forall>x. S(x) & R(x) --> L(x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   235
        (\<forall>x. M(x) --> R(x))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   236
    --> (\<forall>x. P(x) & M(x) --> L(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   237
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   238
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   239
text{*Problem 33*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   240
lemma "(\<forall>x. P(a) & (P(x)-->P(b))-->P(c))  =
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   241
     (\<forall>x. (~P(a) | P(x) | P(c)) & (~P(a) | ~P(b) | P(c)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   242
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   243
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   244
text{*Problem 34  AMENDED (TWICE!!)*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   245
text{*Andrews's challenge*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   246
lemma "((\<exists>x. \<forall>y. p(x) = p(y))  =
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   247
               ((\<exists>x. q(x)) = (\<forall>y. p(y))))   =
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   248
              ((\<exists>x. \<forall>y. q(x) = q(y))  =
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   249
               ((\<exists>x. p(x)) = (\<forall>y. q(y))))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   250
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   251
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   252
text{*Problem 35*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   253
lemma "\<exists>x y. P x y -->  (\<forall>u v. P u v)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   254
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   255
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   256
text{*Problem 36*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   257
lemma "(\<forall>x. \<exists>y. J x y) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   258
        (\<forall>x. \<exists>y. G x y) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   259
        (\<forall>x y. J x y | G x y -->
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   260
        (\<forall>z. J y z | G y z --> H x z))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   261
    --> (\<forall>x. \<exists>y. H x y)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   262
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   263
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   264
text{*Problem 37*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   265
lemma "(\<forall>z. \<exists>w. \<forall>x. \<exists>y.
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   266
           (P x z -->P y w) & P y z & (P y w --> (\<exists>u. Q u w))) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   267
        (\<forall>x z. ~(P x z) --> (\<exists>y. Q y z)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   268
        ((\<exists>x y. Q x y) --> (\<forall>x. R x x))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   269
    --> (\<forall>x. \<exists>y. R x y)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   270
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   271
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   272
text{*Problem 38*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   273
lemma "(\<forall>x. p(a) & (p(x) --> (\<exists>y. p(y) & r x y)) -->
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   274
           (\<exists>z. \<exists>w. p(z) & r x w & r w z))  =
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   275
     (\<forall>x. (~p(a) | p(x) | (\<exists>z. \<exists>w. p(z) & r x w & r w z)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   276
           (~p(a) | ~(\<exists>y. p(y) & r x y) |
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   277
            (\<exists>z. \<exists>w. p(z) & r x w & r w z)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   278
by blast (*beats fast!*)
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   279
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   280
text{*Problem 39*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   281
lemma "~ (\<exists>x. \<forall>y. F y x = (~ F y y))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   282
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   283
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   284
text{*Problem 40.  AMENDED*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   285
lemma "(\<exists>y. \<forall>x. F x y = F x x)
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   286
        -->  ~ (\<forall>x. \<exists>y. \<forall>z. F z y = (~ F z x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   287
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   288
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   289
text{*Problem 41*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   290
lemma "(\<forall>z. \<exists>y. \<forall>x. f x y = (f x z & ~ f x x))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   291
               --> ~ (\<exists>z. \<forall>x. f x z)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   292
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   293
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   294
text{*Problem 42*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   295
lemma "~ (\<exists>y. \<forall>x. p x y = (~ (\<exists>z. p x z & p z x)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   296
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   297
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   298
text{*Problem 43!!*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   299
lemma "(\<forall>x::'a. \<forall>y::'a. q x y = (\<forall>z. p z x = (p z y::bool)))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   300
  --> (\<forall>x. (\<forall>y. q x y = (q y x::bool)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   301
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   302
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   303
text{*Problem 44*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   304
lemma "(\<forall>x. f(x) -->
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   305
              (\<exists>y. g(y) & h x y & (\<exists>y. g(y) & ~ h x y)))  &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   306
              (\<exists>x. j(x) & (\<forall>y. g(y) --> h x y))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   307
              --> (\<exists>x. j(x) & ~f(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   308
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   309
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   310
text{*Problem 45*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   311
lemma "(\<forall>x. f(x) & (\<forall>y. g(y) & h x y --> j x y)
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   312
                      --> (\<forall>y. g(y) & h x y --> k(y))) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   313
     ~ (\<exists>y. l(y) & k(y)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   314
     (\<exists>x. f(x) & (\<forall>y. h x y --> l(y))
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   315
                & (\<forall>y. g(y) & h x y --> j x y))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   316
      --> (\<exists>x. f(x) & ~ (\<exists>y. g(y) & h x y))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   317
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   318
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   319
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   320
subsubsection{*Problems (mainly) involving equality or functions*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   321
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   322
text{*Problem 48*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   323
lemma "(a=b | c=d) & (a=c | b=d) --> a=d | b=c"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   324
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   325
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   326
text{*Problem 49  NOT PROVED AUTOMATICALLY.
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   327
     Hard because it involves substitution for Vars
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   328
  the type constraint ensures that x,y,z have the same type as a,b,u. *}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   329
lemma "(\<exists>x y::'a. \<forall>z. z=x | z=y) & P(a) & P(b) & (~a=b)
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   330
                --> (\<forall>u::'a. P(u))"
23508
702e27cabe82 updated for metis method
paulson
parents: 22731
diff changeset
   331
by metis
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   332
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   333
text{*Problem 50.  (What has this to do with equality?) *}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   334
lemma "(\<forall>x. P a x | (\<forall>y. P x y)) --> (\<exists>x. \<forall>y. P x y)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   335
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   336
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   337
text{*Problem 51*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   338
lemma "(\<exists>z w. \<forall>x y. P x y = (x=z & y=w)) -->
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   339
     (\<exists>z. \<forall>x. \<exists>w. (\<forall>y. P x y = (y=w)) = (x=z))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   340
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   341
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   342
text{*Problem 52. Almost the same as 51. *}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   343
lemma "(\<exists>z w. \<forall>x y. P x y = (x=z & y=w)) -->
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   344
     (\<exists>w. \<forall>y. \<exists>z. (\<forall>x. P x y = (x=z)) = (y=w))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   345
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   346
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   347
text{*Problem 55*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   348
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   349
text{*Non-equational version, from Manthey and Bry, CADE-9 (Springer, 1988).
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   350
  fast DISCOVERS who killed Agatha. *}
36319
8feb2c4bef1a mark schematic statements explicitly;
wenzelm
parents: 32960
diff changeset
   351
schematic_lemma "lives(agatha) & lives(butler) & lives(charles) &
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   352
   (killed agatha agatha | killed butler agatha | killed charles agatha) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   353
   (\<forall>x y. killed x y --> hates x y & ~richer x y) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   354
   (\<forall>x. hates agatha x --> ~hates charles x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   355
   (hates agatha agatha & hates agatha charles) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   356
   (\<forall>x. lives(x) & ~richer x agatha --> hates butler x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   357
   (\<forall>x. hates agatha x --> hates butler x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   358
   (\<forall>x. ~hates x agatha | ~hates x butler | ~hates x charles) -->
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   359
    killed ?who agatha"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   360
by fast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   361
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   362
text{*Problem 56*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   363
lemma "(\<forall>x. (\<exists>y. P(y) & x=f(y)) --> P(x)) = (\<forall>x. P(x) --> P(f(x)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   364
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   365
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   366
text{*Problem 57*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   367
lemma "P (f a b) (f b c) & P (f b c) (f a c) &
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   368
     (\<forall>x y z. P x y & P y z --> P x z)    -->   P (f a b) (f a c)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   369
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   370
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   371
text{*Problem 58  NOT PROVED AUTOMATICALLY*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   372
lemma "(\<forall>x y. f(x)=g(y)) --> (\<forall>x y. f(f(x))=f(g(y)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   373
by (fast intro: arg_cong [of concl: f])
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   374
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   375
text{*Problem 59*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   376
lemma "(\<forall>x. P(x) = (~P(f(x)))) --> (\<exists>x. P(x) & ~P(f(x)))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   377
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   378
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   379
text{*Problem 60*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   380
lemma "\<forall>x. P x (f x) = (\<exists>y. (\<forall>z. P z y --> P z (f x)) & P x y)"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   381
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   382
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   383
text{*Problem 62 as corrected in JAR 18 (1997), page 135*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   384
lemma "(\<forall>x. p a & (p x --> p(f x)) --> p(f(f x)))  =
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   385
      (\<forall>x. (~ p a | p x | p(f(f x))) &
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   386
              (~ p a | ~ p(f x) | p(f(f x))))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   387
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   388
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   389
text{*From Davis, Obvious Logical Inferences, IJCAI-81, 530-531
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   390
  fast indeed copes!*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   391
lemma "(\<forall>x. F(x) & ~G(x) --> (\<exists>y. H(x,y) & J(y))) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   392
       (\<exists>x. K(x) & F(x) & (\<forall>y. H(x,y) --> K(y))) &
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   393
       (\<forall>x. K(x) --> ~G(x))  -->  (\<exists>x. K(x) & J(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   394
by fast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   395
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   396
text{*From Rudnicki, Obvious Inferences, JAR 3 (1987), 383-393.
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   397
  It does seem obvious!*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   398
lemma "(\<forall>x. F(x) & ~G(x) --> (\<exists>y. H(x,y) & J(y))) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   399
       (\<exists>x. K(x) & F(x) & (\<forall>y. H(x,y) --> K(y)))  &
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   400
       (\<forall>x. K(x) --> ~G(x))   -->   (\<exists>x. K(x) --> ~G(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   401
by fast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   402
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   403
text{*Attributed to Lewis Carroll by S. G. Pulman.  The first or last
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   404
assumption can be deleted.*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   405
lemma "(\<forall>x. honest(x) & industrious(x) --> healthy(x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   406
      ~ (\<exists>x. grocer(x) & healthy(x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   407
      (\<forall>x. industrious(x) & grocer(x) --> honest(x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   408
      (\<forall>x. cyclist(x) --> industrious(x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   409
      (\<forall>x. ~healthy(x) & cyclist(x) --> ~honest(x))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   410
      --> (\<forall>x. grocer(x) --> ~cyclist(x))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   411
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   412
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   413
lemma "(\<forall>x y. R(x,y) | R(y,x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   414
       (\<forall>x y. S(x,y) & S(y,x) --> x=y) &
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   415
       (\<forall>x y. R(x,y) --> S(x,y))    -->   (\<forall>x y. S(x,y) --> R(x,y))"
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   416
by blast
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   417
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   418
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   419
subsection{*Model Elimination Prover*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   420
16563
a92f96951355 meson method taking an argument list
paulson
parents: 16417
diff changeset
   421
a92f96951355 meson method taking an argument list
paulson
parents: 16417
diff changeset
   422
text{*Trying out meson with arguments*}
a92f96951355 meson method taking an argument list
paulson
parents: 16417
diff changeset
   423
lemma "x < y & y < z --> ~ (z < (x::nat))"
a92f96951355 meson method taking an argument list
paulson
parents: 16417
diff changeset
   424
by (meson order_less_irrefl order_less_trans)
a92f96951355 meson method taking an argument list
paulson
parents: 16417
diff changeset
   425
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   426
text{*The "small example" from Bezem, Hendriks and de Nivelle,
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   427
Automatic Proof Construction in Type Theory Using Resolution,
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   428
JAR 29: 3-4 (2002), pages 253-275 *}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   429
lemma "(\<forall>x y z. R(x,y) & R(y,z) --> R(x,z)) &
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   430
       (\<forall>x. \<exists>y. R(x,y)) -->
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   431
       ~ (\<forall>x. P x = (\<forall>y. R(x,y) --> ~ P y))"
32262
73cd8f74cf2a Meson.first_order_resolve: avoid handle _;
wenzelm
parents: 30607
diff changeset
   432
by (tactic{*Meson.safe_best_meson_tac @{context} 1*})
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   433
    --{*In contrast, @{text meson} is SLOW: 7.6s on griffon*}
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   434
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   435
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   436
subsubsection{*Pelletier's examples*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   437
text{*1*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   438
lemma "(P --> Q)  =  (~Q --> ~P)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   439
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   440
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   441
text{*2*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   442
lemma "(~ ~ P) =  P"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   443
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   444
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   445
text{*3*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   446
lemma "~(P-->Q) --> (Q-->P)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   447
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   448
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   449
text{*4*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   450
lemma "(~P-->Q)  =  (~Q --> P)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   451
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   452
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   453
text{*5*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   454
lemma "((P|Q)-->(P|R)) --> (P|(Q-->R))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   455
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   456
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   457
text{*6*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   458
lemma "P | ~ P"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   459
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   460
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   461
text{*7*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   462
lemma "P | ~ ~ ~ P"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   463
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   464
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   465
text{*8.  Peirce's law*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   466
lemma "((P-->Q) --> P)  -->  P"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   467
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   468
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   469
text{*9*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   470
lemma "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   471
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   472
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   473
text{*10*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   474
lemma "(Q-->R) & (R-->P&Q) & (P-->Q|R) --> (P=Q)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   475
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   476
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   477
text{*11.  Proved in each direction (incorrectly, says Pelletier!!)  *}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   478
lemma "P=(P::bool)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   479
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   480
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   481
text{*12.  "Dijkstra's law"*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   482
lemma "((P = Q) = R) = (P = (Q = R))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   483
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   484
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   485
text{*13.  Distributive law*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   486
lemma "(P | (Q & R)) = ((P | Q) & (P | R))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   487
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   488
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   489
text{*14*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   490
lemma "(P = Q) = ((Q | ~P) & (~Q|P))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   491
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   492
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   493
text{*15*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   494
lemma "(P --> Q) = (~P | Q)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   495
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   496
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   497
text{*16*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   498
lemma "(P-->Q) | (Q-->P)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   499
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   500
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   501
text{*17*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   502
lemma "((P & (Q-->R))-->S)  =  ((~P | Q | S) & (~P | ~R | S))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   503
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   504
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   505
subsubsection{*Classical Logic: examples with quantifiers*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   506
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   507
lemma "(\<forall>x. P x & Q x) = ((\<forall>x. P x) & (\<forall>x. Q x))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   508
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   509
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   510
lemma "(\<exists>x. P --> Q x)  =  (P --> (\<exists>x. Q x))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   511
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   512
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   513
lemma "(\<exists>x. P x --> Q) = ((\<forall>x. P x) --> Q)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   514
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   515
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   516
lemma "((\<forall>x. P x) | Q)  =  (\<forall>x. P x | Q)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   517
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   518
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   519
lemma "(\<forall>x. P x --> P(f x))  &  P d --> P(f(f(f d)))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   520
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   521
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   522
text{*Needs double instantiation of EXISTS*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   523
lemma "\<exists>x. P x --> P a & P b"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   524
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   525
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   526
lemma "\<exists>z. P z --> (\<forall>x. P x)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   527
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   528
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   529
text{*From a paper by Claire Quigley*}
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   530
lemma "\<exists>y. ((P c & Q y) | (\<exists>z. ~ Q z)) | (\<exists>x. ~ P x & Q d)"
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   531
by fast
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   532
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   533
subsubsection{*Hard examples with quantifiers*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   534
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   535
text{*Problem 18*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   536
lemma "\<exists>y. \<forall>x. P y --> P x"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   537
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   538
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   539
text{*Problem 19*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   540
lemma "\<exists>x. \<forall>y z. (P y --> Q z) --> (P x --> Q x)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   541
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   542
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   543
text{*Problem 20*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   544
lemma "(\<forall>x y. \<exists>z. \<forall>w. (P x & Q y --> R z & S w))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   545
    --> (\<exists>x y. P x & Q y) --> (\<exists>z. R z)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   546
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   547
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   548
text{*Problem 21*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   549
lemma "(\<exists>x. P --> Q x) & (\<exists>x. Q x --> P) --> (\<exists>x. P=Q x)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   550
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   551
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   552
text{*Problem 22*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   553
lemma "(\<forall>x. P = Q x)  -->  (P = (\<forall>x. Q x))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   554
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   555
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   556
text{*Problem 23*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   557
lemma "(\<forall>x. P | Q x)  =  (P | (\<forall>x. Q x))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   558
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   559
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   560
text{*Problem 24*}  (*The first goal clause is useless*)
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   561
lemma "~(\<exists>x. S x & Q x) & (\<forall>x. P x --> Q x | R x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   562
      (~(\<exists>x. P x) --> (\<exists>x. Q x)) & (\<forall>x. Q x | R x --> S x)
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   563
    --> (\<exists>x. P x & R x)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   564
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   565
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   566
text{*Problem 25*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   567
lemma "(\<exists>x. P x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   568
      (\<forall>x. L x --> ~ (M x & R x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   569
      (\<forall>x. P x --> (M x & L x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   570
      ((\<forall>x. P x --> Q x) | (\<exists>x. P x & R x))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   571
    --> (\<exists>x. Q x & P x)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   572
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   573
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   574
text{*Problem 26; has 24 Horn clauses*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   575
lemma "((\<exists>x. p x) = (\<exists>x. q x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   576
      (\<forall>x. \<forall>y. p x & q y --> (r x = s y))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   577
  --> ((\<forall>x. p x --> r x) = (\<forall>x. q x --> s x))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   578
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   579
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   580
text{*Problem 27; has 13 Horn clauses*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   581
lemma "(\<exists>x. P x & ~Q x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   582
      (\<forall>x. P x --> R x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   583
      (\<forall>x. M x & L x --> P x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   584
      ((\<exists>x. R x & ~ Q x) --> (\<forall>x. L x --> ~ R x))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   585
      --> (\<forall>x. M x --> ~L x)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   586
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   587
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   588
text{*Problem 28.  AMENDED; has 14 Horn clauses*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   589
lemma "(\<forall>x. P x --> (\<forall>x. Q x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   590
      ((\<forall>x. Q x | R x) --> (\<exists>x. Q x & S x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   591
      ((\<exists>x. S x) --> (\<forall>x. L x --> M x))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   592
    --> (\<forall>x. P x & L x --> M x)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   593
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   594
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   595
text{*Problem 29.  Essentially the same as Principia Mathematica *11.71.
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   596
      62 Horn clauses*}
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   597
lemma "(\<exists>x. F x) & (\<exists>y. G y)
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   598
    --> ( ((\<forall>x. F x --> H x) & (\<forall>y. G y --> J y))  =
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   599
          (\<forall>x y. F x & G y --> H x & J y))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   600
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   601
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   602
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   603
text{*Problem 30*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   604
lemma "(\<forall>x. P x | Q x --> ~ R x) & (\<forall>x. (Q x --> ~ S x) --> P x & R x)
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   605
       --> (\<forall>x. S x)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   606
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   607
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   608
text{*Problem 31; has 10 Horn clauses; first negative clauses is useless*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   609
lemma "~(\<exists>x. P x & (Q x | R x)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   610
      (\<exists>x. L x & P x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   611
      (\<forall>x. ~ R x --> M x)
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   612
    --> (\<exists>x. L x & M x)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   613
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   614
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   615
text{*Problem 32*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   616
lemma "(\<forall>x. P x & (Q x | R x)-->S x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   617
      (\<forall>x. S x & R x --> L x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   618
      (\<forall>x. M x --> R x)
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   619
    --> (\<forall>x. P x & M x --> L x)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   620
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   621
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   622
text{*Problem 33; has 55 Horn clauses*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   623
lemma "(\<forall>x. P a & (P x --> P b)-->P c)  =
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   624
      (\<forall>x. (~P a | P x | P c) & (~P a | ~P b | P c))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   625
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   626
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   627
text{*Problem 34: Andrews's challenge has 924 Horn clauses*}
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   628
lemma "((\<exists>x. \<forall>y. p x = p y)  = ((\<exists>x. q x) = (\<forall>y. p y)))     =
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   629
      ((\<exists>x. \<forall>y. q x = q y)  = ((\<exists>x. p x) = (\<forall>y. q y)))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   630
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   631
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   632
text{*Problem 35*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   633
lemma "\<exists>x y. P x y -->  (\<forall>u v. P u v)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   634
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   635
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   636
text{*Problem 36; has 15 Horn clauses*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   637
lemma "(\<forall>x. \<exists>y. J x y) & (\<forall>x. \<exists>y. G x y) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   638
       (\<forall>x y. J x y | G x y --> (\<forall>z. J y z | G y z --> H x z))
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   639
       --> (\<forall>x. \<exists>y. H x y)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   640
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   641
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   642
text{*Problem 37; has 10 Horn clauses*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   643
lemma "(\<forall>z. \<exists>w. \<forall>x. \<exists>y.
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   644
           (P x z --> P y w) & P y z & (P y w --> (\<exists>u. Q u w))) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   645
      (\<forall>x z. ~P x z --> (\<exists>y. Q y z)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   646
      ((\<exists>x y. Q x y) --> (\<forall>x. R x x))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   647
    --> (\<forall>x. \<exists>y. R x y)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   648
by blast --{*causes unification tracing messages*}
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   649
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   650
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   651
text{*Problem 38*}  text{*Quite hard: 422 Horn clauses!!*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   652
lemma "(\<forall>x. p a & (p x --> (\<exists>y. p y & r x y)) -->
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   653
           (\<exists>z. \<exists>w. p z & r x w & r w z))  =
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   654
      (\<forall>x. (~p a | p x | (\<exists>z. \<exists>w. p z & r x w & r w z)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   655
            (~p a | ~(\<exists>y. p y & r x y) |
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   656
             (\<exists>z. \<exists>w. p z & r x w & r w z)))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   657
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   658
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   659
text{*Problem 39*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   660
lemma "~ (\<exists>x. \<forall>y. F y x = (~F y y))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   661
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   662
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   663
text{*Problem 40.  AMENDED*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   664
lemma "(\<exists>y. \<forall>x. F x y = F x x)
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   665
      -->  ~ (\<forall>x. \<exists>y. \<forall>z. F z y = (~F z x))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   666
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   667
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   668
text{*Problem 41*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   669
lemma "(\<forall>z. (\<exists>y. (\<forall>x. f x y = (f x z & ~ f x x))))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   670
      --> ~ (\<exists>z. \<forall>x. f x z)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   671
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   672
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   673
text{*Problem 42*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   674
lemma "~ (\<exists>y. \<forall>x. p x y = (~ (\<exists>z. p x z & p z x)))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   675
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   676
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   677
text{*Problem 43  NOW PROVED AUTOMATICALLY!!*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   678
lemma "(\<forall>x. \<forall>y. q x y = (\<forall>z. p z x = (p z y::bool)))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   679
      --> (\<forall>x. (\<forall>y. q x y = (q y x::bool)))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   680
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   681
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   682
text{*Problem 44: 13 Horn clauses; 7-step proof*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   683
lemma "(\<forall>x. f x --> (\<exists>y. g y & h x y & (\<exists>y. g y & ~ h x y)))  &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   684
       (\<exists>x. j x & (\<forall>y. g y --> h x y))
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   685
       --> (\<exists>x. j x & ~f x)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   686
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   687
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   688
text{*Problem 45; has 27 Horn clauses; 54-step proof*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   689
lemma "(\<forall>x. f x & (\<forall>y. g y & h x y --> j x y)
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   690
            --> (\<forall>y. g y & h x y --> k y)) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   691
      ~ (\<exists>y. l y & k y) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   692
      (\<exists>x. f x & (\<forall>y. h x y --> l y)
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   693
                & (\<forall>y. g y & h x y --> j x y))
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   694
      --> (\<exists>x. f x & ~ (\<exists>y. g y & h x y))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   695
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   696
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   697
text{*Problem 46; has 26 Horn clauses; 21-step proof*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   698
lemma "(\<forall>x. f x & (\<forall>y. f y & h y x --> g y) --> g x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   699
       ((\<exists>x. f x & ~g x) -->
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   700
       (\<exists>x. f x & ~g x & (\<forall>y. f y & ~g y --> j x y))) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   701
       (\<forall>x y. f x & f y & h x y --> ~j y x)
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   702
       --> (\<forall>x. f x --> g x)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   703
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   704
16593
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   705
text{*Problem 47.  Schubert's Steamroller.
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   706
      26 clauses; 63 Horn clauses.
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   707
      87094 inferences so far.  Searching to depth 36*}
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   708
lemma "(\<forall>x. wolf x \<longrightarrow> animal x) & (\<exists>x. wolf x) &
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   709
       (\<forall>x. fox x \<longrightarrow> animal x) & (\<exists>x. fox x) &
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   710
       (\<forall>x. bird x \<longrightarrow> animal x) & (\<exists>x. bird x) &
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   711
       (\<forall>x. caterpillar x \<longrightarrow> animal x) & (\<exists>x. caterpillar x) &
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   712
       (\<forall>x. snail x \<longrightarrow> animal x) & (\<exists>x. snail x) &
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   713
       (\<forall>x. grain x \<longrightarrow> plant x) & (\<exists>x. grain x) &
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   714
       (\<forall>x. animal x \<longrightarrow>
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   715
             ((\<forall>y. plant y \<longrightarrow> eats x y)  \<or> 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32262
diff changeset
   716
              (\<forall>y. animal y & smaller_than y x &
16593
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   717
                    (\<exists>z. plant z & eats y z) \<longrightarrow> eats x y))) &
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   718
       (\<forall>x y. bird y & (snail x \<or> caterpillar x) \<longrightarrow> smaller_than x y) &
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   719
       (\<forall>x y. bird x & fox y \<longrightarrow> smaller_than x y) &
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   720
       (\<forall>x y. fox x & wolf y \<longrightarrow> smaller_than x y) &
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   721
       (\<forall>x y. wolf x & (fox y \<or> grain y) \<longrightarrow> ~eats x y) &
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   722
       (\<forall>x y. bird x & caterpillar y \<longrightarrow> eats x y) &
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   723
       (\<forall>x y. bird x & snail y \<longrightarrow> ~eats x y) &
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   724
       (\<forall>x. (caterpillar x \<or> snail x) \<longrightarrow> (\<exists>y. plant y & eats x y))
0115764233e4 stylistic improvements
paulson
parents: 16563
diff changeset
   725
       \<longrightarrow> (\<exists>x y. animal x & animal y & (\<exists>z. grain z & eats y z & eats x y))"
32262
73cd8f74cf2a Meson.first_order_resolve: avoid handle _;
wenzelm
parents: 30607
diff changeset
   726
by (tactic{*Meson.safe_best_meson_tac @{context} 1*})
15384
b13eb8a8897d renamed attributes to lower case
paulson
parents: 15151
diff changeset
   727
    --{*Nearly twice as fast as @{text meson},
b13eb8a8897d renamed attributes to lower case
paulson
parents: 15151
diff changeset
   728
        which performs iterative deepening rather than best-first search*}
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   729
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   730
text{*The Los problem. Circulated by John Harrison*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   731
lemma "(\<forall>x y z. P x y & P y z --> P x z) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   732
       (\<forall>x y z. Q x y & Q y z --> Q x z) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   733
       (\<forall>x y. P x y --> P y x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   734
       (\<forall>x y. P x y | Q x y)
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   735
       --> (\<forall>x y. P x y) | (\<forall>x y. Q x y)"
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   736
by meson
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   737
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   738
text{*A similar example, suggested by Johannes Schumann and
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   739
 credited to Pelletier*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   740
lemma "(\<forall>x y z. P x y --> P y z --> P x z) -->
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   741
       (\<forall>x y z. Q x y --> Q y z --> Q x z) -->
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   742
       (\<forall>x y. Q x y --> Q y x) -->  (\<forall>x y. P x y | Q x y) -->
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   743
       (\<forall>x y. P x y) | (\<forall>x y. Q x y)"
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   744
by meson
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   745
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   746
text{*Problem 50.  What has this to do with equality?*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   747
lemma "(\<forall>x. P a x | (\<forall>y. P x y)) --> (\<exists>x. \<forall>y. P x y)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   748
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   749
15151
429666b09783 proof reconstruction for external ATPs
paulson
parents: 15116
diff changeset
   750
text{*Problem 54: NOT PROVED*}
429666b09783 proof reconstruction for external ATPs
paulson
parents: 15116
diff changeset
   751
lemma "(\<forall>y::'a. \<exists>z. \<forall>x. F x z = (x=y)) -->
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   752
      ~ (\<exists>w. \<forall>x. F x w = (\<forall>u. F x u --> (\<exists>y. F y u & ~ (\<exists>z. F z u & F z y))))"
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   753
oops 
15151
429666b09783 proof reconstruction for external ATPs
paulson
parents: 15116
diff changeset
   754
429666b09783 proof reconstruction for external ATPs
paulson
parents: 15116
diff changeset
   755
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   756
text{*Problem 55*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   757
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   758
text{*Non-equational version, from Manthey and Bry, CADE-9 (Springer, 1988).
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   759
  @{text meson} cannot report who killed Agatha. *}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   760
lemma "lives agatha & lives butler & lives charles &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   761
       (killed agatha agatha | killed butler agatha | killed charles agatha) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   762
       (\<forall>x y. killed x y --> hates x y & ~richer x y) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   763
       (\<forall>x. hates agatha x --> ~hates charles x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   764
       (hates agatha agatha & hates agatha charles) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   765
       (\<forall>x. lives x & ~richer x agatha --> hates butler x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   766
       (\<forall>x. hates agatha x --> hates butler x) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   767
       (\<forall>x. ~hates x agatha | ~hates x butler | ~hates x charles) -->
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   768
       (\<exists>x. killed x agatha)"
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   769
by meson
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   770
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   771
text{*Problem 57*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   772
lemma "P (f a b) (f b c) & P (f b c) (f a c) &
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   773
      (\<forall>x y z. P x y & P y z --> P x z)    -->   P (f a b) (f a c)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   774
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   775
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   776
text{*Problem 58: Challenge found on info-hol *}
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   777
lemma "\<forall>P Q R x. \<exists>v w. \<forall>y z. P x & Q y --> (P v | R w) & (R z --> Q v)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   778
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   779
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   780
text{*Problem 59*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   781
lemma "(\<forall>x. P x = (~P(f x))) --> (\<exists>x. P x & ~P(f x))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   782
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   783
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   784
text{*Problem 60*}
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   785
lemma "\<forall>x. P x (f x) = (\<exists>y. (\<forall>z. P z y --> P z (f x)) & P x y)"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   786
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   787
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   788
text{*Problem 62 as corrected in JAR 18 (1997), page 135*}
14249
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   789
lemma "(\<forall>x. p a & (p x --> p(f x)) --> p(f(f x)))  =
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   790
       (\<forall>x. (~ p a | p x | p(f(f x))) &
05382e257d95 tidying
paulson
parents: 14220
diff changeset
   791
            (~ p a | ~ p(f x) | p(f(f x))))"
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   792
by blast
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   793
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   794
text{** Charles Morgan's problems **}
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   795
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   796
lemma
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   797
  assumes a: "\<forall>x y.  T(i x(i y x))"
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   798
      and b: "\<forall>x y z. T(i (i x (i y z)) (i (i x y) (i x z)))"
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   799
      and c: "\<forall>x y.   T(i (i (n x) (n y)) (i y x))"
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   800
      and c': "\<forall>x y.   T(i (i y x) (i (n x) (n y)))"
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   801
      and d: "\<forall>x y.   T(i x y) & T x --> T y"
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   802
 shows True
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   803
proof -
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   804
  from a b d have "\<forall>x. T(i x x)" by blast
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   805
  from a b c d have "\<forall>x. T(i x (n(n x)))" --{*Problem 66*}
23508
702e27cabe82 updated for metis method
paulson
parents: 22731
diff changeset
   806
    by metis
16011
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   807
  from a b c d have "\<forall>x. T(i (n(n x)) x)" --{*Problem 67*}
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   808
    by meson
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   809
      --{*4.9s on griffon. 51061 inferences, depth 21 *}
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   810
  from a b c' d have "\<forall>x. T(i x (n(n x)))" 
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   811
      --{*Problem 68: not proved.  Listed as satisfiable in TPTP (LCL078-1)*}
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   812
oops
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   813
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   814
text{*Problem 71, as found in TPTP (SYN007+1.005)*}
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   815
lemma "p1 = (p2 = (p3 = (p4 = (p5 = (p1 = (p2 = (p3 = (p4 = p5))))))))"
237aafbdb1f4 converted some problems to Isar format
paulson
parents: 15384
diff changeset
   816
by blast
14220
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   817
4dc132902672 Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
paulson
parents:
diff changeset
   818
end