equal
deleted
inserted
replaced
727 primrec_new sum_btree :: "('a\<Colon>plus) btree \<Rightarrow> 'a" where |
727 primrec_new sum_btree :: "('a\<Colon>plus) btree \<Rightarrow> 'a" where |
728 "sum_btree (BNode a lt rt) = |
728 "sum_btree (BNode a lt rt) = |
729 a + the_default Zero (option_map sum_btree lt) + |
729 a + the_default Zero (option_map sum_btree lt) + |
730 the_default Zero (option_map sum_btree rt)" |
730 the_default Zero (option_map sum_btree rt)" |
731 |
731 |
|
732 text {* |
|
733 Show example with function composition (ftree). |
|
734 *} |
732 |
735 |
733 subsubsection {* Nested-as-Mutual Recursion *} |
736 subsubsection {* Nested-as-Mutual Recursion *} |
734 |
737 |
735 text {* |
738 text {* |
736 * can pretend a nested type is mutually recursive |
739 * can pretend a nested type is mutually recursive (if purely inductive) |
737 * avoids the higher-order map |
740 * avoids the higher-order map |
738 * e.g. |
741 * e.g. |
739 *} |
742 *} |
740 |
743 |
741 primrec_new |
744 primrec_new |
992 text {* |
995 text {* |
993 More examples in \verb|~~/src/HOL/BNF/Basic_BNFs.thy| and |
996 More examples in \verb|~~/src/HOL/BNF/Basic_BNFs.thy| and |
994 \verb|~~/src/HOL/BNF/More_BNFs.thy|. |
997 \verb|~~/src/HOL/BNF/More_BNFs.thy|. |
995 |
998 |
996 Mention distinction between live and dead type arguments; |
999 Mention distinction between live and dead type arguments; |
|
1000 * and existence of map, set for those |
997 mention =>. |
1001 mention =>. |
998 *} |
1002 *} |
999 |
1003 |
1000 |
1004 |
1001 subsection {* Syntax |
1005 subsection {* Syntax |