-
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.
- Loading branch information
1 parent
9e62648
commit 98626b4
Showing
3 changed files
with
59 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
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,27 @@ | ||
import stainless.lang._ | ||
import stainless.collection._ | ||
|
||
object i1349a { | ||
type Index = BigInt | ||
|
||
type LIndex = List[Index] | ||
|
||
case class IndexedKey(index: BigInt, key: LIndex) { | ||
require(0 <= index && index < key.length) | ||
} | ||
|
||
def mkIndexedKey1(index: BigInt, key: LIndex): IndexedKey = { | ||
require(0 <= index && index < key.length) | ||
IndexedKey(index, key) | ||
} | ||
|
||
def mkIndexedKey2(index: BigInt, key: List[Index]): IndexedKey = { | ||
require(0 <= index && index < key.length) | ||
IndexedKey(index, key) | ||
} | ||
|
||
def mkIndexedKey3(index: Index, key: LIndex): IndexedKey = { | ||
require(0 <= index && index < key.length) | ||
IndexedKey(index, key) | ||
} | ||
} |
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,21 @@ | ||
object i1349b { | ||
final case class Wrap[A](a: A) { | ||
def get: A = a | ||
} | ||
|
||
type WInt = Wrap[Int] | ||
|
||
case class IndexedKey(key: WInt) { | ||
require(key.get < 100) | ||
} | ||
|
||
def mkIndexedKey1(key: WInt): IndexedKey = { | ||
require(key.get < 100) | ||
IndexedKey(key) | ||
} | ||
|
||
def mkIndexedKey2(key: Wrap[Int]): IndexedKey = { | ||
require(key.get < 100) | ||
IndexedKey(key) | ||
} | ||
} |