Follow Modgil & Prakken 2018 Def 14 on mixed attack/defeat frameworks - #99
Merged
Merged
Conversation
…works
Core semantics disagreed when attacks differ from defeats: grounded
ignored attacks and returned a set that conflicts on them, preferred
enumerated every subset, and the solver layer (grounded reduct, SCC
recursion over defeats, SAT kernels and shortcuts) returned sets such as
{a, c} that are not conflict-free on attacks.
- grounded_extension is the least complete extension: the defeat-based
least fixed point, or ValueError when it conflicts on attacks (then no
complete extension exists). grounded_extensions/extensions_for return ()
there, like complete and stable.
- Mixed preferred (maximal Def 14 admissible) uses a pruned search instead
of subset enumeration; an operational contract bounds its nodes (2N+1 on
40-argument fixtures) and forbids subset enumeration.
- attacks_resolved_by_defeats gates the grounded reduct, the SCC recursion,
the SAT single-extension/acceptance kernels and preferred shortcuts; mixed
frameworks with an attack that is a defeat in neither direction use the
core Def 14 enumeration.
- Single-relation frameworks are unchanged, checked against a verbatim copy
of the pre-change implementation.
Updated existing tests (both asserted the withdrawn contract that grounded
ignores attacks):
- tests/core/test_dung.py test_grounded_ignores_attack_metadata: now expects
ValueError, plus a failed-rebuttal control with grounded {B}.
- tests/core/test_bipolar_argumentation.py
test_grounded_extension_ignores_attack_metadata: now expects ValueError.
Closes #90
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V4tAVyyKcs1sYcsEzL7Bzg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the revised contract in #90: Modgil & Prakken 2018, Def 14, on mixed attack/defeat frameworks. Conflict-freeness is checked on attacks; defense and admissibility on defeats.
Core semantics (
core/dung.py)grounded_extensionnow returns the least complete extension. It computes the least fixed point of the defeat-based characteristic function, which is contained in every complete extension. If that set is conflict-free on attacks, it is the least complete extension. If it is not, no complete extension exists and the function raisesValueError. The newgrounded_extensions()andextensions_for(..., "grounded")return()in that case instead, matching how complete and stable report no extensions._mixed_preferred_search) instead of enumerating every subset.Solver layer (pre-existing Def 14 violations)
On mixed frameworks where some attack is a defeat in neither direction, the solver layer returned wrong results. It returned
{a, c}althoughaattacksc, and it answered skeptical preferred acceptance withTruewhere the answer isFalse. There were three causes:The new
attacks_resolved_by_defeats(framework)returns True when every attack is a defeat in at least one direction. It is used as a gate in several places:simplify_afapplies the grounded reduct only when it holds.scc_extensionsfalls back to the flat Def 14 enumeration when it doesn't.af_sat's preferred-skeptical shortcuts after the self-attack check run only when it holds.When it holds (including every single-relation framework), the least fixed point is conflict-free on attacks and contained in every preferred extension, so those optimisations stay in place.
A random differential over 250 frameworks with 2–5 arguments compared native, sat and auto backends for enumeration, single extension, and credulous/skeptical acceptance. All agree with core Def 14 after the fix.
Audit of
grounded_extensioncallersgrounded_extensions(return()when there is no complete extension):extensions_for, which covers probabilistic worlds, dynamics, CAF and partial AF;semantics._dung_extensions;solver._dung_extensions;sat_encoding; the materialized ASPIC extensions; and ICCMA grounded witness validation, where a witness for a framework with no grounded extension is now rejected.bipolar_grounded_extension,ranking/weighted, and theaf_satacyclic fragment, which was already gated.af_satpreferred-skeptical shortcut andsimplify_af.ValueError(public grounded-only APIs on user frameworks):solve_aspic_grounded(docstring updated),cayrol_2014_classify_grounded_argument_addition, andgradual/sensitivity.{a: 0, b: 0.5}.Tests
New file
tests/core/test_def14_mixed_semantics.py:ValueError; complete and stable are[]; preferred is[{a}, {b}].tests/core/pre_def14_reference.py, a verbatim copy of the pre-change implementation.Scope note on the property. The acceptance criterion "preferred equals the maximal complete extensions" is false for arbitrary mixed frameworks that do have a complete extension. Exhaustive checking over 3-argument frameworks found 540 counterexamples out of 10,664. One example: attacks {(a,b), (a,c), (b,a)} with defeats {(a,b), (b,a)} gives preferred {a}, {b,c} but maximal complete {b,c}. The criterion holds when every attack is a defeat in some direction: 0 counterexamples exhaustively at 3 arguments and in 4,000 random frameworks each at 4 and 5 arguments. So that property test uses such frameworks, and the separate arbitrary-framework property tests preferred as maximal admissible.
Two existing tests updated. Both asserted the withdrawn behaviour that grounded ignores attacks and returns {A, B}. They now expect
ValueError, and one gains a failed-rebuttal control:tests/core/test_dung.pytests/core/test_bipolar_argumentation.pyCloses #90
🤖 Generated with Claude Code
https://claude.ai/code/session_01V4tAVyyKcs1sYcsEzL7Bzg