A brief review of Lecture 19.
If the recursive step of $S$ includes multiple rules for constructing new elements from existing elements, then 
③ assume $P$ for the existing elements in every rule, and 
④ prove $P$ for the new element in every rule.
Ordinary induction is just structural induction applied to the recursively defined set of natural numbers!
$\rule{P(\Node); \forall L, R\in S. (P(L)\wedge P(R))\rightarrow P(\Tree(\Node,L,R))}{\forall x \in S. P(x)}$
How do we get $P(\Tree(\Node,\Tree(\Node, \Node,\Node)))$ from $P(\Node)$ and $\forall L,R\in S. (P(L)\wedge P(R))\rightarrow P(\Tree(\Node,L,R))$?
| 1. | First, we have $\forall L,R\in S. (P(L)\wedge P(R))\rightarrow P(\Tree(\Node,L,R))$ | |
| 2. | Next, we have $P(\Node)$. | $P(\Node)$ | 
| 3. | Intro $\wedge$ on 2 gives us $P(\Node)\wedge P(\Node)$. | $P(\Node)\wedge P(\Node)$ | 
| 4. | Elim $\forall$ on 1 gives us $(P(\Node)\wedge P(\Node))\rightarrow P(\Tree(\Node, \Node, \Node))$. | $\ \Downarrow_{\ (P(\Node)\wedge P(\Node))\rightarrow P(\Tree(\Node, \Node,\Node))}$ | 
| 5. | Modus Ponens on 3 and 4 gives us $P(\Tree(\Node, \Node,\Node))$. | $P(\Tree(\Node, \Node,\Node))$ | 
| 6. | Intro $\wedge$ on 2 and 5 gives us $P(\Node)\wedge P(\Tree(\Node, \Node,\Node))$. | $P(\Node)\wedge P(\Tree(\Node, \Node,\Node))$ | 
| 7. | Elim $\forall$ on 1 gives us $(P(\Node)\wedge P(\Tree(\Node, \Node,\Node))\rightarrow P(\Tree(\Node,\Tree(\Node, \Node, \Node)))$. | $\ \Downarrow_{\ (P(\Node)\wedge P(\Tree(\Node, \Node,\Node))\rightarrow P(\Tree(\Node,\Tree(\Node, \Node, \Node)))}$ | 
| 8. | Modus Ponens on 6 and 7 gives us $P(\Tree(\Node,\Tree(\Node, \Node, \Node)))$. | $P(\Tree(\Node,\Tree(\Node, \Node, \Node)))$ | 
Example proofs about recursively defined numbers, strings, and trees.
What object ($x$ or $y$) to do structural induction on?
Definition, examples, applications.
This just defines a recursive function definition for computing
the meaning of a regular expression:
grep, a Unix program that searches for patterns in a set of files.grep "311" *.md searches for the string “311” in all Markdown files in the current directory.grep to everyday programming.