Changes between Version 15 and Version 16 of Fundamentals


Ignore:
Timestamp:
05/14/23 10:26:02 (3 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Fundamentals

    v15 v16  
    5959== Qualifiers
    6060
    61 * `$input`
    62 * `$output`
    63 * `$abstract`
    64 * `$atomic_f`
    65 * `$system`
    66 * `$pure`
     61=== The `$input` and  `$output` type qualifiers
     62
     63The declaration of a variable in the root scope may include the type qualifier `$input`, e.g.,
     64{{{
     65$input int N;
     66}}}
     67This declares the variable to be an input variable, i.e., one which is considered to be an input to the program.
     68Such a variable is initialized with an arbitrary (unconstrained) value of its type.
     69When using symbolic execution to verify a program, such a variable will be assigned a unique symbolic constant of its type.
     70In contrast, variables in the root scope which are not input variables will instead be initialized with the “undefined” value.
     71Reading an undefined value is erroneous. [Note: the model checker attempts to catch such errors but currently
     72does not do so for arrays, which are always initialized with unconstrained values.]
     73In addition, input variables may only be read, never written to; an attempt to write to an input variable is also flagged as an error.
     74
     75Alternatively, it is possible to specify a particular concrete value for an input variable, either on the command line, e.g.,
     76{{{
     77civl verify -inputN=8 ...
     78}}}
     79or by including an initializer in the declaration, e.g.
     80{{{
     81$input int N=8;
     82}}}
     83The protocol for initializing an input variable is the following: if a command line value is specified, it is used.
     84Otherwise, if an initializer is present, it is used.   Otherwise, the variable is assigned an arbitrary value of its type.
     85
     86A variable in the root scope may be declared with `$output` to declare it to be an output variable.
     87Output variables may only be written to, never read.
     88They are used primarily in functional equivalence checking.
     89
     90Input and output variables play a key role when determining whether two programs are functionally equivalent.
     91Two programs are considered functionally equivalent if, whenever they are given the same inputs (i.e., corresponding $input
     92variables are initialized with the same values) they will produce the same outputs (i.e., corresponding $output variables will
     93end up with the same values at termination).
     94
     95=== `$abstract`
     96
     97=== `$atomic_f`
     98
     99=== `$system`
     100
     101=== `$pure`
    67102
    68103== Types