Program: 166830
Project: 166830
Buggy source:
/** 
 * Equivalent transformation between products and images when the subject is a compound {<(*, S, M) --> P>, S@(*, S, M)} |- <S --> (/, P, _, M)> {<S --> (/, P, _, M)>, P@(/, P, _, M)} |- <(*, S, M) --> P> {<S --> (/, P, _, M)>, M@(/, P, _, M)} |- <M --> (/, P, S, _)>
 * @param subject The subject term
 * @param predicate The predicate term
 * @param memory Reference to the memory
 */
private static void transformSubjectPI(CompoundTerm subject,Term predicate,Memory memory){
  TruthValue truth=memory.currentTask.getSentence().getTruth();
  BudgetValue budget;
  Inheritance inheritance;
  Term newSubj, newPred;
  if (subject instanceof Product) {
    Product product=(Product)subject;
    for (short i=0; i < product.size(); i++) {
      newSubj=product.componentAt(i);
      newPred=ImageExt.make(product,predicate,i,memory);
      inheritance=Inheritance.make(newSubj,newPred,memory);
      if (inheritance != null) {
        if (truth == null) {
          budget=BudgetFunctions.compoundBackward(inheritance,memory);
        }
 else {
          budget=BudgetFunctions.compoundForward(truth,inheritance,memory);
        }
        memory.singlePremiseTask(inheritance,truth,budget);
      }
    }
  }
 else   if (subject instanceof ImageInt) {
    ImageInt image=(ImageInt)subject;
    int relationIndex=image.getRelationIndex();
    for (short i=0; i < image.size(); i++) {
      if (i == relationIndex) {
        newSubj=image.componentAt(relationIndex);
        newPred=Product.make(image,predicate,relationIndex,memory);
      }
 else {
        newSubj=ImageInt.make((ImageInt)image,predicate,i,memory);
        newPred=image.componentAt(i);
      }
      inheritance=Inheritance.make(newSubj,newPred,memory);
      if (truth == null) {
        budget=BudgetFunctions.compoundBackward(inheritance,memory);
      }
 else {
        budget=BudgetFunctions.compoundForward(truth,inheritance,memory);
      }
      memory.singlePremiseTask(inheritance,truth,budget);
    }
  }
}

Fixed version (ground truth):
/** 
 * Equivalent transformation between products and images when the subject is a compound {<(*, S, M) --> P>, S@(*, S, M)} |- <S --> (/, P, _, M)> {<S --> (/, P, _, M)>, P@(/, P, _, M)} |- <(*, S, M) --> P> {<S --> (/, P, _, M)>, M@(/, P, _, M)} |- <M --> (/, P, S, _)>
 * @param subject The subject term
 * @param predicate The predicate term
 * @param memory Reference to the memory
 */
private static void transformSubjectPI(CompoundTerm subject,Term predicate,Memory memory){
  TruthValue truth=memory.currentTask.getSentence().getTruth();
  BudgetValue budget;
  Inheritance inheritance;
  Term newSubj, newPred;
  if (subject instanceof Product) {
    Product product=(Product)subject;
    for (short i=0; i < product.size(); i++) {
      newSubj=product.componentAt(i);
      newPred=ImageExt.make(product,predicate,i,memory);
      inheritance=Inheritance.make(newSubj,newPred,memory);
      if (inheritance != null) {
        if (truth == null) {
          budget=BudgetFunctions.compoundBackward(inheritance,memory);
        }
 else {
          budget=BudgetFunctions.compoundForward(truth,inheritance,memory);
        }
        memory.singlePremiseTask(inheritance,truth,budget);
      }
    }
  }
 else   if (subject instanceof ImageInt) {
    ImageInt image=(ImageInt)subject;
    int relationIndex=image.getRelationIndex();
    for (short i=0; i < image.size(); i++) {
      if (i == relationIndex) {
        newSubj=image.componentAt(relationIndex);
        newPred=Product.make(image,predicate,relationIndex,memory);
      }
 else {
        newSubj=ImageInt.make((ImageInt)image,predicate,i,memory);
        newPred=image.componentAt(i);
      }
      inheritance=Inheritance.make(newSubj,newPred,memory);
      if (inheritance != null) {
        if (truth == null) {
          budget=BudgetFunctions.compoundBackward(inheritance,memory);
        }
 else {
          budget=BudgetFunctions.compoundForward(truth,inheritance,memory);
        }
        memory.singlePremiseTask(inheritance,truth,budget);
      }
    }
  }
}