
scasp.pl -- Using s(CASP) from Prolog
While library(scasp/main) is used to build the scasp executable,
this library (library(scasp)) is used to embed or dynamically create
s(CASP) programs in Prolog and query them from Prolog.
?--(:Query)
?+-(:Query)
?-+(:Query)
?++(:Query)
?+++(:Query)
??+-(:Query)
??-+(:Query)
??++(:Query)The following predicates are exported from this file while their implementation is defined in imported modules or non-module files loaded by this module.
∉(?X, +G)
scasp(:Query) is nondet
scasp(:Query, +Options) is nondets(CASP) semantics. This performs the following
steps:
s(CASP) representation in a temporary
modules(CASP) solverOptions are passed to scasp_compile/2. Other options processed:
s(CASP) model, a list of model terms.
See scasp_model/1.s(CASP) justification tree. See
scasp_justification/2 for details.false, do not include source origin terms into the
final tree.s(CASP) gathers the clauses reachable from the query
and the global constraints whose call tree overlaps them, so a
constraint mentioning nothing the query reaches is left out --
and an odd loop or a p/-p contradiction elsewhere in the
program is left out with it. That is usually what is wanted: it
is what makes scasp/2 usable on a large program. Where it is
not -- where the answer must respect the whole program however
unrelated it looks -- name the rest of it here:
?- scasp(q, [collect((p, r(_)))]).
Only collection is affected. The query, the model and the justification are still about Query alone.
scasp(:Query) is nondet
scasp(:Query, +Options) is nondets(CASP) semantics. This performs the following
steps:
s(CASP) representation in a temporary
modules(CASP) solverOptions are passed to scasp_compile/2. Other options processed:
s(CASP) model, a list of model terms.
See scasp_model/1.s(CASP) justification tree. See
scasp_justification/2 for details.false, do not include source origin terms into the
final tree.s(CASP) gathers the clauses reachable from the query
and the global constraints whose call tree overlaps them, so a
constraint mentioning nothing the query reaches is left out --
and an odd loop or a p/-p contradiction elsewhere in the
program is left out with it. That is usually what is wanted: it
is what makes scasp/2 usable on a large program. Where it is
not -- where the answer must respect the whole program however
unrelated it looks -- name the rest of it here:
?- scasp(q, [collect((p, r(_)))]).
Only collection is affected. The query, the model and the justification are still about Query alone.
scasp_show(:Query, +What)s(CASP) program. Currently
What is one of:
?- scasp_show(Query, code(user(false), constraints(true))).
An option given as a bare name means true: code(constraints) is
code(constraints(true)).
scasp_dynamic(:Spec) is det
scasp_assert(:Clause) is det
scasp_retract(:Clause) is nondet
scasp_retractall(:Head) is det-(Term), indicating classical negation. Also deals with global
constraints written in any of these formats:
false :- Constraint.:- Constraint.
scasp_assert(:Clause) is det
scasp_retract(:Clause) is nondet
scasp_retractall(:Head) is det-(Term), indicating classical negation. Also deals with global
constraints written in any of these formats:
false :- Constraint.:- Constraint.
scasp_assert(:Clause) is det
scasp_retract(:Clause) is nondet
scasp_retractall(:Head) is det-(Term), indicating classical negation. Also deals with global
constraints written in any of these formats:
false :- Constraint.:- Constraint.
scasp_abolish(:PredicateIndicator) is det
#(:Directive)s(CASP) directives. Same as :- Directive.. Provides
compatibility with sCASP sources as normally found.
describe(:Template) is detpred is
used for declaring the domain of arguments.
abducible(:Spec)
prolog(:PIs) is detjustified
(default) or opaque, meaning that we call the predicate without
creating a justification tree.
prolog is no longer a prefix operator. Use `:- sld PIs as Type`,
which library(sscasp) understands as well.
sld(:PIs) is det:- sld PIs as Type.
prolog is not an operator, so `:- prolog p/1.` no longer reads.
Use `:- sld p/1.`, which works with both libraries.
#=(?A, ?B)
#<>(?A, ?B)
#<(?A, ?B)
#>(?A, ?B)
#>=(?A, ?B)
#=<(?A, ?B)s(CASP) constraints. This implementation is
normally not used and mostly makes the program analysis work.
#=(?A, ?B)
#<>(?A, ?B)
#<(?A, ?B)
#>(?A, ?B)
#>=(?A, ?B)
#=<(?A, ?B)s(CASP) constraints. This implementation is
normally not used and mostly makes the program analysis work.
#=(?A, ?B)
#<>(?A, ?B)
#<(?A, ?B)
#>(?A, ?B)
#>=(?A, ?B)
#=<(?A, ?B)s(CASP) constraints. This implementation is
normally not used and mostly makes the program analysis work.
#=(?A, ?B)
#<>(?A, ?B)
#<(?A, ?B)
#>(?A, ?B)
#>=(?A, ?B)
#=<(?A, ?B)s(CASP) constraints. This implementation is
normally not used and mostly makes the program analysis work.
#=(?A, ?B)
#<>(?A, ?B)
#<(?A, ?B)
#>(?A, ?B)
#>=(?A, ?B)
#=<(?A, ?B)s(CASP) constraints. This implementation is
normally not used and mostly makes the program analysis work.
#=(?A, ?B)
#<>(?A, ?B)
#<(?A, ?B)
#>(?A, ?B)
#>=(?A, ?B)
#=<(?A, ?B)s(CASP) constraints. This implementation is
normally not used and mostly makes the program analysis work.
begin_scasp(+Unit)
begin_scasp(+Unit, +Exports)Otherwise the read clauses are asserted verbatim. Directives are terms #(Directive). Prolog directives (:- Directive) are interpreted as sCASP global constraints. The matching end_scasp/0 compiles the sCASP program and creates wrappers in the enclosing module that call the sCASP solver.
The sCASP code must be closed using end_scasp/0. Both begin_scasp/1,2 and end_scasp/0 must be used as directives.
begin_scasp(+Unit)
begin_scasp(+Unit, +Exports)Otherwise the read clauses are asserted verbatim. Directives are terms #(Directive). Prolog directives (:- Directive) are interpreted as sCASP global constraints. The matching end_scasp/0 compiles the sCASP program and creates wrappers in the enclosing module that call the sCASP solver.
The sCASP code must be closed using end_scasp/0. Both begin_scasp/1,2 and end_scasp/0 must be used as directives.
end_scasp
not(:Query)
- :Query
scasp_model(:Model) is semidet
scasp_model(:Model, +Options) is semidet
scasp_stack(-Stack) is det
scasp_justification(:Tree, +Options) is semidet
scasp_listing(+Unit, +Options)
scasp_trace(:Goal, +Ports) is dets(CASP) Goal. Ports a single
port or a list of ports. Each port may be prefixed with + or
0 enables all portsThe following predicates are exported, but not or incorrectly documented.
pred(Arg1)
??(Arg1)
show(Arg1)
abducible(Arg1, Arg2)
?(Arg1)
scasp_assert(Arg1, Arg2)
#(Arg1, Arg2)