public static boolean mapAndEnqueueVariableP(Stella_Object variable, Stella_Object localvalue, KeyValueMap mapping) {
    if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(variable), Logic.SGT_LOGIC_PATTERN_VARIABLE)) {
      { PatternVariable variable000 = ((PatternVariable)(variable));

        { Stella_Object mapstovalue = mapping.lookup(variable000);

          if (mapstovalue == null) {
            mapstovalue = Logic.nativeValueOf(variable000);
            if (mapstovalue != null) {
              mapping.insertAt(variable000, mapstovalue);
            }
          }
          if (mapstovalue != null) {
            return ((localvalue == null) ||
                (Stella_Object.eqlP(mapstovalue, localvalue) ||
                 (Logic.skolemP(localvalue) ||
                  Logic.skolemP(mapstovalue))));
          }
          else if (localvalue != null) {
            mapping.insertAt(variable000, localvalue);
          }
          else {
            { Skolem skolem = Logic.createVariableOrSkolem(variable000.skolemType, null);

              mapping.insertAt(variable000, skolem);
            }
          }
        }
      }
    }
    else {
    }
    return (true);
  }