Conditional Learning of Rules and Plans by Knowledge Exchange in Logical Agents