Repository navigation
Adf rework - #28
Merged
Merged
Adf rework#28
Conversation
Maven 3.10 rejects duplicate plugin declarations, so no module built with mvn.
… k++ADF IO New classes alongside the old implementation (removed in phase 7): - syntax: AbstractDialecticalFramework (BeliefSet + Graph over Dung arguments, PlFormula acceptance conditions, detached getters, validated atomic mutation with revision counter, reduct, restrict, fromDungTheory), Link, LinkType, AcceptanceConditions - semantics: TruthValue, ThreeValuedInterpretation (Kleene evaluation for all connectives, information order, consensus, lazy completions, AF conversions), CharacteristicOperator (Kleene fast path, parent-restricted completions), CompiledAdf (shared int/byte evaluation core) - analysis: LinkTypeClassifier (syntactic polarity certificate, exact truth table up to 20 parents, logics-pl SAT otherwise) - io: KppAdfParser, KppAdfWriter Adds the pl dependency and JUnit 5 (vintage engine keeps the old tests). Tests cover the course chapter 3.6 examples, Kleene truth tables, ownership and mutation contracts, and differential checks of Γ and link types against their definitions on random ADFs.
- AbstractAdfReasoner: closeable lazy ModelIterator, getModels/getModel,
isModel, credulous/skeptical query and queryAll by early-exit enumeration,
getSimpleReasonerForSemantics
- Simple{TwoValuedModel,ThreeValuedModel,ConflictFree,Naive,Admissible,
Complete,Grounded,Preferred,Stable}AdfReasoner on a compiled snapshot;
3^n / 2^n enumeration with interruption support, direct verification
- BruteForceOracle (tests): definitional Γ over all completions on PlFormulas,
pairwise maximality, stable via AbstractDialecticalFramework.reduct
Tests: course and Brewka et al. 2013 examples (incl. cyclic support), the
ADM-vs-3MOD and non-canonical admissible counterexamples, enumeration and
isModel against the oracle on 1500 random ADFs with all connectives,
inclusions between semantics, AF correspondence with the Dung reasoners,
query conventions without models, iterator closing, snapshots and
cancellation.
…n 4) Standalone Maven project org-tweetyproject-arg-adf/bench, not part of the reactor: - common: runner protocol (untimed parse per repetition, timed solve with wall and thread CPU time, SOLVE_START/SOLVE_END progress on stderr, one JSON result line), canonical order-independent answer hash - runner-old: frozen baseline (adf:1.31-baseline, built from tag adf-baseline) with native MiniSat, explicit iterator over a closed stream - runner-new: current SNAPSHOT, Simple* reasoners until phase 4 - driver: seeded instance families (af, bipolar, general), one pinned JVM per run with per-solve timeout and watchdog, chains per implementation and family that skip larger sizes after all instances time out, resumable JSONL with run header, Markdown/CSV report Not yet covered: hot-fixed baseline, independent oracle in the driver, tasks other than EE, cold mode, plots.
…4..20, 5 each, seed 2026)
…pter
ThreeValuedInterpretation.toString now uses the k++ADF/DIAMOND notation
{t(a) f(b) u(c)} of the old implementation (sorted), so the web service's
answer format stays unchanged. Adds the harness README.
…ormativeThan Follows the naming of FourValuedWorld.isAtLeastAsInformativeAs in logics-translators; the receiver is the more informative side, so admissibility reads gamma(v).isAtLeastAsInformativeAs(v). Also fixes the direction of the course helper isMoreInformative in the consumer prototype.
Verification by enumeration was exponential where a direct check is polynomial or a single Γ check per argument; every reasoner must now state its verification procedure. The simple reasoners already did.
…ator getModels/getModel come from ModelProvider and are computed eagerly; query and queryAll are based on getModels as in AbstractExtensionReasoner. The simple reasoners collect their models in one loop over all candidates, which is as fast as the lazy enumeration for full enumeration. Keeps the interruption check so a timed-out web request stops computing.
Use v instead of υ for interpretations, remove section dividers and shorten several descriptions.
Complements ModelProvider with isModel(B, T). Adopted by the ADF module first; other modules can follow.
AbstractAdfReasoner implements ModelVerifier. The simple reasoners implement only isModel; AbstractSimpleAdfReasoner computes getModels by generate and test over all 3^n (or 2^n) interpretations. Grounded and preferred override getModels. CharacteristicOperator and LinkTypeClassifier work directly on ThreeValuedInterpretation. The test oracle evaluates completions with its own classical evaluator, so it shares no evaluation code with the reasoners.
Interpretations derived from each other (with, completions, consensus, Γ, candidate generation) share one immutable domain and copy only a TruthValue array instead of a map; comparisons over the same domain are positional, otherwise by name as before. Public API unchanged. About 3x faster for the simple reasoners (complete, n = 11: 1.8 s -> 0.6 s).
No cache across calls exists or is planned; reuse happens through explicitly held immutable objects instead.
runner-old copies adf:1.31-baseline and adf:1.31-baseline-fixed to target/adf and leaves them out of classpath.txt; the driver adds the jar of the selected implementation (old, old-fixed). run defaults to old,old-fixed,new. The report compares new with old-fixed when present and lists crashes of every implementation.
Oracle and KppAdf share no code with either ADF implementation: their own k++ADF parser (including n-ary and/or), strong Kleene evaluation and Gamma over completions of the undecided parents, written from the definitions in ARCHITECTURE.md for MOD, 3MOD, CF (k++ADF), NA, ADM, CO, GR, PR and ST. OracleTest covers the two review counterexamples (ADM vs 3MOD, noncanonical admissible AF interpretation), the baseline-bug reproducers, Kleene truth tables, parser errors and semantic inclusions on random instances. run solves instances with at most --oracle-max (10) arguments with the oracle first and records them as implementation oracle. The report gains a validation section (oracle-verified, wrong, agreement, disagreement, unchecked) and writes mismatches.jsonl with a reproduction command; the new check command runs one instance on the given implementations and prints the oracle's models. Canonical answers and hashes move to common/Answers.
Runner protocol: --task EE|CE|SE|DC|DS|VE with --arg (DC/DS) and --interpretation (VE, canonical form). The old runner answers SE with the first enumerated model, DC/DS with where(a).exists()/forAll() and VE by membership in the enumeration; the new runner uses getModel, query and isModel. Unsupported semantics are reported as unsupported. The driver freezes the queries per instance (Queries: three arguments for DC/DS; all-undecided, grounded, random and oracle-model candidates for VE) and records the oracle's expected answer per query. Oracle.verify checks a single interpretation for any size (PR/NA up to 12 undecided arguments), which gives VE answers and SE witnesses an independent check beyond the enumeration limit. The report has a section per (semantics, task) and compares answers per task (SE by existence of a model).
…olar, n = 50..200) generate gains --families; co-scaling still reproduces unchanged.
- Sat4jIncrementalSolver: pure-Java incremental solver with assumptions - MiniSat returned the complement of every model (value 0 means true) and read witnesses from a second solve without the assumptions - native libraries were loaded via getResource().getPath(), which fails inside a jar; NativeLibrary extracts them to a temporary file - closing a native solver twice crashed the JVM; close is now idempotent - Lingeling aborted the JVM when a variable was assumed again after a solve; variables are frozen on creation - witness returns null if the formula is unsatisfiable (before: an empty array, indistinguishable from an empty projection) - tests moved to JUnit 5: one parameterized test over all four backends
TseitinEncoder encodes PlFormula into clauses of an org.tweetyproject.sat solver with full equivalences; AdfEncoding holds the argument variables and condition literals. SatCharacteristicOperator computes Γ with two incremental calls per argument under the decided arguments as assumptions. SatTwoValuedModelAdfReasoner enumerates MOD with blocking clauses. Backends are chosen with a Supplier<SatSolver> constructor argument, Sat4j by default.
The new runner selects the SAT reasoners with --reasoner sat; semantics without one are reported as unsupported. The report pairs the reference with new-sat when it was run.
Follows the previous GroundGenerator: undecided arguments are decided by a tautology and an unsatisfiability check of their condition, and decided arguments are fixed by unit clauses. The new runner uses it for GR.
…ative The old ADF module bundles libraries with the same names but other JNI symbols at the resource root; on a shared classpath they shadowed these.
…cided As in the brute-force CharacteristicOperator, a decided Kleene value of phi_a under v agrees with Γ(v)(a).
Conflict-free encoding of k++ADF (Linsbichler et al., IJCAI 2018) with the enumeration and maximisation of k++ADF's enumerate_cf / enumerate_nai. SimpleConflictFreeAdfReasoner now cites the IJCAI 2018 paper.
Credulous CF/NA is one SAT call on the conflict-free encoding, skeptical CF is false, skeptical NA follows k++ADF's skept_nai; unlike skept_nai, it answers false if the all-undecided interpretation is the only naive one. References without section numbers.
As in k++ADF (Linsbichler et al., IJCAI 2018): the k-bipolar encoding if every argument has fewer than K dependent parents (default 31, k++ADF's), otherwise conflict-free candidates with the bipolar clauses, each verified by one SAT call. ConflictFreeEncoding becomes ThreeValuedEncoding with the conflict-free, bipolar and k-bipolar blocks added separately. LinkTypeClassifier decides links that have no syntactic polarity certificate with k++ADF's two SAT checks on the incremental backend instead of truth tables or the logics-pl solver; TseitinEncoder is public for it.
As in k++ADF (Linsbichler et al., IJCAI 2018): admissible interpretations strictly more informative than the grounded one are maximised on a second solver and excluded with Refine_>; skeptical acceptance as in skept_prf, except that it answers false if the grounded interpretation is the only preferred one. The admissible encoding relative to an interpretation moves to ThreeValuedEncoding.addAdmissible.
Two-valued models enumerated as in k++ADF, each checked against the grounded interpretation of its reduct (Brewka et al., IJCAI 2013, Def. 6) computed with SatGroundedAdfReasoner.
As in k++ADF (Linsbichler et al., IJCAI 2018): the grounded interpretation, then the models of the admissible encoding with k++ADF's complete clauses (com_bipolar_interpretation) if every argument has fewer than K dependent parents, otherwise Γ iterated from verified admissible candidates. Skeptical acceptance by the grounded interpretation, credulous as for admissible interpretations.
…tics The SAT reasoners share the solver supplier and the cancellation check in AbstractSatAdfReasoner, analogous to AbstractSimpleAdfReasoner. AbstractAdfReasoner.getSatReasonerForSemantics returns the SAT reasoner with Sat4j for CF, NA, ADM, CO, GR, PR and ST. Fixes the unresolved javadoc links to getModels that made the javadoc build fail.
The ADF is parsed with KppAdfParser and solved by the SAT reasoners of AbstractAdfReasoner.getSatReasonerForSemantics (Sat4j instead of native MiniSat). Request and answer format are unchanged, except that an interpretation without true arguments no longer starts with a space.
Acceptance conditions are PlFormulas now, so ConverterADF2CL no longer needs getFormulaFromAcc. The example programs use KppAdfParser and the SAT reasoners; PriestWorldIterator keeps its three-valued counter in a Boolean array instead of the removed ThreeValuedBitSet. The programs print the same results as before (conditions now in PlFormula syntax).
Deletes the old packages (reasoner pipeline, custom formula and SAT layers, query API, transformations, utilities, CLI), the bundled native solver libraries, the committed class files and the old JUnit 4 tests, together with the junit and junit-vintage-engine test dependencies. This also resolves the case-only clash between AbstractADFReasoner and AbstractAdfReasoner. New examples: AdfExample builds an ADF in code, AdfParserExample reads and writes the k++ADF format.
Comments: paper references are @see tags in the class comments; inline citations, references to the old implementation, the course text and the rework plan, and the section dividers are removed. Long class comments of the reasoners are shortened, and the clause sets of the SAT encoding are described in words instead of the paper's names and HTML entities. ConsumerPrototypeTest is removed and the course* tests are renamed. Layout: adf.io is split into adf.parser (KppAdfParser) and adf.writer (KppAdfWriter), as in the other arg modules, and TseitinEncoder moves to adf.util, so that analysis no longer depends on reasoner.sat. Translators and web import the parser from its new package. The benchmark harness in bench/ is no longer tracked.
Duplicated helpers are shared: ThreeValuedInterpretation.isDefinedOver is the one domain check, AcceptanceConditions.unsupportedConnective the one exception for unsupported connectives, and TseitinEncoder.trueLiteral supplies one literal fixed to true per solver to all encoders on it. AbstractDialecticalFramework.getChildren uses the name returned by requireArgument. SAT reasoners: AdfEncoding encodes the two-valued models and excludes found assignments for SatStable and SatTwoValuedModel. The bound check on the dependent parents is SatAdmissibleAdfReasoner.isExact, used by the complete and preferred reasoners instead of their own copy of the bound. ThreeValuedEncoding.addRefineUnequal and addRefineLarger are renamed to exclude and excludeLessInformative. KppAdfParser extends Parser<AbstractDialecticalFramework, PlFormula>; parseFormula parses a single acceptance condition, and the parse helpers are kept.
AdfEncoding is renamed to TwoValuedEncoding, and its assumptions method, which fixes only the decided arguments of an interpretation, to decided. AbstractAdfReasoner provides the default getModel (the first model or null) instead of AbstractSimpleAdfReasoner. The SAT reasoners and SatCharacteristicOperator work on the given ADF instead of copying it in every call. Some class comments are shortened.
The simple reasoners are the reference for the SAT reasoners, so the separate BruteForceOracle is removed. The SAT tests are one parameterized test per semantics against the simple reasoners on 100 random ADFs and the empty ADF. The inclusions between the semantics and the correspondence with the Dung semantics move into SimpleAdfReasonerTest with fewer random inputs. Duplicated tests and test helpers are removed; the classical evaluation, Γ by its definition and the enumeration of all interpretations are shared in AdfTestSupport.
Simple and SAT-based reasoners for initial models (IS). The SAT reasoner verifies with Algorithm 1 of Strass and Wallner (COMMA 2026) and enumerates by minimising non-trivial admissible interpretations. The admissible candidate step is shared with the preferred reasoner. IS is registered in the reasoner factories and the ADF web service.
…on order and update return type to unmodifiableSet. Add unit test for subgraph functionality in AbstractDialecticalFramework.
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.
No description provided.