author  wenzelm 
Tue, 05 Apr 2011 14:25:18 +0200  
changeset 42224  578a51fae383 
parent 42151  4da4fc77664b 
child 42264  b6c1b0c4c511 
permissions  rwrr 
42151  1 
(* Title: HOL/HOLCF/Cfun.thy 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

2 
Author: Franz Regensburger 
35794  3 
Author: Brian Huffman 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

4 
*) 
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

5 

efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

6 
header {* The type of continuous functions *} 
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

7 

15577  8 
theory Cfun 
40772  9 
imports Cpodef Fun_Cpo Product_Cpo 
15577  10 
begin 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

11 

36452  12 
default_sort cpo 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

13 

15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

14 
subsection {* Definition of continuous function type *} 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

15 

40327  16 
cpodef ('a, 'b) cfun (infixr ">" 0) = "{f::'a => 'b. cont f}" 
40011
b974cf829099
cleaned up Fun_Cpo.thy; deprecated a few theorem names
huffman
parents:
40008
diff
changeset

17 
by (auto intro: cont_const adm_cont) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

18 

35427  19 
type_notation (xsymbols) 
35525  20 
cfun ("(_ \<rightarrow>/ _)" [1, 0] 0) 
17816
9942c5ed866a
new syntax translations for continuous lambda abstraction
huffman
parents:
17815
diff
changeset

21 

25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
23152
diff
changeset

22 
notation 
40327  23 
Rep_cfun ("(_$/_)" [999,1000] 999) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

24 

25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
23152
diff
changeset

25 
notation (xsymbols) 
40327  26 
Rep_cfun ("(_\<cdot>/_)" [999,1000] 999) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

27 

25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
23152
diff
changeset

28 
notation (HTML output) 
40327  29 
Rep_cfun ("(_\<cdot>/_)" [999,1000] 999) 
17816
9942c5ed866a
new syntax translations for continuous lambda abstraction
huffman
parents:
17815
diff
changeset

30 

17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

31 
subsection {* Syntax for continuous lambda abstraction *} 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

32 

41479  33 
syntax "_cabs" :: "[logic, logic] \<Rightarrow> logic" 
18078
20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
huffman
parents:
18076
diff
changeset

34 

20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
huffman
parents:
18076
diff
changeset

35 
parse_translation {* 
40327  36 
(* rewrite (_cabs x t) => (Abs_cfun (%x. t)) *) 
37 
[mk_binder_tr (@{syntax_const "_cabs"}, @{const_syntax Abs_cfun})]; 

18078
20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
huffman
parents:
18076
diff
changeset

38 
*} 
17816
9942c5ed866a
new syntax translations for continuous lambda abstraction
huffman
parents:
17815
diff
changeset

39 

41478
18500bd1f47b
make print translation for Abs_cfun consistent with other binders: prevent etacontraction, but don't force etaexpansion
huffman
parents:
41430
diff
changeset

40 
print_translation {* 
18500bd1f47b
make print translation for Abs_cfun consistent with other binders: prevent etacontraction, but don't force etaexpansion
huffman
parents:
41430
diff
changeset

41 
[(@{const_syntax Abs_cfun}, fn [Abs abs] => 
18500bd1f47b
make print translation for Abs_cfun consistent with other binders: prevent etacontraction, but don't force etaexpansion
huffman
parents:
41430
diff
changeset

42 
let val (x, t) = atomic_abs_tr' abs 
18500bd1f47b
make print translation for Abs_cfun consistent with other binders: prevent etacontraction, but don't force etaexpansion
huffman
parents:
41430
diff
changeset

43 
in Syntax.const @{syntax_const "_cabs"} $ x $ t end)] 
18500bd1f47b
make print translation for Abs_cfun consistent with other binders: prevent etacontraction, but don't force etaexpansion
huffman
parents:
41430
diff
changeset

44 
*}  {* To avoid etacontraction of body *} 
17816
9942c5ed866a
new syntax translations for continuous lambda abstraction
huffman
parents:
17815
diff
changeset

45 

18087  46 
text {* Syntax for nested abstractions *} 
17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

47 

e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

48 
syntax 
41479  49 
"_Lambda" :: "[cargs, logic] \<Rightarrow> logic" ("(3LAM _./ _)" [1000, 10] 10) 
17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

50 

e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

51 
syntax (xsymbols) 
41479  52 
"_Lambda" :: "[cargs, logic] \<Rightarrow> logic" ("(3\<Lambda> _./ _)" [1000, 10] 10) 
17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

53 

17816
9942c5ed866a
new syntax translations for continuous lambda abstraction
huffman
parents:
17815
diff
changeset

54 
parse_ast_translation {* 
35115  55 
(* rewrite (LAM x y z. t) => (_cabs x (_cabs y (_cabs z t))) *) 
56 
(* cf. Syntax.lambda_ast_tr from src/Pure/Syntax/syn_trans.ML *) 

18078
20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
huffman
parents:
18076
diff
changeset

57 
let 
20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
huffman
parents:
18076
diff
changeset

58 
fun Lambda_ast_tr [pats, body] = 
42224
578a51fae383
discontinued special treatment of structure Ast: no pervasive content, no inclusion in structure Syntax;
wenzelm
parents:
42151
diff
changeset

59 
Ast.fold_ast_p @{syntax_const "_cabs"} 
578a51fae383
discontinued special treatment of structure Ast: no pervasive content, no inclusion in structure Syntax;
wenzelm
parents:
42151
diff
changeset

60 
(Ast.unfold_ast @{syntax_const "_cargs"} (Syntax.strip_positions_ast pats), body) 
578a51fae383
discontinued special treatment of structure Ast: no pervasive content, no inclusion in structure Syntax;
wenzelm
parents:
42151
diff
changeset

61 
 Lambda_ast_tr asts = raise Ast.AST ("Lambda_ast_tr", asts); 
35115  62 
in [(@{syntax_const "_Lambda"}, Lambda_ast_tr)] end; 
17816
9942c5ed866a
new syntax translations for continuous lambda abstraction
huffman
parents:
17815
diff
changeset

63 
*} 
9942c5ed866a
new syntax translations for continuous lambda abstraction
huffman
parents:
17815
diff
changeset

64 

9942c5ed866a
new syntax translations for continuous lambda abstraction
huffman
parents:
17815
diff
changeset

65 
print_ast_translation {* 
35115  66 
(* rewrite (_cabs x (_cabs y (_cabs z t))) => (LAM x y z. t) *) 
67 
(* cf. Syntax.abs_ast_tr' from src/Pure/Syntax/syn_trans.ML *) 

18078
20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
huffman
parents:
18076
diff
changeset

68 
let 
20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
huffman
parents:
18076
diff
changeset

69 
fun cabs_ast_tr' asts = 
42224
578a51fae383
discontinued special treatment of structure Ast: no pervasive content, no inclusion in structure Syntax;
wenzelm
parents:
42151
diff
changeset

70 
(case Ast.unfold_ast_p @{syntax_const "_cabs"} 
578a51fae383
discontinued special treatment of structure Ast: no pervasive content, no inclusion in structure Syntax;
wenzelm
parents:
42151
diff
changeset

71 
(Ast.Appl (Ast.Constant @{syntax_const "_cabs"} :: asts)) of 
578a51fae383
discontinued special treatment of structure Ast: no pervasive content, no inclusion in structure Syntax;
wenzelm
parents:
42151
diff
changeset

72 
([], _) => raise Ast.AST ("cabs_ast_tr'", asts) 
578a51fae383
discontinued special treatment of structure Ast: no pervasive content, no inclusion in structure Syntax;
wenzelm
parents:
42151
diff
changeset

73 
 (xs, body) => Ast.Appl 
578a51fae383
discontinued special treatment of structure Ast: no pervasive content, no inclusion in structure Syntax;
wenzelm
parents:
42151
diff
changeset

74 
[Ast.Constant @{syntax_const "_Lambda"}, 
578a51fae383
discontinued special treatment of structure Ast: no pervasive content, no inclusion in structure Syntax;
wenzelm
parents:
42151
diff
changeset

75 
Ast.fold_ast @{syntax_const "_cargs"} xs, body]); 
35115  76 
in [(@{syntax_const "_cabs"}, cabs_ast_tr')] end 
17816
9942c5ed866a
new syntax translations for continuous lambda abstraction
huffman
parents:
17815
diff
changeset

77 
*} 
15641  78 

18087  79 
text {* Dummy patterns for continuous abstraction *} 
18079  80 
translations 
40327  81 
"\<Lambda> _. t" => "CONST Abs_cfun (\<lambda> _. t)" 
18087  82 

17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

83 
subsection {* Continuous function space is pointed *} 
15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

84 

41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41400
diff
changeset

85 
lemma bottom_cfun: "\<bottom> \<in> cfun" 
40327  86 
by (simp add: cfun_def inst_fun_pcpo) 
16098  87 

35525  88 
instance cfun :: (cpo, discrete_cpo) discrete_cpo 
40327  89 
by intro_classes (simp add: below_cfun_def Rep_cfun_inject) 
26025  90 

35525  91 
instance cfun :: (cpo, pcpo) pcpo 
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41400
diff
changeset

92 
by (rule typedef_pcpo [OF type_definition_cfun below_cfun_def bottom_cfun]) 
16098  93 

40327  94 
lemmas Rep_cfun_strict = 
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41400
diff
changeset

95 
typedef_Rep_strict [OF type_definition_cfun below_cfun_def bottom_cfun] 
16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

96 

40327  97 
lemmas Abs_cfun_strict = 
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41400
diff
changeset

98 
typedef_Abs_strict [OF type_definition_cfun below_cfun_def bottom_cfun] 
16098  99 

17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

100 
text {* function application is strict in its first argument *} 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

101 

40327  102 
lemma Rep_cfun_strict1 [simp]: "\<bottom>\<cdot>x = \<bottom>" 
103 
by (simp add: Rep_cfun_strict) 

17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

104 

35641  105 
lemma LAM_strict [simp]: "(\<Lambda> x. \<bottom>) = \<bottom>" 
40327  106 
by (simp add: inst_fun_pcpo [symmetric] Abs_cfun_strict) 
35641  107 

17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

108 
text {* for compatibility with old HOLCFVersion *} 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

109 
lemma inst_cfun_pcpo: "\<bottom> = (\<Lambda> x. \<bottom>)" 
35641  110 
by simp 
17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

111 

e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

112 
subsection {* Basic properties of continuous functions *} 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

113 

e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

114 
text {* Betaequality for continuous functions *} 
16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

115 

40327  116 
lemma Abs_cfun_inverse2: "cont f \<Longrightarrow> Rep_cfun (Abs_cfun f) = f" 
117 
by (simp add: Abs_cfun_inverse cfun_def) 

16098  118 

37083
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

119 
lemma beta_cfun: "cont f \<Longrightarrow> (\<Lambda> x. f x)\<cdot>u = f u" 
40327  120 
by (simp add: Abs_cfun_inverse2) 
16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

121 

37083
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

122 
text {* Betareduction simproc *} 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

123 

03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

124 
text {* 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

125 
Given the term @{term "(\<Lambda> x. f x)\<cdot>y"}, the procedure tries to 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

126 
construct the theorem @{term "(\<Lambda> x. f x)\<cdot>y == f y"}. If this 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

127 
theorem cannot be completely solved by the cont2cont rules, then 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

128 
the procedure returns the ordinary conditional @{text beta_cfun} 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

129 
rule. 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

130 

03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

131 
The simproc does not solve any more goals that would be solved by 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

132 
using @{text beta_cfun} as a simp rule. The advantage of the 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

133 
simproc is that it can avoid deeplynested calls to the simplifier 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

134 
that would otherwise be caused by large continuity side conditions. 
41322
43a5b9a0ee8a
betareduction simproc uses lemma Abs_cfun_inverse2 instead of beta_cfun, to be more robust against etacontraction
huffman
parents:
41031
diff
changeset

135 

43a5b9a0ee8a
betareduction simproc uses lemma Abs_cfun_inverse2 instead of beta_cfun, to be more robust against etacontraction
huffman
parents:
41031
diff
changeset

136 
Update: The simproc now uses rule @{text Abs_cfun_inverse2} instead 
43a5b9a0ee8a
betareduction simproc uses lemma Abs_cfun_inverse2 instead of beta_cfun, to be more robust against etacontraction
huffman
parents:
41031
diff
changeset

137 
of @{text beta_cfun}, to avoid problems with etacontraction. 
37083
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

138 
*} 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

139 

41322
43a5b9a0ee8a
betareduction simproc uses lemma Abs_cfun_inverse2 instead of beta_cfun, to be more robust against etacontraction
huffman
parents:
41031
diff
changeset

140 
simproc_setup beta_cfun_proc ("Rep_cfun (Abs_cfun f)") = {* 
37083
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

141 
fn phi => fn ss => fn ct => 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

142 
let 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

143 
val dest = Thm.dest_comb; 
41322
43a5b9a0ee8a
betareduction simproc uses lemma Abs_cfun_inverse2 instead of beta_cfun, to be more robust against etacontraction
huffman
parents:
41031
diff
changeset

144 
val f = (snd o dest o snd o dest) ct; 
37083
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

145 
val [T, U] = Thm.dest_ctyp (ctyp_of_term f); 
41322
43a5b9a0ee8a
betareduction simproc uses lemma Abs_cfun_inverse2 instead of beta_cfun, to be more robust against etacontraction
huffman
parents:
41031
diff
changeset

146 
val tr = instantiate' [SOME T, SOME U] [SOME f] 
43a5b9a0ee8a
betareduction simproc uses lemma Abs_cfun_inverse2 instead of beta_cfun, to be more robust against etacontraction
huffman
parents:
41031
diff
changeset

147 
(mk_meta_eq @{thm Abs_cfun_inverse2}); 
37083
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

148 
val rules = Cont2ContData.get (Simplifier.the_context ss); 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

149 
val tac = SOLVED' (REPEAT_ALL_NEW (match_tac rules)); 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

150 
in SOME (perhaps (SINGLE (tac 1)) tr) end 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

151 
*} 
03a70ab79dd9
add beta_cfun simproc, which uses cont2cont rules
huffman
parents:
37079
diff
changeset

152 

16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

153 
text {* Etaequality for continuous functions *} 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

154 

36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

155 
lemma eta_cfun: "(\<Lambda> x. f\<cdot>x) = f" 
40327  156 
by (rule Rep_cfun_inverse) 
16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

157 

36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

158 
text {* Extensionality for continuous functions *} 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

159 

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

160 
lemma cfun_eq_iff: "f = g \<longleftrightarrow> (\<forall>x. f\<cdot>x = g\<cdot>x)" 
40327  161 
by (simp add: Rep_cfun_inject [symmetric] fun_eq_iff) 
17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

162 

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

163 
lemma cfun_eqI: "(\<And>x. f\<cdot>x = g\<cdot>x) \<Longrightarrow> f = g" 
c5b5f7a3a3b1
new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
huffman
parents:
40001
diff
changeset

164 
by (simp add: cfun_eq_iff) 
17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

165 

e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

166 
text {* Extensionality wrt. ordering for continuous functions *} 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

167 

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

168 
lemma cfun_below_iff: "f \<sqsubseteq> g \<longleftrightarrow> (\<forall>x. f\<cdot>x \<sqsubseteq> g\<cdot>x)" 
40327  169 
by (simp add: below_cfun_def fun_below_iff) 
17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

170 

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

171 
lemma cfun_belowI: "(\<And>x. f\<cdot>x \<sqsubseteq> g\<cdot>x) \<Longrightarrow> f \<sqsubseteq> g" 
c5b5f7a3a3b1
new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
huffman
parents:
40001
diff
changeset

172 
by (simp add: cfun_below_iff) 
17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

173 

e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

174 
text {* Congruence for continuous function application *} 
15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

175 

16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

176 
lemma cfun_cong: "\<lbrakk>f = g; x = y\<rbrakk> \<Longrightarrow> f\<cdot>x = g\<cdot>y" 
15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

177 
by simp 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

178 

16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

179 
lemma cfun_fun_cong: "f = g \<Longrightarrow> f\<cdot>x = g\<cdot>x" 
15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

180 
by simp 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

181 

16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

182 
lemma cfun_arg_cong: "x = y \<Longrightarrow> f\<cdot>x = f\<cdot>y" 
15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

183 
by simp 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

184 

16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

185 
subsection {* Continuity of application *} 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

186 

40327  187 
lemma cont_Rep_cfun1: "cont (\<lambda>f. f\<cdot>x)" 
40834
a1249aeff5b6
change cpodefgenerated cont_Rep rules to cont2cont format
huffman
parents:
40794
diff
changeset

188 
by (rule cont_Rep_cfun [OF cont_id, THEN cont2cont_fun]) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

189 

40327  190 
lemma cont_Rep_cfun2: "cont (\<lambda>x. f\<cdot>x)" 
191 
apply (cut_tac x=f in Rep_cfun) 

192 
apply (simp add: cfun_def) 

15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

193 
done 
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

194 

40327  195 
lemmas monofun_Rep_cfun = cont_Rep_cfun [THEN cont2mono] 
15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

196 

40327  197 
lemmas monofun_Rep_cfun1 = cont_Rep_cfun1 [THEN cont2mono, standard] 
198 
lemmas monofun_Rep_cfun2 = cont_Rep_cfun2 [THEN cont2mono, standard] 

16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

199 

40327  200 
text {* contlub, cont properties of @{term Rep_cfun} in each argument *} 
16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

201 

27413  202 
lemma contlub_cfun_arg: "chain Y \<Longrightarrow> f\<cdot>(\<Squnion>i. Y i) = (\<Squnion>i. f\<cdot>(Y i))" 
40327  203 
by (rule cont_Rep_cfun2 [THEN cont2contlubE]) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

204 

27413  205 
lemma contlub_cfun_fun: "chain F \<Longrightarrow> (\<Squnion>i. F i)\<cdot>x = (\<Squnion>i. F i\<cdot>x)" 
40327  206 
by (rule cont_Rep_cfun1 [THEN cont2contlubE]) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

207 

16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

208 
text {* monotonicity of application *} 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

209 

36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

210 
lemma monofun_cfun_fun: "f \<sqsubseteq> g \<Longrightarrow> f\<cdot>x \<sqsubseteq> g\<cdot>x" 
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

211 
by (simp add: cfun_below_iff) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

212 

16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

213 
lemma monofun_cfun_arg: "x \<sqsubseteq> y \<Longrightarrow> f\<cdot>x \<sqsubseteq> f\<cdot>y" 
40327  214 
by (rule monofun_Rep_cfun2 [THEN monofunE]) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

215 

16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

216 
lemma monofun_cfun: "\<lbrakk>f \<sqsubseteq> g; x \<sqsubseteq> y\<rbrakk> \<Longrightarrow> f\<cdot>x \<sqsubseteq> g\<cdot>y" 
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less>below in many lemma names
huffman
parents:
31041
diff
changeset

217 
by (rule below_trans [OF monofun_cfun_fun monofun_cfun_arg]) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

218 

16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

219 
text {* ch2ch  rules for the type @{typ "'a > 'b"} *} 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

220 

16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

221 
lemma chain_monofun: "chain Y \<Longrightarrow> chain (\<lambda>i. f\<cdot>(Y i))" 
40327  222 
by (erule monofun_Rep_cfun2 [THEN ch2ch_monofun]) 
16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

223 

40327  224 
lemma ch2ch_Rep_cfunR: "chain Y \<Longrightarrow> chain (\<lambda>i. f\<cdot>(Y i))" 
225 
by (rule monofun_Rep_cfun2 [THEN ch2ch_monofun]) 

15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

226 

40327  227 
lemma ch2ch_Rep_cfunL: "chain F \<Longrightarrow> chain (\<lambda>i. (F i)\<cdot>x)" 
228 
by (rule monofun_Rep_cfun1 [THEN ch2ch_monofun]) 

15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

229 

40327  230 
lemma ch2ch_Rep_cfun [simp]: 
18076  231 
"\<lbrakk>chain F; chain Y\<rbrakk> \<Longrightarrow> chain (\<lambda>i. (F i)\<cdot>(Y i))" 
25884  232 
by (simp add: chain_def monofun_cfun) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

233 

25884  234 
lemma ch2ch_LAM [simp]: 
235 
"\<lbrakk>\<And>x. chain (\<lambda>i. S i x); \<And>i. cont (\<lambda>x. S i x)\<rbrakk> \<Longrightarrow> chain (\<lambda>i. \<Lambda> x. S i x)" 

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

236 
by (simp add: chain_def cfun_below_iff) 
18092
2c5d5da79a1e
renamed and added ch2ch, cont2cont, mono2mono theorems ending in _fun, _lambda, _LAM
huffman
parents:
18091
diff
changeset

237 

40327  238 
text {* contlub, cont properties of @{term Rep_cfun} in both arguments *} 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

239 

41027  240 
lemma lub_APP: 
241 
"\<lbrakk>chain F; chain Y\<rbrakk> \<Longrightarrow> (\<Squnion>i. F i\<cdot>(Y i)) = (\<Squnion>i. F i)\<cdot>(\<Squnion>i. Y i)" 

18076  242 
by (simp add: contlub_cfun_fun contlub_cfun_arg diag_lub) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

243 

41027  244 
lemma lub_LAM: 
18092
2c5d5da79a1e
renamed and added ch2ch, cont2cont, mono2mono theorems ending in _fun, _lambda, _LAM
huffman
parents:
18091
diff
changeset

245 
"\<lbrakk>\<And>x. chain (\<lambda>i. F i x); \<And>i. cont (\<lambda>x. F i x)\<rbrakk> 
41027  246 
\<Longrightarrow> (\<Squnion>i. \<Lambda> x. F i x) = (\<Lambda> x. \<Squnion>i. F i x)" 
41322
43a5b9a0ee8a
betareduction simproc uses lemma Abs_cfun_inverse2 instead of beta_cfun, to be more robust against etacontraction
huffman
parents:
41031
diff
changeset

247 
by (simp add: lub_cfun lub_fun ch2ch_lambda) 
18092
2c5d5da79a1e
renamed and added ch2ch, cont2cont, mono2mono theorems ending in _fun, _lambda, _LAM
huffman
parents:
18091
diff
changeset

248 

41027  249 
lemmas lub_distribs = lub_APP lub_LAM 
25901  250 

16209
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

251 
text {* strictness *} 
36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

252 

36ee7f6af79f
removed dependencies on MF2 lemmas; removed some obsolete theorems; cleaned up many proofs; renamed less_cfun2 to less_cfun_ext
huffman
parents:
16098
diff
changeset

253 
lemma strictI: "f\<cdot>x = \<bottom> \<Longrightarrow> f\<cdot>\<bottom> = \<bottom>" 
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41400
diff
changeset

254 
apply (rule bottomI) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

255 
apply (erule subst) 
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

256 
apply (rule minimal [THEN monofun_cfun_arg]) 
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

257 
done 
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

258 

15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

259 
text {* type @{typ "'a > 'b"} is chain complete *} 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

260 

41031  261 
lemma lub_cfun: "chain F \<Longrightarrow> (\<Squnion>i. F i) = (\<Lambda> x. \<Squnion>i. F i\<cdot>x)" 
262 
by (simp add: lub_cfun lub_fun ch2ch_lambda) 

15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

263 

17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

264 
subsection {* Continuity simplification procedure *} 
15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

265 

40327  266 
text {* cont2cont lemma for @{term Rep_cfun} *} 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

267 

40326
73d45866dbda
renamed lemma cont2cont_Rep_CFun to cont2cont_APP
huffman
parents:
40093
diff
changeset

268 
lemma cont2cont_APP [simp, cont2cont]: 
29049  269 
assumes f: "cont (\<lambda>x. f x)" 
270 
assumes t: "cont (\<lambda>x. t x)" 

271 
shows "cont (\<lambda>x. (f x)\<cdot>(t x))" 

272 
proof  

40006  273 
have 1: "\<And>y. cont (\<lambda>x. (f x)\<cdot>y)" 
40327  274 
using cont_Rep_cfun1 f by (rule cont_compose) 
40006  275 
show "cont (\<lambda>x. (f x)\<cdot>(t x))" 
40327  276 
using t cont_Rep_cfun2 1 by (rule cont_apply) 
29049  277 
qed 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

278 

40008  279 
text {* 
280 
Two specific lemmas for the combination of LCF and HOL terms. 

281 
These lemmas are needed in theories that use types like @{typ "'a \<rightarrow> 'b \<Rightarrow> 'c"}. 

282 
*} 

283 

40326
73d45866dbda
renamed lemma cont2cont_Rep_CFun to cont2cont_APP
huffman
parents:
40093
diff
changeset

284 
lemma cont_APP_app [simp]: "\<lbrakk>cont f; cont g\<rbrakk> \<Longrightarrow> cont (\<lambda>x. ((f x)\<cdot>(g x)) s)" 
73d45866dbda
renamed lemma cont2cont_Rep_CFun to cont2cont_APP
huffman
parents:
40093
diff
changeset

285 
by (rule cont2cont_APP [THEN cont2cont_fun]) 
40008  286 

40326
73d45866dbda
renamed lemma cont2cont_Rep_CFun to cont2cont_APP
huffman
parents:
40093
diff
changeset

287 
lemma cont_APP_app_app [simp]: "\<lbrakk>cont f; cont g\<rbrakk> \<Longrightarrow> cont (\<lambda>x. ((f x)\<cdot>(g x)) s t)" 
73d45866dbda
renamed lemma cont2cont_Rep_CFun to cont2cont_APP
huffman
parents:
40093
diff
changeset

288 
by (rule cont_APP_app [THEN cont2cont_fun]) 
40008  289 

290 

15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

291 
text {* cont2mono Lemma for @{term "%x. LAM y. c1(x)(y)"} *} 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

292 

efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

293 
lemma cont2mono_LAM: 
29049  294 
"\<lbrakk>\<And>x. cont (\<lambda>y. f x y); \<And>y. monofun (\<lambda>x. f x y)\<rbrakk> 
295 
\<Longrightarrow> monofun (\<lambda>x. \<Lambda> y. f x y)" 

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

296 
unfolding monofun_def cfun_below_iff by simp 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

297 

29049  298 
text {* cont2cont Lemma for @{term "%x. LAM y. f x y"} *} 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

299 

29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

300 
text {* 
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

301 
Not suitable as a cont2cont rule, because on nested lambdas 
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

302 
it causes exponential blowup in the number of subgoals. 
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

303 
*} 
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

304 

15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

305 
lemma cont2cont_LAM: 
29049  306 
assumes f1: "\<And>x. cont (\<lambda>y. f x y)" 
307 
assumes f2: "\<And>y. cont (\<lambda>x. f x y)" 

308 
shows "cont (\<lambda>x. \<Lambda> y. f x y)" 

40327  309 
proof (rule cont_Abs_cfun) 
29049  310 
fix x 
40327  311 
from f1 show "f x \<in> cfun" by (simp add: cfun_def) 
29049  312 
from f2 show "cont f" by (rule cont2cont_lambda) 
313 
qed 

15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

314 

29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

315 
text {* 
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

316 
This version does work as a cont2cont rule, since it 
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

317 
has only a single subgoal. 
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

318 
*} 
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

319 

37079
0cd15d8c90a0
remove cont2cont simproc; instead declare cont2cont rules as simp rules
huffman
parents:
36452
diff
changeset

320 
lemma cont2cont_LAM' [simp, cont2cont]: 
29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

321 
fixes f :: "'a::cpo \<Rightarrow> 'b::cpo \<Rightarrow> 'c::cpo" 
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

322 
assumes f: "cont (\<lambda>p. f (fst p) (snd p))" 
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

323 
shows "cont (\<lambda>x. \<Lambda> y. f x y)" 
39808
1410c84013b9
rename cont2cont_split to cont2cont_prod_case; add lemmas prod_contI, prod_cont_iff; simplify some proofs
huffman
parents:
39302
diff
changeset

324 
using assms by (simp add: cont2cont_LAM prod_cont_iff) 
29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

325 

37079
0cd15d8c90a0
remove cont2cont simproc; instead declare cont2cont rules as simp rules
huffman
parents:
36452
diff
changeset

326 
lemma cont2cont_LAM_discrete [simp, cont2cont]: 
29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

327 
"(\<And>y::'a::discrete_cpo. cont (\<lambda>x. f x y)) \<Longrightarrow> cont (\<lambda>x. \<Lambda> y. f x y)" 
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
29138
diff
changeset

328 
by (simp add: cont2cont_LAM) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

329 

17832
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

330 
subsection {* Miscellaneous *} 
e18fc1a9a0e0
rearranged subsections; added theorems expand_cfun_eq, expand_cfun_less
huffman
parents:
17817
diff
changeset

331 

40327  332 
text {* Monotonicity of @{term Abs_cfun} *} 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

333 

40433
3128c2a54785
remove some unnecessary lemmas; move monofun_LAM to Cfun.thy
huffman
parents:
40327
diff
changeset

334 
lemma monofun_LAM: 
3128c2a54785
remove some unnecessary lemmas; move monofun_LAM to Cfun.thy
huffman
parents:
40327
diff
changeset

335 
"\<lbrakk>cont f; cont g; \<And>x. f x \<sqsubseteq> g x\<rbrakk> \<Longrightarrow> (\<Lambda> x. f x) \<sqsubseteq> (\<Lambda> x. g x)" 
3128c2a54785
remove some unnecessary lemmas; move monofun_LAM to Cfun.thy
huffman
parents:
40327
diff
changeset

336 
by (simp add: cfun_below_iff) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

337 

15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

338 
text {* some lemmata for functions with flat/chfin domain/range types *} 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

339 

40327  340 
lemma chfin_Rep_cfunR: "chain (Y::nat => 'a::cpo>'b::chfin) 
27413  341 
==> !s. ? n. (LUB i. Y i)$s = Y n$s" 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

342 
apply (rule allI) 
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

343 
apply (subst contlub_cfun_fun) 
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

344 
apply assumption 
40771  345 
apply (fast intro!: lub_eqI chfin lub_finch2 chfin2finch ch2ch_Rep_cfunL) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

346 
done 
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

347 

18089  348 
lemma adm_chfindom: "adm (\<lambda>(u::'a::cpo \<rightarrow> 'b::chfin). P(u\<cdot>s))" 
349 
by (rule adm_subst, simp, rule adm_chfin) 

350 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

351 
subsection {* Continuous injectionretraction pairs *} 
15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

352 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

353 
text {* Continuous retractions are strict. *} 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

354 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

355 
lemma retraction_strict: 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

356 
"\<forall>x. f\<cdot>(g\<cdot>x) = x \<Longrightarrow> f\<cdot>\<bottom> = \<bottom>" 
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41400
diff
changeset

357 
apply (rule bottomI) 
16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

358 
apply (drule_tac x="\<bottom>" in spec) 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

359 
apply (erule subst) 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

360 
apply (rule monofun_cfun_arg) 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

361 
apply (rule minimal) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

362 
done 
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

363 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

364 
lemma injection_eq: 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

365 
"\<forall>x. f\<cdot>(g\<cdot>x) = x \<Longrightarrow> (g\<cdot>x = g\<cdot>y) = (x = y)" 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

366 
apply (rule iffI) 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

367 
apply (drule_tac f=f in cfun_arg_cong) 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

368 
apply simp 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

369 
apply simp 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

370 
done 
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

371 

31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less>below in many lemma names
huffman
parents:
31041
diff
changeset

372 
lemma injection_below: 
16314  373 
"\<forall>x. f\<cdot>(g\<cdot>x) = x \<Longrightarrow> (g\<cdot>x \<sqsubseteq> g\<cdot>y) = (x \<sqsubseteq> y)" 
374 
apply (rule iffI) 

375 
apply (drule_tac f=f in monofun_cfun_arg) 

376 
apply simp 

377 
apply (erule monofun_cfun_arg) 

378 
done 

379 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

380 
lemma injection_defined_rev: 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

381 
"\<lbrakk>\<forall>x. f\<cdot>(g\<cdot>x) = x; g\<cdot>z = \<bottom>\<rbrakk> \<Longrightarrow> z = \<bottom>" 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

382 
apply (drule_tac f=f in cfun_arg_cong) 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

383 
apply (simp add: retraction_strict) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

384 
done 
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

385 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

386 
lemma injection_defined: 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

387 
"\<lbrakk>\<forall>x. f\<cdot>(g\<cdot>x) = x; z \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> g\<cdot>z \<noteq> \<bottom>" 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

388 
by (erule contrapos_nn, rule injection_defined_rev) 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

389 

15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

390 
text {* a result about functions with flat codomain *} 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

391 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

392 
lemma flat_eqI: "\<lbrakk>(x::'a::flat) \<sqsubseteq> y; x \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> x = y" 
25920  393 
by (drule ax_flat, simp) 
16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

394 

c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

395 
lemma flat_codom: 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

396 
"f\<cdot>x = (c::'b::flat) \<Longrightarrow> f\<cdot>\<bottom> = \<bottom> \<or> (\<forall>z. f\<cdot>z = c)" 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

397 
apply (case_tac "f\<cdot>x = \<bottom>") 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

398 
apply (rule disjI1) 
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41400
diff
changeset

399 
apply (rule bottomI) 
16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

400 
apply (erule_tac t="\<bottom>" in subst) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

401 
apply (rule minimal [THEN monofun_cfun_arg]) 
16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

402 
apply clarify 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

403 
apply (rule_tac a = "f\<cdot>\<bottom>" in refl [THEN box_equals]) 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

404 
apply (erule minimal [THEN monofun_cfun_arg, THEN flat_eqI]) 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

405 
apply (erule minimal [THEN monofun_cfun_arg, THEN flat_eqI]) 
15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

406 
done 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

407 

69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

408 
subsection {* Identity and composition *} 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

409 

25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
25131
diff
changeset

410 
definition 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
25131
diff
changeset

411 
ID :: "'a \<rightarrow> 'a" where 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
25131
diff
changeset

412 
"ID = (\<Lambda> x. x)" 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
25131
diff
changeset

413 

4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
25131
diff
changeset

414 
definition 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
25131
diff
changeset

415 
cfcomp :: "('b \<rightarrow> 'c) \<rightarrow> ('a \<rightarrow> 'b) \<rightarrow> 'a \<rightarrow> 'c" where 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
25131
diff
changeset

416 
oo_def: "cfcomp = (\<Lambda> f g x. f\<cdot>(g\<cdot>x))" 
15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

417 

25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
23152
diff
changeset

418 
abbreviation 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
23152
diff
changeset

419 
cfcomp_syn :: "['b \<rightarrow> 'c, 'a \<rightarrow> 'b] \<Rightarrow> 'a \<rightarrow> 'c" (infixr "oo" 100) where 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
23152
diff
changeset

420 
"f oo g == cfcomp\<cdot>f\<cdot>g" 
15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

421 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

422 
lemma ID1 [simp]: "ID\<cdot>x = x" 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

423 
by (simp add: ID_def) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

424 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

425 
lemma cfcomp1: "(f oo g) = (\<Lambda> x. f\<cdot>(g\<cdot>x))" 
15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

426 
by (simp add: oo_def) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

427 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

428 
lemma cfcomp2 [simp]: "(f oo g)\<cdot>x = f\<cdot>(g\<cdot>x)" 
15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

429 
by (simp add: cfcomp1) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

430 

27274  431 
lemma cfcomp_LAM: "cont g \<Longrightarrow> f oo (\<Lambda> x. g x) = (\<Lambda> x. f\<cdot>(g x))" 
432 
by (simp add: cfcomp1) 

433 

19709  434 
lemma cfcomp_strict [simp]: "\<bottom> oo f = \<bottom>" 
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

435 
by (simp add: cfun_eq_iff) 
19709  436 

15589
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

437 
text {* 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

438 
Show that interpretation of (pcpo,@{text "_>_"}) is a category. 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

439 
The class of objects is interpretation of syntactical class pcpo. 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

440 
The class of arrows between objects @{typ 'a} and @{typ 'b} is interpret. of @{typ "'a > 'b"}. 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

441 
The identity arrow is interpretation of @{term ID}. 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

442 
The composition of f and g is interpretation of @{text "oo"}. 
69bea57212ef
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset

443 
*} 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

444 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

445 
lemma ID2 [simp]: "f oo ID = f" 
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

446 
by (rule cfun_eqI, simp) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

447 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

448 
lemma ID3 [simp]: "ID oo f = f" 
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

449 
by (rule cfun_eqI, simp) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

450 

efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

451 
lemma assoc_oo: "f oo (g oo h) = (f oo g) oo h" 
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

452 
by (rule cfun_eqI, simp) 
15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

453 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

454 
subsection {* Strictified functions *} 
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

455 

36452  456 
default_sort pcpo 
16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

457 

25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
23152
diff
changeset

458 
definition 
40767
a3e505b236e7
rename function 'strict' to 'seq', which is its name in Haskell
huffman
parents:
40502
diff
changeset

459 
seq :: "'a \<rightarrow> 'b \<rightarrow> 'b" where 
a3e505b236e7
rename function 'strict' to 'seq', which is its name in Haskell
huffman
parents:
40502
diff
changeset

460 
"seq = (\<Lambda> x. if x = \<bottom> then \<bottom> else ID)" 
16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

461 

40794  462 
lemma cont2cont_if_bottom [cont2cont, simp]: 
463 
assumes f: "cont (\<lambda>x. f x)" and g: "cont (\<lambda>x. g x)" 

464 
shows "cont (\<lambda>x. if f x = \<bottom> then \<bottom> else g x)" 

465 
proof (rule cont_apply [OF f]) 

466 
show "\<And>x. cont (\<lambda>y. if y = \<bottom> then \<bottom> else g x)" 

467 
unfolding cont_def is_lub_def is_ub_def ball_simps 

468 
by (simp add: lub_eq_bottom_iff) 

469 
show "\<And>y. cont (\<lambda>x. if y = \<bottom> then \<bottom> else g x)" 

470 
by (simp add: g) 

471 
qed 

16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

472 

40767
a3e505b236e7
rename function 'strict' to 'seq', which is its name in Haskell
huffman
parents:
40502
diff
changeset

473 
lemma seq_conv_if: "seq\<cdot>x = (if x = \<bottom> then \<bottom> else ID)" 
40794  474 
unfolding seq_def by simp 
16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

475 

41400
1a7557cc686a
replaced separate lemmas seq{1,2,3} with seq_simps
huffman
parents:
41322
diff
changeset

476 
lemma seq_simps [simp]: 
1a7557cc686a
replaced separate lemmas seq{1,2,3} with seq_simps
huffman
parents:
41322
diff
changeset

477 
"seq\<cdot>\<bottom> = \<bottom>" 
1a7557cc686a
replaced separate lemmas seq{1,2,3} with seq_simps
huffman
parents:
41322
diff
changeset

478 
"seq\<cdot>x\<cdot>\<bottom> = \<bottom>" 
1a7557cc686a
replaced separate lemmas seq{1,2,3} with seq_simps
huffman
parents:
41322
diff
changeset

479 
"x \<noteq> \<bottom> \<Longrightarrow> seq\<cdot>x = ID" 
1a7557cc686a
replaced separate lemmas seq{1,2,3} with seq_simps
huffman
parents:
41322
diff
changeset

480 
by (simp_all add: seq_conv_if) 
40093  481 

482 
definition 

40046
ba2e41c8b725
introduce function strict :: 'a > 'b > 'b, which works like Haskell's seq; use strict instead of strictify in various definitions
huffman
parents:
40011
diff
changeset

483 
strictify :: "('a \<rightarrow> 'b) \<rightarrow> 'a \<rightarrow> 'b" where 
40767
a3e505b236e7
rename function 'strict' to 'seq', which is its name in Haskell
huffman
parents:
40502
diff
changeset

484 
"strictify = (\<Lambda> f x. seq\<cdot>x\<cdot>(f\<cdot>x))" 
16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

485 

17815  486 
lemma strictify_conv_if: "strictify\<cdot>f\<cdot>x = (if x = \<bottom> then \<bottom> else f\<cdot>x)" 
40046
ba2e41c8b725
introduce function strict :: 'a > 'b > 'b, which works like Haskell's seq; use strict instead of strictify in various definitions
huffman
parents:
40011
diff
changeset

487 
unfolding strictify_def by simp 
16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

488 

c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

489 
lemma strictify1 [simp]: "strictify\<cdot>f\<cdot>\<bottom> = \<bottom>" 
17815  490 
by (simp add: strictify_conv_if) 
16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

491 

c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

492 
lemma strictify2 [simp]: "x \<noteq> \<bottom> \<Longrightarrow> strictify\<cdot>f\<cdot>x = f\<cdot>x" 
17815  493 
by (simp add: strictify_conv_if) 
16085
c004b9bc970e
rewrote continuous isomorphism section, cleaned up
huffman
parents:
16070
diff
changeset

494 

35933
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

495 
subsection {* Continuity of letbindings *} 
17816
9942c5ed866a
new syntax translations for continuous lambda abstraction
huffman
parents:
17815
diff
changeset

496 

35933
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

497 
lemma cont2cont_Let: 
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

498 
assumes f: "cont (\<lambda>x. f x)" 
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

499 
assumes g1: "\<And>y. cont (\<lambda>x. g x y)" 
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

500 
assumes g2: "\<And>x. cont (\<lambda>y. g x y)" 
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

501 
shows "cont (\<lambda>x. let y = f x in g x y)" 
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

502 
unfolding Let_def using f g2 g1 by (rule cont_apply) 
17816
9942c5ed866a
new syntax translations for continuous lambda abstraction
huffman
parents:
17815
diff
changeset

503 

37079
0cd15d8c90a0
remove cont2cont simproc; instead declare cont2cont rules as simp rules
huffman
parents:
36452
diff
changeset

504 
lemma cont2cont_Let' [simp, cont2cont]: 
35933
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

505 
assumes f: "cont (\<lambda>x. f x)" 
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

506 
assumes g: "cont (\<lambda>p. g (fst p) (snd p))" 
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

507 
shows "cont (\<lambda>x. let y = f x in g x y)" 
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

508 
using f 
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

509 
proof (rule cont2cont_Let) 
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

510 
fix x show "cont (\<lambda>y. g x y)" 
40003
427106657e04
remove unused lemmas cont_fst_snd_D1, cont_fst_snd_D2
huffman
parents:
40002
diff
changeset

511 
using g by (simp add: prod_cont_iff) 
35933
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

512 
next 
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

513 
fix y show "cont (\<lambda>x. g x y)" 
40003
427106657e04
remove unused lemmas cont_fst_snd_D1, cont_fst_snd_D2
huffman
parents:
40002
diff
changeset

514 
using g by (simp add: prod_cont_iff) 
35933
f135ebcc835c
remove continuous letbinding function CLet; add cont2cont rule ordinary Let
huffman
parents:
35914
diff
changeset

515 
qed 
17816
9942c5ed866a
new syntax translations for continuous lambda abstraction
huffman
parents:
17815
diff
changeset

516 

39145  517 
text {* The simple version (suggested by Joachim Breitner) is needed if 
518 
the type of the defined term is not a cpo. *} 

519 

520 
lemma cont2cont_Let_simple [simp, cont2cont]: 

521 
assumes "\<And>y. cont (\<lambda>x. g x y)" 

522 
shows "cont (\<lambda>x. let y = t in g x y)" 

523 
unfolding Let_def using assms . 

524 

15576
efb95d0d01f7
converted to newstyle theories, and combined numbered files
huffman
parents:
diff
changeset

525 
end 