src/HOLCF/pcpo.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/pcpo.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 pcpo.thy
nipkow@243
     7
*)
nipkow@243
     8
 
nipkow@243
     9
open Pcpo;
nipkow@243
    10
nipkow@243
    11
(* ------------------------------------------------------------------------ *)
nipkow@243
    12
(* in pcpo's everthing equal to THE lub has lub properties for every chain  *)
nipkow@243
    13
(* ------------------------------------------------------------------------ *)
nipkow@243
    14
nipkow@243
    15
val thelubE = prove_goal  Pcpo.thy 
nipkow@243
    16
	"[| is_chain(S);lub(range(S)) = l::'a::pcpo|] ==> range(S) <<| l "
nipkow@243
    17
(fn prems =>
nipkow@243
    18
	[
nipkow@243
    19
	(cut_facts_tac prems 1), 
nipkow@243
    20
	(hyp_subst_tac 1),
nipkow@243
    21
	(rtac lubI 1),
nipkow@243
    22
	(etac cpo 1)
nipkow@243
    23
	]);
nipkow@243
    24
nipkow@243
    25
(* ------------------------------------------------------------------------ *)
nipkow@243
    26
(* Properties of the lub                                                    *)
nipkow@243
    27
(* ------------------------------------------------------------------------ *)
nipkow@243
    28
nipkow@243
    29
nipkow@243
    30
val is_ub_thelub = (cpo RS lubI RS is_ub_lub);
nipkow@243
    31
(* is_chain(?S1) ==> ?S1(?x) << lub(range(?S1))                             *)
nipkow@243
    32
nipkow@243
    33
val is_lub_thelub = (cpo RS lubI RS is_lub_lub);
nipkow@243
    34
(* [| is_chain(?S5); range(?S5) <| ?x1 |] ==> lub(range(?S5)) << ?x1        *)
nipkow@243
    35
nipkow@243
    36
nipkow@243
    37
(* ------------------------------------------------------------------------ *)
nipkow@243
    38
(* the << relation between two chains is preserved by their lubs            *)
nipkow@243
    39
(* ------------------------------------------------------------------------ *)
nipkow@243
    40
nipkow@243
    41
val lub_mono = prove_goal Pcpo.thy 
nipkow@243
    42
	"[|is_chain(C1::(nat=>'a::pcpo));is_chain(C2); ! k. C1(k) << C2(k)|]\
nipkow@243
    43
\           ==> lub(range(C1)) << lub(range(C2))"
nipkow@243
    44
(fn prems =>
nipkow@243
    45
	[
nipkow@243
    46
	(cut_facts_tac prems 1),
nipkow@243
    47
	(etac is_lub_thelub 1),
nipkow@243
    48
	(rtac ub_rangeI 1),
nipkow@243
    49
	(rtac allI 1),
nipkow@243
    50
	(rtac trans_less 1),
nipkow@243
    51
	(etac spec 1),
nipkow@243
    52
	(etac is_ub_thelub 1)
nipkow@243
    53
	]);
nipkow@243
    54
nipkow@243
    55
(* ------------------------------------------------------------------------ *)
nipkow@243
    56
(* the = relation between two chains is preserved by their lubs            *)
nipkow@243
    57
(* ------------------------------------------------------------------------ *)
nipkow@243
    58
nipkow@243
    59
val lub_equal = prove_goal Pcpo.thy
nipkow@243
    60
"[| is_chain(C1::(nat=>'a::pcpo));is_chain(C2);!k.C1(k)=C2(k)|]\
nipkow@243
    61
\	==> lub(range(C1))=lub(range(C2))"
nipkow@243
    62
(fn prems =>
nipkow@243
    63
	[
nipkow@243
    64
	(cut_facts_tac prems 1),
nipkow@243
    65
	(rtac antisym_less 1),
nipkow@243
    66
	(rtac lub_mono 1),
nipkow@243
    67
	(atac 1),
nipkow@243
    68
	(atac 1),
nipkow@243
    69
	(strip_tac 1),
nipkow@243
    70
	(rtac (antisym_less_inverse RS conjunct1) 1),
nipkow@243
    71
	(etac spec 1),
nipkow@243
    72
	(rtac lub_mono 1),
nipkow@243
    73
	(atac 1),
nipkow@243
    74
	(atac 1),
nipkow@243
    75
	(strip_tac 1),
nipkow@243
    76
	(rtac (antisym_less_inverse RS conjunct2) 1),
nipkow@243
    77
	(etac spec 1)
nipkow@243
    78
	]);
nipkow@243
    79
nipkow@243
    80
(* ------------------------------------------------------------------------ *)
nipkow@243
    81
(* more results about mono and = of lubs of chains                          *)
nipkow@243
    82
(* ------------------------------------------------------------------------ *)
nipkow@243
    83
nipkow@243
    84
val lub_mono2 = prove_goal Pcpo.thy 
nipkow@243
    85
"[|? j.!i. j<i --> X(i::nat)=Y(i);is_chain(X::nat=>'a::pcpo);is_chain(Y)|]\
nipkow@243
    86
\ ==> lub(range(X))<<lub(range(Y))"
nipkow@243
    87
 (fn prems =>
nipkow@243
    88
	[
nipkow@243
    89
	(rtac  exE 1),
nipkow@243
    90
	(resolve_tac prems 1),
nipkow@243
    91
	(rtac is_lub_thelub 1),
nipkow@243
    92
	(resolve_tac prems 1),
nipkow@243
    93
	(rtac ub_rangeI 1),
nipkow@243
    94
	(strip_tac 1),
nipkow@243
    95
	(res_inst_tac [("Q","x<i")] classical2 1),
nipkow@243
    96
	(res_inst_tac [("s","Y(i)"),("t","X(i)")] subst 1),
nipkow@243
    97
	(rtac sym 1),
nipkow@243
    98
	(fast_tac HOL_cs 1),
nipkow@243
    99
	(rtac is_ub_thelub 1),
nipkow@243
   100
	(resolve_tac prems 1),
nipkow@243
   101
	(res_inst_tac [("y","X(Suc(x))")] trans_less 1),
nipkow@243
   102
	(rtac (chain_mono RS mp) 1),
nipkow@243
   103
	(resolve_tac prems 1),
nipkow@243
   104
	(rtac (not_less_eq RS subst) 1),
nipkow@243
   105
	(atac 1),
nipkow@243
   106
	(res_inst_tac [("s","Y(Suc(x))"),("t","X(Suc(x))")] subst 1),
nipkow@243
   107
	(rtac sym 1),
nipkow@243
   108
	(asm_simp_tac nat_ss 1),
nipkow@243
   109
	(rtac is_ub_thelub 1),
nipkow@243
   110
	(resolve_tac prems 1)
nipkow@243
   111
	]);
nipkow@243
   112
nipkow@243
   113
val lub_equal2 = prove_goal Pcpo.thy 
nipkow@243
   114
"[|? j.!i. j<i --> X(i)=Y(i);is_chain(X::nat=>'a::pcpo);is_chain(Y)|]\
nipkow@243
   115
\ ==> lub(range(X))=lub(range(Y))"
nipkow@243
   116
 (fn prems =>
nipkow@243
   117
	[
nipkow@243
   118
	(rtac antisym_less 1),
nipkow@243
   119
	(rtac lub_mono2 1),
nipkow@243
   120
	(REPEAT (resolve_tac prems 1)),
nipkow@243
   121
	(cut_facts_tac prems 1),
nipkow@243
   122
	(rtac lub_mono2 1),
nipkow@243
   123
	(safe_tac HOL_cs),
nipkow@243
   124
	(step_tac HOL_cs 1),
nipkow@243
   125
	(safe_tac HOL_cs),
nipkow@243
   126
	(rtac sym 1),
nipkow@243
   127
	(fast_tac HOL_cs 1)
nipkow@243
   128
	]);
nipkow@243
   129
nipkow@243
   130
val lub_mono3 = prove_goal Pcpo.thy "[|is_chain(Y::nat=>'a::pcpo);is_chain(X);\
nipkow@243
   131
\! i. ? j. Y(i)<< X(j)|]==> lub(range(Y))<<lub(range(X))"
nipkow@243
   132
 (fn prems =>
nipkow@243
   133
	[
nipkow@243
   134
	(cut_facts_tac prems 1),
nipkow@243
   135
	(rtac is_lub_thelub 1),
nipkow@243
   136
	(atac 1),
nipkow@243
   137
	(rtac ub_rangeI 1),
nipkow@243
   138
	(strip_tac 1),
nipkow@243
   139
	(etac allE 1),
nipkow@243
   140
	(etac exE 1),
nipkow@243
   141
	(rtac trans_less 1),
nipkow@243
   142
	(rtac is_ub_thelub 2),
nipkow@243
   143
	(atac 2),
nipkow@243
   144
	(atac 1)
nipkow@243
   145
	]);
nipkow@243
   146
nipkow@243
   147
(* ------------------------------------------------------------------------ *)
nipkow@243
   148
(* usefull lemmas about UU                                                  *)
nipkow@243
   149
(* ------------------------------------------------------------------------ *)
nipkow@243
   150
nipkow@243
   151
val eq_UU_iff = prove_goal Pcpo.thy "(x=UU)=(x<<UU)"
nipkow@243
   152
 (fn prems =>
nipkow@243
   153
	[
nipkow@243
   154
	(rtac iffI 1),
nipkow@243
   155
	(hyp_subst_tac 1),
nipkow@243
   156
	(rtac refl_less 1),
nipkow@243
   157
	(rtac antisym_less 1),
nipkow@243
   158
	(atac 1),
nipkow@243
   159
	(rtac minimal 1)
nipkow@243
   160
	]);
nipkow@243
   161
nipkow@243
   162
val UU_I = prove_goal Pcpo.thy "x << UU ==> x = UU"
nipkow@243
   163
 (fn prems =>
nipkow@243
   164
	[
nipkow@243
   165
	(rtac (eq_UU_iff RS ssubst) 1),
nipkow@243
   166
	(resolve_tac prems 1)
nipkow@243
   167
	]);
nipkow@243
   168
nipkow@243
   169
val not_less2not_eq = prove_goal Pcpo.thy "~x<<y ==> ~x=y"
nipkow@243
   170
 (fn prems =>
nipkow@243
   171
	[
nipkow@243
   172
	(cut_facts_tac prems 1),
nipkow@243
   173
	(rtac classical3 1),
nipkow@243
   174
	(atac 1),
nipkow@243
   175
	(hyp_subst_tac 1),
nipkow@243
   176
	(rtac refl_less 1)
nipkow@243
   177
	]);
nipkow@243
   178
nipkow@243
   179
nipkow@243
   180
val chain_UU_I = prove_goal Pcpo.thy
nipkow@243
   181
	"[|is_chain(Y);lub(range(Y))=UU|] ==> ! i.Y(i)=UU"
nipkow@243
   182
(fn prems =>
nipkow@243
   183
	[
nipkow@243
   184
	(cut_facts_tac prems 1),
nipkow@243
   185
	(rtac allI 1),
nipkow@243
   186
	(rtac antisym_less 1),
nipkow@243
   187
	(rtac minimal 2),
nipkow@243
   188
	(res_inst_tac [("t","UU")] subst 1),
nipkow@243
   189
	(atac 1),
nipkow@243
   190
	(etac is_ub_thelub 1)
nipkow@243
   191
	]);
nipkow@243
   192
nipkow@243
   193
nipkow@243
   194
val chain_UU_I_inverse = prove_goal Pcpo.thy 
nipkow@243
   195
	"!i.Y(i::nat)=UU ==> lub(range(Y::(nat=>'a::pcpo)))=UU"
nipkow@243
   196
(fn prems =>
nipkow@243
   197
	[
nipkow@243
   198
	(cut_facts_tac prems 1),
nipkow@243
   199
	(rtac lub_chain_maxelem 1),
nipkow@243
   200
	(rtac is_chainI 1),
nipkow@243
   201
	(rtac allI 1),
nipkow@243
   202
	(res_inst_tac [("s","UU"),("t","Y(i)")] subst 1),
nipkow@243
   203
	(rtac sym 1),
nipkow@243
   204
	(etac spec 1),
nipkow@243
   205
	(rtac minimal 1),
nipkow@243
   206
	(rtac exI 1),
nipkow@243
   207
	(etac spec 1),
nipkow@243
   208
	(rtac allI 1),
nipkow@243
   209
	(rtac (antisym_less_inverse RS conjunct1) 1),
nipkow@243
   210
	(etac spec 1)
nipkow@243
   211
	]);
nipkow@243
   212
nipkow@243
   213
val chain_UU_I_inverse2 = prove_goal Pcpo.thy 
nipkow@243
   214
	"~lub(range(Y::(nat=>'a::pcpo)))=UU ==> ? i.~ Y(i)=UU"
nipkow@243
   215
 (fn prems =>
nipkow@243
   216
	[
nipkow@243
   217
	(cut_facts_tac prems 1),
nipkow@243
   218
	(rtac (notall2ex RS iffD1) 1),
nipkow@243
   219
	(rtac swap 1),
nipkow@243
   220
	(rtac chain_UU_I_inverse 2),
nipkow@243
   221
	(etac notnotD 2),
nipkow@243
   222
	(atac 1)
nipkow@243
   223
	]);
nipkow@243
   224
nipkow@243
   225
nipkow@243
   226
val notUU_I = prove_goal Pcpo.thy "[| x<<y; ~x=UU |] ==> ~y=UU"
nipkow@243
   227
(fn prems =>
nipkow@243
   228
	[
nipkow@243
   229
	(cut_facts_tac prems 1),
nipkow@243
   230
	(etac contrapos 1),
nipkow@243
   231
	(rtac UU_I 1),
nipkow@243
   232
	(hyp_subst_tac 1),
nipkow@243
   233
	(atac 1)
nipkow@243
   234
	]);
nipkow@243
   235
nipkow@243
   236
nipkow@243
   237
val chain_mono2 = prove_goal Pcpo.thy 
nipkow@243
   238
"[|? j.~Y(j)=UU;is_chain(Y::nat=>'a::pcpo)|]\
nipkow@243
   239
\ ==> ? j.!i.j<i-->~Y(i)=UU"
nipkow@243
   240
 (fn prems =>
nipkow@243
   241
	[
nipkow@243
   242
	(cut_facts_tac prems 1),
nipkow@243
   243
	(safe_tac HOL_cs),
nipkow@243
   244
	(step_tac HOL_cs 1),
nipkow@243
   245
	(strip_tac 1),
nipkow@243
   246
	(rtac notUU_I 1),
nipkow@243
   247
	(atac 2),
nipkow@243
   248
	(etac (chain_mono RS mp) 1),
nipkow@243
   249
	(atac 1)
nipkow@243
   250
	]);
nipkow@243
   251
nipkow@243
   252
nipkow@243
   253
nipkow@243
   254
nipkow@243
   255
(* ------------------------------------------------------------------------ *)
nipkow@243
   256
(* uniqueness in void                                                       *)
nipkow@243
   257
(* ------------------------------------------------------------------------ *)
nipkow@243
   258
nipkow@243
   259
val unique_void2 = prove_goal Pcpo.thy "x::void=UU"
nipkow@243
   260
 (fn prems =>
nipkow@243
   261
	[
nipkow@243
   262
	(rtac (inst_void_pcpo RS ssubst) 1),
nipkow@243
   263
	(rtac (Rep_Void_inverse RS subst) 1),
nipkow@243
   264
	(rtac (Rep_Void_inverse RS subst) 1),
nipkow@243
   265
	(rtac arg_cong 1),
nipkow@243
   266
	(rtac box_equals 1),
nipkow@243
   267
	(rtac refl 1),
nipkow@243
   268
	(rtac (unique_void RS sym) 1),
nipkow@243
   269
	(rtac (unique_void RS sym) 1)
nipkow@243
   270
	]);
nipkow@243
   271
nipkow@243
   272