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