public static Description findDuplicateComplexDescription(Description self) {
    { IntegerWrapper index = IntegerWrapper.wrapInteger(Proposition.propositionHashIndex(self.proposition, null, false));
      List bucket = ((List)(Logic.$STRUCTURED_OBJECTS_INDEX$.lookup(index)));
      Module homemodule = self.homeContext.baseModule;
      KeyValueMap mapping = KeyValueMap.newKeyValueMap();

      if (bucket == null) {
        Logic.$STRUCTURED_OBJECTS_INDEX$.insertAt(index, List.list(Cons.cons(self, Stella.NIL)));
        return (null);
      }
      bucket.removeDeletedMembers();
      if ((((Vector)(KeyValueList.dynamicSlotValue(self.dynamicSlots, Logic.SYM_LOGIC_EXTERNAL_VARIABLES, null))) != null) &&
          (((QueryIterator)(Logic.$QUERYITERATOR$.get())) != null)) {
        mapping = KeyValueMap.newKeyValueMap();
        { PatternVariable v = null;
          Vector vector000 = ((Vector)(KeyValueList.dynamicSlotValue(self.dynamicSlots, Logic.SYM_LOGIC_EXTERNAL_VARIABLES, null)));
          int index000 = 0;
          int length000 = vector000.length();

          for (;index000 < length000; index000 = index000 + 1) {
            v = ((PatternVariable)((vector000.theArray)[index000]));
            { Stella_Object temp000 = Logic.argumentBoundTo(v);

              mapping.insertAt(v, ((temp000 != null) ? temp000 : v));
            }
          }
        }
      }
      { ContextSensitiveObject d = null;
        Cons iter000 = bucket.theConsList;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
          d = ((ContextSensitiveObject)(iter000.value));
          if (Stella_Object.isaP(d, Logic.SGT_LOGIC_DESCRIPTION) &&
              (Description.equivalentDescriptionsP(self, ((Description)(d)), mapping) &&
               Context.subcontextP(homemodule, d.homeContext.baseModule))) {
            return (((Description)(d)));
          }
        }
      }
      bucket.push(self);
      return (null);
    }
  }