Skip to content

Commit 10735be

Browse files
committed
Specify ABA rule grouping
1 parent 83e859c commit 10735be

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tests/test_aba.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,29 @@ def test_bitvec_ranked_closure_matches_native_closure(
313313
assert ranked_closure == native_aba._closure(framework, selected)
314314

315315

316+
def test_rules_by_consequent_groups_rules_deterministically() -> None:
317+
a1 = literal("a1")
318+
a2 = literal("a2")
319+
x = literal("x")
320+
y = literal("y")
321+
z = literal("z")
322+
first = Rule((a2,), x, "strict")
323+
second = Rule((a1,), x, "strict")
324+
third = Rule((x,), y, "strict")
325+
framework = ABAFramework(
326+
language=frozenset({a1, a2, x, y, z}),
327+
rules=frozenset({third, first, second}),
328+
assumptions=frozenset({a1, a2}),
329+
contrary={a1: y, a2: z},
330+
)
331+
332+
grouped = aba_sat._rules_by_consequent(framework, tuple(sorted(framework.language, key=repr)))
333+
334+
assert grouped[x] == tuple(sorted((first, second), key=repr))
335+
assert grouped[y] == (third,)
336+
assert grouped[z] == ()
337+
338+
316339
@given(flat_aba_frameworks(), st.data())
317340
@settings(deadline=10000, max_examples=40)
318341
def test_preferred_support_sat_preserves_required_assumptions(

0 commit comments

Comments
 (0)