public static Keyword aritySpecialist(ControlFrame frame, Keyword lastmove) {
    { Proposition proposition = frame.proposition;
      Stella_Object relationArg = (proposition.arguments.theArray)[0];
      Stella_Object relationArgValue = Logic.argumentBoundTo(relationArg);
      Stella_Object arityArg = (proposition.arguments.theArray)[1];
      Stella_Object arityArgValue = Logic.argumentBoundTo(arityArg);
      IntegerWrapper computedArity = PlKernelKb.arityComputation(relationArgValue);
      Iterator iterator = ((Iterator)(KeyValueList.dynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ITERATOR, null)));

      lastmove = lastmove;
      if (iterator == null) {
        if (relationArgValue == null) {
          iterator = Logic.allNamedDescriptions(((Module)(Stella.$MODULE$.get())), false);
          KeyValueList.setDynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ITERATOR, iterator, null);
        }
        else if (arityArgValue == null) {
          return (Logic.selectProofResult(Logic.bindArgumentToValueP(arityArg, computedArity, true), false, true));
        }
        else {
          if (computedArity == null) {
            return (Logic.KWD_FAILURE);
          }
          else {
            if (Surrogate.subtypeOfIntegerP(Stella_Object.safePrimaryType(arityArgValue))) {
              { IntegerWrapper arityArgValue000 = ((IntegerWrapper)(arityArgValue));

                return (Logic.selectTestResult(Stella_Object.eqlP(arityArgValue000, computedArity), true, frame));
              }
            }
            else {
              return (Logic.selectTestResult(Logic.bindArgumentToValueP(arityArg, computedArity, true), true, frame));
            }
          }
        }
      }
      { NamedDescription description = null;

        while (iterator.nextP()) {
          description = ((NamedDescription)(iterator.value));
          computedArity = PlKernelKb.arityComputation(description);
          if (Logic.bindArgumentToValueP(arityArg, computedArity, true) &&
              Logic.bindArgumentToValueP(relationArg, description, true)) {
            return (Logic.KWD_CONTINUING_SUCCESS);
          }
        }
        return (Logic.KWD_FAILURE);
      }
    }
  }