def extra_concepts(self): tn = self.text_name() X, Y = self.variable('X'), self.variable('Y') c = [ Literal(1, Atom(tn, [X])), ~eq_lit(X, Y), Literal(1, Atom(tn, [Y])) ] cs = [ProductSpace([NamedSpace(x) for x in c])] w = get_witness(self) if w: cls = [[~lit, eq_lit(X, w)] for lit in self.fmla] cs += [ProductSpace([NamedSpace(x) for x in c]) for c in cls] return cs
def clauses_to_concept(name, clauses): vars = used_variables_clauses(clauses) ps = [ ProductSpace([NamedSpace(~lit) for lit in clause]) for clause in clauses ] ss = ps[0] if len(ps) == 1 else SumSpace(ps) return (Atom(name, vars), ss)
def relation_concepts(self, relations): rcons = [r.to_concept_space() for r in relations] rprods = [ ProductSpace([ NamedSpace(x) for x in [ node_concept(r.sorts[0], 'X'), Literal(1, cs[0]), node_concept(r.sorts[1], 'Y') ] ]) for (r, cs) in zip(relations, rcons) ] rsp = to_atom('__rsp(X,Y)'), SumSpace(rprods) return rcons + [rsp]
def p_expr_prod(p): 'expr : prod' p[0] = ProductSpace(p[1])
def to_concept_space(self): return Atom(self.text_name(), [self.variable('X')]), ProductSpace( [NamedSpace(x) for x in self.fmla])