chore: unify add_halves and add_halves' (#14790) by generalizing to DivisionSemiring
add_halves
add_halves'
DivisionSemiring