1212import liquidjava .rj_language .ast .Expression ;
1313import liquidjava .rj_language .ast .Var ;
1414
15- import static liquidjava .rj_language .opt .VCSimplificationUtils .*;
16-
1715/**
1816 * Simplifies VCImplication chains by replacing binder equalities with their known values
1917 */
@@ -55,7 +53,7 @@ private static VCImplication substitute(VCImplication implication, VCImplication
5553 return substitute (implication .getNext (), source , value );
5654
5755 Predicate refinement = substituteRefinement (implication .getRefinement (), source , value );
58- VCImplication result = VCSimplificationUtils . copyWithRefinement (implication , refinement );
56+ VCImplication result = new VCImplication (implication , refinement );
5957 result .setNext (substitute (implication .getNext (), source , value ));
6058 return result ;
6159 }
@@ -64,11 +62,11 @@ private static VCImplication substitute(VCImplication implication, VCImplication
6462 * Substitutes a source binder inside one predicate while preserving simplification metadata
6563 */
6664 private static Predicate substituteRefinement (Predicate refinement , VCImplication source , Expression value ) {
67- Expression active = activeExpression ( refinement );
65+ Expression active = refinement . getExpression (). clone ( );
6866 Binder binder = new Binder (source .getName (), source .getType ());
6967 Expression substituted = active .substitute (new Var (binder .getName ()), value .clone ());
7068
71- return new SimplifiedPredicate (new Predicate (substituted ), VCSimplificationUtils . originPredicate ( refinement ),
69+ return new SimplifiedPredicate (new Predicate (substituted ), refinement . getOrigin (). clone ( ),
7270 bindersAfterSubstitution (refinement , active , binder ));
7371 }
7472
@@ -105,7 +103,7 @@ private static Optional<Substitution> getSubstitution(VCImplication implication)
105103 if (!implication .hasBinder ())
106104 return Optional .empty ();
107105
108- Expression refinement = activeExpression ( implication .getRefinement ());
106+ Expression refinement = implication .getRefinement (). getExpression (). clone ( );
109107 if (!(refinement instanceof BinaryExpression binary ) || !"==" .equals (binary .getOperator ()))
110108 return Optional .empty ();
111109
0 commit comments