src/Doc/Prog_Prove/Types_and_funs.thy
changeset 68919 027219002f32
parent 67613 ce654b0e6d69
child 68921 35ea237696cf
equal deleted inserted replaced
68916:2a1583baaaa0 68919:027219002f32
   536 Method @{text auto} can be modified in exactly the same way.
   536 Method @{text auto} can be modified in exactly the same way.
   537 The modifier \indexed{@{text "split:"}}{split} can be followed by multiple names.
   537 The modifier \indexed{@{text "split:"}}{split} can be followed by multiple names.
   538 Splitting if or case-expressions in the assumptions requires 
   538 Splitting if or case-expressions in the assumptions requires 
   539 @{text "split: if_splits"} or @{text "split: t.splits"}.
   539 @{text "split: if_splits"} or @{text "split: t.splits"}.
   540 
   540 
       
   541 \ifsem\else
       
   542 \subsection{Converting Numerals to @{const Suc} Terms}
       
   543 
       
   544 Recursive functions on type @{typ nat} are often defined by pattern matching over @{text 0} and @{const Suc},
       
   545 e.g. @{text "f 0 = ..."} and  @{text "f (Suc n) = ..."}. In order to simplify \<open>f 2\<close>, the \<open>2\<close>
       
   546 needs to be converted to @{term "Suc(Suc 0)"} first. The simplification rule @{thm[source] numeral_eq_Suc}
       
   547 converts all numerals to @{const Suc} terms.
       
   548 \fi
   541 
   549 
   542 \subsection*{Exercises}
   550 \subsection*{Exercises}
   543 
   551 
   544 \exercise\label{exe:tree0}
   552 \exercise\label{exe:tree0}
   545 Define a datatype @{text tree0} of binary tree skeletons which do not store
   553 Define a datatype @{text tree0} of binary tree skeletons which do not store