Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit cd8e77e

Browse files
committed
update MSL doc
1 parent 435d432 commit cd8e77e

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

apps/nextra/pages/en/build/smart-contracts/prover/spec-lang.mdx

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,6 @@ exists <binding>, ..., <binding> [ where <exp> ] : <exp>
136136
- The optional constraint `where <exp>` allows to restrict the quantified range. `forall x: T where p: q`
137137
is equivalent to `forall x: T : p ==> q` and `exists x: T where p: q` is equivalent to `exists x: T : p && q`.
138138

139-
Notice that it is possible to quantify over types. For example:
140-
141-
```move
142-
forall t: type, addr: address where exists<R<t>>(addr): exists<T<t>>(addr)
143-
```
144-
145139
## Choice operator
146140

147141
The choice operator allows selecting a value that satisfies a predicate:
@@ -658,20 +652,6 @@ module 0x42::m {
658652
}
659653
```
660654

661-
If this is not wanted, and the `aborts_with` should be independent of `aborts_if`, one can use the
662-
property `[check]`:
663-
664-
```move
665-
module 0x42::m {
666-
spec get_one_off {
667-
aborts_if !exists<Counter>(addr) with 3;
668-
aborts_if global<Counter>(addr) == 0 with EXECUTION_FAILURE;
669-
670-
aborts_with [check] 3, EXECUTION_FAILURE;
671-
}
672-
}
673-
```
674-
675655
## Requires condition
676656

677657
The `requires` condition is a spec block member that postulates a pre-condition for a function. The
@@ -857,6 +837,14 @@ module 0x42::m {
857837
}
858838
```
859839

840+
Notice that type parameters are supported in global invariants. For example:
841+
842+
```move
843+
module addr::M {
844+
invariant<Y> forall addr: address where exists<R<Y>>(addr): exists<T<Y>>(addr);
845+
}
846+
```
847+
860848
#### Disabling invariants
861849

862850
There are times when a global invariant holds almost everywhere, except for a brief interval inside a function. In current Move code, this often occurs when something (e.g. an account) is being set up and

0 commit comments

Comments
 (0)