src/HOLCF/lift3.ML
author paulson
Mon Dec 07 18:26:25 1998 +0100 (1998-12-07)
changeset 6019 0e55c2fb2ebb
parent 243 c22b85994e17
permissions -rw-r--r--
tidying
nipkow@243
     1
(*  Title: 	HOLCF/lift3.ML
nipkow@243
     2
    ID:         $Id$
nipkow@243
     3
    Author: 	Franz Regensburger
nipkow@243
     4
    Copyright   1993 Technische Universitaet Muenchen
nipkow@243
     5
nipkow@243
     6
Lemmas for lift3.thy
nipkow@243
     7
*)
nipkow@243
     8
nipkow@243
     9
open Lift3;
nipkow@243
    10
nipkow@243
    11
(* -------------------------------------------------------------------------*)
nipkow@243
    12
(* some lemmas restated for class pcpo                                      *)
nipkow@243
    13
(* ------------------------------------------------------------------------ *)
nipkow@243
    14
nipkow@243
    15
val less_lift3b = prove_goal Lift3.thy "~ Iup(x) << UU"
nipkow@243
    16
 (fn prems =>
nipkow@243
    17
	[
nipkow@243
    18
	(rtac (inst_lift_pcpo RS ssubst) 1),
nipkow@243
    19
	(rtac less_lift2b 1)
nipkow@243
    20
	]);
nipkow@243
    21
nipkow@243
    22
val defined_Iup2 = prove_goal Lift3.thy "~ Iup(x) = UU"
nipkow@243
    23
 (fn prems =>
nipkow@243
    24
	[
nipkow@243
    25
	(rtac (inst_lift_pcpo RS ssubst) 1),
nipkow@243
    26
	(rtac defined_Iup 1)
nipkow@243
    27
	]);
nipkow@243
    28
nipkow@243
    29
(* ------------------------------------------------------------------------ *)
nipkow@243
    30
(* continuity for Iup                                                       *)
nipkow@243
    31
(* ------------------------------------------------------------------------ *)
nipkow@243
    32
nipkow@243
    33
val contlub_Iup = prove_goal Lift3.thy "contlub(Iup)"
nipkow@243
    34
 (fn prems =>
nipkow@243
    35
	[
nipkow@243
    36
	(rtac contlubI 1),
nipkow@243
    37
	(strip_tac 1),
nipkow@243
    38
	(rtac trans 1),
nipkow@243
    39
	(rtac (thelub_lift1a RS sym) 2),
nipkow@243
    40
	(fast_tac HOL_cs 3),
nipkow@243
    41
	(etac (monofun_Iup RS ch2ch_monofun) 2),
nipkow@243
    42
	(res_inst_tac [("f","Iup")] arg_cong  1),
nipkow@243
    43
	(rtac lub_equal 1),
nipkow@243
    44
	(atac 1),
nipkow@243
    45
	(rtac (monofun_Ilift2 RS ch2ch_monofun) 1),
nipkow@243
    46
	(etac (monofun_Iup RS ch2ch_monofun) 1),
nipkow@243
    47
	(asm_simp_tac Lift_ss 1)
nipkow@243
    48
	]);
nipkow@243
    49
nipkow@243
    50
val contX_Iup = prove_goal Lift3.thy "contX(Iup)"
nipkow@243
    51
 (fn prems =>
nipkow@243
    52
	[
nipkow@243
    53
	(rtac monocontlub2contX 1),
nipkow@243
    54
	(rtac monofun_Iup 1),
nipkow@243
    55
	(rtac contlub_Iup 1)
nipkow@243
    56
	]);
nipkow@243
    57
nipkow@243
    58
nipkow@243
    59
(* ------------------------------------------------------------------------ *)
nipkow@243
    60
(* continuity for Ilift                                                     *)
nipkow@243
    61
(* ------------------------------------------------------------------------ *)
nipkow@243
    62
nipkow@243
    63
val contlub_Ilift1 = prove_goal Lift3.thy "contlub(Ilift)"
nipkow@243
    64
 (fn prems =>
nipkow@243
    65
	[
nipkow@243
    66
	(rtac contlubI 1),
nipkow@243
    67
	(strip_tac 1),
nipkow@243
    68
	(rtac trans 1),
nipkow@243
    69
	(rtac (thelub_fun RS sym) 2),
nipkow@243
    70
	(etac (monofun_Ilift1 RS ch2ch_monofun) 2),
nipkow@243
    71
	(rtac ext 1),
nipkow@243
    72
	(res_inst_tac [("p","x")] liftE 1),
nipkow@243
    73
	(asm_simp_tac Lift_ss 1),
nipkow@243
    74
	(rtac (lub_const RS thelubI RS sym) 1),
nipkow@243
    75
	(asm_simp_tac Lift_ss 1),
nipkow@243
    76
	(etac contlub_cfun_fun 1)
nipkow@243
    77
	]);
nipkow@243
    78
nipkow@243
    79
nipkow@243
    80
val contlub_Ilift2 = prove_goal Lift3.thy "contlub(Ilift(f))"
nipkow@243
    81
 (fn prems =>
nipkow@243
    82
	[
nipkow@243
    83
	(rtac contlubI 1),
nipkow@243
    84
	(strip_tac 1),
nipkow@243
    85
	(rtac disjE 1),
nipkow@243
    86
	(rtac (thelub_lift1a RS ssubst) 2),
nipkow@243
    87
	(atac 2),
nipkow@243
    88
	(atac 2),
nipkow@243
    89
	(asm_simp_tac Lift_ss 2),
nipkow@243
    90
	(rtac (thelub_lift1b RS ssubst) 3),
nipkow@243
    91
	(atac 3),
nipkow@243
    92
	(atac 3),
nipkow@243
    93
	(fast_tac HOL_cs 1),
nipkow@243
    94
	(asm_simp_tac Lift_ss 2),
nipkow@243
    95
	(rtac (chain_UU_I_inverse RS sym) 2),
nipkow@243
    96
	(rtac allI 2),
nipkow@243
    97
	(res_inst_tac [("p","Y(i)")] liftE 2),
nipkow@243
    98
	(asm_simp_tac Lift_ss 2),
nipkow@243
    99
	(rtac notE 2),
nipkow@243
   100
	(dtac spec 2),
nipkow@243
   101
	(etac spec 2),
nipkow@243
   102
	(atac 2),
nipkow@243
   103
	(rtac (contlub_cfun_arg RS ssubst) 1),
nipkow@243
   104
	(etac (monofun_Ilift2 RS ch2ch_monofun) 1),
nipkow@243
   105
	(rtac lub_equal2 1),
nipkow@243
   106
	(rtac (monofun_fapp2 RS ch2ch_monofun) 2),
nipkow@243
   107
	(etac (monofun_Ilift2 RS ch2ch_monofun) 2),
nipkow@243
   108
	(etac (monofun_Ilift2 RS ch2ch_monofun) 2),
nipkow@243
   109
	(rtac (chain_mono2 RS exE) 1),
nipkow@243
   110
	(atac 2),
nipkow@243
   111
	(etac exE 1),
nipkow@243
   112
	(etac exE 1),
nipkow@243
   113
	(rtac exI 1),
nipkow@243
   114
	(res_inst_tac [("s","Iup(x)"),("t","Y(i)")] ssubst 1),
nipkow@243
   115
	(atac 1),
nipkow@243
   116
	(rtac defined_Iup2 1),
nipkow@243
   117
	(rtac exI 1),
nipkow@243
   118
	(strip_tac 1),
nipkow@243
   119
	(res_inst_tac [("p","Y(i)")] liftE 1),
nipkow@243
   120
	(asm_simp_tac Lift_ss 2),
nipkow@243
   121
	(res_inst_tac [("P","Y(i) = UU")] notE 1),
nipkow@243
   122
	(fast_tac HOL_cs 1),
nipkow@243
   123
	(rtac (inst_lift_pcpo RS ssubst) 1),
nipkow@243
   124
	(atac 1)
nipkow@243
   125
	]);
nipkow@243
   126
nipkow@243
   127
val contX_Ilift1 = prove_goal Lift3.thy "contX(Ilift)"
nipkow@243
   128
 (fn prems =>
nipkow@243
   129
	[
nipkow@243
   130
	(rtac monocontlub2contX 1),
nipkow@243
   131
	(rtac monofun_Ilift1 1),
nipkow@243
   132
	(rtac contlub_Ilift1 1)
nipkow@243
   133
	]);
nipkow@243
   134
nipkow@243
   135
val contX_Ilift2 = prove_goal Lift3.thy "contX(Ilift(f))"
nipkow@243
   136
 (fn prems =>
nipkow@243
   137
	[
nipkow@243
   138
	(rtac monocontlub2contX 1),
nipkow@243
   139
	(rtac monofun_Ilift2 1),
nipkow@243
   140
	(rtac contlub_Ilift2 1)
nipkow@243
   141
	]);
nipkow@243
   142
nipkow@243
   143
nipkow@243
   144
(* ------------------------------------------------------------------------ *)
nipkow@243
   145
(* continuous versions of lemmas for ('a)u                                  *)
nipkow@243
   146
(* ------------------------------------------------------------------------ *)
nipkow@243
   147
nipkow@243
   148
val Exh_Lift1 = prove_goalw Lift3.thy [up_def] "z = UU | (? x. z = up[x])"
nipkow@243
   149
 (fn prems =>
nipkow@243
   150
	[
nipkow@243
   151
	(simp_tac (Lift_ss addsimps [contX_Iup]) 1),
nipkow@243
   152
	(rtac (inst_lift_pcpo RS ssubst) 1),
nipkow@243
   153
	(rtac Exh_Lift 1)
nipkow@243
   154
	]);
nipkow@243
   155
nipkow@243
   156
val inject_up = prove_goalw Lift3.thy [up_def] "up[x]=up[y] ==> x=y"
nipkow@243
   157
 (fn prems =>
nipkow@243
   158
	[
nipkow@243
   159
	(cut_facts_tac prems 1),
nipkow@243
   160
	(rtac inject_Iup 1),
nipkow@243
   161
	(etac box_equals 1),
nipkow@243
   162
	(simp_tac (Lift_ss addsimps [contX_Iup]) 1),
nipkow@243
   163
	(simp_tac (Lift_ss addsimps [contX_Iup]) 1)
nipkow@243
   164
	]);
nipkow@243
   165
nipkow@243
   166
val defined_up = prove_goalw Lift3.thy [up_def] "~ up[x]=UU"
nipkow@243
   167
 (fn prems =>
nipkow@243
   168
	[
nipkow@243
   169
	(simp_tac (Lift_ss addsimps [contX_Iup]) 1),
nipkow@243
   170
	(rtac defined_Iup2 1)
nipkow@243
   171
	]);
nipkow@243
   172
nipkow@243
   173
val liftE1 = prove_goalw Lift3.thy [up_def] 
nipkow@243
   174
	"[| p=UU ==> Q; !!x. p=up[x]==>Q|] ==>Q"
nipkow@243
   175
 (fn prems =>
nipkow@243
   176
	[
nipkow@243
   177
	(rtac liftE 1),
nipkow@243
   178
	(resolve_tac prems 1),
nipkow@243
   179
	(etac (inst_lift_pcpo RS ssubst) 1),
nipkow@243
   180
	(resolve_tac (tl prems) 1),
nipkow@243
   181
	(asm_simp_tac (Lift_ss addsimps [contX_Iup]) 1)
nipkow@243
   182
	]);
nipkow@243
   183
nipkow@243
   184
nipkow@243
   185
val lift1 = prove_goalw Lift3.thy [up_def,lift_def] "lift[f][UU]=UU"
nipkow@243
   186
 (fn prems =>
nipkow@243
   187
	[
nipkow@243
   188
	(rtac (inst_lift_pcpo RS ssubst) 1),
nipkow@243
   189
	(rtac (beta_cfun RS ssubst) 1),
nipkow@243
   190
	(REPEAT (resolve_tac (contX_lemmas @ [contX_Iup,contX_Ilift1,
nipkow@243
   191
		contX_Ilift2,contX2contX_CF1L]) 1)),
nipkow@243
   192
	(rtac (beta_cfun RS ssubst) 1),
nipkow@243
   193
	(REPEAT (resolve_tac (contX_lemmas @ [contX_Iup,contX_Ilift1,
nipkow@243
   194
		contX_Ilift2,contX2contX_CF1L]) 1)),
nipkow@243
   195
	(simp_tac (Lift_ss addsimps [contX_Iup,contX_Ilift1,contX_Ilift2]) 1)
nipkow@243
   196
	]);
nipkow@243
   197
nipkow@243
   198
val lift2 = prove_goalw Lift3.thy [up_def,lift_def] "lift[f][up[x]]=f[x]"
nipkow@243
   199
 (fn prems =>
nipkow@243
   200
	[
nipkow@243
   201
	(rtac (beta_cfun RS ssubst) 1),
nipkow@243
   202
	(rtac contX_Iup 1),
nipkow@243
   203
	(rtac (beta_cfun RS ssubst) 1),
nipkow@243
   204
	(REPEAT (resolve_tac (contX_lemmas @ [contX_Iup,contX_Ilift1,
nipkow@243
   205
		contX_Ilift2,contX2contX_CF1L]) 1)),
nipkow@243
   206
	(rtac (beta_cfun RS ssubst) 1),
nipkow@243
   207
	(rtac contX_Ilift2 1),
nipkow@243
   208
	(simp_tac (Lift_ss addsimps [contX_Iup,contX_Ilift1,contX_Ilift2]) 1)
nipkow@243
   209
	]);
nipkow@243
   210
nipkow@243
   211
val less_lift4b = prove_goalw Lift3.thy [up_def,lift_def] "~ up[x] << UU"
nipkow@243
   212
 (fn prems =>
nipkow@243
   213
	[
nipkow@243
   214
	(simp_tac (Lift_ss addsimps [contX_Iup]) 1),
nipkow@243
   215
	(rtac less_lift3b 1)
nipkow@243
   216
	]);
nipkow@243
   217
nipkow@243
   218
val less_lift4c = prove_goalw Lift3.thy [up_def,lift_def]
nipkow@243
   219
	 "(up[x]<<up[y]) = (x<<y)"
nipkow@243
   220
 (fn prems =>
nipkow@243
   221
	[
nipkow@243
   222
	(simp_tac (Lift_ss addsimps [contX_Iup]) 1),
nipkow@243
   223
	(rtac less_lift2c 1)
nipkow@243
   224
	]);
nipkow@243
   225
nipkow@243
   226
val thelub_lift2a = prove_goalw Lift3.thy [up_def,lift_def] 
nipkow@243
   227
"[| is_chain(Y); ? i x. Y(i) = up[x] |] ==>\
nipkow@243
   228
\      lub(range(Y)) = up[lub(range(%i. lift[LAM x. x][Y(i)]))]"
nipkow@243
   229
 (fn prems =>
nipkow@243
   230
	[
nipkow@243
   231
	(cut_facts_tac prems 1),
nipkow@243
   232
	(rtac (beta_cfun RS ssubst) 1),
nipkow@243
   233
	(REPEAT (resolve_tac (contX_lemmas @ [contX_Iup,contX_Ilift1,
nipkow@243
   234
		contX_Ilift2,contX2contX_CF1L]) 1)),
nipkow@243
   235
	(rtac (beta_cfun RS ssubst) 1),
nipkow@243
   236
	(REPEAT (resolve_tac (contX_lemmas @ [contX_Iup,contX_Ilift1,
nipkow@243
   237
		contX_Ilift2,contX2contX_CF1L]) 1)),
nipkow@243
   238
nipkow@243
   239
	(rtac (beta_cfun RS ext RS ssubst) 1),
nipkow@243
   240
	(REPEAT (resolve_tac (contX_lemmas @ [contX_Iup,contX_Ilift1,
nipkow@243
   241
		contX_Ilift2,contX2contX_CF1L]) 1)),
nipkow@243
   242
	(rtac thelub_lift1a 1),
nipkow@243
   243
	(atac 1),
nipkow@243
   244
	(etac exE 1),
nipkow@243
   245
	(etac exE 1),
nipkow@243
   246
	(rtac exI 1),
nipkow@243
   247
	(rtac exI 1),
nipkow@243
   248
	(etac box_equals 1),
nipkow@243
   249
	(rtac refl 1),
nipkow@243
   250
	(simp_tac (Lift_ss addsimps [contX_Iup]) 1)
nipkow@243
   251
	]);
nipkow@243
   252
nipkow@243
   253
nipkow@243
   254
nipkow@243
   255
val thelub_lift2b = prove_goalw Lift3.thy [up_def,lift_def] 
nipkow@243
   256
"[| is_chain(Y); ! i x. ~ Y(i) = up[x] |] ==> lub(range(Y)) = UU"
nipkow@243
   257
 (fn prems =>
nipkow@243
   258
	[
nipkow@243
   259
	(cut_facts_tac prems 1),
nipkow@243
   260
	(rtac (inst_lift_pcpo RS ssubst) 1),
nipkow@243
   261
	(rtac thelub_lift1b 1),
nipkow@243
   262
	(atac 1),
nipkow@243
   263
	(strip_tac 1),
nipkow@243
   264
	(dtac spec 1),
nipkow@243
   265
	(dtac spec 1),
nipkow@243
   266
	(rtac swap 1),
nipkow@243
   267
	(atac 1),
nipkow@243
   268
	(dtac notnotD 1),
nipkow@243
   269
	(etac box_equals 1),
nipkow@243
   270
	(rtac refl 1),
nipkow@243
   271
	(simp_tac (Lift_ss addsimps [contX_Iup]) 1)
nipkow@243
   272
	]);
nipkow@243
   273
nipkow@243
   274
nipkow@243
   275
val lift_lemma2 = prove_goal Lift3.thy  " (? x.z = up[x]) = (~z=UU)"
nipkow@243
   276
 (fn prems =>
nipkow@243
   277
	[
nipkow@243
   278
	(rtac iffI 1),
nipkow@243
   279
	(etac exE 1),
nipkow@243
   280
	(hyp_subst_tac 1),
nipkow@243
   281
	(rtac defined_up 1),
nipkow@243
   282
	(res_inst_tac [("p","z")] liftE1 1),
nipkow@243
   283
	(etac notE 1),
nipkow@243
   284
	(atac 1),
nipkow@243
   285
	(etac exI 1)
nipkow@243
   286
	]);
nipkow@243
   287
nipkow@243
   288
nipkow@243
   289
val thelub_lift2a_rev = prove_goal Lift3.thy  
nipkow@243
   290
"[| is_chain(Y); lub(range(Y)) = up[x] |] ==> ? i x. Y(i) = up[x]"
nipkow@243
   291
 (fn prems =>
nipkow@243
   292
	[
nipkow@243
   293
	(cut_facts_tac prems 1),
nipkow@243
   294
	(rtac exE 1),
nipkow@243
   295
	(rtac chain_UU_I_inverse2 1),
nipkow@243
   296
	(rtac (lift_lemma2 RS iffD1) 1),
nipkow@243
   297
	(etac exI 1),
nipkow@243
   298
	(rtac exI 1),
nipkow@243
   299
	(rtac (lift_lemma2 RS iffD2) 1),
nipkow@243
   300
	(atac 1)
nipkow@243
   301
	]);
nipkow@243
   302
nipkow@243
   303
val thelub_lift2b_rev = prove_goal Lift3.thy  
nipkow@243
   304
"[| is_chain(Y); lub(range(Y)) = UU |] ==> ! i x. ~ Y(i) = up[x]"
nipkow@243
   305
 (fn prems =>
nipkow@243
   306
	[
nipkow@243
   307
	(cut_facts_tac prems 1),
nipkow@243
   308
	(rtac allI 1),
nipkow@243
   309
	(rtac (notex2all RS iffD1) 1),
nipkow@243
   310
	(rtac contrapos 1),
nipkow@243
   311
	(etac (lift_lemma2 RS iffD1) 2),
nipkow@243
   312
	(rtac notnotI 1),
nipkow@243
   313
	(rtac (chain_UU_I RS spec) 1),
nipkow@243
   314
	(atac 1),
nipkow@243
   315
	(atac 1)
nipkow@243
   316
	]);
nipkow@243
   317
nipkow@243
   318
nipkow@243
   319
val thelub_lift3 = prove_goal Lift3.thy  
nipkow@243
   320
"is_chain(Y) ==> lub(range(Y)) = UU |\
nipkow@243
   321
\                lub(range(Y)) = up[lub(range(%i. lift[LAM x. x][Y(i)]))]"
nipkow@243
   322
 (fn prems =>
nipkow@243
   323
	[
nipkow@243
   324
	(cut_facts_tac prems 1),
nipkow@243
   325
	(rtac disjE 1),
nipkow@243
   326
	(rtac disjI1 2),
nipkow@243
   327
	(rtac thelub_lift2b 2),
nipkow@243
   328
	(atac 2),
nipkow@243
   329
	(atac 2),
nipkow@243
   330
	(rtac disjI2 2),
nipkow@243
   331
	(rtac thelub_lift2a 2),
nipkow@243
   332
	(atac 2),
nipkow@243
   333
	(atac 2),
nipkow@243
   334
	(fast_tac HOL_cs 1)
nipkow@243
   335
	]);
nipkow@243
   336
nipkow@243
   337
val lift3 = prove_goal Lift3.thy "lift[up][x]=x"
nipkow@243
   338
 (fn prems =>
nipkow@243
   339
	[
nipkow@243
   340
	(res_inst_tac [("p","x")] liftE1 1),
nipkow@243
   341
	(asm_simp_tac (Cfun_ss addsimps [lift1,lift2]) 1),
nipkow@243
   342
	(asm_simp_tac (Cfun_ss addsimps [lift1,lift2]) 1)
nipkow@243
   343
	]);
nipkow@243
   344
nipkow@243
   345
(* ------------------------------------------------------------------------ *)
nipkow@243
   346
(* install simplifier for ('a)u                                             *)
nipkow@243
   347
(* ------------------------------------------------------------------------ *)
nipkow@243
   348
nipkow@243
   349
val lift_rews = [lift1,lift2,defined_up];