def show_used_relations(self, clauses, both=False):
     self.current_concept_graph.clear_edges()
     rels = self.current_concept_graph.g.relations
     used = set(
         il.normalize_symbol(s)
         for s in lu.used_constants(clauses.to_formula()))
     for rel in rels:
         fmla = rel.formula
         if any(c in used and not c.name.startswith('@')
                for c in lu.used_constants(fmla)):
             self.current_concept_graph.show_relation(rel,
                                                      '+',
                                                      update=False)
             if both and not il.is_enumerated(fmla):
                 self.current_concept_graph.show_relation(rel,
                                                          '-',
                                                          update=False)
     need_update_relations = False
     for app in ilu.apps_clauses(clauses):
         if len(app.args) == 3 and il.is_numeral(app.args[0]):
             fmla = app.rep(app.args[0], il.Variable('X', app.args[1].sort),
                            il.Variable('Y', app.args[2].sort))
             concept = self.current_concept_graph.g.formula_to_concept(fmla)
             self.current_concept_graph.g.new_relation(concept)
             need_update_relations = True
             self.current_concept_graph.show_relation(concept,
                                                      '+',
                                                      update=False)
             if both:
                 self.current_concept_graph.show_relation(concept,
                                                          '-',
                                                          update=False)
     if need_update_relations:
         self.current_concept_graph.update_relations()
     self.current_concept_graph.update()
Beispiel #2
0
 def show_used_relations(self,clauses,both=False):
     self.current_concept_graph.clear_edges()
     rels = self.current_concept_graph.g.relations
     used = set(il.normalize_symbol(s) for s in lu.used_constants(clauses.to_formula()))
     for rel in rels:
         if any(c in used and not c.name.startswith('@')
                for c in lu.used_constants(rel.formula)):
             self.current_concept_graph.show_relation(rel,'+',update=False)
             if both:
                 self.current_concept_graph.show_relation(rel,'-',update=False)
     need_update_relations = False
     for app in ilu.apps_clauses(clauses):
         if len(app.args) == 3 and il.is_numeral(app.args[0]):
             fmla = app.rep(app.args[0],il.Variable('X',app.args[1].sort),il.Variable('Y',app.args[2].sort))
             concept = self.current_concept_graph.g.formula_to_concept(fmla)
             self.current_concept_graph.g.new_relation(concept)
             need_update_relations = True
             self.current_concept_graph.show_relation(concept,'+',update=False)
             if both:
                 self.current_concept_graph.show_relation(concept,'-',update=False)
     if need_update_relations:
         self.current_concept_graph.update_relations()
     self.current_concept_graph.update()
Beispiel #3
0
def is_numeral_concept(c):
    return (len(c.variables) == 1 and il.is_eq(c.formula) and isinstance(c.formula.args[0],il.Variable) and
            il.is_numeral(c.formula.args[1]))
Beispiel #4
0
def is_numeral_concept(c):
    return (len(c.variables) == 1 and il.is_eq(c.formula)
            and isinstance(c.formula.args[0], il.Variable)
            and il.is_numeral(c.formula.args[1]))