3 (*>*) |
3 (*>*) |
4 |
4 |
5 text{*\noindent |
5 text{*\noindent |
6 Now that we have learned about rules and logic, we take another look at the |
6 Now that we have learned about rules and logic, we take another look at the |
7 finer points of induction. The two questions we answer are: what to do if the |
7 finer points of induction. The two questions we answer are: what to do if the |
8 proposition to be proved is not directly amenable to induction, and how to |
8 proposition to be proved is not directly amenable to induction |
9 utilize and even derive new induction schemas. We conclude with some slightly subtle |
9 (\S\ref{sec:ind-var-in-prems}), and how to utilize (\S\ref{sec:complete-ind}) |
10 examples of induction. |
10 and even derive (\S\ref{sec:derive-ind}) new induction schemas. We conclude |
|
11 with an extended example of induction (\S\ref{sec:CTL-revisited}). |
11 *}; |
12 *}; |
12 |
13 |
13 subsection{*Massaging the proposition*}; |
14 subsection{*Massaging the proposition*}; |
14 |
15 |
15 text{*\label{sec:ind-var-in-prems} |
16 text{*\label{sec:ind-var-in-prems} |
158 From the above axiom\footnote{In general, the use of axioms is strongly |
159 From the above axiom\footnote{In general, the use of axioms is strongly |
159 discouraged, because of the danger of inconsistencies. The above axiom does |
160 discouraged, because of the danger of inconsistencies. The above axiom does |
160 not introduce an inconsistency because, for example, the identity function |
161 not introduce an inconsistency because, for example, the identity function |
161 satisfies it.} |
162 satisfies it.} |
162 for @{term"f"} it follows that @{prop"n <= f n"}, which can |
163 for @{term"f"} it follows that @{prop"n <= f n"}, which can |
163 be proved by induction on @{term"f n"}. Following the recipy outlined |
164 be proved by induction on @{term"f n"}. Following the recipe outlined |
164 above, we have to phrase the proposition as follows to allow induction: |
165 above, we have to phrase the proposition as follows to allow induction: |
165 *}; |
166 *}; |
166 |
167 |
167 lemma f_incr_lem: "\<forall>i. k = f i \<longrightarrow> i \<le> f i"; |
168 lemma f_incr_lem: "\<forall>i. k = f i \<longrightarrow> i \<le> f i"; |
168 |
169 |
276 @{thm[display]"less_SucE"[no_vars]} |
277 @{thm[display]"less_SucE"[no_vars]} |
277 |
278 |
278 Now it is straightforward to derive the original version of |
279 Now it is straightforward to derive the original version of |
279 @{thm[source]nat_less_induct} by manipulting the conclusion of the above lemma: |
280 @{thm[source]nat_less_induct} by manipulting the conclusion of the above lemma: |
280 instantiate @{term"n"} by @{term"Suc n"} and @{term"m"} by @{term"n"} and |
281 instantiate @{term"n"} by @{term"Suc n"} and @{term"m"} by @{term"n"} and |
281 remove the trivial condition @{prop"n < Sc n"}. Fortunately, this |
282 remove the trivial condition @{prop"n < Suc n"}. Fortunately, this |
282 happens automatically when we add the lemma as a new premise to the |
283 happens automatically when we add the lemma as a new premise to the |
283 desired goal: |
284 desired goal: |
284 *}; |
285 *}; |
285 |
286 |
286 theorem nat_less_induct: "(\<And>n::nat. \<forall>m<n. P m \<Longrightarrow> P n) \<Longrightarrow> P n"; |
287 theorem nat_less_induct: "(\<And>n::nat. \<forall>m<n. P m \<Longrightarrow> P n) \<Longrightarrow> P n"; |
287 by(insert induct_lem, blast); |
288 by(insert induct_lem, blast); |
288 |
289 |
289 text{* |
290 text{* |
290 Finally we should mention that HOL already provides the mother of all |
291 Finally we should remind the reader that HOL already provides the mother of |
291 inductions, \textbf{well-founded |
292 all inductions, well-founded induction (see \S\ref{sec:Well-founded}). For |
292 induction}\indexbold{induction!well-founded}\index{well-founded |
293 example theorem @{thm[source]nat_less_induct} can be viewed (and derived) as |
293 induction|see{induction, well-founded}} (@{thm[source]wf_induct}): |
294 a special case of @{thm[source]wf_induct} where @{term r} is @{text"<"} on |
294 @{thm[display]wf_induct[no_vars]} |
295 @{typ nat}. The details can be found in the HOL library. |
295 where @{term"wf r"} means that the relation @{term r} is well-founded |
|
296 (see \S\ref{sec:well-founded}). |
|
297 For example, theorem @{thm[source]nat_less_induct} can be viewed (and |
|
298 derived) as a special case of @{thm[source]wf_induct} where |
|
299 @{term r} is @{text"<"} on @{typ nat}. The details can be found in the HOL library. |
|
300 For a mathematical account of well-founded induction see, for example, \cite{Baader-Nipkow}. |
|
301 *}; |
296 *}; |
302 |
297 |
303 (*<*) |
298 (*<*) |
304 end |
299 end |
305 (*>*) |
300 (*>*) |