Esempio n. 1
0
 /**
  * Inference between a compound term and a statement
  *
  * @param compound The compound term
  * @param index The location of the current term in the compound
  * @param statement The statement
  * @param side The location of the current term in the statement
  * @param beliefTerm The content of the belief
  * @param memory Reference to the memory
  */
 private static void compoundAndStatement(
     CompoundTerm compound,
     short index,
     Statement statement,
     short side,
     Term beliefTerm,
     Memory memory) {
   Term component = compound.componentAt(index);
   Task task = memory.currentTask;
   if (component.getClass() == statement.getClass()) {
     if ((compound instanceof Conjunction) && (memory.currentBelief != null)) {
       if (Variable.unify(Symbols.VAR_DEPENDENT, component, statement, compound, statement)) {
         SyllogisticRules.elimiVarDep(compound, component, statement.equals(beliefTerm), memory);
       } else if (task.getSentence().isJudgment()) {
         CompositionalRules.introVarInner(statement, (Statement) component, compound, memory);
       }
     }
   } else {
     if (!task.isStructural() && task.getSentence().isJudgment()) {
       if (statement instanceof Inheritance) {
         StructuralRules.structuralCompose1(compound, index, statement, memory);
         //                    if (!(compound instanceof SetExt) && !(compound instanceof SetInt))
         // {
         if (!(compound instanceof SetExt
             || compound instanceof SetInt
             || compound instanceof Negation)) {
           StructuralRules.structuralCompose2(compound, index, statement, side, memory);
         } // {A --> B, A @ (A&C)} |- (A&C) --> (B&C)
       } else if ((statement instanceof Similarity) && !(compound instanceof Conjunction)) {
         StructuralRules.structuralCompose2(compound, index, statement, side, memory);
       } // {A <-> B, A @ (A&C)} |- (A&C) <-> (B&C)
     }
   }
 }