Markus Triska
5dce7d9075
FIXED: enforce equality also for ground elements in tuples
...
Example:
?- tuples_in([[A,B]], [[1,2],[3,4]]),
tuples_in([[A,B]], [[3,2]]).
false.
See https://github.com/SWI-Prolog/swipl-devel/issues/1160 .
2023-04-11 22:33:19 +02:00
Markus Triska
f08f539768
do not create attributed variables for ground tuples
2023-04-11 21:26:18 +02:00
Markus Triska
be45672e22
actually disable and reenable the queue
2023-04-11 21:26:18 +02:00
Markus Triska
94efb9ffe3
remove no longer needed clpz_relation attributes
2023-04-11 21:26:18 +02:00
Markus Triska
fd1e902492
do not leave an attribute when (re-)enabling a queue
2023-04-11 21:14:18 +02:00
Markus Triska
fe27605497
FIXED: number_chars(N, "0' "), addressing #1580 .
...
There may be a more elegant way to solve this.
2023-04-02 10:04:52 +02:00
Markus Triska
b87fe1e21f
DOC: link to "Indexing dif/2"
2023-04-01 11:04:37 +02:00
Markus Triska
d6ac125425
DOC: explain location of scryer-prolog after compilation
...
This question was recently raised on the #scryer IRC channel.
2023-04-01 11:04:37 +02:00
Markus Triska
b79d8732ea
use the release flag so that the instructions can be used verbatim
...
Also, the location of the executable depends on this flag.
2023-04-01 11:04:33 +02:00
Markus Triska
3df0806017
change "run" to "build", since "run" leads to a Scryer prompt which can be unexpected
2023-04-01 11:03:31 +02:00
Markus Triska
8ab1155fc5
ENHANCED: use call_residue_vars/2 to show all pending constraints
...
Example:
?- freeze(_, false).
freeze:freeze(_A,false).
This was originally added in 04ba9bc11a ,
then reverted, and is now restored.
2023-03-30 23:49:33 +02:00
Markus Triska
01285f12c3
remove no longer needed queue attributes after propagation
2023-03-15 21:17:06 +01:00
Markus Triska
cd586aab8c
show remaining queue/2 attributes as residual goals
...
This lets us verify that all attributes are correctly removed earlier.
2023-03-15 19:56:02 +01:00
Markus Triska
56bd596af3
use actual toplevel answers
2023-03-08 23:35:11 +01:00
Markus Triska
21acb9361a
use string notation as discussed on #scryer IRC
2023-03-08 23:32:05 +01:00
Markus Triska
c3477d8476
items --> elements
...
This addresses #1740 .
2023-03-08 23:31:02 +01:00
Markus Triska
884b0ca10e
FIXED: Take all variables into account during goal projection.
...
This addresses #1751 .
2023-03-08 21:16:54 +01:00
Markus Triska
c9ecfb11d9
ENHANCED: more compact definition of dif/2
...
As outlined in #1753 .
2023-03-08 20:50:33 +01:00
Markus Triska
3dc6ed79d2
ENHANCED: must_be/2: prefer type error over instantiation error
...
This addresses #1594 .
2023-02-26 22:28:18 +01:00
Markus Triska
997161c740
rely on first instantiated argument indexing
...
This great improvement to indexing allows much more natural
definitions of virtually all meta-predicates. Many thanks to @notoria!
2023-02-25 10:17:55 +01:00
Markus Triska
669242a8ce
DOC: update residual goals
2023-02-23 00:10:36 +01:00
Markus Triska
2a04d5e799
in projection of residual goals, mark considered propagators as processed
...
This is to avoid duplicated goals with the new projection mechanism.
2023-02-23 00:05:27 +01:00
Markus Triska
1a01438064
add link to newly available homepage
...
Many thanks to @aarroyoc for the documentation system, and for hosting the page!
2023-02-20 20:09:47 +01:00
Markus Triska
196e9c1e47
DOC: teletype font for reification
2023-02-03 20:47:08 +01:00
Markus Triska
da4c0a359b
correct DocLog ~/.scryerrc rendering
2023-02-01 23:26:52 +01:00
Markus Triska
95278c221b
DOC: use valid Prolog terms as predicate indicators
2023-01-29 21:48:22 +01:00
Markus Triska
814b631543
use DocLog syntax for section anchors and links within the document
2023-01-28 17:37:43 +01:00
Markus Triska
0d8c7f8785
small documentation adjustments
2023-01-28 17:37:43 +01:00
Markus Triska
5bae8fcaf8
FIXED: use lsb/2 and msb/2 from library(arithmetic)
...
This addresses #1720 .
2023-01-28 17:37:43 +01:00
Markus Triska
58fb851717
correct table layout for entries that themselves contain |
2023-01-27 00:22:48 +01:00
Markus Triska
2e9ec653a8
DOC: convert library(simplex) documentation to DocLog format
2023-01-26 00:46:06 +01:00
Markus Triska
7ca782b92d
DOC: convert code samples in library(lambda) to DocLog format
2023-01-26 00:40:08 +01:00
Markus Triska
996496c3f5
DOC: initial documentation for library(pairs) in DocLog format
2023-01-26 00:36:05 +01:00
Markus Triska
90cf713186
add link to Desouter et al., "Tabling as a Library with Delimited Control"
2023-01-26 00:25:26 +01:00
Markus Triska
ca4aaf44de
DOC: initial documentation for library(tabling) in DocLog format
2023-01-26 00:20:53 +01:00
Markus Triska
b04d845ec0
DOC: convert library(pio) documentation to DocLog format
2023-01-26 00:09:41 +01:00
Markus Triska
a8ea2b0f97
DOC: add documentation for library(freeze) in DocLog format
2023-01-25 23:54:30 +01:00
Markus Triska
a29227d0d4
DOC: add link to "Indexing dif/2" in DocLog format
2023-01-25 23:40:55 +01:00
Markus Triska
7f8f137aa0
DOC: convert library(si) documentation to DocLog format
2023-01-25 23:27:45 +01:00
Markus Triska
cc7e721611
DOC: convert library(format) documentation to DocLog format
2023-01-25 23:18:39 +01:00
Markus Triska
22b815dc5c
DOC: correctly format the table using DocLog syntax
2023-01-25 22:29:14 +01:00
Markus Triska
64be8e0fba
DOC: add DocLog documentation for library(debug)
2023-01-25 00:19:14 +01:00
Markus Triska
43a297b691
DOC: add DocLog documentation for library(diag)
2023-01-25 00:09:44 +01:00
Markus Triska
af9f0f81d8
DOC: convert library(sgml) documentation to DocLog format
2023-01-24 22:42:58 +01:00
Markus Triska
1c08b56e05
strengthen reified division for divisor == 1
2023-01-24 22:15:05 +01:00
Markus Triska
6cb8020f62
DOC: add CLP(B) documentation in DocLog format
2023-01-24 22:15:05 +01:00
Markus Triska
d742d4cde9
DOC: convert library(time) documentation to DocLog format
2023-01-24 22:14:15 +01:00
Markus Triska
b7d06540e6
DOC: convert library(crypto) documentation to DocLog format
2023-01-24 22:13:38 +01:00
Markus Triska
909f2e1058
DOC: improve CLP(ℤ) DocLog documentation
2023-01-24 20:39:47 +01:00
Markus Triska
f213956ceb
use (#)/1
2023-01-11 17:23:53 +01:00
Markus Triska
c5caa9d311
ADDED: sign/1 is now reifiable.
...
This addresses #1500 .
2023-01-11 17:22:38 +01:00
Markus Triska
542b9e1976
rely on newly available operator notation for (#)/1
2023-01-10 22:59:11 +01:00
Markus Triska
73a1ee59fa
replace several more instances of ?/1 by (#)/1
2023-01-10 22:57:14 +01:00
Markus Triska
2771109427
use (#)/1 already internally for describing constraint projections
2023-01-10 22:50:38 +01:00
Markus Triska
cc420bd31a
FIXED: reification of (xor)/2.
...
Example:
?- A #= 1 xor 0 #<==> R.
%@ clpz:(A#=1#<==>R), clpz:(R in 0..1).
2023-01-10 22:09:41 +01:00
Markus Triska
2fe1d2ef53
FIXED: correctly reify (/)/2.
...
Example:
?- 0 #==> X #= 1/2.
%@ clpz:(X in inf..sup)
%@ ; false.
This addresses #1501 .
2023-01-10 17:35:43 +01:00
Markus Triska
6cb8d7596a
dereference more registers, analogous to d660e4244f
...
See also #1654 for a nice test case by @notoria which this corrects.
2022-12-18 17:43:33 +01:00
Markus Triska
309e5b320e
more uses of newly available deref_register(n)
2022-12-07 23:19:31 +01:00
Markus Triska
56e5da6680
introduce and use deref_register(n)
2022-12-06 21:07:50 +01:00
Markus Triska
d91ee5b77c
FIXED: CLP(ℤ): Correctly remove all attributes during propagation of all_distinct/1 and other global constraints.
...
The constraints from library(clpz) were already correctly removed, but
others such as pending freeze/2 goals were not, potentially leading to
an accumulation of redundant constraints during propagation.
Test case:
?- freeze(A,(X=1;X=2)), all_distinct([A]), A = 1.
A = 1, X = 1
; A = 1, X = 2.
The combination of freeze/2 and CLP(ℤ) is useful for example when
creating animations of search processes.
This addresses #1624 .
2022-10-26 23:36:07 -06:00
Markus Triska
b2cccab768
ENHANCED: library(crypto): Faster conversion to bytes when the integer is known.
...
These entailed constraints only affect performance, and can be removed
without affecting the correctness of the code. They speed up scalar
multiplication of a curve point, used for example in Bitcoinolog.
2022-10-26 23:36:07 -06:00
Markus Triska
579aa8acd4
use newly available u8s_to_string
2022-10-26 23:36:07 -06:00
Markus Triska
9c2cb144b5
remove redundant error handling, since this case is checked in Prolog
...
This restores f668640e3d , where this
change was already made. It seems it was accidentally overwritten in
0404c3bd94 .
2022-10-26 23:36:07 -06:00
Markus Triska
3d04689660
introduce and use u8s_to_string
2022-10-26 23:36:07 -06:00
Markus Triska
a891cc4edf
use (slightly) better variable names
2022-10-26 23:36:07 -06:00
Markus Triska
706ab2ae5b
use newly available must_be(chars, ...) for better and shorter type test
2022-10-26 23:36:07 -06:00
Markus Triska
9c1de8e00b
ENHANCED: Eliminate the OpenSSL dependency of library(crypto).
...
This is achieved by using the newly available crrl crate by @pornin
to implement crypto_curve_scalar_mult/4 for secp256k1. Many thanks!
2022-10-26 23:36:07 -06:00
Markus Triska
ce313b8a6b
correct nth0/4 and nth1/4
...
As per https://github.com/triska/scryer-prolog/commit/56b430ecaf9bd59fb7bd0b1e56d451ab322c422e#commitcomment-82155379 .
2022-10-26 23:36:07 -06:00
Markus Triska
7c96b91663
remove nth1/3, which is now provided by library(lists)
2022-10-26 23:36:07 -06:00
Markus Triska
87e966e185
remove nth1/3, which is now provided by library(lists)
2022-10-26 23:36:07 -06:00
Markus Triska
1e018681de
ENHANCED: Much improved nth0/3, taken from #1529 .
...
This also adds nth0/4 and bootstraps nth1/[3,4] from it.
2022-10-26 23:36:07 -06:00
Markus Triska
5b324680ba
ADDED: must_be/can_be(not_less_than_zero, ...)
...
See #1309 .
2022-10-26 23:36:07 -06:00
Markus Triska
abca5fc405
better implementation of list_si/1
...
Per discussion in https://github.com/mthom/scryer-prolog/pull/1589 .
2022-10-26 23:36:07 -06:00
Markus Triska
6a455d2866
ADDED: chars_si/1, testing for a string
...
Examples:
?- chars_si("hello").
true.
?- chars_si(5).
false.
?- chars_si([a,b,c|Rs]).
error(instantiation_error,sort/2).
2022-10-26 23:36:07 -06:00
Markus Triska
70da818101
use new domain names from library(error): octet_character, octet_chars
2022-10-26 23:36:07 -06:00
Markus Triska
5ec837acb4
ADDED: octet_character and octet_chars, testing for strings that represent bytes.
2022-10-26 23:36:07 -06:00
Markus Triska
76e33d051c
rely on the built-in DCG expansion, per discussion in #1577
2022-10-26 23:36:07 -06:00
Markus Triska
7c5318b784
ENHANCED: Use '$skip_max_list'/4 for greater efficiency of nth0/3.
...
This is now possible due to 4c7e2eb8614da9c04f2286f6116b468017fb442c.
See #1529 for the suggestion by @UWN.
2022-10-26 23:36:07 -06:00
Markus Triska
47892bf24a
ENHANCED: Improve determinism of ... //0 and seq//1.
...
Example:
?- phrase(..., "hello").
true.
This addresses #1577 .
2022-10-26 23:36:07 -06:00
Markus Triska
0ab355eada
use a DCG to describe the path
2022-10-26 23:36:07 -06:00
Markus Triska
44825826df
remove entailed must_be/2 goals
2022-10-26 23:36:07 -06:00
Markus Triska
612f09893c
use newly available ... //0 from library(dcgs)
2022-10-26 23:36:07 -06:00
Markus Triska
e9f507b868
add meta_predicate/1 declaration for phrase_to_file/3
2022-10-26 23:36:07 -06:00
Markus Triska
c7caf6b7a9
ENHANCED: CLP(ℤ): Reduce redundant propagator invocations during all_distinct/1 filtering
...
First, the current propagator is now logged and not re-triggered
during filtering. Second, and more significantly, all neq_num/2
constraints are scheduled and processed before more global constraints
are invoked. In this way, all the distilled information can be taken
into account by subsequently invoked global constraints.
These changes yield a 3-fold improvement in several Sudoku instances,
and a significant runtime reduction in social golfer instance 8-4-9.
2022-10-26 23:36:07 -06:00
Markus Triska
4422ffe39f
add meta_predicate/1 declarations
2022-10-26 23:36:07 -06:00
Markus Triska
6b49653754
use in_character
...
This addresses one aspect of #1472 .
2022-05-22 23:04:27 +02:00
Markus Triska
d5fa8cc211
ADDED: must_be(in_character, ...) and can_be(in_character, ...)
2022-05-22 23:04:27 +02:00
Markus Triska
47a6b498e3
ENHANCED: "f" on toplevel to report answers up to the next multiple of 5.
...
This makes counting solutions easy.
2022-05-21 18:20:08 +02:00
Markus Triska
18c52e076f
indent enumerations
2022-05-15 10:55:56 +02:00
Markus Triska
1810dabc14
clarify the representation
2022-05-15 10:55:27 +02:00
Markus Triska
609a3a229f
strengthen and improve type checks
2022-05-15 10:51:00 +02:00
Markus Triska
dff56643f0
clarify comment
2022-05-15 10:23:00 +02:00
Markus Triska
77f8d52271
use phrase_from_file/2 directly on the file name
2022-05-15 10:19:00 +02:00
Markus Triska
1e9821ec0c
document atom and predicate completion with TAB
...
This feature, added via
https://github.com/mthom/scryer-prolog/pull/1467 , makes the toplevel
interaction a lot more convenient in many cases.
Many thanks to @euanlacy!
2022-05-15 10:05:30 +02:00
Markus Triska
a5e72679bc
prioritize type errors over instantiation errors
...
Example:
?- must_be(chars, [a,X,cc]).
error(type_error(character,cc),can_be/2).
See https://github.com/mthom/scryer-prolog/pull/1474#issuecomment-1126664368
2022-05-14 09:53:21 +02:00
Markus Triska
15cc916333
FIXED: can_be(chars, [a,X]), i.e., if variables occur as elements
...
This should simplify 2f3de51e55 and
other cases like it.
2022-05-14 08:39:20 +02:00
Markus Triska
d58dd7cc91
ADDED: sign/1
2022-05-05 22:51:49 +02:00
Markus Triska
7e06abebd5
remove comment that seems no longer valid
2022-05-05 22:51:49 +02:00
Markus Triska
eea83d9474
ADDED: can_be(term, ...) and must_be(term, ...)
...
This terminology is a bit harder to understand than that of the other
type checks.
Scryer Prolog comprises two individually consistent but incompatible
notions of terms, namely terms and rational trees (which are also
called "cyclic terms"). This leads to a confusion in terminology,
because cyclic terms are not terms in the former sense even though
they also contain the word "term" in their name.
This terminological confusion is not restricted to terms: We also find
it for example in the notion of lists. Lists are defined inductively:
- The empty list (written as "" or [], called 'nil') is a list.
- A term with principal functor '.'/2 is a list if its second argument
is a list.
Note that a list may contain cyclic terms as elements, and still be
called a list. However, if we post:
?- Ls = [_|Ls].
then Ls is not a list, because it does not fit the inductive
definition. Still, it is sometimes referred to as a "cyclic list" or
"circular list", even though it is not a list. Even Prolog
implementors that aim for strict conformance to the Prolog ISO
standard and are deeply familiar with the standard use this
terminology when talking about such terms, see for example:
https://github.com/ichiban/prolog/pull/198
Consequently, must_be(list, Ls) raises a *type error* in this case.
Terms are distinguished from cyclic terms completely analogously. This
leads to the counterintuitive consequence that *cyclic lists are not
terms*. The reason for this apparent contradiction in terminology is
the mutual incompatibility of different notions of terms. The notion
of "term" precludes rational trees, similar to the notion of "list"
which precludes cyclic lists.
We therefore introduce:
* must_be(term, Term)
- raises an instantiation error if Term contains variables (since
it could still become a rational tree)
- raises a type error if Term is a rational tree
* can_be(term, Term)
- raises a type error if Term is a rational tree
Note that using the notion of "cyclic term" and "acyclic term" in this
terminology would not be a good idea, because this confusion is
precisely what we want to eliminate: must_be(term, Term) should be
usable as a test that reliably determines whether Term can be treated
as a term with the logical properties we expect from terms.
This addresses #1428 .
2022-04-20 22:15:32 +02:00
Markus Triska
1fa8a0a969
ENHANCED: more memory efficient call_nth/2 ( #1264 )
...
I hope that this will allow more extensive tests of Scryer Prolog. Enjoy!
2022-04-02 17:42:45 +02:00