Fix Datalog grounding projection: instance-specific defeaters, full provenance, fresh rule names - #93
Merged
Merged
Conversation
_defeater_targets matched a named defeater ~r(t...) against every ground instance of r, ignoring its arguments, so ~birds_fly(a) also undercut birds_fly(b). Each ground instance r theta is its own rule (Diller et al. 2025), so match the defeater's arguments against the instance's substitution values in Gunray's variable order; a nullary ~r still names every instance. Closes #66 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V4tAVyyKcs1sYcsEzL7Bzg
Distinct authored strict rules that ground to the same ASPIC+ rule share one Rule value, and source_to_ground_rules was built from a Rule-keyed origin map, so the later origin overwrote the earlier and s1 vanished. Build the source-to-ground relation from every (rule, origin) pair, which also keeps superiority projection for every authored id, and make the single-origin rule_origins map deterministic (first authored origin). Closes #67 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V4tAVyyKcs1sYcsEzL7Bzg
…ates The projector named ground rules gr0, gr1, ... and undercut rules uc0, ... without reserving them against the authored language. Rule names are literals n(r) that undercuts target (Diller et al. 2025, Def 3), so an unrelated authored fact ~gr0 became an undercutter of the first rule. Reserve every authored predicate and suffix a generated name until fresh. Closes #68 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V4tAVyyKcs1sYcsEzL7Bzg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V4tAVyyKcs1sYcsEzL7Bzg
A named defeater ~r(t1, ..., tn) matched t1..tn against Gunray's substitution, which is sorted alphabetically, so for rel(Y, A) :- pair(Y, A) the defeater ~r(a, b) undercut Y = b, A = a. Per the maintainer's decision on #66, the arguments bind r's variables in first-appearance order: head terms left to right, then body literals left to right. ground_defeasible_theory derives that order from the theory's rule text (new rule_variable_orders helper) and passes it to grounding_inspection_to_aspic. A bare inspection carries no rule text, so a named defeater with arguments there raises ValueError unless the caller supplies rule_variable_orders, instead of guessing an order. Closes #66 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V4tAVyyKcs1sYcsEzL7Bzg
Owner
Author
Rework of #66: named-defeater arguments now bind variables in first-appearance orderPer the maintainer's decision on #66, a named defeater Commit 1226159:
Regression tests in
The branch has also been merged with main 6441acd, which includes #99's Def 14 core semantics change. Gates on 1226159:
|
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.
Three fixes to the Gunray Datalog-to-ASPIC+ projection in
structured/aspic/datalog_grounding.py. Each issue has its own commit with a failing regression test and a valid neighboring control.~r(t...)matched every ground instance of rulerand ignored its arguments, so~birds_fly(a)also undercutbirds_fly(b). Diller et al. 2025 ground each instance r-theta as its own rule. The defeater's arguments are now compared with the target instance's substitution values, in Gunray's variable order (sorted by variable name). A nullary~rstill names every instance. Convention to review: with more than one variable, the positions follow that sorted order.Ruleoverwrote each other in the Rule-keyed origin map, sosource_to_ground_rulesdroppeds1. The source-to-ground relation (which superiority projection also uses) is now built from every (rule, origin) pair.rule_originsstill holds one origin per rule; it is now deterministic, keeping the first authored origin instead of the last.gr{i}anduc{i}were not reserved against the authored language. Because rule names are literals n(r) that undercuts target (Diller et al. 2025, Def 3), an unrelated fact~gr0undercut the first rule. Every authored predicate is now reserved, and a generated name gets a numeric suffix until it is fresh. Names that don't collide stay asgr0/uc0.Gates:
tests/structured/aspic/test_aspic.py::TestAttackProperties::test_rebutting_targets_defeasible_conclusions. It hangs for more than 600s incompute_attacks. The file is unchanged here and the hang is reported separately.tests/structured/aspicgives 152 passed, 1 deselected. CI covers the full suite on the final tree.pyright srcreports 0 errors.lint-importsreports 2 kept, 0 broken.ruff checkandruff format --checkpass on the changed files.Closes #66
Closes #67
Closes #68
🤖 Generated with Claude Code
https://claude.ai/code/session_01V4tAVyyKcs1sYcsEzL7Bzg