static Cons helpGetPropositions(LogicObject relation, Cons arguments, int limit, Module module, Environment environment) {
    if (relation == null) {
      return (Stella.NIL);
    }
    { Module mdl000 = module;
      Context cxt000 = mdl000;

      if (mdl000 == null) {
        mdl000 = ((Module)(Stella.$MODULE$.get()));
        cxt000 = ((Context)(Stella.$CONTEXT$.get()));
      }
      { Object old$Module$000 = Stella.$MODULE$.get();
        Object old$Context$000 = Stella.$CONTEXT$.get();

        try {
          Native.setSpecial(Stella.$MODULE$, mdl000);
          Native.setSpecial(Stella.$CONTEXT$, cxt000);
          environment = environment;
          synchronized (Logic.$POWERLOOM_LOCK$) {
            { boolean assertionsonlyP = (environment != null) &&
                  Stella.stringEqlP(environment.level, "ASSERTION");
              boolean specializeP = !assertionsonlyP;

              { Stella_Object value000 = null;

                { Stella_Object arg = null;
                  Cons iter000 = arguments;

                  loop000 : for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
                    arg = iter000.value;
                    if ((arg != null) &&
                        Stella_Object.isaP(arg, Logic.SGT_LOGIC_LOGIC_OBJECT)) {
                      value000 = arg;
                      break loop000;
                    }
                  }
                }
                { Stella_Object argumentwithbacklinks = value000;
                  Iterator iterator = ((argumentwithbacklinks != null) ? ((Iterator)(Logic.allTrueDependentPropositions(argumentwithbacklinks, relation.surrogateValueInverse, specializeP))) : PLI.helpGetTrueExtensionMembers(((NamedDescription)(relation)), specializeP).allocateIterator());
                  Cons results = Stella.NIL;

                  if (!(assertionsonlyP)) {
                    Native.setSpecial(Stella.$CONTEXT$, Logic.getPropertyTestContext());
                  }
                  { Proposition p = null;
                    Iterator iter001 = iterator;

                    loop001 : while (iter001.nextP()) {
                      p = ((Proposition)(iter001.value));
                      { boolean testValue000 = false;

                        { boolean alwaysP000 = true;

                          { Stella_Object inputarg = null;
                            Cons iter002 = arguments;
                            Stella_Object arg2 = null;
                            Vector vector000 = p.arguments;
                            int index000 = 0;
                            int length000 = vector000.length();

                            loop002 : for (;(!(iter002 == Stella.NIL)) &&
                                      (index000 < length000); iter002 = iter002.rest, index000 = index000 + 1) {
                              inputarg = iter002.value;
                              arg2 = (vector000.theArray)[index000];
                              if (!((inputarg == null) ||
                                  Stella_Object.eqlP(inputarg, Logic.valueOf(arg2)))) {
                                alwaysP000 = false;
                                break loop002;
                              }
                            }
                          }
                          testValue000 = alwaysP000;
                        }
                        if (testValue000) {
                          testValue000 = arguments.length() == p.arguments.length();
                        }
                        if (testValue000) {
                          results = Cons.cons(p, results);
                          limit = limit - 1;
                          if (limit == 0) {
                            break loop001;
                          }
                        }
                      }
                    }
                  }
                  return (results);
                }
              }
            }
          }

        } finally {
          Stella.$CONTEXT$.set(old$Context$000);
          Stella.$MODULE$.set(old$Module$000);
        }
      }
    }
  }