269 "Assumption.export -> |
269 "Assumption.export -> |
270 cterm list -> Proof.context -> thm list * Proof.context"} \\ |
270 cterm list -> Proof.context -> thm list * Proof.context"} \\ |
271 @{define_ML Assumption.add_assumes: " |
271 @{define_ML Assumption.add_assumes: " |
272 cterm list -> Proof.context -> thm list * Proof.context"} \\ |
272 cterm list -> Proof.context -> thm list * Proof.context"} \\ |
273 @{define_ML Assumption.export: "bool -> Proof.context -> Proof.context -> thm -> thm"} \\ |
273 @{define_ML Assumption.export: "bool -> Proof.context -> Proof.context -> thm -> thm"} \\ |
|
274 @{define_ML Assumption.export_term: "Proof.context -> Proof.context -> term -> term"} \\ |
274 \end{mldecls} |
275 \end{mldecls} |
275 |
276 |
276 \<^descr> Type \<^ML_type>\<open>Assumption.export\<close> represents arbitrary export rules, which |
277 \<^descr> Type \<^ML_type>\<open>Assumption.export\<close> represents export rules, as a pair of |
277 is any function of type \<^ML_type>\<open>bool -> cterm list -> thm -> thm\<close>, where |
278 functions \<^ML_type>\<open>bool -> cterm list -> (thm -> thm) * (term -> term)\<close>. |
278 the \<^ML_type>\<open>bool\<close> indicates goal mode, and the \<^ML_type>\<open>cterm list\<close> |
279 The \<^ML_type>\<open>bool\<close> argument indicates goal mode, and the \<^ML_type>\<open>cterm list\<close> |
279 the collection of assumptions to be discharged simultaneously. |
280 the collection of assumptions to be discharged simultaneously. |
280 |
281 |
281 \<^descr> \<^ML>\<open>Assumption.assume\<close>~\<open>ctxt A\<close> turns proposition \<open>A\<close> into a primitive |
282 \<^descr> \<^ML>\<open>Assumption.assume\<close>~\<open>ctxt A\<close> turns proposition \<open>A\<close> into a primitive |
282 assumption \<open>A \<turnstile> A'\<close>, where the conclusion \<open>A'\<close> is in HHF normal form. |
283 assumption \<open>A \<turnstile> A'\<close>, where the conclusion \<open>A'\<close> is in HHF normal form. |
283 |
284 |
284 \<^descr> \<^ML>\<open>Assumption.add_assms\<close>~\<open>r As\<close> augments the context by assumptions \<open>As\<close> |
285 \<^descr> \<^ML>\<open>Assumption.add_assms\<close>~\<open>r As\<close> augments the context by assumptions \<open>As\<close> |
285 with export rule \<open>r\<close>. The resulting facts are hypothetical theorems as |
286 with export rule \<open>r\<close>. The resulting facts are hypothetical theorems as |
286 produced by the raw \<^ML>\<open>Assumption.assume\<close>. |
287 produced by the raw \<^ML>\<open>Assumption.assume\<close>. |
287 |
288 |
288 \<^descr> \<^ML>\<open>Assumption.add_assumes\<close>~\<open>As\<close> is a special case of \<^ML>\<open>Assumption.add_assms\<close> where the export rule performs \<open>\<Longrightarrow>\<hyphen>intro\<close> or |
289 \<^descr> \<^ML>\<open>Assumption.add_assumes\<close>~\<open>As\<close> is a special case of |
|
290 \<^ML>\<open>Assumption.add_assms\<close> where the export rule performs \<open>\<Longrightarrow>\<hyphen>intro\<close> or |
289 \<open>#\<Longrightarrow>\<hyphen>intro\<close>, depending on goal mode. |
291 \<open>#\<Longrightarrow>\<hyphen>intro\<close>, depending on goal mode. |
290 |
292 |
291 \<^descr> \<^ML>\<open>Assumption.export\<close>~\<open>is_goal inner outer thm\<close> exports result \<open>thm\<close> |
293 \<^descr> \<^ML>\<open>Assumption.export\<close>~\<open>is_goal inner outer thm\<close> exports result \<open>thm\<close> |
292 from the the \<open>inner\<close> context back into the \<open>outer\<close> one; \<open>is_goal = true\<close> |
294 from the \<open>inner\<close> context back into the \<open>outer\<close> one; \<open>is_goal = true\<close> means |
293 means this is a goal context. The result is in HHF normal form. Note that |
295 this is a goal context. The result is in HHF normal form. Note that |
294 \<^ML>\<open>Proof_Context.export\<close> combines \<^ML>\<open>Variable.export\<close> and \<^ML>\<open>Assumption.export\<close> in the canonical way. |
296 \<^ML>\<open>Proof_Context.export\<close> combines \<^ML>\<open>Variable.export\<close> and |
|
297 \<^ML>\<open>Assumption.export\<close> in the canonical way. |
|
298 |
|
299 \<^descr> \<^ML>\<open>Assumption.export_term\<close>~\<open>inner outer t\<close> exports term \<open>t\<close> from the |
|
300 \<open>inner\<close> context back into the \<open>outer\<close> one. This is analogous to |
|
301 \<^ML>\<open>Assumption.export\<close>, but only takes syntactical aspects of the |
|
302 context into account (such as locally specified variables as seen in |
|
303 @{command define} or @{command obtain}). |
295 \<close> |
304 \<close> |
296 |
305 |
297 text %mlex \<open> |
306 text %mlex \<open> |
298 The following example demonstrates how rules can be derived by building up a |
307 The following example demonstrates how rules can be derived by building up a |
299 context of assumptions first, and exporting some local fact afterwards. We |
308 context of assumptions first, and exporting some local fact afterwards. We |