src/Sequents/LK/Quantifiers.thy
author wenzelm
Mon, 20 Nov 2006 23:47:10 +0100
changeset 21426 87ac12bed1ab
child 35762 af3ff2ba4c54
permissions -rw-r--r--
converted legacy ML scripts;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21426
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
     1
(*  Title:      LK/Quantifiers.ML
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
     5
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
     6
Classical sequent calculus: examples with quantifiers.
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
     7
*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
     8
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
     9
theory Quantifiers
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    10
imports LK
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    11
begin
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    12
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    13
lemma "|- (ALL x. P)  <->  P"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    14
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    15
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    16
lemma "|- (ALL x y. P(x,y))  <->  (ALL y x. P(x,y))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    17
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    18
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    19
lemma "ALL u. P(u), ALL v. Q(v) |- ALL u v. P(u) & Q(v)"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    20
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    21
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    22
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    23
text "Permutation of existential quantifier."
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    24
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    25
lemma "|- (EX x y. P(x,y)) <-> (EX y x. P(x,y))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    26
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    27
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    28
lemma "|- (ALL x. P(x) & Q(x)) <-> (ALL x. P(x)) & (ALL x. Q(x))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    29
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    30
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    31
(*Converse is invalid*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    32
lemma "|- (ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x)|Q(x))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    33
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    34
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    35
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    36
text "Pushing ALL into an implication."
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    37
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    38
lemma "|- (ALL x. P --> Q(x))  <->  (P --> (ALL x. Q(x)))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    39
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    40
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    41
lemma "|- (ALL x. P(x)-->Q)  <->  ((EX x. P(x)) --> Q)"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    42
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    43
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    44
lemma "|- (EX x. P)  <->  P"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    45
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    46
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    47
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    48
text "Distribution of EX over disjunction."
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    49
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    50
lemma "|- (EX x. P(x) | Q(x)) <-> (EX x. P(x))  |  (EX x. Q(x))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    51
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    52
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    53
(*Converse is invalid*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    54
lemma "|- (EX x. P(x) & Q(x))  -->  (EX x. P(x))  &  (EX x. Q(x))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    55
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    56
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    57
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    58
text "Harder examples: classical theorems."
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    59
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    60
lemma "|- (EX x. P-->Q(x))  <->  (P --> (EX x. Q(x)))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    61
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    62
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    63
lemma "|- (EX x. P(x)-->Q)  <->  (ALL x. P(x)) --> Q"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    64
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    65
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    66
lemma "|- (ALL x. P(x)) | Q  <->  (ALL x. P(x) | Q)"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    67
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    68
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    69
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    70
text "Basic test of quantifier reasoning"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    71
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    72
lemma "|- (EX y. ALL x. Q(x,y)) --> (ALL x. EX y. Q(x,y))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    73
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    74
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    75
lemma "|- (ALL x. Q(x))  -->  (EX x. Q(x))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    76
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    77
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    78
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    79
text "The following are invalid!"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    80
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    81
(*INVALID*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    82
lemma "|- (ALL x. EX y. Q(x,y))  -->  (EX y. ALL x. Q(x,y))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    83
  apply fast?
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    84
  apply (rule _)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    85
  oops
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    86
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    87
(*INVALID*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    88
lemma "|- (EX x. Q(x))  -->  (ALL x. Q(x))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    89
  apply fast?
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    90
  apply (rule _)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    91
  oops
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    92
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    93
(*INVALID*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    94
lemma "|- P(?a) --> (ALL x. P(x))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    95
  apply fast?
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    96
  apply (rule _)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    97
  oops
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    98
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
    99
(*INVALID*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   100
lemma "|- (P(?a) --> (ALL x. Q(x))) --> (ALL x. P(x) --> Q(x))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   101
  apply fast?
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   102
  apply (rule _)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   103
  oops
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   104
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   105
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   106
text "Back to things that are provable..."
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   107
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   108
lemma "|- (ALL x. P(x)-->Q(x)) & (EX x. P(x)) --> (EX x. Q(x))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   109
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   110
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   111
(*An example of why exR should be delayed as long as possible*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   112
lemma "|- (P--> (EX x. Q(x))) & P--> (EX x. Q(x))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   113
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   114
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   115
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   116
text "Solving for a Var"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   117
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   118
lemma "|- (ALL x. P(x)-->Q(f(x))) & (ALL x. Q(x)-->R(g(x))) & P(d) --> R(?a)"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   119
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   120
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   121
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   122
text "Principia Mathematica *11.53"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   123
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   124
lemma "|- (ALL x y. P(x) --> Q(y)) <-> ((EX x. P(x)) --> (ALL y. Q(y)))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   125
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   126
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   127
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   128
text "Principia Mathematica *11.55"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   129
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   130
lemma "|- (EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX y. Q(x,y)))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   131
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   132
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   133
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   134
text "Principia Mathematica *11.61"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   135
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   136
lemma "|- (EX y. ALL x. P(x) --> Q(x,y)) --> (ALL x. P(x) --> (EX y. Q(x,y)))"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   137
  by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   138
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   139
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   140
(*21 August 88: loaded in 45.7 secs*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   141
(*18 September 2005: loaded in 0.114 secs*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   142
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents:
diff changeset
   143
end