5 Commits

Author SHA1 Message Date
c1e75afb71 Version bump for release 0.1.9 RC 5 2018-04-22 22:33:38 +02:00
20112317fd Update examples
This updates the examples to showcase the scope of anthem’s feature set.
New examples are added concerning placeholders, hiding predicates, and
simplifications related to integer variables.
2018-04-22 22:26:17 +02:00
6015b225a2 Remove unintended period at end of lines
The integer specifier lines in the output weren’t intended to be
followed by a period. This removes the period to make the format
consistent with the other formulas in the output.
2018-04-22 22:12:43 +02:00
d3e160222a Remove obsolete code in examples
These lines of code were commented out and can be safely removed.
2018-04-22 22:12:02 +02:00
8110195d62 Prefix integer variables with “N”
Instead of suffixing integer variables with “i”, this prefixes them with
“N” instead to make it consistent with common mathematical notations.
2018-04-22 21:23:26 +02:00
11 changed files with 48 additions and 17 deletions

View File

@@ -1,6 +1,6 @@
# Change Log # Change Log
## 0.1.9 RC 4 (2018-04-22) ## 0.1.9 RC 5 (2018-04-22)
### Features ### Features

View File

@@ -72,7 +72,7 @@ int main(int argc, char **argv)
if (version) if (version)
{ {
std::cout << "anthem version 0.1.8-rc.4" << std::endl; std::cout << "anthem version 0.1.9-rc.5" << std::endl;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

2
examples/choice-rules.lp Normal file
View File

@@ -0,0 +1,2 @@
p(a).
{q(a)}.

View File

@@ -1,10 +1,18 @@
#external color(1). % assign a set of colors to each vertex
#external edge(2).
#external vertex(1).
#show color/2.
{color(V, C)} :- vertex(V), color(C). {color(V, C)} :- vertex(V), color(C).
% at most one color per vertex
:- color(V, C1), color(V, C2), C1 != C2.
% at least one color per vertex
covered(V) :- color(V, _). covered(V) :- color(V, _).
:- vertex(V), not covered(V). :- vertex(V), not covered(V).
% adjacent vertices dont share the same color
:- color(V1, C), color(V2, C), edge(V1, V2). :- color(V1, C), color(V2, C), edge(V1, V2).
:- color(V, C1), color(V, C2), C1 != C2.
#show color/2.
#external vertex(1).
#external edge(2).
#external color(1).

11
examples/letters.lp Normal file
View File

@@ -0,0 +1,11 @@
letter(a).
letter(b).
letter(c).
{p(1..3, Y)} :- letter(Y).
:- p(X1, Y), p(X2, Y), X1 != X2.
q(X) :- p(X, _).
:- X = 1..3, not q(X).
#show p/2.

View File

@@ -1,5 +1,4 @@
#show p/2. #show p/2.
%#external integer(n(0)).
{p(1..n, 1..n)}. {p(1..n, 1..n)}.

View File

@@ -1,5 +1,4 @@
#show prime/1.
%#external integer(n(0)).
composite(I * J) :- I = 2..n, J = 2..n. composite(I * J) :- I = 2..n, J = 2..n.
prime(N) :- N = 2..n, not composite(N). prime(N) :- N = 2..n, not composite(N).
#show prime/1.

View File

@@ -1,9 +1,7 @@
#show in/2.
%#external integer(n(0)).
%#external integer(r(0)).
{in(1..n, 1..r)}. {in(1..n, 1..r)}.
covered(I) :- in(I, S). covered(I) :- in(I, S).
:- I = 1..n, not covered(I). :- I = 1..n, not covered(I).
:- in(I, S), in(J, S), in(I + J, S). :- in(I, S), in(J, S), in(I + J, S).
#show in/2.

View File

@@ -0,0 +1,9 @@
s(X) :- p(X).
s(X) :- q(X).
u(X) :- r(X), not s(X).
#show u/1.
#external p(1).
#external q(1).
#external r(1).

View File

@@ -0,0 +1,5 @@
s(X) :- p(X).
s(X) :- q(X).
#external p(1).
#external q(1).

View File

@@ -155,7 +155,7 @@ void translate(const char *fileName, std::istream &stream, Context &context)
<< "(" << predicateDeclaration->name << "(" << predicateDeclaration->name
<< "/" << output::Number(predicateDeclaration->arity()) << "/" << output::Number(predicateDeclaration->arity())
<< "@" << output::Number(i + 1) << "@" << output::Number(i + 1)
<< ")." << std::endl; << ")" << std::endl;
} }
} }
} }