minor fix to algebraic solver
added some rewrites and abstraction work