Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
e38d99d
Add SimplifiedExpression
rcosta358 Jun 8, 2026
208249f
Change SimplifiedExpression to SimplifiedPredicate
rcosta358 Jun 8, 2026
92359f3
Requested Changes
rcosta358 Jun 9, 2026
de68c47
Formatting
rcosta358 Jun 9, 2026
8bb6fb4
Minor Changes
rcosta358 Jun 9, 2026
ba977dc
Add VC Substitution
rcosta358 Jun 8, 2026
82eb3be
Add Comments
rcosta358 Jun 8, 2026
63a1c21
SimplifiedPredicate Follow-Up
rcosta358 Jun 8, 2026
36fd1fd
Add `simplifyOnce`
rcosta358 Jun 8, 2026
e8e07d5
Code Refactoring
rcosta358 Jun 9, 2026
27061e9
Add Comment
rcosta358 Jun 9, 2026
47c1844
Code Refactoring
rcosta358 Jun 9, 2026
a3b4f29
Add Fixed Point Iteration
rcosta358 Jun 9, 2026
659a139
Requested Changes
rcosta358 Jun 9, 2026
7f6f9d2
Rename
rcosta358 Jun 9, 2026
2e145d3
Replace `SimplifiedPredicate` with `SimplifiedVCImplication`
rcosta358 Jun 9, 2026
ba81c3a
Refactoring
rcosta358 Jun 9, 2026
43a0bef
Minor Change
rcosta358 Jun 9, 2026
fa7eff5
Add Tests
rcosta358 Jun 11, 2026
607e1b5
Change SimplifiedExpression to SimplifiedPredicate
rcosta358 Jun 8, 2026
0b060bb
Add VC Folding
rcosta358 Jun 9, 2026
7bb0632
Add Fixed Point Iteration
rcosta358 Jun 9, 2026
4c39689
Use SimplifiedVCImplication
rcosta358 Jun 9, 2026
981c63f
Refactoring
rcosta358 Jun 9, 2026
b374c66
Fix
rcosta358 Jun 9, 2026
67b05ce
Refactoring
rcosta358 Jun 9, 2026
9ffbe14
Add Comments
rcosta358 Jun 10, 2026
68c3b42
Refactoring
rcosta358 Jun 10, 2026
eab59f7
Refactoring
rcosta358 Jun 10, 2026
11be88b
Simplify VCFolding
rcosta358 Jun 10, 2026
84f9727
Add Tests
rcosta358 Jun 11, 2026
99131d4
Fixes
rcosta358 Jun 11, 2026
8cde2d2
Update Tests
rcosta358 Jun 11, 2026
ee3919c
Refactor Tests
rcosta358 Jun 11, 2026
cb0cb2e
Update VCImplicationGenerator
rcosta358 Jun 11, 2026
35895a3
Minor Changes
rcosta358 Jun 11, 2026
e4258aa
Minor Changes
rcosta358 Jun 12, 2026
804c7a6
Update Tests
rcosta358 Jun 12, 2026
1043d1a
Refactor Tests
rcosta358 Jun 12, 2026
9fc831a
Add Comments
rcosta358 Jun 13, 2026
b813bb7
Add VC Arithmetic Simplification
rcosta358 Jun 13, 2026
0a04e5b
Add Comments
rcosta358 Jun 13, 2026
e5d9162
Renaming
rcosta358 Jun 13, 2026
f4250de
Update Comments
rcosta358 Jun 13, 2026
334ff7e
Refactor Simplification Passes
rcosta358 Jun 13, 2026
eb9ff24
Add VC Logical Simplification
rcosta358 Jun 13, 2026
d8f9aee
Fix Origins
rcosta358 Jun 13, 2026
f9e4624
Fix Origins
rcosta358 Jun 13, 2026
63aeaf9
Fix Origins
rcosta358 Jun 13, 2026
28c5a0f
Refactor VC Simplification
rcosta358 Jun 14, 2026
8b148b0
Minor Changes
rcosta358 Jun 14, 2026
9bc108f
Minor Changes
rcosta358 Jun 14, 2026
8588a9d
Add VC Binder Simplification
rcosta358 Jun 14, 2026
5fbcef7
Return Null Origin for Unsimplified VCs
rcosta358 Jun 15, 2026
d068108
Fix VC Substitution
rcosta358 Jun 17, 2026
935a168
VC Simplification Refactoring
rcosta358 Jun 17, 2026
5c73350
Use VC Implication Simplification
rcosta358 Jun 17, 2026
e789e05
Remove Expression-Based Simplification Classes
rcosta358 Jun 17, 2026
8932b49
Don't Simplify Expected Type
rcosta358 Jun 17, 2026
b54a9e3
Merge branch 'main' into simplification-migration
rcosta358 Jun 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update Comments
  • Loading branch information
rcosta358 committed Jun 13, 2026
commit f4250de68c9a8d1dc006643e44ef0b9e6267b971
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
import liquidjava.rj_language.ast.UnaryExpression;

/**
* Simplifies VCImplication chains by applying arithmetic identities inside refinements.
* Simplifies VCImplication chains by applying arithmetic identities inside refinements
*/
public class VCArithmeticSimplification {

/**
* Applies the first arithmetic simplification available in a VC chain.
* Applies the first arithmetic simplification available in a VC chain
*/
public static VCImplication apply(VCImplication implication) {
if (implication == null)
Expand Down Expand Up @@ -55,7 +55,7 @@ private static VCImplication apply(VCImplication implication, List<Expression> n
}

/**
* Simplifies the first arithmetic identity found inside an expression.
* Simplifies the first arithmetic identity found inside an expression
*/
private static Expression simplify(Expression expression, List<Expression> nonZeroExpressions) {
if (expression instanceof BinaryExpression binary)
Expand All @@ -70,7 +70,7 @@ private static Expression simplify(Expression expression, List<Expression> nonZe
}

/**
* Simplifies a binary expression by visiting operands before the current node.
* Simplifies a binary expression by visiting operands before the current node
*/
private static Expression simplifyBinary(BinaryExpression binary, List<Expression> nonZeroExpressions) {
Expression left = binary.getFirstOperand();
Expand All @@ -91,7 +91,7 @@ private static Expression simplifyBinary(BinaryExpression binary, List<Expressio
}

/**
* Simplifies a unary expression by visiting its operand before the current node.
* Simplifies a unary expression by visiting its operand before the current node
*/
private static Expression simplifyUnary(UnaryExpression unary, List<Expression> nonZeroExpressions) {
Expression operand = unary.getExpression();
Expand All @@ -107,7 +107,7 @@ private static Expression simplifyUnary(UnaryExpression unary, List<Expression>
}

/**
* Simplifies a ternary expression by visiting condition, then branch, and else branch.
* Simplifies a ternary expression by visiting condition, then branch, and else branch
*/
private static Expression simplifyIte(Ite ite, List<Expression> nonZeroExpressions) {
Expression condition = ite.getCondition();
Expand All @@ -129,7 +129,7 @@ private static Expression simplifyIte(Ite ite, List<Expression> nonZeroExpressio
}

/**
* Simplifies an expression wrapped in parentheses while preserving the group node.
* Simplifies an expression wrapped in parentheses while preserving the group node
*/
private static Expression simplifyGroup(GroupExpression group, List<Expression> nonZeroExpressions) {
Expression expression = group.getExpression();
Expand All @@ -140,7 +140,7 @@ private static Expression simplifyGroup(GroupExpression group, List<Expression>
}

/**
* Dispatches a local binary arithmetic identity by operator.
* Dispatches a local binary arithmetic identity by operator
*/
private static Expression simplifyLocalBinary(Expression left, Expression right, String op,
List<Expression> nonZeroExpressions) {
Expand All @@ -155,7 +155,7 @@ private static Expression simplifyLocalBinary(Expression left, Expression right,
}

/**
* Applies addition identities involving zero and unary negation.
* Applies addition identities involving zero and unary negation
*/
private static Expression simplifyAddition(Expression left, Expression right) {
// x + 0 -> x
Expand All @@ -177,7 +177,7 @@ private static Expression simplifyAddition(Expression left, Expression right) {
}

/**
* Applies subtraction identities involving zero, same operands, and unary negation.
* Applies subtraction identities involving zero, same operands, and unary negation
*/
private static Expression simplifySubtraction(Expression left, Expression right) {
// x - 0 -> x
Expand All @@ -196,7 +196,7 @@ private static Expression simplifySubtraction(Expression left, Expression right)
}

/**
* Applies multiplication identities involving one and zero.
* Applies multiplication identities involving one and zero
*/
private static Expression simplifyMultiplication(Expression left, Expression right) {
// x * 1 -> x
Expand All @@ -215,7 +215,7 @@ private static Expression simplifyMultiplication(Expression left, Expression rig
}

/**
* Applies division identities, using prior non-zero premises when needed.
* Applies division identities, using prior non-zero premises when needed
*/
private static Expression simplifyDivision(Expression left, Expression right, List<Expression> nonZeroExpressions) {
// x / 1 -> x
Expand All @@ -231,7 +231,7 @@ private static Expression simplifyDivision(Expression left, Expression right, Li
}

/**
* Applies modulo identities, using prior non-zero premises when needed.
* Applies modulo identities, using prior non-zero premises when needed
*/
private static Expression simplifyModulo(Expression left, Expression right, List<Expression> nonZeroExpressions) {
// x % 1 -> 0
Expand All @@ -244,7 +244,7 @@ private static Expression simplifyModulo(Expression left, Expression right, List
}

/**
* Records direct non-zero premises shaped as expr != 0 or 0 != expr.
* Records direct non-zero premises shaped as x != 0 or 0 != x
*/
private static void addNonZeroExpression(Expression expression, List<Expression> nonZeroExpressions) {
if (!(expression instanceof BinaryExpression binary) || !"!=".equals(binary.getOperator()))
Expand All @@ -259,14 +259,14 @@ private static void addNonZeroExpression(Expression expression, List<Expression>
}

/**
* Checks whether a previous premise recorded an expression as non-zero.
* Checks whether a previous premise recorded an expression as non-zero
*/
private static boolean isNonZero(Expression expression, List<Expression> nonZeroExpressions) {
return nonZeroExpressions.stream().anyMatch(e -> e.equals(expression));
}

/**
* Checks whether an expression is a numeric zero literal.
* Checks whether an expression is a numeric zero literal
*/
private static boolean isZero(Expression expression) {
if (expression instanceof LiteralInt literal)
Expand All @@ -277,7 +277,7 @@ private static boolean isZero(Expression expression) {
}

/**
* Checks whether an expression is a numeric one literal.
* Checks whether an expression is a numeric one literal
*/
private static boolean isOne(Expression expression) {
if (expression instanceof LiteralInt literal)
Expand All @@ -288,14 +288,14 @@ private static boolean isOne(Expression expression) {
}

/**
* Checks whether an expression is unary negation.
* Checks whether an expression is unary negation
*/
private static boolean isNegation(Expression expression) {
return expression instanceof UnaryExpression unary && "-".equals(unary.getOp());
}

/**
* Reads the operand of a unary negation expression.
* Returns the operand of a unary negation expression
*/
private static Expression negatedExpression(Expression expression) {
return ((UnaryExpression) expression).getExpression();
Expand Down
Loading