public static void helpDistributeGoal(Stella_Object argument, Proposition parentgoal, boolean generatorP) {
    { Surrogate testValue000 = Stella_Object.safePrimaryType(argument);

      if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_PATTERN_VARIABLE)) {
        { PatternVariable argument000 = ((PatternVariable)(argument));

          if (PatternVariable.variableBoundP(argument000)) {
            return;
          }
          { GoalRecord goalrecord = PatternVariable.goalRecord(argument000);

            if (goalrecord.generatorGoals.memberP(parentgoal) ||
                goalrecord.otherGoals.memberP(parentgoal)) {
              return;
            }
            if (generatorP) {
              goalrecord.generatorGoals.insert(parentgoal);
            }
            else {
              goalrecord.otherGoals.insert(parentgoal);
            }
            Native.setBooleanSpecial(Logic.$DISTRIBUTEDOPENGOALp$, true);
          }
        }
      }
      else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_PROPOSITION)) {
        { Proposition argument000 = ((Proposition)(argument));

          { Stella_Object arg = null;
            Vector vector000 = argument000.arguments;
            int index000 = 0;
            int length000 = vector000.length();

            for (;index000 < length000; index000 = index000 + 1) {
              arg = (vector000.theArray)[index000];
              Logic.helpDistributeGoal(arg, parentgoal, generatorP);
            }
          }
        }
      }
      else {
      }
    }
  }