Package aima.core.logic.fol.parsing.ast

Examples of aima.core.logic.fol.parsing.ast.NotSentence


    for (Clause c : KB.getAllClauses()) {
      c = KB.standardizeApart(c);
      c.setStandardizedApartCheckNotRequired();
      clauses.addAll(c.getFactors());
    }
    Sentence notAlpha = new NotSentence(alpha);
    // Want to use an answer literal to pull
    // query variables where necessary
    Literal answerLiteral = KB.createAnswerLiteral(notAlpha);
    Set<Variable> answerLiteralVariables = KB
        .collectAllVariables(answerLiteral.getAtomicSentence());
View Full Code Here


  }

  public Object visitNotSentence(NotSentence notSentence, Object arg) {
    Sentence negated = notSentence.getNegated();

    return new NotSentence((Sentence) negated.accept(this, arg));
  }
View Full Code Here

    // Eliminate <=>, bi-conditional elimination,
    // replace (alpha <=> beta) with (~alpha V beta) ^ (alpha V ~beta).
    if (Connectors.isBICOND(sentence.getConnector())) {
      Sentence first = new ConnectedSentence(Connectors.OR,
          new NotSentence(alpha), beta);
      Sentence second = new ConnectedSentence(Connectors.OR, alpha,
          new NotSentence(beta));

      return new ConnectedSentence(Connectors.AND, first, second);
    }

    // Eliminate =>, implication elimination,
    // replacing (alpha => beta) with (~alpha V beta)
    if (Connectors.isIMPLIES(sentence.getConnector())) {
      return new ConnectedSentence(Connectors.OR, new NotSentence(alpha),
          beta);
    }

    return new ConnectedSentence(sentence.getConnector(), alpha, beta);
  }
View Full Code Here

    }
    return new Function(function.getFunctionName(), newTerms);
  }

  public Object visitNotSentence(NotSentence sentence, Object arg) {
    return new NotSentence((Sentence) sentence.getNegated().accept(this,
        arg));
  }
View Full Code Here

      Sentence alpha = negConnected.getFirst();
      Sentence beta = negConnected.getSecond();
      // ~(alpha ^ beta) equivalent to (~alpha V ~beta) (De Morgan)
      if (Connectors.isAND(negConnected.getConnector())) {
        // I need to ensure the ~s are moved in deeper
        Sentence notAlpha = (Sentence) (new NotSentence(alpha)).accept(
            this, arg);
        Sentence notBeta = (Sentence) (new NotSentence(beta)).accept(
            this, arg);
        return new ConnectedSentence(Connectors.OR, notAlpha, notBeta);
      }

      // ~(alpha V beta) equivalent to (~alpha ^ ~beta) (De Morgan)
      if (Connectors.isOR(negConnected.getConnector())) {
        // I need to ensure the ~s are moved in deeper
        Sentence notAlpha = (Sentence) (new NotSentence(alpha)).accept(
            this, arg);
        Sentence notBeta = (Sentence) (new NotSentence(beta)).accept(
            this, arg);
        return new ConnectedSentence(Connectors.AND, notAlpha, notBeta);
      }
    }

    // in addition, rules for negated quantifiers:
    if (negated instanceof QuantifiedSentence) {
      QuantifiedSentence negQuantified = (QuantifiedSentence) negated;
      // I need to ensure the ~ is moved in deeper
      Sentence notP = (Sentence) (new NotSentence(
          negQuantified.getQuantified())).accept(this, arg);

      // ~FORALL x p becomes EXISTS x ~p
      if (Quantifiers.isFORALL(negQuantified.getQuantifier())) {
        return new QuantifiedSentence(Quantifiers.EXISTS,
            negQuantified.getVariables(), notP);
      }

      // ~EXISTS x p becomes FORALL x ~p
      if (Quantifiers.isEXISTS(negQuantified.getQuantifier())) {
        return new QuantifiedSentence(Quantifiers.FORALL,
            negQuantified.getVariables(), notP);
      }
    }

    return new NotSentence((Sentence) negated.accept(this, arg));
  }
View Full Code Here

  public Object visitFunction(Function function, Object arg) {
    return function;
  }

  public Object visitNotSentence(NotSentence sentence, Object arg) {
    return new NotSentence((Sentence) sentence.getNegated().accept(this,
        arg));
  }
View Full Code Here

  public Object visitFunction(Function function, Object arg) {
    return function;
  }

  public Object visitNotSentence(NotSentence sentence, Object arg) {
    return new NotSentence((Sentence) sentence.getNegated().accept(this,
        arg));
  }
View Full Code Here

    return new TermEquality(term1, term2);
  }

  public Sentence parseNotSentence() {
    match("NOT");
    return new NotSentence(parseSentence());
  }
View Full Code Here

  public Object visitFunction(Function function, Object arg) {
    return function;
  }

  public Object visitNotSentence(NotSentence sentence, Object arg) {
    return new NotSentence((Sentence) sentence.getNegated().accept(this,
        arg));
  }
View Full Code Here

TOP

Related Classes of aima.core.logic.fol.parsing.ast.NotSentence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.