--
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/CAEvX6dkqSwJbOxsK%2B6n%2BF0a4nbrYqYtALHQpoZVLo24E_%2BJRkQ%40mail.gmail.com.
What is co-induction in this case?
datatype T = t of (U)
and U = u of (T)
>>Why don't you use REVERSE and APPEND have already defined?
I could but doing so would take more time.
A person doing theorem-proving in a system like Coq often gets distracted
as the focus is much more on low-level technical details than on the kind of
high-level reasoning humans prefer.
extern
prfun
lemma_rev_append{xs,ys:ilist}
(
// argumentless
) : ILISTEQ(rev(append(xs, ys)), append(rev(ys), rev(xs)))
propdef PAL(xs: ilist) = REVERSE(xs, xs)
(* ****** ****** *)
//
extern
prfun
lemma_apprev_pal{xs,ys,zs:ilist}(REVERSE(xs, ys), APPEND(xs, ys, zs)): PAL(zs)
//
sortdef elt = int
//
extern
prfun
mylemma1
{xs,xs2:ilist}{n:int}
(
LENGTH(xs, n), LENGTH(xs2, n),
fpf: {x:elt}{i:int}(NTH(x, xs, i) -> NTH(x, xs2, n-1-i))
) : REVERSE (xs, xs2)
//
(* ****** ****** *)
//
extern
prfun
mylemma_main
{xs,ys,zs:ilist}{n:int}
(
LENGTH(xs, n), REVERSE(xs, ys), APPEND(xs, ys, zs)
) : {z:elt}{i:int}(NTH(z, zs, i) -> NTH(z, zs, 2*n-1-i))
//
[…]However, it can be quite involved to prove it in ATS.
[…]
Personally, I do not see much to be gained by going through this exercise.
Of course, you get to learn more about typechecking in ATS, but that is about it.
//
extern
prfun
lemma_reverse_scons
{x:elt}{xs,ys:ilist}{ys1:ilist}
(REVERSE(xs, ys), SNOC(ys, x, ys1)): REVERSE(ilist_cons(x,xs), ys1)
//
extern
prfun
lemma_append_scons
{x:elt}{xs,ys,zs:ilist}{ys1,zs1:ilist}
(APPEND(xs, ys, zs), SNOC(ys, x, ys1), SNOC(zs, x, zs1)): APPEND(xs, ys1, zs1)
//
prfun pal_rev : {xs:ilist} PAL(xs) -> REVERSE(xs, xs)
prfun rev_pal : {xs:ilist} REVERSE(xs, xs) -> PAL(xs)
rev(cons(x, xs)) = snoc(rev(xs), x)
rev(snoc(x, xs)) = cons(x, rev(xs))
snoc(cons(x, ys), z) = cons(x, snoc(ys, z))
Hi all,
I would like to shape palindrome on ATS/LF.
http://www.cis.upenn.edu/~bcpierce/sf/current/Prop.html#lab267
However, I think "datasort" can't have any quantification.
Then I have following code:
dataprop List_l (int) =
| List_l_nil (0)
| {n:nat} List_l_cons (n+1) of (int, List_l (n))
prfun snoc_l {n:nat} .<n>. (l: List_l (n), v: int):<> List_l (n+1) =
case+ l of
| List_l_nil () => List_l_cons (v, List_l_nil ())
| List_l_cons (h, t) => List_l_cons (h, snoc_l (t, v))
dataprop Palindrome (List_l (int)) =
| Pal_nil (Nil)
| {n:int} Pal_one (Cons (n, Nil))
| Pal_cons ...
It's hard to shape "Palindrome"...
How to shape palindrome on ATS/LF?
Thank's,
--
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/CAEvX6dmBuOuET4oiC3w%2BJLnioSnWQNc0PQBf6GiHFCn9mMdcMQ%40mail.gmail.com.