Beispiel #1
0
 def _attempt_proof_n_all(
     self, current, context, agenda, accessible_vars, atoms, debug
 ):
     agenda[Categories.EXISTS].add(
         (ExistsExpression(current.term.variable, -current.term.term), context)
     )
     return self._attempt_proof(agenda, accessible_vars, atoms, debug + 1)
Beispiel #2
0
class Constants(object):
    ALL = 'ALL'
    EXISTS = 'EXISTS'
    NOT = 'NOT'
    AND = 'AND'
    OR = 'OR'
    IMP = 'IMP'
    IFF = 'IFF'
    PRED = 'PRED'
    LEQ = 'LEQ'
    HOLE = 'HOLE'
    LABEL = 'LABEL'

    MAP = {ALL: lambda v,e: AllExpression(v.variable, e),
           EXISTS: lambda v,e: ExistsExpression(v.variable, e),
           NOT: NegatedExpression,
           AND: AndExpression,
           OR: OrExpression,
           IMP: ImpExpression,
           IFF: IffExpression,
           PRED: ApplicationExpression}
Beispiel #3
0
class Constants(object):
    ALL = "ALL"
    EXISTS = "EXISTS"
    NOT = "NOT"
    AND = "AND"
    OR = "OR"
    IMP = "IMP"
    IFF = "IFF"
    PRED = "PRED"
    LEQ = "LEQ"
    HOLE = "HOLE"
    LABEL = "LABEL"

    MAP = {
        ALL: lambda v, e: AllExpression(v.variable, e),
        EXISTS: lambda v, e: ExistsExpression(v.variable, e),
        NOT: NegatedExpression,
        AND: AndExpression,
        OR: OrExpression,
        IMP: ImpExpression,
        IFF: IffExpression,
        PRED: ApplicationExpression,
    }
Beispiel #4
0
    def fol(self):
        if self.consequent:
            accum = None
            if self.conds:
                accum = reduce(AndExpression, [c.fol() for c in self.conds])

            if accum:
                accum = ImpExpression(accum, self.consequent.fol())
            else:
                accum = self.consequent.fol()

            for ref in self.refs[::-1]:
                accum = AllExpression(ref, accum)

            return accum

        else:
            if not self.conds:
                raise Exception("Cannot convert DRS with no conditions to FOL.")
            accum = reduce(AndExpression, [c.fol() for c in self.conds])
            for ref in map(Variable, self._order_ref_strings(self.refs)[::-1]):
                accum = ExistsExpression(ref, accum)
            return accum