src/HOLCF/Cont.thy
author huffman
Thu, 10 Mar 2005 20:22:45 +0100
changeset 15600 a59f07556a8d
parent 15588 14e3228f18cc
child 16053 603820cad083
permissions -rw-r--r--
fixed filename in header
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15600
a59f07556a8d fixed filename in header
huffman
parents: 15588
diff changeset
     1
(*  Title:      HOLCF/Cont.thy
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     2
    ID:         $Id$
1479
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
     3
    Author:     Franz Regensburger
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
     4
    License:    GPL (GNU GENERAL PUBLIC LICENSE)
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     5
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     6
    Results about continuity and monotonicity
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     7
*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     8
15577
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
     9
header {* Continuity and monotonicity *}
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    10
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    11
theory Cont
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    12
imports FunCpo
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    13
begin
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    14
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    15
text {*
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    16
   Now we change the default class! Form now on all untyped type variables are
3323
194ae2e0c193 eliminated the constant less by the introduction of the axclass sq_ord
slotosch
parents: 2838
diff changeset
    17
   of default class po
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    18
*}
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    19
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    20
defaultsort po
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    21
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    22
consts  
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    23
        monofun :: "('a => 'b) => bool"  -- "monotonicity"
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    24
        contlub :: "('a::cpo => 'b::cpo) => bool"  -- "first cont. def"
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    25
        cont    :: "('a::cpo => 'b::cpo) => bool"  -- "secnd cont. def"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    26
1168
74be52691d62 The curried version of HOLCF is now just called HOLCF. The old
regensbu
parents: 1150
diff changeset
    27
defs 
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    28
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    29
monofun:         "monofun(f) == ! x y. x << y --> f(x) << f(y)"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    30
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    31
contlub:         "contlub(f) == ! Y. chain(Y) --> 
3842
b55686a7b22c fixed dots;
wenzelm
parents: 3323
diff changeset
    32
                                f(lub(range(Y))) = lub(range(% i. f(Y(i))))"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    33
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    34
cont:            "cont(f)   == ! Y. chain(Y) --> 
3842
b55686a7b22c fixed dots;
wenzelm
parents: 3323
diff changeset
    35
                                range(% i. f(Y(i))) <<| f(lub(range(Y)))"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    36
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    37
text {*
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    38
  the main purpose of cont.thy is to show:
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    39
  @{prop "monofun(f) & contlub(f) == cont(f)"}
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    40
*}
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    41
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    42
text {* access to definition *}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    43
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    44
lemma contlubI:
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    45
        "! Y. chain(Y) --> f(lub(range(Y))) = lub(range(%i. f(Y(i))))==>
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    46
        contlub(f)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    47
by (unfold contlub)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    48
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    49
lemma contlubE: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    50
        " contlub(f)==> 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    51
          ! Y. chain(Y) --> f(lub(range(Y))) = lub(range(%i. f(Y(i))))"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    52
by (unfold contlub)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    53
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    54
lemma contI: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    55
 "! Y. chain(Y) --> range(% i. f(Y(i))) <<| f(lub(range(Y))) ==> cont(f)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    56
by (unfold cont)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    57
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    58
lemma contE: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    59
 "cont(f) ==> ! Y. chain(Y) --> range(% i. f(Y(i))) <<| f(lub(range(Y)))"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    60
by (unfold cont)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    61
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    62
lemma monofunI: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    63
        "! x y. x << y --> f(x) << f(y) ==> monofun(f)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    64
by (unfold monofun)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    65
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    66
lemma monofunE: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    67
        "monofun(f) ==> ! x y. x << y --> f(x) << f(y)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    68
by (unfold monofun)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    69
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    70
text {* monotone functions map chains to chains *}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    71
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    72
lemma ch2ch_monofun: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    73
        "[| monofun(f); chain(Y) |] ==> chain(%i. f(Y(i)))"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    74
apply (rule chainI)
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    75
apply (erule monofunE [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    76
apply (erule chainE)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    77
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    78
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    79
text {* monotone functions map upper bound to upper bounds *}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    80
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    81
lemma ub2ub_monofun: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    82
 "[| monofun(f); range(Y) <| u|]  ==> range(%i. f(Y(i))) <| f(u)"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    83
apply (rule ub_rangeI)
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    84
apply (erule monofunE [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    85
apply (erule ub_rangeD)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    86
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    87
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    88
text {* left to right: @{prop "monofun(f) & contlub(f) ==> cont(f)"} *}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    89
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    90
lemma monocontlub2cont: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    91
        "[|monofun(f);contlub(f)|] ==> cont(f)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    92
apply (rule contI [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    93
apply (rule thelubE)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    94
apply (erule ch2ch_monofun)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    95
apply assumption
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    96
apply (erule contlubE [rule_format, symmetric])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    97
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    98
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
    99
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   100
text {* first a lemma about binary chains *}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   101
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   102
lemma binchain_cont: "[| cont(f); x << y |]   
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   103
      ==> range(%i::nat. f(if i = 0 then x else y)) <<| f(y)"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   104
apply (rule subst)
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   105
prefer 2 apply (erule contE [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   106
apply (erule bin_chain)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   107
apply (rule_tac y = "y" in arg_cong)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   108
apply (erule lub_bin_chain [THEN thelubI])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   109
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   110
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   111
text {* right to left: @{prop "cont(f) ==> monofun(f) & contlub(f)"} *}
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   112
text {* part1: @{prop "cont(f) ==> monofun(f)"} *}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   113
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   114
lemma cont2mono: "cont(f) ==> monofun(f)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   115
apply (rule monofunI [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   116
apply (drule binchain_cont [THEN is_ub_lub])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   117
apply (auto split add: split_if_asm)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   118
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   119
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   120
text {* right to left: @{prop "cont(f) ==> monofun(f) & contlub(f)"} *}
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   121
text {* part2: @{prop "cont(f) ==> contlub(f)"} *}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   122
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   123
lemma cont2contlub: "cont(f) ==> contlub(f)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   124
apply (rule contlubI [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   125
apply (rule thelubI [symmetric])
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   126
apply (erule contE [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   127
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   128
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   129
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   130
text {* monotone functions map finite chains to finite chains *}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   131
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   132
lemma monofun_finch2finch: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   133
  "[| monofun f; finite_chain Y |] ==> finite_chain (%n. f (Y n))"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   134
apply (unfold finite_chain_def)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   135
apply (force elim!: ch2ch_monofun simp add: max_in_chain_def)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   136
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   137
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   138
text {* The same holds for continuous functions *}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   139
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   140
lemmas cont_finch2finch = cont2mono [THEN monofun_finch2finch, standard]
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   141
(* [| cont ?f; finite_chain ?Y |] ==> finite_chain (%n. ?f (?Y n)) *)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   142
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   143
text {*
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   144
  The following results are about a curried function that is monotone
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   145
  in both arguments
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   146
*}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   147
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   148
lemma ch2ch_MF2L: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   149
"[|monofun(MF2); chain(F)|] ==> chain(%i. MF2 (F i) x)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   150
by (erule ch2ch_monofun [THEN ch2ch_fun])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   151
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   152
lemma ch2ch_MF2R: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   153
"[|monofun(MF2(f)); chain(Y)|] ==> chain(%i. MF2 f (Y i))"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   154
by (erule ch2ch_monofun)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   155
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   156
lemma ch2ch_MF2LR: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   157
"[|monofun(MF2); !f. monofun(MF2(f)); chain(F); chain(Y)|] ==>  
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   158
   chain(%i. MF2(F(i))(Y(i)))"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   159
apply (rule chainI)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   160
apply (rule trans_less)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   161
apply (erule ch2ch_MF2L [THEN chainE])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   162
apply assumption
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   163
apply (rule monofunE [rule_format], erule spec)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   164
apply (erule chainE)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   165
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   166
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   167
lemma ch2ch_lubMF2R: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   168
"[|monofun(MF2::('a::po=>'b::po=>'c::cpo)); 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   169
   !f. monofun(MF2(f)::('b::po=>'c::cpo)); 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   170
        chain(F);chain(Y)|] ==>  
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   171
        chain(%j. lub(range(%i. MF2 (F j) (Y i))))"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   172
apply (rule lub_mono [THEN chainI])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   173
apply (rule ch2ch_MF2R, erule spec)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   174
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   175
apply (rule ch2ch_MF2R, erule spec)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   176
apply assumption
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   177
apply (rule allI)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   178
apply (rule chainE)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   179
apply (erule ch2ch_MF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   180
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   181
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   182
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   183
lemma ch2ch_lubMF2L: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   184
"[|monofun(MF2::('a::po=>'b::po=>'c::cpo)); 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   185
   !f. monofun(MF2(f)::('b::po=>'c::cpo)); 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   186
        chain(F);chain(Y)|] ==>  
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   187
        chain(%i. lub(range(%j. MF2 (F j) (Y i))))"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   188
apply (rule lub_mono [THEN chainI])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   189
apply (erule ch2ch_MF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   190
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   191
apply (erule ch2ch_MF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   192
apply assumption
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   193
apply (rule allI)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   194
apply (rule chainE)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   195
apply (rule ch2ch_MF2R, erule spec)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   196
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   197
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   198
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   199
lemma lub_MF2_mono: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   200
"[|monofun(MF2::('a::po=>'b::po=>'c::cpo)); 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   201
   !f. monofun(MF2(f)::('b::po=>'c::cpo)); 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   202
        chain(F)|] ==>  
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   203
        monofun(% x. lub(range(% j. MF2 (F j) (x))))"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   204
apply (rule monofunI [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   205
apply (rule lub_mono)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   206
apply (erule ch2ch_MF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   207
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   208
apply (erule ch2ch_MF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   209
apply assumption
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   210
apply (rule allI)
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   211
apply (rule monofunE [rule_format], erule spec)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   212
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   213
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   214
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   215
lemma ex_lubMF2: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   216
"[|monofun(MF2::('a::po=>'b::po=>'c::cpo)); 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   217
   !f. monofun(MF2(f)::('b::po=>'c::cpo)); 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   218
        chain(F); chain(Y)|] ==>  
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   219
                lub(range(%j. lub(range(%i. MF2(F j) (Y i))))) = 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   220
                lub(range(%i. lub(range(%j. MF2(F j) (Y i)))))"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   221
apply (rule antisym_less)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   222
apply (rule is_lub_thelub[OF _ ub_rangeI])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   223
apply (erule ch2ch_lubMF2R)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   224
apply (assumption+)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   225
apply (rule lub_mono)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   226
apply (rule ch2ch_MF2R, erule spec)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   227
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   228
apply (erule ch2ch_lubMF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   229
apply (assumption+)
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   230
apply (rule allI)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   231
apply (rule is_ub_thelub)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   232
apply (erule ch2ch_MF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   233
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   234
apply (rule is_lub_thelub[OF _ ub_rangeI])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   235
apply (erule ch2ch_lubMF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   236
apply (assumption+)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   237
apply (rule lub_mono)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   238
apply (erule ch2ch_MF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   239
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   240
apply (erule ch2ch_lubMF2R)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   241
apply (assumption+)
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   242
apply (rule allI)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   243
apply (rule is_ub_thelub)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   244
apply (rule ch2ch_MF2R, erule spec)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   245
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   246
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   247
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   248
lemma diag_lubMF2_1: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   249
"[|monofun(MF2::('a::po=>'b::po=>'c::cpo)); 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   250
   !f. monofun(MF2(f)::('b::po=>'c::cpo)); 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   251
   chain(FY);chain(TY)|] ==> 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   252
  lub(range(%i. lub(range(%j. MF2(FY(j))(TY(i)))))) = 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   253
  lub(range(%i. MF2(FY(i))(TY(i))))"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   254
apply (rule antisym_less)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   255
apply (rule is_lub_thelub[OF _ ub_rangeI])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   256
apply (erule ch2ch_lubMF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   257
apply (assumption+)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   258
apply (rule lub_mono3)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   259
apply (erule ch2ch_MF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   260
apply (assumption+)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   261
apply (erule ch2ch_MF2LR)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   262
apply (assumption+)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   263
apply (rule allI)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   264
apply (rule_tac m = "i" and n = "ia" in nat_less_cases)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   265
apply (rule_tac x = "ia" in exI)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   266
apply (rule chain_mono)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   267
apply (erule allE)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   268
apply (erule ch2ch_MF2R)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   269
apply (assumption+)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   270
apply (erule ssubst)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   271
apply (rule_tac x = "ia" in exI)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   272
apply (rule refl_less)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   273
apply (rule_tac x = "i" in exI)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   274
apply (rule chain_mono)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   275
apply (erule ch2ch_MF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   276
apply (assumption+)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   277
apply (rule lub_mono)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   278
apply (erule ch2ch_MF2LR)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   279
apply (assumption+)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   280
apply (erule ch2ch_lubMF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   281
apply (assumption+)
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   282
apply (rule allI)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   283
apply (rule is_ub_thelub)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   284
apply (erule ch2ch_MF2L)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   285
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   286
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   287
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   288
lemma diag_lubMF2_2: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   289
"[|monofun(MF2::('a::po=>'b::po=>'c::cpo)); 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   290
   !f. monofun(MF2(f)::('b::po=>'c::cpo)); 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   291
   chain(FY);chain(TY)|] ==> 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   292
  lub(range(%j. lub(range(%i. MF2(FY(j))(TY(i)))))) = 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   293
  lub(range(%i. MF2(FY(i))(TY(i))))"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   294
apply (rule trans)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   295
apply (rule ex_lubMF2)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   296
apply (assumption+)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   297
apply (erule diag_lubMF2_1)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   298
apply (assumption+)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   299
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   300
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   301
text {*
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   302
  The following results are about a curried function that is continuous
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   303
  in both arguments
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   304
*}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   305
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   306
lemma contlub_CF2:
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   307
assumes prem1: "cont(CF2)"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   308
assumes prem2: "!f. cont(CF2(f))"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   309
assumes prem3: "chain(FY)"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   310
assumes prem4: "chain(TY)"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   311
shows "CF2(lub(range(FY)))(lub(range(TY))) = lub(range(%i. CF2(FY(i))(TY(i))))"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   312
apply (subst prem1 [THEN cont2contlub, THEN contlubE, THEN spec, THEN mp])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   313
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   314
apply (subst thelub_fun)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   315
apply (rule prem1 [THEN cont2mono [THEN ch2ch_monofun]])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   316
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   317
apply (rule trans)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   318
apply (rule prem2 [THEN spec, THEN cont2contlub, THEN contlubE, THEN spec, THEN mp, THEN ext, THEN arg_cong, THEN arg_cong])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   319
apply (rule prem4)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   320
apply (rule diag_lubMF2_2)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   321
apply (auto simp add: cont2mono prems)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   322
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   323
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   324
text {*
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   325
  The following results are about application for functions in @{typ "'a=>'b"}
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   326
*}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   327
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   328
lemma monofun_fun_fun: "f1 << f2 ==> f1(x) << f2(x)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   329
by (erule less_fun [THEN iffD1, THEN spec])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   330
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   331
lemma monofun_fun_arg: "[|monofun(f); x1 << x2|] ==> f(x1) << f(x2)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   332
by (erule monofunE [THEN spec, THEN spec, THEN mp])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   333
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   334
lemma monofun_fun: "[|monofun(f1); monofun(f2); f1 << f2; x1 << x2|] ==> f1(x1) << f2(x2)"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   335
apply (rule trans_less)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   336
apply (erule monofun_fun_arg)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   337
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   338
apply (erule monofun_fun_fun)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   339
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   340
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   341
text {*
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   342
  The following results are about the propagation of monotonicity and
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   343
  continuity
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   344
*}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   345
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   346
lemma mono2mono_MF1L: "[|monofun(c1)|] ==> monofun(%x. c1 x y)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   347
apply (rule monofunI [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   348
apply (erule monofun_fun_arg [THEN monofun_fun_fun])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   349
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   350
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   351
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   352
lemma cont2cont_CF1L: "[|cont(c1)|] ==> cont(%x. c1 x y)"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   353
apply (rule monocontlub2cont)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   354
apply (erule cont2mono [THEN mono2mono_MF1L])
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   355
apply (rule contlubI [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   356
apply (frule asm_rl)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   357
apply (erule cont2contlub [THEN contlubE, THEN spec, THEN mp, THEN ssubst])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   358
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   359
apply (subst thelub_fun)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   360
apply (rule ch2ch_monofun)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   361
apply (erule cont2mono)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   362
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   363
apply (rule refl)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   364
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   365
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   366
(*********  Note "(%x.%y.c1 x y) = c1" ***********)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   367
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   368
lemma mono2mono_MF1L_rev: "!y. monofun(%x. c1 x y) ==> monofun(c1)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   369
apply (rule monofunI [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   370
apply (rule less_fun [THEN iffD2])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   371
apply (blast dest: monofunE)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   372
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   373
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   374
lemma cont2cont_CF1L_rev: "!y. cont(%x. c1 x y) ==> cont(c1)"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   375
apply (rule monocontlub2cont)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   376
apply (rule cont2mono [THEN allI, THEN mono2mono_MF1L_rev])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   377
apply (erule spec)
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   378
apply (rule contlubI [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   379
apply (rule ext)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   380
apply (subst thelub_fun)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   381
apply (rule cont2mono [THEN allI, THEN mono2mono_MF1L_rev, THEN ch2ch_monofun])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   382
apply (erule spec)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   383
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   384
apply (blast dest: cont2contlub [THEN contlubE])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   385
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   386
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   387
text {*
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   388
  What D.A.Schmidt calls continuity of abstraction
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   389
  never used here
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   390
*}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   391
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   392
lemma contlub_abstraction: 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   393
"[|chain(Y::nat=>'a);!y. cont(%x.(c::'a::cpo=>'b::cpo=>'c::cpo) x y)|] ==> 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   394
  (%y. lub(range(%i. c (Y i) y))) = (lub(range(%i.%y. c (Y i) y)))"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   395
apply (rule trans)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   396
prefer 2 apply (rule cont2contlub [THEN contlubE, THEN spec, THEN mp])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   397
prefer 2 apply (assumption)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   398
apply (erule cont2cont_CF1L_rev)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   399
apply (rule ext)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   400
apply (rule cont2contlub [THEN contlubE, THEN spec, THEN mp, symmetric])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   401
apply (erule spec)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   402
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   403
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   404
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   405
lemma mono2mono_app: "[|monofun(ft);!x. monofun(ft(x));monofun(tt)|] ==> 
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   406
         monofun(%x.(ft(x))(tt(x)))"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   407
apply (rule monofunI [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   408
apply (rule_tac ?f1.0 = "ft(x)" and ?f2.0 = "ft(y)" in monofun_fun)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   409
apply (erule spec)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   410
apply (erule spec)
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   411
apply (erule monofunE [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   412
apply assumption
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   413
apply (erule monofunE [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   414
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   415
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   416
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   417
lemma cont2contlub_app: "[|cont(ft);!x. cont(ft(x));cont(tt)|] ==> contlub(%x.(ft(x))(tt(x)))"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   418
apply (rule contlubI [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   419
apply (rule_tac f3 = "tt" in contlubE [THEN spec, THEN mp, THEN ssubst])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   420
apply (erule cont2contlub)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   421
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   422
apply (rule contlub_CF2)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   423
apply (assumption+)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   424
apply (erule cont2mono [THEN ch2ch_monofun])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   425
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   426
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   427
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   428
lemma cont2cont_app: "[|cont(ft); !x. cont(ft(x)); cont(tt)|] ==> cont(%x.(ft(x))(tt(x)))"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   429
apply (blast intro: monocontlub2cont mono2mono_app cont2mono cont2contlub_app)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   430
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   431
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   432
lemmas cont2cont_app2 = cont2cont_app[OF _ allI]
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   433
(*  [| cont ?ft; !!x. cont (?ft x); cont ?tt |] ==> *)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   434
(*        cont (%x. ?ft x (?tt x))                    *)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   435
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   436
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   437
text {* The identity function is continuous *}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   438
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   439
lemma cont_id: "cont(% x. x)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   440
apply (rule contI [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   441
apply (erule thelubE)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   442
apply (rule refl)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   443
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   444
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   445
text {* constant functions are continuous *}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   446
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   447
lemma cont_const: "cont(%x. c)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   448
apply (rule contI [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   449
apply (blast intro: is_lubI ub_rangeI dest: ub_rangeD)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   450
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   451
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   452
lemma cont2cont_app3: "[|cont(f); cont(t) |] ==> cont(%x. f(t(x)))"
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   453
by (best intro: cont2cont_app2 cont_const)
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   454
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   455
text {* A non-emptiness result for Cfun *}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   456
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   457
lemma CfunI: "?x:Collect cont"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   458
apply (rule CollectI)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   459
apply (rule cont_const)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   460
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   461
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   462
text {* some properties of flat *}
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   463
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   464
lemma flatdom2monofun: "f UU = UU ==> monofun (f::'a::flat=>'b::pcpo)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   465
apply (rule monofunI [rule_format])
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   466
apply (drule ax_flat [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   467
apply auto
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   468
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   469
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   470
declare range_composition [simp del]
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   471
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   472
lemma chfindom_monofun2cont: "monofun f ==> cont(f::'a::chfin=>'b::pcpo)"
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   473
apply (rule monocontlub2cont)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   474
apply assumption
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   475
apply (rule contlubI [rule_format])
15565
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   476
apply (frule chfin2finch)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   477
apply (rule antisym_less)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   478
apply (clarsimp simp add: finite_chain_def maxinch_is_thelub)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   479
apply (rule is_ub_thelub)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   480
apply (erule ch2ch_monofun)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   481
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   482
apply (drule monofun_finch2finch[COMP swap_prems_rl])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   483
apply assumption
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   484
apply (simp add: finite_chain_def)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   485
apply (erule conjE)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   486
apply (erule exE)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   487
apply (simp add: maxinch_is_thelub)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   488
apply (erule monofunE [THEN spec, THEN spec, THEN mp])
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   489
apply (erule is_ub_thelub)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   490
done
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   491
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   492
lemmas flatdom_strict2cont = flatdom2monofun [THEN chfindom_monofun2cont, standard]
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   493
(* f UU = UU ==> cont (f::'a=>'b::pcpo)" *)
2454493bd77b converted to new-style theory
huffman
parents: 14981
diff changeset
   494
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   495
end