public static Cons translateLoomDefinition(Cons tree) {
    { Symbol operator = ((Symbol)(tree.value));
      Symbol name = ((Symbol)(tree.rest.value));
      StringWrapper docstring = null;
      PropertyList options = null;
      int arity = -1;
      Stella_Object definition = null;
      Cons constraints = Stella.NIL;
      Cons defaults = Stella.NIL;
      Cons axioms = Stella.NIL;
      Stella_Object kifdefinition = null;
      Stella_Object kifconstraint = null;
      Stella_Object kifaxiom = null;

      if ((tree.rest.rest.value != null) &&
          Stella_Object.isaP(tree.rest.rest.value, Logic.SGT_STELLA_STRING_WRAPPER)) {
        {
          docstring = ((StringWrapper)(tree.rest.rest.value));
          { PropertyList self000 = PropertyList.newPropertyList();

            self000.thePlist = tree.rest.rest.rest;
            options = self000;
          }
        }
      }
      else {
        { PropertyList self001 = PropertyList.newPropertyList();

          self001.thePlist = tree.rest.rest;
          options = self001;
        }
      }
      if (Stella.getQuotedTree("((DEFCONCEPT DEFSET) \"/LOGIC\")", "/LOGIC").memberP(operator)) {
        arity = 1;
        operator = Logic.SYM_LOGIC_DEFCONCEPT;
      }
      if (operator == Logic.SYM_LOGIC_DEFPROPERTY) {
        operator = Logic.SYM_LOGIC_DEFRELATION;
        arity = 1;
      }
      { Stella_Object keyword = null;
        Stella_Object value = null;
        Cons iter000 = options.thePlist;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest.rest) {
          keyword = iter000.value;
          value = iter000.rest.value;
          keyword = Logic.simplifyTopLevelLoomKeywords(((Keyword)(keyword)));
          { GeneralizedSymbol testValue000 = ((GeneralizedSymbol)(keyword));

            if (testValue000 == Logic.KWD_IS_PRIMITIVE) {
              constraints = Cons.cons(value, constraints);
            }
            else if (testValue000 == Logic.KWD_IS) {
              definition = value;
            }
            else if (testValue000 == Logic.KWD_CONSTRAINTS) {
              constraints = Cons.cons(value, constraints);
            }
            else if (testValue000 == Logic.KWD_DEFAULTS) {
              defaults = Cons.cons(value, defaults);
            }
            else if (testValue000 == Logic.KWD_DOMAIN) {
              constraints = Cons.cons(Cons.list$(Cons.cons(Logic.SYM_LOGIC_DOMAIN, Cons.cons(value, Cons.cons(Stella.NIL, Stella.NIL)))), constraints);
              if (arity < 0) {
                arity = 2;
              }
            }
            else if (testValue000 == Logic.KWD_DOMAINS) {
              constraints = Cons.cons(Cons.cons(Logic.SYM_LOGIC_DOMAINS, ((Cons)(value)).concatenate(Stella.NIL, Stella.NIL)), constraints);
              if (arity < 0) {
                arity = ((Cons)(value)).length() + 1;
              }
            }
            else if (testValue000 == Logic.KWD_RANGE) {
              constraints = Cons.cons(Cons.list$(Cons.cons(Logic.SYM_LOGIC_RANGE, Cons.cons(value, Cons.cons(Stella.NIL, Stella.NIL)))), constraints);
              if (arity < 0) {
                arity = 2;
              }
            }
            else if (testValue000 == Logic.KWD_ARITY) {
              arity = ((IntegerWrapper)(value)).wrapperValue;
            }
            else if ((testValue000 == Logic.KWD_PARTITIONS) ||
                (testValue000 == Logic.KWD_EXHAUSTIVE_PARTITIONS)) {
              { Stella_Object p = null;
                Cons iter001 = Logic.translateLoomPartitions(value, keyword == Logic.KWD_EXHAUSTIVE_PARTITIONS, name);

                for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
                  p = iter001.value;
                  axioms = Cons.cons(p, axioms);
                }
              }
            }
            else if (testValue000 == Logic.KWD_IN_PARTITION) {
              axioms = Cons.cons(Cons.list$(Cons.cons(Logic.SYM_PL_KERNEL_KB_MEMBER_OF, Cons.cons(name, Cons.cons(Cons.cons(value, Stella.NIL), Stella.NIL)))), axioms);
            }
            else if ((testValue000 == Logic.KWD_CHARACTERISTICS) ||
                (testValue000 == Logic.KWD_ATTRIBUTES)) {
              axioms = Cons.cons(Logic.translateLoomCharacteristics(value, name), axioms);
            }
            else if (testValue000 == Logic.KWD_ANNOTATIONS) {
              axioms = Cons.cons(Logic.translateLoomAnnotations(value, name), axioms);
            }
            else if (testValue000 == Logic.KWD_ROLES) {
              System.out.println(":roles OPTION NOT YET IMPLEMENTED");
            }
            else if (testValue000 == Logic.KWD_NAME) {
            }
            else if (testValue000 == Logic.KWD_IDENTIFIER) {
              {
                System.out.println("Note: Definition `" + name + "' is also known as `" + value + "'");
                System.out.println();
              }
;
            }
            else {
              {
                System.out.println("Skipping unimplemented keyword: `" + keyword + "'");
                System.out.println("   in Loom definition: `" + tree + "'");
                System.out.println();
              }
;
            }
          }
        }
      }
      arity = Logic.guessLoomDefinitionArity(arity, definition, constraints);
      { Cons variables = Logic.yieldImplicitVariables(arity);
        Stella_Object characteristics = options.lookup(Logic.KWD_CHARACTERISTICS);
        boolean converttofunctionP = (characteristics != null) &&
            ((characteristics == Logic.KWD_SINGLE_VALUED) ||
             (Stella_Object.consP(characteristics) &&
              ((Cons)(characteristics)).memberP(Logic.KWD_SINGLE_VALUED)));
        Cons resultclause = Stella.NIL;

        if (!(constraints == Stella.NIL)) {
          kifconstraint = Logic.helpTranslateLoomDescriptionToKif(Logic.conjoinSentences(constraints), variables);
        }
        { Stella_Object renamed_Default = null;
          Cons iter002 = defaults;

          for (;!(iter002 == Stella.NIL); iter002 = iter002.rest) {
            renamed_Default = iter002.value;
            axioms = Cons.cons(Logic.translateLoomDefaults(renamed_Default, variables), axioms);
          }
        }
        if (!(axioms == Stella.NIL)) {
          kifaxiom = Logic.conjoinSentences(axioms);
          if (kifaxiom == Stella.NIL) {
            kifaxiom = null;
          }
        }
        if (definition != null) {
          kifdefinition = Logic.helpTranslateLoomDescriptionToKif(definition, variables);
        }
        if (converttofunctionP) {
          operator = Logic.SYM_LOGIC_DEFFUNCTION;
          resultclause = Cons.list$(Cons.cons(Logic.KWD__g, Cons.cons(((Symbol)(variables.last())), Cons.cons(Stella.NIL, Stella.NIL))));
          variables = variables.butLast().consify();
        }
        return (Cons.cons(operator, Cons.cons(name, Cons.cons(variables, resultclause.concatenate((((docstring != null) ? Cons.list$(Cons.cons(edu.isi.powerloom.pl_kernel_kb.loom_api.LoomApi.KWD_DOCUMENTATION, Cons.cons(docstring, Cons.cons(Stella.NIL, Stella.NIL)))) : Stella.NIL)).concatenate((((kifdefinition != null) ? Cons.list$(Cons.cons(Logic.KWD_llegg, Cons.cons(kifdefinition, Cons.cons(Stella.NIL, Stella.NIL)))) : Stella.NIL)).concatenate((((kifconstraint != null) ? Cons.list$(Cons.cons(Logic.KWD_egg, Cons.cons(kifconstraint, Cons.cons(Stella.NIL, Stella.NIL)))) : Stella.NIL)).concatenate((((kifaxiom != null) ? Cons.list$(Cons.cons(edu.isi.powerloom.pl_kernel_kb.loom_api.LoomApi.KWD_AXIOMS, Cons.cons(kifaxiom, Cons.cons(Stella.NIL, Stella.NIL)))) : Stella.NIL)).concatenate(Stella.NIL, Stella.NIL), Stella.NIL), Stella.NIL), Stella.NIL), Stella.NIL)))));
      }
    }
  }