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