public static boolean singleValuedTermP(Stella_Object self) {
    { Object old$ReversepolarityP$000 = Logic.$REVERSEPOLARITYp$.get();

      try {
        Native.setBooleanSpecial(Logic.$REVERSEPOLARITYp$, false);
        if (Logic.$CYC_KLUDGES_ENABLEDp$) {
          return (Logic.functionP(self) ||
              Logic.testPropertyP(self, Logic.SGT_PL_KERNEL_KB_SINGLE_VALUED));
        }
        { MemoizationTable memoTable000 = null;
          Cons memoizedEntry000 = null;
          Stella_Object memoizedValue000 = null;

          if (Stella.$MEMOIZATION_ENABLEDp$) {
            memoTable000 = ((MemoizationTable)(Logic.SGT_LOGIC_F_SINGLE_VALUED_TERMp_MEMO_TABLE_000.surrogateValue));
            if (memoTable000 == null) {
              Surrogate.initializeMemoizationTable(Logic.SGT_LOGIC_F_SINGLE_VALUED_TERMp_MEMO_TABLE_000, "(:MAX-VALUES 500 :TIMESTAMPS (:META-KB-UPDATE))");
              memoTable000 = ((MemoizationTable)(Logic.SGT_LOGIC_F_SINGLE_VALUED_TERMp_MEMO_TABLE_000.surrogateValue));
            }
            memoizedEntry000 = MruMemoizationTable.lookupMruMemoizedValue(((MruMemoizationTable)(memoTable000)), self, ((Context)(Stella.$CONTEXT$.get())), Stella.MEMOIZED_NULL_VALUE, null, 2);
            memoizedValue000 = memoizedEntry000.value;
          }
          if (memoizedValue000 != null) {
            if (memoizedValue000 == Stella.MEMOIZED_NULL_VALUE) {
              memoizedValue000 = null;
            }
          }
          else {
            { boolean testValue001 = false;

              if (Logic.nonRecursiveSingleValuedTermP(self)) {
                testValue001 = true;
              }
              else {
                {
                  testValue001 = !Logic.classP(self);
                  if (testValue001) {
                    { boolean foundP001 = false;

                      { LogicObject d = null;
                        Iterator iter001 = LogicObject.allSupercollections(((LogicObject)(self)));

                        loop000 : while (iter001.nextP()) {
                          d = ((LogicObject)(iter001.value));
                          if (Logic.nonRecursiveSingleValuedTermP(d)) {
                            foundP001 = true;
                            break loop000;
                          }
                        }
                      }
                      testValue001 = foundP001;
                    }
                  }
                }
              }
              memoizedValue000 = (testValue001 ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER);
            }
            if (Stella.$MEMOIZATION_ENABLEDp$) {
              memoizedEntry000.value = ((memoizedValue000 == null) ? Stella.MEMOIZED_NULL_VALUE : memoizedValue000);
            }
          }
          { BooleanWrapper value000 = ((BooleanWrapper)(memoizedValue000));

            return (BooleanWrapper.coerceWrappedBooleanToBoolean(value000));
          }
        }

      } finally {
        Logic.$REVERSEPOLARITYp$.set(old$ReversepolarityP$000);
      }
    }
  }