Implement basic mathematical primitives.

Also outlined the basic boolean primitives but no impl yet.