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] Jessie - loop invariant preserved
- Subject: [Frama-c-discuss] Jessie - loop invariant preserved
- From: guillaume.melquiond at inria.fr (Guillaume Melquiond)
- Date: Fri, 08 Feb 2013 20:02:08 +0100
- In-reply-to: <CAEtoXR0gAmzcL4GFrndQX2iwP5koNDy3cK_JdWP15Ze7wBcHWw@mail.gmail.com>
- References: <CAEtoXR0gAmzcL4GFrndQX2iwP5koNDy3cK_JdWP15Ze7wBcHWw@mail.gmail.com>
Le vendredi 08 f?vrier 2013 ? 16:35 -0200, Rovedy Aparecida Busquim e Silva a ?crit : > 1) Is my pos-condition written correctly? It seems fine, as far as I can tell. > 2) In this function, there is only a loop. So, the pos-condition is > equal to loop invariant, is this right? No, and that is where your main issue lies. Your loop invariant is just plain wrong. A loop invariant has to hold at the start of each iteration and at the end of the loop. Yours is true only at the end. A better invariant (untested) would be \forall integer j; 0<=j<i ==> G_E[j].G_Inst_Ativ <= Tempo ==> G_E[j].G_Ativo == 1; Notice how occurrences of i were replaced by j and how 0<=i<5 became 0<=j<i. Best regards, Guillaume
- Follow-Ups:
- [Frama-c-discuss] Jessie - loop invariant preserved
- From: rovedy at ig.com.br (Rovedy Aparecida Busquim e Silva)
- [Frama-c-discuss] Jessie - loop invariant preserved
- References:
- [Frama-c-discuss] Jessie - loop invariant preserved
- From: rovedy at ig.com.br (Rovedy Aparecida Busquim e Silva)
- [Frama-c-discuss] Jessie - loop invariant preserved
- Prev by Date: [Frama-c-discuss] Jessie - loop invariant preserved
- Next by Date: [Frama-c-discuss] Jessie - loop invariant preserved
- Previous by thread: [Frama-c-discuss] Jessie - loop invariant preserved
- Next by thread: [Frama-c-discuss] Jessie - loop invariant preserved
- Index(es):