Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d6f3951
Add proof by statement
keyboardDrummer Sep 16, 2024
84c7073
Merge remote-tracking branch 'origin/master' into penetratingByBlocks
keyboardDrummer Sep 16, 2024
a2f6b5c
Pass AssertMode to all Assert calls
keyboardDrummer Sep 16, 2024
313ad7e
Use free calls inside by blocks
keyboardDrummer Sep 20, 2024
174abf8
Move code from BoogieGenerator.TrStatement into separate files
keyboardDrummer Sep 20, 2024
5a2f37c
Use namespace directive
keyboardDrummer Sep 20, 2024
ae6f060
Start with removing pre and post call stuff
keyboardDrummer Sep 20, 2024
3cdae72
Finish pre/post call cleanup
keyboardDrummer Sep 20, 2024
9e7a558
Remove the proof field everywhere but in BlockByProof
keyboardDrummer Sep 20, 2024
2b17edc
Update parser
keyboardDrummer Sep 20, 2024
0774dc4
Fix a few bugs
keyboardDrummer Sep 20, 2024
1049866
More use of BodyTranslationContext.AssertMode
keyboardDrummer Sep 20, 2024
a8b2312
Improve printing
keyboardDrummer Sep 20, 2024
0391450
Rename of UpdateStmt
keyboardDrummer Sep 20, 2024
6b985cf
Add comments
keyboardDrummer Sep 20, 2024
fe456d3
Definite assignment tracking issue
keyboardDrummer Sep 21, 2024
5af6b22
Definite assignment tracker changed so it's never cleaned up
keyboardDrummer Sep 21, 2024
6e6d73d
Add substituter implementation
keyboardDrummer Sep 21, 2024
212cfbe
Prepare for using ordered dictionary for locals
keyboardDrummer Sep 23, 2024
da8787e
Introduce Variables class to track Boogie variables using an ordered …
keyboardDrummer Sep 23, 2024
185834a
CallBy.dfy works now
keyboardDrummer Sep 23, 2024
6f2dbf3
CallByHide.dfy passes
keyboardDrummer Sep 23, 2024
16f8ef7
Convert giant if to switch statement
keyboardDrummer Sep 23, 2024
5415a97
Fix
keyboardDrummer Sep 23, 2024
00e11e8
Merge remote-tracking branch 'origin/master' into penetratingByBlocks
keyboardDrummer Sep 23, 2024
10ee669
Ran formatter and def assignment improvement
keyboardDrummer Sep 23, 2024
2eea9e3
Move to symbols for mapping to tracking variables
keyboardDrummer Sep 24, 2024
6560fc2
Fixes
keyboardDrummer Sep 24, 2024
e9db4b9
More fixes
keyboardDrummer Sep 24, 2024
0830162
Fix formatter
keyboardDrummer Sep 24, 2024
35442d9
Merge commit 'ef13a72f3a9d3f' into penetratingByBlocks
keyboardDrummer Sep 24, 2024
d4ca466
Fix
keyboardDrummer Sep 24, 2024
4dfbd8b
Fix expect file
keyboardDrummer Sep 24, 2024
e8c409f
Undo Def as tracking changes
keyboardDrummer Sep 24, 2024
a078831
Fixes
keyboardDrummer Sep 24, 2024
e86fed8
Update expect file
keyboardDrummer Sep 24, 2024
67cdf7b
Update tests
keyboardDrummer Sep 24, 2024
054140b
Update tests
keyboardDrummer Sep 24, 2024
ae8d333
Use an immediately dictionary instead of adding and removing
keyboardDrummer Sep 24, 2024
a4796d2
Fix test generation
keyboardDrummer Sep 24, 2024
8ab5cb7
Refactoring
keyboardDrummer Sep 24, 2024
bdb02ae
Update test
keyboardDrummer Sep 24, 2024
2f189bb
Add test-case for assign such that
keyboardDrummer Sep 24, 2024
880fa30
Add tests
keyboardDrummer Sep 24, 2024
95a09a2
Add another test
keyboardDrummer Sep 24, 2024
13a25b3
Updates
keyboardDrummer Sep 25, 2024
46dc302
Fix SubsetTypes
keyboardDrummer Sep 25, 2024
946bdd6
Merge branch 'master' into penetratingByBlocks
keyboardDrummer Sep 25, 2024
f45a1a3
Remove todos
keyboardDrummer Oct 6, 2024
7cce358
Regenerated makefiles
keyboardDrummer Oct 6, 2024
d132f87
Merge remote-tracking branch 'origin/master' into penetratingByBlocks
keyboardDrummer Oct 6, 2024
f9c2fa3
Update doos
keyboardDrummer Oct 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Source/DafnyCore/Verifier/BoogieGenerator.Iterators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ void AddIteratorWellformednessCheck(IteratorDecl iter, Procedure proc) {
var th = new ThisExpr(iter); // resolve here
var rds = new MemberSelectExpr(iter.tok, th, iter.Member_Reads);
var mod = new MemberSelectExpr(iter.tok, th, iter.Member_Modifies);
builder.Add(new Bpl.CallCmd(iter.tok, "$IterHavoc0",
new List<Bpl.Expr>() { etran.TrExpr(th), etran.TrExpr(rds), etran.TrExpr(mod) },
builder.Add(Call(builder.Context, iter.tok, "$IterHavoc0",
new List<Expr>() { etran.TrExpr(th), etran.TrExpr(rds), etran.TrExpr(mod) },
new List<Bpl.IdentifierExpr>()));

// assume the automatic yield-requires precondition (which is always well-formed): this.Valid()
Expand All @@ -206,7 +206,7 @@ void AddIteratorWellformednessCheck(IteratorDecl iter, Procedure proc) {
builder.Add(Bpl.Cmd.SimpleAssign(iter.tok, new Bpl.IdentifierExpr(iter.tok, oldIterHeap), etran.HeapExpr));
// simulate a modifies this, this._modifies, this._new;
var nw = new MemberSelectExpr(iter.tok, th, iter.Member_New);
builder.Add(new Bpl.CallCmd(iter.tok, "$IterHavoc1",
builder.Add(Call(builder.Context, iter.tok, "$IterHavoc1",
new List<Bpl.Expr>() { etran.TrExpr(th), etran.TrExpr(mod), etran.TrExpr(nw) },
new List<Bpl.IdentifierExpr>()));
// assume the implicit postconditions promised by MoveNext:
Expand Down Expand Up @@ -387,7 +387,7 @@ void YieldHavoc(IToken tok, IteratorDecl iter, BoogieStmtListBuilder builder, Ex
var th = new ThisExpr(iter);
var rds = new MemberSelectExpr(tok, th, iter.Member_Reads);
var nw = new MemberSelectExpr(tok, th, iter.Member_New);
builder.Add(new Bpl.CallCmd(tok, "$YieldHavoc",
builder.Add(Call(builder.Context, tok, "$YieldHavoc",
new List<Bpl.Expr>() { etran.TrExpr(th), etran.TrExpr(rds), etran.TrExpr(nw) },
new List<Bpl.IdentifierExpr>()));
// assume YieldRequires;
Expand Down
9 changes: 6 additions & 3 deletions Source/DafnyCore/Verifier/BoogieGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2801,6 +2801,7 @@ private Bpl.Function GetCanCallFunction(Function f) {
/// Note that SpecWellformedness and Implementation have procedure implementations
/// but no callers, and vice versa for InterModuleCall, IntraModuleCall, and CoCall.
/// </summary>
/// Remy: TODO Simplify
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there more work on this that you want to do for this PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The work was done. Now the TODO is also gone.

enum MethodTranslationKind { SpecWellformedness, CallPre, CallPost, CoCallPre, CoCallPost, Implementation, OverrideCheck }

private static readonly Dictionary<MethodTranslationKind, string> kindSanitizedPrefix =
Expand Down Expand Up @@ -2848,14 +2849,16 @@ private static void AddSmtOptionAttribute(Bpl.NamedDeclaration targetDecl, strin
targetDecl.Attributes = new QKeyValue(targetDecl.tok, "smt_option", new List<object>() { name, value }, targetDecl.Attributes);
}

private static CallCmd Call(IToken tok, string methodName, List<Expr> ins, List<Bpl.IdentifierExpr> outs) {
private static CallCmd Call(BodyTranslationContext context, IToken tok, string methodName,
List<Expr> ins, List<Bpl.IdentifierExpr> outs) {
Contract.Requires(tok != null);
Contract.Requires(methodName != null);
Contract.Requires(ins != null);
Contract.Requires(outs != null);

CallCmd call;
call = new CallCmd(tok, methodName, ins, outs);
var call = new CallCmd(tok, methodName, ins, outs) {
IsFree = context.AssertMode == AssertMode.Assume
};
// CLEMENT enable this: call.ErrorData = "possible violation of function precondition";
return call;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/DafnyCore/Verifier/BoogieStmtListBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public BoogieStmtListBuilder(BoogieGenerator tran, DafnyOptions options, BodyTra
public void Add(Cmd cmd) {
Commands.Add(cmd);
builder.Add(cmd);
if (cmd is Boogie.AssertCmd) {
if (cmd is AssertCmd) {
tran.assertionCount++;
} else if (cmd is Boogie.CallCmd call) {
} else if (cmd is CallCmd call) {
// A call command may involve a precondition, but we can't tell for sure until the callee
// procedure has been generated. Therefore, to be on the same side, we count this call
// as a possible assertion, unless it's a procedure that's part of the translation and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2026,7 +2026,7 @@ void AddCall(BoogieStmtListBuilder callBuilder) {
callBuilder.Add(new CommentCmd($"ProcessCallStmt: Check precondition"));
// Make the call
AddReferencedMember(callee);
Bpl.CallCmd call = Call(tok, MethodName(callee, isCoCall ? MethodTranslationKind.CoCallPre : MethodTranslationKind.CallPre), ins, new List<Bpl.IdentifierExpr>());
var call = Call(callBuilder.Context, tok, MethodName(callee, isCoCall ? MethodTranslationKind.CoCallPre : MethodTranslationKind.CallPre), ins, new List<Bpl.IdentifierExpr>());
proofDependencies?.AddProofDependencyId(call, tok, new CallDependency(cs));
if (
(assertionOnlyFilter != null && !assertionOnlyFilter(tok)) ||
Expand All @@ -2042,7 +2042,8 @@ void AddCall(BoogieStmtListBuilder callBuilder) {
}

builder.Add(new CommentCmd("ProcessCallStmt: Make the call"));
CallCmd post = Call(tok, MethodName(callee, isCoCall ? MethodTranslationKind.CoCallPost : MethodTranslationKind.CallPost), ins, outs);
var post = Call(builder.Context, tok,
MethodName(callee, isCoCall ? MethodTranslationKind.CoCallPost : MethodTranslationKind.CallPost), ins, outs);
proofDependencies?.AddProofDependencyId(post, tok, new CallDependency(cs));
builder.Add(post);

Expand Down Expand Up @@ -2220,7 +2221,7 @@ void RecordNewObjectsIn_New(IToken tok, IteratorDecl iter, Bpl.Expr initHeap, Bp
// call $iter_newUpdate := $IterCollectNewObjects(initHeap, $Heap, this, _new);
var th = new Bpl.IdentifierExpr(iter.tok, etran.This, predef.RefType);
var nwField = new Bpl.IdentifierExpr(tok, GetField(iter.Member_New));
Bpl.Cmd cmd = new CallCmd(iter.tok, "$IterCollectNewObjects",
var cmd = Call(builder.Context, iter.tok, "$IterCollectNewObjects",
new List<Bpl.Expr>() { initHeap, etran.HeapExpr, th, nwField },
new List<Bpl.IdentifierExpr>() { updatedSetIE });
builder.Add(cmd);
Expand Down