-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathproplib.sail
32 lines (23 loc) · 1.1 KB
/
proplib.sail
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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)