public static Proposition newFindSimilarProposition(Proposition proposition, KeyValueMap mapping) {
    if (proposition.kind == Logic.KWD_CONSTANT) {
      return (null);
    }
    { IntegerWrapper index = IntegerWrapper.wrapInteger(Proposition.propositionHashIndex(proposition, mapping, false));
      List bucket = ((List)(Logic.$STRUCTURED_OBJECTS_INDEX$.lookup(index)));
      boolean functionP = proposition.kind == Logic.KWD_FUNCTION;

      if (bucket == null) {
        return (null);
      }
      { GeneralizedSymbol operator = proposition.operator;
        Vector arguments = proposition.arguments;
        int arity = arguments.length();

        { ContextSensitiveObject p = null;
          Cons iter000 = bucket.theConsList;

          for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
            p = ((ContextSensitiveObject)(iter000.value));
            if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(p), Logic.SGT_LOGIC_PROPOSITION)) {
              { Proposition p000 = ((Proposition)(p));

                { boolean testValue000 = false;

                  testValue000 = operator == p000.operator;
                  if (testValue000) {
                    testValue000 = arity == p000.arguments.length();
                    if (testValue000) {
                      testValue000 = functionP;
                      if (testValue000) {
                        { boolean alwaysP000 = true;

                          { Stella_Object arg1 = null;
                            Vector vector000 = arguments;
                            int index000 = 0;
                            int length000 = vector000.length();
                            Stella_Object arg2 = null;
                            Vector vector001 = p000.arguments;
                            int index001 = 0;
                            int length001 = vector001.length();
                            int i = Stella.NULL_INTEGER;
                            int iter001 = 2;
                            int upperBound000 = arity;
                            boolean unboundedP000 = upperBound000 == Stella.NULL_INTEGER;

                            loop001 : for (;(index000 < length000) &&
                                      ((index001 < length001) &&
                                       (unboundedP000 ||
                                        (iter001 <= upperBound000))); 
                                  index000 = index000 + 1,
                                  index001 = index001 + 1,
                                  iter001 = iter001 + 1) {
                              arg1 = (vector000.theArray)[index000];
                              arg2 = (vector001.theArray)[index001];
                              i = iter001;
                              if (!Stella_Object.eqlP(Logic.mappedValueOf(arg1, mapping, false), Logic.valueOf(arg2))) {
                                alwaysP000 = false;
                                break loop001;
                              }
                            }
                          }
                          testValue000 = alwaysP000;
                        }
                      }
                      if (!testValue000) {
                        testValue000 = (!functionP) &&
                            Proposition.equivalentPropositionsP(proposition, p000, mapping);
                      }
                      if (testValue000) {
                        testValue000 = Context.subcontextP(((Module)(Stella.$MODULE$.get())), p000.homeContext.baseModule);
                      }
                    }
                  }
                  if (testValue000) {
                    return (p000);
                  }
                }
              }
            }
            else {
            }
          }
        }
        return (null);
      }
    }
  }