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

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


    // If not variables remaining on the quantifier, then drop it
    if (variables.size() == 0) {
      return quantifiedAfterSubs;
    }

    return new QuantifiedSentence(sentence.getQuantifier(), variables,
        quantifiedAfterSubs);
  }
View Full Code Here


  }

  public Object visitQuantifiedSentence(QuantifiedSentence sentence,
      Object arg) {

    return new QuantifiedSentence(sentence.getQuantifier(),
        sentence.getVariables(), (Sentence) sentence.getQuantified()
            .accept(this, arg));
  }
View Full Code Here

      }
    }

    // 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 visitQuantifiedSentence(QuantifiedSentence sentence,
      Object arg) {

    return new QuantifiedSentence(sentence.getQuantifier(),
        sentence.getVariables(), (Sentence) sentence.getQuantified()
            .accept(this, arg));
  }
View Full Code Here

    // names are tracked
    seenSoFar.addAll(replVariables);

    Sentence sQuantified = (Sentence) subst.accept(this, arg);

    return new QuantifiedSentence(sentence.getQuantifier(), replVariables,
        sQuantified);
  }
View Full Code Here

  @Test
  public void testQuantifiedSentenceWithSingleVariable() {
    Sentence qs = parser.parse("FORALL x  King(x)");
    List<Variable> vars = new ArrayList<Variable>();
    vars.add(new Variable("x"));
    Assert.assertEquals(qs, new QuantifiedSentence("FORALL", vars,
        getKingPredicate(new Variable("x"))));
  }
View Full Code Here

    vars.add(new Variable("y"));
    ConnectedSentence cse = new ConnectedSentence("AND",
        getKingPredicate(new Variable("x")), new TermEquality(
            getBrotherOfFunction(new Variable("x")), new Variable(
                "y")));
    Assert.assertEquals(qs, new QuantifiedSentence("EXISTS", vars, cse));
  }
View Full Code Here

    vars.add(new Variable("y"));
    ConnectedSentence cse = new ConnectedSentence("AND",
        getKingPredicate(new Variable("x")), new TermEquality(
            getBrotherOfFunction(new Variable("x")), new Variable(
                "y")));
    Assert.assertEquals(qs, new QuantifiedSentence("EXISTS", vars, cse));
  }
View Full Code Here

    // If not variables remaining on the quantifier, then drop it
    if (variables.size() == 0) {
      return quantifiedAfterSubs;
    }

    return new QuantifiedSentence(sentence.getQuantifier(), variables,
        quantifiedAfterSubs);
  }
View Full Code Here

  }

  public Object visitQuantifiedSentence(QuantifiedSentence sentence,
      Object arg) {

    return new QuantifiedSentence(sentence.getQuantifier(),
        sentence.getVariables(), (Sentence) sentence.getQuantified()
            .accept(this, arg));
  }
View Full Code Here

TOP

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

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.