Implement basic inference functions.