source: CIVL/README@ 583119f

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 583119f was 583119f, checked in by Manchun Zheng <zmanchun@…>, 13 years ago

update CIVL readme

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

  • Property mode set to 100644
File size: 13.6 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
32For most users, this will be the easiest way to install and use CIVL.
33
341. Install a Java 7 SDK if you have not already. Go to
35http://www.oracle.com/technetwork/java/javase/downloads/ for the
36latest from Oracle. On linux, you can optionally sudo apt-get install
37openjdk-7-jdk.
38
392. If you already have the VSL dependencies library, you may
40skip this step. Otherwise, download the archive of VSL
41dependencies from http://vsl.cis.udel.edu/tools/vsl_depend,
42choosing the version for your OS type (32-bit linux,
4364-bit linux, or 64-bit OS X). Unzip and untar the
44downloaded .tgz file and you will have a folder named "vsl".
45If you do not already have a directory /opt, create one with
46"mkdir /opt". Move vsl into /opt. Use sudo as needed.
47
483. Download the appropriate CIVL distribution from
49http://vsl.cis.udel.edu/civl.
50
514. Unzip and untar the downloaded file if this does not happen
52automatically. This should result in a folder named
53CIVL-TAG, where TAG is some version id string. This folder
54contains the following:
55
56 - README : this file
57 - bin : containing one executable sh script called "civl"
58 - lib : containing civl-TAG.jar
59 - doc : containing some documentation about CIVL
60 - licenses : licenses for CIVL and included libraries
61 - examples : some example CIVL programs
62
635. Move CIVL-TAG into /opt.
64
656. Put the civl script in your path however you like to put things
66in your path. Either move it to a directory in your path,
67or create a symlink to it, or edit your .profile or equivalent
68to put it in your path.
69
70---------------------------- CIVL help -----------------------------
71In command line, type just "civl help" for the usage information
72as shown below.
73
74CIVL v0.4 of 2013-12-06 -- http://vsl.cis.udel.edu/civl
75Usage: civl <command> <options> filename ...
76Commands:
77 verify : verify program filename
78 run : run program filename
79 help : print this message
80 replay : replay trace for program filename
81 parse : show result of preprocessing and parsing filename
82 preprocess : show result of preprocessing filename
83Options:
84 -debug or -debug=BOOLEAN (default: false)
85 debug mode: print very detailed information
86 -errorBound=INTEGER (default: 1)
87 stop after finding this many errors
88 -guided or -guided=BOOLEAN
89 user guided simulation; applies only to run, ignored
90 for all other commands
91 -id=INTEGER (default: 0)
92 ID number of trace to replay
93 -inputKEY=VALUE
94 initialize input variable KEY to VALUE
95 -maxdepth=INTEGER (default: 2147483647)
96 bound on search depth
97 -min or -min=BOOLEAN (default: false)
98 search for minimal counterexample
99 -por=STRING (default: std)
100 partial order reduction (por) choices:
101 std (standard por) or scp (scoped por)
102 -random or -random=BOOLEAN
103 select enabled transitions randomly; default for run,
104 ignored for all other commands
105 -saveStates or -saveStates=BOOLEAN (default: true)
106 save states during depth-first search
107 -seed=STRING
108 set the random seed; applies only to run
109 -showModel or -showModel=BOOLEAN (default: false)
110 print the model
111 -showProverQueries or -showProverQueries=BOOLEAN (default: false)
112 print theorem prover queries only
113 -showQueries or -showQueries=BOOLEAN (default: false)
114 print all queries
115 -showSavedStates or -showSavedStates=BOOLEAN (default: false)
116 print saved states only
117 -showStates or -showStates=BOOLEAN (default: false)
118 print all states
119 -showTransitions or -showTransitions=BOOLEAN (default: false)
120 print transitions
121 -simplify or -simplify=BOOLEAN (default: true)
122 simplify states?
123 -solve or -solve=BOOLEAN (default: false)
124 try to solve for concrete counterexample
125 -sysIncludePath=STRING
126 set the system include path
127 -trace=STRING
128 filename of trace to replay
129 -userIncludePath=STRING
130 set the user include path
131 -verbose or -verbose=BOOLEAN (default: false)
132 verbose mode
133
134------------------------------- License -------------------------------
135
136CIVL is open source software distributed under the GNU
137General Public License. However, the libraries used by CIVL
138(and incorporated into the complete distribution) use various
139licenses. See directory licenses for the license of each component.
140
141------------------------ Language Summary -----------------------------
142
143Summary of new keywords:
144
145 $proc : the process type
146 $self : the process invoking the statement (constant of type $proc)
147 $input : type qualifier declaring variable to be a program input
148 $output : type qualifier declaring variable to be a program output
149 $spawn : create a new process running procedure
150 $wait : wait for a process to terminate
151 $assert : check something holds
152 $true : boolean value true, used in assertions
153 $false: boolean value false, used in assertions
154 $assume : assume something holds
155 $when : guarded statement
156 $choose : nondeterministic choice statement
157 $invariant : declare a loop invariant
158 $requires : procedure precondition
159 $ensures : procedure postcondition
160 $result : refers to result returned by procedure in contracts
161 @ : refer to variable in other process, e.g., p@x
162 $collective : a collective expression
163
164Other syntactic changes:
165
166 - procedure definitions may occur in any scope
167
168------------------------------------------------------------------------
169
170Detailed description:
171
172$proc : this is a primitive object type and functions like any other
173primitive C type (e.g., int). An object of this type refers
174to process. It can be thought of as a process ID, but it is not
175an integer and cannot be cast to one. Certain expressions take
176an argument of $proc type and some return something of $proc type.
177
178------------------------------------------------------------------------
179
180$self: this is a constant of type $proc. It can be used wherever
181an argument of type $proc is called for. It refers to the process
182that is evaluating the expression containing "$self".
183
184------------------------------------------------------------------------
185
186$input : A variable in the global scope only may be declared with this
187type modifier indicating it is an "input" variable, as in
188
189$input int n;
190
191As explained above, the variable becomes a parameter to the Root
192procedure. This is used when comparing two programs for functional
193equivalence. The two programs are functionally equivalent if,
194whenever they are given the same inputs (i.e., corresponding $input
195variables are initialized with the same values) they will produce the
196same outputs (i.e., corresponding $output variables will end up with
197the same values at termination).
198
199------------------------------------------------------------------------
200
201$output : A variable in the global scope may be declared with
202this type modifier to declare it to be an output variable.
203
204------------------------------------------------------------------------
205
206$spawn : this is an expression with side-effects. It spawns a new
207process and returns a reference to the new process, i.e., an object of
208type $proc. The syntax is the same as a procedure invocation with the
209keyword "$spawn" inserted in front:
210
211$spawn f(expr1, ..., exprn)
212
213Typically the returned value is assigned to a variable, e.g.,
214
215$proc p = $spawn f(i);
216
217If the invoked function f returns a value, that value is simply
218ignored.
219
220------------------------------------------------------------------------
221
222$wait: this is a statement that takes an argument of type $proc
223and blocks until the referenced process terminates:
224
225$wait expr;
226
227------------------------------------------------------------------------
228
229$assert: This is an assertion statement. It takes as its sole
230argument an expression of boolean type. The expressions have a
231richer syntax than C expressions. During verification, the
232assertion is checked. If it does not hold, a violation is reported.
233
234$assert expr;
235
236Boolean values $true and $false may be used in assertions
237and assumptions.
238
239------------------------------------------------------------------------
240
241$assume: This is an assume statement. Its syntax is the same as that
242of $assert. During verification, the assumed expression is assumed to
243hold. If this leads to a contradiction on some execution, that
244execution is simply ignored. It never reports a violation, it only
245restricts the set of possible executions that will be explored by the
246verification.
247
248$assume expr;
249
250------------------------------------------------------------------------
251
252$when (expr) stmt;
253
254A guarded command.
255
256All statements have a guard, either implicit or explicit. For most
257statements, the guard is "true". The $when statement allows one to
258attach an explicit guard to a statement.
259
260 When expr is true, the statement is enabled, otherwise it is
261disabled. A disabled statement is "blocked"---it will not be
262scheduled for execution. When it is enabled, it may execute by moving
263control to the stmt and executing the first atomic action in the stmt.
264
265If stmt itself has a guard, the guard of the $when statement is
266effectively the conjunction of the expr and the guard of the stmt.
267
268The evaluation of expr and the first atomic action of stmt effectively
269occur as a single atomic action. There is no guarantee that execution
270of stmt will continue atomically if it contains more than one atomic
271action, i.e., other processes may be scheduled.
272
273Examples:
274
275$when (s>0) s--;
276
277This will block until s is positive then decrement s. The execution
278of s-- is guaranteed to take place in an environment in which s is
279positive.
280
281$when (s>0) {s--; t++}
282
283The execution of s-- must happen when s>0, but between s-- and t++,
284other processes may execute.
285
286$when (s>0) $when (t>0) x=y*t;
287
288This blocks until both x and t are positive then executes
289the assignment in that state. It is equivalent to
290
291$when (s>0 && t>0) x=y*t;
292
293------------------------------------------------------------------------
294
295A $choose statement has the form
296
297$choose {
298 stmt1;
299 stmt2;
300 ...
301 default: stmt
302}
303
304The "default" clause is optional.
305
306The guards of the statements are evaluated and among those that are
307true, one is chosen nondeterministically and executed. If none are
308true and the default clause is present, it is chosen. The default
309clause will only be selected if all guards are false. If no default
310clause is present and all guards are false, the statement blocks.
311Hence the implicit guard of the $choose statement without a default
312clause is the disjunction of the guards of its sub-statements.
313The implicit guard of the $choose statement with a default clause
314is "true".
315
316Example: this shows how to encode "low-level" CIVL:
317
318l1: $choose {
319 $when (x>0) {x--; goto l2;}
320 $when (x==0) {y=1; goto l3;}
321 default: {z=1; goto l4;}
322}
323l2: $choose {
324 ...
325}
326l3: $choose {
327 ...
328}
329
330------------------------------------------------------------------------
331
332$invariant: indicates a loop invariant. Each C loop construct has an
333optional invariant clause as follows:
334
335while (expr) $invariant (expr) stmt
336
337for (e1; e2; e3) $invariant (expr) stmt
338
339do stmt while (expr) $invariant (expr) ;
340
341The invariant is a claim that if if the expr holds upon entering
342the loop and the loop condition holds, then it will hold
343after completion of execution of the loop body.
344
345The invariant is used by certain verification techniques.
346
347------------------------------------------------------------------------
348
349Procedure contracts: $requires and $ensures. There are optional
350elements that may occur in a procedure declaration or definition:
351
352T f(...)
353 $requires expr;
354 $ensures expr;
355;
356
357or
358
359T f(...)
360 $requires expr ;
361 $ensures expr ;
362 {
363 ...
364 }
365
366The value $result may be used in post-conditions to refer
367to the result returned by a procedure.
368
369------------------------------------------------------------------------
370
371expr@x: remote expressions refer to a variable in another process,
372e.g., procs[i]@x. This special kind of expression is used in
373collective expressions, which are used to formulate collective
374assertions and invariants.
375
376The expr must have $proc type. The variable x must be a statically
377visible variable in the context in which it is occurs. When
378this expression is evaluated, the evaluation context will be shifted
379to the process referred to by the expr.
380
381------------------------------------------------------------------------
382
383$collective(proc_expr, int_expr) expr
384
385This is a collective expression over a set of processes. The
386proc_expr is a pointer to the first element of an array of $proc. The
387int_expr gives the length of that array, i.e., the number of
388processes. expr is a boolean-valued expression; it may use remote
389expressions to refer to variables in the processes specified in the
390array.
391
392example:
393
394$proc procs[N];
395...
396$assert $collective(procs, N) i==procs[(pid+1)%N]@i ;
397
Note: See TracBrowser for help on using the repository browser.