Logo BCDDLogo CSC
BCDDBehavioural Contract-Driven Design
version 1.0-beta
ITEN

Chapter 24 — The meaning of “verified”

With the formulas of chapters 21-23 the staircase light CSC contains guarantees of two degrees: verbal and formal. This chapter describes the two moments of verification, the outcomes that each degree can have, the rules by which those outcomes are reported and the part of verification that bcdd executes.

The two moments of verification

The verification of a CSC takes place in two moments:

  1. text verification examines the CSC before the system is built;
  2. recording verification examines the recordings of a built system. A recording is a trace, that is a sequence of steps, observed at the boundaries of a built system.

The two verifications answer different questions. The first establishes whether the description is correctly formulated and whether it is possible to satisfy it; the second, whether a built system has satisfied it in the situations observed.

Text verification

Text verification comprises the following checks:

Check What is checked
form names and types are consistent, every guarantee has a name, every detail makes an existing line precise
consistency there exists at least one trace that satisfies all the assumptions and all the guarantees together
scenarios every scenario is admitted or rejected by the guarantees, as its EXPECT line declares
coverage for every guarantee with a trigger there exists an admitted scenario in which the trigger holds
every used boundary is offered in an entity with parts, every boundary used by a part is provided by another part or is an external boundary
entity guarantees the guarantees of the entity are compatible with those of the parts and of the boundaries
details every detail is compatible with the line it makes precise

The trigger of a guarantee written with WHENEVER is its first condition (chapter 21). For the other forms:

Coverage thus reports the guarantees that are satisfied only because their trigger does not arise in any scenario.

On formal lines these checks can be executed by a program. In the staircase light CSC a program could establish that scenario s2 violates g2a and is therefore rejected, as its EXPECT line declares: this is a check that in chapter 9 was left to the writer. On verbal lines consistency, scenarios and details remain entrusted to the judgement of a person.

Consistency does not guarantee that the system can be built: it indicates only that there exists a trace that satisfies the CSC. The specification does not provide a check of realisability, that is of the existence of a system that satisfies the guarantees whatever the behaviour of the other side.

The checks executed by bcdd

bcdd executes two checks of the table: form, including the names and types of formulas, and the rule every used boundary is offered (chapters 13, 19 and 20). The other checks are not executed, and the report shows this. Section 15 lists the lines to which the checks of scenarios, coverage, consistency and formal details would apply. Section 14 lists the details whose consistency is judged because one of the two lines is in words. Entity guarantees remain entrusted to judgement (chapter 12). On version 0.3 of the light:

$ bcdd check --strict UsoLuce.csc
bcdd check --strict UsoLuce.csc
lines: 65 (recognised 55, comments 5, blank 5, unrecognised 0)
blocks: 1
  line 4: CSC UsoLuce VERSION 0.3, STATUS HYPOTHESIS

1. ERRORS: 0
…
14. TO BE JUDGED: 5
  line 22: GUARANTEE g2b DETAILS g2: consistency between the line and the line that details it, one of the two in words
  line 26: GUARANTEE g3a DETAILS g3: consistency between the line and the line that details it, one of the two in words
  line 29: GUARANTEE g4a DETAILS g4: consistency between the line and the line that details it, one of the two in words
  line 30: GUARANTEE g4b DETAILS g4: consistency between the line and the line that details it, one of the two in words
  line 37: GUARANTEE g7a DETAILS g7: consistency between the line and the line that details it, one of the two in words

15. CHECKS NOT EXECUTED: 4
  scenarios: lines 49, 54, 57, 59, 62
  coverage of the triggers: lines 17, 19, 21, 26, 29, 30, 37, 38, 39, 40
  consistency of assumptions and guarantees: lines 17, 19, 21, 26, 29, 30, 37, 38, 39, 40
  consistency of the details: line 21

outcome: no errors

The outcome no errors concerns form: ten lines are formal, and for each of them section 15 reports what has not been checked. An outcome is never worth more than what has actually been checked.

Check In bcdd
form executed: errors in section 1
every used boundary is offered executed: errors E14, E16, E17
scenarios not executed: entry scenarios of section 15
coverage not executed: entry coverage of the triggers of section 15
consistency not executed: entry consistency of assumptions and guarantees of section 15
details formal: entry consistency of the details of section 15; with a line in words: section 14
entity guarantees by judgement

The outcomes on recordings

On recordings every guarantee receives an outcome. The possible outcomes depend on the degree:

Degree Outcomes
formal satisfied on the trace, violated (with the step), inconclusive, assumption not satisfied, not executed
verbal conforming by judgement, non-conforming by judgement, not assessed; each with who judged and on what

The formal outcomes have this meaning:

The verbal outcomes record a judgement: who judged, on what, and with what conclusion. A verbal guarantee that nobody has yet judged is not assessed.

No program described in this manual executes recording verification: the outcomes of this section are those established by the specification.

“Satisfied on the trace” applies to what has been observed

A recording of the light, written as a scenario, is the following:

    @0 s     premuto    modo = accesa
    @40 s    premuto    modo = accesa
    @125 s   avviso
    @130 s   modo = spenta

On this trace the formulas of the staircase light CSC have the following outcomes:

Guarantee Outcome Reason
g1 satisfied on the trace after each of the two presses the mode is accesa
g2 satisfied on the trace after switching on, the light switches off, at instant 130
g2a satisfied on the trace at the switch-off 90 seconds have elapsed since the last press
g3a satisfied on the trace before the switch-off there is a warning, and after the warning nobody has pressed
g4a satisfied on the trace in the trace there is no cleaning request
g4b satisfied on the trace in the trace there is no cleaning request
g7a satisfied on the trace in the trace there is no press during cleaning
g8 satisfied on the trace with the light off no warning arrives
g9 satisfied on the trace the light comes on only after a press
g10 satisfied on the trace the mode changes twice: at instant 0 with a press, at instant 130 at 90 seconds from the last press

In version 0.3 these lines are pending approval, and their outcome is reported as described in the special case “A guarantee pending approval”.

g4a, g4b and g7a are satisfied on the trace because their trigger never holds: the trace provides no information about how the light responds to a cleaning request or to a press during cleaning. “Satisfied on the trace” applies only to the recorded trace and to the resolution with which it was recorded (chapter 26): it does not imply anything about situations that have not been observed.

On a recording that ends at instant 60, with the light still on, g2 is inconclusive: the switch-off has not happened by the end of the recording, and nothing allows it to be established whether it would have happened. The outcome indicates the switch-on step left without a response. On a recording with a single press at instant 0 and the switch-off at instant 60, g2a is violated in step @60 s.

The judgement of a person and the result of a program

The report of a recording verification shows the outcomes by degree, in separate sections: one for formal guarantees, one for verbal ones and, for guarantees written with an extension, one for the degree declared extension (chapter 27). Lines pending approval appear in a separate section, as in section 4 of the report of bcdd check: their outcome is not an outcome of the contract.

An outcome given by judgement is never added to an outcome given by a program. Consider an approved version of the staircase light CSC, in which the ten formulas are satisfied on the trace and a person with a stopwatch judges the verbal guarantee g3 conforming by judgement. The report shows ten formal guarantees satisfied on the trace and one verbal guarantee conforming by judgement, in two distinct sections; it does not show eleven satisfied guarantees. The two results have a different value: the first derives from applying the formula to every step of the trace, the second from the observation and assessment of a person.

The assumption not satisfied

A guarantee holds as long as the other side satisfies the assumptions on which it depends (chapter 3). If a recording shows that a formal assumption has not been satisfied, the verification reports it with the outcome assumption not satisfied, and not as a violated guarantee: the guarantee holds only if the assumption is satisfied.

The assumption a1 of the light, “whoever presses the button holds it down for at least a tenth of a second”, is verbal: no program can establish whether it has been satisfied. A person establishes it, and their judgement appears in the verbal section, distinct from the outcome of g1. The outcome of g1 remains the one calculated by the program, because a judgement never changes a formal outcome. If a1 is judged not satisfied, the section of formal guarantees contains a note that lists the verbal assumptions judged not satisfied and who judged them: in this way the note reports that an outcome such as “violated” may depend on whoever pressed the button and not on the light. Since a guarantee does not declare on which assumptions it depends, the note applies to all the formal guarantees of the CSC.

The specification does not yet establish what remains guaranteed after an assumption has not been satisfied, nor whether this concerns all guarantees or only those that depend on that assumption.

Summary

Special cases

A formula with an undecided number. With the constant ANTICIPO_AVVISO := UNDECIDED and the detail g3a DETAILS g3: ALWAYS ((PREV(modo) = accesa AND modo = spenta) IMPLIES (COUNT(avviso) > 0 AND COUNT(premuto SINCE avviso) = 0 AND TIME SINCE avviso <= ANTICIPO_AVVISO)) the guarantee cannot be verified, either on the text or on the recordings, until the number is decided. bcdd lists the undecided number, but does not indicate which formulas use it; the line remains formal, and the undecided value is used without a type check:

1. ERRORS: 0

2. DEGREE OF THE CONTRACTUAL LINES
…
  line 27: GUARANTEE g3a formal
…

3. UNDECIDED: 1
  line 14: ANTICIPO_AVVISO

A guarantee that the recording instrument does not observe. If the recording instrument detects the press and the state of the light but not the warning, g8 is not executed: the outcome indicates neither satisfaction nor violation. Chapter 26 describes how to declare what each instrument observes.

A scenario declared rejected but admitted. In chapter 9 a scenario declared rejected, but admitted by the guarantees, could not be detected, because the guarantees were in words. With g2a written as a formula, in a scenario like s2 but with the switch-off at @90 s the scenario check can establish that the scenario is admitted and that the declaration EXPECT REJECTED is wrong. bcdd check does not execute this check: the scenario appears in the entry scenarios of section 15.

A guarantee pending approval. The outcome of a guarantee with STATUS HYPOTHESIS is reported in the section of lines pending approval: a violation indicates that the guarantee, as written, does not describe the recorded system, and not that the system fails to satisfy a contract.