Query-driven PAC-Learning for Reasoning