07.01.2013 Views

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Increment<br />

∆Counter<br />

12 Technology of Test-Case Generation 329<br />

((ctr < 3) ∧ (ctr ′ = ctr +1)∧¬(ctr =3))∨<br />

((ctr < 3) ∧ (ctr ′ = ctr +1)∧¬(ctr ′ =0))∨<br />

(¬(ctr < 3) ∧ (ctr =3)∧ (ctr ′ =0))∨<br />

(¬(ctr ′ = ctr +1)∧ (ctr =3)∧ (ctr ′ =0))∨<br />

((ctr < 3) ∧ (ctr ′ = ctr +1)∧ (ctr =3)∧ (ctr ′ =0))<br />

The predicate part <strong>in</strong> this schema can be simplified by remov<strong>in</strong>g unsatisfiable<br />

disjuncts and unnecessary literals. For <strong>in</strong>stance, the f<strong>in</strong>al disjunct is unsatisfiable<br />

because ctr < 3andctr = 3 are contradictory. The rema<strong>in</strong><strong>in</strong>g four disjuncts can<br />

be simplified by remov<strong>in</strong>g redundant literals. For <strong>in</strong>stance, the literal ¬(ctr =3)<br />

<strong>in</strong> the first disjunct can be removed because it is already implied by ctr < 3.<br />

When cont<strong>in</strong>u<strong>in</strong>g these simplifications, we f<strong>in</strong>ally obta<strong>in</strong> the orig<strong>in</strong>al def<strong>in</strong>ition<br />

of the schema Increment <strong>in</strong> Sec. 12.2.1. This is not surpris<strong>in</strong>g because, as mentioned<br />

above, the orig<strong>in</strong>al def<strong>in</strong>ition was already <strong>in</strong> the desired normal form. In<br />

general, however, this need not to be the case. The generation of test cases <strong>in</strong><br />

this approach consists of two steps:<br />

(1) Compute disjunctive normal form with mutually exclusive disjuncts<br />

(2) Remove unsatisfiable disjuncts and simplify the rema<strong>in</strong><strong>in</strong>g test cases<br />

For the computation of the disjunctive normal form, an optimization to avoid<br />

redundancy was used by Helke et al. [HNS97]. In particular, the predicate part P<br />

of each schema is <strong>in</strong>itially transformed <strong>in</strong>to a conjunction of the form P =<br />

R ∧ Q, whereR is a meta-variable consist<strong>in</strong>g of those schema predicates that<br />

do not conta<strong>in</strong> disjunctions (implicitly or explicitly), and Q is a meta-variable<br />

consist<strong>in</strong>g of the rema<strong>in</strong><strong>in</strong>g predicates that conta<strong>in</strong> at least one disjunction. For<br />

<strong>in</strong>stance, P = a ∧ (c ∨ (d ∧ e)) ∧ b can be transformed such that R = a ∧ b<br />

and Q =(c ∨ (d ∧ e)), where a, b, c, d, ande denote atoms. The disjunctive<br />

normal form is then computed for Q while R is ignored. Hence, the result<strong>in</strong>g<br />

representation of the predicate part P consists of a purely conjunctive part R and<br />

an expression Q <strong>in</strong> disjunctive normal form. This avoids that purely conjunctive<br />

predicates appear <strong>in</strong> each disjunct of the disjunctive normal form which would<br />

lead to much redundancy.<br />

The prepar<strong>in</strong>g partition<strong>in</strong>g of the predicate part and the computation of the<br />

disjunctive normal form can be implemented by Isabelle’s proof tactics. To detect<br />

unsatisfiable disjuncts, Isabelle’s conditional rewrite mechanisms are used,<br />

i.e., a special parameterized tactic called simplifier. It allows to def<strong>in</strong>e rewrite<br />

rules which are able to f<strong>in</strong>d contradict<strong>in</strong>g disjuncts and makes it possible to<br />

rewrite them to false. For <strong>in</strong>stance, the f<strong>in</strong>al disjunct <strong>in</strong> the above schema Increment<br />

conta<strong>in</strong>s ctr < 3aswellasctr = 3. An application of rewrit<strong>in</strong>g yields<br />

3 < 3 which is obviously false. Hence, the disjunct is unsatisfiable and can be<br />

removed. A side effect of such rewrit<strong>in</strong>gs to f<strong>in</strong>d contradict<strong>in</strong>g disjuncts is that<br />

redundancy is reduced, i.e., the test cases are simplified. On the other hand, how-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!