Commit Graph
100 Commits
Author SHA1 Message Date
Markus Triska 814ce2d672 ENHANCED: improved determinism of member/2
Example:

    ?- member(X, "abc").
    %@    X = a
    %@ ;  X = b
    %@ ;  X = c.

This addresses #750.
2023-07-12 14:39:08 -06:00
Markus Triska 918dfca409 DOC: new section on applications of Scryer Prolog
This addresses an important aspect of #1777.
2023-07-09 10:29:53 -06:00
Markus Triska d18f128a3c correct \\ to \, addressing #1865 2023-07-09 10:29:53 -06:00
Markus Triska 6525c1f543 print version more readably, addressing #1868 2023-07-08 08:19:05 +02:00
Markus Triska 3b9b9e75c4 make double_quotes write option not dependent on double_quotes flag
This gives consistent results without depending on another flag.
2023-07-05 21:37:11 +02:00
Markus Triska 7f159a7ed2 advertise newly achieved strong syntactic conformance: all current tests pass
This addresses an important aspect of #1777.
2023-07-03 22:04:26 +02:00
Markus Triska 31030738a4 remove now unneeded check 2023-06-30 22:14:00 +02:00
Markus Triska 42282c6e6e remove unneeded case: only operator definitions should count, not quoting 2023-06-30 18:03:21 +02:00
Markus Triska a3f8ddd24a remove subsumed case: F == Value means Arity =:= 0, now considered above 2023-06-30 18:02:43 +02:00
Markus Triska bfe808a779 shorten needs_bracketing/2 2023-06-30 18:01:54 +02:00
Markus Triska 28065b0565 constrain bracketing to operators with pertaining arity
Example:

    ?- X = -->(a,b,c).
       X = -->(a,b,c).
2023-06-30 18:01:17 +02:00
Markus Triska db972de40c bracket all operators that are direct operands of (=)/2
This addresses #804.
2023-06-30 08:03:38 +02:00
Markus Triska c84a5c3282 remove unneeded single quotes 2023-06-29 19:25:23 +02:00
Markus Triska ceb276b249 use copy_term_nat/2 2023-06-27 22:37:23 +02:00
Markus Triska 9bc3757a9e another case of "read" --> "get", for an only internally used predicate 2023-06-24 11:48:28 +02:00
Markus Triska 18d0a74f23 MODIFIED: read_line_to_chars/3 is now called get_line_to_chars/3
This is for consistency with other I/O predicates, where "read" always
indicates Prolog terms. Please adjust your programs accordingly.
2023-06-24 11:47:32 +02:00
Markus Triska 2716381e7b FIXED: correct dereferencing in atom_codes/2 and number_codes/2.
This addresses #1818.

Test case:

    run :-
	    length(Ls, L),
	    portray_clause(L),
	    maplist(=(X), Ls),
	    X = Y,
	    Y = 12,
	    atom_codes(_, Ls),
	    false.
2023-06-23 14:11:31 -06:00
Markus Triska 97bd778745 FIXED: correctly reset counter in reset_gensym/2 (#1807)
Many thanks to @infradig for detecting this issue and suggesting this
correction!
2023-06-23 14:11:31 -06:00
Markus Triska 43df2e2649 shorten gensym/2 2023-06-23 14:11:31 -06:00
Markus Triska c2f2623471 extend logic to all control and whitespace characters
This addresses #1802.
2023-06-23 14:11:31 -06:00
Markus Triska 86beb222ae rely on first instantiated argument indexing in the definitions of foldl/N
This allows shorter and more natural definitions.
2023-06-23 14:11:31 -06:00
Markus Triska 5e124ccf44 ENHANCED: allow Roman numerals in strings
Example:

    ?- X = "ↁ".
       X = "ↁ".

This addresses #1790.
2023-06-23 14:11:31 -06:00
Markus Triska 47d4e6d2f9 FIXED: consistent read/write of further control characters, and non-breaking space
Example:

    ?- X = '\xa0\'.
       X = '\xa0\'.

This addresses #1768.
2023-06-23 14:11:31 -06:00
Markus Triska 5154314786 FIXED: correct dereferencing in atom_codes/2 and number_codes/2.
This addresses #1818.

Test case:

    run :-
	    length(Ls, L),
	    portray_clause(L),
	    maplist(=(X), Ls),
	    X = Y,
	    Y = 12,
	    atom_codes(_, Ls),
	    false.
2023-05-29 11:43:56 +02:00
Markus Triska 021c01dfd0 FIXED: correctly reset counter in reset_gensym/2 (#1807)
Many thanks to @infradig for detecting this issue and suggesting this
correction!
2023-05-16 22:42:57 +02:00
Markus Triska 30f222b837 shorten gensym/2 2023-05-16 22:41:20 +02:00
Markus Triska 49addc7b04 extend logic to all control and whitespace characters
This addresses #1802.
2023-05-14 09:25:08 +02:00
Markus Triska 4e60cc46a2 rely on first instantiated argument indexing in the definitions of foldl/N
This allows shorter and more natural definitions.
2023-05-04 00:50:27 +02:00
Markus Triska d8edf7bfff FIXED: consistent read/write of further control characters, and non-breaking space
Example:

    ?- X = '\xa0\'.
       X = '\xa0\'.

This addresses #1768.
2023-05-03 23:29:22 +02:00
Markus Triska e951db662d ENHANCED: allow Roman numerals in strings
Example:

    ?- X = "ↁ".
       X = "ↁ".

This addresses #1790.
2023-05-03 22:02:47 +02:00
Markus Triska 2a1b8f37ec remove residual goal for ground BDD
Example:

    ?- sat(X).
       X = 1.
2023-04-23 09:23:00 +02:00
Markus Triska 8b7281fad0 ADDED: dif_si/2
Source: https://stackoverflow.com/questions/20223390/prolog-a-person-is-a-sibling-of-himself

In Scryer Prolog, this is actually not needed, since Scryer Prolog provides
dif/2 in library(dif). However, it is still useful to provide dif_si/2 for two reasons:

  1) to more easily port code from systems where only dif_si/2 is available
  2) to provide correct disequality in other systems that adopt this library
2023-04-23 00:37:14 +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 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