Example #1
0
 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
Example #2
0
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)
Example #3
0
 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]
Example #4
0
def p_expr_prod(p):
    'expr : prod'
    p[0] = ProductSpace(p[1])
Example #5
0
 def to_concept_space(self):
     return Atom(self.text_name(), [self.variable('X')]), ProductSpace(
         [NamedSpace(x) for x in self.fmla])