Unified theory of cognition