src/HOLCF/Cfun2.ML
author oheimb
Fri May 31 19:55:19 1996 +0200 (1996-05-31)
changeset 1779 1155c06fa956
parent 1461 6bcb44e4d6e5
child 1989 8e0ff1bfcfea
permissions -rw-r--r--
introduced forgotten bind_thm calls
clasohm@1461
     1
(*  Title:      HOLCF/cfun2.thy
nipkow@243
     2
    ID:         $Id$
clasohm@1461
     3
    Author:     Franz Regensburger
nipkow@243
     4
    Copyright   1993 Technische Universitaet Muenchen
nipkow@243
     5
nipkow@243
     6
Lemmas for cfun2.thy 
nipkow@243
     7
*)
nipkow@243
     8
nipkow@243
     9
open Cfun2;
nipkow@243
    10
nipkow@243
    11
(* ------------------------------------------------------------------------ *)
nipkow@243
    12
(* access to less_cfun in class po                                          *)
nipkow@243
    13
(* ------------------------------------------------------------------------ *)
nipkow@243
    14
clasohm@892
    15
qed_goal "less_cfun" Cfun2.thy "( f1 << f2 ) = (fapp(f1) << fapp(f2))"
nipkow@243
    16
(fn prems =>
clasohm@1461
    17
        [
clasohm@1461
    18
        (rtac (inst_cfun_po RS ssubst) 1),
clasohm@1461
    19
        (fold_goals_tac [less_cfun_def]),
clasohm@1461
    20
        (rtac refl 1)
clasohm@1461
    21
        ]);
nipkow@243
    22
nipkow@243
    23
(* ------------------------------------------------------------------------ *)
nipkow@243
    24
(* Type 'a ->'b  is pointed                                                 *)
nipkow@243
    25
(* ------------------------------------------------------------------------ *)
nipkow@243
    26
clasohm@892
    27
qed_goalw "minimal_cfun" Cfun2.thy [UU_cfun_def] "UU_cfun << f"
nipkow@243
    28
(fn prems =>
clasohm@1461
    29
        [
clasohm@1461
    30
        (rtac (less_cfun RS ssubst) 1),
clasohm@1461
    31
        (rtac (Abs_Cfun_inverse2 RS ssubst) 1),
clasohm@1461
    32
        (rtac cont_const 1),
clasohm@1461
    33
        (fold_goals_tac [UU_fun_def]),
clasohm@1461
    34
        (rtac minimal_fun 1)
clasohm@1461
    35
        ]);
nipkow@243
    36
nipkow@243
    37
(* ------------------------------------------------------------------------ *)
nipkow@243
    38
(* fapp yields continuous functions in 'a => 'b                             *)
nipkow@243
    39
(* this is continuity of fapp in its 'second' argument                      *)
regensbu@1168
    40
(* cont_fapp2 ==> monofun_fapp2 & contlub_fapp2                            *)
nipkow@243
    41
(* ------------------------------------------------------------------------ *)
nipkow@243
    42
regensbu@1168
    43
qed_goal "cont_fapp2" Cfun2.thy "cont(fapp(fo))"
nipkow@243
    44
(fn prems =>
clasohm@1461
    45
        [
clasohm@1461
    46
        (res_inst_tac [("P","cont")] CollectD 1),
clasohm@1461
    47
        (fold_goals_tac [Cfun_def]),
clasohm@1461
    48
        (rtac Rep_Cfun 1)
clasohm@1461
    49
        ]);
nipkow@243
    50
oheimb@1779
    51
bind_thm ("monofun_fapp2", cont_fapp2 RS cont2mono);
nipkow@243
    52
(* monofun(fapp(?fo1)) *)
nipkow@243
    53
nipkow@243
    54
oheimb@1779
    55
bind_thm ("contlub_fapp2", cont_fapp2 RS cont2contlub);
nipkow@243
    56
(* contlub(fapp(?fo1)) *)
nipkow@243
    57
nipkow@243
    58
(* ------------------------------------------------------------------------ *)
regensbu@1168
    59
(* expanded thms cont_fapp2, contlub_fapp2                                 *)
regensbu@1168
    60
(* looks nice with mixfix syntac                                            *)
nipkow@243
    61
(* ------------------------------------------------------------------------ *)
nipkow@243
    62
oheimb@1779
    63
bind_thm ("cont_cfun_arg", (cont_fapp2 RS contE RS spec RS mp));
regensbu@1168
    64
(* is_chain(?x1) ==> range (%i. ?fo3`(?x1 i)) <<| ?fo3`(lub (range ?x1))    *)
nipkow@243
    65
 
oheimb@1779
    66
bind_thm ("contlub_cfun_arg", (contlub_fapp2 RS contlubE RS spec RS mp));
regensbu@1168
    67
(* is_chain(?x1) ==> ?fo4`(lub (range ?x1)) = lub (range (%i. ?fo4`(?x1 i))) *)
nipkow@243
    68
nipkow@243
    69
nipkow@243
    70
(* ------------------------------------------------------------------------ *)
nipkow@243
    71
(* fapp is monotone in its 'first' argument                                 *)
nipkow@243
    72
(* ------------------------------------------------------------------------ *)
nipkow@243
    73
clasohm@892
    74
qed_goalw "monofun_fapp1" Cfun2.thy [monofun] "monofun(fapp)"
nipkow@243
    75
(fn prems =>
clasohm@1461
    76
        [
clasohm@1461
    77
        (strip_tac 1),
clasohm@1461
    78
        (etac (less_cfun RS subst) 1)
clasohm@1461
    79
        ]);
nipkow@243
    80
nipkow@243
    81
nipkow@243
    82
(* ------------------------------------------------------------------------ *)
nipkow@243
    83
(* monotonicity of application fapp in mixfix syntax [_]_                   *)
nipkow@243
    84
(* ------------------------------------------------------------------------ *)
nipkow@243
    85
regensbu@1168
    86
qed_goal "monofun_cfun_fun" Cfun2.thy  "f1 << f2 ==> f1`x << f2`x"
nipkow@243
    87
(fn prems =>
clasohm@1461
    88
        [
clasohm@1461
    89
        (cut_facts_tac prems 1),
clasohm@1461
    90
        (res_inst_tac [("x","x")] spec 1),
clasohm@1461
    91
        (rtac (less_fun RS subst) 1),
clasohm@1461
    92
        (etac (monofun_fapp1 RS monofunE RS spec RS spec RS mp) 1)
clasohm@1461
    93
        ]);
nipkow@243
    94
nipkow@243
    95
oheimb@1779
    96
bind_thm ("monofun_cfun_arg", monofun_fapp2 RS monofunE RS spec RS spec RS mp);
regensbu@1168
    97
(* ?x2 << ?x1 ==> ?fo5`?x2 << ?fo5`?x1                                      *)
nipkow@243
    98
nipkow@243
    99
(* ------------------------------------------------------------------------ *)
nipkow@243
   100
(* monotonicity of fapp in both arguments in mixfix syntax [_]_             *)
nipkow@243
   101
(* ------------------------------------------------------------------------ *)
nipkow@243
   102
clasohm@892
   103
qed_goal "monofun_cfun" Cfun2.thy
clasohm@1461
   104
        "[|f1<<f2;x1<<x2|] ==> f1`x1 << f2`x2"
nipkow@243
   105
(fn prems =>
clasohm@1461
   106
        [
clasohm@1461
   107
        (cut_facts_tac prems 1),
clasohm@1461
   108
        (rtac trans_less 1),
clasohm@1461
   109
        (etac monofun_cfun_arg 1),
clasohm@1461
   110
        (etac monofun_cfun_fun 1)
clasohm@1461
   111
        ]);
nipkow@243
   112
nipkow@243
   113
nipkow@243
   114
(* ------------------------------------------------------------------------ *)
nipkow@243
   115
(* ch2ch - rules for the type 'a -> 'b                                      *)
nipkow@243
   116
(* use MF2 lemmas from Cont.ML                                              *)
nipkow@243
   117
(* ------------------------------------------------------------------------ *)
nipkow@243
   118
clasohm@892
   119
qed_goal "ch2ch_fappR" Cfun2.thy 
regensbu@1168
   120
 "is_chain(Y) ==> is_chain(%i. f`(Y i))"
nipkow@243
   121
(fn prems =>
clasohm@1461
   122
        [
clasohm@1461
   123
        (cut_facts_tac prems 1),
clasohm@1461
   124
        (etac (monofun_fapp2 RS ch2ch_MF2R) 1)
clasohm@1461
   125
        ]);
nipkow@243
   126
nipkow@243
   127
oheimb@1779
   128
bind_thm ("ch2ch_fappL", monofun_fapp1 RS ch2ch_MF2L);
regensbu@1168
   129
(* is_chain(?F) ==> is_chain (%i. ?F i`?x)                                  *)
nipkow@243
   130
nipkow@243
   131
nipkow@243
   132
(* ------------------------------------------------------------------------ *)
nipkow@243
   133
(*  the lub of a chain of continous functions is monotone                   *)
nipkow@243
   134
(* use MF2 lemmas from Cont.ML                                              *)
nipkow@243
   135
(* ------------------------------------------------------------------------ *)
nipkow@243
   136
clasohm@892
   137
qed_goal "lub_cfun_mono" Cfun2.thy 
clasohm@1461
   138
        "is_chain(F) ==> monofun(% x.lub(range(% j.(F j)`x)))"
nipkow@243
   139
(fn prems =>
clasohm@1461
   140
        [
clasohm@1461
   141
        (cut_facts_tac prems 1),
clasohm@1461
   142
        (rtac lub_MF2_mono 1),
clasohm@1461
   143
        (rtac monofun_fapp1 1),
clasohm@1461
   144
        (rtac (monofun_fapp2 RS allI) 1),
clasohm@1461
   145
        (atac 1)
clasohm@1461
   146
        ]);
nipkow@243
   147
nipkow@243
   148
(* ------------------------------------------------------------------------ *)
nipkow@243
   149
(* a lemma about the exchange of lubs for type 'a -> 'b                     *)
nipkow@243
   150
(* use MF2 lemmas from Cont.ML                                              *)
nipkow@243
   151
(* ------------------------------------------------------------------------ *)
nipkow@243
   152
clasohm@892
   153
qed_goal "ex_lubcfun" Cfun2.thy
clasohm@1461
   154
        "[| is_chain(F); is_chain(Y) |] ==>\
clasohm@1461
   155
\               lub(range(%j. lub(range(%i. F(j)`(Y i))))) =\
clasohm@1461
   156
\               lub(range(%i. lub(range(%j. F(j)`(Y i)))))"
nipkow@243
   157
(fn prems =>
clasohm@1461
   158
        [
clasohm@1461
   159
        (cut_facts_tac prems 1),
clasohm@1461
   160
        (rtac ex_lubMF2 1),
clasohm@1461
   161
        (rtac monofun_fapp1 1),
clasohm@1461
   162
        (rtac (monofun_fapp2 RS allI) 1),
clasohm@1461
   163
        (atac 1),
clasohm@1461
   164
        (atac 1)
clasohm@1461
   165
        ]);
nipkow@243
   166
nipkow@243
   167
(* ------------------------------------------------------------------------ *)
nipkow@243
   168
(* the lub of a chain of cont. functions is continuous                      *)
nipkow@243
   169
(* ------------------------------------------------------------------------ *)
nipkow@243
   170
regensbu@1168
   171
qed_goal "cont_lubcfun" Cfun2.thy 
clasohm@1461
   172
        "is_chain(F) ==> cont(% x.lub(range(% j.F(j)`x)))"
nipkow@243
   173
(fn prems =>
clasohm@1461
   174
        [
clasohm@1461
   175
        (cut_facts_tac prems 1),
clasohm@1461
   176
        (rtac monocontlub2cont 1),
clasohm@1461
   177
        (etac lub_cfun_mono 1),
clasohm@1461
   178
        (rtac contlubI 1),
clasohm@1461
   179
        (strip_tac 1),
clasohm@1461
   180
        (rtac (contlub_cfun_arg RS ext RS ssubst) 1),
clasohm@1461
   181
        (atac 1),
clasohm@1461
   182
        (etac ex_lubcfun 1),
clasohm@1461
   183
        (atac 1)
clasohm@1461
   184
        ]);
nipkow@243
   185
nipkow@243
   186
(* ------------------------------------------------------------------------ *)
nipkow@243
   187
(* type 'a -> 'b is chain complete                                          *)
nipkow@243
   188
(* ------------------------------------------------------------------------ *)
nipkow@243
   189
clasohm@892
   190
qed_goal "lub_cfun" Cfun2.thy 
regensbu@1168
   191
  "is_chain(CCF) ==> range(CCF) <<| (LAM x.lub(range(% i.CCF(i)`x)))"
nipkow@243
   192
(fn prems =>
clasohm@1461
   193
        [
clasohm@1461
   194
        (cut_facts_tac prems 1),
clasohm@1461
   195
        (rtac is_lubI 1),
clasohm@1461
   196
        (rtac conjI 1),
clasohm@1461
   197
        (rtac ub_rangeI 1),  
clasohm@1461
   198
        (rtac allI 1),
clasohm@1461
   199
        (rtac (less_cfun RS ssubst) 1),
clasohm@1461
   200
        (rtac (Abs_Cfun_inverse2 RS ssubst) 1),
clasohm@1461
   201
        (etac cont_lubcfun 1),
clasohm@1461
   202
        (rtac (lub_fun RS is_lubE RS conjunct1 RS ub_rangeE RS spec) 1),
clasohm@1461
   203
        (etac (monofun_fapp1 RS ch2ch_monofun) 1),
clasohm@1461
   204
        (strip_tac 1),
clasohm@1461
   205
        (rtac (less_cfun RS ssubst) 1),
clasohm@1461
   206
        (rtac (Abs_Cfun_inverse2 RS ssubst) 1),
clasohm@1461
   207
        (etac cont_lubcfun 1),
clasohm@1461
   208
        (rtac (lub_fun RS is_lubE RS conjunct2 RS spec RS mp) 1),
clasohm@1461
   209
        (etac (monofun_fapp1 RS ch2ch_monofun) 1),
clasohm@1461
   210
        (etac (monofun_fapp1 RS ub2ub_monofun) 1)
clasohm@1461
   211
        ]);
nipkow@243
   212
oheimb@1779
   213
bind_thm ("thelub_cfun", lub_cfun RS thelubI);
nipkow@243
   214
(* 
regensbu@1168
   215
is_chain(?CCF1) ==>  lub (range ?CCF1) = (LAM x. lub (range (%i. ?CCF1 i`x)))
nipkow@243
   216
*)
nipkow@243
   217
clasohm@892
   218
qed_goal "cpo_cfun" Cfun2.thy 
nipkow@243
   219
  "is_chain(CCF::nat=>('a::pcpo->'b::pcpo)) ==> ? x. range(CCF) <<| x"
nipkow@243
   220
(fn prems =>
clasohm@1461
   221
        [
clasohm@1461
   222
        (cut_facts_tac prems 1),
clasohm@1461
   223
        (rtac exI 1),
clasohm@1461
   224
        (etac lub_cfun 1)
clasohm@1461
   225
        ]);
nipkow@243
   226
nipkow@243
   227
nipkow@243
   228
(* ------------------------------------------------------------------------ *)
nipkow@243
   229
(* Extensionality in 'a -> 'b                                               *)
nipkow@243
   230
(* ------------------------------------------------------------------------ *)
nipkow@243
   231
regensbu@1168
   232
qed_goal "ext_cfun" Cfun1.thy "(!!x. f`x = g`x) ==> f = g"
nipkow@243
   233
 (fn prems =>
clasohm@1461
   234
        [
clasohm@1461
   235
        (res_inst_tac [("t","f")] (Rep_Cfun_inverse RS subst) 1),
clasohm@1461
   236
        (res_inst_tac [("t","g")] (Rep_Cfun_inverse RS subst) 1),
clasohm@1461
   237
        (res_inst_tac [("f","fabs")] arg_cong 1),
clasohm@1461
   238
        (rtac ext 1),
clasohm@1461
   239
        (resolve_tac prems 1)
clasohm@1461
   240
        ]);
nipkow@243
   241
nipkow@243
   242
(* ------------------------------------------------------------------------ *)
nipkow@243
   243
(* Monotonicity of fabs                                                     *)
nipkow@243
   244
(* ------------------------------------------------------------------------ *)
nipkow@243
   245
clasohm@892
   246
qed_goal "semi_monofun_fabs" Cfun2.thy 
clasohm@1461
   247
        "[|cont(f);cont(g);f<<g|]==>fabs(f)<<fabs(g)"
nipkow@243
   248
 (fn prems =>
clasohm@1461
   249
        [
clasohm@1461
   250
        (rtac (less_cfun RS iffD2) 1),
clasohm@1461
   251
        (rtac (Abs_Cfun_inverse2 RS ssubst) 1),
clasohm@1461
   252
        (resolve_tac prems 1),
clasohm@1461
   253
        (rtac (Abs_Cfun_inverse2 RS ssubst) 1),
clasohm@1461
   254
        (resolve_tac prems 1),
clasohm@1461
   255
        (resolve_tac prems 1)
clasohm@1461
   256
        ]);
nipkow@243
   257
nipkow@243
   258
(* ------------------------------------------------------------------------ *)
nipkow@243
   259
(* Extenionality wrt. << in 'a -> 'b                                        *)
nipkow@243
   260
(* ------------------------------------------------------------------------ *)
nipkow@243
   261
regensbu@1168
   262
qed_goal "less_cfun2" Cfun2.thy "(!!x. f`x << g`x) ==> f << g"
nipkow@243
   263
 (fn prems =>
clasohm@1461
   264
        [
clasohm@1461
   265
        (res_inst_tac [("t","f")] (Rep_Cfun_inverse RS subst) 1),
clasohm@1461
   266
        (res_inst_tac [("t","g")] (Rep_Cfun_inverse RS subst) 1),
clasohm@1461
   267
        (rtac semi_monofun_fabs 1),
clasohm@1461
   268
        (rtac cont_fapp2 1),
clasohm@1461
   269
        (rtac cont_fapp2 1),
clasohm@1461
   270
        (rtac (less_fun RS iffD2) 1),
clasohm@1461
   271
        (rtac allI 1),
clasohm@1461
   272
        (resolve_tac prems 1)
clasohm@1461
   273
        ]);
nipkow@243
   274
nipkow@243
   275