public static boolean equivalentDescriptionsP(Description self, Description other, KeyValueMap mapping) {
    if (self == other) {
      return (true);
    }
    if ((self.descriptionName() != null) &&
        (other.descriptionName() != null)) {
      return (false);
    }
    if (!(self.arity() == other.arity())) {
      return (false);
    }
    if (Description.namedDescriptionP(self)) {
      return (false);
    }
    else {
      if (mapping == null) {
        mapping = KeyValueMap.newKeyValueMap();
      }
      { PatternVariable v1 = null;
        Vector vector000 = self.ioVariables;
        int index000 = 0;
        int length000 = vector000.length();
        PatternVariable v2 = null;
        Vector vector001 = other.ioVariables;
        int index001 = 0;
        int length001 = vector001.length();

        for (;(index000 < length000) &&
                  (index001 < length001); index000 = index000 + 1, index001 = index001 + 1) {
          v1 = ((PatternVariable)((vector000.theArray)[index000]));
          v2 = ((PatternVariable)((vector001.theArray)[index001]));
          mapping.insertAt(v1, v2);
          mapping.insertAt(v2, v1);
        }
      }
      { PatternVariable v1 = null;
        Vector vector002 = self.ioVariables;
        int index002 = 0;
        int length002 = vector002.length();
        PatternVariable v2 = null;
        Vector vector003 = other.ioVariables;
        int index003 = 0;
        int length003 = vector003.length();

        for (;(index002 < length002) &&
                  (index003 < length003); index002 = index002 + 1, index003 = index003 + 1) {
          v1 = ((PatternVariable)((vector002.theArray)[index002]));
          v2 = ((PatternVariable)((vector003.theArray)[index003]));
          if (!((mapping.lookup(v1) == v2) &&
              (mapping.lookup(v2) == v1))) {
            return (false);
          }
        }
      }
      { PatternVariable v1 = null;
        Vector vector004 = self.internalVariables;
        int index004 = 0;
        int length004 = vector004.length();
        PatternVariable v2 = null;
        Vector vector005 = other.internalVariables;
        int index005 = 0;
        int length005 = vector005.length();

        for (;(index004 < length004) &&
                  (index005 < length005); index004 = index004 + 1, index005 = index005 + 1) {
          v1 = ((PatternVariable)((vector004.theArray)[index004]));
          v2 = ((PatternVariable)((vector005.theArray)[index005]));
          mapping.insertAt(v1, v2);
        }
      }
      return (Logic.equivalentFormulaeP(self.proposition, other.proposition, mapping));
    }
  }