Repair doctest code in TypeEncodingFunction
Eliminate duplicate elements in domain normalization
Add doctest testing for optimization in domain normalization