• Aucun résultat trouvé

Use Alt-Ergo on the generated verification conditions

N/A
N/A
Protected

Academic year: 2022

Partager "Use Alt-Ergo on the generated verification conditions"

Copied!
1
0
0

Texte intégral

(1)

Master Parisien de Recherche en Informatique 2010–2011 Proof Assistants

TD/TP 8 – Verifying Imperative Programs 2011-02-15

The goal is to verify some C functions from a string-manipulation library by using Frama-C + Jessie + Why for computing weakest preconditions and Alt-Ergo for checking them. The tools can be run withframa-c -jessie file.c.

Complete the specification of these functions. Use Alt-Ergo on the generated verification conditions. Fix the implementation of the functions if needed. Add some other functions and their specification.

/* @

a x i o m a t i c s t r i n g {

l o g i c i n t e g e r s t r l e n _ { L }( c h a r * src );

a x i o m s t r l e n _ i n s i d e { L }:

\ f o r a l l c h a r * src ; \ f o r a l l i n t e g e r x ; 0 <= x < s t r l e n _ ( src ) == > src [ x ] != 0;

a x i o m s t r l e n _ e n d { L }:

\ f o r a l l c h a r * src ; src [ s t r l e n _ ( src )] == 0;

}

*/

/* @

r e q u i r e s \ v a l i d _ r a n g e ( src , 0 , s t r l e n _ ( src ));

e n s u r e s \ r e s u l t == s t r l e n _ ( src );

*/

int s t r l e n (c h a r * src ) {

int res = 0;

/* @ l o o p i n v a r i a n t 0 <= res && res <= s t r l e n _ ( src );

l o o p v a r i a n t s t r l e n _ ( src ) - res ; */

for (; src [ res ]; ++ res );

r e t u r n res ; }

v o i d s t r c a t (c h a r * dst , c o n s t c h a r * src ) {

dst += s t r l e n ( dst );

for (; * src ; ++ src , ++ dst ) * dst = * src ;

* dst = 0;

}

Remarks:

• C strings are usually represented by a pointer to their first character, and they extend till character0inclusive.

• The \valid_range(p, i, j) predicate states that pointer p is inside an allocated memory block big enough for all the pointersp+i . . . p+j to be valid.

• Typeintegeris the type of unbounded integers (Z) while typeintis the type of machine integers; they can overflow.

1

Références

Documents relatifs

Results: Genes encoding the carbapenemase NDM-1 and the ESBL VEB-6 were located in a 38.5 kb MDR structure, which itself was inserted into a new variant of the Proteus genomic island

The proof obligations sent to Alt-Ergo are extracted from Atelier B as logical formulas that are combined with a (polymorphic) model of B’s set theory [8].. This process relies on

the elementary k.p theory to be an introduction to Chuang‘s derivation of the Wurtzite Hamiltonian using Luttinger-Kohn model and showed the its similarity with the one obtained

Cette confrontation montre qu'il existe de nombreuses analogies entre le domaine de la Manche et la région de la baie d'Audierne, Il existe en effet une

Since the translation between RTL and gate-level descriptions can be done automatically and efficiently, the gate-level description is today mainly an intermediate representation

Unite´ de recherche INRIA Rennes, Irisa, Campus universitaire de Beaulieu, 35042 RENNES Cedex Unite´ de recherche INRIA Rhoˆne-Alpes, 46 avenue Fe´lix Viallet, 38031 GRENOBLE Cedex

L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des

step response of a zero-phase filter (Butterworth order 8 applied using filtfilt), cutoff as indicated in legend. B: response to a pulse of a Butterworth order 8 filter, cutoff