src/Sequents/LK0.thy
author wenzelm
Mon, 20 Nov 2006 23:47:10 +0100
changeset 21426 87ac12bed1ab
parent 17481 75166ebb619b
child 21428 f84cf8e9cad8
permissions -rw-r--r--
converted legacy ML scripts;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
     1
(*  Title:      LK/LK0.thy
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
     2
    ID:         $Id$
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
     5
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
     6
There may be printing problems if a seqent is in expanded normal form
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
     7
        (eta-expanded, beta-contracted)
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
     8
*)
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
     9
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    10
header {* Classical First-Order Sequent Calculus *}
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    11
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    12
theory LK0
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    13
imports Sequents
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    14
begin
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    15
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    16
global
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    17
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    18
classes "term"
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    19
defaultsort "term"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    20
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    21
consts
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    22
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    23
 Trueprop       :: "two_seqi"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    24
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    25
  True         :: o
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    26
  False        :: o
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    27
  "="          :: "['a,'a] => o"     (infixl 50)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    28
  Not          :: "o => o"           ("~ _" [40] 40)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    29
  "&"          :: "[o,o] => o"       (infixr 35)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    30
  "|"          :: "[o,o] => o"       (infixr 30)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    31
  "-->"        :: "[o,o] => o"       (infixr 25)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    32
  "<->"        :: "[o,o] => o"       (infixr 25)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    33
  The          :: "('a => o) => 'a"  (binder "THE " 10)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    34
  All          :: "('a => o) => o"   (binder "ALL " 10)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    35
  Ex           :: "('a => o) => o"   (binder "EX " 10)
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    36
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    37
syntax
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    38
 "@Trueprop"    :: "two_seqe" ("((_)/ |- (_))" [6,6] 5)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    39
  "_not_equal" :: "['a, 'a] => o"              (infixl "~=" 50)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    40
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    41
parse_translation {* [("@Trueprop", two_seq_tr "Trueprop")] *}
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    42
print_translation {* [("Trueprop", two_seq_tr' "@Trueprop")] *}
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    43
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    44
translations
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    45
  "x ~= y"      == "~ (x = y)"
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    46
12116
4027b15377a5 got rid of obsolete input filtering;
wenzelm
parents: 7166
diff changeset
    47
syntax (xsymbols)
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    48
  Not           :: "o => o"               ("\<not> _" [40] 40)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    49
  "op &"        :: "[o, o] => o"          (infixr "\<and>" 35)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    50
  "op |"        :: "[o, o] => o"          (infixr "\<or>" 30)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    51
  "op -->"      :: "[o, o] => o"          (infixr "\<longrightarrow>" 25)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    52
  "op <->"      :: "[o, o] => o"          (infixr "\<longleftrightarrow>" 25)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    53
  "ALL "        :: "[idts, o] => o"       ("(3\<forall>_./ _)" [0, 10] 10)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    54
  "EX "         :: "[idts, o] => o"       ("(3\<exists>_./ _)" [0, 10] 10)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    55
  "EX! "        :: "[idts, o] => o"       ("(3\<exists>!_./ _)" [0, 10] 10)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    56
  "_not_equal"  :: "['a, 'a] => o"        (infixl "\<noteq>" 50)
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    57
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    58
syntax (HTML output)
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    59
  Not           :: "o => o"               ("\<not> _" [40] 40)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    60
  "op &"        :: "[o, o] => o"          (infixr "\<and>" 35)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    61
  "op |"        :: "[o, o] => o"          (infixr "\<or>" 30)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    62
  "ALL "        :: "[idts, o] => o"       ("(3\<forall>_./ _)" [0, 10] 10)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    63
  "EX "         :: "[idts, o] => o"       ("(3\<exists>_./ _)" [0, 10] 10)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    64
  "EX! "        :: "[idts, o] => o"       ("(3\<exists>!_./ _)" [0, 10] 10)
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    65
  "_not_equal"  :: "['a, 'a] => o"        (infixl "\<noteq>" 50)
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    66
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    67
local
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    68
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    69
axioms
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    70
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    71
  (*Structural rules: contraction, thinning, exchange [Soren Heilmann] *)
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    72
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    73
  contRS: "$H |- $E, $S, $S, $F ==> $H |- $E, $S, $F"
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    74
  contLS: "$H, $S, $S, $G |- $E ==> $H, $S, $G |- $E"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    75
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    76
  thinRS: "$H |- $E, $F ==> $H |- $E, $S, $F"
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    77
  thinLS: "$H, $G |- $E ==> $H, $S, $G |- $E"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    78
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    79
  exchRS: "$H |- $E, $R, $S, $F ==> $H |- $E, $S, $R, $F"
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    80
  exchLS: "$H, $R, $S, $G |- $E ==> $H, $S, $R, $G |- $E"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    81
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    82
  cut:   "[| $H |- $E, P;  $H, P |- $E |] ==> $H |- $E"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    83
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    84
  (*Propositional rules*)
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    85
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    86
  basic: "$H, P, $G |- $E, P, $F"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    87
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    88
  conjR: "[| $H|- $E, P, $F;  $H|- $E, Q, $F |] ==> $H|- $E, P&Q, $F"
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    89
  conjL: "$H, P, Q, $G |- $E ==> $H, P & Q, $G |- $E"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    90
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    91
  disjR: "$H |- $E, P, Q, $F ==> $H |- $E, P|Q, $F"
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    92
  disjL: "[| $H, P, $G |- $E;  $H, Q, $G |- $E |] ==> $H, P|Q, $G |- $E"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    93
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    94
  impR:  "$H, P |- $E, Q, $F ==> $H |- $E, P-->Q, $F"
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    95
  impL:  "[| $H,$G |- $E,P;  $H, Q, $G |- $E |] ==> $H, P-->Q, $G |- $E"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    96
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    97
  notR:  "$H, P |- $E, $F ==> $H |- $E, ~P, $F"
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
    98
  notL:  "$H, $G |- $E, P ==> $H, ~P, $G |- $E"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    99
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   100
  FalseL: "$H, False, $G |- $E"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   101
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   102
  True_def: "True == False-->False"
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   103
  iff_def:  "P<->Q == (P-->Q) & (Q-->P)"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   104
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   105
  (*Quantifiers*)
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   106
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   107
  allR:  "(!!x.$H |- $E, P(x), $F) ==> $H |- $E, ALL x. P(x), $F"
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   108
  allL:  "$H, P(x), $G, ALL x. P(x) |- $E ==> $H, ALL x. P(x), $G |- $E"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   109
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   110
  exR:   "$H |- $E, P(x), $F, EX x. P(x) ==> $H |- $E, EX x. P(x), $F"
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   111
  exL:   "(!!x.$H, P(x), $G |- $E) ==> $H, EX x. P(x), $G |- $E"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   112
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   113
  (*Equality*)
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   114
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   115
  refl:  "$H |- $E, a=a, $F"
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   116
  subst: "$H(a), $G(a) |- $E(a) ==> $H(b), a=b, $G(b) |- $E(b)"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   117
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   118
  (* Reflection *)
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   119
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   120
  eq_reflection:  "|- x=y ==> (x==y)"
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   121
  iff_reflection: "|- P<->Q ==> (P==Q)"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   122
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   123
  (*Descriptions*)
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   124
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   125
  The: "[| $H |- $E, P(a), $F;  !!x.$H, P(x) |- $E, x=a, $F |] ==>
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   126
          $H |- $E, P(THE x. P(x)), $F"
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   127
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   128
constdefs
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   129
  If :: "[o, 'a, 'a] => 'a"   ("(if (_)/ then (_)/ else (_))" 10)
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   130
   "If(P,x,y) == THE z::'a. (P --> z=x) & (~P --> z=y)"
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   131
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   132
setup
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   133
  prover_setup
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   134
21426
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   135
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   136
(** Structural Rules on formulas **)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   137
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   138
(*contraction*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   139
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   140
lemma contR: "$H |- $E, P, P, $F ==> $H |- $E, P, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   141
  by (rule contRS)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   142
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   143
lemma contL: "$H, P, P, $G |- $E ==> $H, P, $G |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   144
  by (rule contLS)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   145
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   146
(*thinning*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   147
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   148
lemma thinR: "$H |- $E, $F ==> $H |- $E, P, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   149
  by (rule thinRS)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   150
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   151
lemma thinL: "$H, $G |- $E ==> $H, P, $G |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   152
  by (rule thinLS)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   153
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   154
(*exchange*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   155
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   156
lemma exchR: "$H |- $E, Q, P, $F ==> $H |- $E, P, Q, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   157
  by (rule exchRS)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   158
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   159
lemma exchL: "$H, Q, P, $G |- $E ==> $H, P, Q, $G |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   160
  by (rule exchLS)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   161
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   162
ML {*
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   163
local
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   164
  val thinR = thm "thinR"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   165
  val thinL = thm "thinL"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   166
  val cut = thm "cut"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   167
in
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   168
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   169
(*Cut and thin, replacing the right-side formula*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   170
fun cutR_tac s i =
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   171
  res_inst_tac [ ("P", s) ] cut i  THEN  rtac thinR i
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   172
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   173
(*Cut and thin, replacing the left-side formula*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   174
fun cutL_tac s i =
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   175
  res_inst_tac [("P", s)] cut i  THEN  rtac thinL (i+1)
17481
75166ebb619b converted to Isar theory format;
wenzelm
parents: 16019
diff changeset
   176
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   177
end
21426
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   178
*}
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   179
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   180
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   181
(** If-and-only-if rules **)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   182
lemma iffR: 
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   183
    "[| $H,P |- $E,Q,$F;  $H,Q |- $E,P,$F |] ==> $H |- $E, P <-> Q, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   184
  apply (unfold iff_def)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   185
  apply (assumption | rule conjR impR)+
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   186
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   187
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   188
lemma iffL: 
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   189
    "[| $H,$G |- $E,P,Q;  $H,Q,P,$G |- $E |] ==> $H, P <-> Q, $G |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   190
  apply (unfold iff_def)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   191
  apply (assumption | rule conjL impL basic)+
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   192
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   193
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   194
lemma iff_refl: "$H |- $E, (P <-> P), $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   195
  apply (rule iffR basic)+
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   196
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   197
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   198
lemma TrueR: "$H |- $E, True, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   199
  apply (unfold True_def)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   200
  apply (rule impR)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   201
  apply (rule basic)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   202
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   203
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   204
(*Descriptions*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   205
lemma the_equality:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   206
  assumes p1: "$H |- $E, P(a), $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   207
    and p2: "!!x. $H, P(x) |- $E, x=a, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   208
  shows "$H |- $E, (THE x. P(x)) = a, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   209
  apply (rule cut)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   210
   apply (rule_tac [2] p2)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   211
  apply (rule The, rule thinR, rule exchRS, rule p1)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   212
  apply (rule thinR, rule exchRS, rule p2)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   213
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   214
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   215
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   216
(** Weakened quantifier rules.  Incomplete, they let the search terminate.**)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   217
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   218
lemma allL_thin: "$H, P(x), $G |- $E ==> $H, ALL x. P(x), $G |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   219
  apply (rule allL)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   220
  apply (erule thinL)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   221
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   222
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   223
lemma exR_thin: "$H |- $E, P(x), $F ==> $H |- $E, EX x. P(x), $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   224
  apply (rule exR)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   225
  apply (erule thinR)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   226
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   227
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   228
(*The rules of LK*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   229
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   230
ML {*
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   231
val prop_pack = empty_pack add_safes
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   232
                [thm "basic", thm "refl", thm "TrueR", thm "FalseL",
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   233
                 thm "conjL", thm "conjR", thm "disjL", thm "disjR", thm "impL", thm "impR",
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   234
                 thm "notL", thm "notR", thm "iffL", thm "iffR"];
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   235
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   236
val LK_pack = prop_pack add_safes   [thm "allR", thm "exL"]
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   237
                        add_unsafes [thm "allL_thin", thm "exR_thin", thm "the_equality"];
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   238
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   239
val LK_dup_pack = prop_pack add_safes   [thm "allR", thm "exL"]
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   240
                            add_unsafes [thm "allL", thm "exR", thm "the_equality"];
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   241
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   242
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   243
pack_ref() := LK_pack;
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   244
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   245
local
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   246
  val thinR = thm "thinR"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   247
  val thinL = thm "thinL"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   248
  val cut = thm "cut"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   249
in
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   250
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   251
fun lemma_tac th i =
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   252
    rtac (thinR RS cut) i THEN REPEAT (rtac thinL i) THEN rtac th i;
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   253
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   254
end;
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   255
*}
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   256
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   257
method_setup fast_prop =
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   258
  {* Method.no_args (Method.SIMPLE_METHOD' HEADGOAL (fast_tac prop_pack)) *}
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   259
  "propositional reasoning"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   260
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   261
method_setup fast =
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   262
  {* Method.no_args (Method.SIMPLE_METHOD' HEADGOAL (fast_tac LK_pack)) *}
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   263
  "classical reasoning"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   264
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   265
method_setup fast_dup =
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   266
  {* Method.no_args (Method.SIMPLE_METHOD' HEADGOAL (fast_tac LK_dup_pack)) *}
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   267
  "classical reasoning"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   268
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   269
method_setup best =
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   270
  {* Method.no_args (Method.SIMPLE_METHOD' HEADGOAL (best_tac LK_pack)) *}
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   271
  "classical reasoning"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   272
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   273
method_setup best_dup =
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   274
  {* Method.no_args (Method.SIMPLE_METHOD' HEADGOAL (best_tac LK_dup_pack)) *}
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   275
  "classical reasoning"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   276
7118
ee384c7b7416 adding missing declarations for the <<...>> notation
paulson
parents: 7093
diff changeset
   277
21426
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   278
lemma mp_R:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   279
  assumes major: "$H |- $E, $F, P --> Q"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   280
    and minor: "$H |- $E, $F, P"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   281
  shows "$H |- $E, Q, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   282
  apply (rule thinRS [THEN cut], rule major)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   283
  apply (tactic "step_tac LK_pack 1")
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   284
  apply (rule thinR, rule minor)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   285
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   286
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   287
lemma mp_L:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   288
  assumes major: "$H, $G |- $E, P --> Q"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   289
    and minor: "$H, $G, Q |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   290
  shows "$H, P, $G |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   291
  apply (rule thinL [THEN cut], rule major)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   292
  apply (tactic "step_tac LK_pack 1")
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   293
  apply (rule thinL, rule minor)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   294
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   295
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   296
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   297
(** Two rules to generate left- and right- rules from implications **)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   298
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   299
lemma R_of_imp:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   300
  assumes major: "|- P --> Q"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   301
    and minor: "$H |- $E, $F, P"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   302
  shows "$H |- $E, Q, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   303
  apply (rule mp_R)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   304
   apply (rule_tac [2] minor)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   305
  apply (rule thinRS, rule major [THEN thinLS])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   306
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   307
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   308
lemma L_of_imp:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   309
  assumes major: "|- P --> Q"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   310
    and minor: "$H, $G, Q |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   311
  shows "$H, P, $G |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   312
  apply (rule mp_L)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   313
   apply (rule_tac [2] minor)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   314
  apply (rule thinRS, rule major [THEN thinLS])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   315
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   316
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   317
(*Can be used to create implications in a subgoal*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   318
lemma backwards_impR:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   319
  assumes prem: "$H, $G |- $E, $F, P --> Q"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   320
  shows "$H, P, $G |- $E, Q, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   321
  apply (rule mp_L)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   322
   apply (rule_tac [2] basic)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   323
  apply (rule thinR, rule prem)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   324
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   325
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   326
lemma conjunct1: "|-P&Q ==> |-P"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   327
  apply (erule thinR [THEN cut])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   328
  apply fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   329
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   330
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   331
lemma conjunct2: "|-P&Q ==> |-Q"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   332
  apply (erule thinR [THEN cut])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   333
  apply fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   334
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   335
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   336
lemma spec: "|- (ALL x. P(x)) ==> |- P(x)"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   337
  apply (erule thinR [THEN cut])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   338
  apply fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   339
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   340
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   341
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   342
(** Equality **)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   343
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   344
lemma sym: "|- a=b --> b=a"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   345
  by (tactic {* safe_tac (LK_pack add_safes [thm "subst"]) 1 *})
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   346
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   347
lemma trans: "|- a=b --> b=c --> a=c"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   348
  by (tactic {* safe_tac (LK_pack add_safes [thm "subst"]) 1 *})
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   349
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   350
(* Symmetry of equality in hypotheses *)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   351
lemmas symL = sym [THEN L_of_imp, standard]
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   352
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   353
(* Symmetry of equality in hypotheses *)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   354
lemmas symR = sym [THEN R_of_imp, standard]
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   355
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   356
lemma transR: "[| $H|- $E, $F, a=b;  $H|- $E, $F, b=c |] ==> $H|- $E, a=c, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   357
  by (rule trans [THEN R_of_imp, THEN mp_R])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   358
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   359
(* Two theorms for rewriting only one instance of a definition:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   360
   the first for definitions of formulae and the second for terms *)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   361
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   362
lemma def_imp_iff: "(A == B) ==> |- A <-> B"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   363
  apply unfold
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   364
  apply (rule iff_refl)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   365
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   366
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   367
lemma meta_eq_to_obj_eq: "(A == B) ==> |- A = B"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   368
  apply unfold
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   369
  apply (rule refl)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   370
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   371
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   372
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   373
(** if-then-else rules **)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   374
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   375
lemma if_True: "|- (if True then x else y) = x"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   376
  unfolding If_def by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   377
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   378
lemma if_False: "|- (if False then x else y) = y"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   379
  unfolding If_def by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   380
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   381
lemma if_P: "|- P ==> |- (if P then x else y) = x"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   382
  apply (unfold If_def)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   383
  apply (erule thinR [THEN cut])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   384
  apply fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   385
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   386
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   387
lemma if_not_P: "|- ~P ==> |- (if P then x else y) = y";
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   388
  apply (unfold If_def)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   389
  apply (erule thinR [THEN cut])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   390
  apply fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   391
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   392
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   393
end