Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
119
Issues
119
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
97843952
Commit
97843952
authored
Oct 18, 2018
by
Sylvain Dailler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ce-bench add example with a record with invariant
parent
80334a31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
0 deletions
+89
-0
bench/ce/records_inv.mlw
bench/ce/records_inv.mlw
+89
-0
No files found.
bench/ce/records_inv.mlw
0 → 100644
View file @
97843952
(*****************************************
** Getting counterexamples for records **
*****************************************)
module M
use ref.Ref
use int.Int
(*** In all cases, records are decomposed using match eval ***)
type r = {f [@model_trace:.my_field_f] :int; g:bool}
invariant { f = 0 }
let record_match_eval_test1 (x : r) : int
ensures { result = 1 }
=
if x.g then
x.f
else
1
let record_match_eval_test2 (x : r ) : int
ensures { result = 1 }
=
x.f
let record_match_eval_test3 (x : ref r) : unit
ensures { !x.g }
=
x := { !x with f = 6}
let record_match_eval_test4 (x : ref r) : r
ensures { result.g }
=
x := { !x with f = 6 };
!x
let record_match_eval_test44 (x : ref r) : r
ensures { result.g }
= [@vc:sp]
x := { !x with f = 6 };
assert { !x.f = 12};
!x
val re : ref r
let test_record_match_eval_test5 (x : ref r) : r
ensures { result = !re }
=
x := { !x with f = 6 };
!x
end
module Mutable
use int.Int
type r = {mutable f [@model_trace:.my_field_f] :int; mutable g:bool}
let record_match_eval_test1 (x : r) : int
ensures { result = 1 }
=
if x.g then
x.f
else
1
let record_match_eval_test2 (x : r ) : int
ensures { result = 1 }
=
x.f
let record_match_eval_test3 (x : r) : unit
ensures { x.g }
=
x.f <- 6
let record_match_eval_test4 (x : r) : r
ensures { result.g }
=
x.f <- 6;
x
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment