A Logic Framework for the Incremental Inductive Synthesis of Datalog Theories