Processing math: 1%

Lecture 20: Inductive definitions

 

Inductively defined sets

An inductively defined set is a set where the elements are constructed by a finite number of applications of a given set of rules.

Examples:

BNF

Compact way of writing down inductively defined sets: BNF (Backus Naur Form)

Only the name of the set and the rules are written down; they are separated by a "::=", and the rules are separated by vertical bar (|).

Examples (from above):

Here, the variables to the left of the \in indicate metavariables. When the same characters appear in the rules on the right-hand side of the ::=, they indicate an arbitrary element of the set being defined. For example, the e_1 and e_2 in the e_1 + e_2 rule could be arbitrary elements of the set E, but + is just the symbol +.

Inductively defined functions

If X is an inductively defined set, you can define a function from X to Y by defining the function on each of the types of elements of X; i.e. for each of the rules. In the inductive rules (i.e. the ones containing the metavariable being defined), you can assume the function is already defined on the subterms.

Examples: