@@ -39,15 +39,15 @@ public SubstVisitor() {
3939 *
4040 */
4141 public Sentence subst (Map <Variable , Term > theta , Sentence aSentence ) {
42- return (Sentence ) (( Sentence ) aSentence .accept (this , theta )). copy ( );
42+ return (Sentence ) aSentence .accept (this , theta );
4343 }
4444
4545 public Term subst (Map <Variable , Term > theta , Term aTerm ) {
46- return (Term ) (( Term ) aTerm .accept (this , theta )). copy ( );
46+ return (Term ) aTerm .accept (this , theta );
4747 }
4848
4949 public Function subst (Map <Variable , Term > theta , Function aFunction ) {
50- return (Function ) (( Function ) aFunction .accept (this , theta )). copy ( );
50+ return (Function ) aFunction .accept (this , theta );
5151 }
5252
5353 public Literal subst (Map <Variable , Term > theta , Literal aLiteral ) {
@@ -63,7 +63,7 @@ public Object visitVariable(Variable variable, Object arg) {
6363 if (substitution .containsKey (variable )) {
6464 return substitution .get (variable ).copy ();
6565 }
66- return variable ;
66+ return variable . copy () ;
6767 }
6868
6969 @ SuppressWarnings ("unchecked" )
@@ -83,12 +83,12 @@ public Object visitQuantifiedSentence(QuantifiedSentence sentence,
8383 if (st instanceof Variable ) {
8484 // Only if it is a variable to I replace it, otherwise
8585 // I drop it.
86- variables .add ((Variable ) st );
86+ variables .add ((Variable ) st . copy () );
8787 }
8888 } else {
8989 // No substitution for the quantified variable, so
9090 // keep it.
91- variables .add (v );
91+ variables .add (v . copy () );
9292 }
9393 }
9494
0 commit comments