Knowledge retrieval as specialized inference (artificial intelligence, sorted logic)