-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into sam_reporting
- Loading branch information
Showing
3 changed files
with
20 additions
and
2 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
2 changes: 1 addition & 1 deletion
2
...nchmarks/imperative/valid/FreshExpr.scala → ...chmarks/imperative/valid/FreshExpr1.scala
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import stainless.lang._ | ||
|
||
object FreshExpr2 { | ||
|
||
def iden(arr: Array[Int]) = arr | ||
|
||
// Recursive functions must return fresh expression | ||
def counting(i: Int): Array[Int] = { | ||
require(0 <= i && i <= 10) | ||
decreases(10 - i) | ||
if (i < 10) { | ||
counting(i + 1) | ||
} else { | ||
val b = Array.fill(0)(0) | ||
iden(b) // This is a fresh expression | ||
} | ||
} | ||
} |