public static void distributeOpenGoal(Proposition goal) {
    { Object old$DistributedopengoalP$000 = Logic.$DISTRIBUTEDOPENGOALp$.get();

      try {
        Native.setBooleanSpecial(Logic.$DISTRIBUTEDOPENGOALp$, false);
        { Keyword testValue000 = goal.kind;

          if (testValue000 == Logic.KWD_FUNCTION) {
            { Stella_Object arg = null;
              Iterator iter000 = goal.arguments.butLast();

              while (iter000.nextP()) {
                arg = iter000.value;
                Logic.helpDistributeGoal(arg, goal, !Proposition.computedPredicateP(goal));
              }
            }
            Logic.helpDistributeGoal((goal.arguments.theArray)[(goal.arguments.length() - 1)], goal, false);
          }
          else if (testValue000 == Logic.KWD_EQUIVALENT) {
            { Stella_Object arg = null;
              Vector vector000 = goal.arguments;
              int index000 = 0;
              int length000 = vector000.length();

              for (;index000 < length000; index000 = index000 + 1) {
                arg = (vector000.theArray)[index000];
                Logic.helpDistributeGoal(arg, goal, false);
              }
            }
          }
          else if (testValue000 == Logic.KWD_ISA) {
            Logic.helpDistributeGoal((goal.arguments.theArray)[0], goal, Logic.generatorCollectionP(Logic.getDescription(((Surrogate)(goal.operator)))));
          }
          else if (testValue000 == Logic.KWD_PREDICATE) {
            { Stella_Object arg = null;
              Vector vector001 = goal.arguments;
              int index001 = 0;
              int length001 = vector001.length();

              for (;index001 < length001; index001 = index001 + 1) {
                arg = (vector001.theArray)[index001];
                Logic.helpDistributeGoal(arg, goal, !Proposition.computedPredicateP(goal));
              }
            }
          }
          else if ((testValue000 == Logic.KWD_NOT) ||
              (testValue000 == Logic.KWD_FAIL)) {
            Logic.helpDistributeGoal((goal.arguments.theArray)[0], goal, false);
          }
          else if (testValue000 == Logic.KWD_IMPLIES) {
            { Stella_Object arg = null;
              Vector vector002 = goal.arguments;
              int index002 = 0;
              int length002 = vector002.length();

              for (;index002 < length002; index002 = index002 + 1) {
                arg = (vector002.theArray)[index002];
                Logic.helpDistributeGoal(arg, goal, true);
              }
            }
          }
          else {
          }
        }
        if (!((Boolean)(Logic.$DISTRIBUTEDOPENGOALp$.get())).booleanValue()) {
          ((QueryIterator)(Logic.$QUERYITERATOR$.get())).residueGoals().insert(goal);
        }

      } finally {
        Logic.$DISTRIBUTEDOPENGOALp$.set(old$DistributedopengoalP$000);
      }
    }
  }