Wrote pseudocode for derive_rules().