forked from creusot-rs/creusot
-
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
4 changed files
with
177 additions
and
66 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 |
---|---|---|
@@ -1,8 +1,24 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(specialization)] | ||
extern crate creusot_contracts; | ||
use creusot_contracts::{invariant, *}; | ||
|
||
pub struct List<T>(T, Option<Box<List<T>>>); | ||
pub struct Sum10(i32, i32); | ||
|
||
pub fn use_list(l: List<i32>) { | ||
proof_assert!(invariant::inv(l)) | ||
impl invariant::UserInv for Sum10 { | ||
#[predicate] | ||
#[open] | ||
fn user_inv(self) -> bool { | ||
pearlite! { self.0@ + self.1@ == 10 } | ||
} | ||
} | ||
|
||
pub enum Foo<'a, T> { | ||
A { f1: &'a mut Sum10, f2: usize }, | ||
B(T), | ||
} | ||
|
||
#[requires(invariant::inv(x))] | ||
pub fn use_foo<'a>(x: Foo<'a, (Foo<'a, u32>, &'a mut Sum10)>) { | ||
proof_assert!(invariant::inv(x)); | ||
} |
14 changes: 14 additions & 0 deletions
14
creusot/tests/should_succeed/type_invariants/generated/why3session.xml
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,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE why3session PUBLIC "-//Why3//proof session v5//EN" | ||
"http://why3.lri.fr/why3session.dtd"> | ||
<why3session shape_version="6"> | ||
<prover id="0" name="Alt-Ergo" version="2.4.2" timelimit="1" steplimit="0" memlimit="1000"/> | ||
<file format="mlcfg" proved="true"> | ||
<path name=".."/><path name="generated.mlcfg"/> | ||
<theory name="Generated_UseFoo" proved="true"> | ||
<goal name="use_foo'vc" expl="VC for use_foo" proved="true"> | ||
<proof prover="0"><result status="valid" time="0.01" steps="5"/></proof> | ||
</goal> | ||
</theory> | ||
</file> | ||
</why3session> |
Binary file added
BIN
+214 Bytes
creusot/tests/should_succeed/type_invariants/generated/why3shapes.gz
Binary file not shown.