SLIDE 13 Statements and Branches by Example
– 16 – 2017-07-09 – Scover –
25/62
- Definition. Software is a finite description S of a (possibly infinite) set S of (finite or infinite) compu-
tation paths of the form σ0
α1
− − → σ1
α2
− − → σ2 · · · where
- σi ∈ Σ, i ∈ N0, is called state (or configuration), and
- αi ∈ A, i ∈ N0, is called action (or event).
- In the following, we assume that
- S has a control flow graph (V, E)S, and statements StmS ⊆ V and branches CndS ⊆ E,
- each computation path prefix σ0
α1
− − → σ1
α2
− − → σ2 · · ·
αn
− − → σn gives information on statements and control flow graph branch edges which were executed right before obtaining σn: stm : (Σ × A)∗ → 2StmS , cnd : (Σ × A)∗ → 2CndS ,
1: int f( int x, int y, int z ) 2: { 3: i1: if (x > 100 ∧ y > 10) 4: s1:
z = z ∗ 2;
5:
else
6: s2:
z = z/2;
7: i2: if (x > 500 ∨ y > 50) 8: s3:
z = z ∗ 5;
9: s4: return z; 10:}
Stmf = {s1, s2, s3, s4} Cndf = {e1, e2, e3, e4}
i1 s1 s2 i2 s3 s4
true e1 false e2 true e3 false e4
Statements and Branches by Example
– 16 – 2017-07-09 – Scover –
25/62
- In the following, we assume that
- S has a control flow graph (V, E)S, and statements StmS ⊆ V and branches CndS ⊆ E,
- each computation path prefix σ0
α1
− − → σ1
α2
− − → σ2 · · ·
αn
− − → σn gives information on statements and control flow graph branch edges which were executed right before obtaining σn: stm : (Σ × A)∗ → 2StmS , cnd : (Σ × A)∗ → 2CndS ,
1: int f( int x, int y, int z ) 2: { 3: i1: if (x > 100 ∧ y > 10) 4: s1:
z = z ∗ 2 ;
5:
else
6: s2:
z = z/2;
7: i2: if ( x > 500 ∨ y > 50) 8: s3:
z = z ∗ 5 ;
9: s4: return z ; 10:}
Stmf = {s1, s2, s3, s4} Cndf = {e1, e2, e3, e4}
i1 s1 s2 i2 s3 s4
true e1 false e2 true e3 false e4
σ0
α1
− − → σ1
α2
− − → σ2
α2
− − → σ3
α3
− − → σ4
α4
− − → σ5
α5
− − → σ6
pc : 1 x : 501 y : 11 z : pc : 3 x : 501 y : 11 z : pc : 4 x : 501 y : 11 z : pc : 7 x : 501 y : 11 z : pc : 8 x : 501 y : 11 z : pc : 9 x : 501 y : 11 z : pc : 10 x : 501 y : 11 z :
stm: {} {} {} {s1} {} {s3} {s4} cnd: {} {} {e1} {} {e3} {} {}