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