-
Notifications
You must be signed in to change notification settings - Fork 38
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
1 changed file
with
55 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
(* | ||
package test | ||
import ( | ||
"github.com/tchajed/goose/machine" | ||
) | ||
func test() { | ||
slEmpt := make([]byte, 0) | ||
machine.Assert((slEmpt == nil) == true) | ||
} | ||
*) | ||
(* autogenerated from test *) | ||
From Perennial.goose_lang Require Import prelude. | ||
|
||
Section code. | ||
Context `{ext_ty: ext_types}. | ||
Local Coercion Var' s: expr := Var s. | ||
|
||
(* FIXME: should not be possible to prove this assert *) | ||
Definition test: val := | ||
rec: "test" <> := | ||
let: "slEmpt" := NewSlice byteT #0 in | ||
control.impl.Assert (("slEmpt" = slice.nil) = #true);; | ||
#(). | ||
|
||
End code. | ||
|
||
From Perennial.program_proof Require Import grove_prelude. | ||
From Perennial.goose_lang.lib Require Import slice. | ||
Section proof. | ||
Context `{!heapGS Σ}. | ||
Lemma wp_test : | ||
{{{ | ||
True | ||
}}} | ||
test #() | ||
{{{ | ||
RET #(); True | ||
}}} | ||
. | ||
Proof. | ||
iIntros (Φ) "_ HΦ". | ||
wp_lam. wp_pures. | ||
rewrite /NewSlice. | ||
rewrite /slice.nil. | ||
wp_pures. | ||
wp_pure1. | ||
{ done. } | ||
wp_apply wp_Assert. | ||
2:{ wp_pures; by iApply "HΦ". } | ||
done. | ||
Qed. | ||
|
||
End proof. |