[impl] partition_typed helper function
[impl] apply distributivity to terms of sum