src/Sequents/ILL.ML
author wenzelm
Sun, 18 Sep 2005 15:20:08 +0200
changeset 17481 75166ebb619b
parent 9259 103acc345f75
permissions -rw-r--r--
converted to Isar theory format;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
     1
(*  Title:      Sequents/ILL.ML
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
     2
    ID:         $Id$
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
     3
    Author:     Sara Kalvala and Valeria de Paiva
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
     5
*)
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
     6
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
     7
val lazy_cs = empty_pack
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
     8
 add_safes [tensl, conjr, disjl, promote0,
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
     9
            context2,context3]
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    10
 add_unsafes [identity, zerol, conjll, conjlr, disjrl, disjrr,
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
    11
               impr, tensr, impl, derelict, weaken,
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
    12
                 promote1, promote2,context1,context4a,context4b];
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    13
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    14
fun prom_tac n = REPEAT (resolve_tac [promote0,promote1,promote2] n);
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    15
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
    16
fun auto x = prove_goal (the_context ()) x (fn prems => [best_tac lazy_cs 1]);
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    17
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    18
Goal "$F, $G |- A ==> $F, !(A -o B), $G |- B";
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    19
by (rtac derelict 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    20
by (rtac impl 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    21
by (rtac identity 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    22
by (rtac context1 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    23
by (assume_tac 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    24
qed "aux_impl";
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    25
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    26
Goal " $F, !A, !B, $G |- C ==> $F, !(A && B), $G |- C";
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    27
by (rtac contract 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    28
by (res_inst_tac [("A","(!A) >< (!B)")] cut 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    29
by (rtac tensr 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    30
by (rtac (auto "! (A && B) |- !A") 3);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    31
by (rtac (auto "! (A && B) |- !B") 3);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    32
by (rtac context1 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    33
by (rtac tensl 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    34
by (assume_tac 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    35
by (rtac context3 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    36
by (rtac context3 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    37
by (rtac context1 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    38
qed "conj_lemma";
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    39
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    40
Goal "!A, !A, $G |- B ==> $G |- (!A) -o B";
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    41
by (rtac impr 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    42
by (rtac contract 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    43
by (assume_tac 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    44
qed "impr_contract";
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    45
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    46
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    47
Goal "A, !A, $G |- B ==> $G |- (!A) -o B";
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    48
by (rtac impr 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    49
by (rtac contract 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    50
by (rtac derelict 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    51
by (assume_tac 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    52
qed "impr_contr_der";
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    53
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
    54
val _ = goal (the_context ()) "$F, (!B) -o 0, $G, !B, $H |- A";
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    55
by (rtac impl 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    56
by (rtac identity 3);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    57
by (rtac context3 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    58
by (rtac context1 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    59
by (rtac zerol 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    60
qed "contrad1";
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    61
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    62
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
    63
val _ = goal (the_context ()) "$F, !B, $G, (!B) -o 0, $H |- A";
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    64
by (rtac impl 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    65
by (rtac identity 3);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    66
by (rtac context3 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    67
by (rtac context1 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    68
by (rtac zerol 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    69
qed "contrad2";
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    70
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
    71
val _ = goal (the_context ()) "A -o B, A |- B";
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    72
by (rtac impl 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    73
by (rtac identity 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    74
by (rtac identity 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    75
by (rtac context1 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    76
qed "ll_mp";
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    77
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    78
Goal "$F, B, $G, $H |- C ==> $F, A, $G, A -o B, $H |- C";
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    79
by (res_inst_tac [("A","B")] cut 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    80
by (rtac ll_mp 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    81
by (assume_tac 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    82
by (rtac context3 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    83
by (rtac context3 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    84
by (rtac context1 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    85
qed "mp_rule1";
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    86
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    87
Goal "$F, B, $G, $H |- C ==> $F, A -o B, $G, A, $H |- C";
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    88
by (res_inst_tac [("A","B")] cut 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    89
by (rtac ll_mp 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    90
by (assume_tac 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    91
by (rtac context3 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    92
by (rtac context3 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    93
by (rtac context1 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    94
qed "mp_rule2";
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    95
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
    96
val _ = goal (the_context ()) "!((!(A ++ B)) -o 0) |- !( ((!A) -o 0) && ((!B) -o 0))";
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    97
by (best_tac lazy_cs 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
    98
qed "or_to_and";
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
    99
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   100
Goal "$F, !( ((!A) -o 0) && ((!B) -o 0)), $G |- C ==> \
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   101
\         $F, !((!(A ++ B)) -o 0), $G |- C";
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   102
by (rtac cut 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   103
by (rtac or_to_and 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   104
by (assume_tac 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   105
by (rtac context3 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   106
by (rtac context1 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   107
qed "o_a_rule";
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   108
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   109
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   110
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
   111
val _ = goal (the_context ()) "((!A) -o C) ++ ((!B) -o C) |- (!(A && B)) -o C";
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   112
by (rtac impr 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   113
by (rtac conj_lemma 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   114
by (rtac disjl 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   115
by (ALLGOALS (rtac mp_rule1 THEN' best_tac lazy_cs));
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   116
qed "conj_imp";
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   117
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   118
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   119
val not_imp = auto "!A, !((!B) -o 0) |- (!((!A) -o B)) -o 0";
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   120
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   121
Goal "!A -o (!A -o 0) |- !A -o 0";
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   122
by (rtac impr 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   123
by (rtac contract 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   124
by (rtac impl 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   125
by (rtac identity 3);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   126
by (rtac context1 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   127
by (best_tac lazy_cs 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   128
qed "a_not_a";
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   129
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   130
Goal "$J1, !A -o 0, $J2 |- B ==> $J1, !A -o (!A -o 0), $J2 |- B";
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   131
by (res_inst_tac [("A","!A -o 0")] cut 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   132
by (rtac a_not_a 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   133
by (assume_tac 2);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   134
by (best_tac lazy_cs 1);
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   135
qed "a_not_a_rule";
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   136
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   137
fun thm_to_rule x y =
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
   138
    prove_goal (the_context ()) x
9259
103acc345f75 removal of batch style, and tidying
paulson
parents: 6451
diff changeset
   139
      (fn [prem] => [(rtac cut 1), (rtac y 2), (rtac prem 2),
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
   140
                     (best_tac lazy_cs 1)]);
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   141
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   142
val safe_cs = lazy_cs add_safes [conj_lemma, ll_mp,contrad1,
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
   143
                                 contrad2, mp_rule1, mp_rule2, o_a_rule,
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
   144
                                 a_not_a_rule]
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
   145
                      add_unsafes [aux_impl];
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   146
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   147
val power_cs = safe_cs add_unsafes [impr_contr_der];
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   148
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
   149
fun auto1 x = prove_goal (the_context ()) x (fn prems => [best_tac safe_cs 1]) ;
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   150
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 9259
diff changeset
   151
fun auto2 x = prove_goal (the_context ()) x (fn prems => [best_tac power_cs 1]) ;
2073
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   152
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   153
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   154
(* some examples from Troelstra and van Dalen
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   155
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   156
auto1  "!((!A) -o ((!B) -o 0)) |- (!(A && B)) -o 0";
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   157
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   158
auto1  "!((!(A && B)) -o 0) |- !((!A) -o ((!B) -o 0))";
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   159
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   160
auto1  "!( (!((! ((!A) -o B) ) -o 0)) -o 0) |- \
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   161
\        (!A) -o ( (!  ((!B) -o 0)) -o 0)";
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   162
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   163
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   164
auto2  "!(  (!A) -o ( (!  ((!B) -o 0)) -o 0) ) |- \
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   165
\         (!((! ((!A) -o B) ) -o 0)) -o 0";
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   166
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   167
fb0655539d05 New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff changeset
   168
                                                         *)