src/Sequents/LK/quant.ML
author wenzelm
Thu, 11 Mar 1999 13:20:35 +0100
changeset 6349 f7750d816c21
parent 6252 935f183bf406
child 17481 75166ebb619b
permissions -rw-r--r--
removed foo_build_completed -- now handled by session management (via usedir);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6252
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
     1
(*  Title:      LK/ex/quant
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
     5
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
     6
Classical sequent calculus: examples with quantifiers.
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
     7
*)
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
     8
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
     9
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    10
writeln"LK/ex/quant: Examples with quantifiers";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    11
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    12
goal LK.thy "|- (ALL x. P)  <->  P";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    13
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    14
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    15
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    16
goal LK.thy "|- (ALL x y. P(x,y))  <->  (ALL y x. P(x,y))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    17
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    18
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    19
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    20
goal LK.thy "ALL u. P(u), ALL v. Q(v) |- ALL u v. P(u) & Q(v)";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    21
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    22
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    23
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    24
writeln"Permutation of existential quantifier.";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    25
goal LK.thy "|- (EX x y. P(x,y)) <-> (EX y x. P(x,y))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    26
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    27
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    28
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    29
goal LK.thy "|- (ALL x. P(x) & Q(x)) <-> (ALL x. P(x)) & (ALL x. Q(x))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    30
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    31
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    32
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    33
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    34
(*Converse is invalid*)
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    35
goal LK.thy "|- (ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x)|Q(x))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    36
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    37
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    38
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    39
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    40
writeln"Pushing ALL into an implication.";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    41
goal LK.thy "|- (ALL x. P --> Q(x))  <->  (P --> (ALL x. Q(x)))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    42
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    43
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    44
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    45
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    46
goal LK.thy "|- (ALL x. P(x)-->Q)  <->  ((EX x. P(x)) --> Q)";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    47
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    48
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    49
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    50
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    51
goal LK.thy "|- (EX x. P)  <->  P";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    52
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    53
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    54
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    55
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    56
writeln"Distribution of EX over disjunction.";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    57
goal LK.thy "|- (EX x. P(x) | Q(x)) <-> (EX x. P(x))  |  (EX x. Q(x))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    58
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    59
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    60
(*5 secs*)
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    61
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    62
(*Converse is invalid*)
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    63
goal LK.thy "|- (EX x. P(x) & Q(x))  -->  (EX x. P(x))  &  (EX x. Q(x))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    64
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    65
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    66
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    67
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    68
writeln"Harder examples: classical theorems.";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    69
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    70
goal LK.thy "|- (EX x. P-->Q(x))  <->  (P --> (EX x. Q(x)))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    71
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    72
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    73
(*3 secs*)
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    74
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    75
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    76
goal LK.thy "|- (EX x. P(x)-->Q)  <->  (ALL x. P(x)) --> Q";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    77
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    78
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    79
(*5 secs*)
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    80
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    81
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    82
goal LK.thy "|- (ALL x. P(x)) | Q  <->  (ALL x. P(x) | Q)";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    83
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    84
result(); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    85
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    86
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    87
writeln"Basic test of quantifier reasoning";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    88
goal LK.thy
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    89
   "|- (EX y. ALL x. Q(x,y)) --> (ALL x. EX y. Q(x,y))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    90
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    91
result();  
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    92
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    93
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    94
goal LK.thy "|- (ALL x. Q(x))  -->  (EX x. Q(x))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    95
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    96
result();  
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    97
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    98
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
    99
writeln"The following are invalid!";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   100
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   101
(*INVALID*)
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   102
goal LK.thy "|- (ALL x. EX y. Q(x,y))  -->  (EX y. ALL x. Q(x,y))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   103
by (fast_tac LK_pack 1) handle ERROR => writeln"Failed, as expected"; 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   104
(*Check that subgoals remain: proof failed.*)
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   105
getgoal 1; 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   106
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   107
(*INVALID*)
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   108
goal LK.thy "|- (EX x. Q(x))  -->  (ALL x. Q(x))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   109
by (fast_tac LK_pack 1) handle ERROR => writeln"Failed, as expected";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   110
getgoal 1; 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   111
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   112
goal LK.thy "|- P(?a) --> (ALL x. P(x))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   113
by (fast_tac LK_pack 1) handle ERROR => writeln"Failed, as expected";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   114
(*Check that subgoals remain: proof failed.*)
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   115
getgoal 1;  
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   116
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   117
goal LK.thy "|- (P(?a) --> (ALL x. Q(x))) --> (ALL x. P(x) --> Q(x))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   118
by (fast_tac LK_pack 1) handle ERROR => writeln"Failed, as expected";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   119
getgoal 1;  
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   120
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   121
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   122
writeln"Back to things that are provable...";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   123
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   124
goal LK.thy "|- (ALL x. P(x)-->Q(x)) & (EX x. P(x)) --> (EX x. Q(x))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   125
by (fast_tac LK_pack 1); 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   126
result();  
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   127
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   128
(*An example of why exR should be delayed as long as possible*)
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   129
goal LK.thy "|- (P--> (EX x. Q(x))) & P--> (EX x. Q(x))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   130
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   131
result();  
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   132
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   133
writeln"Solving for a Var";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   134
goal LK.thy 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   135
   "|- (ALL x. P(x)-->Q(f(x))) & (ALL x. Q(x)-->R(g(x))) & P(d) --> R(?a)";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   136
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   137
result();
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   138
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   139
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   140
writeln"Principia Mathematica *11.53";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   141
goal LK.thy 
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   142
    "|- (ALL x y. P(x) --> Q(y)) <-> ((EX x. P(x)) --> (ALL y. Q(y)))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   143
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   144
result();
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   145
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   146
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   147
writeln"Principia Mathematica *11.55";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   148
goal LK.thy "|- (EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX y. Q(x,y)))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   149
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   150
result();
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   151
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   152
writeln"Principia Mathematica *11.61";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   153
goal LK.thy
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   154
   "|- (EX y. ALL x. P(x) --> Q(x,y)) --> (ALL x. P(x) --> (EX y. Q(x,y)))";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   155
by (fast_tac LK_pack 1);
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   156
result();
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   157
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   158
writeln"Reached end of file.";
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   159
935f183bf406 examples made separate dirs;
wenzelm
parents:
diff changeset
   160
(*21 August 88: loaded in 45.7 secs*)