SMS: The logic of categorial grammars