source: CIVL/README@ 74ec2ad

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 74ec2ad was c7a0783, checked in by Stephen Siegel <siegel@…>, 13 years ago

Improving release script

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@92 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 11.4 KB
Line 
1 CIVL: The Concurrency Intermediate Verification Language
2
3------------------------------ Overview -------------------------------
4
5CIVL is a framework encompassing...
6
7 * a programming language, CIVL-C, which adds to C a number of
8 concurrency primitives, as well as the ability to define
9 functions in any scope. Together, these features make for
10 a very expressive concurrent language that can faithfully
11 represent programs using various APIs and parallel languages,
12 such as MPI, OpenMP, CUDA, and Chapel. CIVL-C also provides
13 a number of primitives supporting verification.
14 * a model checker> which uses symbolic execution to verify a
15 number of safety properties of CIVL-C programs. The model
16 checker can also be used to verify that two CIVL-C programs
17 are functionally equivalent.
18 * a number of translators from various commonly-used languages
19 and APIs to CIVL-C. (This part is still a work in progress.)
20
21CIVL is developed by the Verified Software Laboratory at the
22University of Delaware Department of Computer Science.
23For more information, visit http://vsl.cis.udel.edu/civl
24
25Developers:
26
27Stephen F. Siegel
28Timothy K. Zirkel
29
30---------------------------- Installation -----------------------------
31
32You must have a Java virtual machine (version 7) installed on your
33system and "java" should be in your path.
34
35Installation for Mac OS X:
36
37The complete distribution for Mac OS X 64-bit Intel
38comes in a folder named CIVL-TAG, where TAG is some version
39id string. This folder contains the following:
40
41 - README : this file
42 - bin : containing one executable sh script called "civl"
43 - lib : containing civl-TAG.jar and native libraries
44 used by CIVL
45 - doc : containing some documentation about CIVL
46 - licenses : licenses for CIVL and included libraries
47 - examples : some example CIVL programs
48
49Installation instructions:
50 1. Move folder CIVL-TAG into the /Applications folder
51 2. Put the civl script in your path however you like to put things
52 into your path. Either move it to a directory in your path,
53 or create a symlink to it, or edit your .profile or equivalent
54 to put it in your path.
55
56Now you should be able to run CIVL from the command line by
57typing "civl <filename>".
58
59Installation for Linux:
60
61Same as above, except the folder goes into /usr/local.
62
63------------------------------- License -------------------------------
64
65CIVL is open source software distributed under the GNU
66General Public License. However, the libraries used by CIVL
67(and incorporated into the complete distribution) use various
68licenses. See directory licenses for the license of each component.
69
70
71The CIVL-C code will not have an explicit "Root" procedure. Instead,
72a Root procedure will be implicitly wrapped around the enitre code.
73The global input variables will become the inputs to the Root
74procedure. A "main" procedure must be delcared that takes
75no parameters but can have any return type. The body of the
76main procedure becomes the body of the Root procedure. The return
77type of the main procedure becomes the return type of the body.
78The main procedure disappears.
79
80------------------------ Language Summary -----------------------------
81
82Summary of new keywords:
83
84 $proc : the process type
85 $self : the process invoking the statement (constant of type $proc)
86 $input : type qualifier declaring variable to be a program input
87 $output : type qualifier declaring variable to be a program output
88 $spawn : create a new process running procedure
89 $wait : wait for a process to terminate
90 $assert : check something holds
91 $true : boolean value true, used in assertions
92 $false: boolean value false, used in assertions
93 $assume : assume something holds
94 $when : guarded statement
95 $choose : nondeterministic choice statement
96 $invariant : declare a loop invariant
97 $requires : procedure precondition
98 $ensures : procedure postcondition
99 $result : refers to result returned by procedure in contracts
100 @ : refer to variable in other process, e.g., p@x
101 $collective : a collective expression
102
103Other syntactic changes:
104
105 - procedure definitions may occur in any scope
106
107------------------------------------------------------------------------
108
109Detailed description:
110
111$proc : this is a primitive object type and functions like any other
112primitive C type (e.g., int). An object of this type refers
113to process. It can be thought of as a process ID, but it is not
114an integer and cannot be cast to one. Certain expressions take
115an argument of $proc type and some return something of $proc type.
116
117------------------------------------------------------------------------
118
119$self: this is a constant of type $proc. It can be used wherever
120an argument of type $proc is called for. It refers to the process
121that is evaluating the expression containing "$self".
122
123------------------------------------------------------------------------
124
125$input : A variable in the global scope only may be declared with this
126type modifier indicating it is an "input" variable, as in
127
128$input int n;
129
130As explained above, the variable becomes a parameter to the Root
131procedure. This is used when comparing two programs for functional
132equivalence. The two programs are functionally equivalent if,
133whenever they are given the same inputs (i.e., corresponding $input
134variables are initialized with the same values) they will produce the
135same outputs (i.e., corresponding $output variables will end up with
136the same values at termination).
137
138------------------------------------------------------------------------
139
140$output : A variable in the global scope may be declared with
141this type modifier to declare it to be an output variable.
142
143------------------------------------------------------------------------
144
145$spawn : this is an expression with side-effects. It spawns a new
146process and returns a reference to the new process, i.e., an object of
147type $proc. The syntax is the same as a procedure invocation with the
148keyword "$spawn" inserted in front:
149
150$spawn f(expr1, ..., exprn)
151
152Typically the returned value is assigned to a variable, e.g.,
153
154$proc p = $spawn f(i);
155
156If the invoked function f returns a value, that value is simply
157ignored.
158
159------------------------------------------------------------------------
160
161$wait: this is a statement that takes an argument of type $proc
162and blocks until the referenced process terminates:
163
164$wait expr;
165
166------------------------------------------------------------------------
167
168$assert: This is an assertion statement. It takes as its sole
169argument an expression of boolean type. The expressions have a
170richer syntax than C expressions. During verification, the
171assertion is checked. If it does not hold, a violation is reported.
172
173$assert expr;
174
175Boolean values $true and $false may be used in assertions
176and assumptions.
177
178------------------------------------------------------------------------
179
180$assume: This is an assume statement. Its syntax is the same as that
181of $assert. During verification, the assumed expression is assumed to
182hold. If this leads to a contradiction on some execution, that
183execution is simply ignored. It never reports a violation, it only
184restricts the set of possible executions that will be explored by the
185verification.
186
187$assume expr;
188
189------------------------------------------------------------------------
190
191$when (expr) stmt;
192
193A guarded command.
194
195All statements have a guard, either implicit or explicit. For most
196statements, the guard is "true". The $when statement allows one to
197attach an explicit guard to a statement.
198
199 When expr is true, the statement is enabled, otherwise it is
200disabled. A disabled statement is "blocked"---it will not be
201scheduled for execution. When it is enabled, it may execute by moving
202control to the stmt and executing the first atomic action in the stmt.
203
204If stmt itself has a guard, the guard of the $when statement is
205effectively the conjunction of the expr and the guard of the stmt.
206
207The evaluation of expr and the first atomic action of stmt effectively
208occur as a single atomic action. There is no guarantee that execution
209of stmt will continue atomically if it contains more than one atomic
210action, i.e., other processes may be scheduled.
211
212Examples:
213
214$when (s>0) s--;
215
216This will block until s is positive then decrement s. The execution
217of s-- is guaranteed to take place in an environment in which s is
218positive.
219
220$when (s>0) {s--; t++}
221
222The execution of s-- must happen when s>0, but between s-- and t++,
223other processes may execute.
224
225$when (s>0) $when (t>0) x=y*t;
226
227This blocks until both x and t are positive then executes
228the assignment in that state. It is equivalent to
229
230$when (s>0 && t>0) x=y*t;
231
232------------------------------------------------------------------------
233
234A $choose statement has the form
235
236$choose {
237 stmt1;
238 stmt2;
239 ...
240 default: stmt
241}
242
243The "default" clause is optional.
244
245The guards of the statements are evaluated and among those that are
246true, one is chosen nondeterministically and executed. If none are
247true and the default clause is present, it is chosen. The default
248clause will only be selected if all guards are false. If no default
249clause is present and all guards are false, the statement blocks.
250Hence the implicit guard of the $choose statement without a default
251clause is the disjunction of the guards of its sub-statements.
252The implicit guard of the $choose statement with a default clause
253is "true".
254
255Example: this shows how to encode "low-level" CIVL:
256
257l1: $choose {
258 $when (x>0) {x--; goto l2;}
259 $when (x==0) {y=1; goto l3;}
260 default: {z=1; goto l4;}
261}
262l2: $choose {
263 ...
264}
265l3: $choose {
266 ...
267}
268
269------------------------------------------------------------------------
270
271$invariant: indicates a loop invariant. Each C loop construct has an
272optional invariant clause as follows:
273
274while (expr) $invariant (expr) stmt
275
276for (e1; e2; e3) $invariant (expr) stmt
277
278do stmt while (expr) $invariant (expr) ;
279
280The invariant is a claim that if if the expr holds upon entering
281the loop and the loop condition holds, then it will hold
282after completion of execution of the loop body.
283
284The invariant is used by certain verification techniques.
285
286------------------------------------------------------------------------
287
288Procedure contracts: $requires and $ensures. There are optional
289elements that may occur in a procedure declaration or definition:
290
291T f(...)
292 $requires expr;
293 $ensures expr;
294;
295
296or
297
298T f(...)
299 $requires expr ;
300 $ensures expr ;
301 {
302 ...
303 }
304
305The value $result may be used in post-conditions to refer
306to the result returned by a procedure.
307
308------------------------------------------------------------------------
309
310expr@x: remote expressions refer to a variable in another process,
311e.g., procs[i]@x. This special kind of expression is used in
312collective expressions, which are used to formulate collective
313assertions and invariants.
314
315The expr must have $proc type. The variable x must be a statically
316visible variable in the context in which it is occurs. When
317this expression is evaluated, the evaluation context will be shifted
318to the process referred to by the expr.
319
320------------------------------------------------------------------------
321
322$collective(proc_expr, int_expr) expr
323
324This is a collective expression over a set of processes. The
325proc_expr is a pointer to the first element of an array of $proc. The
326int_expr gives the length of that array, i.e., the number of
327processes. expr is a boolean-valued expression; it may use remote
328expressions to refer to variables in the processes specified in the
329array.
330
331example:
332
333$proc procs[N];
334...
335$assert $collective(procs, N) i==procs[(pid+1)%N]@i ;
336
Note: See TracBrowser for help on using the repository browser.