The thread of the errors in the docs

110 views
Skip to first unread message

Yannick Duchêne

unread,
Jan 28, 2015, 12:49:32 PM1/28/15
to ats-lan...@googlegroups.com
I don't remember of any already existing one, so I'm opening this thread where to report any errors in the docs, instead of opening a new thread for each possible eventual errors (saying that, I don't want to mean there are many).

My first case.


     val
     fact =
     fix f(x: int): int =>
       if x > 0 then x * fact(x-1) else 1
     (* end of [fact] *)

Sure it should be “f(x-1)” instead of “fact(x-1)”

gmhwxi

unread,
Jan 28, 2015, 2:03:03 PM1/28/15
to ats-lan...@googlegroups.com
Thank you very much for opening this thread. It is a VERY good idea!

Yannick Duchêne

unread,
Feb 1, 2015, 7:17:23 AM2/1/15
to ats-lan...@googlegroups.com
Unless I've missed something, there is one in http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/x794.html

It says “For instance, calling rtfind on the polynomial function lam x => x * x - x + 110 returns 11”. But x² - x + 110 = 0 has no solution in ℝ. Testing the example returns the erroneous result 463410 on my 32 bits machine.

Hongwei Xi

unread,
Feb 1, 2015, 10:37:30 AM2/1/15
to ats-lan...@googlegroups.com
The polynomial should be lam x => x * x - x - 110. Fixed.

--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/92d37708-5bbb-4640-ad1f-354e75802fb5%40googlegroups.com.

Yannick Duchêne

unread,
Feb 6, 2015, 12:07:31 PM2/6/15
to ats-lan...@googlegroups.com
In http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/x2528.html , about the second definition of the `isqrt` function, this sentence looks strange to me: “The following code we obtain after proper modification does pass typechecking”. Actually, it does not: both `patscc --typecheck` and `patscc -tcats` tells about one unsolved constraint error and two unsolved termination constraints errors.


Le mercredi 28 janvier 2015 18:49:32 UTC+1, Yannick Duchêne a écrit :

Hongwei Xi

unread,
Feb 6, 2015, 12:26:35 PM2/6/15
to ats-lan...@googlegroups.com
Thanks for pointing it out.

I have changed (diff / 2) into half(diff). The type assigned to integer division in ATS2
is no longer strong enough for this example.

--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.

Hongwei Xi

unread,
Feb 6, 2015, 12:31:04 PM2/6/15
to ats-lan...@googlegroups.com
Just want to add that using ndiv (division for natural numbers) also works.
You can write

ndiv(diff, 2)

or

(diff \ndiv 2)

Message has been deleted
Message has been deleted

Yannick Duchêne

unread,
Feb 7, 2015, 7:27:55 AM2/7/15
to ats-lan...@googlegroups.com

“Within the ATS programming *langauge* system” (should be “language”)

Le mercredi 28 janvier 2015 18:49:32 UTC+1, Yannick Duchêne a écrit :

Hongwei Xi

unread,
Feb 7, 2015, 9:41:00 AM2/7/15
to ats-lan...@googlegroups.com
Fixed. Thanks!

--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.

Yannick Duchêne

unread,
Feb 7, 2015, 10:38:07 AM2/7/15
to ats-lan...@googlegroups.com


Le samedi 7 février 2015 15:41:00 UTC+1, gmhwxi a écrit :
Fixed. Thanks!


Thanks too! :p

I found another typo, more annoying this one, as it ends into a type‑checker error. In http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/x2905.html “prfun mut_istot {m,n:int} (): [p:int] MUL (m, n, p)” the name “mut_istot” should be “mul_istot” or else the proof function implementation which follows fails.

Hongwei Xi

unread,
Feb 7, 2015, 11:01:13 AM2/7/15
to ats-lan...@googlegroups.com
Fixed. Thanks!


--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.

Yannick Duchêne

unread,
Feb 9, 2015, 6:38:39 PM2/9/15
to ats-lan...@googlegroups.com


Le mercredi 28 janvier 2015 18:49:32 UTC+1, Yannick Duchêne a écrit :
I don't remember of any already existing one, so I'm opening this thread where to report any errors in the docs, instead of opening a new thread for each possible eventual errors (saying that, I don't want to mean there are many).

In http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/HTMLTOC/x3076.html , in the sentence “ATS with theorem-proving systems such as Isabel and Coq […]”, Isabelle is misspelled: “le” is missing at the end.

gmhwxi

unread,
Feb 9, 2015, 7:40:08 PM2/9/15
to ats-lan...@googlegroups.com

Fixed. Thanks!

I have never used Isabelle :)

Tried Nuprl a bit and Coq a bit, too.

My theorem-proving experience largely came from
using/implementing a system called TPS, which was
a project led by Prof. Peter Andrews at CMU.

Yannick Duchêne

unread,
Feb 10, 2015, 7:28:24 AM2/10/15
to ats-lan...@googlegroups.com


Le mercredi 28 janvier 2015 18:49:32 UTC+1, Yannick Duchêne a écrit :
I don't remember of any already existing one, so I'm opening this thread where to report any errors in the docs, instead of opening a new thread for each possible eventual errors (saying that, I don't want to mean there are many).


Not an error, more an enhancement.


fun imul2{i,j:int}
 
(i: int i, j: int j): [ij:int] (MUL(i, j, ij) | int ij)

After http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/HTMLTOC/x3140.html , if I check this in a DATS file…

extern fn imul2
 
{i,j:int}
 
(i: int i, j: int j): [ij:int] (MUL(i, j, ij) | int ij)

dataprop FACT
(int, int) =
 
| FACTbas(0, 1)
 
| {n:nat} {r1,r:int} FACTind(n, r) of (FACT(n-1, r1), MUL(n, r1, r))

fun ifact
{n:nat} .<n>. (n: int(n)):<> [r:int] (FACT(n, r) | int r) =
if n = 0
then (FACTbas() | 1)
else
  let
    val
(pf1 | r1) = ifact (n-1) // pf1: FACT(n-1, r1)
    val
(pfmul | r) = imul2 (n, r1) // pfmul: FACT(n, r1, r)
 
in (FACTind(pf1, pfmul) | r)
 
end


… I get the error or warning “some disallowed effects may be incurred: 1” on line #15 (the one which invokes `imul2`).

After an another topic, https://groups.google.com/forum/#!topic/ats-lang-users/MsaDGpgDp0I , seems either `:<>` has to be removed from `ifact` or `:<>` added to `imul2`.

Yannick Duchêne

unread,
Feb 10, 2015, 7:52:24 AM2/10/15
to ats-lan...@googlegroups.com
In http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/HTMLTOC/x3166.html , an invocation of `imul2` is wrong. In `val (pfmul | r1) = (i+1) imul2 r` should either be rewritten as `val (pfmul | r1) = (i+1) \imul2 r` or as `val (pfmul | r1) = imul2((i+1), r)`


Le mercredi 28 janvier 2015 18:49:32 UTC+1, Yannick Duchêne a écrit :

Hongwei Xi

unread,
Feb 10, 2015, 9:36:02 AM2/10/15
to ats-lan...@googlegroups.com
Fixed. Thanks!

--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.

Yannick Duchêne

unread,
May 14, 2015, 8:28:25 AM5/14/15
to ats-lan...@googlegroups.com
Not an error, just a comment.

On the page http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/HTMLTOC/x2110.html , the definition of `array_copy_from_list`, starts like this:

implement
{a}(*tmp*)
array_copy_from_list
 
(A, xs) = let

Looking only at the declaration part, how `a` is used is not visible. It is made visible later, making use of type inference:

      […] = let
//
fun loop
(
  p
: ptr, xs: list0 (a)
) : void =


Just wondered if ever this more easy to follow if `x: list0 (a)` was on the outer declaration, so that the relation would be more obvious. Like this:

implement
{a}(*tmp*)
array_copy_from_list
 
(A, xs: list0 (a)) = let

(provided I've not missed anything and I'm saying something wrong, as I'm not yet used to templates)

Le mercredi 28 janvier 2015 18:49:32 UTC+1, Yannick Duchêne a écrit :
[…]

gmhwxi

unread,
May 14, 2015, 10:10:02 AM5/14/15
to ats-lan...@googlegroups.com
This is fine. It just incurs a little bit extra typechecking.

Yannick Duchêne

unread,
May 20, 2015, 1:08:02 AM5/20/15
to ats-lan...@googlegroups.com


Le mercredi 28 janvier 2015 18:49:32 UTC+1, Yannick Duchêne a écrit :
I don't remember of any already existing one, so I'm opening this thread where to report any errors in the docs, instead of opening a new thread for each possible eventual errors (saying that, I don't want to mean there are many).

[…]

Unless I've missed something, I believe there is a repeated error in http://ats-lang.sourceforge.net/DOCUMENT/ATS2TUTORIAL/HTML/HTMLTOC/c642.html : `n` is never decremented.

At least, adding a termination metric, without touching the function's logic, makes ATS catch an error:
fun fact
 
{n: int} (n: int n): int = let
  fun loop
{n: int} .<n>. (n: int n, res: int): int =
   
if n > 0 then loop (n, n * res) else res
 
// end of [loop]
in
  loop
(n, 1)
end // end of [fact]

This one is OK:
fun fact
 
{n: nat} (n: int n): int = let
  fun loop
{n: nat} .<n>. (n: int n, res: int): int =
   
if n > 0 then loop (n - 1, n * res) else res
 
// end of [loop]
in
  loop
(n, 1)
end // end of [fact]

This seems to be the same with the two preceding functions.

Hongwei Xi

unread,
May 20, 2015, 1:21:57 AM5/20/15
to ats-lan...@googlegroups.com
Fixed. Thanks!


--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.

Yannick Duchêne

unread,
May 21, 2015, 5:50:17 PM5/21/15
to ats-lan...@googlegroups.com
I'm a bit unsure with this one, rather a doubt.

In http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/HTMLTOC/x3658.html , the wording suggest something is to come, but the page contains a single sentence.

Le mercredi 28 janvier 2015 18:49:32 UTC+1, Yannick Duchêne a écrit :
[…]

Hongwei Xi

unread,
May 22, 2015, 10:00:47 AM5/22/15
to ats-lan...@googlegroups.com
This section has not been written yet. I will find some time to do it.


--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.

Yannick Duchêne

unread,
Dec 11, 2015, 3:02:17 PM12/11/15
to ats-lang-users
Not an error, rather what I believe may be misleading, if I understand correctly.

In “Example: Verified Fast Exponentiation”

An `absprop` `MUL` is defined, then follows the declaration of a dynamic function `mul_elt_elt`, returning a proof of `MUL(x, y, xy)`.

This function has no body, and indeed, there is no way for a dynamic function to instantiate a `MUL`, as it's an abstract proposition, thus, not defining any dynamic constructor which would be usable from the body of a dynamic function. This function declared with `fun`, behaves like a `praxi`, and I though this may be better to use `praxi`.

I just wondered what about systematically use `praxi` is these cases, as it underlines it's axiomatic (and one should always be careful with axioms).

Or is there a reason for it to be declared with `fun` instead of `praxi`? Especially in the documentation, `praxi` would be better, isn't it?

There are two others in “Linear Channels for Asynchronous IPC”

`queue_isnil` declared with `fun`, returning a proof of `ISNIL(id, b)` and `ISNIL` is an `absprop`
`queue_isful` declared with `fun`, returning a proof of `ISFUL(id, b)` and `ISFUL` is an `absprop` too.


Unless I'm wrong…

Le mercredi 28 janvier 2015 18:49:32 UTC+1, Yannick Duchêne a écrit :

gmhwxi

unread,
Dec 11, 2015, 9:27:05 PM12/11/15
to ats-lang-users

Originally (that is, in ATS1), there is checking to ensure that each declared
prfun is implemented; if a prfun is not implemented, it needs to be declared as a praxi.
In ATS2, this kind of checking is abandoned (as it seems too unwieldy in practice).
So, there is little difference between prfun and praxi in ATS2.

Even for an abstract prop, using prfun still makes sense as the abstract prop can be
implemented at some point. Say you have an abstract prop FOO. You can do

assume FOO = ...

implement
lemma_for_FOO (...) = ...
Reply all
Reply to author
Forward
0 new messages