Markus Triska
8329d222cb
ENHANCED: use (+)/2 to express unary minus
...
This makes answers a bit shorter and more readable.
Example:
?- X #= -Y.
clpz:(X+Y#=0).
This addresses #2058 .
2023-10-09 22:59:51 +02:00
Markus Triska
99348ec309
ENHANCED: Omit projection of morphed (^)/2 in disentailed constraints.
...
Example:
?- B #<==> (0^Y/0) #= Z.
B = 0, clpz:(Y in 0..sup), clpz:(Z in inf..sup).
2023-10-09 21:33:04 +02:00
Markus Triska
cacc7f3193
FIXED: Queue triggered propagators to be processed after pexp/3 finishes
...
If reification constraints (such as reified equality) are triggered
here, then they may wish to disable this propagator and remove
attributes from auxiliary variables. If the pexp/3 propagation is
interrupted for that purpose, then the attributes will be
unintentionally reattached by the following fd_put/3 calls in this
propagator. We must ensure that this propagator completely finishes,
so we queue the triggered propagators for later processing.
geq/2 implements propagator activation outside the queue, and thus
should not be used in propagators in the way it was used here.
pexp/3 by itself may not seem particularly important. However, it can
arise by metamorphosis from Var*Var. Example:
?- A#<==> -1#=C*C, C in 0..1.
A = 0, clpz:(C in 0..1).
This addresses #2089 .
2023-10-09 20:42:28 +02:00
Markus Triska
743412de33
ENHANCED: Remove no longer needed morphed propagators.
...
This addresses all remaining cases from #2083 , excepting (//)/2:
?- #\ 1#=(X*X)/0.
clpz:(X in inf..sup).
?- #\ 1#=(X+X)/0.
clpz:(X in inf..sup).
Still remaining:
?- #\ 0#=(Y// -1)/0.
clpz:(-1*Y#=_A).
2023-10-08 20:15:56 +02:00
Markus Triska
f34703a279
remove no longer needed goal projection for pdiv
2023-10-08 12:07:17 +02:00
Markus Triska
5cce8ddd7d
ENHANCED: avoid pending residual constraints in disentailed reified (div)/2
...
This addresses #2083 :
?- #\0#=0//0 div 2.
true.
2023-10-08 11:53:06 +02:00
Markus Triska
ff63eacf2c
replace list//1 by seq//1 from library(dcgs)
2023-10-08 11:28:52 +02:00
Markus Triska
8121dce2a4
instead of prdiv, use ptimes directly
2023-10-08 09:46:41 +02:00
Markus Triska
4d910f6bfe
FIXED: variables in reified propagators must share the same queue
...
Otherwise, propagation steps may be inadvertently omitted, if
propagators are scheduled in a different queue.
This addresses #2084 .
2023-10-08 09:45:20 +02:00
Markus Triska
51c00fce57
adapt query to Scryer Prolog
2023-10-08 09:26:22 +02:00
Markus Triska
3fc969b38b
reorder and realign entries to form a contiguous group starting with d(D)
2023-10-06 22:58:56 +02:00
Markus Triska
7ed38d6c6c
FIXED: reification of (/)/2 for undefined subexpressions
...
This addresses #2078 and #2079 .
2023-10-06 22:55:46 +02:00
Markus Triska
7c10683e46
Revert "FIXED: corrections to expansion_simpler/2"
...
This reverts commit f3b848537a .
The root cause of this problem is a mistake in ground/1. See #2073 .
2023-10-03 19:16:04 +02:00
Markus Triska
f3b848537a
FIXED: corrections to expansion_simpler/2
...
Example:
?- X = 0, Y = 0, Z #= X-1 + Y-1.
X = 0, Y = 0, Z = -2.
This addresses #2064 .
See ca5a5b4392 for a previous issue in
this logic.
2023-10-02 23:17:06 +02:00
Markus Triska
182afe3b7d
update comment
2023-09-08 22:34:24 +02:00
Markus Triska
98086de77e
attach more propagators before starting propagation
...
This prevents repeated triggering of already attached propagators
while new propagators are being attached to involved variables.
2023-08-22 21:52:55 +02:00
Markus Triska
24456e9703
remove optional (+)/1 prefix in get_atts/2 and put_atts/2 calls
...
The (+)/1 prefix in get_atts/2 at line 4219 by itself already causes a
greater than 15% slowdown for the benchmark shown in #1730 :
?- N #= 2^14,
time(((between(1, N, _),
X #\= Y,
false)
; true)).
The performance impact is not a good reason to remove the optional
(+)/1 prefix! Performance issues should be addressed at the root, in
this case get_atts/2 (#1962 ). We should never manually work around
performance issues in built-in predicates.
In contrast, readability is a good argument, and I find the calls
slightly easier to read without the optional (+)/1 prefix.
The prefix is now consistently omitted when possible.
2023-08-22 21:52:55 +02:00
Markus Triska
7f024f3b8d
use pneq/2
2023-08-22 21:52:55 +02:00
Markus Triska
67c1b171c7
enforce same queue in more constraints
2023-08-22 21:52:55 +02:00
Markus Triska
04fbb0c1ce
append the entire queues instead of inserting each element individually
2023-08-22 21:52:55 +02:00
Markus Triska
327423ab84
adapt query to Scryer Prolog
2023-08-21 21:19:29 +02:00
Markus Triska
20cfffdff5
update answers
2023-08-21 21:19:29 +02:00
Markus Triska
d8e126044f
use can_be/2
2023-08-21 21:19:29 +02:00
Markus Triska
f02cd0ad3c
ENHANCED: domain error in zcompare/3 ( #1723 )
2023-08-14 17:54:18 +02:00
Markus Triska
0ddda0a864
FIXED: do not attach constraint if the propagator is already entailed and killed
...
Example:
?- A#=A//A#==>B,A-B=1-1.
A = 1, B = 1.
This addresses #1941 .
2023-08-03 00:26:40 +02:00
Markus Triska
54a887cdc3
ENHANCED: forget auxiliary constraints set up by the propagator for multiplication
...
This addresses the issue raised in https://github.com/mthom/scryer-prolog/discussions/1937 .
2023-07-31 21:57:25 +02:00
Markus Triska
ceb276b249
use copy_term_nat/2
2023-06-27 22:37:23 +02:00
notoria
495df8846a
Compute correctly the domain of the remainder
2023-05-27 13:47:14 +02:00
notoria
05d48cdcc3
Don't add variable
...
?- Z #= 0, Z #= X mod Y.
Z = 0, clpz:(_A*Y#=X), clpz:(Y in inf.. -1\/1..sup) % Unexpected.
The expected result:
Z = 0, clpz:(X mod Y#=0), clpz:(Y in inf.. -1\/1..sup).
2023-05-27 13:41:04 +02:00
notoria
dc02be4944
Remove and move comments
2023-05-27 13:08:25 +02:00
Markus Triska
5763a4b9df
FIXED: propagation for ground tuples
...
Example:
?- tuples_in([[A,A]],[[0,1],[2,0]]).
false.
See https://github.com/triska/clpz/issues/22 .
2023-04-13 23:39:45 +02:00
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
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
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
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
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
Mark Thom
df266378c4
Merge pull request #1689 from triska/clpb_doc
...
DOC: preliminary CLP(B) documentation in DocLog format
2023-01-24 22:51:35 +01:00
Markus Triska
1c08b56e05
strengthen reified division for divisor == 1
2023-01-24 22:15:05 +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