def complete(self, implications): for o in self.objects: xintent = self.x_context.get_object_intent(o) new_xintent = closure(xintent, implications) qintent = self.q_context.get_object_intent(o) if not new_xintent <= qintent: # TODO: undo the modifications raise ValueError( 'implications are inconsistent with the partial context') self.x_context.set_object_intent(new_xintent, o) new_qintent = set([ a for a in qintent if a in new_xintent or closure(new_xintent | set([a]), implications) <= qintent ]) self.q_context.set_object_intent(new_qintent, o) # TODO: Remove printing if xintent != new_xintent or qintent != new_qintent: print 'Object', o print self._intent_to_str(xintent, qintent) print 'completed to ' print self._intent_to_str(new_xintent, new_qintent)
def complete(self, implications): for o in self.objects: xintent = self.x_context.get_object_intent(o) new_xintent = closure(xintent, implications) qintent = self.q_context.get_object_intent(o) if not new_xintent <= qintent: # TODO: undo the modifications raise ValueError( 'implications are inconsistent with the partial context') self.x_context.set_object_intent(new_xintent, o) new_qintent = set([a for a in qintent if a in new_xintent or closure(new_xintent | {a}, implications) <= qintent ]) self.q_context.set_object_intent(new_qintent, o) # TODO: Remove printing if xintent != new_xintent or qintent != new_qintent: print('Object', o) print(self._intent_to_str(xintent, qintent)) print('completed to ') print(self._intent_to_str(new_xintent, new_qintent))
def provide_counterexample(self, imp): return (str(imp.premise), closure(imp.premise, self.basis))
def is_valid(self, imp): return imp.conclusion <= closure(imp.premise, self.basis)