ProgTutorial/Package/Ind_Prelims.thy
changeset 222 1dc03eaa7cb9
parent 219 98d43270024f
child 224 647cab4a72c2
equal deleted inserted replaced
221:a9eb69749c93 222:1dc03eaa7cb9
     1 theory Ind_Prelims
     1 theory Ind_Prelims
     2 imports Main LaTeXsugar"../Base" Simple_Inductive_Package
     2 imports Main LaTeXsugar "../Base" 
     3 begin
     3 begin
     4 
     4 
     5 section{* Preliminaries *}
     5 section{* Preliminaries *}
     6   
     6   
     7 text {*
     7 text {*
     8   The user will just give a specification of an inductive predicate and
     8   The user will just give a specification of inductive predicate(s) and
     9   expects from the package to produce a convenient reasoning
     9   expects from the package to produce a convenient reasoning
    10   infrastructure. This infrastructure needs to be derived from the definition
    10   infrastructure. This infrastructure needs to be derived from the definition
    11   that correspond to the specified predicate. This will roughly mean that the
    11   that correspond to the specified predicate(s). Before we start with
    12   package has three main parts, namely:
    12   explaining all parts of the package, let us first give some examples 
    13 
    13   showing how to define inductive predicates and then also how
    14 
    14   to generate a reasoning infrastructure for them. From the examples 
    15   \begin{itemize}
    15   we will figure out a general method for
    16   \item parsing the specification and typing the parsed input,
    16   defining inductive predicates.  The aim in this section is \emph{not} to
    17   \item making the definitions and deriving the reasoning infrastructure, and
    17   write proofs that are as beautiful as possible, but as close as possible to
    18   \item storing the results in the theory. 
    18   the ML-code we will develop in later sections.
    19   \end{itemize}
    19 
    20 
    20 
    21   Before we start with explaining all parts, let us first give three examples
    21 
    22   showing how to define inductive predicates by hand and then also how to
    22   We first consider the transitive closure of a relation @{text R}. The 
    23   prove by hand important properties about them. From these examples, we will
    23   ``pencil-and-paper'' specification for the transitive closure is:
    24   figure out a general method for defining inductive predicates.  The aim in
       
    25   this section is \emph{not} to write proofs that are as beautiful as
       
    26   possible, but as close as possible to the ML-code we will develop in later
       
    27   sections.
       
    28 
       
    29 
       
    30   We first consider the transitive closure of a relation @{text R}. It is
       
    31   an inductive predicate characterised by the two introduction rules:
       
    32 
    24 
    33   \begin{center}\small
    25   \begin{center}\small
    34   @{prop[mode=Axiom] "trcl R x x"} \hspace{5mm}
    26   @{prop[mode=Axiom] "trcl R x x"} \hspace{5mm}
    35   @{prop[mode=Rule] "R x y \<Longrightarrow> trcl R y z \<Longrightarrow> trcl R x z"}
    27   @{prop[mode=Rule] "R x y \<Longrightarrow> trcl R y z \<Longrightarrow> trcl R x z"}
    36   \end{center}
    28   \end{center}
    37 
    29 
    38   In Isabelle, the user will state for @{term trcl\<iota>} the specification:
    30   The package has to make an appropriate definition. Since an inductively
    39 *}
       
    40 
       
    41 simple_inductive
       
    42   trcl\<iota> :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool"
       
    43 where
       
    44   base: "trcl\<iota> R x x"
       
    45 | step: "trcl\<iota> R x y \<Longrightarrow> R y z \<Longrightarrow> trcl\<iota> R x z"
       
    46 
       
    47 text {*
       
    48   As said above the package has to make an appropriate definition and provide
       
    49   lemmas to reason about the predicate @{term trcl\<iota>}. Since an inductively
       
    50   defined predicate is the least predicate closed under a collection of
    31   defined predicate is the least predicate closed under a collection of
    51   introduction rules, the predicate @{text "trcl R x y"} can be defined so
    32   introduction rules, the predicate @{text "trcl R x y"} can be defined so
    52   that it holds if and only if @{text "P x y"} holds for every predicate
    33   that it holds if and only if @{text "P x y"} holds for every predicate
    53   @{text P} closed under the rules above. This gives rise to the definition
    34   @{text P} closed under the rules above. This gives rise to the definition
    54 *}
    35 *}
    56 definition "trcl \<equiv> 
    37 definition "trcl \<equiv> 
    57      \<lambda>R x y. \<forall>P. (\<forall>x. P x x) 
    38      \<lambda>R x y. \<forall>P. (\<forall>x. P x x) 
    58                   \<longrightarrow> (\<forall>x y z. R x y \<longrightarrow> P y z \<longrightarrow> P x z) \<longrightarrow> P x y"
    39                   \<longrightarrow> (\<forall>x y z. R x y \<longrightarrow> P y z \<longrightarrow> P x z) \<longrightarrow> P x y"
    59 
    40 
    60 text {*
    41 text {*
    61   where we quantify over the predicate @{text P}. We have to use the
    42   We have to use the object implication @{text "\<longrightarrow>"} and object quantification
    62   object implication @{text "\<longrightarrow>"} and object quantification @{text "\<forall>"} for
    43   @{text "\<forall>"} for stating this definition (there is no other way for
    63   stating this definition (there is no other way for definitions in
    44   definitions in HOL). However, the introduction rules and induction
    64   HOL). However, the introduction rules and induction principles 
    45   principles associated with the transitive closure should use the meta-connectives, 
    65   should use the meta-connectives since they simplify the
    46   since they simplify the reasoning for the user.
    66   reasoning for the user.
    47 
    67 
    48 
    68   With this definition, the proof of the induction principle for @{term trcl}
    49   With this definition, the proof of the induction principle for @{term trcl}
    69   is almost immediate. It suffices to convert all the meta-level
    50   is almost immediate. It suffices to convert all the meta-level
    70   connectives in the lemma to object-level connectives using the
    51   connectives in the lemma to object-level connectives using the
    71   proof method @{text atomize} (Line 4), expand the definition of @{term trcl}
    52   proof method @{text atomize} (Line 4 below), expand the definition of @{term trcl}
    72   (Line 5 and 6), eliminate the universal quantifier contained in it (Line~7),
    53   (Line 5 and 6), eliminate the universal quantifier contained in it (Line~7),
    73   and then solve the goal by assumption (Line 8).
    54   and then solve the goal by @{text assumption} (Line 8).
    74 
    55 
    75 *}
    56 *}
    76 
    57 
    77 lemma %linenos trcl_induct:
    58 lemma %linenos trcl_induct:
    78   assumes "trcl R x y"
    59 assumes "trcl R x y"
    79   shows "(\<And>x. P x x) \<Longrightarrow> (\<And>x y z. R x y \<Longrightarrow> P y z \<Longrightarrow> P x z) \<Longrightarrow> P x y"
    60 shows "(\<And>x. P x x) \<Longrightarrow> (\<And>x y z. R x y \<Longrightarrow> P y z \<Longrightarrow> P x z) \<Longrightarrow> P x y"
    80 apply(atomize (full))
    61 apply(atomize (full))
    81 apply(cut_tac prems)
    62 apply(cut_tac prems)
    82 apply(unfold trcl_def)
    63 apply(unfold trcl_def)
    83 apply(drule spec[where x=P])
    64 apply(drule spec[where x=P])
    84 apply(assumption)
    65 apply(assumption)
    88   The proofs for the introduction rules are slightly more complicated. 
    69   The proofs for the introduction rules are slightly more complicated. 
    89   For the first one, we need to prove the following lemma:
    70   For the first one, we need to prove the following lemma:
    90 *}
    71 *}
    91 
    72 
    92 lemma %linenos trcl_base: 
    73 lemma %linenos trcl_base: 
    93   shows "trcl R x x"
    74 shows "trcl R x x"
    94 apply(unfold trcl_def)
    75 apply(unfold trcl_def)
    95 apply(rule allI impI)+
    76 apply(rule allI impI)+
    96 apply(drule spec)
    77 apply(drule spec)
    97 apply(assumption)
    78 apply(assumption)
    98 done
    79 done
   108 apply (rule allI impI)+(*>*)
    89 apply (rule allI impI)+(*>*)
   109 txt {* @{subgoals [display]} *}
    90 txt {* @{subgoals [display]} *}
   110 (*<*)oops(*>*)
    91 (*<*)oops(*>*)
   111 
    92 
   112 text {*
    93 text {*
   113   The two assumptions correspond to the introduction rules. Thus, all we have
    94   The two assumptions come from the definition of @{term trcl} and correspond
   114   to do is to eliminate the universal quantifier in front of the first
    95   to the introduction rules. Thus, all we have to do is to eliminate the
   115   assumption (Line 5), and then solve the goal by assumption (Line 6).
    96   universal quantifier in front of the first assumption (Line 5), and then
       
    97   solve the goal by @{text assumption} (Line 6).
   116 *}
    98 *}
   117 
    99 
   118 text {*
   100 text {*
   119   Next we have to show that the second introduction rule also follows from the
   101   Next we have to show that the second introduction rule also follows from the
   120   definition.  Since this rule has premises, the proof is a bit more
   102   definition.  Since this rule has premises, the proof is a bit more
   121   involved. After unfolding the definitions and applying the introduction
   103   involved. After unfolding the definitions and applying the introduction
   122   rules for @{text "\<forall>"} and @{text "\<longrightarrow>"}
   104   rules for @{text "\<forall>"} and @{text "\<longrightarrow>"}
   123 *}
   105 *}
   124 
   106 
   125 lemma trcl_step: 
   107 lemma trcl_step: 
   126   shows "R x y \<Longrightarrow> trcl R y z \<Longrightarrow> trcl R x z"
   108 shows "R x y \<Longrightarrow> trcl R y z \<Longrightarrow> trcl R x z"
   127 apply (unfold trcl_def)
   109 apply (unfold trcl_def)
   128 apply (rule allI impI)+
   110 apply (rule allI impI)+
   129 
   111 
   130 txt {* 
   112 txt {* 
   131   we obtain the goal state
   113   we obtain the goal state
   145   have r2: "\<forall>x y z. R x y \<longrightarrow> P y z \<longrightarrow> P x z" by fact
   127   have r2: "\<forall>x y z. R x y \<longrightarrow> P y z \<longrightarrow> P x z" by fact
   146   show "P x z"
   128   show "P x z"
   147   
   129   
   148 txt {*
   130 txt {*
   149   The assumptions @{text "p1"} and @{text "p2"} correspond to the premises of
   131   The assumptions @{text "p1"} and @{text "p2"} correspond to the premises of
   150   the second introduction rule; the assumptions @{text "r1"} and @{text "r2"}
   132   the second introduction rule (unfolded); the assumptions @{text "r1"} and @{text "r2"}
   151   correspond to the introduction rules. We apply @{text "r2"} to the goal
   133   come from the definition of @{term trcl}. We apply @{text "r2"} to the goal
   152   @{term "P x z"}. In order for the assumption to be applicable as a rule, we
   134   @{term "P x z"}. In order for this assumption to be applicable as a rule, we
   153   have to eliminate the universal quantifier and turn the object-level
   135   have to eliminate the universal quantifier and turn the object-level
   154   implications into meta-level ones. This can be accomplished using the @{text
   136   implications into meta-level ones. This can be accomplished using the @{text
   155   rule_format} attribute. So we continue the proof with:
   137   rule_format} attribute. So we continue the proof with:
   156 
   138 
   157 *}
   139 *}
   181   tactics available in Isabelle for proving this lemmas. After all @{text
   163   tactics available in Isabelle for proving this lemmas. After all @{text
   182   "blast"} would easily dispense of it.
   164   "blast"} would easily dispense of it.
   183 *}
   165 *}
   184 
   166 
   185 lemma trcl_step_blast: 
   167 lemma trcl_step_blast: 
   186   shows "R x y \<Longrightarrow> trcl R y z \<Longrightarrow> trcl R x z"
   168 shows "R x y \<Longrightarrow> trcl R y z \<Longrightarrow> trcl R x z"
   187 apply(unfold trcl_def)
   169 apply(unfold trcl_def)
   188 apply(blast)
   170 apply(blast)
   189 done
   171 done
   190 
   172 
   191 text {*
   173 text {*
   193   @{text blast}, @{text auto} and the like in automated proofs. The reason is
   175   @{text blast}, @{text auto} and the like in automated proofs. The reason is
   194   that you do not have precise control over them (the user can, for example,
   176   that you do not have precise control over them (the user can, for example,
   195   declare new intro- or simplification rules that can throw automatic tactics
   177   declare new intro- or simplification rules that can throw automatic tactics
   196   off course) and also it is very hard to debug proofs involving automatic
   178   off course) and also it is very hard to debug proofs involving automatic
   197   tactics whenever something goes wrong. Therefore if possible, automatic 
   179   tactics whenever something goes wrong. Therefore if possible, automatic 
   198   tactics should be avoided or sufficiently constrained.
   180   tactics should be avoided or be constrained sufficiently.
   199 
   181 
   200   The method of defining inductive predicates by impredicative quantification
   182   The method of defining inductive predicates by impredicative quantification
   201   also generalises to mutually inductive predicates. The next example defines
   183   also generalises to mutually inductive predicates. The next example defines
   202   the predicates @{text even} and @{text odd} characterised by the following
   184   the predicates @{text even} and @{text odd} given by
   203   rules:
   185 
   204  
       
   205   \begin{center}\small
   186   \begin{center}\small
   206   @{prop[mode=Axiom] "even (0::nat)"} \hspace{5mm}
   187   @{prop[mode=Axiom] "even (0::nat)"} \hspace{5mm}
   207   @{prop[mode=Rule] "odd n \<Longrightarrow> even (Suc n)"} \hspace{5mm}
   188   @{prop[mode=Rule] "odd n \<Longrightarrow> even (Suc n)"} \hspace{5mm}
   208   @{prop[mode=Rule] "even n \<Longrightarrow> odd (Suc n)"}
   189   @{prop[mode=Rule] "even n \<Longrightarrow> odd (Suc n)"}
   209   \end{center}
   190   \end{center}
   210   
   191 
   211   The user will state for this inductive definition the specification:
       
   212 *}
       
   213 
       
   214 simple_inductive
       
   215   even and odd
       
   216 where
       
   217   even0: "even 0"
       
   218 | evenS: "odd n \<Longrightarrow> even (Suc n)"
       
   219 | oddS: "even n \<Longrightarrow> odd (Suc n)"
       
   220 
       
   221 text {*
       
   222   Since the predicates @{term even} and @{term odd} are mutually inductive, each 
   192   Since the predicates @{term even} and @{term odd} are mutually inductive, each 
   223   corresponding definition must quantify over both predicates (we name them 
   193   corresponding definition must quantify over both predicates (we name them 
   224   below @{text "P"} and @{text "Q"}).
   194   below @{text "P"} and @{text "Q"}).
   225 *}
   195 *}
   226 
   196 
   227 definition "even\<iota> \<equiv> 
   197 definition "even \<equiv> 
   228   \<lambda>n. \<forall>P Q. P 0 \<longrightarrow> (\<forall>m. Q m \<longrightarrow> P (Suc m)) 
   198   \<lambda>n. \<forall>P Q. P 0 \<longrightarrow> (\<forall>m. Q m \<longrightarrow> P (Suc m)) 
   229                  \<longrightarrow> (\<forall>m. P m \<longrightarrow> Q (Suc m)) \<longrightarrow> P n"
   199                  \<longrightarrow> (\<forall>m. P m \<longrightarrow> Q (Suc m)) \<longrightarrow> P n"
   230 
   200 
   231 definition "odd\<iota> \<equiv>
   201 definition "odd \<equiv>
   232   \<lambda>n. \<forall>P Q. P 0 \<longrightarrow> (\<forall>m. Q m \<longrightarrow> P (Suc m)) 
   202   \<lambda>n. \<forall>P Q. P 0 \<longrightarrow> (\<forall>m. Q m \<longrightarrow> P (Suc m)) 
   233                  \<longrightarrow> (\<forall>m. P m \<longrightarrow> Q (Suc m)) \<longrightarrow> Q n"
   203                  \<longrightarrow> (\<forall>m. P m \<longrightarrow> Q (Suc m)) \<longrightarrow> Q n"
   234 
   204 
   235 text {*
   205 text {*
   236   For proving the induction principles, we use exactly the same technique 
   206   For proving the induction principles, we use exactly the same technique 
   237   as in the transitive closure example, namely:
   207   as in the transitive closure example, namely:
   238 *}
   208 *}
   239 
   209 
   240 lemma even_induct:
   210 lemma even_induct:
   241   assumes "even n"
   211 assumes "even n"
   242   shows "P 0 \<Longrightarrow> 
   212 shows "P 0 \<Longrightarrow> (\<And>m. Q m \<Longrightarrow> P (Suc m)) \<Longrightarrow> (\<And>m. P m \<Longrightarrow> Q (Suc m)) \<Longrightarrow> P n"
   243              (\<And>m. Q m \<Longrightarrow> P (Suc m)) \<Longrightarrow> (\<And>m. P m \<Longrightarrow> Q (Suc m)) \<Longrightarrow> P n"
       
   244 apply(atomize (full))
   213 apply(atomize (full))
   245 apply(cut_tac prems)
   214 apply(cut_tac prems)
   246 apply(unfold even_def)
   215 apply(unfold even_def)
   247 apply(drule spec[where x=P])
   216 apply(drule spec[where x=P])
   248 apply(drule spec[where x=Q])
   217 apply(drule spec[where x=Q])
   250 done
   219 done
   251 
   220 
   252 text {*
   221 text {*
   253   The only difference with the proof @{text "trcl_induct"} is that we have to
   222   The only difference with the proof @{text "trcl_induct"} is that we have to
   254   instantiate here two universal quantifiers.  We omit the other induction
   223   instantiate here two universal quantifiers.  We omit the other induction
   255   principle that has @{term "Q n"} as conclusion.  The proofs of the
   224   principle that has @{prop "even n"} as premise and @{term "Q n"} as conclusion.  
   256   introduction rules are also very similar to the ones in the @{text
   225   The proofs of the introduction rules are also very similar to the ones in 
   257   "trcl"}-example. We only show the proof of the second introduction rule.
   226   the @{text "trcl"}-example. We only show the proof of the second introduction 
   258 
   227   rule.
   259 *}
   228 *}
   260 
   229 
   261 lemma %linenos evenS: 
   230 lemma %linenos evenS: 
   262   shows "odd m \<Longrightarrow> even (Suc m)"
   231 shows "odd m \<Longrightarrow> even (Suc m)"
   263 apply (unfold odd_def even_def)
   232 apply (unfold odd_def even_def)
   264 apply (rule allI impI)+
   233 apply (rule allI impI)+
   265 proof -
   234 proof -
   266   case (goal1 P Q)
   235   case (goal1 P Q)
   267   have p1: "\<forall>P Q. P 0 \<longrightarrow> (\<forall>m. Q m \<longrightarrow> P (Suc m)) 
   236   have p1: "\<forall>P Q. P 0 \<longrightarrow> (\<forall>m. Q m \<longrightarrow> P (Suc m)) 
   275 	           THEN mp, THEN mp, THEN mp, OF r1, OF r2, OF r3])
   244 	           THEN mp, THEN mp, THEN mp, OF r1, OF r2, OF r3])
   276     done
   245     done
   277 qed
   246 qed
   278 
   247 
   279 text {*
   248 text {*
       
   249   The interesting lines are 7 to 15. The assumptions fall into two categories:
       
   250   @{text p1} corresponds to the premise of the introduction rule; @{text "r1"}
       
   251   to @{text "r3"} come from the definition of @{text "even"}.
   280   In Line 13, we apply the assumption @{text "r2"} (since we prove the second
   252   In Line 13, we apply the assumption @{text "r2"} (since we prove the second
   281   introduction rule). In Lines 14 and 15 we apply assumption @{text "p1"} (if
   253   introduction rule). In Lines 14 and 15 we apply assumption @{text "p1"} (if
   282   the second introduction rule had more premises we have to do that for all
   254   the second introduction rule had more premises we have to do that for all
   283   of them). In order for this assumption to be applicable, the quantifiers
   255   of them). In order for this assumption to be applicable, the quantifiers
   284   need to be instantiated and then also the implications need to be resolved
   256   need to be instantiated and then also the implications need to be resolved
   285   with the other rules.
   257   with the other rules.
   286 
   258 
   287 
   259   Next we define the accessible part of a relation @{text R} given by
   288   As a final example, we define the accessible part of a relation @{text R} characterised 
   260   the single rule:
   289   by the introduction rule
   261 
   290   
       
   291   \begin{center}\small
   262   \begin{center}\small
   292   \mbox{\inferrule{@{term "\<And>y. R y x \<Longrightarrow> accpart R y"}}{@{term "accpart R x"}}}
   263   \mbox{\inferrule{@{term "\<And>y. R y x \<Longrightarrow> accpart R y"}}{@{term "accpart R x"}}}
   293   \end{center}
   264   \end{center}
   294 
   265 
   295   whose premise involves a universal quantifier and an implication. The
   266   The definition of @{text "accpart"} is:
   296   definition of @{text accpart} is:
       
   297 *}
   267 *}
   298 
   268 
   299 definition "accpart \<equiv> \<lambda>R x. \<forall>P. (\<forall>x. (\<forall>y. R y x \<longrightarrow> P y) \<longrightarrow> P x) \<longrightarrow> P x"
   269 definition "accpart \<equiv> \<lambda>R x. \<forall>P. (\<forall>x. (\<forall>y. R y x \<longrightarrow> P y) \<longrightarrow> P x) \<longrightarrow> P x"
   300 
   270 
   301 text {*
   271 text {*
   302   The proof of the induction principle is again straightforward.
   272   The proof of the induction principle is again straightforward and omitted.
   303 *}
   273   Proving the introduction rule is a little more complicated, because the 
   304 
   274   quantifier and the implication in the premise. The proof is as follows.
   305 lemma accpart_induct:
       
   306   assumes "accpart R x"
       
   307   shows "(\<And>x. (\<And>y. R y x \<Longrightarrow> P y) \<Longrightarrow> P x) \<Longrightarrow> P x"
       
   308 apply(atomize (full))
       
   309 apply(cut_tac prems)
       
   310 apply(unfold accpart_def)
       
   311 apply(drule spec[where x=P])
       
   312 apply(assumption)
       
   313 done
       
   314 
       
   315 text {*
       
   316   Proving the introduction rule is a little more complicated, because the quantifier
       
   317   and the implication in the premise. The proof is as follows.
       
   318 *}
   275 *}
   319 
   276 
   320 lemma %linenos accpartI: 
   277 lemma %linenos accpartI: 
   321   shows "(\<And>y. R y x \<Longrightarrow> accpart R y) \<Longrightarrow> accpart R x"
   278 shows "(\<And>y. R y x \<Longrightarrow> accpart R y) \<Longrightarrow> accpart R x"
   322 apply (unfold accpart_def)
   279 apply (unfold accpart_def)
   323 apply (rule allI impI)+
   280 apply (rule allI impI)+
   324 proof -
   281 proof -
   325   case (goal1 P)
   282   case (goal1 P)
   326   have p1: "\<And>y. R y x \<Longrightarrow> 
   283   have p1: "\<And>y. R y x \<Longrightarrow> 
   336       done
   293       done
   337   qed
   294   qed
   338 qed
   295 qed
   339 
   296 
   340 text {*
   297 text {*
   341   In Line 11, applying the assumption @{text "r1"} generates a goal state with
   298   As you can see, there are now two subproofs. The assumptions fall again into
   342   the new local assumption @{term "R y x"}, named @{text "r1_prem"} in the 
   299   two categories (Lines 7 to 9). In Line 11, applying the assumption @{text
   343   proof above (Line 14). This local assumption is used to solve
   300   "r1"} generates a goal state with the new local assumption @{term "R y x"},
   344   the goal @{term "P y"} with the help of assumption @{text "p1"}.
   301   named @{text "r1_prem"} in the second subproof (Line 14). This local assumption is
   345 
   302   used to solve the goal @{term "P y"} with the help of assumption @{text
   346   The point of these examples is to get a feeling what the automatic proofs 
   303   "p1"}.
   347   should do in order to solve all inductive definitions we throw at them.
   304 
   348   This is usually the first step in writing a package. We next explain
   305 
       
   306   \begin{exercise}
       
   307   Give the definition for the freshness predicate for lambda-terms. The rules
       
   308   for this predicate are:
       
   309   
       
   310   \begin{center}\small
       
   311   @{prop[mode=Rule] "a\<noteq>b \<Longrightarrow> fresh a (Var b)"}\hspace{5mm}
       
   312   @{prop[mode=Rule] "\<lbrakk>fresh a t; fresh a s\<rbrakk> \<Longrightarrow> fresh a (App t s)"}\\[2mm]
       
   313   @{prop[mode=Axiom] "fresh a (Lam a t)"}\hspace{5mm}
       
   314   @{prop[mode=Rule] "\<lbrakk>a\<noteq>b; fresh a t\<rbrakk> \<Longrightarrow> fresh a (Lam b t)"}
       
   315   \end{center}
       
   316 
       
   317   From the definition derive the induction principle and the introduction 
       
   318   rules. 
       
   319   \end{exercise}
       
   320 
       
   321   The point of all these examples is to get a feeling what the automatic
       
   322   proofs should do in order to solve all inductive definitions we throw at
       
   323   them.  This is usually the first step in writing a package. We next explain
   349   the parsing and typing part of the package.
   324   the parsing and typing part of the package.
   350 
   325 
   351 *}
   326 *}
   352 (*<*)end(*>*)
   327 (*<*)end(*>*)