--- layout: fc_discuss_archives title: Message 22 from Frama-C-discuss on January 2014 ---
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] [wp] unproved goals for strlen() function



Hello,

2014-01-11 16:14, Wolfram Kahl:
> You cannot expect very much without a loop invariant ---
> the only thing known after the loop right now is probably
>
>    *(s - 1) == '\0'
>
> (I haven't done C in a long time) if I remember correctly that
> the ++ increments after the use in the expression...
>
> Your postcondition probably does not follow from that alone...

Wolfram is perfectly right, Xiao-lei you need to add loop invariant to 
*establish* the property you want to prove, i.e. the body of axiom 
strlen(s).

Please find attached an UNFINISHED version of such kind of loop 
invariants. You'll notice that several things are still unproved. More 
home work for you. ;-)

Best regards,
david

-------------- next part --------------
A non-text attachment was scrubbed...
Name: str_len.c
Type: text/x-csrc
Size: 842 bytes
Desc: not available
URL: <http://lists.gforge.inria.fr/pipermail/frama-c-discuss/attachments/20140111/ce54919e/attachment.c>