forked from ocaml-gospel/ortac
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
19 changed files
with
651 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
(lang dune 3.0) | ||
(lang dune 3.8) | ||
(using dune_site 0.1) | ||
(using mdx 0.4) | ||
|
||
(name ortac) | ||
|
||
(package | ||
|
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
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
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
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 @@ | ||
(mdx | ||
(package ortac-qcheck-stm) | ||
(deps | ||
(package ortac-core))) | ||
|
||
(documentation | ||
(package ortac-qcheck-stm) | ||
(mld_files index)) | ||
|
||
(rule | ||
(alias runtest) | ||
(package ortac-qcheck-stm) | ||
(deps | ||
(:example example.mli) | ||
(package gospel)) | ||
(action | ||
(setenv | ||
ORTAC_ONLY_PLUGIN | ||
qcheck-stm | ||
(ignore-outputs | ||
(run gospel check %{example}))))) |
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,36 @@ | ||
(* $MDX part-begin=type-decl *) | ||
|
||
type 'a t | ||
(*@ model size : int | ||
mutable model contents : 'a list *) | ||
|
||
(* $MDX part-end *) | ||
|
||
(* $MDX part-begin=make *) | ||
|
||
val make : int -> 'a -> 'a t | ||
(*@ t = make i a | ||
checks i >= 0 | ||
ensures t.size = i | ||
ensures t.contents = List.init i (fun j -> a) *) | ||
|
||
(* $MDX part-end *) | ||
|
||
(* $MDX part-begin=set *) | ||
|
||
val set : 'a t -> int -> 'a -> unit | ||
(*@ set t i a | ||
checks 0 <= i < t.size | ||
modifies t.contents | ||
ensures t.contents = List.mapi (fun j x -> if j = (i : integer) then a else x) (old t.contents) *) | ||
|
||
(* $MDX part-end *) | ||
|
||
(* $MDX part-begin=get *) | ||
|
||
val get : 'a t -> int -> 'a | ||
(*@ a = get t i | ||
checks 0 <= i < t.size | ||
ensures a = List.nth t.contents i *) | ||
|
||
(* $MDX part-end *) |
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,17 @@ | ||
type 'a t | ||
(*@ model size : int | ||
mutable model contents : 'a list *) | ||
|
||
val make : int -> 'a -> 'a t | ||
(*@ t = make i a | ||
checks i >= 0 | ||
ensures t.size = i | ||
ensures t.contents = List.init i (fun j -> a) *) | ||
|
||
(* $MDX part-begin=fun-decl *) | ||
|
||
val for_all : 'a t -> bool | ||
(*@ b = for_all t | ||
ensures b = List.for_all (fun x -> x = x) t.contents *) | ||
|
||
(* $MDX part-end *) |
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,16 @@ | ||
type 'a t | ||
(*@ model size : int | ||
mutable model contents : 'a list *) | ||
|
||
val make : int -> 'a -> 'a t | ||
(*@ t = make i a | ||
checks i >= 0 | ||
ensures t.size = i | ||
ensures t.contents = List.init i (fun j -> a) *) | ||
|
||
(* $MDX part-begin=fun-decl *) | ||
|
||
val incompatible_type : char -> string t -> bool | ||
(*@ b = incompatible_type c t *) | ||
|
||
(* $MDX part-end *) |
17 changes: 17 additions & 0 deletions
17
plugins/qcheck-stm/doc/example_ill_formed_quantification.mli
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,17 @@ | ||
type 'a t | ||
(*@ model size : int | ||
mutable model contents : 'a list *) | ||
|
||
val make : int -> 'a -> 'a t | ||
(*@ t = make i a | ||
checks i >= 0 | ||
ensures t.size = i | ||
ensures t.contents = List.init i (fun j -> a) *) | ||
|
||
(* $MDX part-begin=fun-decl *) | ||
|
||
val unsupported_quantification : 'a t -> bool | ||
(*@ b = unsupported_quantification t | ||
ensures b = forall a. List.mem a t.contents -> a = a *) | ||
|
||
(* $MDX part-end *) |
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,16 @@ | ||
type 'a t | ||
(*@ model size : int | ||
mutable model contents : 'a list *) | ||
|
||
val make : int -> 'a -> 'a t | ||
(*@ t = make i a | ||
checks i >= 0 | ||
ensures t.size = i | ||
ensures t.contents = List.init i (fun j -> a) *) | ||
|
||
(* $MDX part-begin=fun-decl *) | ||
|
||
val incompatible_type : char -> string t -> bool | ||
(*@ b = incompatible_type c t *) | ||
|
||
(* $MDX part-end *) |
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 @@ | ||
type 'a t | ||
(*@ model size : int | ||
mutable model contents : 'a list *) | ||
|
||
val make : int -> 'a -> 'a t | ||
(*@ t = make i a | ||
checks i >= 0 | ||
ensures t.size = i | ||
ensures t.contents = List.init i (fun j -> a) *) | ||
|
||
(* $MDX part-begin=fun-decl *) | ||
|
||
val ensures_not_found_for_next_state : 'a t -> unit | ||
(*@ ensures_not_found_for_next_state t | ||
modifies t.contents | ||
ensures List.length t.contents = List.length (old t.contents) *) | ||
|
||
(* $MDX part-end *) |
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,25 @@ | ||
type 'a t | ||
(*@ model size : int | ||
mutable model contents : 'a list *) | ||
|
||
val make : int -> 'a -> 'a t | ||
(*@ t = make i a | ||
checks i >= 0 | ||
ensures t.size = i | ||
ensures t.contents = List.init i (fun j -> a) *) | ||
|
||
(* $MDX part-begin=fun-decl *) | ||
|
||
val f : int -> int -> bool | ||
(*@ b = f x y *) | ||
|
||
val g : 'a t -> 'a t -> bool | ||
(*@ b = g t1 t2 *) | ||
|
||
val h : int -> 'a t | ||
(*@ t = h i *) | ||
|
||
val exist : ('a -> bool) -> 'a t -> b | ||
(*@ b = exist p t *) | ||
|
||
(* $MDX part-end *) |
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 @@ | ||
type 'a t | ||
(*@ model size : int | ||
mutable model contents : 'a list *) | ||
|
||
val make : int -> 'a -> 'a t | ||
(*@ t = make i a | ||
checks i >= 0 | ||
ensures t.size = i | ||
ensures t.contents = List.init i (fun j -> a) *) | ||
|
||
type new_type | ||
|
||
(* $MDX part-begin=fun-decl *) | ||
|
||
val type_not_supported : new_type -> 'a t -> new_type | ||
(*@ y = type_not_supported x t *) | ||
|
||
(* $MDX part-end *) |
Oops, something went wrong.