public static void helpCollectFacts(Stella_Object self, List facts, HashSet beenthere, boolean includeunknownP) {
    { Surrogate testValue000 = Stella_Object.safePrimaryType(self);

      if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_LOGIC_OBJECT)) {
        { LogicObject self000 = ((LogicObject)(self));

          if (beenthere.memberP(self000)) {
            return;
          }
          else {
            beenthere.insert(self000);
          }
          { Proposition p = null;
            Iterator iter000 = Logic.unfilteredDependentPropositions(self000, null).allocateIterator();

            while (iter000.nextP()) {
              p = ((Proposition)(iter000.value));
              Logic.helpCollectFacts(p, facts, beenthere, includeunknownP);
            }
          }
          { LogicObject equivalent = null;
            Cons iter001 = self000.variableValueInverse();

            for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
              equivalent = ((LogicObject)(iter001.value));
              Logic.helpCollectFacts(equivalent, facts, beenthere, includeunknownP);
            }
          }
        }
      }
      else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_PROPOSITION)) {
        { Proposition self000 = ((Proposition)(self));

          if (beenthere.memberP(self000)) {
            return;
          }
          else {
            beenthere.insert(self000);
          }
          { boolean assertedP = includeunknownP ||
                (!Proposition.unknownP(self000));
            Skolem outputskolem = null;

            if ((!assertedP) &&
                (self000.kind == Logic.KWD_FUNCTION)) {
              outputskolem = ((Skolem)((self000.arguments.theArray)[(self000.arguments.length() - 1)]));
              assertedP = !(outputskolem == Logic.valueOf(outputskolem));
            }
            if (assertedP) {
              facts.insert(self000);
            }
            { Proposition p = null;
              Iterator iter002 = self000.dependentPropositions.allocateIterator();

              while (iter002.nextP()) {
                p = ((Proposition)(iter002.value));
                Logic.helpCollectFacts(p, facts, beenthere, includeunknownP);
              }
            }
          }
        }
      }
      else if (Surrogate.subtypeOfSurrogateP(testValue000)) {
        { Surrogate self000 = ((Surrogate)(self));

          if (self000.surrogateValue != null) {
            Logic.helpCollectFacts(self000.surrogateValue, facts, beenthere, includeunknownP);
          }
        }
      }
      else if (Surrogate.subtypeOfClassP(testValue000)) {
        { Stella_Class self000 = ((Stella_Class)(self));

          if (((NamedDescription)(KeyValueList.dynamicSlotValue(self000.dynamicSlots, Logic.SYM_LOGIC_DESCRIPTION, null))) != null) {
            Logic.helpCollectFacts(((NamedDescription)(KeyValueList.dynamicSlotValue(self000.dynamicSlots, Logic.SYM_LOGIC_DESCRIPTION, null))), facts, beenthere, includeunknownP);
          }
        }
      }
      else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_STELLA_SLOT)) {
        { Slot self000 = ((Slot)(self));

          if (((NamedDescription)(KeyValueList.dynamicSlotValue(self000.dynamicSlots, Logic.SYM_LOGIC_DESCRIPTION, null))) != null) {
            Logic.helpCollectFacts(((NamedDescription)(KeyValueList.dynamicSlotValue(self000.dynamicSlots, Logic.SYM_LOGIC_DESCRIPTION, null))), facts, beenthere, includeunknownP);
          }
        }
      }
      else {
      }
    }
  }