Changes between Version 32 and Version 33 of Language


Ignore:
Timestamp:
05/20/23 11:11:30 (3 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Language

    v32 v33  
    33[[PageOutline(2-3)]]
    44
    5 == Types
    6 
    7 === The Boolean type
     5== Types #sec:types
     6
     7=== The Boolean type #boolean-type
    88
    99The boolean type is denoted `_Bool`, as in C. Its values are 0 and 1, which are also denoted by `$false` and `$true`, respectively.
     
    1111`bool` to be an alias for `_Bool`.
    1212
    13 === The integer type
     13=== The integer type #int-types
    1414
    1515There is one integer type, corresponding to the mathematical integers.
     
    1717[This is expected to change.]
    1818
    19 === The real type
     19=== The real type #real-types
    2020
    2121There is one real type, corresponding to the mathematical real numbers. Currently, all of the C real types `double`, `float`, etc., are mapped to the CIVL real type. [This is expected to change.]
    2222
    23 === The process type `$proc`
     23=== The process type `$proc` #proc-type
    2424
    2525This is a primitive object type and functions like any other primitive C type (e.g., `int`). An object of this type refers to a process. It can be thought of as a process ID, but it is not an integer and cannot be cast to one.  Certain expressions take an argument of `$proc` type and some return something of `$proc` type. The operators `==` and `!=` may be used with two arguments of type `$proc` to determine whether the two arguments refer to the same process.  The constant `$self` has `$proc` type and refers to the process evaluating this expression;  constant `$proc_null` has `$proc` type and refers to no process.
    2626
    27 === The scope type `$scope`
     27=== The scope type `$scope` #scope-type
    2828
    2929An object of this type is a reference to a dynamic scope.
     
    3434Two different variables of type `$scope` may be aliased, i.e., they may refer to the same dynamic scope.
    3535
    36 === Domain types: `$domain` and `$domain(n)`
     36=== Domain types: `$domain` and `$domain(n)` #domain-type
    3737
    3838A domain type is used to represent a set of tuples of integer values.
     
    4545Certain statements use domains, such as the “CIVL-for” loop `$for`.
    4646
    47 === The range type `$range`
     47=== The range type `$range` #range-type
    4848
    4949An object of this type represents an ordered set of integers.
     
    5151They can also be used in quantified expressions to specify the domain of a bound variable (see `$forall` and `$exists`).
    5252
    53 == Type qualifiers
    54 
    55 === Declaring input and output variables: `$input` and  `$output`
     53== Type qualifiers #qualifiers
     54
     55=== Declaring input and output variables: `$input` and  `$output` #input-output
    5656
    5757The declaration of a variable in the root scope may include the type qualifier `$input`, e.g.,
     
    8787end up with the same values at termination).
    8888
    89 ===  Abstract (uninterpreted) functions: `$abstract`
     89===  Abstract (uninterpreted) functions: `$abstract` #abstract
    9090
    9191An abstract function declares a function without a body.  An abstract function is declared using a standard function prototype with the function qualifier `$abstract`, e.g.,
     
    9595An abstract function must have a non-void return type and take at least one parameter.   An invocation of an abstract function is an expression and can be used anywhere an expression is allowed.  The interpretation is an "uninterpreted function".    A unique symbolic constant of function type will be created, corresponding to the abstract function, and invocations are represented as applications of the uninterpreted function to the arguments. 
    9696
    97 === Atomic functions: `$atomic_f`
     97=== Atomic functions: `$atomic_f` #atomic_f
    9898
    9999A function is declared atomic using the function qualifier `$atomic_f`, e.g.,
     
    107107An atomic function must have a definition; in particular, neither a system function nor an abstract function may be declared using `$atomic_f`.
    108108
    109 === System functions: `$system`
     109=== System functions: `$system` #system
    110110
    111111A system function is one in which the definition of the function is not provided in CIVL-C code, but is implemented instead in a certain Java class.  A system function is declared by adding the function qualifier `$system` to a function prototype.  Invocation of a system function always takes place in a single atomic step.
     
    113113A system function may have a guard, which is specified in the function contract using a `$executes_when` clause.  Unless constrained by its contract or other qualifiers, a system function may modify the stay in an arbitrary way.
    114114
    115 === Pure functions: `$pure`
     115=== Pure functions: `$pure` #pure
    116116
    117117A system or atomic function may be declared to be `$pure`, e.g.,
     
    124124This means that the function is a mathematical function of its arguments only.    I.e., an invocation of the function has no side-effects and the return value depends on the arguments only (if called twice with the same arguments, it will return the same value, regardless of any differences in the state).   The user is responsible for ensuring that a function declared pure actually is pure.    If this is not the case, the model checker may produce incorrect results.
    125125
    126 == Expressions
    127 
    128 === Boolean expressions, `=>`, `$forall`, `$exists`
     126== Expressions #expressions
     127
     128=== Boolean expressions, `=>`, `$forall`, `$exists` #boolean-expressions
    129129
    130130CIVL-C provides the boolean constants`$true` and `$false`, which are simply defined as 1 and 0, respectively.
     
    170170}}}
    171171
    172 === Domain literals
     172=== Domain literals #domain-literals
    173173
    174174An expression of the form
     
    187187}}}
    188188
    189 === This scope: the `$here` scope expression
     189=== This scope: the `$here` scope expression #here
    190190Expression of type `$scope`, evaluating to the dynamic scope in which the evaluation takes place.
    191191
    192 === The null process reference: `$proc_null`
     192=== The null process reference: `$proc_null` #proc_null
    193193The null process constant.  Similar to the NULL pointer, this gives an object of `$proc` type a defined value, and can be used in `==` and `!=` expressions.
    194194It cannot be used as the argument to `$wait` or `$waitall`.
    195195
    196 === The root scope constant: `$root`
     196=== The root scope constant: `$root` #root
    197197Constant of type `$scope`, the root dynamic scope.
    198198
    199 === Range literals: `lo .. hi`
     199=== Range literals: `lo .. hi` #range-literals
    200200
    201201An expression of the form `lo .. hi` where `lo` and `hi` are integer expressions, represents the range consisting of the integers `lo`, `lo` + 1, ..., `hi` (in that order).
     
    206206Precisely, the infinite sequence is intersected with the set of integers greater than or equal to `lo`.
    207207
    208 === The scope of an expression: `$scopeof`
     208=== The scope of an expression: `$scopeof` #scopeof
    209209
    210210Given any left-hand-side expression ''expr'', the expression `$scopeof(`''expr''`)` evaluates to the dynamic scope containing the object specified by ''expr''.
     
    230230}}}
    231231
    232 === Scope relational expressions
     232=== Scope relational expressions #scope-expressions
    233233
    234234Let `s1` and `s2` be expressions of type `$scope`. The following are all CIVL-C expressions of boolean type:
     
    243243Each of these expressions is erroneous if `s1` or `s2` is undefined.  This error is reported by the model checker.
    244244
    245 === This process: `$self`
     245=== This process: `$self` #self
    246246
    247247This expression of `$proc` type returns a reference to the process which is evaluating this expression.
    248248It provides a way for code to obtain the identity of the process executing the code.
    249249
    250 === Spawning a new process: `$spawn`
     250=== Spawning a new process: `$spawn` #spawn
    251251
    252252A spawn expression is an expression with side-effects.
     
    262262If the function `f` returns a value, that value is simply ignored.
    263263
    264 == Statements
    265 
    266 === Atomic blocks: `$atomic`
     264== Statements #statements
     265
     266=== Atomic blocks: `$atomic` #atomic
    267267
    268268An ''atomic block'' is a statement of the form
     
    303303so that when the lock is re-obtained, the original multiplicity is still in place.
    304304
    305 === Nondeterministic selection statement `$choose`
     305=== Nondeterministic selection statement `$choose` #choose
    306306
    307307A `$choose` statement has the form
     
    341341}}}
    342342
    343 === Domain iteration statement: `$for`
     343=== Domain iteration statement: `$for` #for
    344344
    345345A domain statement has the form
     
    364364There is a also a parallel version of this construct, `$parfor`.
    365365
    366 === Parallel for loop: `$parfor`
     366=== Parallel for loop: `$parfor` #parfor
    367367
    368368A parallel for loop statement has the form
     
    379379In particular, there is an effective barrier at the end of the loop, and all the spawned processes disappear after this point.
    380380
    381 === Guarded commands: `$when`
     381=== Guarded commands: `$when` #when
    382382
    383383A guarded command is encoded in CIVL-C using a `$when` statement:
     
    438438
    439439
    440 == Functions
    441 
    442 === Assertions: `$assert`
     440== Functions #functions
     441
     442=== Assertions: `$assert` #assert
    443443
    444444The system function `$assert` has the signature
     
    458458If x=3 and B=2, the assertion is violated and CIVL prints the error message “x-coordinate 3 exceeds bound 2”.
    459459
    460 === Assumptions: `$assume`
     460=== Assumptions: `$assume` #assume
    461461
    462462The system function `$assume` has signature
     
    472472declares `N` and `B` to be integer inputs and restricts consideration to inputs satisfying 1 ≤ `N` ≤ `B`.
    473473
    474 === Temporary assumptions: `$assume_push` and `$assume_pop`
     474=== Temporary assumptions: `$assume_push` and `$assume_pop` #temp-assumptions
    475475
    476476These functions have signatures:
     
    491491This mechanism serves as a "widening operator" (in the sense of abstract interpretation), which enables symbolic execution to converge.
    492492
    493 === Nondeterministic choice of integer: `$choose_int`
     493=== Nondeterministic choice of integer: `$choose_int` #choose_int
    494494
    495495This function has signature
     
    499499and returns an arbitrary integer in [0.''n''-1].  In verification mode, all possible choices are enumerated and explored.
    500500
    501 === Initialization by default value: `$default_value`
     501=== Initialization by default value: `$default_value` #default_value
    502502
    503503Assigns an object the default value of its type.  Signature:
     
    510510For example, 0 is the default value for a numeric type.
    511511
    512 === Explicit elaboration of a domain: `$elaborate_domain`
     512=== Explicit elaboration of a domain: `$elaborate_domain` #elaborate_domain
    513513
    514514Forces explicit enumeration of the elements of a finite domain.  Signature
     
    518518In the concrete semantics, this is a no-op.
    519519
    520 === Process exit: `$exit`
     520=== Process exit: `$exit` #exit
    521521
    522522Terminates the calling process.  Signature:
     
    525525}}}
    526526
    527 === Assignment of arbitrary value: `$havoc`
     527=== Assignment of arbitrary value: `$havoc` #havoc
    528528
    529529Assigns an arbitrary value of the object's type to an object.  Signature:
     
    535535In the symbolic semantics, this function assigns a fresh symbolic constant of the appropriate type to the object pointed to by `ptr`.
    536536
    537 ===  Hiding pointers: `$hide`, `$reveal`, and `$hidden`
     537===  Hiding pointers: `$hide`, `$reveal`, and `$hidden` #hide-reveal-hidden
    538538
    539539The partial order reduction algorithm used by the CIVL Model Checker computes the set of memory locations that a process ''p'' can reach.
     
    556556The function `$hidden` tells whether its argument is a value returned by `$hide`.
    557557
    558 === Checking pointer safety: `$is_derefable`
     558=== Checking pointer safety: `$is_derefable` #is_derefable
    559559
    560560This function has signature
     
    565565This means `ptr` points to a memory location that is capable of and is currently holding a value of type T, where T is the type of `*ptr`.
    566566
    567 === Checking process termination: `$is_terminated`
     567=== Checking process termination: `$is_terminated` #is_terminated
    568568
    569569Signature:
     
    574574If `p` is undefined or `$proc_null`, returns 0.
    575575
    576 === Specifying local regions: `$local_start` and `$local_end`
     576=== Specifying local regions: `$local_start` and `$local_end` #local
    577577
    578578{{{
     
    655655}}}
    656656
    657 ==== Use of `$yield` within a local region
     657==== Use of `$yield` within a local region #local-yield
    658658
    659659Local blocks can also be broken up at specified points using function `$yield`.
     
    665665Only `$local_start` grants a thread a special priority.
    666666
    667 === Heap memory allocation: `$malloc` and `$free`
     667=== Heap memory allocation: `$malloc` and `$free` #malloc-free
    668668
    669669Allocate and deallocate heap memory.  Signatures:
     
    681681An error is generated if the pointer is not one that was returned by $malloc, or if it was already freed.
    682682
    683 === Print the path condition: `$pathCondition`
     683=== Print the path condition: `$pathCondition` #print-path-condition
    684684
    685685Prints the current effective path condition.
     
    688688}}}
    689689
    690 === Power function: `$pow`
     690=== Power function: `$pow`  #pow
    691691
    692692Computes ''x^y^''.
     
    695695}}}
    696696
    697 === Waiting for process termination: `$wait` and `$waitall`
     697=== Waiting for process termination: `$wait` and `$waitall` #wait
    698698
    699699{{{
     
    707707It is OK if a process argument refers to a process that has already terminated.
    708708
    709 === Yielding atomicity: `$yield`
     709=== Yielding atomicity: `$yield` #yield
    710710
    711711{{{
     
    723723In particular, if the lock is available and there is a process at a `$local_start()` call (and the first statement following the call is enabled), one such a process is guaranteed to obtain the lock.
    724724
    725 == Macros
    726 
    727 === Elaboration of integer value: `$elaborate`
    728 
    729 == Contract Annotations
     725== Macros #macros
     726
     727=== Elaboration of integer value: `$elaborate` #elaborate
     728
     729== Contract Annotations #contracts
    730730
    731731clauses
    732732
    733 === The `depends_on` clause
     733=== The `depends_on` clause #depends_on
    734734
    735735`\nothing`
    736736
    737 === The `executes_when` clause
     737=== The `executes_when` clause #executes_when