src/LCF/LCF.thy
author wenzelm
Sat, 25 May 2013 17:40:44 +0200
changeset 52147 9943f8067f11
parent 48475 02dd825f5a4e
child 55380 4de48353034e
permissions -rw-r--r--
tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19757
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
     1
(*  Title:      LCF/LCF.thy
1474
3f7d67927fe2 expanded tabs
clasohm
parents: 649
diff changeset
     2
    Author:     Tobias Nipkow
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
    Copyright   1992  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
     6
header {* LCF on top of First-Order Logic *}
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
     8
theory LCF
48475
02dd825f5a4e more session ROOT files;
wenzelm
parents: 47025
diff changeset
     9
imports "~~/src/FOL/FOL"
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    10
begin
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    12
text {* This theory is based on Lawrence Paulson's book Logic and Computation. *}
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    14
subsection {* Natural Deduction Rules for LCF *}
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    15
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    16
classes cpo < "term"
36452
d37c6eed8117 renamed command 'defaultsort' to 'default_sort';
wenzelm
parents: 35762
diff changeset
    17
default_sort cpo
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    18
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    19
typedecl tr
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    20
typedecl void
41310
65631ca437c9 proper identifiers for consts and types;
wenzelm
parents: 36452
diff changeset
    21
typedecl ('a,'b) prod  (infixl "*" 6)
65631ca437c9 proper identifiers for consts and types;
wenzelm
parents: 36452
diff changeset
    22
typedecl ('a,'b) sum  (infixl "+" 5)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
283
76caebd18756 new type declaration syntax instead of numbers
lcp
parents: 0
diff changeset
    24
arities
27208
5fe899199f85 proper context for tactics derived from res_inst_tac;
wenzelm
parents: 22810
diff changeset
    25
  "fun" :: (cpo, cpo) cpo
41310
65631ca437c9 proper identifiers for consts and types;
wenzelm
parents: 36452
diff changeset
    26
  prod :: (cpo, cpo) cpo
65631ca437c9 proper identifiers for consts and types;
wenzelm
parents: 36452
diff changeset
    27
  sum :: (cpo, cpo) cpo
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    28
  tr :: cpo
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    29
  void :: cpo
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    30
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
consts
1474
3f7d67927fe2 expanded tabs
clasohm
parents: 649
diff changeset
    32
 UU     :: "'a"
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    33
 TT     :: "tr"
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    34
 FF     :: "tr"
1474
3f7d67927fe2 expanded tabs
clasohm
parents: 649
diff changeset
    35
 FIX    :: "('a => 'a) => 'a"
3f7d67927fe2 expanded tabs
clasohm
parents: 649
diff changeset
    36
 FST    :: "'a*'b => 'a"
3f7d67927fe2 expanded tabs
clasohm
parents: 649
diff changeset
    37
 SND    :: "'a*'b => 'b"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    38
 INL    :: "'a => 'a+'b"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    39
 INR    :: "'b => 'a+'b"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    40
 WHEN   :: "['a=>'c, 'b=>'c, 'a+'b] => 'c"
1474
3f7d67927fe2 expanded tabs
clasohm
parents: 649
diff changeset
    41
 adm    :: "('a => o) => o"
3f7d67927fe2 expanded tabs
clasohm
parents: 649
diff changeset
    42
 VOID   :: "void"               ("'(')")
3f7d67927fe2 expanded tabs
clasohm
parents: 649
diff changeset
    43
 PAIR   :: "['a,'b] => 'a*'b"   ("(1<_,/_>)" [0,0] 100)
3f7d67927fe2 expanded tabs
clasohm
parents: 649
diff changeset
    44
 COND   :: "[tr,'a,'a] => 'a"   ("(_ =>/ (_ |/ _))" [60,60,60] 60)
22810
a8455ca995d6 eliminated unnamed infixes;
wenzelm
parents: 19758
diff changeset
    45
 less   :: "['a,'a] => o"       (infixl "<<" 50)
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    46
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    47
axiomatization where
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
  (** DOMAIN THEORY **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    50
  eq_def:        "x=y == x << y & y << x" and
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    51
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    52
  less_trans:    "[| x << y; y << z |] ==> x << z" and
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    53
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    54
  less_ext:      "(ALL x. f(x) << g(x)) ==> f << g" and
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    55
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    56
  mono:          "[| f << g; x << y |] ==> f(x) << g(y)" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    57
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    58
  minimal:       "UU << x" and
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    59
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    60
  FIX_eq:        "\<And>f. f(FIX(f)) = FIX(f)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    61
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    62
axiomatization where
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    63
  (** TR **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    64
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    65
  tr_cases:      "p=UU | p=TT | p=FF" and
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    66
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    67
  not_TT_less_FF: "~ TT << FF" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    68
  not_FF_less_TT: "~ FF << TT" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    69
  not_TT_less_UU: "~ TT << UU" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    70
  not_FF_less_UU: "~ FF << UU" and
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    71
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    72
  COND_UU:       "UU => x | y  =  UU" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    73
  COND_TT:       "TT => x | y  =  x" and
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    74
  COND_FF:       "FF => x | y  =  y"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    75
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    76
axiomatization where
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    77
  (** PAIRS **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    78
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    79
  surj_pairing:  "<FST(z),SND(z)> = z" and
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    80
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    81
  FST:   "FST(<x,y>) = x" and
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    82
  SND:   "SND(<x,y>) = y"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    83
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    84
axiomatization where
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    85
  (*** STRICT SUM ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    86
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    87
  INL_DEF: "~x=UU ==> ~INL(x)=UU" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    88
  INR_DEF: "~x=UU ==> ~INR(x)=UU" and
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    89
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    90
  INL_STRICT: "INL(UU) = UU" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    91
  INR_STRICT: "INR(UU) = UU" and
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    92
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    93
  WHEN_UU:  "WHEN(f,g,UU) = UU" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    94
  WHEN_INL: "~x=UU ==> WHEN(f,g,INL(x)) = f(x)" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
    95
  WHEN_INR: "~x=UU ==> WHEN(f,g,INR(x)) = g(x)" and
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    96
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
    97
  SUM_EXHAUSTION:
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    98
    "z = UU | (EX x. ~x=UU & z = INL(x)) | (EX y. ~y=UU & z = INR(y))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    99
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
   100
axiomatization where
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   101
  (** VOID **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   102
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
   103
  void_cases:    "(x::void) = UU"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   104
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   105
  (** INDUCTION **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   106
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
   107
axiomatization where
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
   108
  induct:        "[| adm(P); P(UU); ALL x. P(x) --> P(f(x)) |] ==> P(FIX(f))"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   109
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
   110
axiomatization where
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   111
  (** Admissibility / Chain Completeness **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   112
  (* All rules can be found on pages 199--200 of Larry's LCF book.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   113
     Note that "easiness" of types is not taken into account
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   114
     because it cannot be expressed schematically; flatness could be. *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   115
47025
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
   116
  adm_less:      "\<And>t u. adm(%x. t(x) << u(x))" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
   117
  adm_not_less:  "\<And>t u. adm(%x.~ t(x) << u)" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
   118
  adm_not_free:  "\<And>A. adm(%x. A)" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
   119
  adm_subst:     "\<And>P t. adm(P) ==> adm(%x. P(t(x)))" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
   120
  adm_conj:      "\<And>P Q. [| adm(P); adm(Q) |] ==> adm(%x. P(x)&Q(x))" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
   121
  adm_disj:      "\<And>P Q. [| adm(P); adm(Q) |] ==> adm(%x. P(x)|Q(x))" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
   122
  adm_imp:       "\<And>P Q. [| adm(%x.~P(x)); adm(Q) |] ==> adm(%x. P(x)-->Q(x))" and
b2b8ae61d6ad modernized axiomatizations;
wenzelm
parents: 41310
diff changeset
   123
  adm_all:       "\<And>P. (!!y. adm(P(y))) ==> adm(%x. ALL y. P(y,x))"
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
   124
19757
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   125
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   126
lemma eq_imp_less1: "x = y ==> x << y"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   127
  by (simp add: eq_def)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   128
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   129
lemma eq_imp_less2: "x = y ==> y << x"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   130
  by (simp add: eq_def)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   131
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   132
lemma less_refl [simp]: "x << x"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   133
  apply (rule eq_imp_less1)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   134
  apply (rule refl)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   135
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   136
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   137
lemma less_anti_sym: "[| x << y; y << x |] ==> x=y"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   138
  by (simp add: eq_def)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   139
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   140
lemma ext: "(!!x::'a::cpo. f(x)=(g(x)::'b::cpo)) ==> (%x. f(x))=(%x. g(x))"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   141
  apply (rule less_anti_sym)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   142
  apply (rule less_ext)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   143
  apply simp
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   144
  apply simp
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   145
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   146
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   147
lemma cong: "[| f=g; x=y |] ==> f(x)=g(y)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   148
  by simp
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   149
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   150
lemma less_ap_term: "x << y ==> f(x) << f(y)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   151
  by (rule less_refl [THEN mono])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   152
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   153
lemma less_ap_thm: "f << g ==> f(x) << g(x)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   154
  by (rule less_refl [THEN [2] mono])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   155
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   156
lemma ap_term: "(x::'a::cpo) = y ==> (f(x)::'b::cpo) = f(y)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   157
  apply (rule cong [OF refl])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   158
  apply simp
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   159
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   160
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   161
lemma ap_thm: "f = g ==> f(x) = g(x)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   162
  apply (erule cong)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   163
  apply (rule refl)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   164
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   165
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   166
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   167
lemma UU_abs: "(%x::'a::cpo. UU) = UU"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   168
  apply (rule less_anti_sym)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   169
  prefer 2
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   170
  apply (rule minimal)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   171
  apply (rule less_ext)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   172
  apply (rule allI)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   173
  apply (rule minimal)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   174
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   175
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   176
lemma UU_app: "UU(x) = UU"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   177
  by (rule UU_abs [symmetric, THEN ap_thm])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   178
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   179
lemma less_UU: "x << UU ==> x=UU"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   180
  apply (rule less_anti_sym)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   181
  apply assumption
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   182
  apply (rule minimal)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   183
  done
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
   184
19757
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   185
lemma tr_induct: "[| P(UU); P(TT); P(FF) |] ==> ALL b. P(b)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   186
  apply (rule allI)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   187
  apply (rule mp)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   188
  apply (rule_tac [2] p = b in tr_cases)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   189
  apply blast
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   190
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   191
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   192
lemma Contrapos: "~ B ==> (A ==> B) ==> ~A"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   193
  by blast
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   194
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   195
lemma not_less_imp_not_eq1: "~ x << y \<Longrightarrow> x \<noteq> y"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   196
  apply (erule Contrapos)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   197
  apply simp
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   198
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   199
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   200
lemma not_less_imp_not_eq2: "~ y << x \<Longrightarrow> x \<noteq> y"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   201
  apply (erule Contrapos)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   202
  apply simp
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   203
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   204
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   205
lemma not_UU_eq_TT: "UU \<noteq> TT"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   206
  by (rule not_less_imp_not_eq2) (rule not_TT_less_UU)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   207
lemma not_UU_eq_FF: "UU \<noteq> FF"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   208
  by (rule not_less_imp_not_eq2) (rule not_FF_less_UU)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   209
lemma not_TT_eq_UU: "TT \<noteq> UU"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   210
  by (rule not_less_imp_not_eq1) (rule not_TT_less_UU)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   211
lemma not_TT_eq_FF: "TT \<noteq> FF"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   212
  by (rule not_less_imp_not_eq1) (rule not_TT_less_FF)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   213
lemma not_FF_eq_UU: "FF \<noteq> UU"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   214
  by (rule not_less_imp_not_eq1) (rule not_FF_less_UU)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   215
lemma not_FF_eq_TT: "FF \<noteq> TT"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   216
  by (rule not_less_imp_not_eq1) (rule not_FF_less_TT)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   217
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   218
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   219
lemma COND_cases_iff [rule_format]:
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   220
    "ALL b. P(b=>x|y) <-> (b=UU-->P(UU)) & (b=TT-->P(x)) & (b=FF-->P(y))"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   221
  apply (insert not_UU_eq_TT not_UU_eq_FF not_TT_eq_UU
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   222
    not_TT_eq_FF not_FF_eq_UU not_FF_eq_TT)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   223
  apply (rule tr_induct)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   224
  apply (simplesubst COND_UU)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   225
  apply blast
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   226
  apply (simplesubst COND_TT)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   227
  apply blast
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   228
  apply (simplesubst COND_FF)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   229
  apply blast
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   230
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   231
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   232
lemma COND_cases: 
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   233
  "[| x = UU --> P(UU); x = TT --> P(xa); x = FF --> P(y) |] ==> P(x => xa | y)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   234
  apply (rule COND_cases_iff [THEN iffD2])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   235
  apply blast
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   236
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   237
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   238
lemmas [simp] =
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   239
  minimal
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   240
  UU_app
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   241
  UU_app [THEN ap_thm]
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   242
  UU_app [THEN ap_thm, THEN ap_thm]
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   243
  not_TT_less_FF not_FF_less_TT not_TT_less_UU not_FF_less_UU not_UU_eq_TT
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   244
  not_UU_eq_FF not_TT_eq_UU not_TT_eq_FF not_FF_eq_UU not_FF_eq_TT
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   245
  COND_UU COND_TT COND_FF
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   246
  surj_pairing FST SND
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
   247
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
   248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
   249
subsection {* Ordered pairs and products *}
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
   250
19757
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   251
lemma expand_all_PROD: "(ALL p. P(p)) <-> (ALL x y. P(<x,y>))"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   252
  apply (rule iffI)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   253
  apply blast
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   254
  apply (rule allI)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   255
  apply (rule surj_pairing [THEN subst])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   256
  apply blast
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   257
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   258
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   259
lemma PROD_less: "(p::'a*'b) << q <-> FST(p) << FST(q) & SND(p) << SND(q)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   260
  apply (rule iffI)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   261
  apply (rule conjI)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   262
  apply (erule less_ap_term)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   263
  apply (erule less_ap_term)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   264
  apply (erule conjE)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   265
  apply (rule surj_pairing [of p, THEN subst])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   266
  apply (rule surj_pairing [of q, THEN subst])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   267
  apply (rule mono, erule less_ap_term, assumption)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   268
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   269
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   270
lemma PROD_eq: "p=q <-> FST(p)=FST(q) & SND(p)=SND(q)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   271
  apply (rule iffI)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   272
  apply simp
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   273
  apply (unfold eq_def)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   274
  apply (simp add: PROD_less)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   275
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   276
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   277
lemma PAIR_less [simp]: "<a,b> << <c,d> <-> a<<c & b<<d"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   278
  by (simp add: PROD_less)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   279
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   280
lemma PAIR_eq [simp]: "<a,b> = <c,d> <-> a=c & b=d"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   281
  by (simp add: PROD_eq)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   282
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   283
lemma UU_is_UU_UU [simp]: "<UU,UU> = UU"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   284
  by (rule less_UU) (simp add: PROD_less)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   285
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   286
lemma FST_STRICT [simp]: "FST(UU) = UU"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   287
  apply (rule subst [OF UU_is_UU_UU])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   288
  apply (simp del: UU_is_UU_UU)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   289
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   290
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   291
lemma SND_STRICT [simp]: "SND(UU) = UU"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   292
  apply (rule subst [OF UU_is_UU_UU])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   293
  apply (simp del: UU_is_UU_UU)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   294
  done
17248
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
   295
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
   296
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
   297
subsection {* Fixedpoint theory *}
81bf91654e73 converted to Isar theory format;
wenzelm
parents: 3837
diff changeset
   298
19757
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   299
lemma adm_eq: "adm(%x. t(x)=(u(x)::'a::cpo))"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   300
  apply (unfold eq_def)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   301
  apply (rule adm_conj adm_less)+
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   302
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   303
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   304
lemma adm_not_not: "adm(P) ==> adm(%x.~~P(x))"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   305
  by simp
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   306
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   307
lemma not_eq_TT: "ALL p. ~p=TT <-> (p=FF | p=UU)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   308
  and not_eq_FF: "ALL p. ~p=FF <-> (p=TT | p=UU)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   309
  and not_eq_UU: "ALL p. ~p=UU <-> (p=TT | p=FF)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   310
  by (rule tr_induct, simp_all)+
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   311
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   312
lemma adm_not_eq_tr: "ALL p::tr. adm(%x. ~t(x)=p)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   313
  apply (rule tr_induct)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   314
  apply (simp_all add: not_eq_TT not_eq_FF not_eq_UU)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   315
  apply (rule adm_disj adm_eq)+
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   316
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   317
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   318
lemmas adm_lemmas =
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   319
  adm_not_free adm_eq adm_less adm_not_less
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   320
  adm_not_eq_tr adm_conj adm_disj adm_imp adm_all
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   321
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   322
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   323
ML {*
27208
5fe899199f85 proper context for tactics derived from res_inst_tac;
wenzelm
parents: 22810
diff changeset
   324
  fun induct_tac ctxt v i =
27239
f2f42f9fa09d pervasive RuleInsts;
wenzelm
parents: 27208
diff changeset
   325
    res_inst_tac ctxt [(("f", 0), v)] @{thm induct} i THEN
22810
a8455ca995d6 eliminated unnamed infixes;
wenzelm
parents: 19758
diff changeset
   326
    REPEAT (resolve_tac @{thms adm_lemmas} i)
19757
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   327
*}
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   328
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   329
lemma least_FIX: "f(p) = p ==> FIX(f) << p"
27208
5fe899199f85 proper context for tactics derived from res_inst_tac;
wenzelm
parents: 22810
diff changeset
   330
  apply (tactic {* induct_tac @{context} "f" 1 *})
19757
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   331
  apply (rule minimal)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   332
  apply (intro strip)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   333
  apply (erule subst)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   334
  apply (erule less_ap_term)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   335
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   336
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   337
lemma lfp_is_FIX:
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   338
  assumes 1: "f(p) = p"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   339
    and 2: "ALL q. f(q)=q --> p << q"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   340
  shows "p = FIX(f)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   341
  apply (rule less_anti_sym)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   342
  apply (rule 2 [THEN spec, THEN mp])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   343
  apply (rule FIX_eq)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   344
  apply (rule least_FIX)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   345
  apply (rule 1)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   346
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   347
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   348
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   349
lemma FIX_pair: "<FIX(f),FIX(g)> = FIX(%p.<f(FST(p)),g(SND(p))>)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   350
  apply (rule lfp_is_FIX)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   351
  apply (simp add: FIX_eq [of f] FIX_eq [of g])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   352
  apply (intro strip)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   353
  apply (simp add: PROD_less)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   354
  apply (rule conjI)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   355
  apply (rule least_FIX)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   356
  apply (erule subst, rule FST [symmetric])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   357
  apply (rule least_FIX)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   358
  apply (erule subst, rule SND [symmetric])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   359
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   360
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   361
lemma FIX1: "FIX(f) = FST(FIX(%p. <f(FST(p)),g(SND(p))>))"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   362
  by (rule FIX_pair [unfolded PROD_eq FST SND, THEN conjunct1])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   363
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   364
lemma FIX2: "FIX(g) = SND(FIX(%p. <f(FST(p)),g(SND(p))>))"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   365
  by (rule FIX_pair [unfolded PROD_eq FST SND, THEN conjunct2])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   366
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   367
lemma induct2:
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   368
  assumes 1: "adm(%p. P(FST(p),SND(p)))"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   369
    and 2: "P(UU::'a,UU::'b)"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   370
    and 3: "ALL x y. P(x,y) --> P(f(x),g(y))"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   371
  shows "P(FIX(f),FIX(g))"
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   372
  apply (rule FIX1 [THEN ssubst, of _ f g])
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   373
  apply (rule FIX2 [THEN ssubst, of _ f g])
19758
wenzelm
parents: 19757
diff changeset
   374
  apply (rule induct [where ?f = "%x. <f(FST(x)),g(SND(x))>"])
wenzelm
parents: 19757
diff changeset
   375
  apply (rule 1)
19757
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   376
  apply simp
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   377
  apply (rule 2)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   378
  apply (simp add: expand_all_PROD)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   379
  apply (rule 3)
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   380
  done
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   381
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   382
ML {*
27208
5fe899199f85 proper context for tactics derived from res_inst_tac;
wenzelm
parents: 22810
diff changeset
   383
fun induct2_tac ctxt (f, g) i =
27239
f2f42f9fa09d pervasive RuleInsts;
wenzelm
parents: 27208
diff changeset
   384
  res_inst_tac ctxt [(("f", 0), f), (("g", 0), g)] @{thm induct2} i THEN
22810
a8455ca995d6 eliminated unnamed infixes;
wenzelm
parents: 19758
diff changeset
   385
  REPEAT(resolve_tac @{thms adm_lemmas} i)
19757
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   386
*}
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   387
4a2a71c31968 removed obsolete ML files;
wenzelm
parents: 17249
diff changeset
   388
end