-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1083 from lorchrob/abstract-type-cleanup
Disallow quantification over variables with types containing abstract types
- Loading branch information
Showing
6 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Abstract Types | ||
============== | ||
|
||
Kind 2 supports Lustre's **abstract types**, | ||
which are user-declared types without definitions. | ||
Abstract types are declared with the syntax ``type <name>``. | ||
Below is a simple Lustre file that declares an identity | ||
node that takes an input of (abstract) type ``T`` | ||
and returns an output of type ``T`` equal to the input. | ||
|
||
.. code-block:: | ||
type T; | ||
function id_T (x: T) returns (y: T); | ||
let | ||
y = x; | ||
tel | ||
In Kind 2, all abstract types have infinite domains. | ||
Therefore, to maintain soundness, quantification over variables with abstract | ||
types is not allowed. For example, the following code block | ||
is rejected by Kind 2, since the contract assumption would constrain | ||
type ``T`` to have a finite domain. | ||
|
||
.. code-block:: | ||
type T; | ||
function id_T (x: T) returns (y: T); | ||
(*@contract | ||
assume forall (x:T) (forall (y: T) x = y); | ||
*) | ||
let | ||
y = x; | ||
tel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters