src/HOLCF/Fun_Cpo.thy
author huffman
Wed, 13 Oct 2010 10:56:42 -0700
changeset 40011 b974cf829099
parent 40006 116e94f9543b
child 40089 8adc57fb8454
permissions -rw-r--r--
cleaned up Fun_Cpo.thy; deprecated a few theorem names
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40001
666c3751227c rename Ffun.thy to Fun_Cpo.thy
huffman
parents: 39302
diff changeset
     1
(*  Title:      HOLCF/Fun_Cpo.thy
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
     2
    Author:     Franz Regensburger
40001
666c3751227c rename Ffun.thy to Fun_Cpo.thy
huffman
parents: 39302
diff changeset
     3
    Author:     Brian Huffman
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
     4
*)
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
     5
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
     6
header {* Class instances for the full function space *}
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
     7
40001
666c3751227c rename Ffun.thy to Fun_Cpo.thy
huffman
parents: 39302
diff changeset
     8
theory Fun_Cpo
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
     9
imports Adm
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    10
begin
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    11
18291
4afdf02d9831 changed section names
huffman
parents: 18092
diff changeset
    12
subsection {* Full function space is a partial order *}
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    13
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    14
instantiation "fun"  :: (type, below) below
25758
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    15
begin
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    16
25758
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    17
definition
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    18
  below_fun_def: "(op \<sqsubseteq>) \<equiv> (\<lambda>f g. \<forall>x. f x \<sqsubseteq> g x)"
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    19
25758
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    20
instance ..
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    21
end
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    22
25758
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    23
instance "fun" :: (type, po) po
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    24
proof
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    25
  fix f :: "'a \<Rightarrow> 'b"
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    26
  show "f \<sqsubseteq> f"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    27
    by (simp add: below_fun_def)
25758
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    28
next
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    29
  fix f g :: "'a \<Rightarrow> 'b"
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    30
  assume "f \<sqsubseteq> g" and "g \<sqsubseteq> f" thus "f = g"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39199
diff changeset
    31
    by (simp add: below_fun_def fun_eq_iff below_antisym)
25758
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    32
next
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    33
  fix f g h :: "'a \<Rightarrow> 'b"
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    34
  assume "f \<sqsubseteq> g" and "g \<sqsubseteq> h" thus "f \<sqsubseteq> h"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    35
    unfolding below_fun_def by (fast elim: below_trans)
25758
89c7c22e64b4 update instance proofs to new style
huffman
parents: 20523
diff changeset
    36
qed
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    37
40002
c5b5f7a3a3b1 new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
huffman
parents: 40001
diff changeset
    38
lemma fun_below_iff: "f \<sqsubseteq> g \<longleftrightarrow> (\<forall>x. f x \<sqsubseteq> g x)"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    39
by (simp add: below_fun_def)
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    40
40002
c5b5f7a3a3b1 new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
huffman
parents: 40001
diff changeset
    41
lemma fun_belowI: "(\<And>x. f x \<sqsubseteq> g x) \<Longrightarrow> f \<sqsubseteq> g"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    42
by (simp add: below_fun_def)
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    43
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
    44
lemma fun_belowD: "f \<sqsubseteq> g \<Longrightarrow> f x \<sqsubseteq> g x"
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
    45
by (simp add: below_fun_def)
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
    46
18291
4afdf02d9831 changed section names
huffman
parents: 18092
diff changeset
    47
subsection {* Full function space is chain complete *}
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    48
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
    49
text {* Function application is monotone. *}
25786
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
    50
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
    51
lemma monofun_app: "monofun (\<lambda>f. f x)"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    52
by (rule monofunI, simp add: below_fun_def)
25786
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
    53
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
    54
text {* Properties of chains of functions. *}
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
    55
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
    56
lemma fun_chain_iff: "chain S \<longleftrightarrow> (\<forall>x. chain (\<lambda>i. S i x))"
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
    57
unfolding chain_def fun_below_iff by auto
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    58
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    59
lemma ch2ch_fun: "chain S \<Longrightarrow> chain (\<lambda>i. S i x)"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    60
by (simp add: chain_def below_fun_def)
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    61
18092
2c5d5da79a1e renamed and added ch2ch, cont2cont, mono2mono theorems ending in _fun, _lambda, _LAM
huffman
parents: 17831
diff changeset
    62
lemma ch2ch_lambda: "(\<And>x. chain (\<lambda>i. S i x)) \<Longrightarrow> chain S"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    63
by (simp add: chain_def below_fun_def)
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    64
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    65
text {* upper bounds of function chains yield upper bound in the po range *}
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    66
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    67
lemma ub2ub_fun:
26028
74668c3a8f70 add lemma is_lub_lambda
huffman
parents: 26025
diff changeset
    68
  "range S <| u \<Longrightarrow> range (\<lambda>i. S i x) <| u x"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    69
by (auto simp add: is_ub_def below_fun_def)
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    70
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    71
text {* Type @{typ "'a::type => 'b::cpo"} is chain complete *}
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    72
26028
74668c3a8f70 add lemma is_lub_lambda
huffman
parents: 26025
diff changeset
    73
lemma is_lub_lambda:
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
    74
  "(\<And>x. range (\<lambda>i. Y i x) <<| f x) \<Longrightarrow> range Y <<| f"
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
    75
unfolding is_lub_def is_ub_def below_fun_def by simp
26028
74668c3a8f70 add lemma is_lub_lambda
huffman
parents: 26025
diff changeset
    76
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    77
lemma lub_fun:
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    78
  "chain (S::nat \<Rightarrow> 'a::type \<Rightarrow> 'b::cpo)
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    79
    \<Longrightarrow> range S <<| (\<lambda>x. \<Squnion>i. S i x)"
26028
74668c3a8f70 add lemma is_lub_lambda
huffman
parents: 26025
diff changeset
    80
apply (rule is_lub_lambda)
74668c3a8f70 add lemma is_lub_lambda
huffman
parents: 26025
diff changeset
    81
apply (rule cpo_lubI)
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    82
apply (erule ch2ch_fun)
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    83
done
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    84
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    85
lemma thelub_fun:
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    86
  "chain (S::nat \<Rightarrow> 'a::type \<Rightarrow> 'b::cpo)
27413
3154f3765cc7 replace lub (range Y) with (LUB i. Y i)
huffman
parents: 26452
diff changeset
    87
    \<Longrightarrow> (\<Squnion>i. S i) = (\<lambda>x. \<Squnion>i. S i x)"
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    88
by (rule lub_fun [THEN thelubI])
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    89
20523
36a59e5d0039 Major update to function package, including new syntax and the (only theoretical)
krauss
parents: 18291
diff changeset
    90
instance "fun"  :: (type, cpo) cpo
40006
116e94f9543b remove unneeded lemmas from Fun_Cpo.thy
huffman
parents: 40004
diff changeset
    91
by intro_classes (rule exI, erule lub_fun)
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
    92
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
    93
subsection {* Chain-finiteness of function space *}
25827
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
    94
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
    95
lemma maxinch2maxinch_lambda:
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
    96
  "(\<And>x. max_in_chain n (\<lambda>i. S i x)) \<Longrightarrow> max_in_chain n S"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39199
diff changeset
    97
unfolding max_in_chain_def fun_eq_iff by simp
25827
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
    98
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
    99
lemma maxinch_mono:
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   100
  "\<lbrakk>max_in_chain i Y; i \<le> j\<rbrakk> \<Longrightarrow> max_in_chain j Y"
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   101
unfolding max_in_chain_def
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   102
proof (intro allI impI)
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   103
  fix k
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   104
  assume Y: "\<forall>n\<ge>i. Y i = Y n"
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   105
  assume ij: "i \<le> j"
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   106
  assume jk: "j \<le> k"
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   107
  from ij jk have ik: "i \<le> k" by simp
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   108
  from Y ij have Yij: "Y i = Y j" by simp
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   109
  from Y ik have Yik: "Y i = Y k" by simp
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   110
  from Yij Yik show "Y j = Y k" by auto
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   111
qed
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   112
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   113
instance "fun" :: (finite, chfin) chfin
25921
0ca392ab7f37 change class axiom chfin to rule_format
huffman
parents: 25906
diff changeset
   114
proof
25827
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   115
  fix Y :: "nat \<Rightarrow> 'a \<Rightarrow> 'b"
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   116
  let ?n = "\<lambda>x. LEAST n. max_in_chain n (\<lambda>i. Y i x)"
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   117
  assume "chain Y"
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   118
  hence "\<And>x. chain (\<lambda>i. Y i x)"
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   119
    by (rule ch2ch_fun)
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   120
  hence "\<And>x. \<exists>n. max_in_chain n (\<lambda>i. Y i x)"
25921
0ca392ab7f37 change class axiom chfin to rule_format
huffman
parents: 25906
diff changeset
   121
    by (rule chfin)
25827
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   122
  hence "\<And>x. max_in_chain (?n x) (\<lambda>i. Y i x)"
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   123
    by (rule LeastI_ex)
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   124
  hence "\<And>x. max_in_chain (Max (range ?n)) (\<lambda>i. Y i x)"
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   125
    by (rule maxinch_mono [OF _ Max_ge], simp_all)
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   126
  hence "max_in_chain (Max (range ?n)) Y"
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   127
    by (rule maxinch2maxinch_lambda)
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   128
  thus "\<exists>n. max_in_chain n Y" ..
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   129
qed
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25786
diff changeset
   130
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   131
instance "fun" :: (finite, finite_po) finite_po ..
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   132
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   133
instance "fun" :: (type, discrete_cpo) discrete_cpo
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   134
proof
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   135
  fix f g :: "'a \<Rightarrow> 'b"
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   136
  show "f \<sqsubseteq> g \<longleftrightarrow> f = g" 
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   137
    unfolding fun_below_iff fun_eq_iff
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   138
    by simp
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   139
qed
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   140
18291
4afdf02d9831 changed section names
huffman
parents: 18092
diff changeset
   141
subsection {* Full function space is pointed *}
17831
4a8c3f8b0a92 cleaned up; renamed less_fun to expand_fun_less
huffman
parents: 16202
diff changeset
   142
4a8c3f8b0a92 cleaned up; renamed less_fun to expand_fun_less
huffman
parents: 16202
diff changeset
   143
lemma minimal_fun: "(\<lambda>x. \<bottom>) \<sqsubseteq> f"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
   144
by (simp add: below_fun_def)
17831
4a8c3f8b0a92 cleaned up; renamed less_fun to expand_fun_less
huffman
parents: 16202
diff changeset
   145
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   146
instance "fun"  :: (type, pcpo) pcpo
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   147
by default (fast intro: minimal_fun)
17831
4a8c3f8b0a92 cleaned up; renamed less_fun to expand_fun_less
huffman
parents: 16202
diff changeset
   148
4a8c3f8b0a92 cleaned up; renamed less_fun to expand_fun_less
huffman
parents: 16202
diff changeset
   149
lemma inst_fun_pcpo: "\<bottom> = (\<lambda>x. \<bottom>)"
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
   150
by (rule minimal_fun [THEN UU_I, symmetric])
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
   151
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
   152
lemma app_strict [simp]: "\<bottom> x = \<bottom>"
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
   153
by (simp add: inst_fun_pcpo)
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
   154
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   155
lemma lambda_strict: "(\<lambda>x. \<bottom>) = \<bottom>"
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   156
by (rule UU_I, rule minimal_fun)
25786
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   157
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   158
subsection {* Propagation of monotonicity and continuity *}
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   159
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   160
text {* The lub of a chain of monotone functions is monotone. *}
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   161
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   162
lemma adm_monofun: "adm monofun"
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   163
by (rule admI, simp add: thelub_fun fun_chain_iff monofun_def lub_mono)
25786
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   164
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   165
text {* The lub of a chain of continuous functions is continuous. *}
25786
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   166
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   167
lemma adm_cont: "adm cont"
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   168
by (rule admI, simp add: thelub_fun fun_chain_iff)
25786
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   169
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   170
text {* Function application preserves monotonicity and continuity. *}
25786
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   171
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   172
lemma mono2mono_fun: "monofun f \<Longrightarrow> monofun (\<lambda>x. f x y)"
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   173
by (simp add: monofun_def fun_below_iff)
25786
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   174
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   175
lemma cont2cont_fun: "cont f \<Longrightarrow> cont (\<lambda>x. f x y)"
35914
91a7311177c4 remove contlub predicate
huffman
parents: 31076
diff changeset
   176
apply (rule contI2)
25786
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   177
apply (erule cont2mono [THEN mono2mono_fun])
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   178
apply (simp add: cont2contlubE thelub_fun ch2ch_cont)
25786
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   179
done
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   180
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   181
text {*
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   182
  Lambda abstraction preserves monotonicity and continuity.
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   183
  (Note @{text "(\<lambda>x. \<lambda>y. f x y) = f"}.)
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   184
*}
25786
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   185
26452
ed657432b8b9 declare cont_lemmas_ext as simp rules individually
huffman
parents: 26028
diff changeset
   186
lemma mono2mono_lambda:
ed657432b8b9 declare cont_lemmas_ext as simp rules individually
huffman
parents: 26028
diff changeset
   187
  assumes f: "\<And>y. monofun (\<lambda>x. f x y)" shows "monofun f"
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   188
using f by (simp add: monofun_def fun_below_iff)
25786
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   189
26452
ed657432b8b9 declare cont_lemmas_ext as simp rules individually
huffman
parents: 26028
diff changeset
   190
lemma cont2cont_lambda [simp]:
ed657432b8b9 declare cont_lemmas_ext as simp rules individually
huffman
parents: 26028
diff changeset
   191
  assumes f: "\<And>y. cont (\<lambda>x. f x y)" shows "cont f"
40011
b974cf829099 cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents: 40006
diff changeset
   192
by (rule contI, rule is_lub_lambda, rule contE [OF f])
25786
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   193
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   194
text {* What D.A.Schmidt calls continuity of abstraction; never used here *}
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   195
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   196
lemma contlub_lambda:
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   197
  "(\<And>x::'a::type. chain (\<lambda>i. S i x::'b::cpo))
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   198
    \<Longrightarrow> (\<lambda>x. \<Squnion>i. S i x) = (\<Squnion>i. (\<lambda>x. S i x))"
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   199
by (simp add: thelub_fun ch2ch_lambda)
6b3c79acac1f move lemmas from Cont.thy to Ffun.thy;
huffman
parents: 25758
diff changeset
   200
16202
61811f31ce5a renamed FunCpo theory to Ffun; added theorems ch2ch_fun_rev and app_strict
huffman
parents:
diff changeset
   201
end