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