Add forward propagation

This PR adds forward type propagation, as well as fixing a few bugs around recursive defintions.