# Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

# [Frama-c-discuss] Problem with solver

*Subject*: [Frama-c-discuss] Problem with solver*From*: Christoph.Weber at first.fraunhofer.de (Christoph Weber)*Date*: Thu, 8 Jan 2009 09:41:13 +0100

Hello again, I would like to post a question regarding the reverse algorithm I sent before. Following combination of functions: /*@ requires \valid(a); requires \valid(b); ensures *a == \old(*b); ensures *b == \old(*a); */ void swap (int* a, int* b ) { int c = *a; *a = *b; *b = c; } /*@ requires 0 <= length; requires \valid_range (a, 0, length-1); ensures \forall integer k; 0 <= k < length ==> \old(a[k]) == a[length-1-k]; ensures \forall integer k; 0 <= k < length ==> a[k] == \old(a[length-1-k]); */ void reverse_array (int* a, int length) { int index_a = 0; int index_backwards = length; /*@ loop invariant 0 <= index_a <= index_backwards <= length; loop invariant index_a == length - index_backwards; loop invariant \forall integer k; 0 <= k < index_a ==> \at(a[k],Pre) == a[length-1-k]; loop invariant \forall integer k; 0 <= k < index_a ==> a[k] == \at(a[length-1-k],Pre); */ while ((index_a != index_backwards) && (index_a != index_backwards-1)) { index_backwards--; swap(&a[index_a], &a[index_backwards]); index_a++; } } My problem is the preservation of the rather complex loop invariant. I do not understand what the problem might be and I would appreciate any helpful hint. Cheers Christoph -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.gforge.inria.fr/pipermail/frama-c-discuss/attachments/20090108/28d426a2/attachment.htm

- Prev by Date:
**[Frama-c-discuss] multiple functions, why error** - Next by Date:
**[Frama-c-discuss] axiomatic definition with two indices** - Previous by thread:
**[Frama-c-discuss] multiple functions, why error** - Next by thread:
**[Frama-c-discuss] axiomatic definition with two indices** - Index(es):