PublicShow sourceprogram.pl -- Input program access

Allow access to input program rules and query by asserting them and exporting the resulting dynamic predicates.

author
- Kyle Marple
version
- 20170628
license
- BSD-3
Source defined_rule(+Name:atom, +FullHead:compound, -Body:list, -Origin:compound) is nondet
Dynamic predicate for asserted rules.
Arguments:
Head- Head predicate has head/arity (no args).
FullHead- A predicate struct containing the head predicate with args.
Body- list of body goals.
Origin- A term describing the origin of this rule. For rules that are derived from loaded clauses, Origin is set to clause(ClauseRef); for compiler generated rules, Origin is set to generated(Why) where Why is one of neg for classical negation, nmr for NMR checks, and dual for dual rules; for rules read directly as s(CASP) with e.g. load_source_files/1, Origin is set to source(Path, Pos) where Path is the path of the source file, and Pos is a term describing the postition and layout of the rule in the file.
Source defined_query(-Goals:list, -SolCount:int) is det
Dynamic predicate for query.
Arguments:
Goals- List of goals in the query.
SolCount- The number of answer sets to compute.
Source defined_predicates(-Predicates:list) is det
Dynamic predicate for the list of predicate symbols defined in the input program.
Arguments:
Predicates- List of predicate structs.
Source defined_nmr_check(+Subchecks:list) is det
Dynamic predicate for the list of NMR sub-checks.
Arguments:
Subchecks- The list of subcheck goals.
Source reserved_prefix(+Prefix:ground) is det
Define reserved prefixes for predicates and compound terms. These take the form of a single letter followed by an underscore. This predicate just tests the letter. The dummy prefix (o_) is appended to predicates and compound terms that either begin with an underscore (legal in ASP but not Prolog) or with a reserved prefix. It will be removed last before printing, and at most one copy will be removed, ensuring that user-defined predicates starting with a reserved prefix won't be processed the same as internally created ones.
Arguments:
Prefix- The letter portion of the prefix.
Source replace_prefix(+FunctorIn, +OldPrefix, +NewPrefix, -Functor)
Source assert_program(+Statements:list) is det
Get rules, initial query and called predicates and assert them for easy access. This fills the dynamic predicates
Arguments:
Statements- List of rules and compute statements produced by DCG.
Source assert_rule(+Rule:compound) is det
Assert a program rule.
Arguments:
Rule- A rule struct.
Source assert_nmr_check(+NMR:list) is det
Assert the NMR check.
Arguments:
NMR- The list of goals in the NMR check.
Source destroy_program
Remove all asserted predicates to allow multiple funs with different programs.

Re-exported predicates

The following predicates are exported from this file while their implementation is defined in imported modules or non-module files loaded by this module.

Source has_prefix(+Functor:atom, -Prefix:atom) is semidet
Succeed if Functor begins with a reserved prefix, returning the character part of the (first) prefix.
Arguments:
Functor- The functor to test.
Prefix- The character of the (first) reserved prefix of the functor.
Source non_printable(+Name) is semidet
True if Name should not be printed. This is true if it starts with an underscore or has a normal prefix and then an underscore.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

Source defined_directive(Arg1)