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