Automatic derivation of generators