Program: 166677
Project: 166677
Buggy source:
/** 
 * {<S ==> M>, <P ==> M>} |- {<(S|P) ==> M>, <(S&P) ==> M>, <(S-P) ==> M>, <(P-S) ==> M>}
 * @param taskSentence The first premise
 * @param belief The second premise
 * @param index The location of the shared term
 * @param nal Reference to the memory
 */
static void composeCompound(final Statement taskContent,final Statement beliefContent,final int index,final DerivationContext nal){
  if ((!nal.getCurrentTask().sentence.isJudgment()) || (taskContent.getClass() != beliefContent.getClass())) {
    return;
  }
  final Term componentT=taskContent.term[1 - index];
  final Term componentB=beliefContent.term[1 - index];
  final Term componentCommon=taskContent.term[index];
  final int order1=taskContent.getTemporalOrder();
  final int order2=beliefContent.getTemporalOrder();
  final int order=TemporalRules.composeOrder(order1,order2);
  if (order == TemporalRules.ORDER_INVALID) {
    return;
  }
  if ((componentT instanceof CompoundTerm) && ((CompoundTerm)componentT).containsAllTermsOf(componentB)) {
    decomposeCompound((CompoundTerm)componentT,componentB,componentCommon,index,true,order,nal);
    return;
  }
 else   if ((componentB instanceof CompoundTerm) && ((CompoundTerm)componentB).containsAllTermsOf(componentT)) {
    decomposeCompound((CompoundTerm)componentB,componentT,componentCommon,index,false,order,nal);
    return;
  }
  final TruthValue truthT=nal.getCurrentTask().sentence.truth;
  final TruthValue truthB=nal.getCurrentBelief().truth;
  final TruthValue truthOr=union(truthT,truthB);
  final TruthValue truthAnd=intersection(truthT,truthB);
  TruthValue truthDif=null;
  Term termOr=null;
  Term termAnd=null;
  Term termDif=null;
  if (index == 0) {
    if (taskContent instanceof Inheritance) {
      termOr=IntersectionInt.make(componentT,componentB);
      termAnd=IntersectionExt.make(componentT,componentB);
      if (truthB.isNegative()) {
        if (!truthT.isNegative()) {
          termDif=DifferenceExt.make(componentT,componentB);
          truthDif=intersection(truthT,negation(truthB));
        }
      }
 else       if (truthT.isNegative()) {
        termDif=DifferenceExt.make(componentB,componentT);
        truthDif=intersection(truthB,negation(truthT));
      }
    }
 else     if (taskContent instanceof Implication) {
      termOr=Disjunction.make(componentT,componentB);
      termAnd=Conjunction.make(componentT,componentB);
    }
    processComposed(taskContent,componentCommon,termOr,order,truthOr,nal);
    processComposed(taskContent,componentCommon,termAnd,order,truthAnd,nal);
    processComposed(taskContent,componentCommon,termDif,order,truthDif,nal);
  }
 else {
    if (taskContent instanceof Inheritance) {
      termOr=IntersectionExt.make(componentT,componentB);
      termAnd=IntersectionInt.make(componentT,componentB);
      if (truthB.isNegative()) {
        if (!truthT.isNegative()) {
          termDif=DifferenceInt.make(componentT,componentB);
          truthDif=intersection(truthT,negation(truthB));
        }
      }
 else       if (truthT.isNegative()) {
        termDif=DifferenceInt.make(componentB,componentT);
        truthDif=intersection(truthB,negation(truthT));
      }
    }
 else     if (taskContent instanceof Implication) {
      termOr=Conjunction.make(componentT,componentB);
      termAnd=Disjunction.make(componentT,componentB);
    }
    processComposed(taskContent,termOr,componentCommon,order,truthOr,nal);
    processComposed(taskContent,termAnd,componentCommon,order,truthAnd,nal);
    processComposed(taskContent,termDif,componentCommon,order,truthDif,nal);
  }
}

Fixed version (ground truth):
/** 
 * {<S ==> M>, <P ==> M>} |- {<(S|P) ==> M>, <(S&P) ==> M>, <(S-P) ==> M>, <(P-S) ==> M>}
 * @param taskSentence The first premise
 * @param belief The second premise
 * @param index The location of the shared term
 * @param nal Reference to the memory
 */
static void composeCompound(final Statement taskContent,final Statement beliefContent,final int index,final DerivationContext nal){
  if ((!nal.getCurrentTask().sentence.isJudgment()) || (taskContent.getClass() != beliefContent.getClass())) {
    return;
  }
  final Term componentT=taskContent.term[1 - index];
  final Term componentB=beliefContent.term[1 - index];
  final Term componentCommon=taskContent.term[index];
  final int order1=taskContent.getTemporalOrder();
  final int order2=beliefContent.getTemporalOrder();
  final int order=TemporalRules.composeOrder(order1,order2);
  if (order == TemporalRules.ORDER_INVALID) {
    return;
  }
  if ((componentT instanceof CompoundTerm) && ((CompoundTerm)componentT).containsAllTermsOf(componentB)) {
    decomposeCompound((CompoundTerm)componentT,componentB,componentCommon,index,true,order,nal);
    return;
  }
 else   if ((componentB instanceof CompoundTerm) && ((CompoundTerm)componentB).containsAllTermsOf(componentT)) {
    decomposeCompound((CompoundTerm)componentB,componentT,componentCommon,index,false,order,nal);
    return;
  }
  final TruthValue truthT=nal.getCurrentTask().sentence.truth;
  final TruthValue truthB=nal.getCurrentBelief().truth;
  final TruthValue truthOr=union(truthT,truthB);
  final TruthValue truthAnd=intersection(truthT,truthB);
  TruthValue truthDif=null;
  Term termOr=null;
  Term termAnd=null;
  Term termDif=null;
  if (index == 0) {
    if (taskContent instanceof Inheritance) {
      termOr=IntersectionInt.make(componentT,componentB);
      termAnd=IntersectionExt.make(componentT,componentB);
      if (truthB.isNegative()) {
        if (!truthT.isNegative()) {
          termDif=DifferenceExt.make(componentT,componentB);
          truthDif=intersection(truthT,negation(truthB));
        }
      }
 else       if (truthT.isNegative()) {
        termDif=DifferenceExt.make(componentB,componentT);
        truthDif=intersection(truthB,negation(truthT));
      }
    }
 else     if (taskContent instanceof Implication) {
      termOr=Disjunction.make(componentT,componentB);
      termAnd=Conjunction.make(componentT,componentB);
    }
    if (!(componentT.cloneDeep().equals(componentB.cloneDeep()))) {
      processComposed(taskContent,componentCommon,termOr,order,truthOr,nal);
      processComposed(taskContent,componentCommon,termAnd,order,truthAnd,nal);
    }
    processComposed(taskContent,componentCommon,termDif,order,truthDif,nal);
  }
 else {
    if (taskContent instanceof Inheritance) {
      termOr=IntersectionExt.make(componentT,componentB);
      termAnd=IntersectionInt.make(componentT,componentB);
      if (truthB.isNegative()) {
        if (!truthT.isNegative()) {
          termDif=DifferenceInt.make(componentT,componentB);
          truthDif=intersection(truthT,negation(truthB));
        }
      }
 else       if (truthT.isNegative()) {
        termDif=DifferenceInt.make(componentB,componentT);
        truthDif=intersection(truthB,negation(truthT));
      }
    }
 else     if (taskContent instanceof Implication) {
      termOr=Conjunction.make(componentT,componentB);
      termAnd=Disjunction.make(componentT,componentB);
    }
    if (!(componentT.cloneDeep().equals(componentB.cloneDeep()))) {
      processComposed(taskContent,termOr,componentCommon,order,truthOr,nal);
      processComposed(taskContent,termAnd,componentCommon,order,truthAnd,nal);
    }
    processComposed(taskContent,termDif,componentCommon,order,truthDif,nal);
  }
}