public static void cachedBackpropagateError(Cons tree, double error) {
    { PropositionNeuralNetwork net = null;
      double temp = 0.0;
      double delta = 0.0;
      Vector input = null;
      Vector hidden = null;
      Vector hiddenError = null;
      Vector inputError = null;
      boolean recursiveConflictP = false;

      if (Stella_Object.isaP(tree.value, Logic.SGT_STELLA_CONS)) {
        if (Logic.$RULE_COMBINATION$ == Logic.KWD_MAX) {
          { double max = 0.0;
            Cons guilty = Stella.NIL;

            { Stella_Object netDef = null;
              Cons iter000 = tree;

              for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
                netDef = iter000.value;
                net = ((PropositionNeuralNetwork)(((Cons)(netDef)).value));
                if (net.output > max) {
                  max = net.output;
                  guilty = ((Cons)(netDef));
                }
              }
            }
            Logic.cachedBackpropagateError(guilty, error);
          }
        }
        else if (Logic.$RULE_COMBINATION$ == Logic.KWD_NOISY_OR) {
          { Stella_Object netDef = null;
            Cons iter001 = tree;

            for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
              netDef = iter001.value;
              Logic.cachedBackpropagateError(((Cons)(netDef)), error * ((PropositionNeuralNetwork)(((Cons)(netDef)).value)).output);
            }
          }
        }
        else {
          { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

            stream000.nativeStream.print("`" + Logic.$RULE_COMBINATION$ + "' is not a valid case option");
            throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
          }
        }
        return;
      }
      net = ((PropositionNeuralNetwork)(tree.value));
      input = net.input;
      hidden = net.hidden;
      inputError = net.inputError;
      hiddenError = net.hiddenError;
      error = error * net.output * (1.0 - net.output);
      { int i = Stella.NULL_INTEGER;
        int iter002 = 1;
        int upperBound000 = net.input.length() - 1;
        Stella_Object ele = null;
        Cons iter003 = tree.rest;

        loop002 : for (;(iter002 <= upperBound000) &&
                  (!(iter003 == Stella.NIL)); iter002 = iter002 + 1, iter003 = iter003.rest) {
          i = iter002;
          ele = iter003.value;
          { Surrogate testValue000 = Stella_Object.safePrimaryType(ele);

            if (testValue000 == Logic.SGT_STELLA_CONS) {
              { Cons ele000 = ((Cons)(ele));

                if (ele000.length() == 1) {
                  temp = ((PropositionNeuralNetwork)(((Cons)(ele000.value)).value)).output;
                }
                else {
                  if (Logic.$RULE_COMBINATION$ == Logic.KWD_MAX) {
                    temp = 0.0;
                    { Stella_Object netDef = null;
                      Cons iter004 = ele000;

                      for (;!(iter004 == Stella.NIL); iter004 = iter004.rest) {
                        netDef = iter004.value;
                        if (((PropositionNeuralNetwork)(((Cons)(netDef)).value)).output > temp) {
                          temp = net.output;
                        }
                      }
                    }
                  }
                  else if (Logic.$RULE_COMBINATION$ == Logic.KWD_NOISY_OR) {
                    { Cons scores = Stella.NIL;

                      { Stella_Object netDef = null;
                        Cons iter005 = ele000;
                        Cons collect000 = null;

                        for (;!(iter005 == Stella.NIL); iter005 = iter005.rest) {
                          netDef = iter005.value;
                          if (collect000 == null) {
                            {
                              collect000 = Cons.cons(FloatWrapper.wrapFloat(((PropositionNeuralNetwork)(((Cons)(netDef)).value)).output), Stella.NIL);
                              if (scores == Stella.NIL) {
                                scores = collect000;
                              }
                              else {
                                Cons.addConsToEndOfConsList(scores, collect000);
                              }
                            }
                          }
                          else {
                            {
                              collect000.rest = Cons.cons(FloatWrapper.wrapFloat(((PropositionNeuralNetwork)(((Cons)(netDef)).value)).output), Stella.NIL);
                              collect000 = collect000.rest;
                            }
                          }
                        }
                      }
                      temp = Logic.probabilisticSumN(scores);
                    }
                  }
                  else {
                    { OutputStringStream stream001 = OutputStringStream.newOutputStringStream();

                      stream001.nativeStream.print("`" + Logic.$RULE_COMBINATION$ + "' is not a valid case option");
                      throw ((StellaException)(StellaException.newStellaException(stream001.theStringReader()).fillInStackTrace()));
                    }
                  }
                }
              }
            }
            else if (Surrogate.subtypeOfFloatP(testValue000)) {
              { FloatWrapper ele000 = ((FloatWrapper)(ele));

                temp = ele000.wrapperValue;
              }
            }
            else {
              { OutputStringStream stream002 = OutputStringStream.newOutputStringStream();

                stream002.nativeStream.print("`" + testValue000 + "' is not a valid case option");
                throw ((StellaException)(StellaException.newStellaException(stream002.theStringReader()).fillInStackTrace()));
              }
            }
          }
          { double value = ((FloatWrapper)((net.input.theArray)[i])).wrapperValue;

            if (!(value == temp)) {
              recursiveConflictP = true;
              break loop002;
            }
          }
        }
      }
      if (recursiveConflictP) {
        Logic.activateCachedNetwork(Cons.consList(Cons.cons(tree, Stella.NIL)));
        hidden = Vector.newVector(net.hidden.length());
        hiddenError = Vector.newVector(net.hidden.length());
        input = Vector.newVector(net.input.length());
        { int i = Stella.NULL_INTEGER;
          int iter006 = 0;
          int upperBound001 = input.length() - 1;

          for (;iter006 <= upperBound001; iter006 = iter006 + 1) {
            i = iter006;
            (input.theArray)[i] = (((FloatWrapper)((net.input.theArray)[i])));
          }
        }
        { int h = Stella.NULL_INTEGER;
          int iter007 = 0;
          int upperBound002 = hidden.length() - 1;

          for (;iter007 <= upperBound002; iter007 = iter007 + 1) {
            h = iter007;
            (hidden.theArray)[h] = (((FloatWrapper)((net.hidden.theArray)[h])));
          }
        }
      }
      { int h = Stella.NULL_INTEGER;
        int iter008 = 0;
        int upperBound003 = hidden.length() - 1;

        for (;iter008 <= upperBound003; iter008 = iter008 + 1) {
          h = iter008;
          (hiddenError.theArray)[h] = (FloatWrapper.wrapFloat(error * ((FloatWrapper)((net.ho.theArray)[h])).wrapperValue));
          (hiddenError.theArray)[h] = (FloatWrapper.wrapFloat(((FloatWrapper)((hiddenError.theArray)[h])).wrapperValue * ((FloatWrapper)((hidden.theArray)[h])).wrapperValue * (1.0 - ((FloatWrapper)((hidden.theArray)[h])).wrapperValue)));
        }
      }
      { int i = Stella.NULL_INTEGER;
        int iter009 = 0;
        int upperBound004 = input.length() - 1;

        for (;iter009 <= upperBound004; iter009 = iter009 + 1) {
          i = iter009;
          (inputError.theArray)[i] = (FloatWrapper.wrapFloat(0.0));
          { int h = Stella.NULL_INTEGER;
            int iter010 = 0;
            int upperBound005 = hidden.length() - 1;

            for (;iter010 <= upperBound005; iter010 = iter010 + 1) {
              h = iter010;
              (inputError.theArray)[i] = (FloatWrapper.wrapFloat(((FloatWrapper)((inputError.theArray)[i])).wrapperValue + (((FloatWrapper)((hiddenError.theArray)[h])).wrapperValue * ((FloatWrapper)((net.ih.theArray)[((i * net.ih.nofColumns) + h)])).wrapperValue)));
            }
          }
        }
      }
      { Stella_Object input000 = null;
        Cons iter011 = tree.rest;
        int i = Stella.NULL_INTEGER;
        int iter012 = 1;

        for (;!(iter011 == Stella.NIL); iter011 = iter011.rest, iter012 = iter012 + 1) {
          input000 = iter011.value;
          i = iter012;
          if (Stella_Object.isaP(input000, Logic.SGT_STELLA_CONS)) {
            Logic.cachedBackpropagateError(((Cons)(input000)), ((FloatWrapper)((inputError.theArray)[i])).wrapperValue);
          }
        }
      }
      { int h = Stella.NULL_INTEGER;
        int iter013 = 0;
        int upperBound006 = hidden.length() - 1;

        for (;iter013 <= upperBound006; iter013 = iter013 + 1) {
          h = iter013;
          delta = (Logic.$MOMENTUM_TERM$ * ((FloatWrapper)((net.hoDelta.theArray)[h])).wrapperValue) + (Logic.$LEARNING_RATE$ * error * ((FloatWrapper)((hidden.theArray)[h])).wrapperValue);
          (net.ho.theArray)[h] = (FloatWrapper.wrapFloat(((FloatWrapper)((net.ho.theArray)[h])).wrapperValue + delta));
          (net.hoDelta.theArray)[h] = (FloatWrapper.wrapFloat(delta));
          { int i = Stella.NULL_INTEGER;
            int iter014 = 0;
            int upperBound007 = input.length() - 1;

            for (;iter014 <= upperBound007; iter014 = iter014 + 1) {
              i = iter014;
              delta = (Logic.$MOMENTUM_TERM$ * ((FloatWrapper)((net.ihDelta.theArray)[((i * net.ihDelta.nofColumns) + h)])).wrapperValue) + (Logic.$LEARNING_RATE$ * ((FloatWrapper)((hiddenError.theArray)[h])).wrapperValue * ((FloatWrapper)((input.theArray)[i])).wrapperValue);
              (net.ih.theArray)[((i * net.ih.nofColumns) + h)] = (FloatWrapper.wrapFloat(((FloatWrapper)((net.ih.theArray)[((i * net.ih.nofColumns) + h)])).wrapperValue + delta));
              (net.ihDelta.theArray)[((i * net.ihDelta.nofColumns) + h)] = (FloatWrapper.wrapFloat(delta));
            }
          }
        }
      }
    }
  }