-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split property helpers to their own file
- Loading branch information
Showing
3 changed files
with
34 additions
and
34 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,32 @@ | ||
|
||
|
||
/* Syntactic sugar */ | ||
|
||
infixr 1 --> | ||
|
||
type operator -->('p: Bool, 'q: Bool) -> Bool = not('p) | 'q | ||
val operator --> : forall ('p 'q: Bool). (bool('p), bool('q)) -> bool('p --> 'q) | ||
function operator --> (p, q) = not_bool(p) | q | ||
|
||
infix 1 <--> | ||
|
||
type operator <-->('p: Bool, 'q: Bool) -> Bool = ('p --> 'q) & ('q --> 'p) | ||
val operator <--> : forall ('p 'q: Bool). (bool('p), bool('q)) -> bool('p <--> 'q) | ||
function operator <--> (p, q) = (p --> q) & (q --> p) | ||
|
||
/* Useful functions */ | ||
|
||
/*! | ||
* THIS is a helper function to compress and then decompress a Capability. | ||
* The [Capability] struct can hold non-encodable values therefore some | ||
* properties encode then decode a Capability to check the effect that | ||
* compression / decompression has. In general the bounds, address and tag | ||
* should be unaffected but the permissions and otype might change. | ||
*/ | ||
function encodeDecode(c : Capability) -> Capability = capBitsToCapability(c.tag, capToBits(c)) | ||
|
||
/*! | ||
* THIS is a helper to check that the given Capability is unaffected by | ||
* compression / decompression. | ||
*/ | ||
function capEncodable(c : Capability) -> bool = c == encodeDecode(c) |
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