Abstract

This chapter introduces inductively defined sets and simple inductive data types such as natural numbers, words, lists and trees with emphasis on definition patterns. For these sets and data types, recursive equations in Backus-Naur form are introduced and it is shown how, e.g., propositional formulae and simple while programs can be specified in this format. Next it is explained how functions can be defined inductively on such sets and data types. Examples include the factorial function, Harmonic numbers, Fibonacci numbers, addition and multiplication on natural numbers and functions that compute the length of a word or list and the height of a tree. In contrast, recursive functions are defined in a way that does not necessarily lead to terminating evaluations. Recursive procedures are also described, with examples presented of various sorting algorithms and the Towers of Hanoi puzzle.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.