public Justification copy() {
    { Justification self = this;

      { Justification copy = null;
        Cons antecedents = Stella.NIL;

        if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(self), Logic.SGT_LOGIC_PRIMITIVE_STRATEGY)) {
          { PrimitiveStrategy self000 = ((PrimitiveStrategy)(self));

            { PrimitiveStrategy self001 = PrimitiveStrategy.newPrimitiveStrategy();

              self001.strategy = self000.strategy;
              copy = self001;
            }
          }
        }
        else {
          copy = Justification.newJustification();
        }
        copy.inferenceRule = self.inferenceRule;
        copy.proposition = self.proposition;
        copy.substitution = self.substitution;
        copy.reversePolarityP = self.reversePolarityP;
        copy.truthValue = self.truthValue;
        copy.positiveScore = self.positiveScore;
        copy.negativeScore = self.negativeScore;
        { Justification antecedent = null;
          Cons iter000 = self.antecedents;
          Cons collect000 = null;

          for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
            antecedent = ((Justification)(iter000.value));
            if (collect000 == null) {
              {
                collect000 = Cons.cons(antecedent.copy(), Stella.NIL);
                if (antecedents == Stella.NIL) {
                  antecedents = collect000;
                }
                else {
                  Cons.addConsToEndOfConsList(antecedents, collect000);
                }
              }
            }
            else {
              {
                collect000.rest = Cons.cons(antecedent.copy(), Stella.NIL);
                collect000 = collect000.rest;
              }
            }
          }
        }
        copy.antecedents = antecedents;
        if (self.inferenceRule == Logic.KWD_PATTERN) {
          { Justification antecedent = null;
            Cons iter001 = copy.antecedents;

            for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
              antecedent = ((Justification)(iter001.value));
              Justification.backlinkToPatternJustification(antecedent, copy);
            }
          }
        }
        return (copy);
      }
    }
  }