section ‹Nested datatypes› theory Nested_Datatype imports Main begin subsection ‹Terms and substitution›