The logic of cognitive systems