more error checks on duplicate identifiers
Added compile-time check to make sure derivations have finite length