public static Cons simplifyAntecedent(Cons antecedent, Cons outputVariables, List positive, List negative) {
    { Cons newAntecedent = Stella.NIL;
      Cons candidate = Stella.NIL;
      Cons discardedPotentialGenerators = Stella.NIL;
      int coveredExamples = 0;
      int previousCoveredExamples = 0;
      int score = Logic.numExamplesCovered(antecedent, positive);

      while (!(antecedent == Stella.NIL)) {
        { Cons head000 = ((Cons)(antecedent.value));

          antecedent = antecedent.rest;
          candidate = head000;
        }
        if (Logic.ruleCoversAnyExampleP(Cons.append(newAntecedent, antecedent), negative)) {
          newAntecedent = Cons.cons(candidate, newAntecedent);
        }
        else {
          {
            System.out.println("Removing clause " + candidate);
            if (Logic.containsOutputVariableP(candidate, outputVariables)) {
              discardedPotentialGenerators = Cons.cons(candidate, discardedPotentialGenerators);
            }
          }
        }
      }
      coveredExamples = Logic.numExamplesCovered(newAntecedent, positive);
      while ((!(discardedPotentialGenerators == Stella.NIL)) &&
          (coveredExamples < score)) {
        { Stella_Object head001 = discardedPotentialGenerators.value;

          discardedPotentialGenerators = discardedPotentialGenerators.rest;
          candidate = ((Cons)(head001));
        }
        previousCoveredExamples = coveredExamples;
        coveredExamples = Logic.numExamplesCovered(Cons.cons(candidate, newAntecedent), positive);
        if (coveredExamples > previousCoveredExamples) {
          System.out.println("Reinserting clause " + candidate);
          newAntecedent = Cons.cons(candidate, newAntecedent);
        }
      }
      return (newAntecedent);
    }
  }