-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
closing #272: better diagnostics for recursive operators
- Loading branch information
Showing
9 changed files
with
145 additions
and
31 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
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 |
---|---|---|
@@ -1,19 +1,27 @@ | ||
--------------------------- MODULE Rec10 ------------------------------------- | ||
(* | ||
* A regression test. | ||
* Recursive operators that are declared via instances should not fail. | ||
* Test for missing annotation UNROLL_DEFAULT_Fact. | ||
* | ||
* Igor Konnov, April 2020 | ||
*) | ||
-------------------------------- MODULE test ------------------------------- | ||
----------------------------- MODULE inner --------------------------- | ||
RECURSIVE A(_) | ||
A(x) == IF x = 1 THEN 1 ELSE A(1) | ||
====================================================================== | ||
EXTENDS Integers | ||
|
||
VARIABLES f | ||
I == INSTANCE inner | ||
|
||
Init == f = I!A(0) | ||
RECURSIVE Fact(_) | ||
|
||
Next == UNCHANGED f | ||
Fact(n) == | ||
IF n <= 1 | ||
THEN 1 | ||
ELSE n * Fact(n - 1) | ||
|
||
Inv == TRUE | ||
============================================================================ | ||
Init == | ||
f = Fact(4) | ||
|
||
Next == | ||
f' = Fact(7) | ||
|
||
Inv == | ||
f >= 1 | ||
|
||
============================================================================= |
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,33 @@ | ||
--------------------------- MODULE Rec11 ------------------------------------- | ||
(* | ||
* Testing whether Unroller complains about missing UNROLL_TIMES_Fact. | ||
* | ||
* Igor Konnov, April 2020 | ||
*) | ||
EXTENDS Integers | ||
|
||
VARIABLES f | ||
|
||
RECURSIVE Fact(_) | ||
|
||
Fact(n) == | ||
IF n <= 1 | ||
THEN 1 | ||
ELSE n * Fact(n - 1) | ||
|
||
\* define the default value | ||
UNROLL_DEFAULT_Fact == 0 | ||
|
||
\* but keep UNROLL_TIMES_Fact undefined | ||
\*UNROLL_TIMES_Fact == 4 | ||
|
||
Init == | ||
f = Fact(4) | ||
|
||
Next == | ||
f' = Fact(7) | ||
|
||
Inv == | ||
f >= 1 | ||
|
||
============================================================================= |
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,20 @@ | ||
(* | ||
* A regression test. | ||
* Recursive operators that are declared via instances should not fail. | ||
*) | ||
-------------------------------- MODULE Rec12 ------------------------------- | ||
----------------------------- MODULE inner --------------------------- | ||
RECURSIVE A(_) | ||
A(x) == IF x = 1 THEN 1 ELSE A(1) | ||
====================================================================== | ||
|
||
VARIABLES f | ||
I == INSTANCE inner | ||
|
||
Init == f = I!A(0) | ||
|
||
Next == UNCHANGED f | ||
|
||
Inv == TRUE | ||
============================================================================ | ||
|
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