Changes between Version 12 and Version 13 of Introduction


Ignore:
Timestamp:
12/29/18 20:41:10 (7 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Introduction

    v12 v13  
    425425
    426426
    427 === Verifying C Programs ===
    428 
     427=== Verifying Sequential C Programs ===
     428
     429
     430{{{
     431#include <assert.h>
     432#include <stdio.h>
     433#ifdef _CIVL
     434#include <civlc.cvh>
     435$input int B=5, N;
     436$assume(1<=N && N<=B);
     437#else
     438#define N 100
     439#endif
     440int sum=0;
     441int main() {
     442  for (int i = 1; i <= N; i++) sum += i;
     443  printf("N=%d, sum = %d\n", N, sum);
     444  assert(sum == (N+1)*N/2);
     445}
     446}}}
     447
     448{{{
     449$ cc -o sum sum.c
     450$ ./sum
     451N=100, sum = 5050
     452$
     453}}}
     454
     455{{{
     456$ civl verify sum.c
     457CIVL v1.18+ of 2018-12-28 -- http://vsl.cis.udel.edu/civl
     458N=5, sum = 15
     459N=4, sum = 10
     460N=3, sum = 6
     461N=2, sum = 3
     462N=1, sum = 1
     463
     464=== Source files ===
     465sum.c  (sum.c)
     466
     467
     468=== Command ===
     469civl verify sum.c
     470
     471=== Stats ===
     472   time (s)            : 2.26
     473   memory (bytes)      : 163053568
     474   max process count   : 1
     475   states              : 51
     476   states saved        : 31
     477   state matches       : 0
     478   transitions         : 50
     479   trace steps         : 16
     480   valid calls         : 54
     481   provers             : cvc4, z3
     482   prover calls        : 13
     483
     484=== Result ===
     485The standard properties hold for all executions.
     486$
     487}}}
    429488
    430489