-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganise sections, and improve the explanation of ShallowModel
- Loading branch information
1 parent
f22dfec
commit 4f5677e
Showing
11 changed files
with
49 additions
and
23 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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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,3 @@ | ||
# Representation of types | ||
|
||
Creusot translates Rust code to Why3. But Rust types don't always exists in Why3, and would not have the same semantics: thus we need to map each Rust type to a Why3 type. |
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 @@ | ||
# Base types | ||
|
||
Most type have a very simple interpretation in Why3: | ||
|
||
- The interpretation for a scalar type (`i32`, `bool`, `f64`, ...) is itself. | ||
- The interpretation of `[T]` is `Seq<T>`, the type of sequences. | ||
- The interpretation of `&T` is the interpretation of `T`. | ||
|
||
Creusot is able to assume that `T` and `&T` behave the same, because of the "shared xor mutable" rule of Rust: we won't be able to change the value (interior mutability is handled by defining a special model for e.g. `Cell<T>`), so we may as well be manipulating an exact copy of the value. | ||
- The interpretation of `Box<T>` is the interpretation of `T`. | ||
|
||
This is because a `Box` uniquely own its content: it really acts exactly the same as `T`. | ||
- Structures and enums are interpreted by products and sum types. | ||
- The interpretation of `&mut T` is a bit more complicated: see the next section. |
10 changes: 9 additions & 1 deletion
10
guide/src/mutable_borrows.md → ...epresentation_of_types/mutable_borrows.md
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