Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify flatten_*op rules into flatten_generic #585

Merged
merged 3 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ such that
--

Sum([|x|, |y|]),
~~> flatten_vecop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
Sum([__0, __1])
new variables:
__0: int(0..5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ such that
--

Sum([|x|, |y|]),
~~> flatten_vecop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
Sum([__0, __1])
new variables:
__0: int(0..5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ And([(Sum([|Sum([SafeDiv(x, 2), y, -(z)])|, SafeDiv(|y|, 2)]) = 10)]),
--

Sum([|Sum([SafeDiv(x, 2), y, -(z)])|, SafeDiv(|y|, 2)]),
~~> flatten_vecop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
Sum([__0, __1])
new variables:
__0: int(0..10)
Expand All @@ -166,7 +166,7 @@ new constraints:
--

|Sum([SafeDiv(x, 2), y, -(z)])|,
~~> flatten_unop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
|__2|
new variables:
__2: int(-10..8)
Expand All @@ -181,7 +181,7 @@ AbsEq(__0,__2)
--

SafeDiv(|y|, 2),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
SafeDiv(__3, 2)
new variables:
__3: int(0..5)
Expand All @@ -202,7 +202,7 @@ DivEq(__3, 2, __1)
--

Sum([SafeDiv(x, 2), y, -(z)]),
~~> flatten_vecop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
Sum([__4, y, __5])
new variables:
__4: int(-3..1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ such that
--

Product([y, |x|]),
~~> flatten_vecop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
Product([y, __0])
new variables:
__0: int(0..3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Not((c != 0)),
--

(a != SafeDiv(b, c)),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(a != __0)
new variables:
__0: int(0..3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ And([(c != 0)]),
--

(a != SafeDiv(b, c)),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(a != __0)
new variables:
__0: int(0..3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Not((c != 0)),
--

(a != SafeDiv(b, c)),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(a != __0)
new variables:
__0: int(0..3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Not((c != 0)),
--

(a != SafeMod(b,c)),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(a != __0)
new variables:
__0: int(0..2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ And([(c != 0)]),
--

(a != SafeMod(b,c)),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(a != __0)
new variables:
__0: int(0..2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Not((c != 0)),
--

(a != SafeMod(b,c)),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(a != __0)
new variables:
__0: int(0..2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ And([(z != 0)]),
--

SafeDiv(-(y), z),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
SafeDiv(__0, z)
new variables:
__0: int(-1..1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,21 @@ And([(z != 0)]),

--

(x = -(SafeDiv(y, z))),
~~> flatten_minuseq ([("Minion", 4200)])
MinusEq(x,__0)
-(SafeDiv(y, z)),
~~> flatten_generic ([("Minion", 4200)])
-(__0)
new variables:
__0: int(-1..1)
new constraints:
__0 =aux SafeDiv(y, z)
--

(x = -(__0)),
~~> introduce_minuseq_from_eq ([("Minion", 4400)])
MinusEq(x,__0)

--

__0 =aux SafeDiv(y, z),
~~> introduce_diveq ([("Minion", 4200)])
DivEq(y, z, __0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ And([(x = SafeDiv(-(SafeDiv(y, z)), z)), (z != 0), (z != 0)])
--

SafeDiv(-(SafeDiv(y, z)), z),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
SafeDiv(__0, z)
new variables:
__0: int(-1..1)
Expand All @@ -97,15 +97,21 @@ DivEq(__0, z, x)

--

__0 =aux -(SafeDiv(y, z)),
~~> flatten_minuseq ([("Minion", 4200)])
MinusEq(__0,__1)
-(SafeDiv(y, z)),
~~> flatten_generic ([("Minion", 4200)])
-(__1)
new variables:
__1: int(-1..1)
new constraints:
__1 =aux SafeDiv(y, z)
--

__0 =aux -(__1),
~~> introduce_minuseq_from_aux_decl ([("Minion", 4400)])
MinusEq(__0,__1)

--

__1 =aux SafeDiv(y, z),
~~> introduce_diveq ([("Minion", 4200)])
DivEq(y, z, __1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ such that
--

Sum([-(y), z]),
~~> flatten_vecop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
Sum([__0, z])
new variables:
__0: int(-1..1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ a
--

Sum([-(y), -(z), -1, a, b]),
~~> flatten_vecop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
Sum([__0, __1, -1, a, b])
new variables:
__0: int(-1..1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Sum([15, -1]),
--

(Product([x, y, z]) <= 14),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(__0 <= 14)
new variables:
__0: int(8..64)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ And([(a != 0)]),
--

SafeDiv(Sum([x, y, z]), a),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
SafeDiv(__0, a)
new variables:
__0: int(6..14)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ such that
--

Sum([Product([2, x]), Product([3, y])]),
~~> flatten_vecop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
Sum([__0, __1])
new variables:
__0: int(4..8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ And([(SafeDiv(x, SafeDiv(y, z)) = 10), (SafeDiv(y, z) != 0), (z != 0)])
--

SafeDiv(x, SafeDiv(y, z)),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
SafeDiv(x, __0)
new variables:
__0: int(0..5)
Expand All @@ -86,7 +86,7 @@ DivEq(x, __0, 10)
--

(SafeDiv(y, z) != 0),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(__1 != 0)
new variables:
__1: int(0..5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ And([(SafeDiv(x, SafeDiv(y, z)) != 10), (SafeDiv(y, z) != 0), (z != 0)])
--

(SafeDiv(x, SafeDiv(y, z)) != 10),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(__0 != 10)
new variables:
__0: int(0..20)
Expand All @@ -80,7 +80,7 @@ new constraints:
--

(SafeDiv(y, z) != 0),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(__1 != 0)
new variables:
__1: int(0..5)
Expand All @@ -89,7 +89,7 @@ new constraints:
--

SafeDiv(x, SafeDiv(y, z)),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
SafeDiv(x, __2)
new variables:
__2: int(0..5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Not((z != 0)),
--

(SafeDiv(x, SafeDiv(y, z)) != 10),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(__0 != 10)
new variables:
__0: int(0..20)
Expand All @@ -110,7 +110,7 @@ DivEq(y, z, 0)
--

SafeDiv(x, SafeDiv(y, z)),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
SafeDiv(x, __1)
new variables:
__1: int(0..5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ And([(SafeMod(x,SafeMod(y,z)) = 3), (SafeMod(y,z) != 0), (z != 0)])
--

SafeMod(x,SafeMod(y,z)),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
SafeMod(x,__0)
new variables:
__0: int(0..5)
Expand All @@ -86,7 +86,7 @@ ModEq(x, __0, 3)
--

(SafeMod(y,z) != 0),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(__1 != 0)
new variables:
__1: int(0..5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ And([(SafeMod(x,SafeMod(y,z)) != 3), (SafeMod(y,z) != 0), (z != 0)])
--

(SafeMod(x,SafeMod(y,z)) != 3),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(__0 != 3)
new variables:
__0: int(0..2)
Expand All @@ -80,7 +80,7 @@ new constraints:
--

(SafeMod(y,z) != 0),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(__1 != 0)
new variables:
__1: int(0..3)
Expand All @@ -89,7 +89,7 @@ new constraints:
--

SafeMod(x,SafeMod(y,z)),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
SafeMod(x,__2)
new variables:
__2: int(0..3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Not((z != 0)),
--

(SafeMod(x,SafeMod(y,z)) != 3),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
(__0 != 3)
new variables:
__0: int(0..2)
Expand All @@ -110,7 +110,7 @@ ModEq(y, z, 0)
--

SafeMod(x,SafeMod(y,z)),
~~> flatten_binop ([("Minion", 4200)])
~~> flatten_generic ([("Minion", 4200)])
SafeMod(x,__1)
new variables:
__1: int(0..3)
Expand Down
Loading
Loading