SWI-Prolog port (swipl branch)
This is a fork from https://gitlab.software.imdea.org/ciao-lang/sCASP. It provides a port of s(CASP) to SWI-Prolog.
About the SWI-Prolog port
The SWI-Prolog port is fully functional and from the solver prespective
fully compatible with the Ciao original. The SWI-Prolog port provides
two significant optimizations: (1) a more low level implementation for
the term copying required for forall constructs that result from
dual rules for clauses that introduce variables in the body as well as
for global constraint and (2) an index to speedup finding loops and
already proved literals. This often leads to about 10 times better
performance.
Running requires SWI-Prolog 8.5.6 or later. The scasp executable
can be build on POSIX systems by running make in the toplevel of the
sCASP directory. On Windows
The command line arguments are similar, but with small differences due
to the use of SWI-Prolog's commandline parser. Run scasp -h for details.
The output is different, using Unicode and, if possible, color to simplify
reading the model and justification.
Next to using the s(CASP) executable, s(CASP) can be used as a library.
For this, activate the sCASP directory as a SWI-Prolog add on by
starting SWI-Prolog in the top directory and run
?- pack_install(.).
Now you can load scasp using
:- use_module(library(scasp)).
Running s(CASP) queries take a normal Prolog program that can be made
available in the usual way: by consulting a file, asserting, etc. The
program must respect the sCASP restrictions. Using any built-in or
control structure that is not known to s(CASP) results in an error.
From the toplevel REPL loop, s(CASP) queries are executed by prefixing
them with one of the 7 operators below.
| Op | Description |
| ?-- | Prove and only show the bindings |
| ?+- | Prove, show bindings and model |
| ?-+ | Prove, show bindings and justification (tree) |
| ?++ | Prove, show bindings model and justification) |
| ??+- | As above, but using human language output |
| ??-+ | |
| ??++ | |
? and ?? are backward compatible aliases for ?+- and ?++. For example,
this shows the model.
?- ? p(X).
The predicate scasp/2 can be used to get access to the model and tree to
reason about them. For example, this returns the model as a list of
terms and the justification as a tree structure.
?- scasp(goal(X), [model(M), tree(T)]).
SWI-Prolog s(CASP) can also be used in your browser using
SWISH.
Finally, there is a simple web
server. This server can also be
deployed locally using the command below. Add -h for options.
swipl examples/dyncall/http.pl
The web server lets you post s(CASP) programs and get their results as
HTML or JSON. See Help for
details.
About s(CASP)
The s(CASP) system is a top-down interpreter for ASP programs with
constraints.
This work was presented at ICLP'18 (Arias et al. 2018), also available here.
And extended description of the justification trees was presented at ICLP'20 (Arias et al. 2020).
Introduction
s(CASP) by Joaquin Arias, is based on
s(ASP) by
Kyle Marple.
s(CASP) is an implementation of the stable model semantics of
constraint logic programming. Unlike similar systems, it does not
employ any form of grounding. This allows s(CASP) to execute programs
that are not finitely groundable, including those which make use of
lists and terms.
Usage of s(CASP)
Usage:
scasp [options] InputFile(s)
- General Options:
-h, -?, --help Print this help message and terminate.
--help_all Print extended help.
-i, --interactive Run in interactive mode (REP loop).
-a, --auto Run in batch mode (no user interaction).
-sN, -nN Compute N answer sets, where N >= 0. N = 0 means 'all'.
-d, --plaindual Generate dual program with single-goal clauses
(for propositional programs).
-r[=d] Output rational numbers as real numbers.
[d] determines precision. Defaults to d = 5.
--code Print program with dual clauses and exit.
--tree Print justification tree for each answer (if any).
--plain Output code / justification tree as literals (default).
--human Output code / justification tree in natural language.
--long Output long version of justification.
--mid Output mid-sized version of justification (default) .
--short Short version of justification.
--pos Only display the selected literals in the justification.
--neg Add the negated literals in the justification (default).
--html[=name] Generate HTML file for the justification. [name]:
use 'name.html'. Default: first InputFile name.
-v, --verbose Enable verbose progress messages.
-f, --tracefails Trace user-predicate failures.
--update Automatically update s(CASP).
--version Output the current version of s(CASP)
--all_c_forall Exhaustive evaluation of c_forall/2.
--prev_forall Deprecated evaluation of forall/2.
Using the principal options
Let us consider the program test.pl:
p(A) :- not q(A).
q(A) :- not p(A).
?- p(A).
- To obtain the models one by one:
$ scasp test.pl
Answer 1 (in 0.09 ms):
p(A) , not q(A)
? ;
for this example there is only one model so when we ask for more models (introducing ; after the ?) the evaluation finishes.
- To obtain all the models automatically use the option
-sn with n=0:
$ scasp -s0 test.pl
- To obtain a specific number of models, e.g., 5, invoke:
$ scasp -s5 test.pl
- To use scasp with its iterative mode invoke
s(CASP) with -i, and introduce the query after ?-:
$ scasp -i test.pl
?- q(A).
Answer 1 (in 0.228 ms):
q(A) , not p(A)
?
Explanation and debugging
Examples & Benchmarks & Event Calculus
Examples
There are some examples, most of them available in the distribution of
s(ASP). Check them [here](examples/) and in your local installation
(the default folder is `~/.ciao/sCASP`).
Towers of Hanoi
s(CASP) vs Clingo standard vs Clingo incremental.
See more details here.
Stream data reasoning
Let us assume that we deal with series of data items, some of which
may be contradictory. Moreover, different sources may give data a
different degree of trustworthiness which can make some pieces of
inconsistent data to be preferred. Lets us assume that p(A) and q(A)
are contradictory and we receive, from source S1, p(A) and, from
source S2, q(a). We may decide that: (i) p(A) is true because S1 is
more realiable; (ii) or if S2 is more realiable, q(a) is true, and any
value `not a` (i.e., X \= a) p(A) is also true; (iii) or, if both
sources are equally reliable, them we have (at least) two different
models: one where q(a) is true and another where p(A) is true (also
for X=a).
See more details here.
Traveling salesman
A variant of the traveling salesman problem (visiting every city in a
country only once, starting and ending in the same city, and moving
between cities using the existing connections) where, in addition, we
want to find out the length of the Hamiltonian cycle.
Solutions for this problem using `CLP(FD) and ASP` appear in
(Dovier et al. 2005),
with comparable performance. However, they show that the ASP
encoding is more compact, even if the `CLP(FD)` version uses the
library predicate circuit/1, which does the bulk of the work and
whose code is non-trivial.
We will show that also in this problem, where the ASP solution is more
compact than that of `CLP(FD)`, s(CASP) is more expressive.
See more details here
Yale shooting scenario
Let us compare the expressiveness of s(CASP) vs ASP + constraints
using the spoiling Yale shooting scenario
(Janhunen et al. 2017).
In this scenario we have an unloaded gun and three possible actions
load, shoot, and wait. If we load the gun, it becomes loaded. If we
shoot the gun and it was loaded for no more than 35 minutes, the
turkey is killed. Otherwise, the gun powder is spoiled. We are looking
for an executable plan such that:
- the turkey is killed within 100 minutes,
- considering that we are not allowed to shoot in the first 35
minutes.
See more details here
Event Calculus
Let us use s(CASP) to implement Event Calculus, a more complex
application, with several scenarios.
In this [folder](examples/benchmark_EventCalculus/lopstr19/) you will
find the benchmark and instruction to
reproduce the evaluation and example presented in the paper
"Modelling and Reasoning in Event Calculus using Goal-Directed Constraint Answer Set Programming", presented in LOPSTR'19.
See more details here
Prolog files
ATTIC/misc_programs/count_asp.pl |
ATTIC/misc_programs/hanoi_for_simple_minds.pl |
ATTIC/misc_programs/hanoi_for_simple_minds_2.pl |
ATTIC/misc_programs/hanoi_for_simple_minds_3.pl |
ATTIC/misc_programs/new_hanoi_2.pl |
ATTIC/misc_programs/new_hanoi_3.pl |
ATTIC/scripts/diseq_oracle.pl |
ATTIC/scripts/refactor.pl |
ATTIC/test_findall/call.pl |
ATTIC/test_findall/findall01.pl |
ATTIC/test_forall/diseq01-ok.pl |
ATTIC/test_forall/diseq02-ok.pl |
ATTIC/test_forall/test01-ok.pl |
ATTIC/test_forall/test02-fail.pl |
ATTIC/test_forall/test03-fail.pl |
ATTIC/test_forall/test05-ok.pl |
ATTIC/test_justification/fever3.pl |
ATTIC/test_justification/fever4.pl |
ATTIC/test_justification/output-fever3.pl |
ATTIC/test_justification/output-fever4.pl |
ATTIC/test_sasp/abdbirds.pl |
ATTIC/test_sasp/birds.pl |
ATTIC/test_sasp/birds2.pl |
ATTIC/test_sasp/classic_negation.pl |
ATTIC/test_sasp/classical_neg_entail.pl |
ATTIC/test_sasp/cofailure.pl |
ATTIC/test_sasp/directive_test.pl |
ATTIC/test_sasp/errtest.pl |
ATTIC/test_sasp/family.pl |
ATTIC/test_sasp/gpa.pl |
ATTIC/test_sasp/graph.pl |
ATTIC/test_sasp/hamcycle.pl |
ATTIC/test_sasp/hamcycle2.pl |
ATTIC/test_sasp/hamcycle_two.pl |
ATTIC/test_sasp/hanoi.pl |
ATTIC/test_sasp/hanoi_7.pl |
ATTIC/test_sasp/hanoi_clp.pl |
ATTIC/test_sasp/left-rec-succ_BAD.pl |
ATTIC/test_sasp/left.pl |
ATTIC/test_sasp/lion.pl |
ATTIC/test_sasp/list.pl |
ATTIC/test_sasp/loop_pos.pl |
ATTIC/test_sasp/loop_succ_pos.pl |
ATTIC/test_sasp/loopvar.pl |
ATTIC/test_sasp/loopvar2.pl |
ATTIC/test_sasp/member.pl |
ATTIC/test_sasp/multitest.pl |
ATTIC/test_sasp/natnum.pl |
ATTIC/test_sasp/oddloop_odd.pl |
ATTIC/test_sasp/paperexample.pl |
ATTIC/test_sasp/path.pl |
ATTIC/test_sasp/path_loop.pl |
ATTIC/test_sasp/pos_loop2_simple.pl |
ATTIC/test_sasp/pos_loop_pass_simple.pl |
ATTIC/test_sasp/pos_loop_simple.pl |
ATTIC/test_sasp/pq_asp.pl |
ATTIC/test_sasp/pq_loop.pl |
ATTIC/test_sasp/pq_loop_b.pl |
ATTIC/test_sasp/queens.pl |
ATTIC/test_sasp/queens_hide.pl |
ATTIC/test_sasp/queens_hide_d0.pl |
ATTIC/test_sasp/queens_old.pl |
ATTIC/test_sasp/reflexive.pl |
ATTIC/test_sasp/schedule.pl |
ATTIC/test_sasp/simple.pl |
ATTIC/test_sasp/struct.pl |
ATTIC/test_sasp/succ.pl |
ATTIC/test_sasp/test1.pl |
ATTIC/test_sasp/test10.pl |
ATTIC/test_sasp/test11.pl |
ATTIC/test_sasp/test12.pl |
ATTIC/test_sasp/test13.pl |
ATTIC/test_sasp/test14.pl |
ATTIC/test_sasp/test15.pl |
ATTIC/test_sasp/test16.pl |
ATTIC/test_sasp/test17.pl |
ATTIC/test_sasp/test18.pl |
ATTIC/test_sasp/test19.pl |
ATTIC/test_sasp/test2.pl |
ATTIC/test_sasp/test20.pl |
ATTIC/test_sasp/test21.pl |
ATTIC/test_sasp/test3.pl |
ATTIC/test_sasp/test4.pl |
ATTIC/test_sasp/test5.pl |
ATTIC/test_sasp/test6.pl |
ATTIC/test_sasp/test7.pl |
ATTIC/test_sasp/test8.pl |
ATTIC/test_sasp/test9.pl |
ATTIC/test_sasp/varcon.pl |
ATTIC/test_sasp/vars_optional.pl |
ATTIC/test_scasp/ball_asp.pl |
ATTIC/test_scasp/ball_tclpq.pl |
ATTIC/test_scasp/block_asp.pl |
ATTIC/test_scasp/clingcon_example.pl |
ATTIC/test_scasp/cross_train_Pontelli_97.pl |
ATTIC/test_scasp/ezsmt_light.pl |
ATTIC/test_scasp/s.pl |
ATTIC/test_scasp/weight_seq/select_instance.pl |
ATTIC/test_scasp/weight_seq/weight_seq_clp.pl |
ATTIC/test_scasp/weight_seq/weight_seq_ezsmt.pl |
ATTIC/test_scasp/weight_seq/weight_seq_scasp.pl |
ATTIC/test_scasp/weight_seq/weight_seq_tclp.pl |
ATTIC/test_scasp/zhou_birds.pl |
ATTIC/test_tabling/edge.pl |
ATTIC/test_tabling/notp.pl |
ATTIC/test_tabling/notpq.pl |
ATTIC/test_tabling/p.pl |
ATTIC/test_tabling/path.pl |
ATTIC/test_tabling/pq.pl |
ATTIC/test_tabling/prop.pl |
Manifest/Manifest.pl |
doc/SETTINGS.pl |
doc/scasp_man.pl |
doc/user_installation.pl |
doc/user_usage.pl |
examples/benchmark_EventCalculus/lopstr19/aux-sasp/bec_light_sasp_discrete_0.25.pl |
examples/benchmark_EventCalculus/lopstr19/aux-sasp/bec_light_sasp_discrete_0.5.pl |
examples/benchmark_EventCalculus/lopstr19/aux-sasp/bec_theory_discrete.pl |
examples/benchmark_EventCalculus/lopstr19/event-calculus/bec_theory.pl |
examples/benchmark_EventCalculus/lopstr19/event-calculus/example-light/bec_light_01.pl |
examples/benchmark_EventCalculus/lopstr19/event-calculus/example-light/bec_light_02.pl |
examples/benchmark_EventCalculus/lopstr19/event-calculus/example-light/bec_light_03_inconsistent.pl |
examples/benchmark_EventCalculus/lopstr19/event-calculus/example-light/bec_light_04_theinconsistencedonothappens.pl |
examples/benchmark_EventCalculus/lopstr19/event-calculus/example-tap/bec_tap_01_overflow.pl |
examples/benchmark_EventCalculus/lopstr19/event-calculus/example-tap/bec_tap_02_no_overflow.pl |
examples/benchmark_EventCalculus/lopstr19/event-calculus/example-tap/bec_tap_03_two_models.pl |
examples/benchmark_EventCalculus/lopstr19/event-calculus/example-tap/bec_tap_04_abducible_infer_event_time.pl |
examples/benchmark_EventCalculus/lopstr19/sCASP-clingo/bec_theory.pl |
examples/benchmark_EventCalculus/lopstr19/sCASP-clingo/light/bec_light_01.pl |
examples/benchmark_EventCalculus/lopstr19/sCASP-clingo/light/bec_query01.pl |
examples/benchmark_EventCalculus/lopstr19/sCASP-clingo/light/bec_query02.pl |
examples/benchmark_EventCalculus/lopstr19/sCASP-clingo/light/bec_query03.pl |
examples/benchmark_EventCalculus/lopstr19/sCASP-clingo/light/bec_query0x.pl |
examples/benchmark_EventCalculus/lopstr19/sCASP-clingo/vessel/bec_queries.pl |
examples/benchmark_EventCalculus/lopstr19/sCASP-clingo/vessel/bec_query01.pl |
examples/benchmark_EventCalculus/lopstr19/sCASP-clingo/vessel/bec_vessel_01.pl |
examples/benchmark_iclp18/sasp_vs_scasp/hamcycle_one.pl |
examples/benchmark_iclp18/sasp_vs_scasp/hamcycle_two.pl |
examples/benchmark_iclp18/sasp_vs_scasp/hanoi_8.pl |
examples/benchmark_iclp18/sasp_vs_scasp/queens_4.pl |
examples/benchmark_iclp18/stream_data_reasoning/new_stream.pl |
examples/benchmark_iclp18/stream_data_reasoning/stream_reasoning.pl |
examples/benchmark_iclp18/towers_hanoi/hanoi_min.pl |
examples/benchmark_iclp18/towers_hanoi/hanoi_scasp_7.pl |
examples/benchmark_iclp18/towers_hanoi/hanoi_scasp_8.pl |
examples/benchmark_iclp18/towers_hanoi/hanoi_scasp_9.pl |
examples/benchmark_iclp18/towers_hanoi/new_hanoi.pl |
examples/benchmark_iclp18/towers_hanoi/toh_incremental_7.pl |
examples/benchmark_iclp18/towers_hanoi/toh_incremental_8.pl |
examples/benchmark_iclp18/towers_hanoi/toh_incremental_9.pl |
examples/benchmark_iclp18/towers_hanoi/toh_standard_5.pl |
examples/benchmark_iclp18/towers_hanoi/toh_standard_6.pl |
examples/benchmark_iclp18/towers_hanoi/toh_standard_7.pl |
examples/benchmark_iclp18/towers_hanoi/toh_standard_8.pl |
examples/benchmark_iclp18/towers_hanoi/toh_standard_9.pl |
examples/benchmark_iclp18/traveling_salesman/hamiltonian_asp.pl |
examples/benchmark_iclp18/traveling_salesman/hamiltonian_scasp.pl |
examples/benchmark_iclp18/yale_shooting_scenario/yale_shooting_casp.pl |
examples/benchmark_iclp18/yale_shooting_scenario/yale_shooting_casp_v2.pl |
examples/benchmark_iclp18/yale_shooting_scenario/yale_shooting_clingoLD.pl |
examples/birds.pl |
examples/classic_negation_incostistent.pl |
examples/compiled/birds_compiled.pl |
examples/compiled/birds_compiled_raw.pl |
examples/dyncall/birds.pl |
examples/dyncall/http.pl |
examples/dyncall/pas/PAS_case.pl |
examples/dyncall/pas/PAS_guide.pl |
examples/dyncall/pas/PAS_patient.pl |
examples/dyncall/pas/PAS_rules.pl |
examples/dyncall/pas/PAS_server.pl |
examples/dyncall/solve_findall.pl |
examples/embed/birds.pl |
examples/embed/pas.pl |
examples/embed/pq.pl |
examples/entail_loop.pl |
examples/family.pl |
examples/hamcycle.pl |
examples/hamcycle_two.pl |
examples/hanoi.pl |
examples/hanoi_7.pl |
examples/min_model.pl |
examples/pq.pl |
examples/queens.pl |
examples/rps.pl |
pack.pl |
prolog/scasp.pl -- Using s(CASP) from Prolog |
| ?++/1 | Shortcuts for scasp/1 that control printing the model and/or tree and the format. |  |
| ?+++/1 | Shortcuts for scasp/1 that control printing the model and/or tree and the format. |  |
| ?+-/1 | Shortcuts for scasp/1 that control printing the model and/or tree and the format. |  |
| ?-+/1 | Shortcuts for scasp/1 that control printing the model and/or tree and the format. |  |
| ?--/1 | Shortcuts for scasp/1 that control printing the model and/or tree and the format. |  |
| ??++/1 | Shortcuts for scasp/1 that control printing the model and/or tree and the format. |  |
| ??+-/1 | Shortcuts for scasp/1 that control printing the model and/or tree and the format. |  |
| ??-+/1 | Shortcuts for scasp/1 that control printing the model and/or tree and the format. |  |
prolog/scasp/call_graph.pl -- Build the call graph used for NMR check construction and indexing. |
prolog/scasp/clp/call_stack.pl -- Call stack constraint solver |
prolog/scasp/clp/clpq.pl -- Extension of the constraint solver CLP(Q) |
prolog/scasp/clp/disequality.pl -- Constraint solver for disequalities |
| .=./2 | Constructive unification of a negatively constrained variable with a non- variable value will succeed if the non-variable value does not constructively unify with any element in the variable’s prohibited value list. |  |
| .\=./2 | |  |
| loop_term/2 | |  |
| not_unify/2 | True when Term cannot unify with any of the elements in List. |  |
| ∉/2 | Constraint that expresses that X is not a member of the list of ground elements in G. |  |
prolog/scasp/common.pl -- Common predicates used in multiple files |
| c_rule/3 | Convert a rule structure into its head and body, or vice-versa. |  |
| create_unique_functor/3 | Create a unique functor by inserting the counter characters just before the _Arity. |  |
| intern_negation/2 | |  |
| is_dual/1 | Succeed if a functor contains the prefix '_not_', indicating that it's a dual. |  |
| is_global_constraint/2 | True when this is a predicate implementing the Nth global constraint. |  |
| join_functor/3 | |  |
| negate_functor/2 | Given the functor of a predicate (of the form name/arity), return the negation. |  |
| operator/3 | ASP/Prolog operator table. |  |
| predicate/3 | Convert a predicate struct to its components, or vice-versa. |  |
| raise_negation/2 | |  |
| rule/4 | Convert a rule structure with an id into its head, ID and body, or vice-versa. |  |
prolog/scasp/comp_duals.pl -- Dual rule computation |
| comp_duals/0 | Compute rules for the negations of positive literals (dual rules), even if there are no clauses for the positive literal (negation will be a fact). |  |
| comp_duals3/2 | Compute the dual for a single positive literal. |  |
| define_forall/3 | If BodyVars is empty, just return the original goal. |  |
prolog/scasp/compile.pl -- s(ASP) Ungrounded Stable Models Solver |
prolog/scasp/dyncall.pl --  |
| #/1 | Handle s(CASP) directives. |  |
| #</2 | Implementation of the s(CASP) constraints. |  |
| #<>/2 | Implementation of the s(CASP) constraints. |  |
| #=/2 | Implementation of the s(CASP) constraints. |  |
| #=</2 | Implementation of the s(CASP) constraints. |  |
| #>/2 | Implementation of the s(CASP) constraints. |  |
| #>=/2 | Implementation of the s(CASP) constraints. |  |
| abducible/1 | Declare Spec, a comma list of heads to be abducible, meaning they can both be in or outside the model. |  |
| scasp/2 | Prove query using s(CASP) semantics. |  |
| scasp_abolish/1 | Remove all facts for both PredicateIndicator and its classical negation. |  |
| scasp_assert/1 | Wrappers for assertz/1, retract/1 and retractall/1 that deal with sCASP terms which may have a head or body terms that are wrapped in -(Term), indicating classical negation. |  |
| scasp_dynamic/1 | Declare a predicates as dynamic or thread_local. |  |
| scasp_query_clauses/2 | |  |
| scasp_retract/1 | Wrappers for assertz/1, retract/1 and retractall/1 that deal with sCASP terms which may have a head or body terms that are wrapped in -(Term), indicating classical negation. |  |
| scasp_retractall/1 | Wrappers for assertz/1, retract/1 and retractall/1 that deal with sCASP terms which may have a head or body terms that are wrapped in -(Term), indicating classical negation. |  |
| scasp_show/2 | Show some aspect of the translated s(CASP) program. |  |
prolog/scasp/embed.pl -- Embed sCASP programs in Prolog sources |
| gxref_called/2 | Hook into gxref/0 that may extend the notion of predicates being called by some infrastructure. |  |
| -/1 | sCASP classical negation. |  |
| begin_scasp/1 | Start an embedded sCASP program. |  |
| begin_scasp/2 | Start an embedded sCASP program. |  |
| end_scasp/0 | Close begin_scasp/1,2. |  |
| not/1 | sCASP NaF negation. |  |
| scasp_call/1 | Solve an sCASP goal from the interactive toplevel. |  |
| scasp_justification/2 | Justification for the current sCASP answer. |  |
| scasp_listing/2 | List the transformed program for Unit. |  |
| scasp_model/1 | True when Model represents the current set of true and false literals. |  |
| scasp_model/2 | True when Model represents the current set of true and false literals. |  |
| scasp_stack/1 | True when Stack represents the justification of the current sCASP answer. |  |
prolog/scasp/html.pl -- Render s(CASP) justification as HTML |
| html_bindings/4 | Print the variable bindings. |  |
| html_justification_tree/4 | Convert the tree to HTML. |  |
| html_model/4 | Emit the model as HTML terms. |  |
| html_model_term/4 | Emit a model term. |  |
| html_predicate/4 | |  |
| html_program/1 | |  |
| html_program/3 | Emit the current program in human format using HTML. |  |
| html_query/4 | Emit the query. |  |
| html_rule/4 | |  |
prolog/scasp/html/html_head.pl |
prolog/scasp/html/html_tail.pl |
prolog/scasp/html/jquery_tree.pl |
prolog/scasp/html_text.pl -- Switch between HTML and plain text output |
prolog/scasp/human.pl -- Print s(CASP) output in human language |
| human_justification_tree/2 | Print Tree to current_output in human representation. |  |
| human_model/2 | |  |
| human_predicate/2 | |  |
| human_query/2 | |  |
| human_rule/2 | |  |
prolog/scasp/input.pl -- Read SASP source code |
prolog/scasp/json.pl |
| scasp_results_json/2 | Generate a JSON document from the results of the s(CASP) solver. |  |
prolog/scasp/lang/en.pl |
prolog/scasp/lang/nl.pl |
prolog/scasp/listing.pl |
| scasp_code_section_title/3 | |  |
| scasp_portray_program/1 | Output pretty print of the program + dual rules + nmr-checks. |  |
prolog/scasp/load_compiled.pl |
prolog/scasp/main.pl |
| main/1 | Used when calling from command line by passing the command line options and the input files. |  |
prolog/scasp/messages.pl |
| scasp_lang/1 | True when Lang is the language used for messages and justifications. |  |
prolog/scasp/model.pl -- sCASP model handling |
| canonical_model/2 | |  |
| print_model/2 | Print the model in aligned columns. |  |
| unqualify_model/3 | Restore the model relation to modules. |  |
prolog/scasp/modules.pl -- Encode modules |
| encoded_module_term/2 | |  |
| model_term_module/2 | |  |
| scasp_encoded_module_term/2 | Map an explicit Prolog module qualification into one that is encoded in the functor name. |  |
| unqualify_model_term/3 | |  |
prolog/scasp/nmr_check.pl -- Detect OLON rules and construct nmr_check |
| generate_nmr_check/1 | Get the rules in the program containing odd loops and compute the NMR check. |  |
prolog/scasp/ops.pl |
prolog/scasp/options.pl -- (Command line) option handling for sCASP |
| scasp_help/0 | Print command line option help. |  |
| scasp_opt_help/2 | Allow reusing scasp option processing. |  |
| scasp_opt_meta/2 | Allow reusing scasp option processing. |  |
| scasp_opt_type/3 | Allow reusing scasp option processing. |  |
| scasp_parse_args/3 | Select from the list of arguments in Args which are the user-options, Options and which are the program files, Sources. |  |
| scasp_set_options/1 | Set Prolog flags that control the solver from Options. |  |
| scasp_set_options/2 | Set Prolog flags that control the solver from Options. |  |
| scasp_version/1 | print the current version of s(CASP). |  |
prolog/scasp/output.pl -- Emit sCASP terms |
| connector/3 | Get an ASCII or Unicode connector string with the claimed Semantics. |  |
| human_expression/3 | If there is a human print rule for Atom, return a list of format actions as Actions. |  |
| inline_constraints/2 | Get constraints on variables notated as Var | {Constraints} and use assigned variable names. |  |
| ovar_analyze_term/1 | Analyze variables in an output term. |  |
| ovar_analyze_term/2 | Analyze variables in an output term. |  |
| ovar_clean/1 | Delete all attributes added by ovar_analyze_term/1. |  |
| ovar_is_singleton/1 | True when Var is a singleton variable. |  |
| ovar_set_bindings/1 | Given Bindings as a list of Name=Var, set the names of the variables. |  |
| ovar_set_name/2 | Set the name of Var to Name. |  |
| ovar_var_name/2 | True when var is not a singleton and has the assigned name. |  |
| print_model_term/2 | Print a model element to the terminal. |  |
prolog/scasp/pr_rules.pl -- Output formatting and printing. |
prolog/scasp/predicates.pl -- Basic information about sCASP predicates |
| clp_builtin/1 | Success if Goal is a builtin constraint predicate. |  |
| clp_interval/1 | Success if Goal is a builtin constraint predicate to extract interval limits. |  |
| prolog_builtin/1 | Success if Goal is a builtin prolog predicate (the compiler introduced its dual). |  |
| scasp_compiled/1 | True when Head is part of the transformed representation. |  |
| table_predicate/1 | Success if Goal is defined as a tabled predicate with the directive :- table pred/n.. |  |
| user_predicate/1 | Success if Goal is a user predicate. |  |
prolog/scasp/program.pl -- Input program access |
| assert_nmr_check/1 | Assert the NMR check. |  |
| assert_program/1 | Get rules, initial query and called predicates and assert them for easy access. |  |
| assert_rule/1 | Assert a program rule. |  |
| defined_nmr_check/1 | Dynamic predicate for the list of NMR sub-checks. |  |
| defined_predicates/1 | Dynamic predicate for the list of predicate symbols defined in the input program. |  |
| defined_query/2 | Dynamic predicate for query. |  |
| defined_rule/4 | Dynamic predicate for asserted rules. |  |
| destroy_program/0 | Remove all asserted predicates to allow multiple funs with different programs. |  |
| replace_prefix/4 | |  |
| reserved_prefix/1 | Define reserved prefixes for predicates and compound terms. |  |
prolog/scasp/solve.pl -- The sCASP solver |
| solve/4 | Solve the list of sub-goals Goal where StackIn is the list of goals already visited and returns in StackOut the list of goals visited to prove the sub-goals and in Model the model that supports the sub-goals. |  |
prolog/scasp/source_ref.pl -- s(CASP) source references |
| scasp_dynamic_clause_position/2 | True when Pos is the stream position is which the source code for the dynamic clause referenced by Ref was read. |  |
prolog/scasp/stack.pl |
prolog/scasp/swish.pl -- s(CASP) adapter for SWISH |
| post_context/1 | Called before the other context extraction. |  |
| post_context/3 | Bind Var with the context information that belongs to Name. |  |
prolog/scasp/variables.pl -- Variable storage and access |
| body_vars/3 | Get the body variables (variables used in the body but not in the head) for a clause. |  |
| is_var/1 | Test an entry to see if it's a variable (the first non-underscore is an upper-case letter. |  |
| is_var/2 | Test an entry to see if it's a variable (the first non-underscore is an upper-case letter. |  |
| revar/3 | If Term is a term that contains atoms using variable syntax ([A-Z].*), VarTerm is a copy of Term with all such atoms replaced by variables. |  |
| var_list/2 | Get a list of N variables, each of which is different. |  |
prolog/scasp/verbose.pl -- Print goal and stack in Ciao compatible format |
| print_check_calls_calling/2 | Auxiliar predicate to print StackIn the current stack and Goal. |  |
| print_goal/1 | Print an sCASP goal. |  |
| scasp_info/2 | Emit an informational through print_message/2. |  |
| scasp_trace/2 | Emit a debug messages through print_message/2. |  |
| scasp_warning/1 | Emit a warning through print_message/2. |  |
| scasp_warning/2 | Emit a warning through print_message/2. |  |
test/all_programs/abdbirds.pl |
test/all_programs/bec_light.pl |
test/all_programs/bec_loan.pl |
test/all_programs/bec_tap_01_overflow.pl |
test/all_programs/bec_tap_02_no_overflow.pl |
test/all_programs/bec_tap_03_two_models.pl |
test/all_programs/bec_tap_04_abducible_infer_event_time.pl |
test/all_programs/birds.pl |
test/all_programs/citizenshiptrust-scasp.pl |
test/all_programs/classic_negation_inconstistent.pl |
test/all_programs/classic_negation_incostistent.pl |
test/all_programs/clpq_equality.pl |
test/all_programs/criminaljustice-scasp.pl |
test/all_programs/dcc/hamilton_c.pl |
test/all_programs/family-le-scasp.pl |
test/all_programs/family.pl |
test/all_programs/forall_arity.pl |
test/all_programs/gpa.pl |
test/all_programs/hamcycle.pl |
test/all_programs/hamcycle2.pl |
test/all_programs/hamcycle_two.pl |
test/all_programs/hanoi.pl |
test/all_programs/hanoi_7.pl |
test/all_programs/hanoi_scasp_7.pl |
test/all_programs/haplotype.pl |
test/all_programs/impossibleancestor-scasp.pl |
test/all_programs/isdapermissioncorrected-scasp.pl |
test/all_programs/itispermittedthat-scasp.pl |
test/all_programs/left-rec-succ_BAD.pl |
test/all_programs/lion.pl |
test/all_programs/list-scasp.pl |
test/all_programs/loanwithcure-scasp.pl |
test/all_programs/loop_pos.pl |
test/all_programs/loop_succ_pos.pl |
test/all_programs/loopvar.pl |
test/all_programs/loopvar2.pl |
test/all_programs/min_model.pl |
test/all_programs/minicontract-scasp.pl |
test/all_programs/natnum.pl |
test/all_programs/obligation-scasp.pl |
test/all_programs/path_loop.pl |
test/all_programs/pq.pl |
test/all_programs/queens.pl |
test/all_programs/queens_old.pl |
test/all_programs/rat.pl |
test/all_programs/sasp/abdbirds.pl |
test/all_programs/sasp/gpa.pl |
test/all_programs/sasp/hamcycle.pl |
test/all_programs/sasp/hamcycle2.pl |
test/all_programs/sasp/hamcycle_two.pl |
test/all_programs/sasp/hanoi_7.pl |
test/all_programs/sasp/left-rec-succ_BAD.pl |
test/all_programs/sasp/lion.pl |
test/all_programs/sasp/loop_pos.pl |
test/all_programs/sasp/loop_succ_pos.pl |
test/all_programs/sasp/loopvar.pl |
test/all_programs/sasp/loopvar2.pl |
test/all_programs/sasp/natnum.pl |
test/all_programs/sasp/path_loop.pl |
test/all_programs/sasp/queens_old.pl |
test/all_programs/simpleRPS-scasp.pl |
test/all_programs/solve_findall.pl |
test/all_programs/subset-scasp.pl |
test/all_programs/turingcomplete-scasp.pl |
test/all_programs/vars.pl |
test/diff.pl |
test/le_programs/citizenshiptrust-scasp.pl |
test/le_programs/criminaljustice-scasp.pl |
test/le_programs/family-le-scasp.pl |
test/le_programs/impossibleancestor-scasp.pl |
test/le_programs/isdapermissioncorrected-scasp.pl |
test/le_programs/itispermittedthat-scasp.pl |
test/le_programs/list-scasp.pl |
test/le_programs/loanwithcure-scasp.pl |
test/le_programs/minicontract-scasp.pl |
test/le_programs/obligation-scasp.pl |
test/le_programs/simpleRPS-scasp.pl |
test/le_programs/subset-scasp.pl |
test/le_programs/turingcomplete-scasp.pl |
test/min_programs/bec_loan.pl |
test/min_programs/bec_tap_04_abducible_infer_event_time.pl |
test/min_programs/clpq_gt_gte_lt_lte_equal.pl |
test/min_programs/clpq_intercept.pl |
test/min_programs/ex01-dual.pl |
test/min_programs/ex02-member.pl |
test/min_programs/forall_arity.pl |
test/min_programs/hamiltonian_scasp.pl |
test/min_programs/lion.pl |
test/min_programs/nixon-diamond.pl |
test/min_programs/queens_old.pl |
test/min_programs/solve_call.pl |
test/min_programs/solve_findall_superset.pl |
test/min_programs/solve_forall.pl |
test/min_programs/solve_not_is.pl |
test/min_programs/solve_not_true.pl |
test/min_programs/stream_reasoning.pl |
test/min_programs/yale_shooting_casp_v2.pl |
test/small_programs/ex01-dual.pl |
test/small_programs/solve_not_true.pl |
test/test_clp_disequality.pl |
test/test_just.pl |
test/test_scasp.pl |
| run_test/2 | Compute all stacks and models for File. |  |