src/Sequents/LK0.thy
author haftmann
Mon, 05 Jul 2010 15:12:20 +0200
changeset 37715 44b27ea94a16
parent 36452 d37c6eed8117
child 38499 8f0cd11238a7
permissions -rw-r--r--
tuned proof
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"
36452
d37c6eed8117 renamed command 'defaultsort' to 'default_sort';
wenzelm
parents: 35417
diff changeset
    18
default_sort "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
35355
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    46
notation (xsymbols)
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    47
  Not  ("\<not> _" [40] 40) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    48
  conj  (infixr "\<and>" 35) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    49
  disj  (infixr "\<or>" 30) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    50
  imp  (infixr "\<longrightarrow>" 25) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    51
  iff  (infixr "\<longleftrightarrow>" 25) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    52
  All  (binder "\<forall>" 10) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    53
  Ex  (binder "\<exists>" 10) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    54
  not_equal  (infixl "\<noteq>" 50)
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
    55
35355
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    56
notation (HTML output)
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    57
  Not  ("\<not> _" [40] 40) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    58
  conj  (infixr "\<and>" 35) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    59
  disj  (infixr "\<or>" 30) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    60
  All  (binder "\<forall>" 10) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    61
  Ex  (binder "\<exists>" 10) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 35113
diff changeset
    62
  not_equal  (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
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 35113
diff changeset
   125
definition If :: "[o, 'a, 'a] => 'a" ("(if (_)/ then (_)/ else (_))" 10) where 
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   126
   "If(P,x,y) == THE z::'a. (P --> z=x) & (~P --> z=y)"
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   127
21426
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   128
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   129
(** Structural Rules on formulas **)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   130
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   131
(*contraction*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   132
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   133
lemma contR: "$H |- $E, P, P, $F ==> $H |- $E, P, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   134
  by (rule contRS)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   135
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   136
lemma contL: "$H, P, P, $G |- $E ==> $H, P, $G |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   137
  by (rule contLS)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   138
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   139
(*thinning*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   140
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   141
lemma thinR: "$H |- $E, $F ==> $H |- $E, P, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   142
  by (rule thinRS)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   143
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   144
lemma thinL: "$H, $G |- $E ==> $H, P, $G |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   145
  by (rule thinLS)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   146
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   147
(*exchange*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   148
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   149
lemma exchR: "$H |- $E, Q, P, $F ==> $H |- $E, P, Q, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   150
  by (rule exchRS)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   151
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   152
lemma exchL: "$H, Q, P, $G |- $E ==> $H, P, Q, $G |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   153
  by (rule exchLS)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   154
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   155
ML {*
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   156
(*Cut and thin, replacing the right-side formula*)
27208
5fe899199f85 proper context for tactics derived from res_inst_tac;
wenzelm
parents: 27146
diff changeset
   157
fun cutR_tac ctxt s i =
27239
f2f42f9fa09d pervasive RuleInsts;
wenzelm
parents: 27208
diff changeset
   158
  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
   159
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   160
(*Cut and thin, replacing the left-side formula*)
27208
5fe899199f85 proper context for tactics derived from res_inst_tac;
wenzelm
parents: 27146
diff changeset
   161
fun cutL_tac ctxt s i =
27239
f2f42f9fa09d pervasive RuleInsts;
wenzelm
parents: 27208
diff changeset
   162
  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
   163
*}
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
(** If-and-only-if rules **)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   167
lemma iffR: 
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   168
    "[| $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
   169
  apply (unfold iff_def)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   170
  apply (assumption | rule conjR impR)+
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   171
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   172
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   173
lemma iffL: 
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   174
    "[| $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
   175
  apply (unfold iff_def)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   176
  apply (assumption | rule conjL impL basic)+
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   177
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   178
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   179
lemma iff_refl: "$H |- $E, (P <-> P), $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   180
  apply (rule iffR basic)+
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   181
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   182
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   183
lemma TrueR: "$H |- $E, True, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   184
  apply (unfold True_def)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   185
  apply (rule impR)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   186
  apply (rule basic)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   187
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   188
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   189
(*Descriptions*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   190
lemma the_equality:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   191
  assumes p1: "$H |- $E, P(a), $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   192
    and p2: "!!x. $H, P(x) |- $E, x=a, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   193
  shows "$H |- $E, (THE x. P(x)) = a, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   194
  apply (rule cut)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   195
   apply (rule_tac [2] p2)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   196
  apply (rule The, rule thinR, rule exchRS, rule p1)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   197
  apply (rule thinR, rule exchRS, rule p2)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   198
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   199
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   200
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   201
(** Weakened quantifier rules.  Incomplete, they let the search terminate.**)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   202
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   203
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
   204
  apply (rule allL)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   205
  apply (erule thinL)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   206
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   207
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   208
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
   209
  apply (rule exR)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   210
  apply (erule thinR)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   211
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   212
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   213
(*The rules of LK*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   214
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   215
ML {*
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   216
val prop_pack = empty_pack add_safes
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   217
                [thm "basic", thm "refl", thm "TrueR", thm "FalseL",
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   218
                 thm "conjL", thm "conjR", thm "disjL", thm "disjR", thm "impL", thm "impR",
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   219
                 thm "notL", thm "notR", thm "iffL", thm "iffR"];
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   220
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   221
val LK_pack = prop_pack add_safes   [thm "allR", thm "exL"]
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   222
                        add_unsafes [thm "allL_thin", thm "exR_thin", thm "the_equality"];
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   223
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   224
val LK_dup_pack = prop_pack add_safes   [thm "allR", thm "exL"]
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   225
                            add_unsafes [thm "allL", thm "exR", thm "the_equality"];
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   226
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   227
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   228
local
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   229
  val thinR = thm "thinR"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   230
  val thinL = thm "thinL"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   231
  val cut = thm "cut"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   232
in
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   233
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   234
fun lemma_tac th i =
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   235
    rtac (thinR RS cut) i THEN REPEAT (rtac thinL i) THEN rtac th i;
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   236
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   237
end;
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   238
*}
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   239
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   240
method_setup fast_prop =
30549
d2d7874648bd simplified method setup;
wenzelm
parents: 30510
diff changeset
   241
  {* Scan.succeed (K (SIMPLE_METHOD' (fast_tac prop_pack))) *}
21426
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   242
  "propositional reasoning"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   243
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   244
method_setup fast =
30549
d2d7874648bd simplified method setup;
wenzelm
parents: 30510
diff changeset
   245
  {* Scan.succeed (K (SIMPLE_METHOD' (fast_tac LK_pack))) *}
21426
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   246
  "classical reasoning"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   247
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   248
method_setup fast_dup =
30549
d2d7874648bd simplified method setup;
wenzelm
parents: 30510
diff changeset
   249
  {* Scan.succeed (K (SIMPLE_METHOD' (fast_tac LK_dup_pack))) *}
21426
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   250
  "classical reasoning"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   251
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   252
method_setup best =
30549
d2d7874648bd simplified method setup;
wenzelm
parents: 30510
diff changeset
   253
  {* Scan.succeed (K (SIMPLE_METHOD' (best_tac LK_pack))) *}
21426
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   254
  "classical reasoning"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   255
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   256
method_setup best_dup =
30549
d2d7874648bd simplified method setup;
wenzelm
parents: 30510
diff changeset
   257
  {* Scan.succeed (K (SIMPLE_METHOD' (best_tac LK_dup_pack))) *}
21426
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   258
  "classical reasoning"
7093
b2ee0e5d1a7f renamed theory LK to LK0
paulson
parents:
diff changeset
   259
7118
ee384c7b7416 adding missing declarations for the <<...>> notation
paulson
parents: 7093
diff changeset
   260
21426
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   261
lemma mp_R:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   262
  assumes major: "$H |- $E, $F, P --> Q"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   263
    and minor: "$H |- $E, $F, P"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   264
  shows "$H |- $E, Q, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   265
  apply (rule thinRS [THEN cut], rule major)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   266
  apply (tactic "step_tac LK_pack 1")
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   267
  apply (rule thinR, rule minor)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   268
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   269
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   270
lemma mp_L:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   271
  assumes major: "$H, $G |- $E, P --> Q"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   272
    and minor: "$H, $G, Q |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   273
  shows "$H, P, $G |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   274
  apply (rule thinL [THEN cut], rule major)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   275
  apply (tactic "step_tac LK_pack 1")
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   276
  apply (rule thinL, rule minor)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   277
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   278
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   279
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   280
(** Two rules to generate left- and right- rules from implications **)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   281
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   282
lemma R_of_imp:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   283
  assumes major: "|- P --> Q"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   284
    and minor: "$H |- $E, $F, P"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   285
  shows "$H |- $E, Q, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   286
  apply (rule mp_R)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   287
   apply (rule_tac [2] minor)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   288
  apply (rule thinRS, rule major [THEN thinLS])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   289
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   290
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   291
lemma L_of_imp:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   292
  assumes major: "|- P --> Q"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   293
    and minor: "$H, $G, Q |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   294
  shows "$H, P, $G |- $E"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   295
  apply (rule mp_L)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   296
   apply (rule_tac [2] minor)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   297
  apply (rule thinRS, rule major [THEN thinLS])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   298
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   299
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   300
(*Can be used to create implications in a subgoal*)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   301
lemma backwards_impR:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   302
  assumes prem: "$H, $G |- $E, $F, P --> Q"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   303
  shows "$H, P, $G |- $E, Q, $F"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   304
  apply (rule mp_L)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   305
   apply (rule_tac [2] basic)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   306
  apply (rule thinR, rule prem)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   307
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   308
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   309
lemma conjunct1: "|-P&Q ==> |-P"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   310
  apply (erule thinR [THEN cut])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   311
  apply fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   312
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   313
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   314
lemma conjunct2: "|-P&Q ==> |-Q"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   315
  apply (erule thinR [THEN cut])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   316
  apply fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   317
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   318
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   319
lemma spec: "|- (ALL x. P(x)) ==> |- P(x)"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   320
  apply (erule thinR [THEN cut])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   321
  apply fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   322
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   323
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   324
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   325
(** Equality **)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   326
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   327
lemma sym: "|- a=b --> b=a"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   328
  by (tactic {* safe_tac (LK_pack add_safes [thm "subst"]) 1 *})
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   329
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   330
lemma trans: "|- a=b --> b=c --> a=c"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   331
  by (tactic {* safe_tac (LK_pack add_safes [thm "subst"]) 1 *})
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   332
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   333
(* Symmetry of equality in hypotheses *)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   334
lemmas symL = sym [THEN L_of_imp, standard]
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   335
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   336
(* Symmetry of equality in hypotheses *)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   337
lemmas symR = sym [THEN R_of_imp, standard]
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   338
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   339
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
   340
  by (rule trans [THEN R_of_imp, THEN mp_R])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   341
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   342
(* Two theorms for rewriting only one instance of a definition:
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   343
   the first for definitions of formulae and the second for terms *)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   344
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   345
lemma def_imp_iff: "(A == B) ==> |- A <-> B"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   346
  apply unfold
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   347
  apply (rule iff_refl)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   348
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   349
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   350
lemma meta_eq_to_obj_eq: "(A == B) ==> |- A = B"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   351
  apply unfold
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   352
  apply (rule refl)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   353
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   354
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   355
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   356
(** if-then-else rules **)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   357
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   358
lemma if_True: "|- (if True then x else y) = x"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   359
  unfolding If_def by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   360
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   361
lemma if_False: "|- (if False then x else y) = y"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   362
  unfolding If_def by fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   363
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   364
lemma if_P: "|- P ==> |- (if P then x else y) = x"
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   365
  apply (unfold If_def)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   366
  apply (erule thinR [THEN cut])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   367
  apply fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   368
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   369
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   370
lemma if_not_P: "|- ~P ==> |- (if P then x else y) = y";
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   371
  apply (unfold If_def)
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   372
  apply (erule thinR [THEN cut])
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   373
  apply fast
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   374
  done
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   375
87ac12bed1ab converted legacy ML scripts;
wenzelm
parents: 17481
diff changeset
   376
end