Theory of mind and rule-based reasoning