Program: 73636
Project: 73636
Buggy source:
/** 
 * Return the monotonicity of the conditional being analyzed given a few extra assumptions.  The if statement must be of the form: (x <= c) ? e1 : e2 where both e1 and e2 are montonic, and c is a constant. If these assumptions are not met, this function may return an unsound analysis. Note that this function performs an analysis that is approximately equivalent to the ifc analysis of "Static Monotonicity Analysis for lambda-definable Functions over Lattices" (Murawski and Yi, 2002), except that that analysis is unsound.  This analysis is a corrected form of that one.
 * @param constant The constant c.
 * @return Monotonic, if the function is monotonic.Nonmonotonic, otherwise.
 * @exception IllegalActionException If there is a problemevaluating the subexpressions of the conditional.
 */
private Concept _specialIfAnalysis(Concept constant) throws IllegalActionException {
  MonotonicityCounterexamples toCheck=_nodeToCounterexamples.get(_ifNode.jjtGetChild(2));
  if (toCheck == null) {
    toCheck=new MonotonicityCounterexamples();
  }
  ConceptGraph inputLattice=_domainOntology.getGraph();
  List downsetList=Arrays.asList(inputLattice.downSet(constant));
  List<Concept> downset=(List<Concept>)downsetList;
  for (  Concept b : downset) {
    for (    Concept d : b.getStrictDominators()) {
      if (downset.contains(d)) {
        continue;
      }
      toCheck.add(b,d);
    }
  }
  MonotonicityCounterexamples counterexamples=new MonotonicityCounterexamples();
  for (  MonotonicityCounterexamples.ConceptPair pair : toCheck.entrySet()) {
    Concept fb=_evaluateChild(1,pair.getKey());
    Concept fd=_evaluateChild(2,pair.getValue());
    if (!fd.isAboveOrEqualTo(fb)) {
      counterexamples.add(pair.getKey(),pair.getValue());
    }
  }
  if (counterexamples.containsCounterexamples()) {
    _nodeToCounterexamples.put(_ifNode,counterexamples);
    return _nonmonotonicConcept;
  }
 else {
    return _monotonicConcept;
  }
}

Fixed version (ground truth):
/** 
 * Return the monotonicity of the conditional being analyzed given a few extra assumptions.  The if statement must be of the form: (x <= c) ? e1 : e2 where both e1 and e2 are montonic, and c is a constant. If these assumptions are not met, this function may return an unsound analysis. Note that this function performs an analysis that is approximately equivalent to the ifc analysis of "Static Monotonicity Analysis for lambda-definable Functions over Lattices" (Murawski and Yi, 2002), except that that analysis is unsound.  This analysis is a corrected form of that one.
 * @param constant The constant c.
 * @return Monotonic, if the function is monotonic.Nonmonotonic, otherwise.
 * @exception IllegalActionException If there is a problemevaluating the subexpressions of the conditional.
 */
private Concept _specialIfAnalysis(Concept constant) throws IllegalActionException {
  MonotonicityCounterexamples toCheck=_nodeToCounterexamples.get(_ifNode.jjtGetChild(2));
  if (toCheck == null) {
    toCheck=new MonotonicityCounterexamples();
  }
  ConceptGraph inputLattice=_domainOntology.getGraph();
  List downsetList=Arrays.asList(inputLattice.downSet(constant));
  List<Concept> downset=(List<Concept>)downsetList;
  for (  Concept b : downset) {
    for (    Concept d : b.getStrictDominators()) {
      if (downset.contains(d)) {
        continue;
      }
      toCheck.add(b,d);
    }
  }
  MonotonicityCounterexamples counterexamples=new MonotonicityCounterexamples();
  for (  MonotonicityCounterexamples.ConceptPair pair : toCheck.entrySet()) {
    Concept fb=_evaluateNode(_ifNode,pair.getKey());
    Concept fd=_evaluateNode(_ifNode,pair.getValue());
    if (!fd.isAboveOrEqualTo(fb)) {
      counterexamples.add(pair.getKey(),pair.getValue());
    }
  }
  if (counterexamples.containsCounterexamples()) {
    _nodeToCounterexamples.put(_ifNode,counterexamples);
    return _nonmonotonicConcept;
  }
 else {
    return _monotonicConcept;
  }
}