public static int generateClassificationTrainingExamples(Vector instances, Surrogate concept, boolean createSignatureP) {
    { int numInstances = instances.length();
      Cons consQuery = Stella.NIL;
      int numExamples = 0;
      TrainingExample example = null;
      Proposition prop = null;
      Cons classificationQuery = Stella.NIL;
      QueryIterator query = null;
      Symbol conceptName = Symbol.internSymbol(concept.symbolName);

      { int i = Stella.NULL_INTEGER;
        int iter000 = 0;
        int upperBound000 = numInstances - 1;

        for (;iter000 <= upperBound000; iter000 = iter000 + 1) {
          i = iter000;
          consQuery = Cons.consList(Cons.cons(conceptName, Cons.cons(Logic.objectName(((LogicObject)((instances.theArray)[i]))), Stella.NIL)));
          classificationQuery = Cons.consList(Cons.cons(Symbol.internSymbol(conceptName.symbolName + "-Classification"), Cons.cons(Logic.objectName(((LogicObject)((instances.theArray)[i]))), Stella.NIL)));
          prop = ((Proposition)(Logic.conceiveFormula(((Cons)(Stella_Object.copyConsTree(consQuery))))));
          example = null;
          if (Proposition.trueP(prop)) {
            {
              Proposition.helpUpdateTopLevelProposition(prop, Logic.KWD_RETRACT_TRUE);
              query = Logic.makeQuery(Stella.NIL, ((Cons)(Stella_Object.copyConsTree(consQuery))), Stella.NIL, Stella.NIL);
              if (TruthValue.unknownTruthValueP(Logic.callAsk(query))) {
                example = TrainingExample.newTrainingExample();
                example.query = classificationQuery;
                example.output = Stella.TRUE_WRAPPER;
                example.concept = conceptName;
                example.name = Logic.objectName(((LogicObject)((instances.theArray)[i])));
                example.score = 1.0;
              }
              Proposition.helpUpdateTopLevelProposition(prop, Logic.KWD_ASSERT_TRUE);
            }
          }
          else {
            if (Proposition.falseP(prop) ||
                Logic.$CLOSED_WORLD_TRAINING_EXAMPLES$) {
              {
                example = TrainingExample.newTrainingExample();
                example.query = classificationQuery;
                example.output = Stella.FALSE_WRAPPER;
                example.concept = conceptName;
                example.name = Logic.objectName(((LogicObject)((instances.theArray)[i])));
                example.score = 0.0;
              }
            }
          }
          if (!(example == null)) {
            if (createSignatureP) {
              example.input = Logic.createInputSignature(classificationQuery);
            }
            example.module = ((Module)(Stella.$MODULE$.get()));
            example.timestamp = -1;
            numExamples = numExamples + 1;
            Logic.$TRAINING_EXAMPLES$.push(example);
          }
        }
      }
      return (numExamples);
    }
  }