137 text {* Beta-equality for continuous functions *} |
137 text {* Beta-equality for continuous functions *} |
138 |
138 |
139 lemma Abs_CFun_inverse2: "cont f \<Longrightarrow> Rep_CFun (Abs_CFun f) = f" |
139 lemma Abs_CFun_inverse2: "cont f \<Longrightarrow> Rep_CFun (Abs_CFun f) = f" |
140 by (simp add: Abs_CFun_inverse CFun_def) |
140 by (simp add: Abs_CFun_inverse CFun_def) |
141 |
141 |
142 lemma beta_cfun [simp]: "cont f \<Longrightarrow> (\<Lambda> x. f x)\<cdot>u = f u" |
142 lemma beta_cfun: "cont f \<Longrightarrow> (\<Lambda> x. f x)\<cdot>u = f u" |
143 by (simp add: Abs_CFun_inverse2) |
143 by (simp add: Abs_CFun_inverse2) |
|
144 |
|
145 text {* Beta-reduction simproc *} |
|
146 |
|
147 text {* |
|
148 Given the term @{term "(\<Lambda> x. f x)\<cdot>y"}, the procedure tries to |
|
149 construct the theorem @{term "(\<Lambda> x. f x)\<cdot>y == f y"}. If this |
|
150 theorem cannot be completely solved by the cont2cont rules, then |
|
151 the procedure returns the ordinary conditional @{text beta_cfun} |
|
152 rule. |
|
153 |
|
154 The simproc does not solve any more goals that would be solved by |
|
155 using @{text beta_cfun} as a simp rule. The advantage of the |
|
156 simproc is that it can avoid deeply-nested calls to the simplifier |
|
157 that would otherwise be caused by large continuity side conditions. |
|
158 *} |
|
159 |
|
160 simproc_setup beta_cfun_proc ("Abs_CFun f\<cdot>x") = {* |
|
161 fn phi => fn ss => fn ct => |
|
162 let |
|
163 val dest = Thm.dest_comb; |
|
164 val (f, x) = (apfst (snd o dest o snd o dest) o dest) ct; |
|
165 val [T, U] = Thm.dest_ctyp (ctyp_of_term f); |
|
166 val tr = instantiate' [SOME T, SOME U] [SOME f, SOME x] |
|
167 (mk_meta_eq @{thm beta_cfun}); |
|
168 val rules = Cont2ContData.get (Simplifier.the_context ss); |
|
169 val tac = SOLVED' (REPEAT_ALL_NEW (match_tac rules)); |
|
170 in SOME (perhaps (SINGLE (tac 1)) tr) end |
|
171 *} |
144 |
172 |
145 text {* Eta-equality for continuous functions *} |
173 text {* Eta-equality for continuous functions *} |
146 |
174 |
147 lemma eta_cfun: "(\<Lambda> x. f\<cdot>x) = f" |
175 lemma eta_cfun: "(\<Lambda> x. f\<cdot>x) = f" |
148 by (rule Rep_CFun_inverse) |
176 by (rule Rep_CFun_inverse) |