Commit Graph

913 Commits

Author SHA1 Message Date
Mark
2811660fa7 remove assert(a,z)/2 (#1975) 2023-11-22 09:24:07 -07:00
Markus Triska
186bba9d75 ENHANCED: time/1 now shows the number of inferences
Example:

    ?- time(member(X, "abc")).
       % CPU time: 0.000s, 1 inference
       X = a
    ;  % CPU time: 0.000s, 3 inferences
       X = b
    ;  % CPU time: 0.000s, 3 inferences
       X = c.

This is an initial step towards addressing #1039.
2023-11-21 20:36:44 +01:00
Mark
1e5bb2d3da fix dif:vars_remove_goal/2 (#2175), untabify forms.rs to appease format check 2023-11-20 14:21:18 -07:00
Adrián Arroyo Calle
682b2ada4c Rename to_upper to upper and to_lower to lower 2023-10-28 19:16:07 +02:00
Mark
ff19db0084 qualify dif/2 call in reinforce_goal (#2135) 2023-10-25 12:26:01 -06:00
notoria
62e6ca02f9 Reify (^)/2
Like (/)/2, (^)/2 can fail in cases such as 0 #==> X #= 2^(-1), where success is expected.
2023-10-14 12:11:24 -06:00
notoria
c6fcbe20e1 Trigger propagator for popcount/1 2023-10-14 12:11:24 -06:00
notoria
a1b71f0440 Trigger propagator for sign/1 2023-10-14 12:11:24 -06:00
notoria
dc08c26d9f Trigger propagator for (xor)/2 2023-10-14 12:11:24 -06:00
Markus Triska
721cf20cf7 shift morphing to the more general p/2 case 2023-10-12 23:32:04 +02:00
Markus Triska
6ed9a99832 ENHANCED: Omit unnecessary residual constraints in disentailed reified (//)/2
Example:

    ?- #\ 0#=(Y// -1)/0.
    %@    clpz:(Y in inf..sup).

This addresses #2104.
2023-10-12 23:32:04 +02:00
Mark
1163d14ea1 fix control construct bugs, iter indentation (#947) 2023-10-11 12:41:45 -06:00
Markus Triska
8de3498e07 use round brackets around operators to form valid Prolog terms 2023-10-10 21:32:45 +02:00
Markus Triska
26fdf83a48 update comment to reflect the used propagators 2023-10-10 21:32:45 +02:00
Markus Triska
32af047925 remove definition and calls of do_queue/0, which has become a NOP 2023-10-10 21:32:45 +02:00
Markus Triska
282633c877 ENHANCED: Queue morphed propagators to give them a chance for propagation.
This addresses #2096:

    ?- B in -2..0, 0#<==>0#=0/(B*B),labeling([],[B]).
       B = 0.

    ?- A#<==>A#=A/A^2,A=0.
       A = 0.
2023-10-10 21:32:45 +02:00
Mark Thom
c9df19ca30 Merge pull request #2094 from triska/unary_minus
ENHANCED: use (+)/2 to express unary minus
2023-10-09 15:06:09 -06:00
Markus Triska
7c1cd18a06 Z --> Y 2023-10-09 23:13:09 +02:00
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
1c3df1cdd7 attach the propagator to Y 2023-10-09 21:55:39 +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
Mark Thom
3ffea2d987 Merge pull request #2072 from aarroyoc/fix-urldecode
Improved version of url_decode
2023-10-02 16:06:35 -06:00
Adrián Arroyo Calle
93ff049e54 Improved version of url_decode 2023-10-02 23:49:09 +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
Mark
4a8aa0acbd throw instantiation_error from error/2 if Error_term uninstantiated (#2060) 2023-09-30 22:35:46 -06:00
Mark
6fa00b5b55 get rid of inference_limit_exceeded(B) as an error term (#2023) 2023-09-30 22:35:46 -06:00
Mark
40d3345cd5 revert throwing domain errors for unexpected forms of read-options (#2015) 2023-09-27 18:58:45 -06:00
Adrián Arroyo Calle
660860bccf Replace Hyper with Warp for HTTP server
- Use Warp
- Optimize clones
- HTTPS server
- Content-Length limit
- HTTP Basic Auth
- Stop server with Ctrl-C
2023-09-27 18:50:19 +02:00
Mark
39934208c3 throw instantiation_error when appropriate from parse_write_options_ (5.5.12 of the standard, #1965) 2023-09-26 12:08:51 -06:00
bakaq
f644a76281 Remove reposition option from phrase_from_file/2 2023-09-25 02:18:05 -03:00
bakaq
63bb993c02 Inline string_get_n_chars_/3 2023-09-24 19:29:51 -03:00
bakaq
c50291cec8 Better string_get_n_chars_/3 2023-09-24 19:21:03 -03:00
bakaq
2fe79b5fc3 Fixed bug with '$skip_max_list'/4 2023-09-24 15:08:24 -03:00
bakaq
b4fab5a806 Use '$skip_max_list'/4 in string_get_n_chars/4 2023-09-24 14:32:44 -03:00
bakaq
35d0042be1 Add phrase_from_stream/2 to library(pio) 2023-09-24 14:32:44 -03:00
bakaq
cb79e83510 Avoid dif/1 attribute with empty list
Closes #1956
2023-09-21 14:00:37 -03:00
bakaq
a64a765f32 Improved dif/2 2023-09-20 20:56:04 -03:00
Mark
de440a8c92 get rid of OssifiedOpDir, DBRef, simplify current_op/3 2023-09-11 15:36:15 -06:00
Markus Triska
85cc4a80d0 remove code that is not needed in Scryer Prolog 2023-09-09 07:46:01 +02:00