Changes between Version 19 and Version 20 of C Interface


Ignore:
Timestamp:
09/15/10 10:47:11 (16 years ago)
Author:
Stephen Siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • C Interface

    v19 v20  
    2121
    2222{{{
    23 #pragma TASS assume N>0
     23#pragma TASS input {N>0} int
     24#define N 25
    2425}}}
     26
     27(Note: the "25" will be ignored by TASS.)
    2528
    2629== Non-deterministic select statement ==
     
    3538
    3639{{{
    37 #pragma TASS assert forall {int i | i>=0 && i<N} a[i]>=0
     40#pragma TASS assert NAME forall {int i | i>=0 && i<N} a[i]>=0;
    3841}}}
    39 
    40 
    41 == Loop (joint) invariants ==
    42 
    43 Question: how are these expressed in the source code?
    44 
    45 Answer:  These are also expressed as pragmas:
    46 {{{
    47 #pragma TASS jointinvariant skew(2:1) i == spec.j && k == spec.s + 1
    48 }}}
    49 or something like that.
    5042
    5143== Library calls ==
     
    10496    int more = fscanf(fp, "%lf", &tmp);
    10597
    106     #pragma TASS assume tmp>=0.0
     98    #pragma TASS assume tmp>=0.0;
    10799    if (more == EOF) break;
    108100    i++;
     
    127119Question: what are all the pragmas we will need, and what will be there exact syntax and semantics:
    128120
    129 Answer: Here is a proposed list:
     121Here is the general pragma grammar for assertion/invariants:
    130122
    131  * `#pragma TASS assert <TASS expression>`
    132    * verify that the expression is true; report an error if it is not
    133  * {{{#pragma TASS assume <TASS expression>}}}
     123{{{
     124#pragma TASS [collective|joint]? [assert|invariant] IDENT <expression> [skew <expression>]? ;
     125}}}
     126
     127 
     128Other pragmas:
     129 * `#pragma TASS assume <TASS expression>`
    134130   * assume the expression is true, i.e., add the value of this expression to the current path condition
    135  * {{{#pragma TASS invariant <TASS expression>}}}
    136    * this is an (ordinary) loop invariant.   Check that it really is an invariant, and use that fact to compute the state after the loop exit
    137  * {{{#pragma TASS jointinvariant <TASS expression>}}}
    138    * this is a joint loop invariant relating this loop to a loop in the specification program.   Use to check functional equivalence.
    139  * {{{#pragma TASS ignore}}}
     131 * `#pragma TASS ignore`
    140132   * ignore the next statement (typically used for I/O statements that are not relevant)
    141  * {{{#pragma TASS input <type> <variable>}}}
    142    * treat the next element as an input variable.   Could be a preprocessor directory defining an object-type macro.
     133 * `#pragma TASS input ['{' assumption-expression '}']? <type> <variable>?`
     134   * treat the next element as an input variable.   Could be a preprocessor directory defining an object-type macro.  If preceding a preprocessor object macro, leave out the variable.  The assumption expression is optional and can be used to add an assumption to the initial state.
    143135 * `#pragma TASS system`
    144136   * declares the following function to be "system-level"
    145137 * `#pragma TASS abstract`
    146138   * declares the following function to be abstract (a pure mathematical side-effect free function, like sin(x))
    147 
    148 To combine an input with assumption:
    149 {{{
    150 #pragma TASS input { N>0 && N*N<M }
    151 int N;
    152 }}}
    153139
    154140Grammar of TASS expressions:
     
    158144 * {{{forall {<type> <ident> | expr} expr}}}
    159145 * ditto with {{{exists}}} in place of {{{forall}}}
     146 * `PROC[expr].IDENT`
     147    * reference to a process-global variable in another process (with pid obtained by evaluating expr)
     148 * `PROC[expr]@f.IDENT`
     149    * like above, but referring to a local variable in function f in the other process
    160150
    161151