public static boolean logicalSubtypeOfLiteralP(Surrogate type) {
    { NamedDescription desc = Logic.surrogateToDescription(type);
      NamedDescription literalclass = Logic.surrogateToDescription(Logic.SGT_STELLA_LITERAL);
      Cons literalsubs = Stella.NIL;

      if (desc == null) {
        return (false);
      }
      else if (desc == literalclass) {
        return (true);
      }
      else {
        { Object old$ReversepolarityP$000 = Logic.$REVERSEPOLARITYp$.get();
          Object old$Context$000 = Stella.$CONTEXT$.get();

          try {
            Native.setBooleanSpecial(Logic.$REVERSEPOLARITYp$, false);
            Native.setSpecial(Stella.$CONTEXT$, Logic.getPropertyTestContext());
            { MemoizationTable memoTable000 = null;
              Cons memoizedEntry000 = null;
              Stella_Object memoizedValue000 = null;

              if (Stella.$MEMOIZATION_ENABLEDp$) {
                memoTable000 = ((MemoizationTable)(Logic.SGT_LOGIC_F_LOGICAL_SUBTYPE_OF_LITERALp_MEMO_TABLE_000.surrogateValue));
                if (memoTable000 == null) {
                  Surrogate.initializeMemoizationTable(Logic.SGT_LOGIC_F_LOGICAL_SUBTYPE_OF_LITERALp_MEMO_TABLE_000, "(:MAX-VALUES 10 :TIMESTAMPS (:META-KB-UPDATE))");
                  memoTable000 = ((MemoizationTable)(Logic.SGT_LOGIC_F_LOGICAL_SUBTYPE_OF_LITERALp_MEMO_TABLE_000.surrogateValue));
                }
                memoizedEntry000 = MruMemoizationTable.lookupMruMemoizedValue(((MruMemoizationTable)(memoTable000)), ((Context)(Stella.$CONTEXT$.get())), Stella.MEMOIZED_NULL_VALUE, null, null, -1);
                memoizedValue000 = memoizedEntry000.value;
              }
              if (memoizedValue000 != null) {
                if (memoizedValue000 == Stella.MEMOIZED_NULL_VALUE) {
                  memoizedValue000 = null;
                }
              }
              else {
                memoizedValue000 = LogicObject.allSubcollections(literalclass).consify();
                if (Stella.$MEMOIZATION_ENABLEDp$) {
                  memoizedEntry000.value = ((memoizedValue000 == null) ? Stella.MEMOIZED_NULL_VALUE : memoizedValue000);
                }
              }
              literalsubs = ((Cons)(memoizedValue000));
            }
            if (literalsubs.membP(desc)) {
              return (true);
            }

          } finally {
            Stella.$CONTEXT$.set(old$Context$000);
            Logic.$REVERSEPOLARITYp$.set(old$ReversepolarityP$000);
          }
        }
      }
      return (false);
    }
  }