forked from boogie-org/boogie
-
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.
### Changes - Add hide and reveal commands, that works together with pruning to enable preventing specific edges in the dependency graph from being traversed, thereby causing more to be pruned. An axiom can be marked as `hideable`. The hide and reveal commands can hide or reveal a set of functions, a state which is maintained throughout the execution of a Boogie implementation. During pruning, if a live but hidden function uses a hideable axiom, then the axiom will not be made live. - Add the `pushScope` and `popScope` commands, which represents entering and leaving lexical scopes. Right now, these commands only influence the behavior of `hide` and `reveal`, but in the future they may also allow local variable shadowing. ### Testing - Add test `Reveal.bpl` which tests the new feature - Add test `AssumeFalseSplit.bpl`, which tests an existing piece of the behavior of splits
- Loading branch information
1 parent
22adc83
commit 5ef7ba8
Showing
44 changed files
with
1,377 additions
and
626 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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
MSBuild_Logs/ | ||
|
||
.lit_test_times.txt | ||
|
||
# Nuget | ||
Source/packages/ | ||
|
||
|
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
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,34 @@ | ||
#nullable enable | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Boogie; | ||
|
||
/// <summary> | ||
/// Allows pushing and popping scopes inside a Boogie implementation. | ||
/// | ||
/// Right now these scopes only affect the state of what functions are hidden and revealed using the hide and reveal keywords. | ||
/// However, in the future these scopes should also allow lexical scoping and variable shadowing. | ||
/// </summary> | ||
public class ChangeScope : Cmd { | ||
public bool Push { get; } | ||
|
||
public ChangeScope(IToken tok, bool push) : base(tok) { | ||
Push = push; | ||
} | ||
|
||
public override void Resolve(ResolutionContext rc) { | ||
} | ||
|
||
public override void Typecheck(TypecheckingContext tc) { | ||
} | ||
|
||
public override void Emit(TokenTextWriter stream, int level) { | ||
} | ||
|
||
public override void AddAssignedVariables(List<Variable> vars) { | ||
} | ||
|
||
public override Absy StdDispatch(StandardVisitor visitor) { | ||
return this; | ||
} | ||
} |
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,54 @@ | ||
#nullable enable | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Boogie; | ||
|
||
/// <summary> | ||
/// Can be used to hide or reveal a specific function, or all functions | ||
/// If pruning is turned on, a hidden function will be pruned despite being referenced in a Boogie implementation. | ||
/// The function is only partially pruned though: the function definition itself is kept, and only axioms | ||
/// that the function depends on, that are marked as hideable, are pruned. | ||
/// | ||
/// Hide and revealing takes into account lexical scoping: | ||
/// A popScope command will undo any hide and reveal operations that came after the last pushScope command. | ||
/// </summary> | ||
public class HideRevealCmd : Cmd { | ||
public bool Hide { get; } | ||
private readonly FunctionCall? functionCall; | ||
|
||
public HideRevealCmd(IToken tok, bool hide) : base(tok) { | ||
this.Hide = hide; | ||
} | ||
|
||
public HideRevealCmd(IdentifierExpr name, bool hide) : base(name.tok) { | ||
this.Hide = hide; | ||
this.functionCall = new FunctionCall(name); | ||
} | ||
|
||
public Function? Function => functionCall?.Func; | ||
|
||
public override void Resolve(ResolutionContext rc) | ||
{ | ||
functionCall?.Resolve(rc, null); | ||
} | ||
|
||
public override void Typecheck(TypecheckingContext tc) | ||
{ | ||
} | ||
|
||
public override void Emit(TokenTextWriter stream, int level) | ||
{ | ||
stream.Write(this, level, Hide ? "hide " : "reveal "); | ||
stream.Write(this, level, Function == null ? "*" : Function.Name); | ||
stream.WriteLine(";"); | ||
} | ||
|
||
public override void AddAssignedVariables(List<Variable> vars) | ||
{ | ||
} | ||
|
||
public override Absy StdDispatch(StandardVisitor visitor) | ||
{ | ||
return visitor.VisitRevealCmd(this); | ||
} | ||
} |
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
Oops, something went wrong.