Evolog - Support for actions and program modularization#364
Draft
madmike200590 wants to merge 63 commits intomasterfrom
Draft
Evolog - Support for actions and program modularization#364madmike200590 wants to merge 63 commits intomasterfrom
madmike200590 wants to merge 63 commits intomasterfrom
Conversation
…e StratifiedEvaluation
…st<Term>> rather than just Set<List<ConstantTerm>> so we can have module interpretations returning function terms
…s interpretations for module literals by wrapping calls to the ASP solver.
…n. Add very simple end2end test with module-based 3-coloring implementation.
…cluding unit tests
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.
Support for actions and program modularization
Detailed formal semantics for both actions and modules are described in Chapter 3 of [1].
Action Rules
Overview
Action rules allow for so-called side-effects in an ASP program, i.e. when an action rule fires, certain changes (such as opening or writing to files) can be applied to the environment. Consider the following Hello World-style example:
The rule on line 2 is an action rule:
hello_result(R) : @streamWrite[STDOUT, TEXT] = Ris an action head, wherehello_result(R)is a regular head atom, but@streamWrite[STDOUT, TEXT] = Rreferences an action function that has 2 input terms (variablesSTDOUTandTEXT) and yields the result termR.@streamWrite[STDOUT, TEXT]writes the stringTEXTto the file descriptorSTDOUT. VariableSTDOUTis bound by an external atom&stdout(STDOUT)which always supplies a reference to the standard output stream.Semantics and Restrictions
To stay in line with ASPs declarative semantics, action rulesin Alpha
Hello World!is only written to the console once, regardless of the solver's actual evaluation strategy.Implementation
Rules with action heads are modelled as instances of
NormalRulewhose head is an instance ofActionHead:[1]: https://repositum.tuwien.at/handle/20.500.12708/220293 Michael Langowski. Evolog-Actions and Modularization in Lazy-Grounding Answer Set Programming. Master Thesis, Technische Universität Wien, 2025.