File tree Expand file tree Collapse file tree
liquidjava-verifier/src/main/java/liquidjava/rj_language/opt Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package liquidjava .rj_language .opt ;
22
3+ import java .util .List ;
4+ import java .util .function .UnaryOperator ;
5+
36import liquidjava .processor .VCImplication ;
47
58/**
69 * Simplifies VCImplication chains by applying various simplification steps
710 */
811public class VCSimplification {
912
13+ private static final List <UnaryOperator <VCImplication >> PASSES = List .of (VCSubstitution ::apply , VCFolding ::apply ,
14+ VCArithmeticSimplification ::apply );
15+
1016 /**
1117 * Applies all available simplification steps to a VC chain until a fixed point is reached
1218 */
@@ -31,17 +37,11 @@ public static VCImplication simplifyOnce(VCImplication implication) {
3137 if (implication == null )
3238 return null ;
3339
34- // substitution
35- VCImplication substituted = VCSubstitution .apply (implication );
36- if (!implication .equals (substituted ))
37- return substituted ;
38-
39- // folding
40- VCImplication folded = VCFolding .apply (implication );
41- if (!implication .equals (folded ))
42- return folded ;
43-
44- // arithmetic simplification
45- return VCArithmeticSimplification .apply (implication );
40+ for (UnaryOperator <VCImplication > pass : PASSES ) {
41+ VCImplication simplified = pass .apply (implication );
42+ if (!implication .equals (simplified ))
43+ return simplified ;
44+ }
45+ return implication ;
4646 }
4747}
You can’t perform that action at this time.
0 commit comments