Example 1. Adapted from Hofstadter, 178