summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Unknown <afd@afd-THINK>2012-09-28 11:20:06 +0100
committerGravatar Unknown <afd@afd-THINK>2012-09-28 11:20:06 +0100
commitca048fe8bc97f291c1a4918ecf9bbc10f33fc8fd (patch)
treefb28743953de1d75d4d98e83ba486ae85ef89e3a
parent930161bb7df44eb931e38bc2dc1a480e282d1e94 (diff)
parent0148932e73baf6c34ff2fbf19ca9fca2b345afba (diff)
Merge
-rw-r--r--Binaries/DafnyPrelude.bpl12
-rw-r--r--Binaries/UnivBackPred2.smt23
-rw-r--r--Chalice/src/main/scala/Translator.scala7
-rw-r--r--Chalice/tests/general-tests/ll-lastnode.chalice82
-rw-r--r--Chalice/tests/general-tests/ll-lastnode.output.txt6
-rw-r--r--Source/AbsInt/AbsInt.csproj7
-rw-r--r--Source/AbsInt/AbstractInterpretation.cs916
-rw-r--r--Source/AbsInt/ExprFactories.cs275
-rw-r--r--Source/AbsInt/IntervalDomain.cs33
-rw-r--r--Source/AbsInt/LoopInvariantsOnDemand.cs84
-rw-r--r--Source/AbsInt/NativeLattice.cs20
-rw-r--r--Source/Basetypes/Basetypes.csproj1
-rw-r--r--Source/Basetypes/BigDec.cs313
-rw-r--r--Source/Boogie.sln56
-rw-r--r--Source/BoogieDriver/BoogieDriver.cs11
-rw-r--r--Source/BoogieDriver/BoogieDriver.csproj8
-rw-r--r--Source/Core/Absy.cs202
-rw-r--r--Source/Core/AbsyCmd.cs14
-rw-r--r--Source/Core/AbsyExpr.cs865
-rw-r--r--Source/Core/AbsyQuant.cs242
-rw-r--r--Source/Core/AbsyType.cs26
-rw-r--r--Source/Core/BoogiePL.atg58
-rw-r--r--Source/Core/CommandLineOptions.cs44
-rw-r--r--Source/Core/Core.csproj4
-rw-r--r--Source/Core/Parser.cs982
-rw-r--r--Source/Core/Scanner.cs355
-rw-r--r--Source/Core/StandardVisitor.cs5
-rw-r--r--Source/Core/Util.cs10
-rw-r--r--Source/Dafny/DafnyPipeline.csproj4
-rw-r--r--Source/DafnyDriver/DafnyDriver.cs4
-rw-r--r--Source/DafnyDriver/DafnyDriver.csproj3
-rw-r--r--Source/Houdini/Houdini.cs18
-rw-r--r--Source/Houdini/Houdini.csproj4
-rw-r--r--Source/Provers/Isabelle/Isabelle.csproj210
-rw-r--r--Source/Provers/Isabelle/Prover.cs1083
-rw-r--r--Source/Provers/Isabelle/cce.cs193
-rw-r--r--Source/Provers/SMTLib/SMTLib.csproj4
-rw-r--r--Source/Provers/SMTLib/SMTLibLineariser.cs39
-rw-r--r--Source/Provers/SMTLib/SMTLibNamer.cs6
-rw-r--r--Source/Provers/SMTLib/TypeDeclCollector.cs2
-rw-r--r--Source/Provers/Z3api/ContextLayer.cs38
-rw-r--r--Source/Provers/Z3api/TypeAdapter.cs9
-rw-r--r--Source/Provers/Z3api/VCExprVisitor.cs60
-rw-r--r--Source/Provers/Z3api/Z3api.csproj4
-rw-r--r--Source/VCExpr/BigLiteralAbstracter.cs8
-rw-r--r--Source/VCExpr/Boogie2VCExpr.cs77
-rw-r--r--Source/VCExpr/SimplifyLikeLineariser.cs63
-rw-r--r--Source/VCExpr/TypeErasure.cs48
-rw-r--r--Source/VCExpr/VCExpr.csproj4
-rw-r--r--Source/VCExpr/VCExprAST.cs74
-rw-r--r--Source/VCExpr/VCExprASTPrinter.cs24
-rw-r--r--Source/VCExpr/VCExprASTVisitors.cs40
-rw-r--r--Source/VCGeneration/ConditionGeneration.cs1
-rw-r--r--Source/VCGeneration/DoomCheck.cs1
-rw-r--r--Source/VCGeneration/DoomErrorHandler.cs1
-rw-r--r--Source/VCGeneration/DoomedLoopUnrolling.cs1
-rw-r--r--Source/VCGeneration/DoomedStrategy.cs1
-rw-r--r--Source/VCGeneration/HasseDiagram.cs1
-rw-r--r--Source/VCGeneration/StratifiedVC.cs1
-rw-r--r--Source/VCGeneration/VC.cs1
-rw-r--r--Source/VCGeneration/VCDoomed.cs1
-rw-r--r--Source/VCGeneration/VCGeneration.csproj438
-rw-r--r--Test/aitest0/Answer28
-rw-r--r--Test/aitest0/runtest.bat2
-rw-r--r--Test/aitest1/Answer69
-rw-r--r--Test/aitest1/runtest.bat4
-rw-r--r--Test/aitest9/runtest.bat2
-rw-r--r--Test/dafny0/Answer16
-rw-r--r--Test/dafny0/CoPredicates.dfy11
-rw-r--r--Test/dafny2/COST-verif-comp-2011-4-FloydCycleDetect.dfy9
-rw-r--r--Test/inline/Answer6
-rw-r--r--Test/livevars/bla1.bpl2
-rw-r--r--Test/livevars/daytona_bug2_ioctl_example_1.bpl2
-rw-r--r--Test/livevars/daytona_bug2_ioctl_example_2.bpl2
-rw-r--r--Test/livevars/stack_overflow.bpl2
-rw-r--r--Test/prover/Answer16
-rw-r--r--Test/prover/EQ_v2.Eval__v4.Eval_out.bpl4
-rw-r--r--Test/test0/Answer40
-rw-r--r--Test/test0/BadLabels1.bpl2
-rw-r--r--Test/test0/ModifiedBag.bpl2
-rw-r--r--Test/test0/PrettyPrint.bpl25
-rw-r--r--Test/test0/Prog0.bpl2
-rw-r--r--Test/test1/Answer19
-rw-r--r--Test/test1/IntReal.bpl48
-rw-r--r--Test/test1/runtest.bat1
-rw-r--r--Test/test15/Answer120
-rw-r--r--Test/test2/strings-no-where.bpl22
-rw-r--r--Test/test2/strings-where.bpl22
-rw-r--r--Test/test20/Answer8
-rw-r--r--Test/test20/Prog0.bpl2
-rw-r--r--Test/test20/Prog1.bpl2
-rw-r--r--Test/test21/Answer9
-rw-r--r--Test/test21/Real.bpl17
-rw-r--r--Test/test21/runtest.bat4
-rw-r--r--Util/Emacs/boogie-mode.el2
-rw-r--r--Util/VS2010/Boogie/BoogieLanguageService/Grammar.cs7
-rw-r--r--Util/VS2010/DafnyExtension/DafnyExtension.sln4
-rw-r--r--Util/VS2010/DafnyExtension/DafnyExtension/DafnyExtension.csproj14
-rw-r--r--Util/VS2010/DafnyExtension/DafnyExtension/source.extension.vsixmanifest3
-rw-r--r--Util/latex/boogie.sty2
-rw-r--r--Util/vim/syntax/boogie.vim2
-rw-r--r--_admin/Boogie/aste/summary.log33
102 files changed, 2563 insertions, 5131 deletions
diff --git a/Binaries/DafnyPrelude.bpl b/Binaries/DafnyPrelude.bpl
index ca526173..53e8e86a 100644
--- a/Binaries/DafnyPrelude.bpl
+++ b/Binaries/DafnyPrelude.bpl
@@ -613,15 +613,15 @@ var $Tick: TickType;
// -- Arithmetic -------------------------------------------------
// ---------------------------------------------------------------
-// the connection between % and /
-axiom (forall x:int, y:int :: {x % y} {x / y} x % y == x - x / y * y);
+// the connection between mod and div
+axiom (forall x:int, y:int :: {x mod y} {x div y} x mod y == x - x div y * y);
// remainder is always Euclidean Modulus.
-axiom (forall x:int, y:int :: {x % y} 0 < y ==> 0 <= x % y && x % y < y);
-axiom (forall x:int, y:int :: {x % y} y < 0 ==> 0 <= x % y && x % y < -y);
+axiom (forall x:int, y:int :: {x mod y} 0 < y ==> 0 <= x mod y && x mod y < y);
+axiom (forall x:int, y:int :: {x mod y} y < 0 ==> 0 <= x mod y && x mod y < -y);
-// the following axiom has some unfortunate matching, but it does state a property about % that
+// the following axiom has some unfortunate matching, but it does state a property about mod that
// is sometimes useful
-axiom (forall a: int, b: int, d: int :: { a % d, b % d } 2 <= d && a % d == b % d && a < b ==> a + d <= b);
+axiom (forall a: int, b: int, d: int :: { a mod d, b mod d } 2 <= d && a mod d == b mod d && a < b ==> a + d <= b);
// ---------------------------------------------------------------
diff --git a/Binaries/UnivBackPred2.smt2 b/Binaries/UnivBackPred2.smt2
index d3e3777f..9bb05bfb 100644
--- a/Binaries/UnivBackPred2.smt2
+++ b/Binaries/UnivBackPred2.smt2
@@ -3,7 +3,6 @@
(set-info :category "industrial")
(declare-sort |T@U| 0)
(declare-sort |T@T| 0)
-(declare-fun int_div (Int Int) Int)
-(declare-fun int_mod (Int Int) Int)
+(declare-fun real_pow (Real Real) Real)
(declare-fun UOrdering2 (|T@U| |T@U|) Bool)
(declare-fun UOrdering3 (|T@T| |T@U| |T@U|) Bool)
diff --git a/Chalice/src/main/scala/Translator.scala b/Chalice/src/main/scala/Translator.scala
index f661e51c..ccdcf57d 100644
--- a/Chalice/src/main/scala/Translator.scala
+++ b/Chalice/src/main/scala/Translator.scala
@@ -2135,11 +2135,8 @@ class ExpressionTranslator(val globals: Globals, preGlobals: Globals, val fpi: F
val fullArgs = if (!fapp.f.isStatic) (obj :: processedArgs) else (processedArgs)
val noOldETran = this.UseCurrentAsOld();
val trArgs = fullArgs map {arg => noOldETran.Tr(arg)} // translate args
- val precs = Preconditions(fapp.f.spec) map (p => SubstVars(p, obj, fapp.f.ins, processedArgs))
- val pre = precs.foldLeft(BoolLiteral(true): Expression)({ (a, b) => And(a, b) });
- val partialHeap = functionDependencies(pre, etran);
- val frameFunctionName = "#" + functionName(fapp.f);
- functions ::= (FunctionApp(frameFunctionName, partialHeap :: trArgs),containedVars,extraVars)
+ val triggerFunctionName = functionName(fapp.f) + "#limited#trigger";
+ functions ::= (FunctionApp(triggerFunctionName, trArgs),containedVars,extraVars)
}
case _ =>}
}
diff --git a/Chalice/tests/general-tests/ll-lastnode.chalice b/Chalice/tests/general-tests/ll-lastnode.chalice
new file mode 100644
index 00000000..f7a44cfe
--- /dev/null
+++ b/Chalice/tests/general-tests/ll-lastnode.chalice
@@ -0,0 +1,82 @@
+// This test case showed a triggering problem (and potentially a matching loop).
+// The quantified assertion and postcondition that did not verify are highlighted below.
+class Node
+{
+ var val:int
+ var next:Node
+ var break_here:bool
+
+ predicate lseg
+ {
+ acc(break_here) && (!break_here ==> acc(val) && acc(next) && (next!=null ==> next.lseg))
+ }
+
+ predicate xlseg
+ {
+ acc(val) && acc(next) && (next!=null ==> next.lseg)
+ }
+
+ function length():int
+ requires lseg
+ ensures 0 <= result
+ {
+ unfolding lseg in (break_here ? 0 : (next==null ? 1 : 1+next.length()))
+ }
+
+ function xlength():int
+ requires xlseg
+ ensures 0 < result
+ {
+ unfolding xlseg in (next==null ? 1 : 1+next.length())
+ }
+
+ function get(i:int):int
+ requires lseg && i>=0 && i<length()
+ {
+ unfolding lseg in i==0 ? val : next.get(i-1)
+ }
+
+ function xget(i:int):int
+ requires xlseg && i>=0 && i<xlength()
+ {
+ unfolding xlseg in i==0 ? val : next.get(i-1)
+ }
+
+ function get_next_seg():Node
+ requires lseg
+ {
+ unfolding lseg in break_here ? this : (next==null ? next : next.get_next_seg())
+ }
+
+ method lastNode() returns(res:Node)
+ requires lseg && length()>0
+ ensures res != null && lseg && res.xlseg
+ ensures res.xlength()==1 && res.xget(0)==old(get(length()-1))
+ ensures length() == old(length()-1)
+ // Did not verify.
+ ensures (forall i:int :: 0<=i && i<length() ==> get(i) == old(get(i)))
+ {
+ var I:int
+ var h:Node
+
+ res:=this
+ unfold lseg
+ break_here:=true
+ fold lseg
+ fold xlseg
+
+ while(res.xlength()>1)
+ invariant res!=null && lseg && res.xlseg &&
+ res==get_next_seg() && // new invariant
+ length() + res.xlength() == old(length()) &&
+ 0 <= length() && length() < old(length()) &&
+ (forall i:int :: 0<=i && i<length() ==> get(i)==old(get(i))) &&
+ (forall i:int :: length()<=i && i<old(length()) ==> res.xget(i-length())==old(get(i)))
+ {
+ // We are not interested (at the moment) in verifying the loop.
+ assume false
+ }
+ // Did not verify.
+ assert (forall i:int :: length()<=i && i<old(length()) ==> res.xget(i-length())==old(get(i)))
+ }
+} \ No newline at end of file
diff --git a/Chalice/tests/general-tests/ll-lastnode.output.txt b/Chalice/tests/general-tests/ll-lastnode.output.txt
new file mode 100644
index 00000000..a02dd2d8
--- /dev/null
+++ b/Chalice/tests/general-tests/ll-lastnode.output.txt
@@ -0,0 +1,6 @@
+Verification of ll-lastnode.chalice using parameters=""
+
+
+ 77.9: Assumption introduces a contradiction.
+
+Boogie program verifier finished with 0 errors and 1 smoke test warnings
diff --git a/Source/AbsInt/AbsInt.csproj b/Source/AbsInt/AbsInt.csproj
index 9ccd0ffe..7e421eb1 100644
--- a/Source/AbsInt/AbsInt.csproj
+++ b/Source/AbsInt/AbsInt.csproj
@@ -212,20 +212,13 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Compile Include="AbstractInterpretation.cs" />
- <Compile Include="ExprFactories.cs" />
<Compile Include="IntervalDomain.cs" />
- <Compile Include="LoopInvariantsOnDemand.cs" />
<Compile Include="TrivialDomain.cs" />
<Compile Include="NativeLattice.cs" />
<Compile Include="Traverse.cs" />
<Compile Include="..\version.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\AIFramework\AIFramework.csproj">
- <Project>{39B0658D-C955-41C5-9A43-48C97A1EF5FD}</Project>
- <Name>AIFramework</Name>
- </ProjectReference>
<ProjectReference Include="..\Basetypes\Basetypes.csproj">
<Project>{43DFAD18-3E35-4558-9BE2-CAFF6B5BA8A0}</Project>
<Name>Basetypes</Name>
diff --git a/Source/AbsInt/AbstractInterpretation.cs b/Source/AbsInt/AbstractInterpretation.cs
deleted file mode 100644
index d69c624a..00000000
--- a/Source/AbsInt/AbstractInterpretation.cs
+++ /dev/null
@@ -1,916 +0,0 @@
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) Microsoft Corporation. All Rights Reserved.
-//
-//-----------------------------------------------------------------------------
-
-namespace Microsoft.Boogie.AbstractInterpretation {
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.Contracts;
- using Microsoft.Boogie;
- using System.Linq;
- using AI = Microsoft.AbstractInterpretationFramework;
-
-
- /// <summary>
- /// Defines invariant propagation methods over ASTs for an abstract interpretation policy.
- /// </summary>
- public class AbstractionEngine {
- private AI.Lattice lattice;
- private Queue<ProcedureWorkItem> procWorkItems; //PM: changed to generic queue
- private Queue/*<CallSite>*/ callReturnWorkItems;
-
- [ContractInvariantMethod]
- void ObjectInvariant() {
- Contract.Invariant(lattice != null);
- Contract.Invariant(procWorkItems != null);
- Contract.Invariant(callReturnWorkItems != null);
- }
-
-
- private class ProcedureWorkItem {
- [Rep] // KRML: this doesn't seem like the right designation to me; but I'm not sure what is
- public Procedure Proc;
-
- public int Index; // pre state is Impl.Summary[Index]
- [ContractInvariantMethod]
- void ObjectInvariant() {
- Contract.Invariant(Proc != null);
- Contract.Invariant(0 <= Index && Index < Proc.Summary.Count);
- Contract.Invariant(log != null);
- }
-
- public ProcedureWorkItem([Captured] Procedure p, AI.Lattice.Element v, AI.Lattice lattice) {
- Contract.Requires(p != null);
- Contract.Requires(v != null);
- Contract.Requires(lattice != null);
-
- Contract.Ensures(p == Proc);
- this.Proc = p;
- p.Summary.Add(new ProcedureSummaryEntry(lattice, v));
- this.Index = p.Summary.Count - 1;
- // KRML: axioms are now in place: assume 0 <= Index && Index < Proc.Summary.Count; //PM: Should not be necessary once axioms for pure methods are there
- }
- }
-
- private readonly static AI.Logger log = new AI.Logger("Engine");
-
-
- public AbstractionEngine(AI.Lattice lattice) {
- Contract.Requires(lattice != null);
- Contract.Assume(cce.IsExposable(log)); //PM: One would need static class invariants to prove this property
- cce.BeginExpose(log);
- log.Enabled = AI.Lattice.LogSwitch;
- cce.EndExpose();
- this.lattice = lattice;
- this.procWorkItems = new Queue<ProcedureWorkItem>();
- this.callReturnWorkItems = new Queue();
- }
-
- public static Dictionary<Procedure, Implementation[]> ComputeProcImplMap(Program program) {
- Contract.Requires(program != null);
- // Since implementations call procedures (impl. signatures)
- // rather than directly calling other implementations, we first
- // need to compute which implementations implement which
- // procedures and remember which implementations call which
- // procedures.
-
- return program
- .TopLevelDeclarations
- .Where(d => d is Implementation).Select(i => (Implementation)i)
- .GroupBy(i => i.Proc).Select(g => g.ToArray()).ToDictionary(a => a[0].Proc);
-
- }
-
- public AI.Lattice.Element ApplyProcedureSummary(CallCmd call, Implementation caller, AI.Lattice.Element knownAtCallSite, CallSite callSite) {
- Contract.Requires(call.Proc != null);
- Contract.Requires(call != null);
- Contract.Requires(caller != null);
- Contract.Requires(knownAtCallSite != null);
- Contract.Requires(callSite != null);
-
- Contract.Ensures(Contract.Result<AI.Lattice.Element>() != null);
- Procedure proc = call.Proc;//Precondition required that call.Proc !=null, therefore no assert necessarry.
-
- // NOTE: Here, we count on the fact that an implementation's variables
- // are distinct from an implementation's procedure's variables. So, even for
- // a recursive implementation, we're free to use the implementation's
- // procedure's input parameters as though they were temporary local variables.
- //
- // Hence, in the program
- // procedure Foo (i:int); implementation Foo (i':int) { ...call Foo(i'+1)... }
- // we can treat the recursive call as
- // i:=i'+1; call Foo(i);
- // where the notation i' means a variable with the same (string) name as i,
- // but a different identity.
-
- AI.Lattice.Element relevantToCall = knownAtCallSite; //Precondition of the method implies that this can never be null, therefore no need for an assert.
- for (int i = 0; i < proc.InParams.Length; i++) {
- // "Assign" the actual expressions to the corresponding formal variables.
- Contract.Assume(proc.InParams[i] != null); //PM: this can be fixed once VariableSeq is replaced by List<Variable!>;
- Contract.Assume(call.Ins[i] != null); //PM: this can be fixed once VariableSeq is replaced by List<Variable!>;
- Expr equality = Expr.Eq(Expr.Ident(cce.NonNull(proc.InParams[i])), cce.NonNull(call.Ins[i]));
- relevantToCall = lattice.Constrain(relevantToCall, equality.IExpr);
- }
- foreach (Variable var in caller.LocVars) {
- Contract.Assert(var != null);
- relevantToCall = this.lattice.Eliminate(relevantToCall, var);
- }
-
- ProcedureSummary summary = proc.Summary;
- Contract.Assert(summary != null);
- ProcedureSummaryEntry applicableEntry = null;
-
- for (int i = 0; i < summary.Count; i++) {
- ProcedureSummaryEntry current = cce.NonNull(summary[i]);
-
- if (lattice.Equivalent(current.OnEntry, relevantToCall)) {
- applicableEntry = current;
- break;
- }
- }
-
- // Not found in current map, so add new entry.
- if (applicableEntry == null) {
- ProcedureWorkItem newWorkItem = new ProcedureWorkItem(proc, relevantToCall, lattice);
- Contract.Assert(newWorkItem != null);
- this.procWorkItems.Enqueue(newWorkItem);
- applicableEntry = cce.NonNull(proc.Summary[newWorkItem.Index]);
- }
- applicableEntry.ReturnPoints.Add(callSite);
-
-
- AI.Lattice.Element atReturn = applicableEntry.OnExit;
-
- for (int i = 0; i < call.Outs.Count; i++) {
- atReturn = this.lattice.Rename(atReturn, cce.NonNull(call.Proc.OutParams[i]), cce.NonNull(cce.NonNull(call.Outs[i]).Decl));
- knownAtCallSite = this.lattice.Eliminate(knownAtCallSite, cce.NonNull(cce.NonNull(call.Outs[i]).Decl));
- }
-
- return this.lattice.Meet(atReturn, knownAtCallSite);
- }
-
- /// <summary>
- /// Compute the invariants for the program using the underlying abstract domain
- /// </summary>
- public void ComputeProgramInvariants(Program program) {
- Contract.Requires(program != null);
-
- Dictionary<Procedure, Implementation[]> procedureImplementations = ComputeProcImplMap(program);
- //the line above, ergo there is no need for
- //an assert after this statement to maintain
- //the non-null type.
- AI.Lattice.Element initialElement = this.lattice.Top;
- Contract.Assert(initialElement != null);
- // Gather all the axioms to create the initial lattice element
- // Differently stated, it is the \alpha from axioms (i.e. first order formulae) to the underlyng abstract domain
-
- foreach (Declaration decl in program.TopLevelDeclarations) {
- Axiom ax = decl as Axiom;
- if (ax != null) {
- initialElement = this.lattice.Constrain(initialElement, ax.Expr.IExpr);
- }
- }
-
- // propagate over all procedures...
- foreach (Declaration decl in program.TopLevelDeclarations) {
- Procedure proc = decl as Procedure;
- if (proc != null) {
- this.procWorkItems.Enqueue(new ProcedureWorkItem(proc, initialElement, this.lattice));
- }
- }
-
- // analyze all the procedures...
- while (this.procWorkItems.Count + this.callReturnWorkItems.Count > 0) {
- while (this.procWorkItems.Count > 0) {
- ProcedureWorkItem workItem = this.procWorkItems.Dequeue();
-
- ProcedureSummaryEntry summaryEntry = cce.NonNull(workItem.Proc.Summary[workItem.Index]);
- if (!procedureImplementations.ContainsKey(workItem.Proc)) {
- // This procedure has no given implementations. We therefore treat the procedure
- // according to its specification only.
-
- if (!CommandLineOptions.Clo.IntraproceduralInfer) {
- AI.Lattice.Element post = summaryEntry.OnEntry;
- // BUGBUG. Here, we should process "post" according to the requires, modifies, ensures
- // specification of the procedure, including any OLD expressions in the postcondition.
- AI.Lattice.Element atReturn = post;
-
- if (!this.lattice.LowerThan(atReturn, summaryEntry.OnExit)) {
- // If the results of this analysis are strictly worse than
- // what we previous knew for the same input assumptions,
- // update the summary and re-do the call sites.
-
- summaryEntry.OnExit = this.lattice.Join(summaryEntry.OnExit, atReturn);
-
- foreach (CallSite callSite in summaryEntry.ReturnPoints) {
- this.callReturnWorkItems.Enqueue(callSite);
- }
- }
- }
- } else {
- // There are implementations, so do inference based on those implementations
-
- if (!CommandLineOptions.Clo.IntraproceduralInfer) {
- summaryEntry.OnExit = lattice.Bottom;
- }
-
- // For each implementation in the procedure...
- foreach (Implementation impl in cce.NonNull(procedureImplementations[workItem.Proc])) {
- // process each procedure implementation by recursively processing the first (entry) block...
- cce.NonNull(impl.Blocks[0]).Lattice = lattice;
- ComputeBlockInvariants(impl, cce.NonNull(impl.Blocks[0]), summaryEntry.OnEntry, summaryEntry);
- AdjustProcedureSummary(impl, summaryEntry);
- }
- }
- }
-
-
- while (this.callReturnWorkItems.Count > 0) {
- CallSite callSite = cce.NonNull((CallSite)this.callReturnWorkItems.Dequeue());
-
- PropagateStartingAtStatement(callSite.Impl, callSite.Block, callSite.Statement, callSite.KnownBeforeCall, callSite.SummaryEntry);
- AdjustProcedureSummary(callSite.Impl, callSite.SummaryEntry);
- }
-
- } // both queues
-
- }
-
- void AdjustProcedureSummary(Implementation impl, ProcedureSummaryEntry summaryEntry) {
- Contract.Requires(impl != null);
- Contract.Requires(summaryEntry != null);
- if (CommandLineOptions.Clo.IntraproceduralInfer) {
- return; // no summary to adjust
- }
-
- // compute the procedure invariant by joining all terminal block invariants...
- AI.Lattice.Element post = lattice.Bottom;
- foreach (Block block in impl.Blocks) {
- if (block.TransferCmd is ReturnCmd) {
- // note: if program control cannot reach this block, then postValue will be null
- if (block.PostInvariant != null) {
- post = (AI.Lattice.Element)lattice.Join(post, block.PostInvariant);
- }
- }
- }
-
- AI.Lattice.Element atReturn = post;
- foreach (Variable var in impl.LocVars) {
- Contract.Assert(var != null);
- atReturn = this.lattice.Eliminate(atReturn, var);
- }
- foreach (Variable var in impl.InParams) {
- Contract.Assert(var != null);
- atReturn = this.lattice.Eliminate(atReturn, var);
- }
-
- if (!this.lattice.LowerThan(atReturn, summaryEntry.OnExit)) {
- // If the results of this analysis are strictly worse than
- // what we previous knew for the same input assumptions,
- // update the summary and re-do the call sites.
-
- summaryEntry.OnExit = this.lattice.Join(summaryEntry.OnExit, atReturn);
-
- foreach (CallSite callSite in summaryEntry.ReturnPoints) {
- Contract.Assert(callSite != null);
- this.callReturnWorkItems.Enqueue(callSite);
- }
- }
- }
-
- private static int freshVarId = 0;
- private static Variable FreshVar(Boogie.Type ty) {
- Contract.Requires(ty != null);
- Contract.Ensures(Contract.Result<Variable>() != null);
-
- Variable fresh = new LocalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "fresh" + freshVarId, ty));
- freshVarId++;
- return fresh;
- }
-
- private delegate CallSite/*!*/ MarkCallSite(AI.Lattice.Element/*!*/ currentValue);
-
- /// <summary>
- /// Given a basic block, it propagates the abstract state at the entry point through the exit point of the block
- /// <param name="impl"> The implementation that owns the block </param>
- /// <param name="block"> The from where we propagate </param>
- /// <param name="statementIndex"> </param>
- /// <param name="currentValue"> The initial value </param>
- /// </summary>
- private void PropagateStartingAtStatement(Implementation/*!*/ impl, Block/*!*/ block, int statementIndex, AI.Lattice.Element/*!*/ currentValue,
- ProcedureSummaryEntry/*!*/ summaryEntry) {
- Contract.Requires(impl != null);
- Contract.Requires(block != null);
- Contract.Requires(currentValue != null);
- Contract.Requires(summaryEntry != null);
- Contract.Assume(cce.IsPeerConsistent(log));
- log.DbgMsg(string.Format("{0}:", block.Label));
- log.DbgMsgIndent();
-
- #region Apply the abstract transition relation to the statements in the block
- for (int cmdIndex = statementIndex; cmdIndex < block.Cmds.Length; cmdIndex++) {
- Cmd cmd = cce.NonNull(block.Cmds[cmdIndex]); // Fetch the command
- currentValue = Step(cmd, currentValue, impl, // Apply the transition function
- delegate(AI.Lattice.Element cv) {
- Contract.Requires(cv != null);
- return new CallSite(impl, block, cmdIndex, cv, summaryEntry);
- }
- );
- }
-
- block.PostInvariant = currentValue; // The invariant at the exit point of the block is that of the last statement
-
- log.DbgMsg(string.Format("pre {0}", cce.NonNull(block.PreInvariant).ToString()));
- log.DbgMsg(string.Format("post {0}", (block.PostInvariant).ToString()));
- log.DbgMsgUnindent();
- #endregion
- #region Propagate the post-condition to the successor nodes
- GotoCmd @goto = block.TransferCmd as GotoCmd;
- if (@goto != null) {
- // labelTargets is non-null after calling Resolve in a prior phase.
- Contract.Assume(@goto.labelTargets != null);
-
- // For all the successors of this block, propagate the abstract state
- foreach (Block succ in @goto.labelTargets) {
- Contract.Assert(succ != null);
- if (impl.Blocks.Contains(succ)) {
- succ.Lattice = block.Lattice; // The lattice is the same
- // Propagate the post-abstract state of this block to the successor
- ComputeBlockInvariants(impl, succ, block.PostInvariant, summaryEntry);
- }
- }
- }
- #endregion
- }
-
- /// <summary>
- /// The abstract transition relation.
- /// </summary>
- private AI.Lattice.Element Step(Cmd cmd, AI.Lattice.Element pre, Implementation impl, MarkCallSite/*?*/ callSiteMarker) {
- Contract.Requires(cmd != null);
- Contract.Requires(pre != null);
- Contract.Requires(impl != null);
- Contract.Ensures(Contract.Result<AI.Lattice.Element>() != null);
-
- Contract.Assume(cce.IsPeerConsistent(log));
- log.DbgMsg(string.Format("{0}", cmd));
- log.DbgMsgIndent();
-
- AI.Lattice.Element currentValue = pre;//Nonnullability was a precondition
-
- // Case split...
- #region AssignCmd
- if (cmd is AssignCmd) { // parallel assignment
- // we first eliminate map assignments
- AssignCmd assmt = cce.NonNull((AssignCmd)cmd).AsSimpleAssignCmd;
- //PM: Assume variables have been resolved
- Contract.Assume(Contract.ForAll<AssignLhs>(assmt.Lhss, lhs => lhs.DeepAssignedVariable != null));//TODO: Check my work, please, Mike.
-
- List<IdentifierExpr/*!>!*/> freshLhs = new List<IdentifierExpr/*!*/>();
- foreach (AssignLhs lhs in assmt.Lhss) {
- Contract.Assert(lhs != null);
- freshLhs.Add(Expr.Ident(FreshVar(cce.NonNull(lhs.DeepAssignedVariable)
- .TypedIdent.Type)));
- }
-
- for (int i = 0; i < freshLhs.Count; ++i)
- currentValue =
- this.lattice.Constrain(currentValue,
- Expr.Eq(freshLhs[i], assmt.Rhss[i]).IExpr);
- foreach (AssignLhs lhs in assmt.Lhss) {
- Contract.Assert(lhs != null);
- currentValue =
- this.lattice.Eliminate(currentValue, cce.NonNull(lhs.DeepAssignedVariable));
- }
- for (int i = 0; i < freshLhs.Count; ++i)
- currentValue =
- this.lattice.Rename(currentValue, cce.NonNull(freshLhs[i].Decl),
- cce.NonNull(assmt.Lhss[i].DeepAssignedVariable));
- }
-
- /*
- if (cmd is SimpleAssignCmd)
- {
- SimpleAssignCmd! assmt = (SimpleAssignCmd)cmd;
- assume assmt.Lhs.Decl != null; //PM: Assume variables have been resolved
- Variable! dest = assmt.Lhs.Decl;
- Variable! fresh = FreshVar(dest.TypedIdent.Type);
- IdentifierExpr newLhs = Expr.Ident(fresh);
- Expr equality = Expr.Eq(newLhs, assmt.Rhs);
-
- currentValue = this.lattice.Constrain(currentValue, equality.IExpr);
- currentValue = this.lattice.Eliminate(currentValue, dest);
- currentValue = this.lattice.Rename(currentValue, fresh, dest);
- }
- #endregion
- #region ArrayAssignCmd
- else if (cmd is ArrayAssignCmd)
- {
- ArrayAssignCmd assmt = (ArrayAssignCmd)cmd;
-
- assume assmt.Array.Type != null; //PM: assume that type checker has run
- ArrayType! arrayType = (ArrayType)assmt.Array.Type;
-
- Variable newHeapVar = FreshVar(arrayType);
- IdentifierExpr newHeap = Expr.Ident(newHeapVar);
- IdentifierExpr oldHeap = assmt.Array;
- assume oldHeap.Decl != null; //PM: assume that variable has been resolved
-
- // For now, we only know how to handle heaps
- if (arrayType.IndexType0.IsRef && arrayType.IndexType1 != null && arrayType.IndexType1.IsName)
- {
- //PM: The following assertion follows from a nontrivial invariant of ArrayAssignCmd,
- //PM: which we do not have yet. Therefore, we put in an assume fo now.
- assume assmt.Index1 != null;
- assert assmt.Index1 != null;
- // heap succession predicate
- Expr heapsucc = Expr.HeapSucc(oldHeap, newHeap, assmt.Index0, assmt.Index1);
-
- currentValue = this.lattice.Constrain(currentValue, heapsucc.IExpr);
-
- }
- else
- {
- // TODO: We can do this case as well if the heap succession array can handle non-heap arrays
- }
- // new select expression
- IndexedExpr newLhs = new IndexedExpr(Token.NoToken, newHeap, assmt.Index0, assmt.Index1);
- Expr equality = Expr.Eq(newLhs, assmt.Rhs);
-
- currentValue = this.lattice.Constrain(currentValue, equality.IExpr);
- currentValue = this.lattice.Eliminate(currentValue, oldHeap.Decl);
- currentValue = this.lattice.Rename(currentValue, newHeapVar, oldHeap.Decl);
-
-
- } */
- #endregion
- #region Havoc
- else if (cmd is HavocCmd) {
- HavocCmd havoc = (HavocCmd)cmd;
- foreach (IdentifierExpr id in havoc.Vars) {
- Contract.Assert(id != null);
- currentValue = this.lattice.Eliminate(currentValue, cce.NonNull(id.Decl));
- }
- }
- #endregion
- #region PredicateCmd
- else if (cmd is PredicateCmd) {
- //System.Console.WriteLine("Abstract State BEFORE " + ((PredicateCmd) cmd).Expr + " : " +this.lattice.ToPredicate(currentValue));
-
- Expr embeddedExpr = cce.NonNull((PredicateCmd)cmd).Expr;
- List<Expr/*!>!*/> conjuncts = flatConjunction(embeddedExpr); // Handle "assume P && Q" as if it was "assume P; assume Q"
- Contract.Assert(conjuncts != null);
- foreach (Expr c in conjuncts) {
- Contract.Assert(c != null);
- currentValue = this.lattice.Constrain(currentValue, c.IExpr);
- }
-
- //System.Console.WriteLine("Abstract State AFTER assert/assume "+ this.lattice.ToPredicate(currentValue));
- }
- #endregion
- #region CallCmd
- else if (cmd is CallCmd) {
- CallCmd call = (CallCmd)cmd;
-
- if (!CommandLineOptions.Clo.IntraproceduralInfer) {
- // Interprocedural analysis
-
- if (callSiteMarker == null) {
- throw new System.InvalidOperationException("INTERNAL ERROR: Context does not allow CallCmd.");
- }
-
- CallSite here = callSiteMarker(currentValue);
- currentValue = ApplyProcedureSummary(call, impl, currentValue, here);
- } else {
- // Intraprocedural analysis
-
- StateCmd statecmd = call.Desugaring as StateCmd;
- if (statecmd != null) {
- // Iterate the abstract transition on all the commands in the desugaring of the call
- foreach (Cmd callDesug in statecmd.Cmds) {
- Contract.Assert(callDesug != null);
- currentValue = Step(callDesug, currentValue, impl, null);
- }
-
- // Now, project out the local variables
- foreach (Variable local in statecmd.Locals) {
- Contract.Assert(local != null);
- currentValue = this.lattice.Eliminate(currentValue, local);
- }
- } else
- throw new System.InvalidOperationException("INTERNAL ERROR: CallCmd does not desugar to StateCmd.");
- }
- }
- #endregion
- #region CommentCmd
- else if (cmd is CommentCmd) {
- // skip
- }
- #endregion
- else if (cmd is SugaredCmd) {
- // other sugared commands are treated like their desugaring
- SugaredCmd sugar = (SugaredCmd)cmd;
- Cmd desugaring = sugar.Desugaring;
- if (desugaring is StateCmd) {
- StateCmd statecmd = (StateCmd)desugaring;
- // Iterate the abstract transition on all the commands in the desugaring of the call
- foreach (Cmd callDesug in statecmd.Cmds) {
- Contract.Assert(callDesug != null);
- currentValue = Step(callDesug, currentValue, impl, null);
- }
- // Now, project out the local variables
- foreach (Variable local in statecmd.Locals) {
- Contract.Assert(local != null);
- currentValue = this.lattice.Eliminate(currentValue, local);
- }
- } else {
- currentValue = Step(desugaring, currentValue, impl, null);
- }
- } else {
- Contract.Assert(false); // unknown command
- throw new cce.UnreachableException();
- }
-
- log.DbgMsgUnindent();
-
- return currentValue;
- }
-
- /// <summary>
- /// Flatten an expresion in the form P AND Q ... AND R into a list [P, Q, ..., R]
- /// </summary>
- private List<Expr/*!>!*/> flatConjunction(Expr embeddedExpr) {
- Contract.Requires(embeddedExpr != null);
- Contract.Ensures(cce.NonNullElements(Contract.Result<List<Expr>>()));
-
- var retValue = new List<Expr/*!*/>();
- NAryExpr e = embeddedExpr as NAryExpr;
- if (e != null && e.Fun.FunctionName.CompareTo("&&") == 0) { // if it is a conjunction
- foreach (Expr arg in e.Args) {
- Contract.Assert(arg != null);
- var newConjuncts = flatConjunction(arg);
- retValue.AddRange(newConjuncts);
- }
- } else {
- retValue.Add(embeddedExpr);
- }
- return retValue;
- }
-
- /// <summary>
- /// Compute the invariants for a basic block
- /// <param name="impl"> The implementation the block belongs to </param>
- /// <param name="block"> The block for which we compute the invariants </param>
- /// <param name="incomingValue"> The "init" abstract state for the block </param>
- /// </summary>
- private void ComputeBlockInvariants(Implementation impl, Block block, AI.Lattice.Element incomingValue, ProcedureSummaryEntry summaryEntry) {
- Contract.Requires(impl != null);
- Contract.Requires(block != null);
- Contract.Requires(incomingValue != null);
- Contract.Requires(summaryEntry != null);
- if (block.PreInvariant == null) // block has not yet been processed
- {
- Contract.Assert(block.PostInvariant == null);
-
- // To a first approximation the block is unreachable
- block.PreInvariant = this.lattice.Bottom;
- block.PostInvariant = this.lattice.Bottom;
- }
-
- Contract.Assert(block.PreInvariant != null);
- Contract.Assert(block.PostInvariant != null);
-
- #region Check if we have reached a postfixpoint
-
- if (lattice.LowerThan(incomingValue, block.PreInvariant)) {
- // We have reached a post-fixpoint, so we are done...
-#if DEBUG_PRINT
- System.Console.WriteLine("@@ Compared for block {0}:", block.Label);
- System.Console.WriteLine("@@ {0}", lattice.ToPredicate(incomingValue));
- System.Console.WriteLine("@@ {0}", lattice.ToPredicate(block.PreInvariant));
- System.Console.WriteLine("@@ result = True");
- System.Console.WriteLine("@@ end Compare");
-#endif
- return;
- }
-#if DEBUG_PRINT
- // Compute the free variables in incoming and block.PreInvariant
- FreeVariablesVisitor freeVarsVisitorForA = new FreeVariablesVisitor();
- FreeVariablesVisitor freeVarsVisitorForB = new FreeVariablesVisitor();
-
- lattice.ToPredicate(incomingValue).DoVisit(freeVarsVisitorForA);
- lattice.ToPredicate(block.PreInvariant).DoVisit(freeVarsVisitorForB);
-
- List<AI.IVariable!>! freeVarsOfA = freeVarsVisitorForA.FreeVariables;
- List<AI.IVariable!>! freeVarsOfB = freeVarsVisitorForB.FreeVariables;
-
- System.Console.WriteLine("@@ Compared for block {0}:", block.Label);
- System.Console.WriteLine("@@ Incoming: {0}", lattice.ToPredicate((!) incomingValue));
- System.Console.WriteLine("@@ Free Variables : {0}", ToString(freeVarsOfA));
- System.Console.WriteLine("@@ Previous: {0}", lattice.ToPredicate(block.PreInvariant));
- System.Console.WriteLine("@@ Free Variables : {0}", ToString(freeVarsOfB));
- System.Console.WriteLine("@@ result = False");
- System.Console.WriteLine("@@ end Compare");
- string operation = "";
-#endif
- #endregion
- #region If it is not the case, then join or widen the incoming abstract state with the previous one
- if (block.widenBlock) // If the considered block is the entry point of a loop
- {
- if (block.iterations <= CommandLineOptions.Clo.StepsBeforeWidening + 1) {
-#if DEBUG_PRINT
- operation = "join";
-#endif
- block.PreInvariant = (AI.Lattice.Element)lattice.Join(block.PreInvariant, incomingValue);
- } else {
-#if DEBUG_PRINT
- operation = "widening";
-#endif
-
- // The default is to have have a widening that perform a (approximation of) the closure of the operands, so to improve the precision
- // block.PreInvariant = WideningWithClosure.MorePreciseWiden(lattice, (!) block.PreInvariant, incomingValue);
- block.PreInvariant = (AI.Lattice.Element)lattice.Widen(block.PreInvariant, incomingValue);
- }
- block.iterations++;
- } else {
-#if DEBUG_PRINT
- operation = "join";
-#endif
- block.PreInvariant = (AI.Lattice.Element)lattice.Join(block.PreInvariant, incomingValue);
- }
-
-#if DEBUG_PRINT
- System.Console.WriteLine("@@ {0} for block {1}:", operation, block.Label);
- System.Console.WriteLine("@@ {0}", lattice.ToPredicate(block.PreInvariant));
- System.Console.WriteLine("@@ end");
-#endif
- #endregion
- #region Propagate the entry abstract state through the method
- PropagateStartingAtStatement(impl, block, 0, cce.NonNull(block.PreInvariant.Clone()), summaryEntry);
- #endregion
- }
-
-#if DEBUG_PRINT
- private string! ToString(List<AI.IVariable!>! vars)
- {
- string s = "";
-
- foreach(AI.IVariable! v in vars)
- {
- s += v.Name +" ";
- }
- return s;
- }
-#endif
-
- } // class
-
-
- /// <summary>
- /// Defines a class for building the abstract domain according to the parameters switch
- /// </summary>
- public class AbstractDomainBuilder {
-
- private AbstractDomainBuilder() { /* do nothing */
- }
-
- /// <summary>
- /// Return a fresh instance of the abstract domain of intervals
- /// </summary>
- static public AbstractAlgebra BuildIntervalsAbstractDomain() {
- Contract.Ensures(Contract.Result<AbstractAlgebra>() != null);
-
- AI.IPropExprFactory propfactory = new BoogiePropFactory();
- AI.ILinearExprFactory linearfactory = new BoogieLinearFactory();
- AI.IValueExprFactory valuefactory = new BoogieValueFactory();
- IComparer variableComparer = new VariableComparer();
-
- AbstractAlgebra retAlgebra;
- AI.Lattice intervals = new AI.VariableMapLattice(propfactory, valuefactory, new AI.IntervalLattice(linearfactory), variableComparer);
- Contract.Assert(intervals != null);
- retAlgebra = new AbstractAlgebra(intervals, propfactory, linearfactory, null, valuefactory, null, variableComparer);
-
- return retAlgebra;
- }
-
- /// <summary>
- /// Return a fresh abstract domain, according to the parameters specified by the command line
- /// </summary>
- static public AbstractAlgebra BuildAbstractDomain() {
- Contract.Ensures(Contract.Result<AbstractAlgebra>() != null);
-
- AbstractAlgebra retAlgebra;
-
- AI.Lattice returnLattice;
-
- AI.IPropExprFactory propfactory = new BoogiePropFactory();
- AI.ILinearExprFactory linearfactory = new BoogieLinearFactory();
- AI.IIntExprFactory intfactory = new BoogieIntFactory();
- AI.IValueExprFactory valuefactory = new BoogieValueFactory();
- AI.INullnessFactory nullfactory = new BoogieNullnessFactory();
- IComparer variableComparer = new VariableComparer();
-
- AI.MultiLattice multilattice = new AI.MultiLattice(propfactory, valuefactory);
-
- if (CommandLineOptions.Clo.Ai.Intervals) // Intervals
- {
- multilattice.AddLattice(new AI.VariableMapLattice(propfactory, valuefactory,
- new AI.IntervalLattice(linearfactory),
- variableComparer));
- }
- if (CommandLineOptions.Clo.Ai.Constant) // Constant propagation
-
- {
- multilattice.AddLattice(new AI.VariableMapLattice(propfactory, valuefactory,
- new AI.ConstantLattice(intfactory),
- variableComparer));
- }
- if (CommandLineOptions.Clo.Ai.DynamicType) // Class types
- {
- BoogieTypeFactory typeFactory = new BoogieTypeFactory();
- multilattice.AddLattice(new AI.VariableMapLattice(propfactory, valuefactory,
- new AI.DynamicTypeLattice(typeFactory, propfactory),
- variableComparer));
- }
- if (CommandLineOptions.Clo.Ai.Nullness) // Nullness
- {
- multilattice.AddLattice(new AI.VariableMapLattice(propfactory, valuefactory,
- new AI.NullnessLattice(nullfactory),
- variableComparer));
- }
- if (CommandLineOptions.Clo.Ai.Polyhedra) // Polyhedra
- {
- multilattice.AddLattice(new AI.PolyhedraLattice(linearfactory, propfactory));
- }
-
-
- returnLattice = multilattice;
- if (CommandLineOptions.Clo.Ai.DebugStatistics) {
- returnLattice = new AI.StatisticsLattice(returnLattice);
- }
-
- returnLattice.Validate();
-
- retAlgebra = new AbstractAlgebra(returnLattice, propfactory, linearfactory, intfactory, valuefactory, nullfactory,
- variableComparer);
-
- return retAlgebra;
-
- }
- }
-
- /// <summary>
- /// An Abstract Algebra is a tuple made of a Lattice and several factories
- /// </summary>
- public class AbstractAlgebra {
- [Peer]
- private AI.Lattice lattice;
- [Peer]
- private AI.IPropExprFactory propFactory;
- [Peer]
- private AI.ILinearExprFactory linearFactory;
- [Peer]
- private AI.IIntExprFactory intFactory;
- [Peer]
- private AI.IValueExprFactory valueFactory;
- [Peer]
- private AI.INullnessFactory nullFactory;
- [Peer]
- private IComparer variableComparer;
-
- [ContractInvariantMethod]
- void ObjectInvariant() {
- Contract.Invariant(lattice != null);
- }
-
- public AI.Lattice Lattice {
- get {
- Contract.Ensures(Contract.Result<AI.Lattice>() != null);
-
- return lattice;
- }
- }
-
- public AI.IPropExprFactory PropositionFactory {
- get {
- return this.propFactory;
- }
- }
-
- public AI.ILinearExprFactory LinearExprFactory {
- get {
- return this.linearFactory;
- }
- }
-
- public AI.IIntExprFactory IntExprFactory {
- get {
- return this.intFactory;
- }
- }
-
- public AI.IValueExprFactory ValueFactory {
- get {
- return this.valueFactory;
- }
- }
-
- public AI.INullnessFactory NullFactory {
- get {
- return this.nullFactory;
- }
- }
-
- public IComparer VariableComparer {
- get {
- return this.variableComparer;
- }
- }
-
- [Captured]
- public AbstractAlgebra(AI.Lattice lattice,
- AI.IPropExprFactory propFactory,
- AI.ILinearExprFactory linearFactory,
- AI.IIntExprFactory intFactory,
- AI.IValueExprFactory valueFactory,
- AI.INullnessFactory nullFactory,
- IComparer variableComparer) {
- Contract.Requires(propFactory == null || cce.Owner.Same(lattice, propFactory));//TODO: Owner is Microsoft.Contracts (mscorlib.Contracts).Owner
- Contract.Requires(linearFactory == null || cce.Owner.Same(lattice, linearFactory));
- Contract.Requires(intFactory == null || cce.Owner.Same(lattice, intFactory));
- Contract.Requires(valueFactory == null || cce.Owner.Same(lattice, valueFactory));
- Contract.Requires(nullFactory == null || cce.Owner.Same(lattice, nullFactory));
- Contract.Requires(variableComparer == null || cce.Owner.Same(lattice, variableComparer));
- // ensures Owner.Same(this, lattice); // KRML:
-
- Contract.Requires(lattice != null);
- this.lattice = lattice;
-
- this.propFactory = propFactory;
- this.linearFactory = linearFactory;
- this.intFactory = intFactory;
- this.valueFactory = valueFactory;
- this.nullFactory = nullFactory;
- this.variableComparer = variableComparer;
- }
-
- }
-
- public class AbstractInterpretation {
- /// <summary>
- /// Run the abstract interpretation.
- /// It has two entry points. One is the RunBoogie method. The other is the CCI PlugIn
- /// </summary>
- public static void RunAbstractInterpretation(Program program) {
- Contract.Requires(program != null);
- Helpers.ExtraTraceInformation("Starting abstract interpretation");
-
- if (CommandLineOptions.Clo.UseAbstractInterpretation) {
- DateTime start = new DateTime(); // to please compiler's definite assignment rules
- if (CommandLineOptions.Clo.Trace) {
- Console.WriteLine();
- Console.WriteLine("Running abstract interpretation...");
- start = DateTime.UtcNow;
- }
-
- WidenPoints.Compute(program);
-
- if (CommandLineOptions.Clo.Ai.AnySet) // if there is some user defined domain we override the default (= intervals)
- {
- AI.Lattice lattice = AbstractDomainBuilder.BuildAbstractDomain().Lattice;
- ApplyAbstractInterpretation(program, lattice);
-
- if (CommandLineOptions.Clo.Ai.DebugStatistics) {
- Console.Error.WriteLine(lattice);
- }
- } else // Otherwise the default is the use of the abstract domain of intervals (useful for simple for loops)
- {
- AI.Lattice lattice = AbstractDomainBuilder.BuildIntervalsAbstractDomain().Lattice;
- Contract.Assert(lattice != null);
- ApplyAbstractInterpretation(program, lattice);
- }
-
- program.InstrumentWithInvariants();
-
- if (CommandLineOptions.Clo.Trace) {
- DateTime end = DateTime.UtcNow;
- TimeSpan elapsed = end - start;
- Console.WriteLine(" [{0} s]", elapsed.TotalSeconds);
- Console.Out.Flush();
- }
- }
- }
-
- static void ApplyAbstractInterpretation(Program program, AI.Lattice lattice) {
- Contract.Requires(program != null);
- Contract.Requires(lattice != null);
- AbstractionEngine engine = new AbstractionEngine(lattice);
- engine.ComputeProgramInvariants(program);
- }
- }
-
-} // namespace \ No newline at end of file
diff --git a/Source/AbsInt/ExprFactories.cs b/Source/AbsInt/ExprFactories.cs
deleted file mode 100644
index 9b1ea0a0..00000000
--- a/Source/AbsInt/ExprFactories.cs
+++ /dev/null
@@ -1,275 +0,0 @@
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) Microsoft Corporation. All Rights Reserved.
-//
-//-----------------------------------------------------------------------------
-using Microsoft.Boogie;
-using AI = Microsoft.AbstractInterpretationFramework;
-using System.Diagnostics.Contracts;
-using Microsoft.Basetypes;
-
-namespace Microsoft.Boogie.AbstractInterpretation {
-
- public class BoogiePropFactory : BoogieFactory, AI.IPropExprFactory
- {
- public AI.IFunApp False {
- get {
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
-
- return Expr.False;
- }
- }
- public AI.IFunApp True {
- get {
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
-
- return Expr.True;
- }
- }
-
- public AI.IFunApp Not(AI.IExpr p) {
- //Contract.Requires(p != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
-
- return Expr.Unary(Token.NoToken, UnaryOperator.Opcode.Not, IExpr2Expr(p));
- }
-
- public AI.IFunApp And(AI.IExpr p, AI.IExpr q) {
- //Contract.Requires(p != null);
- //Contract.Requires(q != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
-
- return Expr.Binary(BinaryOperator.Opcode.And, IExpr2Expr(p), IExpr2Expr(q));
- }
-
- public AI.IFunApp Or(AI.IExpr p, AI.IExpr q) {
- //Contract.Requires(p != null);
- //Contract.Requires(q != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- return Expr.Binary(BinaryOperator.Opcode.Or, IExpr2Expr(p), IExpr2Expr(q));
- }
-
- public AI.IFunApp Implies(AI.IExpr p, AI.IExpr q) {
- //Contract.Requires(p != null);
- //Contract.Requires(q != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- return Expr.Binary(BinaryOperator.Opcode.Imp, IExpr2Expr(p), IExpr2Expr(q));
- }
-
- public AI.IFunApp Exists(AI.IFunction p) {
- //Contract.Requires(p != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
-
- return (AI.IFunApp)(new ExistsExpr(Token.NoToken, new VariableSeq((Variable)p.Param), IExpr2Expr(p.Body))).IExpr;
- }
-
- public AI.IFunApp Forall(AI.IFunction p) {
- //Contract.Requires(p != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
-
- return (AI.IFunApp)(new ForallExpr(Token.NoToken, new VariableSeq((Variable)p.Param), IExpr2Expr(p.Body))).IExpr;
- }
- }
-
- public class BoogieValueFactory : BoogieFactory, AI.IValueExprFactory {
- public AI.IFunApp Eq(AI.IExpr e0, AI.IExpr e1) {
- //Contract.Requires(e0 != null);
- //Contract.Requires(e1 != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
-
- return Expr.Eq(IExpr2Expr(e0), IExpr2Expr(e1));
- }
- public AI.IFunApp Neq(AI.IExpr e0, AI.IExpr e1) {
- //Contract.Requires(e0 != null);
- //Contract.Requires(e1 != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- return Expr.Neq(IExpr2Expr(e0), IExpr2Expr(e1));
- }
- }
-
- public class BoogieNullnessFactory : BoogieFactory, AI.INullnessFactory {
- public AI.IFunApp Eq(AI.IExpr e0, AI.IExpr e1) {
- //Contract.Requires(e0 != null);
- //Contract.Requires(e1 != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- return Expr.Eq(IExpr2Expr(e0), IExpr2Expr(e1));
- }
-
- public AI.IFunApp Neq(AI.IExpr e0, AI.IExpr e1) {
- //Contract.Requires(e0 != null);
- //Contract.Requires(e1 != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- return Expr.Neq(IExpr2Expr(e0), IExpr2Expr(e1));
- }
-
- public AI.IFunApp Null {
- get {
- Contract.Assert(false); // don't know where to get null from\
- throw new cce.UnreachableException();
- }
- }
- }
-
- public class BoogieIntFactory : BoogieValueFactory, AI.IIntExprFactory {
- public AI.IFunApp Const(BigNum i) {
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
-
- return new LiteralExpr(Token.NoToken, i);
- }
- }
-
- public class BoogieLinearFactory : BoogieIntFactory, AI.ILinearExprFactory {
- public AI.IFunApp AtMost(AI.IExpr e0, AI.IExpr e1) {
- //Contract.Requires(e0 != null);
- //Contract.Requires(e1 != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- return Expr.Le(IExpr2Expr(e0), IExpr2Expr(e1));
- }
- public AI.IFunApp Add(AI.IExpr e0, AI.IExpr e1) {
- //Contract.Requires(e0 != null);
- //Contract.Requires(e1 != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- return Expr.Add(IExpr2Expr(e0), IExpr2Expr(e1));
- }
- public AI.IExpr Term(Rational r, AI.IVariable var) {
- Contract.Ensures(Contract.Result<AI.IExpr>() != null);
-
- if (var != null && r == Rational.ONE) {
- return var;
- } else {
- Expr product;
- if (r.IsIntegral) {
- product = Expr.Literal(r.AsBigNum);
- } else {
- product = Expr.Div(Expr.Literal(r.Numerator), Expr.Literal(r.Denominator));
- }
- if (var != null) {
- product = Expr.Mul(product, IExpr2Expr(var));
- }
- return product.IExpr;
- }
- }
-
- public AI.IFunApp False {
- get {
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
-
- return Expr.False;
- }
- }
- public AI.IFunApp True {
- get {
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
-
- return Expr.True;
- }
- }
- public AI.IFunApp And(AI.IExpr p, AI.IExpr q) {
- //Contract.Requires(p != null);
- //Contract.Requires(q != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
-
- return Expr.Binary(BinaryOperator.Opcode.And, IExpr2Expr(p), IExpr2Expr(q));
- }
- }
-
- public class BoogieTypeFactory : BoogieFactory, AI.ITypeExprFactory {
- /// <summary>
- /// Returns an expression denoting the top of the type hierarchy.
- /// </summary>
- public AI.IExpr RootType {
- get {
- Contract.Assert(false); // BUGBUG: TODO
- throw new System.NotImplementedException();
- }
- }
-
- /// <summary>
- /// Returns true iff "t" denotes a type constant.
- /// </summary>
- [Pure]
- public bool IsTypeConstant(AI.IExpr t) {
- //Contract.Requires(t != null);
- Contract.Ensures(Contract.Result<bool>() == (t is Constant));
- return t is Constant;
- }
-
- /// <summary>
- /// Returns true iff t0 and t1 are types such that t0 and t1 are equal.
- /// </summary>
- [Pure]
- public bool IsTypeEqual(AI.IExpr t0, AI.IExpr t1) {
- //Contract.Requires(t0 != null);
- //Contract.Requires(t1 != null);
- Constant c0 = t0 as Constant;
- Constant c1 = t1 as Constant;
- return c0 != null && c1 != null && c0 == c1;
- }
-
- /// <summary>
- /// Returns true iff t0 and t1 are types such that t0 is a subtype of t1.
- /// </summary>
- [Pure]
- public bool IsSubType(AI.IExpr t0, AI.IExpr t1) {
- //Contract.Requires(t0 != null);
- //Contract.Requires(t1 != null);
-
- Contract.Assert(false); // BUGBUG: TODO
- throw new cce.UnreachableException();
- }
-
- /// <summary>
- /// Returns the most derived supertype of both "t0" and "t1". A precondition is
- /// that "t0" and "t1" both represent types.
- /// </summary>
- public AI.IExpr JoinTypes(AI.IExpr t0, AI.IExpr t1) {
- //Contract.Requires(t0 != null);
- //Contract.Requires(t1 != null);
- Contract.Ensures(Contract.Result<AI.IExpr>() != null);
-
-
- Contract.Assert(false); // BUGBUG: TODO
- throw new cce.UnreachableException();
- }
-
- public AI.IFunApp IsExactlyA(AI.IExpr e, AI.IExpr type) {
- //PM: We need this assume because Boogie does not yet allow us to use the
- //PM: inherited precondition "requires IsTypeConstant(type)".
- //PM: Note that that precondition is currently commented out.
- //Contract.Requires(e != null);
- //Contract.Requires(type != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
-
- Contract.Assume(type is Constant);
- Constant theType = (Constant)type;
- Contract.Assert(false);
- throw new cce.UnreachableException();
- Expr typeofExpr = new NAryExpr(Token.NoToken,
- new FunctionCall(new IdentifierExpr(Token.NoToken, "$typeof", Type.Int // Name
- )),
- new ExprSeq(IExpr2Expr(e)));
- return Expr.Eq(typeofExpr, Expr.Ident(theType));
- }
-
- public AI.IFunApp IsA(AI.IExpr e, AI.IExpr type) {
- //Contract.Requires(e != null);
- //Contract.Requires(type != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- //PM: We need this assume because Boogie does not yet allow us to use the
- //PM: inherited precondition "requires IsTypeConstant(type)".
- //PM: Note that that precondition is currently commented out.
-
-
- Contract.Assume(type is Constant);
- Contract.Assert(false);
- throw new cce.UnreachableException();
- Expr typeofExpr = new NAryExpr(Token.NoToken,
- new FunctionCall(new IdentifierExpr(Token.NoToken, "$typeof", Type.Int // Name
- )),
- new ExprSeq(IExpr2Expr(e)));
- return new NAryExpr(Token.NoToken,
- new BinaryOperator(Token.NoToken, BinaryOperator.Opcode.Subtype),
- new ExprSeq(typeofExpr, IExpr2Expr(e)));
- }
- }
-}
diff --git a/Source/AbsInt/IntervalDomain.cs b/Source/AbsInt/IntervalDomain.cs
index 247a357d..51391105 100644
--- a/Source/AbsInt/IntervalDomain.cs
+++ b/Source/AbsInt/IntervalDomain.cs
@@ -632,6 +632,10 @@ namespace Microsoft.Boogie.AbstractInterpretation
var n = ((BigNum)node.Val).ToBigInteger;
Lo = n;
Hi = n + 1;
+ } else if (node.Val is BigDec) {
+ var n = ((BigDec)node.Val).Floor(-BigInteger.Pow(10, 12), BigInteger.Pow(10, 12));
+ Lo = n;
+ Hi = n + 1;
} else if (node.Val is bool) {
if ((bool)node.Val) {
// true
@@ -646,7 +650,7 @@ namespace Microsoft.Boogie.AbstractInterpretation
return node;
}
public override Expr VisitIdentifierExpr(IdentifierExpr node) {
- if (node.Type.IsBool || node.Type.IsInt) {
+ if (node.Type.IsBool || node.Type.IsInt || node.Type.IsReal) {
Node.GetBounds(N, node.Decl, out Lo, out Hi);
}
return node;
@@ -655,7 +659,18 @@ namespace Microsoft.Boogie.AbstractInterpretation
if (node.Fun is UnaryOperator) {
var op = (UnaryOperator)node.Fun;
Contract.Assert(node.Args.Length == 1);
- if (op.Op == UnaryOperator.Opcode.Not) {
+ if (op.Op == UnaryOperator.Opcode.Neg) {
+ BigInteger? lo, hi;
+ VisitExpr(node.Args[0]);
+ lo = Lo; hi = Hi;
+ if (hi != null) {
+ Lo = 1 - hi;
+ }
+ if (lo != null) {
+ Hi = -lo;
+ }
+ }
+ else if (op.Op == UnaryOperator.Opcode.Not) {
VisitExpr(node.Args[0]);
Contract.Assert((Lo == null && Hi == null) ||
(Lo == null && (BigInteger)Hi == 1) ||
@@ -803,6 +818,20 @@ namespace Microsoft.Boogie.AbstractInterpretation
Hi = hi1;
}
break;
+ case BinaryOperator.Opcode.RealDiv:
+ // this uses an incomplete approximation that could be tightened up
+ if (lo0 != null && lo1 != null && 0 <= (BigInteger)lo0 && 0 <= (BigInteger)lo1) {
+ Lo = new BigInteger(0);
+ Hi = hi1;
+ }
+ break;
+ case BinaryOperator.Opcode.Pow:
+ // this uses an incomplete approximation that could be tightened up
+ if (lo0 != null && lo1 != null && 0 <= (BigInteger)lo0 && 0 <= (BigInteger)lo1) {
+ Lo = new BigInteger(0);
+ Hi = hi1;
+ }
+ break;
default:
break;
}
diff --git a/Source/AbsInt/LoopInvariantsOnDemand.cs b/Source/AbsInt/LoopInvariantsOnDemand.cs
deleted file mode 100644
index b61b1445..00000000
--- a/Source/AbsInt/LoopInvariantsOnDemand.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) Microsoft Corporation. All Rights Reserved.
-//
-//-----------------------------------------------------------------------------
-namespace Microsoft.Boogie.AbstractInterpretation {
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics.Contracts;
- using AI = Microsoft.AbstractInterpretationFramework;
- using Boogie = Microsoft.Boogie;
-
-
-
- /// <summary>
- /// A visitor of an abstract interpretation expression that collects the free variables
- /// </summary>
- class FreeVariablesVisitor : AI.ExprVisitor {
- [Peer]
- List<AI.IVariable> variables;
- [ContractInvariantMethod]
- void ObjectInvariant() {
- Contract.Invariant(cce.NonNullElements(variables));
- Contract.Invariant(cce.NonNullElements(varNames));
- }
-
- public List<AI.IVariable> FreeVariables {
- get {
- Contract.Ensures(cce.NonNullElements(Contract.Result<List<AI.IVariable>>()));
-
- return this.variables;
- }
- }
-
- List<string> varNames; // used to check the consinstency!
-
- public FreeVariablesVisitor() {
- this.variables = new List<AI.IVariable>();
- this.varNames = new List<string>();
- }
-
- override public object Default(AI.IExpr expr) {
-
- if (expr is AI.IVariable) {
- if (!variables.Contains((AI.IVariable)expr)) {
- this.variables.Add((AI.IVariable)expr);
-
- Contract.Assert(!this.varNames.Contains(expr.ToString())); // If we get there, we have an error: two variables with the same name but different identity
-
- this.varNames.Add(expr.ToString());
- }
- return null;
- } else if (expr is AI.IFunApp)
- return VisitFunApp((AI.IFunApp)expr);
- else if (expr is AI.IFunction)
- return VisitFunction((AI.IFunction)expr);
- else if (expr is AI.IUnknown)
- return null;
- else {
- Contract.Assert(false);
- throw new cce.UnreachableException();
- }
- }
-
- public override object VisitFunApp(AI.IFunApp funapp) {
-
- foreach (AI.IExpr arg in funapp.Arguments) {
- Contract.Assert(arg != null);
- arg.DoVisit(this);
- }
- return true;
- }
-
- public override object VisitFunction(AI.IFunction fun) {
- //Contract.Requires(fun != null);
- fun.Body.DoVisit(this);
- this.variables.Remove(fun.Param);
- return true;
- }
-
- }
-
-} \ No newline at end of file
diff --git a/Source/AbsInt/NativeLattice.cs b/Source/AbsInt/NativeLattice.cs
index f5bf1e03..4fccc14b 100644
--- a/Source/AbsInt/NativeLattice.cs
+++ b/Source/AbsInt/NativeLattice.cs
@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;
using Microsoft.Boogie;
@@ -95,7 +96,7 @@ namespace Microsoft.Boogie.AbstractInterpretation
}
if (lattice != null) {
- Dictionary<Procedure, Implementation[]> procedureImplementations = AbstractionEngine.ComputeProcImplMap(program);
+ Dictionary<Procedure, Implementation[]> procedureImplementations = ComputeProcImplMap(program);
ComputeProgramInvariants(program, procedureImplementations, lattice);
if (CommandLineOptions.Clo.Ai.DebugStatistics) {
Console.Error.WriteLine(lattice);
@@ -110,9 +111,22 @@ namespace Microsoft.Boogie.AbstractInterpretation
}
}
+ private static Dictionary<Procedure, Implementation[]> ComputeProcImplMap(Program program) {
+ Contract.Requires(program != null);
+ // Since implementations call procedures (impl. signatures)
+ // rather than directly calling other implementations, we first
+ // need to compute which implementations implement which
+ // procedures and remember which implementations call which
+ // procedures.
+
+ return program
+ .TopLevelDeclarations
+ .Where(d => d is Implementation).Select(i => (Implementation)i)
+ .GroupBy(i => i.Proc).Select(g => g.ToArray()).ToDictionary(a => a[0].Proc);
+ }
+
/// <summary>
- /// Compute and apply the invariants for the program using the underlying abstract domain (using native Boogie
- /// expressions, not the abstracted AI.Expr's).
+ /// Compute and apply the invariants for the program using the underlying abstract domain.
/// </summary>
public static void ComputeProgramInvariants(Program program, Dictionary<Procedure, Implementation[]> procedureImplementations, NativeLattice lattice) {
Contract.Requires(program != null);
diff --git a/Source/Basetypes/Basetypes.csproj b/Source/Basetypes/Basetypes.csproj
index ceccc5cf..a7b7cb71 100644
--- a/Source/Basetypes/Basetypes.csproj
+++ b/Source/Basetypes/Basetypes.csproj
@@ -148,6 +148,7 @@
<Compile Include="..\version.cs">
<Link>version.cs</Link>
</Compile>
+ <Compile Include="BigDec.cs" />
<Compile Include="BigNum.cs" />
<Compile Include="Rational.cs" />
<Compile Include="Set.cs" />
diff --git a/Source/Basetypes/BigDec.cs b/Source/Basetypes/BigDec.cs
new file mode 100644
index 00000000..6059539b
--- /dev/null
+++ b/Source/Basetypes/BigDec.cs
@@ -0,0 +1,313 @@
+//-----------------------------------------------------------------------------
+//
+// Copyright (C) Microsoft Corporation. All Rights Reserved.
+//
+//-----------------------------------------------------------------------------
+using System;
+using System.Text;
+using System.Diagnostics.Contracts;
+
+
+namespace Microsoft.Basetypes {
+ using BIM = System.Numerics.BigInteger;
+
+
+ /// <summary>
+ /// A representation of decimal values.
+ /// </summary>
+ public struct BigDec {
+
+ // the internal representation
+ [Rep]
+ internal readonly BIM mantissa;
+ [Rep]
+ internal readonly int exponent;
+
+ public BIM Mantissa {
+ get {
+ return mantissa;
+ }
+ }
+
+ public int Exponent {
+ get {
+ return exponent;
+ }
+ }
+
+ public static readonly BigDec ZERO = FromInt(0);
+ private static readonly BIM ten = new BIM(10);
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors
+
+ [Pure]
+ public static BigDec FromInt(int v) {
+ return new BigDec(v, 0);
+ }
+
+ [Pure]
+ public static BigDec FromString(string v) {
+ if (v == null) throw new FormatException();
+
+ BIM integral = BIM.Zero;
+ BIM fraction = BIM.Zero;
+ int exponent = 0;
+
+ int len = v.Length;
+
+ int i = v.IndexOf('e');
+ if (i >= 0) {
+ if (i + 1 == v.Length) throw new FormatException();
+ exponent = Int32.Parse(v.Substring(i + 1, len - i - 1));
+ len = i;
+ }
+
+ int fractionLen = 0;
+ i = v.IndexOf('.');
+ if (i >= 0) {
+ if (i + 1 == v.Length) throw new FormatException();
+ fractionLen = len - i - 1;
+ fraction = BIM.Parse(v.Substring(i + 1, fractionLen));
+ len = i;
+ }
+
+ integral = BIM.Parse(v.Substring(0, len));
+
+ if (!fraction.IsZero) {
+ while (fractionLen > 0) {
+ integral = integral * ten;
+ exponent = exponent - 1;
+ fractionLen = fractionLen - 1;
+ }
+ }
+
+ return new BigDec(integral + fraction, exponent);
+ }
+
+ internal BigDec(BIM mantissa, int exponent) {
+ if (mantissa.IsZero) {
+ this.mantissa = mantissa;
+ this.exponent = 0;
+ }
+ else {
+ while (mantissa % ten == BIM.Zero) {
+ mantissa = mantissa / ten;
+ exponent = exponent + 1;
+ }
+ this.mantissa = mantissa;
+ this.exponent = exponent;
+ }
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Basic object operations
+
+ [Pure]
+ [Reads(ReadsAttribute.Reads.Nothing)]
+ public override bool Equals(object obj) {
+ if (obj == null)
+ return false;
+ if (!(obj is BigDec))
+ return false;
+
+ return (this == (BigDec)obj);
+ }
+
+ [Pure]
+ public override int GetHashCode() {
+ return this.mantissa.GetHashCode() * 13 + this.exponent.GetHashCode();
+ }
+
+ [Pure]
+ public override string/*!*/ ToString() {
+ Contract.Ensures(Contract.Result<string>() != null);
+ return String.Format("{0}e{1}", this.mantissa.ToString(), this.exponent.ToString());
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Conversion operations
+
+ [Pure]
+ public BIM Floor(BIM? minimum, BIM? maximum) {
+ BIM n = this.mantissa;
+
+ if (this.exponent >= 0) {
+ int e = this.exponent;
+ while (e > 0 && (minimum == null || minimum <= n) && (maximum == null || n <= maximum)) {
+ n = n * ten;
+ e = e - 1;
+ }
+ }
+ else {
+ int e = -this.exponent;
+ while (e > 0 && !n.IsZero) {
+ n = n / ten;
+ e = e - 1;
+ }
+ }
+
+ if (minimum != null && n < minimum)
+ return (BIM)minimum;
+ else if (maximum != null && maximum < n)
+ return (BIM)maximum;
+ else
+ return n;
+ }
+
+ [Pure]
+ public String ToDecimalString(int maxDigits) {
+ string s = this.mantissa.ToString();
+ int digits = (this.mantissa >= 0) ? s.Length : s.Length - 1;
+ BIM max = BIM.Pow(10, maxDigits);
+ BIM min = -max;
+
+ if (this.exponent >= 0) {
+ if (maxDigits < digits || maxDigits - digits < this.exponent) {
+ return String.Format("{0}.0", (this.mantissa >= 0) ? max.ToString() : min.ToString());
+ }
+ else {
+ return String.Format("{0}{1}.0", s, new string('0', this.exponent));
+ }
+ }
+ else {
+ int exp = -this.exponent;
+
+ if (exp < digits) {
+ int intDigits = digits - exp;
+ if (maxDigits < intDigits) {
+ return String.Format("{0}.0", (this.mantissa >= 0) ? max.ToString() : min.ToString());
+ }
+ else {
+ int fracDigits = Math.Min(maxDigits, digits - intDigits);
+ return String.Format("{0}.{1}", s.Substring(0, intDigits), s.Substring(intDigits, fracDigits));
+ }
+ }
+ else {
+ int fracDigits = Math.Min(maxDigits, digits);
+ return String.Format("0.{0}{1}", new string('0', exp - fracDigits), s.Substring(0, fracDigits));
+ }
+ }
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Basic arithmetic operations
+
+ [Pure]
+ public BigDec Abs {
+ get {
+ return new BigDec(BIM.Abs(this.mantissa), this.exponent);
+ }
+ }
+
+ [Pure]
+ public BigDec Negate {
+ get {
+ return new BigDec(BIM.Negate(this.mantissa), this.exponent);
+ }
+ }
+
+ [Pure]
+ public static BigDec operator -(BigDec x) {
+ return x.Negate;
+ }
+
+ [Pure]
+ public static BigDec operator +(BigDec x, BigDec y) {
+ BIM m1 = x.mantissa;
+ int e1 = x.exponent;
+ BIM m2 = y.mantissa;
+ int e2 = y.exponent;
+ if (e2 < e1) {
+ m1 = y.mantissa;
+ e1 = y.exponent;
+ m2 = x.mantissa;
+ e2 = x.exponent;
+ }
+
+ while (e2 > e1) {
+ m2 = m2 * ten;
+ e2 = e2 - 1;
+ }
+
+ return new BigDec(m1 + m2, e1);
+ }
+
+ [Pure]
+ public static BigDec operator -(BigDec x, BigDec y) {
+ return x + y.Negate;
+ }
+
+ [Pure]
+ public static BigDec operator *(BigDec x, BigDec y) {
+ return new BigDec(x.mantissa * y.mantissa, x.exponent + y.exponent);
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Some basic comparison operations
+
+ public bool IsPositive {
+ get {
+ return (this.mantissa > BIM.Zero);
+ }
+ }
+
+ public bool IsNegative {
+ get {
+ return (this.mantissa < BIM.Zero);
+ }
+ }
+
+ public bool IsZero {
+ get {
+ return this.mantissa.IsZero;
+ }
+ }
+
+ [Pure]
+ public int CompareTo(BigDec that) {
+ if (this.mantissa == that.mantissa && this.exponent == that.exponent) {
+ return 0;
+ }
+ else {
+ BigDec d = this - that;
+ return d.IsNegative ? -1 : 1;
+ }
+ }
+
+ [Pure]
+ public static bool operator ==(BigDec x, BigDec y) {
+ return x.CompareTo(y) == 0;
+ }
+
+ [Pure]
+ public static bool operator !=(BigDec x, BigDec y) {
+ return x.CompareTo(y) != 0;
+ }
+
+ [Pure]
+ public static bool operator <(BigDec x, BigDec y) {
+ return x.CompareTo(y) < 0;
+ }
+
+ [Pure]
+ public static bool operator >(BigDec x, BigDec y) {
+ return x.CompareTo(y) > 0;
+ }
+
+ [Pure]
+ public static bool operator <=(BigDec x, BigDec y) {
+ return x.CompareTo(y) <= 0;
+ }
+
+ [Pure]
+ public static bool operator >=(BigDec x, BigDec y) {
+ return x.CompareTo(y) >= 0;
+ }
+ }
+}
diff --git a/Source/Boogie.sln b/Source/Boogie.sln
index 1e733880..106a9b74 100644
--- a/Source/Boogie.sln
+++ b/Source/Boogie.sln
@@ -5,8 +5,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Provers", "Provers", "{B758
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BoogieDriver", "BoogieDriver\BoogieDriver.csproj", "{DAB6BAA4-7AF7-449F-96AB-F58F34D03A7A}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Isabelle", "Provers\Isabelle\Isabelle.csproj", "{435D5BD0-6F62-49F8-BB24-33E2257519AD}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbsInt", "AbsInt\AbsInt.csproj", "{0EFA3E43-690B-48DC-A72C-384A3EA7F31F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SMTLib", "Provers\SMTLib\SMTLib.csproj", "{9B163AA3-36BC-4AFB-88AB-79BC9E97E401}"
@@ -19,8 +17,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "Core\Core.csproj",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Z3api", "Provers\Z3api\Z3api.csproj", "{966DD87B-A29D-4F3C-9406-F680A61DC0E0}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIFramework", "AIFramework\AIFramework.csproj", "{39B0658D-C955-41C5-9A43-48C97A1EF5FD}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Graph", "Graph\Graph.csproj", "{69A2B0B8-BCAC-4101-AE7A-556FCC58C06E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Basetypes", "Basetypes\Basetypes.csproj", "{43DFAD18-3E35-4558-9BE2-CAFF6B5BA8A0}"
@@ -81,32 +77,6 @@ Global
{DAB6BAA4-7AF7-449F-96AB-F58F34D03A7A}.z3apidebug|Mixed Platforms.Build.0 = Debug|Any CPU
{DAB6BAA4-7AF7-449F-96AB-F58F34D03A7A}.z3apidebug|x86.ActiveCfg = z3apidebug|x86
{DAB6BAA4-7AF7-449F-96AB-F58F34D03A7A}.z3apidebug|x86.Build.0 = z3apidebug|x86
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Checked|.NET.ActiveCfg = Checked|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Checked|Any CPU.ActiveCfg = Checked|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Checked|Any CPU.Build.0 = Checked|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Checked|Mixed Platforms.ActiveCfg = Checked|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Checked|Mixed Platforms.Build.0 = Checked|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Checked|x86.ActiveCfg = Checked|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Debug|.NET.ActiveCfg = Debug|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Debug|.NET.Build.0 = Debug|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Debug|x86.ActiveCfg = Debug|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Release|.NET.ActiveCfg = Release|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Release|Any CPU.Build.0 = Release|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.Release|x86.ActiveCfg = Release|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.z3apidebug|.NET.ActiveCfg = z3apidebug|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.z3apidebug|Any CPU.ActiveCfg = z3apidebug|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.z3apidebug|Any CPU.Build.0 = z3apidebug|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.z3apidebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.z3apidebug|Mixed Platforms.Build.0 = Debug|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.z3apidebug|x86.ActiveCfg = z3apidebug|Any CPU
- {435D5BD0-6F62-49F8-BB24-33E2257519AD}.z3apidebug|x86.Build.0 = z3apidebug|Any CPU
{0EFA3E43-690B-48DC-A72C-384A3EA7F31F}.Checked|.NET.ActiveCfg = Checked|Any CPU
{0EFA3E43-690B-48DC-A72C-384A3EA7F31F}.Checked|Any CPU.ActiveCfg = Checked|Any CPU
{0EFA3E43-690B-48DC-A72C-384A3EA7F31F}.Checked|Any CPU.Build.0 = Checked|Any CPU
@@ -257,31 +227,6 @@ Global
{966DD87B-A29D-4F3C-9406-F680A61DC0E0}.z3apidebug|Mixed Platforms.Build.0 = z3apidebug|Any CPU
{966DD87B-A29D-4F3C-9406-F680A61DC0E0}.z3apidebug|x86.ActiveCfg = z3apidebug|Any CPU
{966DD87B-A29D-4F3C-9406-F680A61DC0E0}.z3apidebug|x86.Build.0 = z3apidebug|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Checked|.NET.ActiveCfg = Checked|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Checked|Any CPU.ActiveCfg = Checked|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Checked|Any CPU.Build.0 = Checked|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Checked|Mixed Platforms.ActiveCfg = Checked|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Checked|Mixed Platforms.Build.0 = Checked|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Checked|x86.ActiveCfg = Checked|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Debug|.NET.ActiveCfg = Debug|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Debug|x86.ActiveCfg = Debug|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Release|.NET.ActiveCfg = Release|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Release|Any CPU.Build.0 = Release|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.Release|x86.ActiveCfg = Release|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.z3apidebug|.NET.ActiveCfg = z3apidebug|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.z3apidebug|Any CPU.ActiveCfg = z3apidebug|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.z3apidebug|Any CPU.Build.0 = z3apidebug|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.z3apidebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.z3apidebug|Mixed Platforms.Build.0 = Debug|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.z3apidebug|x86.ActiveCfg = z3apidebug|Any CPU
- {39B0658D-C955-41C5-9A43-48C97A1EF5FD}.z3apidebug|x86.Build.0 = z3apidebug|Any CPU
{69A2B0B8-BCAC-4101-AE7A-556FCC58C06E}.Checked|.NET.ActiveCfg = Checked|Any CPU
{69A2B0B8-BCAC-4101-AE7A-556FCC58C06E}.Checked|Any CPU.ActiveCfg = Checked|Any CPU
{69A2B0B8-BCAC-4101-AE7A-556FCC58C06E}.Checked|Any CPU.Build.0 = Checked|Any CPU
@@ -461,7 +406,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {435D5BD0-6F62-49F8-BB24-33E2257519AD} = {B758C1E3-824A-439F-AA2F-0BA1143E8C8D}
{9B163AA3-36BC-4AFB-88AB-79BC9E97E401} = {B758C1E3-824A-439F-AA2F-0BA1143E8C8D}
{966DD87B-A29D-4F3C-9406-F680A61DC0E0} = {B758C1E3-824A-439F-AA2F-0BA1143E8C8D}
EndGlobalSection
diff --git a/Source/BoogieDriver/BoogieDriver.cs b/Source/BoogieDriver/BoogieDriver.cs
index 1653b723..75ba7372 100644
--- a/Source/BoogieDriver/BoogieDriver.cs
+++ b/Source/BoogieDriver/BoogieDriver.cs
@@ -20,7 +20,6 @@ namespace Microsoft.Boogie {
using System.Diagnostics;
using System.Linq;
using VC;
- using AI = Microsoft.AbstractInterpretationFramework;
using BoogiePL = Microsoft.Boogie;
/*
@@ -583,11 +582,13 @@ namespace Microsoft.Boogie {
// ---------- Infer invariants --------------------------------------------------------
// Abstract interpretation -> Always use (at least) intervals, if not specified otherwise (e.g. with the "/noinfer" switch)
- if (CommandLineOptions.Clo.Ai.J_Intervals || CommandLineOptions.Clo.Ai.J_Trivial) {
- Microsoft.Boogie.AbstractInterpretation.NativeAbstractInterpretation.RunAbstractInterpretation(program);
- } else {
- Microsoft.Boogie.AbstractInterpretation.AbstractInterpretation.RunAbstractInterpretation(program);
+ if (CommandLineOptions.Clo.UseAbstractInterpretation) {
+ if (!CommandLineOptions.Clo.Ai.J_Intervals && !CommandLineOptions.Clo.Ai.J_Trivial) {
+ // use /infer:j as the default
+ CommandLineOptions.Clo.Ai.J_Intervals = true;
+ }
}
+ Microsoft.Boogie.AbstractInterpretation.NativeAbstractInterpretation.RunAbstractInterpretation(program);
if (CommandLineOptions.Clo.LoopUnrollCount != -1) {
program.UnrollLoops(CommandLineOptions.Clo.LoopUnrollCount);
diff --git a/Source/BoogieDriver/BoogieDriver.csproj b/Source/BoogieDriver/BoogieDriver.csproj
index 57aeb4d9..9edd2df7 100644
--- a/Source/BoogieDriver/BoogieDriver.csproj
+++ b/Source/BoogieDriver/BoogieDriver.csproj
@@ -214,10 +214,6 @@
<Project>{0EFA3E43-690B-48DC-A72C-384A3EA7F31F}</Project>
<Name>AbsInt</Name>
</ProjectReference>
- <ProjectReference Include="..\AIFramework\AIFramework.csproj">
- <Project>{39B0658D-C955-41C5-9A43-48C97A1EF5FD}</Project>
- <Name>AIFramework</Name>
- </ProjectReference>
<ProjectReference Include="..\Basetypes\Basetypes.csproj">
<Project>{43DFAD18-3E35-4558-9BE2-CAFF6B5BA8A0}</Project>
<Name>Basetypes</Name>
@@ -242,10 +238,6 @@
<Project>{FCD3AC7F-9DFD-46C8-AB1E-09F0B0F16DC5}</Project>
<Name>ParserHelper</Name>
</ProjectReference>
- <ProjectReference Include="..\Provers\Isabelle\Isabelle.csproj">
- <Project>{435D5BD0-6F62-49F8-BB24-33E2257519AD}</Project>
- <Name>Isabelle</Name>
- </ProjectReference>
<ProjectReference Include="..\Provers\SMTLib\SMTLib.csproj">
<Project>{9B163AA3-36BC-4AFB-88AB-79BC9E97E401}</Project>
<Name>SMTLib</Name>
diff --git a/Source/Core/Absy.cs b/Source/Core/Absy.cs
index 9df982d9..b64a9e5e 100644
--- a/Source/Core/Absy.cs
+++ b/Source/Core/Absy.cs
@@ -11,56 +11,40 @@ namespace Microsoft.Boogie.AbstractInterpretation {
using System.Diagnostics.Contracts;
using System.Collections;
using System.Collections.Generic;
- using AI = Microsoft.AbstractInterpretationFramework;
public class CallSite {
public readonly Implementation/*!*/ Impl;
public readonly Block/*!*/ Block;
public readonly int Statement; // invariant: Block[Statement] is CallCmd
- public readonly AI.Lattice.Element/*!*/ KnownBeforeCall;
public readonly ProcedureSummaryEntry/*!*/ SummaryEntry;
[ContractInvariantMethod]
void ObjectInvariant() {
Contract.Invariant(Impl != null);
Contract.Invariant(Block != null);
- Contract.Invariant(KnownBeforeCall != null);
Contract.Invariant(SummaryEntry != null);
}
- public CallSite(Implementation impl, Block b, int stmt, AI.Lattice.Element e, ProcedureSummaryEntry summaryEntry) {
+ public CallSite(Implementation impl, Block b, int stmt, ProcedureSummaryEntry summaryEntry) {
Contract.Requires(summaryEntry != null);
- Contract.Requires(e != null);
Contract.Requires(b != null);
Contract.Requires(impl != null);
this.Impl = impl;
this.Block = b;
this.Statement = stmt;
- this.KnownBeforeCall = e;
this.SummaryEntry = summaryEntry;
}
}
public class ProcedureSummaryEntry {
- public AI.Lattice/*!*/ Lattice;
- public AI.Lattice.Element/*!*/ OnEntry;
- public AI.Lattice.Element/*!*/ OnExit;
public HashSet<CallSite>/*!*/ ReturnPoints; // whenever OnExit changes, we start analysis again at all the ReturnPoints
[ContractInvariantMethod]
void ObjectInvariant() {
- Contract.Invariant(Lattice != null);
- Contract.Invariant(OnEntry != null);
- Contract.Invariant(OnExit != null);
Contract.Invariant(ReturnPoints != null);
}
- public ProcedureSummaryEntry(AI.Lattice lattice, AI.Lattice.Element onEntry) {
- Contract.Requires(onEntry != null);
- Contract.Requires(lattice != null);
- this.Lattice = lattice;
- this.OnEntry = onEntry;
- this.OnExit = lattice.Bottom;
+ public ProcedureSummaryEntry() {
this.ReturnPoints = new HashSet<CallSite>();
// base();
}
@@ -93,7 +77,6 @@ namespace Microsoft.Boogie {
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using Microsoft.Boogie.AbstractInterpretation;
- using AI = Microsoft.AbstractInterpretationFramework;
using Graphing;
using Set = GSet<object>;
@@ -349,12 +332,6 @@ namespace Microsoft.Boogie {
}
}
- public void InstrumentWithInvariants() {
- foreach (Declaration d in this.TopLevelDeclarations) {
- d.InstrumentWithInvariants();
- }
- }
-
/// <summary>
/// Reset the abstract stated computed before
/// </summary>
@@ -1045,14 +1022,6 @@ namespace Microsoft.Boogie {
}
/// <summary>
- /// This method inserts the abstract-interpretation-inferred invariants
- /// as assume (or possibly assert) statements in the statement sequences of
- /// each block.
- /// </summary>
- public virtual void InstrumentWithInvariants() {
- }
-
- /// <summary>
/// Reset the abstract stated computed before
/// </summary>
public virtual void ResetAbstractInterpretationState() { /* does nothing */
@@ -1388,7 +1357,7 @@ namespace Microsoft.Boogie {
}
}
- public abstract class Variable : NamedDeclaration, AI.IVariable {
+ public abstract class Variable : NamedDeclaration {
public TypedIdent/*!*/ TypedIdent;
[ContractInvariantMethod]
void ObjectInvariant() {
@@ -1446,11 +1415,6 @@ namespace Microsoft.Boogie {
TypecheckAttributes(tc);
this.TypedIdent.Typecheck(tc);
}
- [Pure]
- public object DoVisit(AI.ExprVisitor visitor) {
- //Contract.Requires(visitor != null);
- return visitor.VisitVariable(this);
- }
}
public class VariableComparer : IComparer {
@@ -2354,12 +2318,6 @@ namespace Microsoft.Boogie {
for (int s = 0; s < this.Summary.Count; s++) {
ProcedureSummaryEntry/*!*/ entry = cce.NonNull(this.Summary[s]);
stream.Write(level + 1, "// ");
- Expr e;
- e = (Expr)entry.Lattice.ToPredicate(entry.OnEntry);
- e.Emit(stream);
- stream.Write(" ==> ");
- e = (Expr)entry.Lattice.ToPredicate(entry.OnExit);
- e.Emit(stream);
stream.WriteLine();
}
}
@@ -2862,53 +2820,6 @@ namespace Microsoft.Boogie {
}
/// <summary>
- /// Instrument the blocks with the inferred invariants
- /// </summary>
- public override void InstrumentWithInvariants() {
- foreach (Block b in this.Blocks) {
- if (b.Lattice != null) {
- Contract.Assert(b.PreInvariant != null); /* If the pre-abstract state is null, then something is wrong */
- Contract.Assert(b.PostInvariant != null); /* If the post-state is null, then something is wrong */
-
- bool instrumentEntry;
- bool instrumentExit;
- switch (CommandLineOptions.Clo.InstrumentInfer) {
- case CommandLineOptions.InstrumentationPlaces.Everywhere:
- instrumentEntry = true;
- instrumentExit = true;
- break;
- case CommandLineOptions.InstrumentationPlaces.LoopHeaders:
- instrumentEntry = b.widenBlock;
- instrumentExit = false;
- break;
- default: {
- Contract.Assert(false);
- throw new cce.UnreachableException();
- } // unexpected InstrumentationPlaces value
- }
-
- if (instrumentEntry || instrumentExit) {
- CmdSeq newCommands = new CmdSeq();
- if (instrumentEntry) {
- Expr inv = (Expr)b.Lattice.ToPredicate(b.PreInvariant); /*b.PreInvariantBuckets.GetDisjunction(b.Lattice);*/
- var kv = new QKeyValue(Token.NoToken, "inferred", new List<object>(), null);
- PredicateCmd cmd = CommandLineOptions.Clo.InstrumentWithAsserts ? (PredicateCmd)new AssertCmd(Token.NoToken, inv, kv) : (PredicateCmd)new AssumeCmd(Token.NoToken, inv, kv);
- newCommands.Add(cmd);
- }
- newCommands.AddRange(b.Cmds);
- if (instrumentExit) {
- Expr inv = (Expr)b.Lattice.ToPredicate(b.PostInvariant);
- var kv = new QKeyValue(Token.NoToken, "inferred", new List<object>(), null);
- PredicateCmd cmd = CommandLineOptions.Clo.InstrumentWithAsserts ? (PredicateCmd)new AssertCmd(Token.NoToken, inv, kv) : (PredicateCmd)new AssumeCmd(Token.NoToken, inv, kv);
- newCommands.Add(cmd);
- }
- b.Cmds = newCommands;
- }
- }
- }
- }
-
- /// <summary>
/// Return a collection of blocks that are reachable from the block passed as a parameter.
/// The block must be defined in the current implementation
/// </summary>
@@ -3148,113 +3059,6 @@ namespace Microsoft.Boogie {
}
}
- /// <summary>
- /// Conceptually, a LatticeElementList is a infinite array indexed from 0,
- /// where some finite number of elements have a non-null value. All elements
- /// have type Lattice.Element.
- ///
- /// The Count property returns the first index above all non-null values.
- ///
- /// The [i] getter returns the element at position i, which may be null. The
- /// index i is not allowed to be negative.
- /// The [i] setter sets the element at position i. As a side effect, this
- /// operation may increase Count. The index i is not allowed to be negative.
- /// The right-hand value of the setter is not allowed to be null; that is,
- /// null can occur in the list only as an "unused" element.
- /// </summary>
- public class LatticeElementList : ArrayList {
- public new /*Maybe null*/ AI.Lattice.Element this[int i] {
- get {
- if (i < Count) {
- return (AI.Lattice.Element)base[i];
- } else {
- return null;
- }
- }
- set {
- System.Diagnostics.Debug.Assert(value != null);
- while (Count <= i) {
- Add(null);
- }
- base[i] = value;
- }
- }
- /// <summary>
- /// Returns the disjunction of (the expression formed from) the
- /// non-null lattice elements in the list. The expressions are
- /// formed according to the given "lattice", which is assumed to
- /// be the lattice of the lattice elements stored in the list.
- /// </summary>
- /// <param name="lattice"></param>
- /// <returns></returns>
- public Expr GetDisjunction(AI.Lattice lattice) {
- Contract.Requires(lattice != null);
- Expr disjunction = null;
- foreach (AI.Lattice.Element el in this) {
- if (el != null) {
- Expr e = (Expr)lattice.ToPredicate(el);
- if (disjunction == null) {
- disjunction = e;
- } else {
- disjunction = Expr.Or(disjunction, e);
- }
- }
- }
- if (disjunction == null) {
- return Expr.False;
- } else {
- return disjunction;
- }
- }
- }
-
- public abstract class BoogieFactory {
- public static Expr IExpr2Expr(AI.IExpr e) {
- Contract.Requires(e != null);
- Contract.Ensures(Contract.Result<Expr>() != null);
- Variable v = e as Variable;
- if (v != null) {
- return new IdentifierExpr(Token.NoToken, v);
- } else if (e is AI.IVariable) { // but not a Variable
- return new AIVariableExpr(Token.NoToken, (AI.IVariable)e);
- } else if (e is IdentifierExpr.ConstantFunApp) {
- return ((IdentifierExpr.ConstantFunApp)e).IdentifierExpr;
- } else if (e is QuantifierExpr.AIQuantifier) {
- return ((QuantifierExpr.AIQuantifier)e).arg.RealQuantifier;
- } else {
- return (Expr)e;
- }
- }
- public static ExprSeq IExprArray2ExprSeq(IList/*<AI.IExpr!>*/ a) {
- Contract.Requires(a != null);
- Contract.Ensures(Contract.Result<ExprSeq>() != null);
- Expr[] e = new Expr[a.Count];
- int i = 0;
- foreach (AI.IExpr/*!*/ aei in a) {
- Contract.Assert(aei != null);
- e[i] = IExpr2Expr(aei);
- i++;
- }
- return new ExprSeq(e);
- }
-
- // Convert a Boogie type into an AIType if possible. This should be
- // extended when AIFramework gets more types.
- public static AI.AIType Type2AIType(Type t) {
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result<AI.AIType>() != null);
- // if (t.IsRef)
- // return AI.Ref.Type;
- // else
- if (t.IsInt)
- return AI.Int.Type;
- // else if (t.IsName) PR: how to handle this case?
- // return AI.FieldName.Type;
- else
- return AI.Value.Type;
- }
- }
-
#region Generic Sequences
//---------------------------------------------------------------------
// Generic Sequences
diff --git a/Source/Core/AbsyCmd.cs b/Source/Core/AbsyCmd.cs
index c6b66585..607848ed 100644
--- a/Source/Core/AbsyCmd.cs
+++ b/Source/Core/AbsyCmd.cs
@@ -13,7 +13,6 @@ namespace Microsoft.Boogie {
using System.Diagnostics;
using System.Collections.Generic;
using Microsoft.Boogie.AbstractInterpretation;
- using AI = Microsoft.AbstractInterpretationFramework;
using System.Diagnostics.Contracts;
using Set = GSet<object>;
@@ -818,13 +817,6 @@ namespace Microsoft.Boogie {
public bool widenBlock;
public int iterations; // Count the number of time we visited the block during fixpoint computation. Used to decide if we widen or not
- // Block-specific invariants...
- public AI.Lattice Lattice; // The lattice used for the analysis of this block
- public AI.Lattice.Element PreInvariant; // The initial abstract states for this block
- public AI.Lattice.Element PostInvariant; // The exit abstract states for this block
- // KRML: We want to include the following invariant, but at the moment, doing so causes a run-time error (something about committed):
- //invariant ;
-
// VC generation and SCC computation
public BlockSeq/*!*/ Predecessors;
@@ -837,7 +829,6 @@ namespace Microsoft.Boogie {
Contract.Invariant(Label != null);
Contract.Invariant(Cmds != null);
Contract.Invariant(cce.NonNullElements(liveVarsBefore, true));
- Contract.Invariant((PreInvariant != null) == (PostInvariant != null));
}
public bool IsLive(Variable v) {
@@ -860,8 +851,6 @@ namespace Microsoft.Boogie {
this.Label = label;
this.Cmds = cmds;
this.TransferCmd = transferCmd;
- this.PreInvariant = null;
- this.PostInvariant = null;
this.Predecessors = new BlockSeq();
this.liveVarsBefore = null;
this.TraversingStatus = VisitState.ToVisit;
@@ -920,9 +909,6 @@ namespace Microsoft.Boogie {
// this.currentlyTraversed = false;
this.TraversingStatus = VisitState.ToVisit;
this.iterations = 0;
- this.Lattice = null;
- this.PreInvariant = null;
- this.PostInvariant = null;
}
[Pure]
diff --git a/Source/Core/AbsyExpr.cs b/Source/Core/AbsyExpr.cs
index e274fcc3..ff84b501 100644
--- a/Source/Core/AbsyExpr.cs
+++ b/Source/Core/AbsyExpr.cs
@@ -13,8 +13,6 @@ namespace Microsoft.Boogie {
using System.Diagnostics;
using System.Collections.Generic;
using Microsoft.Boogie.AbstractInterpretation;
- using AI = Microsoft.AbstractInterpretationFramework;
- using Microsoft.AbstractInterpretationFramework;//DANGER: Added?
using System.Diagnostics.Contracts;
using Microsoft.Basetypes;
@@ -252,6 +250,18 @@ namespace Microsoft.Boogie {
Contract.Ensures(Contract.Result<NAryExpr>() != null);
return Binary(BinaryOperator.Opcode.Mod, e1, e2);
}
+ public static NAryExpr RealDiv(Expr e1, Expr e2) {
+ Contract.Requires(e2 != null);
+ Contract.Requires(e1 != null);
+ Contract.Ensures(Contract.Result<NAryExpr>() != null);
+ return Binary(BinaryOperator.Opcode.RealDiv, e1, e2);
+ }
+ public static NAryExpr Pow(Expr e1, Expr e2) {
+ Contract.Requires(e2 != null);
+ Contract.Requires(e1 != null);
+ Contract.Ensures(Contract.Result<NAryExpr>() != null);
+ return Binary(BinaryOperator.Opcode.Pow, e1, e2);
+ }
public static NAryExpr Subtype(Expr e1, Expr e2) {
Contract.Requires(e2 != null);
Contract.Requires(e1 != null);
@@ -285,6 +295,10 @@ namespace Microsoft.Boogie {
Contract.Ensures(Contract.Result<LiteralExpr>() != null);
return new LiteralExpr(Token.NoToken, value);
}
+ public static LiteralExpr Literal(BigDec value) {
+ Contract.Ensures(Contract.Result<LiteralExpr>() != null);
+ return new LiteralExpr(Token.NoToken, value);
+ }
private static LiteralExpr/*!*/ true_ = Literal(true);
public static LiteralExpr/*!*/ True {
@@ -379,21 +393,6 @@ namespace Microsoft.Boogie {
args.Add(subexpr);
return new NAryExpr(x, new TypeCoercion(x, type), args);
}
-
-
- /// <summary>
- /// This property returns a representation for the expression suitable for use
- /// by the AIFramework. Usually, the property just returns "this", but not
- /// every Expr is an AI.IExpr (besides, AI.IExpr is to be thought of as an
- /// abstract interface--any class that implements AI.IExpr is supposed to
- /// implement some proper subinterface of AI.IExpr).
- /// The converse operations of this property are found in AbsInt\ExprFactories.ssc.
- /// </summary>
- public abstract AI.IExpr/*!*/ IExpr {
- [Peer]
- get;
- }
-
}
[ContractClassFor(typeof(Expr))]
public abstract class ExprContracts : Expr {
@@ -415,17 +414,10 @@ namespace Microsoft.Boogie {
throw new NotImplementedException();
}
}
- public override Microsoft.AbstractInterpretationFramework.IExpr IExpr {
- get {
- Contract.Ensures(Contract.Result<Microsoft.AbstractInterpretationFramework.IExpr>() != null);
-
- throw new NotImplementedException();
- }
- }
}
- public class LiteralExpr : Expr, AI.IFunApp {
- public readonly object/*!*/ Val; // false, true, a BigNum, or a BvConst
+ public class LiteralExpr : Expr {
+ public readonly object/*!*/ Val; // false, true, a BigNum, a BigDec, or a BvConst
[ContractInvariantMethod]
void ObjectInvariant() {
Contract.Invariant(Val != null);
@@ -442,6 +434,7 @@ namespace Microsoft.Boogie {
Val = b;
Type = Type.Bool;
}
+
/// <summary>
/// Creates a literal expression for the integer value "v".
/// </summary>
@@ -455,6 +448,18 @@ namespace Microsoft.Boogie {
}
/// <summary>
+ /// Creates a literal expression for the real value "v".
+ /// </summary>
+ /// <param name="tok"></param>
+ /// <param name="v"></param>
+ public LiteralExpr(IToken/*!*/ tok, BigDec v)
+ : base(tok) {
+ Contract.Requires(tok != null);
+ Val = v;
+ Type = Type.Real;
+ }
+
+ /// <summary>
/// Creates a literal expression for the bitvector value "v".
/// </summary>
public LiteralExpr(IToken/*!*/ tok, BigNum v, int b)
@@ -511,6 +516,8 @@ namespace Microsoft.Boogie {
return Type.Bool;
} else if (Val is BigNum) {
return Type.Int;
+ } else if (Val is BigDec) {
+ return Type.Real;
} else if (Val is BvConst) {
return Type.GetBvType(((BvConst)Val).Bits);
} else {
@@ -532,12 +539,6 @@ namespace Microsoft.Boogie {
return Val is bool && ((bool)Val) == true;
}
}
- public override AI.IExpr/*!*/ IExpr {
- get {
- Contract.Ensures(Contract.Result<AI.IExpr>() != null);
- return this;
- }
- }
// should be eliminated after converting everything to BigNums
private int asInt {
@@ -559,76 +560,31 @@ namespace Microsoft.Boogie {
}
}
- public bool isBool {
+ public bool isBigDec {
get {
- return Val is bool;
+ return Val is BigDec;
}
}
- public bool asBool {
+ public BigDec asBigDec {
get {
- Contract.Assert(isBool);
- return (bool)cce.NonNull(Val);
+ Contract.Assert(isBigDec);
+ return (BigDec)cce.NonNull(Val);
}
}
- public AI.IFunctionSymbol/*!*/ FunctionSymbol {
+ public bool isBool {
get {
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
-
- if (Val is bool) {
- if ((bool)Val) {
- return AI.Prop.True;
- } else {
- return AI.Prop.False;
- }
- } else if (Val is BigNum) {
- return AI.Int.Const((BigNum)Val);
- } else if (Val is BvConst) {
- return AI.Bv.Const(((BvConst)Val).Value, ((BvConst)Val).Bits);
- } else {
- {
- Contract.Assert(false);
- throw new cce.UnreachableException();
- } // like, where did this value come from?!
- }
+ return Val is bool;
}
}
- public IList/*<AI.IExpr!>*//*!*/ Arguments {
- get {
- Contract.Ensures(Contract.Result<IList>() != null);
- return ArrayList.ReadOnly(new AI.IExpr[0]);
- }
- }
- public Microsoft.AbstractInterpretationFramework.IFunApp CloneWithArguments(IList/*<AI.IExpr!>*/ args) {
- //Contract.Requires(args != null);
- Contract.Ensures(Contract.Result<Microsoft.AbstractInterpretationFramework.IFunApp>() != null);
- Contract.Assert(args.Count == 0);
- return this;
- }
- public AI.AIType/*!*/ AIType {
+ public bool asBool {
get {
- Contract.Requires(AIType != null);
- if (Val is bool) {
- return AI.Prop.Type;
- } else if (Val is BigNum) {
- return AI.Int.Type;
- } else if (Val is BvConst) {
- return AI.Bv.Type;
- } else {
- {
- Contract.Assert(false);
- throw new cce.UnreachableException();
- } // like, where did this value come from?!
- }
+ Contract.Assert(isBool);
+ return (bool)cce.NonNull(Val);
}
}
- [Pure]
- public object DoVisit(AI.ExprVisitor visitor) {
- //Contract.Requires(visitor != null);
- return visitor.VisitFunApp(this);
- }
public override Absy StdDispatch(StandardVisitor visitor) {
//Contract.Requires(visitor != null);
@@ -688,86 +644,6 @@ namespace Microsoft.Boogie {
}
}
- public class AIVariableExpr : Expr {
-
- public string Name; // identifier symbol
- public AI.IVariable/*!*/ Decl; // identifier declaration
- [ContractInvariantMethod]
- void ObjectInvariant() {
- Contract.Invariant(Decl != null);
- }
-
-
- /// <summary>
- /// Creates an unresolved identifier expression.
- /// </summary>
- /// <param name="tok"></param>
- /// <param name="name"></param>
- public AIVariableExpr(IToken/*!*/ tok, AI.IVariable/*!*/ var)
- : base(tok) {
- Contract.Requires(tok != null);
- Contract.Requires(var != null);
- Name = var.ToString();
- Decl = var;
- }
- [Pure]
- [Reads(ReadsAttribute.Reads.Nothing)]
- public override bool Equals(object obj) {
- if (obj == null)
- return false;
- if (!(obj is AIVariableExpr))
- return false;
-
- AIVariableExpr other = (AIVariableExpr)obj;
- return object.Equals(this.Name, other.Name) && object.Equals(this.Decl, other.Decl);
- }
- [Pure]
- public override int GetHashCode() {
- int h = this.Name == null ? 0 : this.Name.GetHashCode();
- h ^= this.Decl == null ? 0 : this.Decl.GetHashCode();
- return h;
- }
- public override void Emit(TokenTextWriter stream, int contextBindingStrength, bool fragileContext) {
- //Contract.Requires(stream != null);
- if (CommandLineOptions.Clo.PrintWithUniqueASTIds) {
- stream.Write("{0}^^", this.Decl == null ? "NoDecl" : "h" + this.Decl.GetHashCode());
- }
- stream.Write(this, "{0}", this.Name);
- }
- public override void Resolve(ResolutionContext rc) {
- //Contract.Requires(rc != null);
- }
- public override void ComputeFreeVariables(Set /*Variable*/ freeVars) {
- //Contract.Requires(freeVars != null);
- if (Decl is Variable) {
- freeVars.Add((Variable)Decl);
- }
- }
- public override void Typecheck(TypecheckingContext tc) {
- //Contract.Requires(tc != null);
- throw new System.NotImplementedException();
- }
- public override Type/*!*/ ShallowType {
- get {
- Contract.Ensures(Contract.Result<Type>() != null);
- throw new System.NotImplementedException();
- }
- }
- public override AI.IExpr/*!*/ IExpr {
- get {
- Contract.Ensures(Contract.Result<AI.IExpr>() != null);
-
- return Decl;
- }
- }
-
- public override Absy StdDispatch(StandardVisitor visitor) {
- //Contract.Requires(visitor != null);
- Contract.Ensures(Contract.Result<Absy>() != null);
- return visitor.VisitAIVariableExpr(this);
- }
- }
-
public class IdentifierExpr : Expr {
public string/*!*/ Name; // identifier symbol
public Variable Decl; // identifier declaration
@@ -894,12 +770,11 @@ namespace Microsoft.Boogie {
}
}
- public sealed class ConstantFunApp : AI.IFunApp {
+ public sealed class ConstantFunApp {
private IdentifierExpr/*!*/ identifierExpr;
[ContractInvariantMethod]
void ObjectInvariant() {
Contract.Invariant(identifierExpr != null);
- Contract.Invariant(symbol != null);
Contract.Invariant(emptyArgs != null);
}
@@ -910,14 +785,6 @@ namespace Microsoft.Boogie {
}
}
- private AI.IFunctionSymbol/*!*/ symbol;
- public AI.IFunctionSymbol/*!*/ FunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
- return symbol;
- }
- }
-
private static IList/*!*/ emptyArgs = ArrayList.ReadOnly(cce.NonNull((IList/*!*/)new ArrayList()));
public IList/*!*/ Arguments {
get {
@@ -926,44 +793,14 @@ namespace Microsoft.Boogie {
}
}
- public AI.IFunApp CloneWithArguments(IList newargs) {
- //Contract.Requires(newargs != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- return this;
- }
-
- [Pure]
- public object DoVisit(AI.ExprVisitor visitor) {
- //Contract.Requires(visitor != null);
- return visitor.VisitFunApp(this);
- }
-
public ConstantFunApp(IdentifierExpr ie, Constant c) {
Contract.Requires(c != null);
Contract.Requires(ie != null);
this.identifierExpr = ie;
- this.symbol =
- new AI.NamedSymbol(c.TypedIdent.Name, BoogieFactory.Type2AIType(c.TypedIdent.Type));
// base();
}
}
- private AI.IExpr iexprCache = null;
- public override AI.IExpr/*!*/ IExpr {
- get {
- Contract.Ensures(Contract.Result<IExpr>() != null);
-
- if (iexprCache == null) {
- if (Decl is Constant)
- iexprCache = new ConstantFunApp(this, (Constant)Decl);
- else {
- Contract.Assume(this.Decl != null);
- iexprCache = Decl;
- }
- }
- return iexprCache;
- }
- }
public override Absy StdDispatch(StandardVisitor visitor) {
//Contract.Requires(visitor != null);
@@ -972,7 +809,7 @@ namespace Microsoft.Boogie {
}
}
- public class OldExpr : Expr, AI.IFunApp // HACK
+ public class OldExpr : Expr
{
public Expr/*!*/ Expr;
[ContractInvariantMethod]
@@ -1030,67 +867,6 @@ namespace Microsoft.Boogie {
return Expr.ShallowType;
}
}
- public override AI.IExpr/*!*/ IExpr {
- get {
- Contract.Ensures(Contract.Result<IExpr>() != null);
-
- // Put back these lines when "HACK" removed
- // // An Old expression has no AI.IExpr representation
- // {Contract.Assert(false);throw new cce.UnreachableException();}
- return this; // HACK
- }
- }
- [Pure]
- public object DoVisit(AI.ExprVisitor visitor) {
- //Contract.Requires(visitor != null);
- return visitor.VisitFunApp(this);
- }
- public AI.IFunApp CloneWithArguments(IList/*<IExpr!>*/ args) {
- //Contract.Requires(args != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- Contract.Assume(args.Count == 1);
- AI.IExpr/*!*/ iexpr = (AI.IExpr)cce.NonNull(args[0]);
- return new OldExpr(Token.NoToken, BoogieFactory.IExpr2Expr(iexpr));
- }
- private IList/*?*/ argCache = null;
- public IList/*<IExpr!*//*!*/ Arguments {
-
- get {
- Contract.Ensures(Contract.Result<IList>() != null);
-
- if (argCache == null) {
- IList l = new ArrayList(1);
- l.Add(Expr.IExpr);
- argCache = ArrayList.ReadOnly(l);
- }
- return argCache;
- }
- }
- private sealed class OldFunctionSymbol : AI.IFunctionSymbol {
- private static readonly AI.AIType/*!*/ aitype = new AI.FunctionType(AI.Value.Type, AI.Value.Type);
-
- public AI.AIType/*!*/ AIType {
- get {
- Contract.Ensures(Contract.Result<AIType>() != null);
- return aitype;
- }
- }
- private OldFunctionSymbol() {
- }
- internal static readonly OldFunctionSymbol/*!*/ Sym = new OldFunctionSymbol();
-
- [Pure]
- public override string ToString() {
- Contract.Ensures(Contract.Result<string>() != null);
- return "old";
- }
- }
- public AI.IFunctionSymbol/*!*/ FunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
- return OldFunctionSymbol.Sym;
- }
- }
public override Absy StdDispatch(StandardVisitor visitor) {
//Contract.Requires(visitor != null);
@@ -1106,6 +882,7 @@ namespace Microsoft.Boogie {
T Visit(MapSelect/*!*/ mapSelect);
T Visit(MapStore/*!*/ mapStore);
T Visit(TypeCoercion/*!*/ typeCoercion);
+ T Visit(ArithmeticCoercion/*!*/ arithCoercion);
T Visit(IfThenElse/*!*/ ifThenElse);
}
[ContractClassFor(typeof(IAppliableVisitor<>))]
@@ -1143,6 +920,11 @@ namespace Microsoft.Boogie {
throw new NotImplementedException();
}
+ public T Visit(ArithmeticCoercion arithCoercion) {
+ Contract.Requires(arithCoercion != null);
+ throw new NotImplementedException();
+ }
+
public T Visit(IfThenElse ifThenElse) {
Contract.Requires(ifThenElse != null);
throw new NotImplementedException();
@@ -1198,10 +980,6 @@ namespace Microsoft.Boogie {
/// </summary>
Type/*!*/ ShallowType(ExprSeq/*!*/ args);
- AI.IFunctionSymbol/*!*/ AIFunctionSymbol {
- get;
- }
-
T Dispatch<T>(IAppliableVisitor<T>/*!*/ visitor);
}
[ContractClassFor(typeof(IAppliable))]
@@ -1250,13 +1028,6 @@ namespace Microsoft.Boogie {
throw new NotImplementedException();
}
- public IFunctionSymbol AIFunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
- throw new NotImplementedException();
- }
- }
-
public T Dispatch<T>(IAppliableVisitor<T> visitor) {
Contract.Requires(visitor != null);
throw new NotImplementedException();
@@ -1291,6 +1062,7 @@ namespace Microsoft.Boogie {
}
public enum Opcode {
+ Neg,
Not
};
private Opcode op;
@@ -1326,6 +1098,8 @@ namespace Microsoft.Boogie {
Contract.Ensures(Contract.Result<string>() != null);
switch (this.op) {
+ case Opcode.Neg:
+ return "-";
case Opcode.Not:
return "!";
}
@@ -1334,26 +1108,13 @@ namespace Microsoft.Boogie {
}
}
- public AI.IFunctionSymbol/*!*/ AIFunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
-
- switch (this.op) {
- case Opcode.Not:
- return AI.Prop.Not;
- }
- System.Diagnostics.Debug.Fail("unknown unary operator: " + op.ToString());
- throw new Exception();
- }
- }
-
public void Emit(ExprSeq args, TokenTextWriter stream, int contextBindingStrength, bool fragileContext) {
//Contract.Requires(stream != null);
//Contract.Requires(args != null);
stream.SetToken(ref this.tok);
Contract.Assert(args.Length == 1);
// determine if parens are needed
- int opBindingStrength = 0x60;
+ int opBindingStrength = 0x70;
bool parensNeeded = opBindingStrength < contextBindingStrength ||
(fragileContext && opBindingStrength == contextBindingStrength);
@@ -1391,6 +1152,14 @@ namespace Microsoft.Boogie {
tpInstantiation = SimpleTypeParamInstantiation.EMPTY;
Type arg0type = cce.NonNull(cce.NonNull(args[0]).Type);
switch (this.op) {
+ case Opcode.Neg:
+ if (arg0type.Unify(Type.Int)) {
+ return Type.Int;
+ }
+ if (arg0type.Unify(Type.Real)) {
+ return Type.Real;
+ }
+ goto BAD_TYPE;
case Opcode.Not:
if (arg0type.Unify(Type.Bool)) {
return Type.Bool;
@@ -1411,6 +1180,8 @@ namespace Microsoft.Boogie {
//Contract.Requires(args != null);
Contract.Ensures(Contract.Result<Type>() != null);
switch (this.op) {
+ case Opcode.Neg:
+ return cce.NonNull(cce.NonNull(args[0]).Type);
case Opcode.Not:
return Type.Bool;
default: {
@@ -1425,6 +1196,14 @@ namespace Microsoft.Boogie {
return null;
}
switch (this.op) {
+ case Opcode.Neg:
+ if (argument is BigNum) {
+ return -((BigNum)argument);
+ }
+ if (argument is BigDec) {
+ return -((BigDec)argument);
+ }
+ break;
case Opcode.Not:
if (argument is bool) {
return !((bool)argument);
@@ -1453,6 +1232,8 @@ namespace Microsoft.Boogie {
Mul,
Div,
Mod,
+ RealDiv,
+ Pow,
Eq,
Neq,
Gt,
@@ -1506,9 +1287,13 @@ namespace Microsoft.Boogie {
case Opcode.Mul:
return "*";
case Opcode.Div:
- return "/";
+ return "div";
case Opcode.Mod:
- return "%";
+ return "mod";
+ case Opcode.RealDiv:
+ return "/";
+ case Opcode.Pow:
+ return "**";
case Opcode.Eq:
return "==";
case Opcode.Neq:
@@ -1537,50 +1322,6 @@ namespace Microsoft.Boogie {
}
}
- public AI.IFunctionSymbol/*!*/ AIFunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
-
- switch (this.op) {
-
- case Opcode.Add:
- return AI.Int.Add;
- case Opcode.Sub:
- return AI.Int.Sub;
- case Opcode.Mul:
- return AI.Int.Mul;
- case Opcode.Div:
- return AI.Int.Div;
- case Opcode.Mod:
- return AI.Int.Mod;
- case Opcode.Eq:
- return AI.Value.Eq;
- case Opcode.Neq:
- return AI.Value.Neq;
- case Opcode.Gt:
- return AI.Int.Greater;
- case Opcode.Ge:
- return AI.Int.AtLeast;
- case Opcode.Lt:
- return AI.Int.Less;
- case Opcode.Le:
- return AI.Int.AtMost;
- case Opcode.And:
- return AI.Prop.And;
- case Opcode.Or:
- return AI.Prop.Or;
- case Opcode.Imp:
- return AI.Prop.Implies;
- case Opcode.Iff:
- return AI.Value.Eq;
- case Opcode.Subtype:
- return AI.Value.Subtype;
- }
- System.Diagnostics.Debug.Fail("unknown binary operator: " + op.ToString());
- throw new Exception();
- }
- }
-
public void Emit(ExprSeq args, TokenTextWriter stream, int contextBindingStrength, bool fragileContext) {
//Contract.Requires(stream != null);
//Contract.Requires(args != null);
@@ -1609,6 +1350,14 @@ namespace Microsoft.Boogie {
opBindingStrength = 0x50;
fragileRightContext = true;
break;
+ case Opcode.RealDiv:
+ opBindingStrength = 0x50;
+ fragileRightContext = true;
+ break;
+ case Opcode.Pow:
+ opBindingStrength = 0x60;
+ fragileRightContext = true;
+ break;
case Opcode.Eq:
case Opcode.Neq:
case Opcode.Gt:
@@ -1662,6 +1411,8 @@ namespace Microsoft.Boogie {
case Opcode.Mul:
case Opcode.Div:
case Opcode.Mod:
+ case Opcode.RealDiv:
+ case Opcode.Pow:
case Opcode.Neq: // Neq is allowed, but not Eq
case Opcode.Subtype:
// These are fine
@@ -1713,12 +1464,30 @@ namespace Microsoft.Boogie {
case Opcode.Add:
case Opcode.Sub:
case Opcode.Mul:
+ if (arg0type.Unify(Type.Int) && arg1type.Unify(Type.Int)) {
+ return Type.Int;
+ }
+ if (arg0type.Unify(Type.Real) && arg1type.Unify(Type.Real)) {
+ return Type.Real;
+ }
+ goto BAD_TYPE;
case Opcode.Div:
case Opcode.Mod:
if (arg0type.Unify(Type.Int) && arg1type.Unify(Type.Int)) {
return Type.Int;
}
goto BAD_TYPE;
+ case Opcode.RealDiv:
+ if ((arg0type.Unify(Type.Int) || arg0type.Unify(Type.Real)) &&
+ (arg1type.Unify(Type.Int) || arg1type.Unify(Type.Real))) {
+ return Type.Real;
+ }
+ goto BAD_TYPE;
+ case Opcode.Pow:
+ if (arg0type.Unify(Type.Real) && arg1type.Unify(Type.Real)) {
+ return Type.Real;
+ }
+ goto BAD_TYPE;
case Opcode.Eq:
case Opcode.Neq:
// Comparison is allowed if the argument types are unifiable
@@ -1742,6 +1511,9 @@ namespace Microsoft.Boogie {
if (arg0type.Unify(Type.Int) && arg1type.Unify(Type.Int)) {
return Type.Bool;
}
+ if (arg0type.Unify(Type.Real) && arg1type.Unify(Type.Real)) {
+ return Type.Bool;
+ }
goto BAD_TYPE;
case Opcode.And:
case Opcode.Or:
@@ -1776,10 +1548,16 @@ namespace Microsoft.Boogie {
case Opcode.Add:
case Opcode.Sub:
case Opcode.Mul:
+ return cce.NonNull(args[0]).ShallowType;
+
case Opcode.Div:
case Opcode.Mod:
return Type.Int;
+ case Opcode.RealDiv:
+ case Opcode.Pow:
+ return Type.Real;
+
case Opcode.Eq:
case Opcode.Neq:
case Opcode.Gt:
@@ -1836,16 +1614,25 @@ namespace Microsoft.Boogie {
if (e1 is BigNum && e2 is BigNum) {
return ((BigNum)e1) + ((BigNum)e2);
}
+ if (e1 is BigDec && e2 is BigDec) {
+ return ((BigDec)e1) + ((BigDec)e2);
+ }
break;
case Opcode.Sub:
if (e1 is BigNum && e2 is BigNum) {
return ((BigNum)e1) - ((BigNum)e2);
}
+ if (e1 is BigDec && e2 is BigDec) {
+ return ((BigDec)e1) - ((BigDec)e2);
+ }
break;
case Opcode.Mul:
if (e1 is BigNum && e2 is BigNum) {
return ((BigNum)e1) * ((BigNum)e2);
}
+ if (e1 is BigDec && e2 is BigDec) {
+ return ((BigDec)e1) * ((BigDec)e2);
+ }
break;
case Opcode.Div:
if (e1 is BigNum && e2 is BigNum) {
@@ -1857,25 +1644,43 @@ namespace Microsoft.Boogie {
return /* TODO: right semantics? */ ((BigNum)e1) % ((BigNum)e2);
}
break;
+ case Opcode.RealDiv:
+ // TODO: add partial evaluation fro real division
+ break;
+ case Opcode.Pow:
+ // TODO: add partial evaluation fro real exponentiation
+ break;
case Opcode.Lt:
if (e1 is BigNum && e2 is BigNum) {
return ((BigNum)e1) < ((BigNum)e2);
}
+ if (e1 is BigDec && e2 is BigDec) {
+ return ((BigDec)e1) < ((BigDec)e2);
+ }
break;
case Opcode.Le:
if (e1 is BigNum && e2 is BigNum) {
return ((BigNum)e1) <= ((BigNum)e2);
}
+ if (e1 is BigDec && e2 is BigDec) {
+ return ((BigDec)e1) <= ((BigDec)e2);
+ }
break;
case Opcode.Gt:
if (e1 is BigNum && e2 is BigNum) {
return ((BigNum)e1) > ((BigNum)e2);
}
+ if (e1 is BigDec && e2 is BigDec) {
+ return ((BigDec)e1) > ((BigDec)e2);
+ }
break;
case Opcode.Ge:
if (e1 is BigNum && e2 is BigNum) {
return ((BigNum)e1) >= ((BigNum)e2);
}
+ if (e1 is BigDec && e2 is BigDec) {
+ return ((BigDec)e1) >= ((BigDec)e2);
+ }
break;
case Opcode.And:
@@ -1917,7 +1722,7 @@ namespace Microsoft.Boogie {
}
- public class FunctionCall : IAppliable, AI.IFunctionSymbol {
+ public class FunctionCall : IAppliable {
private IdentifierExpr/*!*/ name;
public Function Func;
public FunctionCall(IdentifierExpr name) {
@@ -1940,25 +1745,6 @@ namespace Microsoft.Boogie {
Contract.Invariant(name != null);
}
- public FunctionCall createUnresolvedCopy()
- {
- return new FunctionCall(new IdentifierExpr(name.tok, name.Name, name.Type));
- }
-
- public AI.IFunctionSymbol/*!*/ AIFunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
-
- if (name.Name == "$typeof") {
- return AI.Value.Typeof;
- } else if (name.Name == "$allocated") {
- return AI.FieldName.Allocated;
- } else {
- return this;
- }
- }
- }
-
[Pure]
public override string ToString() {
Contract.Ensures(Contract.Result<string>() != null);
@@ -1977,15 +1763,6 @@ namespace Microsoft.Boogie {
return Func.GetHashCode();
}
- public AI.AIType/*!*/ AIType {
- get {
- Contract.Ensures(Contract.Result<AIType>() != null);
-
- Contract.Assume(this.Func != null);
- return AI.Value.FunctionType(this.Func.InParams.Length);
- }
- }
-
virtual public void Emit(ExprSeq args, TokenTextWriter stream, int contextBindingStrength, bool fragileContext) {
//Contract.Requires(stream != null);
//Contract.Requires(args != null);
@@ -2088,7 +1865,7 @@ namespace Microsoft.Boogie {
stream.SetToken(ref this.tok);
Contract.Assert(args.Length == 1);
// determine if parens are needed
- int opBindingStrength = 0x70;
+ int opBindingStrength = 0x80;
bool parensNeeded = opBindingStrength < contextBindingStrength ||
(fragileContext && opBindingStrength == contextBindingStrength);
@@ -2139,24 +1916,123 @@ namespace Microsoft.Boogie {
return this.Type;
}
- public AI.IFunctionSymbol/*!*/ AIFunctionSymbol {
+ public T Dispatch<T>(IAppliableVisitor<T> visitor) {
+ //Contract.Requires(visitor != null);
+ return visitor.Visit(this);
+ }
+
+ }
+
+ public class ArithmeticCoercion : IAppliable {
+ public enum CoercionType {
+ ToInt,
+ ToReal
+ }
+
+ private IToken/*!*/ tok;
+ public readonly CoercionType Coercion;
+ private readonly string name;
+ private readonly Type type;
+ private readonly Type argType;
+ private readonly int hashCode;
+
+ public ArithmeticCoercion(IToken tok, CoercionType coercion) {
+ this.tok = tok;
+ this.Coercion = coercion;
+
+ switch (coercion) {
+ case CoercionType.ToInt:
+ this.name = "int";
+ this.type = Type.Int;
+ this.argType = Type.Real;
+ this.hashCode = 1;
+ break;
+ case CoercionType.ToReal:
+ this.name = "real";
+ this.type = Type.Real;
+ this.argType = Type.Int;
+ this.hashCode = 2;
+ break;
+ default:
+ Contract.Assert(false);
+ break;
+ }
+ }
+
+ [Pure]
+ public override string ToString() {
+ Contract.Ensures(Contract.Result<string>() != null);
+ return this.name;
+ }
+
+ [Pure]
+ [Reads(ReadsAttribute.Reads.Nothing)]
+ public override bool Equals(object other) {
+ ArithmeticCoercion ac = other as ArithmeticCoercion;
+ return ac != null && this.Coercion == ac.Coercion;
+ }
+
+ [Pure]
+ public override int GetHashCode() {
+ return this.hashCode;
+ }
+
+ public string/*!*/ FunctionName {
get {
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
+ return this.name;
+ }
+ }
- // not really clear what should be returned here ...
- // should the operation be completely invisible for the abstract interpretation?
- return AI.Heap.UnsupportedHeapOp;
+ public int ArgumentCount {
+ get {
+ return 1;
}
}
- public T Dispatch<T>(IAppliableVisitor<T> visitor) {
+ virtual public void Emit(ExprSeq args, TokenTextWriter stream, int contextBindingStrength, bool fragileContext) {
+ //Contract.Requires(stream != null);
+ //Contract.Requires(args != null);
+ stream.Write(this.name);
+ stream.Write("(");
+ args.Emit(stream);
+ stream.Write(")");
+ }
+
+ public void Resolve(ResolutionContext rc, Expr subjectForErrorReporting) {
+ //Contract.Requires(subjectForErrorReporting != null);
+ //Contract.Requires(rc != null);
+ }
+
+ public virtual Type Typecheck(ref ExprSeq args, out TypeParamInstantiation tpInstantiation, TypecheckingContext tc) {
+ //Contract.Requires(tc != null);
+ //Contract.Requires(args != null);
+ Contract.Ensures(args != null);
+ Contract.Ensures(Contract.ValueAtReturn(out tpInstantiation) != null);
+
+ Contract.Assert(args.Length == 1);
+
+ tpInstantiation = SimpleTypeParamInstantiation.EMPTY;
+
+ if (!cce.NonNull(cce.NonNull(args[0]).Type).Unify(argType)) {
+ tc.Error(this.tok, "argument type {0} does not match expected type {1}", cce.NonNull(args[0]).Type, this.argType);
+ }
+
+ return this.type;
+ }
+
+ public Type ShallowType(ExprSeq args) {
+ //Contract.Requires(args != null);
+ Contract.Ensures(Contract.Result<Type>() != null);
+ return this.type;
+ }
+
+ public virtual T Dispatch<T>(IAppliableVisitor<T> visitor) {
//Contract.Requires(visitor != null);
return visitor.Visit(this);
}
-
}
- public class NAryExpr : Expr, AI.IFunApp {
+ public class NAryExpr : Expr {
[Additive]
[Peer]
public IAppliable/*!*/ Fun;
@@ -2264,44 +2140,6 @@ namespace Microsoft.Boogie {
}
}
- public override AI.IExpr/*!*/ IExpr {
- get {
- Contract.Ensures(Contract.Result<IExpr>() != null);
-
- return this;
- }
- }
- public AI.IFunctionSymbol/*!*/ FunctionSymbol {
- get {
-
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
-
- return Fun.AIFunctionSymbol;
- }
- }
- public IList/*<AI.IExpr!>*//*!*/ Arguments {
- get {
- Contract.Ensures(Contract.Result<IList>() != null);
-
- AI.IExpr[] a = new AI.IExpr[Args.Length];
- for (int i = 0; i < Args.Length; i++) {
- a[i] = cce.NonNull(Args[i]).IExpr;
- }
- return ArrayList.ReadOnly(a);
- }
- }
- public AI.IFunApp CloneWithArguments(IList/*<AI.IExpr!>*/ args) {
- //Contract.Requires(args != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- return new NAryExpr(this.tok, this.Fun, BoogieFactory.IExprArray2ExprSeq(args));
- }
-
- [Pure]
- public object DoVisit(AI.ExprVisitor visitor) {
- //Contract.Requires(visitor != null);
- return visitor.VisitFunApp(this);
- }
-
public override Absy StdDispatch(StandardVisitor visitor) {
//Contract.Requires(visitor != null);
Contract.Ensures(Contract.Result<Absy>() != null);
@@ -2309,7 +2147,7 @@ namespace Microsoft.Boogie {
}
}
- public class MapSelect : IAppliable, AI.IFunctionSymbol {
+ public class MapSelect : IAppliable {
public readonly int Arity;
private readonly IToken/*!*/ tok;
@@ -2361,7 +2199,7 @@ namespace Microsoft.Boogie {
bool withRhs) {
Contract.Requires(args != null);
Contract.Requires(stream != null);
- const int opBindingStrength = 0x80;
+ const int opBindingStrength = 0x90;
bool parensNeeded = opBindingStrength < contextBindingStrength ||
(fragileContext && opBindingStrength == contextBindingStrength);
@@ -2484,40 +2322,13 @@ namespace Microsoft.Boogie {
return Type.InferValueType(mapType.TypeParameters, mapType.Arguments, mapType.Result, actualArgTypes);
}
- public AI.IFunctionSymbol/*!*/ AIFunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
-
- switch (Arity) {
- case 1:
- return AI.Heap.Select1;
- case 2:
- return AI.Heap.Select2;
- default:
- // Maps with Arity arguments are not fully supported yet
- return AI.Heap.UnsupportedHeapOp;
- }
- }
- }
-
- public AI.AIType/*!*/ AIType {
- [Rep]
- [ResultNotNewlyAllocated]
- get {
- Contract.Ensures(Contract.Result<AIType>() != null);
-
- return AI.Prop.Type; // THAT is a type? PR: no idea whether this makes sense,
- // but it is the type of select1
- }
- }
-
public T Dispatch<T>(IAppliableVisitor<T> visitor) {
//Contract.Requires(visitor != null);
return visitor.Visit(this);
}
}
- public class MapStore : IAppliable, AI.IFunctionSymbol {
+ public class MapStore : IAppliable {
public readonly int Arity;
public readonly IToken/*!*/ tok;
@@ -2631,32 +2442,6 @@ namespace Microsoft.Boogie {
return cce.NonNull(args[0]).ShallowType;
}
- public AI.IFunctionSymbol/*!*/ AIFunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
-
- switch (Arity) {
- case 1:
- return AI.Heap.Update1;
- case 2:
- return AI.Heap.Update2;
- default:
- // Maps with Arity arguments are not fully supported yet
- return AI.Heap.UnsupportedHeapOp;
- }
- }
- }
-
- public AI.AIType/*!*/ AIType {
- [Rep]
- [ResultNotNewlyAllocated]
- get {
- Contract.Ensures(Contract.Result<AIType>() != null);
-
- return AI.Heap.Type;
- }
- }
-
public T Dispatch<T>(IAppliableVisitor<T> visitor) {
//Contract.Requires(visitor != null);
return visitor.Visit(this);
@@ -2664,7 +2449,7 @@ namespace Microsoft.Boogie {
}
- public class IfThenElse : IAppliable, AI.IFunctionSymbol {
+ public class IfThenElse : IAppliable {
public IToken/*!*/ tok;
[ContractInvariantMethod]
@@ -2758,23 +2543,6 @@ namespace Microsoft.Boogie {
return cce.NonNull(args[1]).ShallowType;
}
- public AI.IFunctionSymbol/*!*/ AIFunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
- return this;
- }
- }
-
- public AI.AIType/*!*/ AIType {
- [Rep]
- [ResultNotNewlyAllocated]
- get {
- Contract.Ensures(Contract.Result<AIType>() != null);
-
- return AI.Value.FunctionType(3);
- }
- }
-
public T Dispatch<T>(IAppliableVisitor<T> visitor) {
//Contract.Requires(visitor != null);
return visitor.Visit(this);
@@ -2783,7 +2551,7 @@ namespace Microsoft.Boogie {
- public class CodeExpr : Expr, AI.IUnknown {
+ public class CodeExpr : Expr {
public VariableSeq/*!*/ LocVars;
[Rep]
public List<Block/*!*/>/*!*/ Blocks;
@@ -2802,18 +2570,6 @@ namespace Microsoft.Boogie {
Blocks = blocks;
}
- public override AI.IExpr/*!*/ IExpr {
- get {
- Contract.Ensures(Contract.Result<IExpr>() != null);
- return this;
- }
- }
- [Pure]
- public object DoVisit(AI.ExprVisitor visitor) {
- //Contract.Requires(visitor != null);
- return this;
- }
-
public override void ComputeFreeVariables(Set /*Variable*/ freeVars) {
//Contract.Requires(freeVars != null);
// Treat a BlockEexpr as if it has no free variables at all
@@ -2894,7 +2650,7 @@ namespace Microsoft.Boogie {
}
}
- public class BvExtractExpr : Expr, AI.IFunApp {
+ public class BvExtractExpr : Expr {
public /*readonly--except in StandardVisitor*/ Expr/*!*/ Bitvector;
[ContractInvariantMethod]
void ObjectInvariant() {
@@ -2934,7 +2690,7 @@ namespace Microsoft.Boogie {
public override void Emit(TokenTextWriter stream, int contextBindingStrength, bool fragileContext) {
//Contract.Requires(stream != null);
stream.SetToken(this);
- int opBindingStrength = 0x80;
+ int opBindingStrength = 0x90;
bool parensNeeded = opBindingStrength < contextBindingStrength ||
(fragileContext && opBindingStrength == contextBindingStrength);
@@ -2987,56 +2743,6 @@ namespace Microsoft.Boogie {
}
}
- public override AI.IExpr/*!*/ IExpr {
- get {
- Contract.Ensures(Contract.Result<IExpr>() != null);
-
- return this;
- }
- }
- public AI.IFunctionSymbol/*!*/ FunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
-
- return AI.Bv.Extract;
- }
- }
- public IList/*<AI.IExpr!>*//*!*/ Arguments {
- get {
- Contract.Ensures(Contract.Result<IList>() != null);
-
- AI.IExpr[] a = new AI.IExpr[3];
- a[0] = Bitvector.IExpr;
- a[1] = new LiteralExpr(Token.NoToken, BigNum.FromInt(End));
- a[2] = new LiteralExpr(Token.NoToken, BigNum.FromInt(Start));
- return ArrayList.ReadOnly(a);
- }
- }
- public AI.IFunApp CloneWithArguments(IList/*<AI.IExpr!>*/ args) {
- //Contract.Requires(args != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- AI.IFunApp retFun;
-
- if (args.Count == 3) {
- retFun = new BvExtractExpr(this.tok,
- BoogieFactory.IExpr2Expr(cce.NonNull((AI.IExpr)args[0])),
- cce.NonNull((LiteralExpr/*!*/)args[1]).asBigNum.ToIntSafe,
- cce.NonNull((LiteralExpr/*!*/)args[2]).asBigNum.ToIntSafe);
- } else {
- {
- Contract.Assert(false);
- throw new cce.UnreachableException();
- } // If we are something wrong is happended
- }
- return retFun;
- }
-
- [Pure]
- public object DoVisit(AI.ExprVisitor visitor) {
- //Contract.Requires(visitor != null);
- return visitor.VisitFunApp(this);
- }
-
public override Absy StdDispatch(StandardVisitor visitor) {
//Contract.Requires(visitor != null);
Contract.Ensures(Contract.Result<Absy>() != null);
@@ -3044,7 +2750,7 @@ namespace Microsoft.Boogie {
}
}
- public class BvConcatExpr : Expr, AI.IFunApp {
+ public class BvConcatExpr : Expr {
public /*readonly--except in StandardVisitor*/ Expr/*!*/ E0, E1;
[ContractInvariantMethod]
void ObjectInvariant() {
@@ -3137,53 +2843,6 @@ namespace Microsoft.Boogie {
}
}
- public override AI.IExpr/*!*/ IExpr {
- get {
- Contract.Ensures(Contract.Result<IExpr>() != null);
-
- return this;
- }
- }
- public AI.IFunctionSymbol/*!*/ FunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<IFunctionSymbol>() != null);
- return AI.Bv.Concat;
- }
- }
- public IList/*<AI.IExpr!>*//*!*/ Arguments {
- get {
- Contract.Ensures(Contract.Result<IList>() != null);
-
- AI.IExpr[] a = new AI.IExpr[2];
- a[0] = E0.IExpr;
- a[1] = E1.IExpr;
- return ArrayList.ReadOnly(a);
- }
- }
- public AI.IFunApp CloneWithArguments(IList/*<AI.IExpr!>*/ args) {
- //Contract.Requires(args != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- AI.IFunApp/*!*/ retFun;
-
- if (args.Count == 2) {
- retFun = new BvConcatExpr(this.tok,
- BoogieFactory.IExpr2Expr(cce.NonNull((AI.IExpr/*!*/)args[0])),
- BoogieFactory.IExpr2Expr(cce.NonNull((AI.IExpr/*!*/)args[1])));
- } else {
- {
- Contract.Assert(false);
- throw new cce.UnreachableException();
- } // If we are something wrong is happended
- }
- return retFun;
- }
-
- [Pure]
- public object DoVisit(AI.ExprVisitor visitor) {
- //Contract.Requires(visitor != null);
- return visitor.VisitFunApp(this);
- }
-
public override Absy StdDispatch(StandardVisitor visitor) {
//Contract.Requires(visitor != null);
Contract.Ensures(Contract.Result<Absy>() != null);
diff --git a/Source/Core/AbsyQuant.cs b/Source/Core/AbsyQuant.cs
index 3f798fd2..05fdb7e4 100644
--- a/Source/Core/AbsyQuant.cs
+++ b/Source/Core/AbsyQuant.cs
@@ -13,7 +13,6 @@ namespace Microsoft.Boogie {
using System.Diagnostics;
using System.Collections.Generic;
using Microsoft.Boogie.AbstractInterpretation;
- using AI = Microsoft.AbstractInterpretationFramework;
using System.Diagnostics.Contracts;
using Microsoft.Basetypes;
@@ -38,24 +37,11 @@ namespace Microsoft.Boogie {
public BinderExprContracts():base(null,null,null,null,null){
}
- public override Microsoft.AbstractInterpretationFramework.IFunctionSymbol FunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<AI.IFunctionSymbol>() != null);
- throw new NotImplementedException();
- }
- }
-
public override Type ShallowType {
get {
throw new NotImplementedException();
}
}
-
- public override Microsoft.AbstractInterpretationFramework.IExpr IExpr {
- get {
- throw new NotImplementedException();
- }
- }
}
[ContractClass(typeof(BinderExprContracts))]
public abstract class BinderExpr : Expr {
@@ -217,211 +203,6 @@ namespace Microsoft.Boogie {
}
return unmentionedParameters;
}
-
-
- public abstract AI.IFunctionSymbol/*!*/ FunctionSymbol {
- get;
- }
-
- internal sealed class AIQuantifier : AI.IFunApp {
- internal readonly AIFunctionRep/*!*/ arg;
- [ContractInvariantMethod]
- void ObjectInvariant() {
- Contract.Invariant(arg != null);
- }
-
- internal AIQuantifier(BinderExpr/*!*/ realQuantifier, int dummyIndex)
- : this(new AIFunctionRep(realQuantifier, dummyIndex)) {
- Contract.Requires(realQuantifier != null);
- }
- [Pure]
- [Reads(ReadsAttribute.Reads.Nothing)]
- public override bool Equals(object obj) {
- if (obj == null)
- return false;
- if (!(obj is AIQuantifier))
- return false;
-
- AIQuantifier other = (AIQuantifier)obj;
- return object.Equals(this.arg, other.arg);
- }
- [Pure]
- public override int GetHashCode() {
- return this.arg.GetHashCode();
- }
-
- private AIQuantifier(AIFunctionRep arg) {
- Contract.Requires(arg != null);
- this.arg = arg;
- // base();
- }
-
- [Pure]
- public object DoVisit(AI.ExprVisitor visitor) {
- //Contract.Requires(visitor != null);
- return visitor.VisitFunApp(this);
- }
-
- public AI.IFunctionSymbol/*!*/ FunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<AI.IFunctionSymbol>() != null);
- return arg.RealQuantifier.FunctionSymbol;
- }
- }
-
- private IList/*?*/ argCache = null;
- public IList/*<IExpr!>*//*!*/ Arguments {
-
- get {
- Contract.Ensures(Contract.Result<IList>() != null);
-
- if (argCache == null) {
- IList a = new ArrayList(1);
- a.Add(arg);
- argCache = ArrayList.ReadOnly(a);
- }
- return argCache;
- }
- }
-
- public AI.IFunApp CloneWithArguments(IList/*<IExpr!>*/ args) {
- //Contract.Requires(args != null);
- Contract.Ensures(Contract.Result<AI.IFunApp>() != null);
- Contract.Assume(args.Count == 1);
-
- AIFunctionRep rep = args[0] as AIFunctionRep;
- if (rep != null)
- return new AIQuantifier(rep);
- else
- throw new System.NotImplementedException();
- }
-
- [Pure]
- public override string ToString() {
- Contract.Ensures(Contract.Result<string>() != null);
- return string.Format("{0}({1})", FunctionSymbol, arg);
- }
- }
-
- internal sealed class AIFunctionRep : AI.IFunction {
- internal readonly BinderExpr/*!*/ RealQuantifier;
- [ContractInvariantMethod]
- void ObjectInvariant() {
- Contract.Invariant(RealQuantifier != null);
- }
-
- private readonly int dummyIndex;
-
- internal AIFunctionRep(BinderExpr realQuantifier, int dummyIndex) {
- Contract.Requires(realQuantifier != null);
- this.RealQuantifier = realQuantifier;
- this.dummyIndex = dummyIndex;
- Contract.Assert(realQuantifier.TypeParameters.Length == 0); // PR: don't know how to handle this yet
- // base();
- }
- [Pure]
- [Reads(ReadsAttribute.Reads.Nothing)]
- public override bool Equals(object obj) {
- if (obj == null)
- return false;
- if (!(obj is AIFunctionRep))
- return false;
-
- AIFunctionRep other = (AIFunctionRep)obj;
- return object.Equals(this.RealQuantifier, other.RealQuantifier) && this.dummyIndex == other.dummyIndex;
- }
- [Pure]
- public override int GetHashCode() {
- return this.RealQuantifier.GetHashCode() ^ dummyIndex;
- }
-
- [Pure]
- public object DoVisit(AI.ExprVisitor visitor) {
- //Contract.Requires(visitor != null);
- return visitor.VisitFunction(this);
- }
-
- public AI.IVariable/*!*/ Param {
-
- get {
- Contract.Ensures(Contract.Result<AI.IVariable>() != null);
- return cce.NonNull(RealQuantifier.Dummies[dummyIndex]);
- }
- }
- public AI.AIType/*!*/ ParamType {
- get {
- Contract.Ensures(Contract.Result<AI.AIType>() != null);
- throw new System.NotImplementedException();
- }
- }
-
- // We lazily convert to 1 dummy per quantifier representation for AIFramework
- private AI.IExpr/*?*/ bodyCache = null;
- public AI.IExpr/*!*/ Body {
- get {
- Contract.Ensures(Contract.Result<AI.IExpr>() != null);
-
- if (bodyCache == null) {
- int dummyi = dummyIndex;
- int dummylen = RealQuantifier.Dummies.Length;
- Contract.Assume(dummylen > dummyi);
-
- // return the actual body if there are no more dummies
- if (dummyi + 1 == dummylen)
- bodyCache = RealQuantifier.Body.IExpr;
- else {
- AIQuantifier innerquant = new AIQuantifier(RealQuantifier, dummyi + 1);
- bodyCache = innerquant;
- }
- }
- return bodyCache;
- }
- }
- public AI.IFunction CloneWithBody(AI.IExpr body) {
- //Contract.Requires(body != null);
- Contract.Ensures(Contract.Result<AI.IFunction>() != null);
- BinderExpr realquant;
-
- AIQuantifier innerquant = body as AIQuantifier;
- if (innerquant == null) {
- // new quantifier body, clone the real quantifier
- realquant = (BinderExpr)RealQuantifier.Clone();
- realquant.Body = BoogieFactory.IExpr2Expr(body);
- } else {
- if (innerquant.arg.dummyIndex > 0) {
- realquant = innerquant.arg.RealQuantifier;
- } else {
- realquant = (BinderExpr)RealQuantifier.Clone();
- VariableSeq/*!*/ newdummies = new VariableSeq();
- newdummies.Add(Param);
- newdummies.AddRange(innerquant.arg.RealQuantifier.Dummies);
- realquant.Dummies = newdummies;
- realquant.Body = innerquant.arg.RealQuantifier.Body;
- }
- }
-
- return new AIFunctionRep(realquant, dummyIndex);
- }
- [Pure]
- public override string ToString() {
- Contract.Ensures(Contract.Result<string>() != null);
- return string.Format("\\{0} :: {1}", Param, Body);
- }
- }
-
- private AI.IExpr aiexprCache = null;
- public override AI.IExpr/*!*/ IExpr {
- get {
- Contract.Ensures(Contract.Result<AI.IExpr>() != null);
-
- if (TypeParameters.Length > 0)
- return new Constant(Token.NoToken, new TypedIdent(Token.NoToken, "anon", Type.Bool));
- if (aiexprCache == null) {
- aiexprCache = new AIQuantifier(this, 0);
- }
- return aiexprCache;
- }
- }
}
public class QKeyValue : Absy {
@@ -678,13 +459,6 @@ namespace Microsoft.Boogie {
Contract.Requires(dummies.Length + typeParams.Length > 0);
//:base(tok, typeParams, dummies, null, null, body); // here for aesthetic reasons
}
- public override AI.IFunctionSymbol/*!*/ FunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<AI.IFunctionSymbol>() != null);
-
- return AI.Prop.Forall;
- }
- }
public override Absy StdDispatch(StandardVisitor visitor) {
//Contract.Requires(visitor != null);
@@ -726,13 +500,6 @@ namespace Microsoft.Boogie {
Contract.Requires(dummies.Length > 0);
//:base(tok, new TypeVariableSeq(), dummies, null, null, body); // here for aesthetic reasons
}
- public override AI.IFunctionSymbol/*!*/ FunctionSymbol {
- get {
- Contract.Ensures(Contract.Result<AI.IFunctionSymbol>() != null);
-
- return AI.Prop.Exists;
- }
- }
public override Absy StdDispatch(StandardVisitor visitor) {
//Contract.Requires(visitor != null);
@@ -1006,15 +773,6 @@ namespace Microsoft.Boogie {
}
}
- public override AI.IFunctionSymbol/*!*/ FunctionSymbol {
-
- get {
- Contract.Ensures(Contract.Result<AI.IFunctionSymbol>() != null);
-
- return AI.Prop.Lambda;
- }
- }
-
public override Absy StdDispatch(StandardVisitor visitor) {
//Contract.Requires(visitor != null);
Contract.Ensures(Contract.Result<Absy>() != null);
diff --git a/Source/Core/AbsyType.cs b/Source/Core/AbsyType.cs
index a22ece7d..d78e0d34 100644
--- a/Source/Core/AbsyType.cs
+++ b/Source/Core/AbsyType.cs
@@ -13,7 +13,6 @@ namespace Microsoft.Boogie {
using System.Diagnostics;
using System.Collections.Generic;
using Microsoft.Boogie.AbstractInterpretation;
- using AI = Microsoft.AbstractInterpretationFramework;
using System.Diagnostics.Contracts;
//=====================================================================
@@ -240,6 +239,11 @@ namespace Microsoft.Boogie {
return false;
}
}
+ public virtual bool IsReal {
+ get {
+ return false;
+ }
+ }
public virtual bool IsBool {
get {
return false;
@@ -331,6 +335,7 @@ namespace Microsoft.Boogie {
}
public static readonly Type/*!*/ Int = new BasicType(SimpleType.Int);
+ public static readonly Type/*!*/ Real = new BasicType(SimpleType.Real);
public static readonly Type/*!*/ Bool = new BasicType(SimpleType.Bool);
private static BvType[] bvtypeCache;
@@ -866,6 +871,8 @@ namespace Microsoft.Boogie {
switch (T) {
case SimpleType.Int:
return "int";
+ case SimpleType.Real:
+ return "real";
case SimpleType.Bool:
return "bool";
}
@@ -983,6 +990,11 @@ namespace Microsoft.Boogie {
return this.T == SimpleType.Int;
}
}
+ public override bool IsReal {
+ get {
+ return this.T == SimpleType.Real;
+ }
+ }
public override bool IsBool {
get {
return this.T == SimpleType.Bool;
@@ -1884,6 +1896,12 @@ Contract.Requires(that != null);
return p != null && p.IsInt;
}
}
+ public override bool IsReal {
+ get {
+ Type p = ProxyFor;
+ return p != null && p.IsReal;
+ }
+ }
public override bool IsBool {
get {
Type p = ProxyFor;
@@ -2727,6 +2745,11 @@ Contract.Requires(that != null);
return ExpandedType.IsInt;
}
}
+ public override bool IsReal {
+ get {
+ return ExpandedType.IsReal;
+ }
+ }
public override bool IsBool {
get {
return ExpandedType.IsBool;
@@ -3500,6 +3523,7 @@ Contract.Ensures(Contract.ValueAtReturn(out tpInstantiation) != null);
public enum SimpleType {
Int,
+ Real,
Bool
};
diff --git a/Source/Core/BoogiePL.atg b/Source/Core/BoogiePL.atg
index 9c721703..96ba9824 100644
--- a/Source/Core/BoogiePL.atg
+++ b/Source/Core/BoogiePL.atg
@@ -12,7 +12,6 @@ using System.Text;
using Microsoft.Boogie;
using Microsoft.Basetypes;
using Bpl = Microsoft.Boogie;
-using AI = Microsoft.AbstractInterpretationFramework;
COMPILER BoogiePL
@@ -115,7 +114,6 @@ private class BvBounds : Expr {
{Contract.Assert(false);throw new cce.UnreachableException();}
}
public override void ComputeFreeVariables(GSet<object>/*!*/ freeVars) {Contract.Requires(freeVars != null); {Contract.Assert(false);throw new cce.UnreachableException();} }
- public override AI.IExpr/*!*/ IExpr { get { Contract.Ensures(Contract.Result<AI.IExpr>()!=null); {Contract.Assert(false);throw new cce.UnreachableException();} } }
}
/*--------------------------------------------------------------------------*/
@@ -147,7 +145,8 @@ TOKENS
string = quote { regularStringChar | "\\\"" } quote.
- float = digit {digit} '.' {digit}.
+ decimal = digit {digit} 'e' [ '-' ] digit {digit} .
+ float = digit {digit} '.' digit {digit} [ 'e' [ '-' ] digit {digit} ] .
COMMENTS FROM "/*" TO "*/" NESTED
COMMENTS FROM "//" TO lf
@@ -315,6 +314,7 @@ TypeArgs<TypeSeq/*!*/ ts>
TypeAtom<out Bpl.Type/*!*/ ty>
= (.Contract.Ensures(Contract.ValueAtReturn(out ty) != null); ty = dummyType; .)
( "int" (. ty = new BasicType(t, SimpleType.Int); .)
+ | "real" (. ty = new BasicType(t, SimpleType.Real); .)
| "bool" (. ty = new BasicType(t, SimpleType.Bool); .)
/* note: bitvectors are handled in UnresolvedTypeIdentifier */
|
@@ -1164,27 +1164,39 @@ AddOp<out IToken/*!*/ x, out BinaryOperator.Opcode op>
/*------------------------------------------------------------------------*/
Factor<out Expr/*!*/ e0>
= (.Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expr/*!*/ e1; BinaryOperator.Opcode op; .)
- UnaryExpression<out e0>
+ Power<out e0>
{ MulOp<out x, out op>
- UnaryExpression<out e1> (. e0 = Expr.Binary(x, op, e0, e1); .)
+ Power<out e1> (. e0 = Expr.Binary(x, op, e0, e1); .)
}
.
MulOp<out IToken/*!*/ x, out BinaryOperator.Opcode op>
= (. Contract.Ensures(Contract.ValueAtReturn(out x) != null); x = Token.NoToken; op=BinaryOperator.Opcode.Add/*(dummy)*/; .)
( "*" (. x = t; op=BinaryOperator.Opcode.Mul; .)
- | "/" (. x = t; op=BinaryOperator.Opcode.Div; .)
- | "%" (. x = t; op=BinaryOperator.Opcode.Mod; .)
+ | "div" (. x = t; op=BinaryOperator.Opcode.Div; .)
+ | "mod" (. x = t; op=BinaryOperator.Opcode.Mod; .)
+ | "/" (. x = t; op=BinaryOperator.Opcode.RealDiv; .)
)
.
/*------------------------------------------------------------------------*/
+Power<out Expr/*!*/ e0>
+= (.Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expr/*!*/ e1; .)
+ UnaryExpression<out e0>
+ [
+ "**" (. x = t; .)
+ /* recurse because exponentation is right-associative */
+ Power<out e1> (. e0 = Expr.Binary(x, BinaryOperator.Opcode.Pow, e0, e1); .)
+ ]
+ .
+
+/*------------------------------------------------------------------------*/
UnaryExpression<out Expr/*!*/ e>
= (. Contract.Ensures(Contract.ValueAtReturn(out e) != null); IToken/*!*/ x;
e = dummyExpr;
.)
( "-" (. x = t; .)
- UnaryExpression<out e> (. e = Expr.Binary(x, BinaryOperator.Opcode.Sub, new LiteralExpr(x, BigNum.ZERO), e); .)
+ UnaryExpression<out e> (. e = Expr.Unary(x, UnaryOperator.Opcode.Neg, e); .)
| NegOp (. x = t; .)
UnaryExpression<out e> (. e = Expr.Unary(x, UnaryOperator.Opcode.Not, e); .)
| CoercionExpression<out e>
@@ -1273,7 +1285,7 @@ ArrayExpression<out Expr/*!*/ e>
/*------------------------------------------------------------------------*/
AtomExpression<out Expr/*!*/ e>
-= (. Contract.Ensures(Contract.ValueAtReturn(out e) != null); IToken/*!*/ x; int n; BigNum bn;
+= (. Contract.Ensures(Contract.ValueAtReturn(out e) != null); IToken/*!*/ x; int n; BigNum bn; BigDec bd;
ExprSeq/*!*/ es; VariableSeq/*!*/ ds; Trigger trig;
TypeVariableSeq/*!*/ typeParams;
IdentifierExpr/*!*/ id;
@@ -1285,6 +1297,7 @@ AtomExpression<out Expr/*!*/ e>
( "false" (. e = new LiteralExpr(t, false); .)
| "true" (. e = new LiteralExpr(t, true); .)
| Nat<out bn> (. e = new LiteralExpr(t, bn); .)
+ | Dec<out bd> (. e = new LiteralExpr(t, bd); .)
| BvLit<out bn, out n> (. e = new LiteralExpr(t, bn, n); .)
| Ident<out x> (. id = new IdentifierExpr(x, x.val); e = id; .)
@@ -1300,6 +1313,16 @@ AtomExpression<out Expr/*!*/ e>
Expression<out e>
")" (. e = new OldExpr(x, e); .)
+ | "int" (. x = t; .)
+ "("
+ Expression<out e>
+ ")" (. e = new NAryExpr(x, new ArithmeticCoercion(x, ArithmeticCoercion.CoercionType.ToInt), new ExprSeq(e)); .)
+
+ | "real" (. x = t; .)
+ "("
+ Expression<out e>
+ ")" (. e = new NAryExpr(x, new ArithmeticCoercion(x, ArithmeticCoercion.CoercionType.ToReal), new ExprSeq(e)); .)
+
| "(" ( Expression<out e> (. if (e is BvBounds)
this.SemErr("parentheses around bitvector bounds " +
"are not allowed"); .)
@@ -1484,6 +1507,23 @@ Nat<out BigNum n>
.
/*------------------------------------------------------------------------*/
+Dec<out BigDec n>
+= (. string s = ""; .)
+ (
+ decimal (. s = t.val; .)
+ |
+ float (. s = t.val; .)
+ )
+ (. try {
+ n = BigDec.FromString(s);
+ } catch (FormatException) {
+ this.SemErr("incorrectly formatted number");
+ n = BigDec.ZERO;
+ }
+ .)
+ .
+
+/*------------------------------------------------------------------------*/
BvLit<out BigNum n, out int m>
=
bvlit
diff --git a/Source/Core/CommandLineOptions.cs b/Source/Core/CommandLineOptions.cs
index 73fa8946..55f15454 100644
--- a/Source/Core/CommandLineOptions.cs
+++ b/Source/Core/CommandLineOptions.cs
@@ -609,26 +609,9 @@ namespace Microsoft.Boogie {
}
public class AiFlags {
- public bool Intervals = false;
- public bool Constant = false;
- public bool DynamicType = false;
- public bool Nullness = false;
- public bool Polyhedra = false;
public bool J_Trivial = false;
public bool J_Intervals = false;
public bool DebugStatistics = false;
-
- public bool AnySet {
- get {
- return Intervals
- || Constant
- || DynamicType
- || Nullness
- || Polyhedra
- || J_Trivial
- || J_Intervals;
- }
- }
}
public AiFlags/*!*/ Ai = new AiFlags();
@@ -639,26 +622,6 @@ namespace Microsoft.Boogie {
if (ps.ConfirmArgumentCount(1)) {
foreach (char c in cce.NonNull(args[ps.i])) {
switch (c) {
- case 'i':
- Ai.Intervals = true;
- UseAbstractInterpretation = true;
- break;
- case 'c':
- Ai.Constant = true;
- UseAbstractInterpretation = true;
- break;
- case 'd':
- Ai.DynamicType = true;
- UseAbstractInterpretation = true;
- break;
- case 'n':
- Ai.Nullness = true;
- UseAbstractInterpretation = true;
- break;
- case 'p':
- Ai.Polyhedra = true;
- UseAbstractInterpretation = true;
- break;
case 't':
Ai.J_Trivial = true;
UseAbstractInterpretation = true;
@@ -697,12 +660,6 @@ namespace Microsoft.Boogie {
}
return true;
- case "logInfer":
- if (ps.ConfirmArgumentCount(0)) {
- Microsoft.AbstractInterpretationFramework.Lattice.LogSwitch = true;
- }
- return true;
-
case "break":
case "launch":
if (ps.ConfirmArgumentCount(0)) {
@@ -1502,7 +1459,6 @@ namespace Microsoft.Boogie {
perform interprocedural inference (deprecated, not supported)
/contractInfer
perform procedure contract inference
- /logInfer print debug output during inference
/instrumentInfer
h - instrument inferred invariants only at beginning of
loop headers (default)
diff --git a/Source/Core/Core.csproj b/Source/Core/Core.csproj
index 9a24b6b2..3a2f421a 100644
--- a/Source/Core/Core.csproj
+++ b/Source/Core/Core.csproj
@@ -172,10 +172,6 @@
<Compile Include="Xml.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\AIFramework\AIFramework.csproj">
- <Project>{39B0658D-C955-41C5-9A43-48C97A1EF5FD}</Project>
- <Name>AIFramework</Name>
- </ProjectReference>
<ProjectReference Include="..\Basetypes\Basetypes.csproj">
<Project>{43DFAD18-3E35-4558-9BE2-CAFF6B5BA8A0}</Project>
<Name>Basetypes</Name>
diff --git a/Source/Core/Parser.cs b/Source/Core/Parser.cs
index 69f505bc..0a10b0a1 100644
--- a/Source/Core/Parser.cs
+++ b/Source/Core/Parser.cs
@@ -6,7 +6,6 @@ using System.Text;
using Microsoft.Boogie;
using Microsoft.Basetypes;
using Bpl = Microsoft.Boogie;
-using AI = Microsoft.AbstractInterpretationFramework;
@@ -24,8 +23,9 @@ public class Parser {
public const int _bvlit = 2;
public const int _digits = 3;
public const int _string = 4;
- public const int _float = 5;
- public const int maxT = 88;
+ public const int _decimal = 5;
+ public const int _float = 6;
+ public const int maxT = 92;
const bool T = true;
const bool x = false;
@@ -134,7 +134,6 @@ private class BvBounds : Expr {
{Contract.Assert(false);throw new cce.UnreachableException();}
}
public override void ComputeFreeVariables(GSet<object>/*!*/ freeVars) {Contract.Requires(freeVars != null); {Contract.Assert(false);throw new cce.UnreachableException();} }
- public override AI.IExpr/*!*/ IExpr { get { Contract.Ensures(Contract.Result<AI.IExpr>()!=null); {Contract.Assert(false);throw new cce.UnreachableException();} } }
}
/*--------------------------------------------------------------------------*/
@@ -219,7 +218,7 @@ private class BvBounds : Expr {
while (StartOf(1)) {
switch (la.kind) {
- case 19: {
+ case 21: {
Consts(out vs);
foreach(Bpl.Variable/*!*/ v in vs){
Contract.Assert(v != null);
@@ -228,7 +227,7 @@ private class BvBounds : Expr {
break;
}
- case 23: {
+ case 25: {
Function(out ds);
foreach(Bpl.Declaration/*!*/ d in ds){
Contract.Assert(d != null);
@@ -237,12 +236,12 @@ private class BvBounds : Expr {
break;
}
- case 27: {
+ case 29: {
Axiom(out ax);
Pgm.TopLevelDeclarations.Add(ax);
break;
}
- case 28: {
+ case 30: {
UserDefinedTypes(out ts);
foreach(Declaration/*!*/ td in ts){
Contract.Assert(td != null);
@@ -251,7 +250,7 @@ private class BvBounds : Expr {
break;
}
- case 6: {
+ case 7: {
GlobalVars(out vs);
foreach(Bpl.Variable/*!*/ v in vs){
Contract.Assert(v != null);
@@ -260,7 +259,7 @@ private class BvBounds : Expr {
break;
}
- case 30: {
+ case 32: {
Procedure(out pr, out im);
Pgm.TopLevelDeclarations.Add(pr);
if (im != null) {
@@ -269,7 +268,7 @@ private class BvBounds : Expr {
break;
}
- case 31: {
+ case 33: {
Implementation(out nnim);
Pgm.TopLevelDeclarations.Add(nnim);
break;
@@ -285,17 +284,17 @@ private class BvBounds : Expr {
bool u = false; QKeyValue kv = null;
bool ChildrenComplete = false;
List<ConstantParent/*!*/> Parents = null;
- Expect(19);
+ Expect(21);
y = t;
- while (la.kind == 25) {
+ while (la.kind == 27) {
Attribute(ref kv);
}
- if (la.kind == 20) {
+ if (la.kind == 22) {
Get();
u = true;
}
IdsType(out xs);
- if (la.kind == 21) {
+ if (la.kind == 23) {
OrderSpec(out ChildrenComplete, out Parents);
}
bool makeClone = false;
@@ -319,7 +318,7 @@ private class BvBounds : Expr {
ds.Add(new Constant(y, x, u, ParentsClone, ChildrenComplete, kv));
}
- Expect(7);
+ Expect(8);
}
void Function(out DeclarationSeq/*!*/ ds) {
@@ -335,44 +334,44 @@ private class BvBounds : Expr {
Expr definition = null;
Expr/*!*/ tmp;
- Expect(23);
- while (la.kind == 25) {
+ Expect(25);
+ while (la.kind == 27) {
Attribute(ref kv);
}
Ident(out z);
- if (la.kind == 17) {
+ if (la.kind == 19) {
TypeParams(out typeParamTok, out typeParams);
}
- Expect(8);
+ Expect(9);
if (StartOf(2)) {
VarOrType(out tyd);
arguments.Add(new Formal(tyd.tok, tyd, true));
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
VarOrType(out tyd);
arguments.Add(new Formal(tyd.tok, tyd, true));
}
}
- Expect(9);
- if (la.kind == 24) {
+ Expect(10);
+ if (la.kind == 26) {
Get();
- Expect(8);
- VarOrType(out tyd);
Expect(9);
+ VarOrType(out tyd);
+ Expect(10);
retTyd = tyd;
- } else if (la.kind == 10) {
+ } else if (la.kind == 11) {
Get();
Type(out retTy);
retTyd = new TypedIdent(retTy.tok, "", retTy);
- } else SynErr(89);
- if (la.kind == 25) {
+ } else SynErr(93);
+ if (la.kind == 27) {
Get();
Expression(out tmp);
definition = tmp;
- Expect(26);
- } else if (la.kind == 7) {
+ Expect(28);
+ } else if (la.kind == 8) {
Get();
- } else SynErr(90);
+ } else SynErr(94);
if (retTyd == null) {
// construct a dummy type for the case of syntax error
tyd = new TypedIdent(t, "", new BasicType(t, SimpleType.Int));
@@ -453,40 +452,40 @@ private class BvBounds : Expr {
void Axiom(out Axiom/*!*/ m) {
Contract.Ensures(Contract.ValueAtReturn(out m) != null); Expr/*!*/ e; QKeyValue kv = null;
- Expect(27);
- while (la.kind == 25) {
+ Expect(29);
+ while (la.kind == 27) {
Attribute(ref kv);
}
IToken/*!*/ x = t;
Proposition(out e);
- Expect(7);
+ Expect(8);
m = new Axiom(x,e, null, kv);
}
void UserDefinedTypes(out List<Declaration/*!*/>/*!*/ ts) {
Contract.Ensures(cce.NonNullElements(Contract.ValueAtReturn(out ts))); Declaration/*!*/ decl; QKeyValue kv = null; ts = new List<Declaration/*!*/> ();
- Expect(28);
- while (la.kind == 25) {
+ Expect(30);
+ while (la.kind == 27) {
Attribute(ref kv);
}
UserDefinedType(out decl, kv);
ts.Add(decl);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
UserDefinedType(out decl, kv);
ts.Add(decl);
}
- Expect(7);
+ Expect(8);
}
void GlobalVars(out VariableSeq/*!*/ ds) {
Contract.Ensures(Contract.ValueAtReturn(out ds) != null); TypedIdentSeq/*!*/ tyds = new TypedIdentSeq(); ds = new VariableSeq(); QKeyValue kv = null;
- Expect(6);
- while (la.kind == 25) {
+ Expect(7);
+ while (la.kind == 27) {
Attribute(ref kv);
}
IdsTypeWheres(true, tyds);
- Expect(7);
+ Expect(8);
foreach(TypedIdent/*!*/ tyd in tyds){
Contract.Assert(tyd != null);
ds.Add(new GlobalVariable(tyd.tok, tyd, kv));
@@ -507,9 +506,9 @@ private class BvBounds : Expr {
QKeyValue kv = null;
impl = null;
- Expect(30);
+ Expect(32);
ProcSignature(true, out x, out typeParams, out ins, out outs, out kv);
- if (la.kind == 7) {
+ if (la.kind == 8) {
Get();
while (StartOf(3)) {
Spec(pre, mods, post);
@@ -522,7 +521,7 @@ private class BvBounds : Expr {
impl = new Implementation(x, x.val, typeParams,
Formal.StripWhereClauses(ins), Formal.StripWhereClauses(outs), locals, stmtList, kv == null ? null : (QKeyValue)kv.Clone(), this.errors);
- } else SynErr(91);
+ } else SynErr(95);
proc = new Procedure(x, x.val, typeParams, ins, outs, pre, mods, post, kv);
}
@@ -534,7 +533,7 @@ private class BvBounds : Expr {
StmtList/*!*/ stmtList;
QKeyValue kv;
- Expect(31);
+ Expect(33);
ProcSignature(false, out x, out typeParams, out ins, out outs, out kv);
ImplBody(out locals, out stmtList);
impl = new Implementation(x, x.val, typeParams, ins, outs, locals, stmtList, kv, this.errors);
@@ -549,7 +548,7 @@ private class BvBounds : Expr {
void IdsTypeWheres(bool allowWhereClauses, TypedIdentSeq/*!*/ tyds) {
Contract.Requires(tyds != null);
IdsTypeWhere(allowWhereClauses, tyds);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
IdsTypeWhere(allowWhereClauses, tyds);
}
@@ -557,12 +556,12 @@ private class BvBounds : Expr {
void LocalVars(VariableSeq/*!*/ ds) {
Contract.Ensures(Contract.ValueAtReturn(out ds) != null); TypedIdentSeq/*!*/ tyds = new TypedIdentSeq(); QKeyValue kv = null;
- Expect(6);
- while (la.kind == 25) {
+ Expect(7);
+ while (la.kind == 27) {
Attribute(ref kv);
}
IdsTypeWheres(true, tyds);
- Expect(7);
+ Expect(8);
foreach(TypedIdent/*!*/ tyd in tyds){
Contract.Assert(tyd != null);
ds.Add(new LocalVariable(tyd.tok, tyd, kv));
@@ -572,11 +571,11 @@ private class BvBounds : Expr {
void ProcFormals(bool incoming, bool allowWhereClauses, out VariableSeq/*!*/ ds) {
Contract.Ensures(Contract.ValueAtReturn(out ds) != null); TypedIdentSeq/*!*/ tyds = new TypedIdentSeq(); ds = new VariableSeq();
- Expect(8);
+ Expect(9);
if (la.kind == 1) {
IdsTypeWheres(allowWhereClauses, tyds);
}
- Expect(9);
+ Expect(10);
foreach(TypedIdent/*!*/ tyd in tyds){
Contract.Assert(tyd != null);
ds.Add(new Formal(tyd.tok, tyd, incoming));
@@ -597,7 +596,7 @@ private class BvBounds : Expr {
void IdsType(out TypedIdentSeq/*!*/ tyds) {
Contract.Ensures(Contract.ValueAtReturn(out tyds) != null); TokenSeq/*!*/ ids; Bpl.Type/*!*/ ty;
Idents(out ids);
- Expect(10);
+ Expect(11);
Type(out ty);
tyds = new TypedIdentSeq();
foreach(Token/*!*/ id in ids){
@@ -611,7 +610,7 @@ private class BvBounds : Expr {
Contract.Ensures(Contract.ValueAtReturn(out xs) != null); IToken/*!*/ id; xs = new TokenSeq();
Ident(out id);
xs.Add(id);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
Ident(out id);
xs.Add(id);
@@ -620,7 +619,7 @@ private class BvBounds : Expr {
void Type(out Bpl.Type/*!*/ ty) {
Contract.Ensures(Contract.ValueAtReturn(out ty) != null); IToken/*!*/ tok; ty = dummyType;
- if (la.kind == 8 || la.kind == 13 || la.kind == 14) {
+ if (StartOf(5)) {
TypeAtom(out ty);
} else if (la.kind == 1) {
Ident(out tok);
@@ -629,17 +628,17 @@ private class BvBounds : Expr {
TypeArgs(args);
}
ty = new UnresolvedTypeIdentifier (tok, tok.val, args);
- } else if (la.kind == 15 || la.kind == 17) {
+ } else if (la.kind == 17 || la.kind == 19) {
MapType(out ty);
- } else SynErr(92);
+ } else SynErr(96);
}
void IdsTypeWhere(bool allowWhereClauses, TypedIdentSeq/*!*/ tyds) {
Contract.Requires(tyds != null); TokenSeq/*!*/ ids; Bpl.Type/*!*/ ty; Expr wh = null; Expr/*!*/ nne;
Idents(out ids);
- Expect(10);
+ Expect(11);
Type(out ty);
- if (la.kind == 12) {
+ if (la.kind == 13) {
Get();
Expression(out nne);
if (allowWhereClauses) {
@@ -659,7 +658,7 @@ private class BvBounds : Expr {
void Expression(out Expr/*!*/ e0) {
Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expr/*!*/ e1;
ImpliesExpression(false, out e0);
- while (la.kind == 50 || la.kind == 51) {
+ while (la.kind == 52 || la.kind == 53) {
EquivOp();
x = t;
ImpliesExpression(false, out e1);
@@ -669,17 +668,20 @@ private class BvBounds : Expr {
void TypeAtom(out Bpl.Type/*!*/ ty) {
Contract.Ensures(Contract.ValueAtReturn(out ty) != null); ty = dummyType;
- if (la.kind == 13) {
+ if (la.kind == 14) {
Get();
ty = new BasicType(t, SimpleType.Int);
- } else if (la.kind == 14) {
+ } else if (la.kind == 15) {
+ Get();
+ ty = new BasicType(t, SimpleType.Real);
+ } else if (la.kind == 16) {
Get();
ty = new BasicType(t, SimpleType.Bool);
- } else if (la.kind == 8) {
+ } else if (la.kind == 9) {
Get();
Type(out ty);
- Expect(9);
- } else SynErr(93);
+ Expect(10);
+ } else SynErr(97);
}
void Ident(out IToken/*!*/ x) {
@@ -693,7 +695,7 @@ private class BvBounds : Expr {
void TypeArgs(TypeSeq/*!*/ ts) {
Contract.Requires(ts != null); IToken/*!*/ tok; Type/*!*/ ty;
- if (la.kind == 8 || la.kind == 13 || la.kind == 14) {
+ if (StartOf(5)) {
TypeAtom(out ty);
ts.Add(ty);
if (StartOf(2)) {
@@ -706,10 +708,10 @@ private class BvBounds : Expr {
if (StartOf(2)) {
TypeArgs(ts);
}
- } else if (la.kind == 15 || la.kind == 17) {
+ } else if (la.kind == 17 || la.kind == 19) {
MapType(out ty);
ts.Add(ty);
- } else SynErr(94);
+ } else SynErr(98);
}
void MapType(out Bpl.Type/*!*/ ty) {
@@ -719,16 +721,16 @@ private class BvBounds : Expr {
Type/*!*/ result;
TypeVariableSeq/*!*/ typeParameters = new TypeVariableSeq();
- if (la.kind == 17) {
+ if (la.kind == 19) {
TypeParams(out nnTok, out typeParameters);
tok = nnTok;
}
- Expect(15);
+ Expect(17);
if (tok == null) tok = t;
if (StartOf(2)) {
Types(arguments);
}
- Expect(16);
+ Expect(18);
Type(out result);
ty = new MapType(tok, typeParameters, arguments, result);
@@ -736,10 +738,10 @@ private class BvBounds : Expr {
void TypeParams(out IToken/*!*/ tok, out Bpl.TypeVariableSeq/*!*/ typeParams) {
Contract.Ensures(Contract.ValueAtReturn(out tok) != null); Contract.Ensures(Contract.ValueAtReturn(out typeParams) != null); TokenSeq/*!*/ typeParamToks;
- Expect(17);
+ Expect(19);
tok = t;
Idents(out typeParamToks);
- Expect(18);
+ Expect(20);
typeParams = new TypeVariableSeq ();
foreach(Token/*!*/ id in typeParamToks){
Contract.Assert(id != null);
@@ -751,7 +753,7 @@ private class BvBounds : Expr {
Contract.Requires(ts != null); Bpl.Type/*!*/ ty;
Type(out ty);
ts.Add(ty);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
Type(out ty);
ts.Add(ty);
@@ -763,21 +765,21 @@ private class BvBounds : Expr {
Parents = null;
bool u;
IToken/*!*/ parent;
- Expect(21);
+ Expect(23);
Parents = new List<ConstantParent/*!*/> ();
u = false;
- if (la.kind == 1 || la.kind == 20) {
- if (la.kind == 20) {
+ if (la.kind == 1 || la.kind == 22) {
+ if (la.kind == 22) {
Get();
u = true;
}
Ident(out parent);
Parents.Add(new ConstantParent (
new IdentifierExpr(parent, parent.val), u));
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
u = false;
- if (la.kind == 20) {
+ if (la.kind == 22) {
Get();
u = true;
}
@@ -786,7 +788,7 @@ private class BvBounds : Expr {
new IdentifierExpr(parent, parent.val), u));
}
}
- if (la.kind == 22) {
+ if (la.kind == 24) {
Get();
ChildrenComplete = true;
}
@@ -796,7 +798,7 @@ private class BvBounds : Expr {
Contract.Ensures(Contract.ValueAtReturn(out tyd) != null); string/*!*/ varName = ""; Bpl.Type/*!*/ ty; IToken/*!*/ tok;
Type(out ty);
tok = ty.tok;
- if (la.kind == 10) {
+ if (la.kind == 11) {
Get();
if (ty is UnresolvedTypeIdentifier &&
cce.NonNull(ty as UnresolvedTypeIdentifier).Arguments.Length == 0) {
@@ -822,7 +824,7 @@ private class BvBounds : Expr {
if (la.kind == 1) {
WhiteSpaceIdents(out paramTokens);
}
- if (la.kind == 29) {
+ if (la.kind == 31) {
Get();
Type(out body);
synonym = true;
@@ -854,15 +856,15 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
Contract.Ensures(Contract.ValueAtReturn(out name) != null); Contract.Ensures(Contract.ValueAtReturn(out typeParams) != null); Contract.Ensures(Contract.ValueAtReturn(out ins) != null); Contract.Ensures(Contract.ValueAtReturn(out outs) != null);
IToken/*!*/ typeParamTok; typeParams = new TypeVariableSeq();
outs = new VariableSeq(); kv = null;
- while (la.kind == 25) {
+ while (la.kind == 27) {
Attribute(ref kv);
}
Ident(out name);
- if (la.kind == 17) {
+ if (la.kind == 19) {
TypeParams(out typeParamTok, out typeParams);
}
ProcFormals(true, allowWhereClausesOnFormals, out ins);
- if (la.kind == 24) {
+ if (la.kind == 26) {
Get();
ProcFormals(false, allowWhereClausesOnFormals, out outs);
}
@@ -870,7 +872,7 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
void Spec(RequiresSeq/*!*/ pre, IdentifierExprSeq/*!*/ mods, EnsuresSeq/*!*/ post) {
Contract.Requires(pre != null); Contract.Requires(mods != null); Contract.Requires(post != null); TokenSeq/*!*/ ms;
- if (la.kind == 32) {
+ if (la.kind == 34) {
Get();
if (la.kind == 1) {
Idents(out ms);
@@ -880,19 +882,19 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
}
}
- Expect(7);
- } else if (la.kind == 33) {
+ Expect(8);
+ } else if (la.kind == 35) {
Get();
SpecPrePost(true, pre, post);
- } else if (la.kind == 34 || la.kind == 35) {
+ } else if (la.kind == 36 || la.kind == 37) {
SpecPrePost(false, pre, post);
- } else SynErr(95);
+ } else SynErr(99);
}
void ImplBody(out VariableSeq/*!*/ locals, out StmtList/*!*/ stmtList) {
Contract.Ensures(Contract.ValueAtReturn(out locals) != null); Contract.Ensures(Contract.ValueAtReturn(out stmtList) != null); locals = new VariableSeq();
- Expect(25);
- while (la.kind == 6) {
+ Expect(27);
+ while (la.kind == 7) {
LocalVars(locals);
}
StmtList(out stmtList);
@@ -900,25 +902,25 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
void SpecPrePost(bool free, RequiresSeq/*!*/ pre, EnsuresSeq/*!*/ post) {
Contract.Requires(pre != null); Contract.Requires(post != null); Expr/*!*/ e; Token tok = null; QKeyValue kv = null;
- if (la.kind == 34) {
+ if (la.kind == 36) {
Get();
tok = t;
- while (la.kind == 25) {
+ while (la.kind == 27) {
Attribute(ref kv);
}
Proposition(out e);
- Expect(7);
+ Expect(8);
pre.Add(new Requires(tok, free, e, null, kv));
- } else if (la.kind == 35) {
+ } else if (la.kind == 37) {
Get();
tok = t;
- while (la.kind == 25) {
+ while (la.kind == 27) {
Attribute(ref kv);
}
Proposition(out e);
- Expect(7);
+ Expect(8);
post.Add(new Ensures(tok, free, e, null, kv));
- } else SynErr(96);
+ } else SynErr(100);
}
void StmtList(out StmtList/*!*/ stmtList) {
@@ -931,8 +933,8 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
StructuredCmd ec = null; StructuredCmd/*!*/ ecn;
TransferCmd tc = null; TransferCmd/*!*/ tcn;
- while (StartOf(5)) {
- if (StartOf(6)) {
+ while (StartOf(6)) {
+ if (StartOf(7)) {
LabelOrCmd(out c, out label);
if (c != null) {
// LabelOrCmd read a Cmd
@@ -955,7 +957,7 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
cs = new CmdSeq();
}
- } else if (la.kind == 38 || la.kind == 40 || la.kind == 43) {
+ } else if (la.kind == 40 || la.kind == 42 || la.kind == 45) {
StructuredCmd(out ecn);
ec = ecn;
if (startToken == null) { startToken = ec.tok; cs = new CmdSeq(); }
@@ -975,7 +977,7 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
}
}
- Expect(26);
+ Expect(28);
IToken/*!*/ endCurly = t;
if (startToken == null && bigblocks.Count == 0) {
startToken = t; cs = new CmdSeq();
@@ -1000,29 +1002,29 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
if (la.kind == 1) {
LabelOrAssign(out c, out label);
- } else if (la.kind == 44) {
+ } else if (la.kind == 46) {
Get();
x = t;
- while (la.kind == 25) {
+ while (la.kind == 27) {
Attribute(ref kv);
}
Proposition(out e);
c = new AssertCmd(x, e, kv);
- Expect(7);
- } else if (la.kind == 45) {
+ Expect(8);
+ } else if (la.kind == 47) {
Get();
x = t;
- while (la.kind == 25) {
+ while (la.kind == 27) {
Attribute(ref kv);
}
Proposition(out e);
c = new AssumeCmd(x, e, kv);
- Expect(7);
- } else if (la.kind == 46) {
+ Expect(8);
+ } else if (la.kind == 48) {
Get();
x = t;
Idents(out xs);
- Expect(7);
+ Expect(8);
ids = new IdentifierExprSeq();
foreach(IToken/*!*/ y in xs){
Contract.Assert(y != null);
@@ -1030,27 +1032,27 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
}
c = new HavocCmd(x,ids);
- } else if (la.kind == 33 || la.kind == 48) {
+ } else if (la.kind == 35 || la.kind == 50) {
CallCmd(out cn);
- Expect(7);
+ Expect(8);
c = cn;
- } else SynErr(97);
+ } else SynErr(101);
}
void StructuredCmd(out StructuredCmd/*!*/ ec) {
Contract.Ensures(Contract.ValueAtReturn(out ec) != null); ec = dummyStructuredCmd; Contract.Assume(cce.IsPeerConsistent(ec));
IfCmd/*!*/ ifcmd; WhileCmd/*!*/ wcmd; BreakCmd/*!*/ bcmd;
- if (la.kind == 38) {
+ if (la.kind == 40) {
IfCmd(out ifcmd);
ec = ifcmd;
- } else if (la.kind == 40) {
+ } else if (la.kind == 42) {
WhileCmd(out wcmd);
ec = wcmd;
- } else if (la.kind == 43) {
+ } else if (la.kind == 45) {
BreakCmd(out bcmd);
ec = bcmd;
- } else SynErr(98);
+ } else SynErr(102);
}
void TransferCmd(out TransferCmd/*!*/ tc) {
@@ -1058,7 +1060,7 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
Token y; TokenSeq/*!*/ xs;
StringSeq ss = new StringSeq();
- if (la.kind == 36) {
+ if (la.kind == 38) {
Get();
y = t;
Idents(out xs);
@@ -1067,11 +1069,11 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
ss.Add(s.val); }
tc = new GotoCmd(y, ss);
- } else if (la.kind == 37) {
+ } else if (la.kind == 39) {
Get();
tc = new ReturnCmd(t);
- } else SynErr(99);
- Expect(7);
+ } else SynErr(103);
+ Expect(8);
}
void IfCmd(out IfCmd/*!*/ ifcmd) {
@@ -1081,21 +1083,21 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
IfCmd/*!*/ elseIf; IfCmd elseIfOption = null;
StmtList/*!*/ els; StmtList elseOption = null;
- Expect(38);
+ Expect(40);
x = t;
Guard(out guard);
- Expect(25);
+ Expect(27);
StmtList(out thn);
- if (la.kind == 39) {
+ if (la.kind == 41) {
Get();
- if (la.kind == 38) {
+ if (la.kind == 40) {
IfCmd(out elseIf);
elseIfOption = elseIf;
- } else if (la.kind == 25) {
+ } else if (la.kind == 27) {
Get();
StmtList(out els);
elseOption = els;
- } else SynErr(100);
+ } else SynErr(104);
}
ifcmd = new IfCmd(x, guard, thn, elseIfOption, elseOption);
}
@@ -1107,18 +1109,18 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
StmtList/*!*/ body;
QKeyValue kv = null;
- Expect(40);
+ Expect(42);
x = t;
Guard(out guard);
Contract.Assume(guard == null || cce.Owner.None(guard));
- while (la.kind == 33 || la.kind == 41) {
+ while (la.kind == 35 || la.kind == 43) {
isFree = false; z = la/*lookahead token*/;
- if (la.kind == 33) {
+ if (la.kind == 35) {
Get();
isFree = true;
}
- Expect(41);
- while (la.kind == 25) {
+ Expect(43);
+ while (la.kind == 27) {
Attribute(ref kv);
}
Expression(out e);
@@ -1128,9 +1130,9 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
invariants.Add(new AssertCmd(z, e, kv));
}
- Expect(7);
+ Expect(8);
}
- Expect(25);
+ Expect(27);
StmtList(out body);
wcmd = new WhileCmd(x, guard, invariants, body);
}
@@ -1139,27 +1141,27 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
Contract.Ensures(Contract.ValueAtReturn(out bcmd) != null); IToken/*!*/ x; IToken/*!*/ y;
string breakLabel = null;
- Expect(43);
+ Expect(45);
x = t;
if (la.kind == 1) {
Ident(out y);
breakLabel = y.val;
}
- Expect(7);
+ Expect(8);
bcmd = new BreakCmd(x, breakLabel);
}
void Guard(out Expr e) {
Expr/*!*/ ee; e = null;
- Expect(8);
- if (la.kind == 42) {
+ Expect(9);
+ if (la.kind == 44) {
Get();
e = null;
- } else if (StartOf(7)) {
+ } else if (StartOf(8)) {
Expression(out ee);
e = ee;
- } else SynErr(101);
- Expect(9);
+ } else SynErr(105);
+ Expect(10);
}
void LabelOrAssign(out Cmd c, out IToken label) {
@@ -1172,40 +1174,40 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
Ident(out id);
x = t;
- if (la.kind == 10) {
+ if (la.kind == 11) {
Get();
c = null; label = x;
- } else if (la.kind == 11 || la.kind == 15 || la.kind == 47) {
+ } else if (la.kind == 12 || la.kind == 17 || la.kind == 49) {
lhss = new List<AssignLhs/*!*/>();
lhs = new SimpleAssignLhs(id, new IdentifierExpr(id, id.val));
- while (la.kind == 15) {
+ while (la.kind == 17) {
MapAssignIndex(out y, out indexes);
lhs = new MapAssignLhs(y, lhs, indexes);
}
lhss.Add(lhs);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
Ident(out id);
lhs = new SimpleAssignLhs(id, new IdentifierExpr(id, id.val));
- while (la.kind == 15) {
+ while (la.kind == 17) {
MapAssignIndex(out y, out indexes);
lhs = new MapAssignLhs(y, lhs, indexes);
}
lhss.Add(lhs);
}
- Expect(47);
+ Expect(49);
x = t; /* use location of := */
Expression(out e0);
rhss = new List<Expr/*!*/> ();
rhss.Add(e0);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
Expression(out e0);
rhss.Add(e0);
}
- Expect(7);
+ Expect(8);
c = new AssignCmd(x, lhss, rhss);
- } else SynErr(102);
+ } else SynErr(106);
}
void CallCmd(out Cmd/*!*/ c) {
@@ -1217,33 +1219,33 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
c = dummyCmd;
bool isFree = false;
- if (la.kind == 33) {
+ if (la.kind == 35) {
Get();
isFree = true;
}
- Expect(48);
+ Expect(50);
x = t;
- while (la.kind == 25) {
+ while (la.kind == 27) {
Attribute(ref kv);
}
if (la.kind == 1) {
Ident(out first);
- if (la.kind == 8) {
+ if (la.kind == 9) {
Get();
- if (StartOf(8)) {
+ if (StartOf(9)) {
CallForallArg(out en);
es.Add(en);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
CallForallArg(out en);
es.Add(en);
}
}
- Expect(9);
+ Expect(10);
c = new CallCmd(x, first.val, es, ids, kv); ((CallCmd) c).IsFree = isFree;
- } else if (la.kind == 11 || la.kind == 47) {
+ } else if (la.kind == 12 || la.kind == 49) {
ids.Add(new IdentifierExpr(first, first.val));
- if (la.kind == 11) {
+ if (la.kind == 12) {
Get();
CallOutIdent(out p);
if (p==null) {
@@ -1252,7 +1254,7 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
ids.Add(new IdentifierExpr(p, p.val));
}
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
CallOutIdent(out p);
if (p==null) {
@@ -1263,41 +1265,41 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
}
}
- Expect(47);
+ Expect(49);
Ident(out first);
- Expect(8);
- if (StartOf(8)) {
+ Expect(9);
+ if (StartOf(9)) {
CallForallArg(out en);
es.Add(en);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
CallForallArg(out en);
es.Add(en);
}
}
- Expect(9);
+ Expect(10);
c = new CallCmd(x, first.val, es, ids, kv); ((CallCmd) c).IsFree = isFree;
- } else SynErr(103);
- } else if (la.kind == 49) {
+ } else SynErr(107);
+ } else if (la.kind == 51) {
Get();
Ident(out first);
- Expect(8);
+ Expect(9);
args = new List<Expr>();
- if (StartOf(8)) {
+ if (StartOf(9)) {
CallForallArg(out en);
args.Add(en);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
CallForallArg(out en);
args.Add(en);
}
}
- Expect(9);
+ Expect(10);
c = new CallForallCmd(x, first.val, args, kv); ((CallForallCmd) c).IsFree = isFree;
- } else if (la.kind == 42) {
+ } else if (la.kind == 44) {
Get();
ids.Add(null);
- if (la.kind == 11) {
+ if (la.kind == 12) {
Get();
CallOutIdent(out p);
if (p==null) {
@@ -1306,7 +1308,7 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
ids.Add(new IdentifierExpr(p, p.val));
}
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
CallOutIdent(out p);
if (p==null) {
@@ -1317,70 +1319,70 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
}
}
- Expect(47);
+ Expect(49);
Ident(out first);
- Expect(8);
- if (StartOf(8)) {
+ Expect(9);
+ if (StartOf(9)) {
CallForallArg(out en);
es.Add(en);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
CallForallArg(out en);
es.Add(en);
}
}
- Expect(9);
+ Expect(10);
c = new CallCmd(x, first.val, es, ids, kv); ((CallCmd) c).IsFree = isFree;
- } else SynErr(104);
+ } else SynErr(108);
}
void MapAssignIndex(out IToken/*!*/ x, out List<Expr/*!*/>/*!*/ indexes) {
Contract.Ensures(Contract.ValueAtReturn(out x) != null); Contract.Ensures(cce.NonNullElements(Contract.ValueAtReturn(out indexes))); indexes = new List<Expr/*!*/> ();
Expr/*!*/ e;
- Expect(15);
+ Expect(17);
x = t;
- if (StartOf(7)) {
+ if (StartOf(8)) {
Expression(out e);
indexes.Add(e);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
Expression(out e);
indexes.Add(e);
}
}
- Expect(16);
+ Expect(18);
}
void CallForallArg(out Expr exprOptional) {
exprOptional = null;
Expr/*!*/ e;
- if (la.kind == 42) {
+ if (la.kind == 44) {
Get();
- } else if (StartOf(7)) {
+ } else if (StartOf(8)) {
Expression(out e);
exprOptional = e;
- } else SynErr(105);
+ } else SynErr(109);
}
void CallOutIdent(out IToken id) {
id = null;
IToken/*!*/ p;
- if (la.kind == 42) {
+ if (la.kind == 44) {
Get();
} else if (la.kind == 1) {
Ident(out p);
id = p;
- } else SynErr(106);
+ } else SynErr(110);
}
void Expressions(out ExprSeq/*!*/ es) {
Contract.Ensures(Contract.ValueAtReturn(out es) != null); Expr/*!*/ e; es = new ExprSeq();
Expression(out e);
es.Add(e);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
Expression(out e);
es.Add(e);
@@ -1390,8 +1392,8 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
void ImpliesExpression(bool noExplies, out Expr/*!*/ e0) {
Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expr/*!*/ e1;
LogicalExpression(out e0);
- if (StartOf(9)) {
- if (la.kind == 52 || la.kind == 53) {
+ if (StartOf(10)) {
+ if (la.kind == 54 || la.kind == 55) {
ImpliesOp();
x = t;
ImpliesExpression(true, out e1);
@@ -1403,7 +1405,7 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
x = t;
LogicalExpression(out e1);
e0 = Expr.Binary(x, BinaryOperator.Opcode.Imp, e1, e0);
- while (la.kind == 54 || la.kind == 55) {
+ while (la.kind == 56 || la.kind == 57) {
ExpliesOp();
x = t;
LogicalExpression(out e1);
@@ -1414,23 +1416,23 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
}
void EquivOp() {
- if (la.kind == 50) {
+ if (la.kind == 52) {
Get();
- } else if (la.kind == 51) {
+ } else if (la.kind == 53) {
Get();
- } else SynErr(107);
+ } else SynErr(111);
}
void LogicalExpression(out Expr/*!*/ e0) {
Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expr/*!*/ e1;
RelationalExpression(out e0);
- if (StartOf(10)) {
- if (la.kind == 56 || la.kind == 57) {
+ if (StartOf(11)) {
+ if (la.kind == 58 || la.kind == 59) {
AndOp();
x = t;
RelationalExpression(out e1);
e0 = Expr.Binary(x, BinaryOperator.Opcode.And, e0, e1);
- while (la.kind == 56 || la.kind == 57) {
+ while (la.kind == 58 || la.kind == 59) {
AndOp();
x = t;
RelationalExpression(out e1);
@@ -1441,7 +1443,7 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
x = t;
RelationalExpression(out e1);
e0 = Expr.Binary(x, BinaryOperator.Opcode.Or, e0, e1);
- while (la.kind == 58 || la.kind == 59) {
+ while (la.kind == 60 || la.kind == 61) {
OrOp();
x = t;
RelationalExpression(out e1);
@@ -1452,25 +1454,25 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
}
void ImpliesOp() {
- if (la.kind == 52) {
+ if (la.kind == 54) {
Get();
- } else if (la.kind == 53) {
+ } else if (la.kind == 55) {
Get();
- } else SynErr(108);
+ } else SynErr(112);
}
void ExpliesOp() {
- if (la.kind == 54) {
+ if (la.kind == 56) {
Get();
- } else if (la.kind == 55) {
+ } else if (la.kind == 57) {
Get();
- } else SynErr(109);
+ } else SynErr(113);
}
void RelationalExpression(out Expr/*!*/ e0) {
Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expr/*!*/ e1; BinaryOperator.Opcode op;
BvTerm(out e0);
- if (StartOf(11)) {
+ if (StartOf(12)) {
RelOp(out x, out op);
BvTerm(out e1);
e0 = Expr.Binary(x, op, e0, e1);
@@ -1478,25 +1480,25 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
}
void AndOp() {
- if (la.kind == 56) {
+ if (la.kind == 58) {
Get();
- } else if (la.kind == 57) {
+ } else if (la.kind == 59) {
Get();
- } else SynErr(110);
+ } else SynErr(114);
}
void OrOp() {
- if (la.kind == 58) {
+ if (la.kind == 60) {
Get();
- } else if (la.kind == 59) {
+ } else if (la.kind == 61) {
Get();
- } else SynErr(111);
+ } else SynErr(115);
}
void BvTerm(out Expr/*!*/ e0) {
Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expr/*!*/ e1;
Term(out e0);
- while (la.kind == 68) {
+ while (la.kind == 70) {
Get();
x = t;
Term(out e1);
@@ -1507,64 +1509,64 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
void RelOp(out IToken/*!*/ x, out BinaryOperator.Opcode op) {
Contract.Ensures(Contract.ValueAtReturn(out x) != null); x = Token.NoToken; op=BinaryOperator.Opcode.Add/*(dummy)*/;
switch (la.kind) {
- case 60: {
+ case 62: {
Get();
x = t; op=BinaryOperator.Opcode.Eq;
break;
}
- case 17: {
+ case 19: {
Get();
x = t; op=BinaryOperator.Opcode.Lt;
break;
}
- case 18: {
+ case 20: {
Get();
x = t; op=BinaryOperator.Opcode.Gt;
break;
}
- case 61: {
+ case 63: {
Get();
x = t; op=BinaryOperator.Opcode.Le;
break;
}
- case 62: {
+ case 64: {
Get();
x = t; op=BinaryOperator.Opcode.Ge;
break;
}
- case 63: {
+ case 65: {
Get();
x = t; op=BinaryOperator.Opcode.Neq;
break;
}
- case 64: {
+ case 66: {
Get();
x = t; op=BinaryOperator.Opcode.Subtype;
break;
}
- case 65: {
+ case 67: {
Get();
x = t; op=BinaryOperator.Opcode.Neq;
break;
}
- case 66: {
+ case 68: {
Get();
x = t; op=BinaryOperator.Opcode.Le;
break;
}
- case 67: {
+ case 69: {
Get();
x = t; op=BinaryOperator.Opcode.Ge;
break;
}
- default: SynErr(112); break;
+ default: SynErr(116); break;
}
}
void Term(out Expr/*!*/ e0) {
Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expr/*!*/ e1; BinaryOperator.Opcode op;
Factor(out e0);
- while (la.kind == 69 || la.kind == 70) {
+ while (la.kind == 71 || la.kind == 72) {
AddOp(out x, out op);
Factor(out e1);
e0 = Expr.Binary(x, op, e0, e1);
@@ -1573,64 +1575,78 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
void Factor(out Expr/*!*/ e0) {
Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expr/*!*/ e1; BinaryOperator.Opcode op;
- UnaryExpression(out e0);
- while (la.kind == 42 || la.kind == 71 || la.kind == 72) {
+ Power(out e0);
+ while (StartOf(13)) {
MulOp(out x, out op);
- UnaryExpression(out e1);
+ Power(out e1);
e0 = Expr.Binary(x, op, e0, e1);
}
}
void AddOp(out IToken/*!*/ x, out BinaryOperator.Opcode op) {
Contract.Ensures(Contract.ValueAtReturn(out x) != null); x = Token.NoToken; op=BinaryOperator.Opcode.Add/*(dummy)*/;
- if (la.kind == 69) {
+ if (la.kind == 71) {
Get();
x = t; op=BinaryOperator.Opcode.Add;
- } else if (la.kind == 70) {
+ } else if (la.kind == 72) {
Get();
x = t; op=BinaryOperator.Opcode.Sub;
- } else SynErr(113);
+ } else SynErr(117);
}
- void UnaryExpression(out Expr/*!*/ e) {
- Contract.Ensures(Contract.ValueAtReturn(out e) != null); IToken/*!*/ x;
- e = dummyExpr;
-
- if (la.kind == 70) {
+ void Power(out Expr/*!*/ e0) {
+ Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expr/*!*/ e1;
+ UnaryExpression(out e0);
+ if (la.kind == 76) {
Get();
x = t;
- UnaryExpression(out e);
- e = Expr.Binary(x, BinaryOperator.Opcode.Sub, new LiteralExpr(x, BigNum.ZERO), e);
- } else if (la.kind == 73 || la.kind == 74) {
- NegOp();
- x = t;
- UnaryExpression(out e);
- e = Expr.Unary(x, UnaryOperator.Opcode.Not, e);
- } else if (StartOf(12)) {
- CoercionExpression(out e);
- } else SynErr(114);
+ Power(out e1);
+ e0 = Expr.Binary(x, BinaryOperator.Opcode.Pow, e0, e1);
+ }
}
void MulOp(out IToken/*!*/ x, out BinaryOperator.Opcode op) {
Contract.Ensures(Contract.ValueAtReturn(out x) != null); x = Token.NoToken; op=BinaryOperator.Opcode.Add/*(dummy)*/;
- if (la.kind == 42) {
+ if (la.kind == 44) {
Get();
x = t; op=BinaryOperator.Opcode.Mul;
- } else if (la.kind == 71) {
+ } else if (la.kind == 73) {
Get();
x = t; op=BinaryOperator.Opcode.Div;
- } else if (la.kind == 72) {
+ } else if (la.kind == 74) {
Get();
x = t; op=BinaryOperator.Opcode.Mod;
- } else SynErr(115);
+ } else if (la.kind == 75) {
+ Get();
+ x = t; op=BinaryOperator.Opcode.RealDiv;
+ } else SynErr(118);
+ }
+
+ void UnaryExpression(out Expr/*!*/ e) {
+ Contract.Ensures(Contract.ValueAtReturn(out e) != null); IToken/*!*/ x;
+ e = dummyExpr;
+
+ if (la.kind == 72) {
+ Get();
+ x = t;
+ UnaryExpression(out e);
+ e = Expr.Unary(x, UnaryOperator.Opcode.Neg, e);
+ } else if (la.kind == 77 || la.kind == 78) {
+ NegOp();
+ x = t;
+ UnaryExpression(out e);
+ e = Expr.Unary(x, UnaryOperator.Opcode.Not, e);
+ } else if (StartOf(14)) {
+ CoercionExpression(out e);
+ } else SynErr(119);
}
void NegOp() {
- if (la.kind == 73) {
+ if (la.kind == 77) {
Get();
- } else if (la.kind == 74) {
+ } else if (la.kind == 78) {
Get();
- } else SynErr(116);
+ } else SynErr(120);
}
void CoercionExpression(out Expr/*!*/ e) {
@@ -1639,7 +1655,7 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
BigNum bn;
ArrayExpression(out e);
- while (la.kind == 10) {
+ while (la.kind == 11) {
Get();
x = t;
if (StartOf(2)) {
@@ -1654,7 +1670,7 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
e = new BvBounds(x, bn, ((LiteralExpr)e).asBigNum);
}
- } else SynErr(117);
+ } else SynErr(121);
}
}
@@ -1665,20 +1681,20 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
ExprSeq/*!*/ allArgs = dummyExprSeq;
AtomExpression(out e);
- while (la.kind == 15) {
+ while (la.kind == 17) {
Get();
x = t; allArgs = new ExprSeq ();
allArgs.Add(e);
store = false; bvExtract = false;
- if (StartOf(13)) {
- if (StartOf(7)) {
+ if (StartOf(15)) {
+ if (StartOf(8)) {
Expression(out index0);
if (index0 is BvBounds)
bvExtract = true;
else
allArgs.Add(index0);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
Expression(out e1);
if (bvExtract || e1 is BvBounds)
@@ -1686,7 +1702,7 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
allArgs.Add(e1);
}
- if (la.kind == 47) {
+ if (la.kind == 49) {
Get();
Expression(out e1);
if (bvExtract || e1 is BvBounds)
@@ -1700,7 +1716,7 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
allArgs.Add(e1); store = true;
}
}
- Expect(16);
+ Expect(18);
if (store)
e = new NAryExpr(x, new MapStore(x, allArgs.Length - 2), allArgs);
else if (bvExtract)
@@ -1725,7 +1741,7 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
}
void AtomExpression(out Expr/*!*/ e) {
- Contract.Ensures(Contract.ValueAtReturn(out e) != null); IToken/*!*/ x; int n; BigNum bn;
+ Contract.Ensures(Contract.ValueAtReturn(out e) != null); IToken/*!*/ x; int n; BigNum bn; BigDec bd;
ExprSeq/*!*/ es; VariableSeq/*!*/ ds; Trigger trig;
TypeVariableSeq/*!*/ typeParams;
IdentifierExpr/*!*/ id;
@@ -1735,12 +1751,12 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
List<Block/*!*/>/*!*/ blocks;
switch (la.kind) {
- case 75: {
+ case 79: {
Get();
e = new LiteralExpr(t, false);
break;
}
- case 76: {
+ case 80: {
Get();
e = new LiteralExpr(t, true);
break;
@@ -1750,6 +1766,11 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
e = new LiteralExpr(t, bn);
break;
}
+ case 5: case 6: {
+ Dec(out bd);
+ e = new LiteralExpr(t, bd);
+ break;
+ }
case 2: {
BvLit(out bn, out n);
e = new LiteralExpr(t, bn, n);
@@ -1758,47 +1779,65 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
case 1: {
Ident(out x);
id = new IdentifierExpr(x, x.val); e = id;
- if (la.kind == 8) {
+ if (la.kind == 9) {
Get();
- if (StartOf(7)) {
+ if (StartOf(8)) {
Expressions(out es);
e = new NAryExpr(x, new FunctionCall(id), es);
- } else if (la.kind == 9) {
+ } else if (la.kind == 10) {
e = new NAryExpr(x, new FunctionCall(id), new ExprSeq());
- } else SynErr(118);
- Expect(9);
+ } else SynErr(122);
+ Expect(10);
}
break;
}
- case 77: {
+ case 81: {
Get();
x = t;
- Expect(8);
- Expression(out e);
Expect(9);
+ Expression(out e);
+ Expect(10);
e = new OldExpr(x, e);
break;
}
- case 8: {
+ case 14: {
Get();
- if (StartOf(7)) {
+ x = t;
+ Expect(9);
+ Expression(out e);
+ Expect(10);
+ e = new NAryExpr(x, new ArithmeticCoercion(x, ArithmeticCoercion.CoercionType.ToInt), new ExprSeq(e));
+ break;
+ }
+ case 15: {
+ Get();
+ x = t;
+ Expect(9);
+ Expression(out e);
+ Expect(10);
+ e = new NAryExpr(x, new ArithmeticCoercion(x, ArithmeticCoercion.CoercionType.ToReal), new ExprSeq(e));
+ break;
+ }
+ case 9: {
+ Get();
+ if (StartOf(8)) {
Expression(out e);
if (e is BvBounds)
this.SemErr("parentheses around bitvector bounds " +
"are not allowed");
- } else if (la.kind == 49 || la.kind == 81) {
+ } else if (la.kind == 51 || la.kind == 85) {
Forall();
x = t;
QuantifierBody(x, out typeParams, out ds, out kv, out trig, out e);
if (typeParams.Length + ds.Length > 0)
e = new ForallExpr(x, typeParams, ds, kv, trig, e);
- } else if (la.kind == 82 || la.kind == 83) {
+ } else if (la.kind == 86 || la.kind == 87) {
Exists();
x = t;
QuantifierBody(x, out typeParams, out ds, out kv, out trig, out e);
if (typeParams.Length + ds.Length > 0)
e = new ExistsExpr(x, typeParams, ds, kv, trig, e);
- } else if (la.kind == 84 || la.kind == 85) {
+ } else if (la.kind == 88 || la.kind == 89) {
Lambda();
x = t;
QuantifierBody(x, out typeParams, out ds, out kv, out trig, out e);
@@ -1806,21 +1845,39 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
SemErr("triggers not allowed in lambda expressions");
if (typeParams.Length + ds.Length > 0)
e = new LambdaExpr(x, typeParams, ds, kv, e);
- } else SynErr(119);
- Expect(9);
+ } else SynErr(123);
+ Expect(10);
break;
}
- case 38: {
+ case 40: {
IfThenElseExpression(out e);
break;
}
- case 78: {
+ case 82: {
CodeExpression(out locals, out blocks);
e = new CodeExpr(locals, blocks);
break;
}
- default: SynErr(120); break;
+ default: SynErr(124); break;
+ }
+ }
+
+ void Dec(out BigDec n) {
+ string s = "";
+ if (la.kind == 5) {
+ Get();
+ s = t.val;
+ } else if (la.kind == 6) {
+ Get();
+ s = t.val;
+ } else SynErr(125);
+ try {
+ n = BigDec.FromString(s);
+ } catch (FormatException) {
+ this.SemErr("incorrectly formatted number");
+ n = BigDec.ZERO;
}
+
}
void BvLit(out BigNum n, out int m) {
@@ -1840,11 +1897,11 @@ out VariableSeq/*!*/ ins, out VariableSeq/*!*/ outs, out QKeyValue kv) {
}
void Forall() {
- if (la.kind == 49) {
+ if (la.kind == 51) {
Get();
- } else if (la.kind == 81) {
+ } else if (la.kind == 85) {
Get();
- } else SynErr(121);
+ } else SynErr(126);
}
void QuantifierBody(IToken/*!*/ q, out TypeVariableSeq/*!*/ typeParams, out VariableSeq/*!*/ ds,
@@ -1855,35 +1912,35 @@ out QKeyValue kv, out Trigger trig, out Expr/*!*/ body) {
kv = null;
ds = new VariableSeq ();
- if (la.kind == 17) {
+ if (la.kind == 19) {
TypeParams(out tok, out typeParams);
if (la.kind == 1) {
BoundVars(q, out ds);
}
} else if (la.kind == 1) {
BoundVars(q, out ds);
- } else SynErr(122);
+ } else SynErr(127);
QSep();
- while (la.kind == 25) {
+ while (la.kind == 27) {
AttributeOrTrigger(ref kv, ref trig);
}
Expression(out body);
}
void Exists() {
- if (la.kind == 82) {
+ if (la.kind == 86) {
Get();
- } else if (la.kind == 83) {
+ } else if (la.kind == 87) {
Get();
- } else SynErr(123);
+ } else SynErr(128);
}
void Lambda() {
- if (la.kind == 84) {
+ if (la.kind == 88) {
Get();
- } else if (la.kind == 85) {
+ } else if (la.kind == 89) {
Get();
- } else SynErr(124);
+ } else SynErr(129);
}
void IfThenElseExpression(out Expr/*!*/ e) {
@@ -1891,12 +1948,12 @@ out QKeyValue kv, out Trigger trig, out Expr/*!*/ body) {
IToken/*!*/ tok;
Expr/*!*/ e0, e1, e2;
e = dummyExpr;
- Expect(38);
+ Expect(40);
tok = t;
Expression(out e0);
- Expect(80);
+ Expect(84);
Expression(out e1);
- Expect(39);
+ Expect(41);
Expression(out e2);
e = new NAryExpr(tok, new IfThenElse(tok), new ExprSeq(e0, e1, e2));
}
@@ -1905,8 +1962,8 @@ out QKeyValue kv, out Trigger trig, out Expr/*!*/ body) {
Contract.Ensures(Contract.ValueAtReturn(out locals) != null); Contract.Ensures(cce.NonNullElements(Contract.ValueAtReturn(out blocks))); locals = new VariableSeq(); Block/*!*/ b;
blocks = new List<Block/*!*/>();
- Expect(78);
- while (la.kind == 6) {
+ Expect(82);
+ while (la.kind == 7) {
LocalVars(locals);
}
SpecBlock(out b);
@@ -1915,7 +1972,7 @@ out QKeyValue kv, out Trigger trig, out Expr/*!*/ body) {
SpecBlock(out b);
blocks.Add(b);
}
- Expect(79);
+ Expect(83);
}
void SpecBlock(out Block/*!*/ b) {
@@ -1928,8 +1985,8 @@ out QKeyValue kv, out Trigger trig, out Expr/*!*/ body) {
Expr/*!*/ e;
Ident(out x);
- Expect(10);
- while (StartOf(6)) {
+ Expect(11);
+ while (StartOf(7)) {
LabelOrCmd(out c, out label);
if (c != null) {
Contract.Assert(label == null);
@@ -1940,7 +1997,7 @@ out QKeyValue kv, out Trigger trig, out Expr/*!*/ body) {
}
}
- if (la.kind == 36) {
+ if (la.kind == 38) {
Get();
y = t;
Idents(out xs);
@@ -1949,12 +2006,12 @@ out QKeyValue kv, out Trigger trig, out Expr/*!*/ body) {
ss.Add(s.val); }
b = new Block(x,x.val,cs,new GotoCmd(y,ss));
- } else if (la.kind == 37) {
+ } else if (la.kind == 39) {
Get();
Expression(out e);
b = new Block(x,x.val,cs,new ReturnExprCmd(t,e));
- } else SynErr(125);
- Expect(7);
+ } else SynErr(130);
+ Expect(8);
}
void AttributeOrTrigger(ref QKeyValue kv, ref Trigger trig) {
@@ -1962,16 +2019,16 @@ out QKeyValue kv, out Trigger trig, out Expr/*!*/ body) {
string key;
List<object/*!*/> parameters; object/*!*/ param;
- Expect(25);
+ Expect(27);
tok = t;
- if (la.kind == 10) {
+ if (la.kind == 11) {
Get();
Expect(1);
key = t.val; parameters = new List<object/*!*/>();
- if (StartOf(14)) {
+ if (StartOf(16)) {
AttributeParameter(out param);
parameters.Add(param);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
AttributeParameter(out param);
parameters.Add(param);
@@ -1996,10 +2053,10 @@ out QKeyValue kv, out Trigger trig, out Expr/*!*/ body) {
}
}
- } else if (StartOf(7)) {
+ } else if (StartOf(8)) {
Expression(out e);
es = new ExprSeq(e);
- while (la.kind == 11) {
+ while (la.kind == 12) {
Get();
Expression(out e);
es.Add(e);
@@ -2010,8 +2067,8 @@ out QKeyValue kv, out Trigger trig, out Expr/*!*/ body) {
trig.AddLast(new Trigger(tok, true, es, null));
}
- } else SynErr(126);
- Expect(26);
+ } else SynErr(131);
+ Expect(28);
}
void AttributeParameter(out object/*!*/ o) {
@@ -2022,18 +2079,18 @@ out QKeyValue kv, out Trigger trig, out Expr/*!*/ body) {
if (la.kind == 4) {
Get();
o = t.val.Substring(1, t.val.Length-2);
- } else if (StartOf(7)) {
+ } else if (StartOf(8)) {
Expression(out e);
o = e;
- } else SynErr(127);
+ } else SynErr(132);
}
void QSep() {
- if (la.kind == 86) {
+ if (la.kind == 90) {
Get();
- } else if (la.kind == 87) {
+ } else if (la.kind == 91) {
Get();
- } else SynErr(128);
+ } else SynErr(133);
}
@@ -2049,21 +2106,23 @@ out QKeyValue kv, out Trigger trig, out Expr/*!*/ body) {
}
static readonly bool[,]/*!*/ set = {
- {T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,T, x,x,x,T, T,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,T,x,x, x,x,x,x, T,x,x,x, x,T,T,T, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,T,T,x, T,x,x,T, T,T,T,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, T,T,T,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,T,T,T, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x},
- {x,T,T,T, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,T,T, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,T,T,T, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x},
- {x,T,T,T, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x},
- {x,T,T,T, T,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x}
+ {T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
+ {x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,x, x,T,T,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
+ {x,T,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,T,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
+ {x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
+ {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,T, T,x,T,x, x,T,T,T, T,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
+ {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,T,T, T,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
+ {x,T,T,T, x,T,T,x, x,T,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x},
+ {x,T,T,T, x,T,T,x, x,T,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
+ {x,T,T,T, x,T,T,x, x,T,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x},
+ {x,T,T,T, x,T,T,x, x,T,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x},
+ {x,T,T,T, T,T,T,x, x,T,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x}
};
} // end Parser
@@ -2093,130 +2152,135 @@ public class Errors {
case 2: s = "bvlit expected"; break;
case 3: s = "digits expected"; break;
case 4: s = "string expected"; break;
- case 5: s = "float expected"; break;
- case 6: s = "\"var\" expected"; break;
- case 7: s = "\";\" expected"; break;
- case 8: s = "\"(\" expected"; break;
- case 9: s = "\")\" expected"; break;
- case 10: s = "\":\" expected"; break;
- case 11: s = "\",\" expected"; break;
- case 12: s = "\"where\" expected"; break;
- case 13: s = "\"int\" expected"; break;
- case 14: s = "\"bool\" expected"; break;
- case 15: s = "\"[\" expected"; break;
- case 16: s = "\"]\" expected"; break;
- case 17: s = "\"<\" expected"; break;
- case 18: s = "\">\" expected"; break;
- case 19: s = "\"const\" expected"; break;
- case 20: s = "\"unique\" expected"; break;
- case 21: s = "\"extends\" expected"; break;
- case 22: s = "\"complete\" expected"; break;
- case 23: s = "\"function\" expected"; break;
- case 24: s = "\"returns\" expected"; break;
- case 25: s = "\"{\" expected"; break;
- case 26: s = "\"}\" expected"; break;
- case 27: s = "\"axiom\" expected"; break;
- case 28: s = "\"type\" expected"; break;
- case 29: s = "\"=\" expected"; break;
- case 30: s = "\"procedure\" expected"; break;
- case 31: s = "\"implementation\" expected"; break;
- case 32: s = "\"modifies\" expected"; break;
- case 33: s = "\"free\" expected"; break;
- case 34: s = "\"requires\" expected"; break;
- case 35: s = "\"ensures\" expected"; break;
- case 36: s = "\"goto\" expected"; break;
- case 37: s = "\"return\" expected"; break;
- case 38: s = "\"if\" expected"; break;
- case 39: s = "\"else\" expected"; break;
- case 40: s = "\"while\" expected"; break;
- case 41: s = "\"invariant\" expected"; break;
- case 42: s = "\"*\" expected"; break;
- case 43: s = "\"break\" expected"; break;
- case 44: s = "\"assert\" expected"; break;
- case 45: s = "\"assume\" expected"; break;
- case 46: s = "\"havoc\" expected"; break;
- case 47: s = "\":=\" expected"; break;
- case 48: s = "\"call\" expected"; break;
- case 49: s = "\"forall\" expected"; break;
- case 50: s = "\"<==>\" expected"; break;
- case 51: s = "\"\\u21d4\" expected"; break;
- case 52: s = "\"==>\" expected"; break;
- case 53: s = "\"\\u21d2\" expected"; break;
- case 54: s = "\"<==\" expected"; break;
- case 55: s = "\"\\u21d0\" expected"; break;
- case 56: s = "\"&&\" expected"; break;
- case 57: s = "\"\\u2227\" expected"; break;
- case 58: s = "\"||\" expected"; break;
- case 59: s = "\"\\u2228\" expected"; break;
- case 60: s = "\"==\" expected"; break;
- case 61: s = "\"<=\" expected"; break;
- case 62: s = "\">=\" expected"; break;
- case 63: s = "\"!=\" expected"; break;
- case 64: s = "\"<:\" expected"; break;
- case 65: s = "\"\\u2260\" expected"; break;
- case 66: s = "\"\\u2264\" expected"; break;
- case 67: s = "\"\\u2265\" expected"; break;
- case 68: s = "\"++\" expected"; break;
- case 69: s = "\"+\" expected"; break;
- case 70: s = "\"-\" expected"; break;
- case 71: s = "\"/\" expected"; break;
- case 72: s = "\"%\" expected"; break;
- case 73: s = "\"!\" expected"; break;
- case 74: s = "\"\\u00ac\" expected"; break;
- case 75: s = "\"false\" expected"; break;
- case 76: s = "\"true\" expected"; break;
- case 77: s = "\"old\" expected"; break;
- case 78: s = "\"|{\" expected"; break;
- case 79: s = "\"}|\" expected"; break;
- case 80: s = "\"then\" expected"; break;
- case 81: s = "\"\\u2200\" expected"; break;
- case 82: s = "\"exists\" expected"; break;
- case 83: s = "\"\\u2203\" expected"; break;
- case 84: s = "\"lambda\" expected"; break;
- case 85: s = "\"\\u03bb\" expected"; break;
- case 86: s = "\"::\" expected"; break;
- case 87: s = "\"\\u2022\" expected"; break;
- case 88: s = "??? expected"; break;
- case 89: s = "invalid Function"; break;
- case 90: s = "invalid Function"; break;
- case 91: s = "invalid Procedure"; break;
- case 92: s = "invalid Type"; break;
- case 93: s = "invalid TypeAtom"; break;
- case 94: s = "invalid TypeArgs"; break;
- case 95: s = "invalid Spec"; break;
- case 96: s = "invalid SpecPrePost"; break;
- case 97: s = "invalid LabelOrCmd"; break;
- case 98: s = "invalid StructuredCmd"; break;
- case 99: s = "invalid TransferCmd"; break;
- case 100: s = "invalid IfCmd"; break;
- case 101: s = "invalid Guard"; break;
- case 102: s = "invalid LabelOrAssign"; break;
- case 103: s = "invalid CallCmd"; break;
- case 104: s = "invalid CallCmd"; break;
- case 105: s = "invalid CallForallArg"; break;
- case 106: s = "invalid CallOutIdent"; break;
- case 107: s = "invalid EquivOp"; break;
- case 108: s = "invalid ImpliesOp"; break;
- case 109: s = "invalid ExpliesOp"; break;
- case 110: s = "invalid AndOp"; break;
- case 111: s = "invalid OrOp"; break;
- case 112: s = "invalid RelOp"; break;
- case 113: s = "invalid AddOp"; break;
- case 114: s = "invalid UnaryExpression"; break;
- case 115: s = "invalid MulOp"; break;
- case 116: s = "invalid NegOp"; break;
- case 117: s = "invalid CoercionExpression"; break;
- case 118: s = "invalid AtomExpression"; break;
- case 119: s = "invalid AtomExpression"; break;
- case 120: s = "invalid AtomExpression"; break;
- case 121: s = "invalid Forall"; break;
- case 122: s = "invalid QuantifierBody"; break;
- case 123: s = "invalid Exists"; break;
- case 124: s = "invalid Lambda"; break;
- case 125: s = "invalid SpecBlock"; break;
- case 126: s = "invalid AttributeOrTrigger"; break;
- case 127: s = "invalid AttributeParameter"; break;
- case 128: s = "invalid QSep"; break;
+ case 5: s = "decimal expected"; break;
+ case 6: s = "float expected"; break;
+ case 7: s = "\"var\" expected"; break;
+ case 8: s = "\";\" expected"; break;
+ case 9: s = "\"(\" expected"; break;
+ case 10: s = "\")\" expected"; break;
+ case 11: s = "\":\" expected"; break;
+ case 12: s = "\",\" expected"; break;
+ case 13: s = "\"where\" expected"; break;
+ case 14: s = "\"int\" expected"; break;
+ case 15: s = "\"real\" expected"; break;
+ case 16: s = "\"bool\" expected"; break;
+ case 17: s = "\"[\" expected"; break;
+ case 18: s = "\"]\" expected"; break;
+ case 19: s = "\"<\" expected"; break;
+ case 20: s = "\">\" expected"; break;
+ case 21: s = "\"const\" expected"; break;
+ case 22: s = "\"unique\" expected"; break;
+ case 23: s = "\"extends\" expected"; break;
+ case 24: s = "\"complete\" expected"; break;
+ case 25: s = "\"function\" expected"; break;
+ case 26: s = "\"returns\" expected"; break;
+ case 27: s = "\"{\" expected"; break;
+ case 28: s = "\"}\" expected"; break;
+ case 29: s = "\"axiom\" expected"; break;
+ case 30: s = "\"type\" expected"; break;
+ case 31: s = "\"=\" expected"; break;
+ case 32: s = "\"procedure\" expected"; break;
+ case 33: s = "\"implementation\" expected"; break;
+ case 34: s = "\"modifies\" expected"; break;
+ case 35: s = "\"free\" expected"; break;
+ case 36: s = "\"requires\" expected"; break;
+ case 37: s = "\"ensures\" expected"; break;
+ case 38: s = "\"goto\" expected"; break;
+ case 39: s = "\"return\" expected"; break;
+ case 40: s = "\"if\" expected"; break;
+ case 41: s = "\"else\" expected"; break;
+ case 42: s = "\"while\" expected"; break;
+ case 43: s = "\"invariant\" expected"; break;
+ case 44: s = "\"*\" expected"; break;
+ case 45: s = "\"break\" expected"; break;
+ case 46: s = "\"assert\" expected"; break;
+ case 47: s = "\"assume\" expected"; break;
+ case 48: s = "\"havoc\" expected"; break;
+ case 49: s = "\":=\" expected"; break;
+ case 50: s = "\"call\" expected"; break;
+ case 51: s = "\"forall\" expected"; break;
+ case 52: s = "\"<==>\" expected"; break;
+ case 53: s = "\"\\u21d4\" expected"; break;
+ case 54: s = "\"==>\" expected"; break;
+ case 55: s = "\"\\u21d2\" expected"; break;
+ case 56: s = "\"<==\" expected"; break;
+ case 57: s = "\"\\u21d0\" expected"; break;
+ case 58: s = "\"&&\" expected"; break;
+ case 59: s = "\"\\u2227\" expected"; break;
+ case 60: s = "\"||\" expected"; break;
+ case 61: s = "\"\\u2228\" expected"; break;
+ case 62: s = "\"==\" expected"; break;
+ case 63: s = "\"<=\" expected"; break;
+ case 64: s = "\">=\" expected"; break;
+ case 65: s = "\"!=\" expected"; break;
+ case 66: s = "\"<:\" expected"; break;
+ case 67: s = "\"\\u2260\" expected"; break;
+ case 68: s = "\"\\u2264\" expected"; break;
+ case 69: s = "\"\\u2265\" expected"; break;
+ case 70: s = "\"++\" expected"; break;
+ case 71: s = "\"+\" expected"; break;
+ case 72: s = "\"-\" expected"; break;
+ case 73: s = "\"div\" expected"; break;
+ case 74: s = "\"mod\" expected"; break;
+ case 75: s = "\"/\" expected"; break;
+ case 76: s = "\"**\" expected"; break;
+ case 77: s = "\"!\" expected"; break;
+ case 78: s = "\"\\u00ac\" expected"; break;
+ case 79: s = "\"false\" expected"; break;
+ case 80: s = "\"true\" expected"; break;
+ case 81: s = "\"old\" expected"; break;
+ case 82: s = "\"|{\" expected"; break;
+ case 83: s = "\"}|\" expected"; break;
+ case 84: s = "\"then\" expected"; break;
+ case 85: s = "\"\\u2200\" expected"; break;
+ case 86: s = "\"exists\" expected"; break;
+ case 87: s = "\"\\u2203\" expected"; break;
+ case 88: s = "\"lambda\" expected"; break;
+ case 89: s = "\"\\u03bb\" expected"; break;
+ case 90: s = "\"::\" expected"; break;
+ case 91: s = "\"\\u2022\" expected"; break;
+ case 92: s = "??? expected"; break;
+ case 93: s = "invalid Function"; break;
+ case 94: s = "invalid Function"; break;
+ case 95: s = "invalid Procedure"; break;
+ case 96: s = "invalid Type"; break;
+ case 97: s = "invalid TypeAtom"; break;
+ case 98: s = "invalid TypeArgs"; break;
+ case 99: s = "invalid Spec"; break;
+ case 100: s = "invalid SpecPrePost"; break;
+ case 101: s = "invalid LabelOrCmd"; break;
+ case 102: s = "invalid StructuredCmd"; break;
+ case 103: s = "invalid TransferCmd"; break;
+ case 104: s = "invalid IfCmd"; break;
+ case 105: s = "invalid Guard"; break;
+ case 106: s = "invalid LabelOrAssign"; break;
+ case 107: s = "invalid CallCmd"; break;
+ case 108: s = "invalid CallCmd"; break;
+ case 109: s = "invalid CallForallArg"; break;
+ case 110: s = "invalid CallOutIdent"; break;
+ case 111: s = "invalid EquivOp"; break;
+ case 112: s = "invalid ImpliesOp"; break;
+ case 113: s = "invalid ExpliesOp"; break;
+ case 114: s = "invalid AndOp"; break;
+ case 115: s = "invalid OrOp"; break;
+ case 116: s = "invalid RelOp"; break;
+ case 117: s = "invalid AddOp"; break;
+ case 118: s = "invalid MulOp"; break;
+ case 119: s = "invalid UnaryExpression"; break;
+ case 120: s = "invalid NegOp"; break;
+ case 121: s = "invalid CoercionExpression"; break;
+ case 122: s = "invalid AtomExpression"; break;
+ case 123: s = "invalid AtomExpression"; break;
+ case 124: s = "invalid AtomExpression"; break;
+ case 125: s = "invalid Dec"; break;
+ case 126: s = "invalid Forall"; break;
+ case 127: s = "invalid QuantifierBody"; break;
+ case 128: s = "invalid Exists"; break;
+ case 129: s = "invalid Lambda"; break;
+ case 130: s = "invalid SpecBlock"; break;
+ case 131: s = "invalid AttributeOrTrigger"; break;
+ case 132: s = "invalid AttributeParameter"; break;
+ case 133: s = "invalid QSep"; break;
default: s = "error " + n; break;
}
diff --git a/Source/Core/Scanner.cs b/Source/Core/Scanner.cs
index cfef86c7..60c15b41 100644
--- a/Source/Core/Scanner.cs
+++ b/Source/Core/Scanner.cs
@@ -211,8 +211,8 @@ public class UTF8Buffer: Buffer {
public class Scanner {
const char EOL = '\n';
const int eofSym = 0; /* pdt */
- const int maxT = 88;
- const int noSym = 88;
+ const int maxT = 92;
+ const int noSym = 92;
[ContractInvariantMethod]
@@ -256,42 +256,41 @@ public class Scanner {
for (int i = 65; i <= 90; ++i) start[i] = 2;
for (int i = 94; i <= 122; ++i) start[i] = 2;
for (int i = 126; i <= 126; ++i) start[i] = 2;
- for (int i = 48; i <= 57; ++i) start[i] = 9;
+ for (int i = 48; i <= 57; ++i) start[i] = 16;
for (int i = 34; i <= 34; ++i) start[i] = 6;
start[92] = 1;
- start[59] = 12;
- start[40] = 13;
- start[41] = 14;
- start[58] = 49;
- start[44] = 15;
- start[91] = 16;
- start[93] = 17;
- start[60] = 50;
- start[62] = 51;
- start[123] = 18;
- start[125] = 52;
- start[61] = 53;
- start[42] = 19;
- start[8660] = 22;
- start[8658] = 24;
- start[8656] = 25;
- start[38] = 26;
- start[8743] = 28;
- start[124] = 54;
- start[8744] = 30;
- start[33] = 55;
- start[8800] = 34;
- start[8804] = 35;
- start[8805] = 36;
- start[43] = 56;
- start[45] = 38;
- start[47] = 39;
- start[37] = 40;
- start[172] = 41;
- start[8704] = 44;
- start[8707] = 45;
- start[955] = 46;
- start[8226] = 48;
+ start[59] = 19;
+ start[40] = 20;
+ start[41] = 21;
+ start[58] = 55;
+ start[44] = 22;
+ start[91] = 23;
+ start[93] = 24;
+ start[60] = 56;
+ start[62] = 57;
+ start[123] = 25;
+ start[125] = 58;
+ start[61] = 59;
+ start[42] = 60;
+ start[8660] = 28;
+ start[8658] = 30;
+ start[8656] = 31;
+ start[38] = 32;
+ start[8743] = 34;
+ start[124] = 61;
+ start[8744] = 36;
+ start[33] = 62;
+ start[8800] = 40;
+ start[8804] = 41;
+ start[8805] = 42;
+ start[43] = 63;
+ start[45] = 44;
+ start[47] = 45;
+ start[172] = 47;
+ start[8704] = 50;
+ start[8707] = 51;
+ start[955] = 52;
+ start[8226] = 54;
start[Buffer.EOF] = -1;
}
@@ -489,42 +488,45 @@ public class Scanner {
void CheckLiteral() {
switch (t.val) {
- case "var": t.kind = 6; break;
- case "where": t.kind = 12; break;
- case "int": t.kind = 13; break;
- case "bool": t.kind = 14; break;
- case "const": t.kind = 19; break;
- case "unique": t.kind = 20; break;
- case "extends": t.kind = 21; break;
- case "complete": t.kind = 22; break;
- case "function": t.kind = 23; break;
- case "returns": t.kind = 24; break;
- case "axiom": t.kind = 27; break;
- case "type": t.kind = 28; break;
- case "procedure": t.kind = 30; break;
- case "implementation": t.kind = 31; break;
- case "modifies": t.kind = 32; break;
- case "free": t.kind = 33; break;
- case "requires": t.kind = 34; break;
- case "ensures": t.kind = 35; break;
- case "goto": t.kind = 36; break;
- case "return": t.kind = 37; break;
- case "if": t.kind = 38; break;
- case "else": t.kind = 39; break;
- case "while": t.kind = 40; break;
- case "invariant": t.kind = 41; break;
- case "break": t.kind = 43; break;
- case "assert": t.kind = 44; break;
- case "assume": t.kind = 45; break;
- case "havoc": t.kind = 46; break;
- case "call": t.kind = 48; break;
- case "forall": t.kind = 49; break;
- case "false": t.kind = 75; break;
- case "true": t.kind = 76; break;
- case "old": t.kind = 77; break;
- case "then": t.kind = 80; break;
- case "exists": t.kind = 82; break;
- case "lambda": t.kind = 84; break;
+ case "var": t.kind = 7; break;
+ case "where": t.kind = 13; break;
+ case "int": t.kind = 14; break;
+ case "real": t.kind = 15; break;
+ case "bool": t.kind = 16; break;
+ case "const": t.kind = 21; break;
+ case "unique": t.kind = 22; break;
+ case "extends": t.kind = 23; break;
+ case "complete": t.kind = 24; break;
+ case "function": t.kind = 25; break;
+ case "returns": t.kind = 26; break;
+ case "axiom": t.kind = 29; break;
+ case "type": t.kind = 30; break;
+ case "procedure": t.kind = 32; break;
+ case "implementation": t.kind = 33; break;
+ case "modifies": t.kind = 34; break;
+ case "free": t.kind = 35; break;
+ case "requires": t.kind = 36; break;
+ case "ensures": t.kind = 37; break;
+ case "goto": t.kind = 38; break;
+ case "return": t.kind = 39; break;
+ case "if": t.kind = 40; break;
+ case "else": t.kind = 41; break;
+ case "while": t.kind = 42; break;
+ case "invariant": t.kind = 43; break;
+ case "break": t.kind = 45; break;
+ case "assert": t.kind = 46; break;
+ case "assume": t.kind = 47; break;
+ case "havoc": t.kind = 48; break;
+ case "call": t.kind = 50; break;
+ case "forall": t.kind = 51; break;
+ case "div": t.kind = 73; break;
+ case "mod": t.kind = 74; break;
+ case "false": t.kind = 79; break;
+ case "true": t.kind = 80; break;
+ case "old": t.kind = 81; break;
+ case "then": t.kind = 84; break;
+ case "exists": t.kind = 86; break;
+ case "lambda": t.kind = 88; break;
default: break;
}
}
@@ -577,152 +579,181 @@ public class Scanner {
case 6:
if (ch == '"') {AddCh(); goto case 7;}
else if (ch <= 9 || ch >= 11 && ch <= 12 || ch >= 14 && ch <= '!' || ch >= '#' && ch <= '[' || ch >= ']' && ch <= 65535) {AddCh(); goto case 6;}
- else if (ch == 92) {AddCh(); goto case 10;}
+ else if (ch == 92) {AddCh(); goto case 17;}
else {goto case 0;}
case 7:
{t.kind = 4; break;}
case 8:
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 10;}
+ else if (ch == '-') {AddCh(); goto case 9;}
+ else {goto case 0;}
+ case 9:
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 10;}
+ else {goto case 0;}
+ case 10:
recEnd = pos; recKind = 5;
- if (ch >= '0' && ch <= '9') {AddCh(); goto case 8;}
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 10;}
else {t.kind = 5; break;}
- case 9:
+ case 11:
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 12;}
+ else {goto case 0;}
+ case 12:
+ recEnd = pos; recKind = 6;
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 12;}
+ else if (ch == 'e') {AddCh(); goto case 13;}
+ else {t.kind = 6; break;}
+ case 13:
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 15;}
+ else if (ch == '-') {AddCh(); goto case 14;}
+ else {goto case 0;}
+ case 14:
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 15;}
+ else {goto case 0;}
+ case 15:
+ recEnd = pos; recKind = 6;
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 15;}
+ else {t.kind = 6; break;}
+ case 16:
recEnd = pos; recKind = 3;
- if (ch >= '0' && ch <= '9') {AddCh(); goto case 9;}
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 16;}
else if (ch == 'b') {AddCh(); goto case 3;}
- else if (ch == '.') {AddCh(); goto case 8;}
+ else if (ch == 'e') {AddCh(); goto case 8;}
+ else if (ch == '.') {AddCh(); goto case 11;}
else {t.kind = 3; break;}
- case 10:
- if (ch == '"') {AddCh(); goto case 11;}
+ case 17:
+ if (ch == '"') {AddCh(); goto case 18;}
else if (ch <= 9 || ch >= 11 && ch <= 12 || ch >= 14 && ch <= '!' || ch >= '#' && ch <= '[' || ch >= ']' && ch <= 65535) {AddCh(); goto case 6;}
- else if (ch == 92) {AddCh(); goto case 10;}
+ else if (ch == 92) {AddCh(); goto case 17;}
else {goto case 0;}
- case 11:
+ case 18:
recEnd = pos; recKind = 4;
if (ch == '"') {AddCh(); goto case 7;}
else if (ch <= 9 || ch >= 11 && ch <= 12 || ch >= 14 && ch <= '!' || ch >= '#' && ch <= '[' || ch >= ']' && ch <= 65535) {AddCh(); goto case 6;}
- else if (ch == 92) {AddCh(); goto case 10;}
+ else if (ch == 92) {AddCh(); goto case 17;}
else {t.kind = 4; break;}
- case 12:
- {t.kind = 7; break;}
- case 13:
- {t.kind = 8; break;}
- case 14:
- {t.kind = 9; break;}
- case 15:
- {t.kind = 11; break;}
- case 16:
- {t.kind = 15; break;}
- case 17:
- {t.kind = 16; break;}
- case 18:
- {t.kind = 25; break;}
case 19:
- {t.kind = 42; break;}
+ {t.kind = 8; break;}
case 20:
- {t.kind = 47; break;}
+ {t.kind = 9; break;}
case 21:
- {t.kind = 50; break;}
+ {t.kind = 10; break;}
case 22:
- {t.kind = 51; break;}
+ {t.kind = 12; break;}
case 23:
- {t.kind = 52; break;}
+ {t.kind = 17; break;}
case 24:
- {t.kind = 53; break;}
+ {t.kind = 18; break;}
case 25:
- {t.kind = 55; break;}
+ {t.kind = 27; break;}
case 26:
- if (ch == '&') {AddCh(); goto case 27;}
- else {goto case 0;}
+ {t.kind = 49; break;}
case 27:
- {t.kind = 56; break;}
+ {t.kind = 52; break;}
case 28:
- {t.kind = 57; break;}
+ {t.kind = 53; break;}
case 29:
- {t.kind = 58; break;}
+ {t.kind = 54; break;}
case 30:
- {t.kind = 59; break;}
+ {t.kind = 55; break;}
case 31:
- {t.kind = 62; break;}
+ {t.kind = 57; break;}
case 32:
- {t.kind = 63; break;}
+ if (ch == '&') {AddCh(); goto case 33;}
+ else {goto case 0;}
case 33:
- {t.kind = 64; break;}
+ {t.kind = 58; break;}
case 34:
- {t.kind = 65; break;}
+ {t.kind = 59; break;}
case 35:
- {t.kind = 66; break;}
+ {t.kind = 60; break;}
case 36:
- {t.kind = 67; break;}
+ {t.kind = 61; break;}
case 37:
- {t.kind = 68; break;}
+ {t.kind = 64; break;}
case 38:
- {t.kind = 70; break;}
+ {t.kind = 65; break;}
case 39:
- {t.kind = 71; break;}
+ {t.kind = 66; break;}
case 40:
- {t.kind = 72; break;}
+ {t.kind = 67; break;}
case 41:
- {t.kind = 74; break;}
+ {t.kind = 68; break;}
case 42:
- {t.kind = 78; break;}
+ {t.kind = 69; break;}
case 43:
- {t.kind = 79; break;}
+ {t.kind = 70; break;}
case 44:
- {t.kind = 81; break;}
+ {t.kind = 72; break;}
case 45:
- {t.kind = 83; break;}
+ {t.kind = 75; break;}
case 46:
- {t.kind = 85; break;}
+ {t.kind = 76; break;}
case 47:
- {t.kind = 86; break;}
+ {t.kind = 78; break;}
case 48:
- {t.kind = 87; break;}
+ {t.kind = 82; break;}
case 49:
- recEnd = pos; recKind = 10;
- if (ch == '=') {AddCh(); goto case 20;}
- else if (ch == ':') {AddCh(); goto case 47;}
- else {t.kind = 10; break;}
+ {t.kind = 83; break;}
case 50:
- recEnd = pos; recKind = 17;
- if (ch == '=') {AddCh(); goto case 57;}
- else if (ch == ':') {AddCh(); goto case 33;}
- else {t.kind = 17; break;}
+ {t.kind = 85; break;}
case 51:
- recEnd = pos; recKind = 18;
- if (ch == '=') {AddCh(); goto case 31;}
- else {t.kind = 18; break;}
+ {t.kind = 87; break;}
case 52:
- recEnd = pos; recKind = 26;
- if (ch == '|') {AddCh(); goto case 43;}
- else {t.kind = 26; break;}
+ {t.kind = 89; break;}
case 53:
- recEnd = pos; recKind = 29;
- if (ch == '=') {AddCh(); goto case 58;}
- else {t.kind = 29; break;}
+ {t.kind = 90; break;}
case 54:
- if (ch == '|') {AddCh(); goto case 29;}
- else if (ch == '{') {AddCh(); goto case 42;}
- else {goto case 0;}
+ {t.kind = 91; break;}
case 55:
- recEnd = pos; recKind = 73;
- if (ch == '=') {AddCh(); goto case 32;}
- else {t.kind = 73; break;}
+ recEnd = pos; recKind = 11;
+ if (ch == '=') {AddCh(); goto case 26;}
+ else if (ch == ':') {AddCh(); goto case 53;}
+ else {t.kind = 11; break;}
case 56:
- recEnd = pos; recKind = 69;
- if (ch == '+') {AddCh(); goto case 37;}
- else {t.kind = 69; break;}
+ recEnd = pos; recKind = 19;
+ if (ch == '=') {AddCh(); goto case 64;}
+ else if (ch == ':') {AddCh(); goto case 39;}
+ else {t.kind = 19; break;}
case 57:
- recEnd = pos; recKind = 61;
- if (ch == '=') {AddCh(); goto case 59;}
- else {t.kind = 61; break;}
+ recEnd = pos; recKind = 20;
+ if (ch == '=') {AddCh(); goto case 37;}
+ else {t.kind = 20; break;}
case 58:
- recEnd = pos; recKind = 60;
- if (ch == '>') {AddCh(); goto case 23;}
- else {t.kind = 60; break;}
+ recEnd = pos; recKind = 28;
+ if (ch == '|') {AddCh(); goto case 49;}
+ else {t.kind = 28; break;}
case 59:
- recEnd = pos; recKind = 54;
- if (ch == '>') {AddCh(); goto case 21;}
- else {t.kind = 54; break;}
+ recEnd = pos; recKind = 31;
+ if (ch == '=') {AddCh(); goto case 65;}
+ else {t.kind = 31; break;}
+ case 60:
+ recEnd = pos; recKind = 44;
+ if (ch == '*') {AddCh(); goto case 46;}
+ else {t.kind = 44; break;}
+ case 61:
+ if (ch == '|') {AddCh(); goto case 35;}
+ else if (ch == '{') {AddCh(); goto case 48;}
+ else {goto case 0;}
+ case 62:
+ recEnd = pos; recKind = 77;
+ if (ch == '=') {AddCh(); goto case 38;}
+ else {t.kind = 77; break;}
+ case 63:
+ recEnd = pos; recKind = 71;
+ if (ch == '+') {AddCh(); goto case 43;}
+ else {t.kind = 71; break;}
+ case 64:
+ recEnd = pos; recKind = 63;
+ if (ch == '=') {AddCh(); goto case 66;}
+ else {t.kind = 63; break;}
+ case 65:
+ recEnd = pos; recKind = 62;
+ if (ch == '>') {AddCh(); goto case 29;}
+ else {t.kind = 62; break;}
+ case 66:
+ recEnd = pos; recKind = 56;
+ if (ch == '>') {AddCh(); goto case 27;}
+ else {t.kind = 56; break;}
}
t.val = new String(tval, 0, tlen);
diff --git a/Source/Core/StandardVisitor.cs b/Source/Core/StandardVisitor.cs
index 9bbeada1..66eee658 100644
--- a/Source/Core/StandardVisitor.cs
+++ b/Source/Core/StandardVisitor.cs
@@ -63,11 +63,6 @@ namespace Microsoft.Boogie {
Contract.Ensures(Contract.Result<Absy>() != null);
return node.StdDispatch(this);
}
- public virtual AIVariableExpr VisitAIVariableExpr(AIVariableExpr node) {
- Contract.Requires(node != null);
- Contract.Ensures(Contract.Result<AIVariableExpr>() != null);
- return node;
- }
public virtual Cmd VisitAssertCmd(AssertCmd node) {
Contract.Requires(node != null);
Contract.Ensures(Contract.Result<Cmd>() != null);
diff --git a/Source/Core/Util.cs b/Source/Core/Util.cs
index a8e12f63..9a7fec0c 100644
--- a/Source/Core/Util.cs
+++ b/Source/Core/Util.cs
@@ -451,7 +451,7 @@ namespace Microsoft.Boogie {
op = " && ";
break;
case Microsoft.Boogie.BinaryOperator.Opcode.Div:
- op = " / ";
+ op = " div ";
break;
case Microsoft.Boogie.BinaryOperator.Opcode.Eq:
op = " == ";
@@ -475,7 +475,7 @@ namespace Microsoft.Boogie {
op = " < ";
break;
case Microsoft.Boogie.BinaryOperator.Opcode.Mod:
- op = " % ";
+ op = " mod ";
break;
case Microsoft.Boogie.BinaryOperator.Opcode.Mul:
op = " * ";
@@ -486,6 +486,12 @@ namespace Microsoft.Boogie {
case Microsoft.Boogie.BinaryOperator.Opcode.Or:
op = " || ";
break;
+ case Microsoft.Boogie.BinaryOperator.Opcode.Pow:
+ op = " ** ";
+ break;
+ case Microsoft.Boogie.BinaryOperator.Opcode.RealDiv:
+ op = " / ";
+ break;
case Microsoft.Boogie.BinaryOperator.Opcode.Sub:
op = " - ";
break;
diff --git a/Source/Dafny/DafnyPipeline.csproj b/Source/Dafny/DafnyPipeline.csproj
index f572f419..b4c2ae1e 100644
--- a/Source/Dafny/DafnyPipeline.csproj
+++ b/Source/Dafny/DafnyPipeline.csproj
@@ -127,10 +127,6 @@
<CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>
</PropertyGroup>
<ItemGroup>
- <Reference Include="AIFramework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=736440c9b414ea16, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\Binaries\AIFramework.dll</HintPath>
- </Reference>
<Reference Include="Basetypes, Version=2.0.0.0, Culture=neutral, PublicKeyToken=736440c9b414ea16, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Binaries\Basetypes.dll</HintPath>
diff --git a/Source/DafnyDriver/DafnyDriver.cs b/Source/DafnyDriver/DafnyDriver.cs
index 64f5fbbb..39733c8e 100644
--- a/Source/DafnyDriver/DafnyDriver.cs
+++ b/Source/DafnyDriver/DafnyDriver.cs
@@ -22,7 +22,6 @@ namespace Microsoft.Dafny
using System.Diagnostics;
using VC;
using System.CodeDom.Compiler;
- using AI = Microsoft.AbstractInterpretationFramework;
public class DafnyDriver
{
@@ -536,9 +535,6 @@ namespace Microsoft.Dafny
if (CommandLineOptions.Clo.UseAbstractInterpretation) {
if (CommandLineOptions.Clo.Ai.J_Intervals || CommandLineOptions.Clo.Ai.J_Trivial) {
Microsoft.Boogie.AbstractInterpretation.NativeAbstractInterpretation.RunAbstractInterpretation(program);
- } else if (CommandLineOptions.Clo.Ai.AnySet) {
- // run one of the old domains
- Microsoft.Boogie.AbstractInterpretation.AbstractInterpretation.RunAbstractInterpretation(program);
} else {
// use /infer:j as the default
CommandLineOptions.Clo.Ai.J_Intervals = true;
diff --git a/Source/DafnyDriver/DafnyDriver.csproj b/Source/DafnyDriver/DafnyDriver.csproj
index 5dac8f59..6f32302d 100644
--- a/Source/DafnyDriver/DafnyDriver.csproj
+++ b/Source/DafnyDriver/DafnyDriver.csproj
@@ -127,9 +127,6 @@
<Reference Include="AbsInt">
<HintPath>..\..\Binaries\AbsInt.dll</HintPath>
</Reference>
- <Reference Include="AIFramework">
- <HintPath>..\..\Binaries\AIFramework.dll</HintPath>
- </Reference>
<Reference Include="Core">
<HintPath>..\..\Binaries\Core.dll</HintPath>
</Reference>
diff --git a/Source/Houdini/Houdini.cs b/Source/Houdini/Houdini.cs
index b47512bd..f27cd410 100644
--- a/Source/Houdini/Houdini.cs
+++ b/Source/Houdini/Houdini.cs
@@ -11,7 +11,6 @@ using Microsoft.Boogie.VCExprAST;
using VC;
using System.Collections;
using System.IO;
-using Microsoft.AbstractInterpretationFramework;
using Graphing;
namespace Microsoft.Boogie.Houdini {
@@ -485,17 +484,18 @@ namespace Microsoft.Boogie.Houdini {
public bool MatchCandidate(Expr boogieExpr, out Variable candidateConstant) {
candidateConstant = null;
- IExpr antecedent, consequent;
- IExpr expr = boogieExpr as IExpr;
- if (expr != null && ExprUtil.Match(expr, Prop.Implies, out antecedent, out consequent)) {
- IdentifierExpr.ConstantFunApp constantFunApp = antecedent as IdentifierExpr.ConstantFunApp;
- if (constantFunApp != null && houdiniConstants.Contains(constantFunApp.IdentifierExpr.Decl)) {
- candidateConstant = constantFunApp.IdentifierExpr.Decl;
+ NAryExpr e = boogieExpr as NAryExpr;
+ if (e != null && e.Fun is BinaryOperator && ((BinaryOperator)e.Fun).Op == BinaryOperator.Opcode.Imp) {
+ Expr antecedent = e.Args[0];
+ Expr consequent = e.Args[1];
+
+ IdentifierExpr id = antecedent as IdentifierExpr;
+ if (id != null && id.Decl is Constant && houdiniConstants.Contains((Constant)id.Decl)) {
+ candidateConstant = id.Decl;
return true;
}
- var e = consequent as Expr;
- if (e != null && MatchCandidate(e, out candidateConstant))
+ if (MatchCandidate(consequent, out candidateConstant))
return true;
}
return false;
diff --git a/Source/Houdini/Houdini.csproj b/Source/Houdini/Houdini.csproj
index af1755a3..97d26001 100644
--- a/Source/Houdini/Houdini.csproj
+++ b/Source/Houdini/Houdini.csproj
@@ -82,10 +82,6 @@
<Compile Include="Houdini.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\AIFramework\AIFramework.csproj">
- <Project>{39B0658D-C955-41C5-9A43-48C97A1EF5FD}</Project>
- <Name>AIFramework</Name>
- </ProjectReference>
<ProjectReference Include="..\Basetypes\Basetypes.csproj">
<Project>{43DFAD18-3E35-4558-9BE2-CAFF6B5BA8A0}</Project>
<Name>Basetypes</Name>
diff --git a/Source/Provers/Isabelle/Isabelle.csproj b/Source/Provers/Isabelle/Isabelle.csproj
deleted file mode 100644
index 0593ee45..00000000
--- a/Source/Provers/Isabelle/Isabelle.csproj
+++ /dev/null
@@ -1,210 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.21022</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{435D5BD0-6F62-49F8-BB24-33E2257519AD}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Microsoft.Boogie.Isabelle</RootNamespace>
- <AssemblyName>Provers.Isabelle</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <SignAssembly>true</SignAssembly>
- <AssemblyOriginatorKeyFile>..\..\InterimKey.snk</AssemblyOriginatorKeyFile>
- <CodeContractsAssemblyMode>1</CodeContractsAssemblyMode>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>3.5</OldToolsVersion>
- <UpgradeBackupLocation />
- <PublishUrl>publish\</PublishUrl>
- <Install>true</Install>
- <InstallFrom>Disk</InstallFrom>
- <UpdateEnabled>false</UpdateEnabled>
- <UpdateMode>Foreground</UpdateMode>
- <UpdateInterval>7</UpdateInterval>
- <UpdateIntervalUnits>Days</UpdateIntervalUnits>
- <UpdatePeriodically>false</UpdatePeriodically>
- <UpdateRequired>false</UpdateRequired>
- <MapFileExtensions>true</MapFileExtensions>
- <ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
- <UseApplicationTrust>false</UseApplicationTrust>
- <BootstrapperEnabled>true</BootstrapperEnabled>
- <TargetFrameworkProfile>Client</TargetFrameworkProfile>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeContractsEnableRuntimeChecking>False</CodeContractsEnableRuntimeChecking>
- <CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
- <CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
- <CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
- <CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
- <CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
- <CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
- <CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
- <CodeContractsPointerObligations>False</CodeContractsPointerObligations>
- <CodeContractsContainerAnalysis>False</CodeContractsContainerAnalysis>
- <CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
- <CodeContractsRunInBackground>True</CodeContractsRunInBackground>
- <CodeContractsShowSquigglies>False</CodeContractsShowSquigglies>
- <CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
- <CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
- <CodeContractsCustomRewriterAssembly>
- </CodeContractsCustomRewriterAssembly>
- <CodeContractsCustomRewriterClass>
- </CodeContractsCustomRewriterClass>
- <CodeContractsLibPaths>
- </CodeContractsLibPaths>
- <CodeContractsExtraRewriteOptions>
- </CodeContractsExtraRewriteOptions>
- <CodeContractsExtraAnalysisOptions>
- </CodeContractsExtraAnalysisOptions>
- <CodeContractsBaseLineFile>
- </CodeContractsBaseLineFile>
- <CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
- <CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'z3apidebug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\z3apidebug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DebugType>full</DebugType>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <CodeAnalysisRuleAssemblies>
- </CodeAnalysisRuleAssemblies>
- <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
- <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>Migrated rules for Isabelle.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Checked|AnyCPU'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\Checked\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DebugType>full</DebugType>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <CodeAnalysisLogFile>bin\Debug\Provers.Isabelle.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
- <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
- <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
- <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
- <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
- <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
- <CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
- <CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
- <CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
- <CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
- <CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
- <CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
- <CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
- <CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
- <CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
- <CodeContractsEnumObligations>False</CodeContractsEnumObligations>
- <CodeContractsPointerObligations>False</CodeContractsPointerObligations>
- <CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
- <CodeContractsRunInBackground>True</CodeContractsRunInBackground>
- <CodeContractsShowSquigglies>False</CodeContractsShowSquigglies>
- <CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
- <CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
- <CodeContractsCustomRewriterAssembly />
- <CodeContractsCustomRewriterClass />
- <CodeContractsLibPaths />
- <CodeContractsExtraRewriteOptions />
- <CodeContractsExtraAnalysisOptions />
- <CodeContractsBaseLineFile />
- <CodeContractsCacheAnalysisResults>False</CodeContractsCacheAnalysisResults>
- <CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
- <CodeContractsReferenceAssembly>Build</CodeContractsReferenceAssembly>
- <CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Prover.cs" />
- <Compile Include="..\..\version.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\AIFramework\AIFramework.csproj">
- <Project>{39B0658D-C955-41C5-9A43-48C97A1EF5FD}</Project>
- <Name>AIFramework</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\Basetypes\Basetypes.csproj">
- <Project>{43DFAD18-3E35-4558-9BE2-CAFF6B5BA8A0}</Project>
- <Name>Basetypes</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\CodeContractsExtender\CodeContractsExtender.csproj">
- <Project>{ACCC0156-0921-43ED-8F67-AD8BDC8CDE31}</Project>
- <Name>CodeContractsExtender</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\Core\Core.csproj">
- <Project>{B230A69C-C466-4065-B9C1-84D80E76D802}</Project>
- <Name>Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\ParserHelper\ParserHelper.csproj">
- <Project>{FCD3AC7F-9DFD-46C8-AB1E-09F0B0F16DC5}</Project>
- <Name>ParserHelper</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\VCExpr\VCExpr.csproj">
- <Project>{56FFDBCA-7D14-43B8-A6CA-22A20E417EE1}</Project>
- <Name>VCExpr</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\VCGeneration\VCGeneration.csproj">
- <Project>{E1F10180-C7B9-4147-B51F-FA1B701966DC}</Project>
- <Name>VCGeneration</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Folder Include="Properties\" />
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
- <Visible>False</Visible>
- <ProductName>Windows Installer 3.1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project> \ No newline at end of file
diff --git a/Source/Provers/Isabelle/Prover.cs b/Source/Provers/Isabelle/Prover.cs
deleted file mode 100644
index 35913019..00000000
--- a/Source/Provers/Isabelle/Prover.cs
+++ /dev/null
@@ -1,1083 +0,0 @@
-/*
-Copyright (c) 2009, Sascha Boehme, Technische Universitaet Muenchen
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-* Neither the name of the Technische Universitaet Muenchen nor the names of
- its contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-using System;
-using System.IO;
-using System.Collections.Generic;
-using System.Diagnostics.Contracts;
-using Microsoft.Basetypes;
-using Microsoft.Boogie.VCExprAST;
-
-namespace Microsoft.Boogie.Isabelle {
- public class IsabelleProverOptions : ProverOptions {
- private string filename = null;
- public string Filename = "";
-
- public bool AllTypes = false;
-
- protected override bool Parse(string opt) {
- //Contract.Requires(opt != null);
- bool v2 = false;
- return
- ParseString(opt, "ISABELLE_INPUT", ref filename) ||
- ParseBool(opt, "ISABELLE_FULL", ref AllTypes) ||
- ParseBool(opt, "V2", ref v2) ||
- base.Parse(opt);
- }
-
- [ContractInvariantMethod]
- void ObjectInvariant() {
- Contract.Invariant(Filename != null);
- }
-
-
-
- public override void PostParse() {
- base.PostParse();
-
- if (filename == null) {
- ReportError("Missing ISABELLE_INPUT option. " +
- "This option expects a filename (with extension .b2i).");
- } else if (!Path.GetExtension(filename).Equals(".b2i")) {
- filename = Path.ChangeExtension(filename, ".b2i");
- }
- Filename = cce.NonNull(filename);
- }
- }
-
- public class Factory : ProverFactory {
- private static int index = 0;
-
- public override ProverOptions BlankProverOptions() {
- Contract.Ensures(Contract.Result<ProverOptions>() != null);//POSTCORE
-
- return new IsabelleProverOptions();
- }
-
- public override object NewProverContext(ProverOptions options) {
- //Contract.Requires(options != null);
- Contract.Ensures(Contract.Result<object>() != null);//POSTCORE
-
- IsabelleProverOptions opts = (IsabelleProverOptions)options;
- string filename = opts.Filename;
- Contract.Assert(filename != null);
- lock (this) {
- if (index > 0) {
- filename = Path.ChangeExtension(filename, "." + index + ".b2i");
- }
- index++;
- if (File.Exists(filename)) {
- File.Delete(filename);
- }
- }
- return new IsabelleContext(filename, opts.AllTypes);
- }
-
- public override object SpawnProver(ProverOptions options, object ctxt) {
- //Contract.Requires(options != null);
- //Contract.Requires(ctxt != null);
- Contract.Ensures(Contract.Result<object>() != null);//POSTCORE
-
- return new IsabelleInterface(cce.NonNull((ProverContext)ctxt));
- }
-
- // we prefer DAG outputs over LET
- public override bool SupportsDags {
- get {
- return true;
- }
- }
-
- // this works well in Isabelle, but we do not get structural information
- public override CommandLineOptions.VCVariety DefaultVCVariety {
- get {
- return CommandLineOptions.VCVariety.Dag;
- }
- }
- }
-
- public class IsabelleInterface : ProverInterface {
- private static Dictionary<string/*!*/, int> lastVCIndex =
- new Dictionary<string/*!*/, int>();
-
- private IsabelleContext ctxt;
-
- [ContractInvariantMethod]
- void ObjectInvariant() {
- Contract.Invariant(cce.NonNullElements(lastVCIndex.Keys));
- Contract.Invariant(ctxt != null);
- Contract.Invariant(lastVCIndex != null);
- }
-
-
- public IsabelleInterface(ProverContext ctxt) {
- Contract.Requires(ctxt != null);
- this.ctxt = (IsabelleContext)cce.NonNull(ctxt);
- }
- public override ProverContext Context {
- get {
- Contract.Ensures(Contract.Result<ProverContext>() != null);//POSTCORE
- return ctxt;
- }
- }
- public override VCExpressionGenerator VCExprGen {
- get {
- Contract.Ensures(Contract.Result<VCExpressionGenerator>() != null);//POSTCORE
- return cce.NonNull(ctxt.ExprGen);
- }
- }
-
- public override void BeginCheck(string name, VCExpr vc, ErrorHandler h) {
- //Contract.Requires(h != null);
- //Contract.Requires(vc != null);
- //Contract.Requires(name != null);
-
- int index;
- lock (lastVCIndex) {
- lastVCIndex.TryGetValue(name, out index);
- index++;
- lastVCIndex[name] = index;
- }
- lock (ctxt) {
- ctxt.AddVC(name + " " + index, vc, h);
- }
- }
- public override Outcome CheckOutcome(ErrorHandler handler) {
- //Contract.Requires(handler != null);
- return Outcome.Undetermined; // we will check the goal later in Isabelle
- }
- }
-
- public class IsabelleContext : DeclFreeProverContext {
- private List<string/*!*/> declaredFunctions = new List<string/*!*/>();
-
- public readonly string OutputFilename;
-
- [ContractInvariantMethod]
- void ObjectInvariant() {
- Contract.Invariant(declaredFunctions != null);
- Contract.Invariant(OutputFilename != null);
- Contract.Invariant(cce.NonNullElements(declaredFunctions));
- }
-
- public bool IsFunctionDeclared(string name) {
- Contract.Requires(name != null);
- return declaredFunctions.Contains(name);
- }
- public readonly bool AllTypes;
-
- public IsabelleContext(string outputFilename, bool allTypes)
- : base(new VCExpressionGenerator(), new VCGenerationOptions(new List<string/*!*/> { "isabelle", "external" })) {
- Contract.Requires(outputFilename != null);
-
- this.OutputFilename = outputFilename;
- this.AllTypes = allTypes;
- }
-
- public override object Clone() {
- Contract.Ensures(Contract.Result<object>() != null);//POSTCORE
- return this;
- }
-
- public override void DeclareType(TypeCtorDecl t, string atts) {
- //Contract.Requires(t != null);
-
- B2I b2i = new B2I(this);
- b2i.Write(B2I.Kind.TypeDecl, t.Name + " " + t.Arity + " " +
- B2I.CountOf(t.Attributes));
- b2i.Indent(2);
- b2i.Write(t.Attributes, BoogieExprTranslator);
- b2i.Close();
- }
-
- public override void DeclareConstant(Constant c, bool uniq, string atts) {
- //Contract.Requires(c != null);
- QKeyValue attributes = c.Attributes;
- if (c.Unique) {
- attributes = B2I.Add("unique", null, attributes);
- }
- declaredFunctions.Add(c.Name);
-
- B2I b2i = new B2I(this);
- if (AllTypes) {
- b2i.Write(B2I.Kind.FunDecl, c.Name + " 0 1 " +
- B2I.CountOf(attributes));
- } else {
- b2i.Write(B2I.Kind.FunDecl, c.Name + " 1 " + B2I.CountOf(attributes));
- }
- b2i.Indent(4);
- b2i.Write(c.TypedIdent.Type);
- b2i.Unindent();
- b2i.Indent(2);
- b2i.Write(attributes, BoogieExprTranslator);
- b2i.Close();
- }
-
- public override void DeclareFunction(Function f, string atts) {
- //Contract.Requires(f != null);
- declaredFunctions.Add(f.Name);
-
- B2I b2i = new B2I(this);
- if (AllTypes) {
- b2i.Write(B2I.Kind.FunDecl, f.Name + " " + f.TypeParameters.Length +
- " " + (f.InParams.Length + 1) + " " + B2I.CountOf(f.Attributes));
- b2i.Indent(4);
- foreach (TypeVariable v in f.TypeParameters) {
- Contract.Assert(v != null);
- b2i.Write(v);
- }
- b2i.Unindent();
- } else {
- b2i.Write(B2I.Kind.FunDecl, f.Name + " " + (f.InParams.Length + 1) +
- " " + B2I.CountOf(f.Attributes));
- }
- b2i.Indent(4);
- foreach (Variable v in f.InParams) {
- Contract.Assert(v != null);
- b2i.Write(v.TypedIdent.Type);
- }
- Contract.Assert(f.OutParams.Length == 1);
- b2i.Write(cce.NonNull(f.OutParams[0]).TypedIdent.Type);
- b2i.Unindent();
- b2i.Indent(2);
- b2i.Write(f.Attributes, BoogieExprTranslator);
- b2i.Close();
- }
-
- public override void AddAxiom(Axiom a, string atts) {
- //Contract.Requires(a != null);
- B2I b2i = new B2I(this);
- b2i.Write(B2I.Kind.Axiom, B2I.CountOf(a.Attributes).ToString());
- b2i.Indent(4);
- b2i.Write(BoogieExprTranslator.Translate(a.Expr));
- b2i.Unindent();
- b2i.Indent(2);
- b2i.Write(a.Attributes, BoogieExprTranslator);
- b2i.Close();
- }
-
- public override void AddAxiom(VCExpr e) {
- //Contract.Requires(e != null);
- B2I b2i = new B2I(this);
- b2i.Write(B2I.Kind.Axiom, "0");
- b2i.Indent(4);
- b2i.Write(e);
- b2i.Close();
- }
-
- public override void DeclareGlobalVariable(GlobalVariable v, string atts) {
- //Contract.Requires(v != null);
- B2I b2i = new B2I(this);
- b2i.Write(B2I.Kind.VarDecl, v.Name + " " + B2I.CountOf(v.Attributes));
- b2i.Indent(4);
- b2i.Write(v.TypedIdent.Type);
- b2i.Unindent();
- b2i.Indent(2);
- b2i.Write(v.Attributes, BoogieExprTranslator);
- b2i.Close();
- }
-
- public void AddVC(string name, VCExpr vc,
- ProverInterface.ErrorHandler h) {
- Contract.Requires(name != null);
- Contract.Requires(vc != null);
- Contract.Requires(h != null);
- B2I b2i = new B2I(this);
- b2i.Write(B2I.Kind.VC, name);
- b2i.Indent(4);
- b2i.Write(vc, h);
- b2i.Close();
- }
- }
-
- class B2I {
-
- private TextWriter w;
- private VCExprWriter exprWriter = new VCExprWriter();
- private VCExprOpWriter exprOpWriter = new VCExprOpWriter();
- private ProverInterface.ErrorHandler eh = null;
- public ProverInterface.ErrorHandler LabelRenamer {
- get {
- return eh;
- }
- }
- public readonly IsabelleContext Context;
- private Stack<int> indents;
- private static int[] default_indent = new int[] { 0 };
-
- [ContractInvariantMethod]
- void ObjectInvariant() {
- Contract.Invariant(w != null);
- Contract.Invariant(exprWriter != null);
- Contract.Invariant(exprOpWriter != null);
- Contract.Invariant(Context != null);
- Contract.Invariant(indents != null);
- }
-
-
- public B2I(IsabelleContext ctxt) {
- Contract.Requires(ctxt != null);
- Context = ctxt;
- w = new StreamWriter(ctxt.OutputFilename, true);
- indents = new Stack<int>(default_indent);
- }
- public void Close() {
- w.Close();
- }
-
- public void Indent(int indent) {
- indents.Push(indent + indents.Peek());
- }
- public void Unindent() {
- indents.Pop();
- }
-
- private void DoWrite(Kind k, string s) {
- Contract.Requires(s != null);
- w.WriteLine(new String(' ', indents.Peek()) + StringOfKind(k) + s);
- }
- public void Write(Kind k) {
- DoWrite(k, "");
- }
- public void Write(Kind k, string s) {
- Contract.Requires(s != null);
- DoWrite(k, " " + s);
- }
-
- public void Write(Type ty) {
- Contract.Requires(ty != null);
- if (ty.IsInt) {
- Write(B2I.Kind.Int);
- } else if (ty.IsBool) {
- Write(B2I.Kind.Bool);
- } else if (ty.IsBv) {
- Write(B2I.Kind.BvType, ty.BvBits.ToString());
- } else if (ty.IsVariable) {
- Write(B2I.Kind.TypeVar, ty.AsVariable.Name);
- } else if (ty.IsCtor) {
- CtorType t = ty.AsCtor;
- Contract.Assert(t != null);
- Write(B2I.Kind.TypeCon, t.Decl.Name + " " + t.Arguments.Length);
- Indent(2);
- foreach (Type a in t.Arguments) {
- Contract.Assert(a != null);
- Write(a);
- }
- Unindent();
- } else if (ty.IsMap) {
- MapType t = ty.AsMap;
- Contract.Assert(t != null);
- if (Context.AllTypes) {
- Write(B2I.Kind.Array, t.TypeParameters.Length + " " +
- (t.Arguments.Length + 1));
- Indent(2);
- foreach (TypeVariable v in t.TypeParameters) {
- Contract.Assert(v != null);
- Write(v);
- }
- Unindent();
- } else {
- Write(B2I.Kind.Array, (t.Arguments.Length + 1).ToString());
- }
- Indent(2);
- foreach (Type a in t.Arguments) {
- Contract.Assert(a != null);
- Write(a);
- }
- Write(t.Result);
- Unindent();
- }
- }
-
- public void Write(VCExpr e) {
- Contract.Requires(e != null);
- e.Accept<bool, B2I/*!*/>(exprWriter, this);
- }
- public void Write(VCExpr e, ProverInterface.ErrorHandler h) {
- Contract.Requires(e != null);
- Contract.Requires(h != null);
- eh = h;
- e.Accept<bool, B2I/*!*/>(exprWriter, this);
- eh = null;
- }
- public void Write(VCExprNAry e) {
- Contract.Requires(e != null);
- e.Accept<bool, B2I/*!*/>(exprOpWriter, this);
- }
-
- public B2I Write(QKeyValue atts, Boogie2VCExprTranslator tr) {
- Contract.Requires(tr != null);
- Contract.Ensures(Contract.Result<B2I>() != null);
-
- for (QKeyValue a = atts; a != null; a = a.Next) {
- Write(B2I.Kind.Attribute, a.Key + " " + a.Params.Count);
- Indent(2);
- foreach (object v in a.Params) {
- Contract.Assert(v != null);
- if (v is string) {
- string s = cce.NonNull((string)v).Replace("\n", " ").Replace("\r", " ")
- .Replace("\t", "\\w");
- Write(B2I.Kind.AttributeString, s);
- } else {
- Write(B2I.Kind.AttributeExpr);
- Indent(2);
- Write(tr.Translate(cce.NonNull((Expr)v)));
- Unindent();
- }
- }
- Unindent();
- }
- return this;
- }
-
- public enum Kind {
- TypeDecl,
- FunDecl,
- VarDecl,
- Axiom,
- VC,
- Attribute,
- AttributeString,
- AttributeExpr,
- Type,
- Int,
- Bool,
- BvType,
- TypeVar,
- TypeCon,
- Array,
- True,
- False,
- Not,
- And,
- Or,
- Implies,
- IfThenElse,
- Distinct,
- Eq,
- IntNumber,
- Le,
- Lt,
- Ge,
- Gt,
- Add,
- Sub,
- Mul,
- Div,
- Mod,
- BvNumber,
- BvExtract,
- BvConcat,
- Variable,
- Pat,
- NoPat,
- Forall,
- Exists,
- Select,
- Store,
- HeapSucc,
- Subtype,
- Subtype3,
- Function,
- Label
- };
-
- private string StringOfKind(Kind k) {
- Contract.Ensures(Contract.Result<string>() != null);
-
- switch (k) {
- case Kind.TypeDecl:
- return "type-decl";
- case Kind.FunDecl:
- return "fun-decl";
- case Kind.VarDecl:
- return "var-decl";
- case Kind.Axiom:
- return "axiom";
- case Kind.VC:
- return "vc";
-
- case Kind.Attribute:
- return "attribute";
- case Kind.AttributeString:
- return "string-attr";
- case Kind.AttributeExpr:
- return "expr-attr";
-
- case Kind.Type:
- return "type";
- case Kind.Int:
- return "int";
- case Kind.Bool:
- return "bool";
- case Kind.BvType:
- return "bv";
- case Kind.TypeVar:
- return "type-var";
- case Kind.TypeCon:
- return "type-con";
- case Kind.Array:
- return "array";
-
- case Kind.True:
- return "true";
- case Kind.False:
- return "false";
- case Kind.IntNumber:
- return "int-num";
- case Kind.BvNumber:
- return "bv-num";
- case Kind.Variable:
- return "var";
-
- case Kind.Not:
- return "not";
- case Kind.And:
- return "and";
- case Kind.Or:
- return "or";
- case Kind.Implies:
- return "implies";
- case Kind.IfThenElse:
- return "ite";
- case Kind.Distinct:
- return "distinct";
- case Kind.Eq:
- return "=";
- case Kind.Le:
- return "<=";
- case Kind.Lt:
- return "<";
- case Kind.Ge:
- return ">=";
- case Kind.Gt:
- return ">";
- case Kind.Add:
- return "+";
- case Kind.Sub:
- return "-";
- case Kind.Mul:
- return "*";
- case Kind.Div:
- return "/";
- case Kind.Mod:
- return "%";
- case Kind.Select:
- return "select";
- case Kind.Store:
- return "store";
- case Kind.BvExtract:
- return "bv-extract";
- case Kind.BvConcat:
- return "bv-concat";
- case Kind.HeapSucc:
- return "heap-succ";
- case Kind.Subtype:
- return "subtype";
- case Kind.Subtype3:
- return "subtype3";
-
- case Kind.Function:
- return "fun";
-
- case Kind.Label:
- return "label";
-
- case Kind.Pat:
- return "pat";
- case Kind.NoPat:
- return "nopat";
- case Kind.Forall:
- return "forall";
- case Kind.Exists:
- return "exists";
- }
- Contract.Assert(false);
- throw new cce.UnreachableException();
- }
-
- public static int CountOf(QKeyValue atts) {
- int i = 0;
- for (QKeyValue a = atts; a != null; a = a.Next) {
- i++;
- }
- return i;
- }
-
- public static QKeyValue Add(string key, string value, QKeyValue kv) {
- Contract.Requires(key != null);
- Contract.Ensures(Contract.Result<QKeyValue>() != null);
-
-
- List<object/*!*/>/*!*/ list = new List<object/*!*/>();
- if (value != null) {
- list.Add(value);
- }
- return new QKeyValue(Token.NoToken, key, list, kv);
- }
- }
-
- class VCExprWriter : IVCExprVisitor<bool, B2I/*!*/> {
- public bool Visit(VCExprLiteral node, B2I b2i) {
- //Contract.Requires(node != null);
- //Contract.Requires(b2i != null);
-
- if (node == VCExpressionGenerator.True) {
- b2i.Write(B2I.Kind.True);
- } else if (node == VCExpressionGenerator.False) {
- b2i.Write(B2I.Kind.False);
- } else if (node is VCExprIntLit) {
- b2i.Write(B2I.Kind.IntNumber, ((VCExprIntLit)node).Val.ToString());
- } else
- Contract.Assert(false);
- return true;
- }
-
- public bool Visit(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- b2i.Write(node);
- return true;
- }
-
- public bool Visit(VCExprVar node, B2I b2i) {
- //Contract.Requires(node != null);
- //Contract.Requires(b2i != null);
- if (b2i.Context.IsFunctionDeclared(node.Name)) {
- b2i.Write(B2I.Kind.Function, node.Name + " 0");
- if (b2i.Context.AllTypes) {
- b2i.Indent(2);
- b2i.Write(node.Type);
- b2i.Unindent();
- }
- } else {
- b2i.Write(B2I.Kind.Variable, node.Name);
- b2i.Indent(2);
- b2i.Write(node.Type);
- b2i.Unindent();
- }
- return true;
- }
-
- public bool Visit(VCExprQuantifier node, B2I b2i) {
- //Contract.Requires(node != null);
- //Contract.Requires(b2i != null);
- QKeyValue attribs =
- B2I.Add("qid", node.Infos.qid,
- B2I.Add("uniqueId", node.Infos.uniqueId.ToString(),
- B2I.Add("bvZ3Native", node.Infos.bvZ3Native.ToString(),
- node.Infos.attributes)));
-
- B2I.Kind all = B2I.Kind.Forall;
- B2I.Kind ex = B2I.Kind.Exists;
- if (b2i.Context.AllTypes) {
- b2i.Write((node.Quan == Quantifier.ALL) ? all : ex,
- node.TypeParameters.Count + " " + node.BoundVars.Count + " " +
- node.Triggers.Count + " " + B2I.CountOf(attribs));
- b2i.Indent(2);
- foreach (TypeVariable v in node.TypeParameters) {
- Contract.Assert(v != null);
- b2i.Write(v);
- }
- b2i.Unindent();
- } else {
- b2i.Write((node.Quan == Quantifier.ALL) ? all : ex,
- node.BoundVars.Count + " " + node.Triggers.Count + " " +
- B2I.CountOf(attribs));
- }
- b2i.Indent(2);
- foreach (VCExprVar v in node.BoundVars) {
- Contract.Assert(v != null);
- b2i.Write(B2I.Kind.Variable, v.Name);
- b2i.Indent(2);
- b2i.Write(v.Type);
- b2i.Unindent();
- }
- foreach (VCTrigger t in node.Triggers) {
- Contract.Assert(t != null);
- B2I.Kind k = (t.Pos) ? B2I.Kind.Pat : B2I.Kind.NoPat;
- b2i.Write(k, t.Exprs.Count.ToString());
- b2i.Indent(2);
- foreach (VCExpr e in t.Exprs) {
- Contract.Assert(e != null);
- b2i.Write(e);
- }
- b2i.Unindent();
- }
- b2i.Write(attribs, b2i.Context.BoogieExprTranslator);
- b2i.Unindent();
- b2i.Write(node.Body);
- return true;
- }
-
- public bool Visit(VCExprLet node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- // we do not support "let"
- Contract.Assert(false);
- return true;
- }
- }
-
- class VCExprOpWriter : IVCExprOpVisitor<bool, B2I/*!*/> {
- private void WriteArguments(B2I b2i, VCExprNAry node) {
- Contract.Requires(node!=null);
- Contract.Requires(b2i != null);
- foreach (VCExpr e in node) {
- b2i.Write(e);
- }
- }
- private bool Write(B2I b2i, B2I.Kind k, VCExprNAry node) {
- Contract.Requires(node!=null);
- Contract.Requires(b2i != null);
- b2i.Write(k);
- WriteArguments(b2i, node);
- return true;
- }
-
- public bool VisitNotOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.Not, node);
- }
- public bool VisitEqOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- b2i.Write(B2I.Kind.Eq);
- if (b2i.Context.AllTypes) {
- b2i.Indent(2);
- b2i.Write(node[0].Type);
- b2i.Unindent();
- }
- WriteArguments(b2i, node);
- return true;
- }
- public bool VisitNeqOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- b2i.Write(B2I.Kind.Not);
- b2i.Write(B2I.Kind.Eq);
- if (b2i.Context.AllTypes) {
- b2i.Indent(2);
- b2i.Write(node[0].Type);
- b2i.Unindent();
- }
- WriteArguments(b2i, node);
- return true;
- }
- private bool Unroll(B2I.Kind kind, VCExprNAry node, B2I b2i) {
- Contract.Requires(node!=null);
- Contract.Requires(b2i != null);
- List<VCExpr/*!>!*/> unroll = new List<VCExpr/*!*/>();
- foreach (VCExpr e in node) {
- unroll.Insert(0, e);
- }
-
- List<VCExpr/*!>!*/> flat = new List<VCExpr/*!*/>();
-
- while (unroll.Count > 0) {
- VCExpr hd = unroll[0];
- Contract.Assert(hd != node);
- unroll.RemoveAt(0);
- if (hd is VCExprNAry && ((VCExprNAry)hd).Op.Equals(node.Op)) {
- VCExprNAry n = (VCExprNAry)hd;
- foreach (VCExpr e in n) {
- Contract.Assert(e != null);
- unroll.Insert(0, e);
- }
- } else {
- flat.Insert(0, hd);
- }
- }
-
- b2i.Write(kind, flat.Count.ToString());
- foreach (VCExpr e in flat) {
- Contract.Assert(e != null);
- b2i.Write(e);
- }
- return true;
- }
- public bool VisitAndOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node != null);
- //Contract.Requires(b2i != null);
- return Unroll(B2I.Kind.And, node, b2i);
- }
- public bool VisitOrOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- return Unroll(B2I.Kind.Or, node, b2i);
- }
- public bool VisitImpliesOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.Implies, node);
- }
- public bool VisitDistinctOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- b2i.Write(B2I.Kind.Distinct, node.Length.ToString());
- if (b2i.Context.AllTypes) {
- b2i.Indent(2);
- b2i.Write(node[0].Type);
- b2i.Unindent();
- }
- WriteArguments(b2i, node);
- return true;
- }
-
- public bool VisitLabelOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node != null);
- //Contract.Requires(b2i != null);
- VCExprLabelOp op = (VCExprLabelOp)node.Op;
- Contract.Assert(op != null);
- string label = op.label.Substring(1);
- int ln = 0;
- int col = 0;
- if (b2i.LabelRenamer != null) {
- Absy absy = b2i.LabelRenamer.Label2Absy(label);
- Contract.Assert(absy != null);
- if (absy.Line > 0 && absy.Col > 0) {
- ln = absy.Line;
- col = absy.Col;
- }
- }
- string k = ((op.pos) ? "pos" : "neg");
- b2i.Write(B2I.Kind.Label, k + " " + ln + " " + col);
- WriteArguments(b2i, node);
- return true;
- }
-
- public bool VisitSelectOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node != null);
- //Contract.Requires(b2i != null);
- b2i.Write(B2I.Kind.Select, node.Length.ToString());
- if (b2i.Context.AllTypes) {
- b2i.Indent(2);
- foreach (VCExpr e in node) {
- Contract.Assert(e != null);
- b2i.Write(e.Type);
- }
- b2i.Unindent();
- }
- Contract.Assert(node.Type.Equals(node[0].Type.AsMap.Result));
- WriteArguments(b2i, node);
- return true;
- }
- public bool VisitStoreOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node != null);
- //Contract.Requires(b2i != null);
- b2i.Write(B2I.Kind.Store, node.Length.ToString());
- if (b2i.Context.AllTypes) {
- b2i.Indent(2);
- foreach (VCExpr e in node) {
- Contract.Assert(e != null);
- b2i.Write(e.Type);
- }
- b2i.Unindent();
- }
- Contract.Assert(node.Type.Equals(node[0].Type));
- WriteArguments(b2i, node);
- return true;
- }
-
- public bool VisitBvOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node != null);
- //Contract.Requires(b2i != null);
- VCExprIntLit num = node[0] as VCExprIntLit;
- if (num == null) {
- Contract.Assert(false);
- }
- b2i.Write(B2I.Kind.BvNumber, node.Type.BvBits + " " + num.Val);
- return true;
- }
- public bool VisitBvExtractOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- VCExprBvExtractOp op = (VCExprBvExtractOp)node.Op;
- Contract.Assert(op != null);
- VCExpr child = node[0];
- Contract.Assert(child != null);
-
- b2i.Write(B2I.Kind.BvExtract, op.End + " " + op.Start);
- if (b2i.Context.AllTypes) {
- b2i.Indent(2);
- b2i.Write(child.Type);
- b2i.Write(node.Type);
- b2i.Unindent();
- }
- b2i.Write(child);
- return true;
- }
- public bool VisitBvConcatOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node != null);
- //Contract.Requires(b2i != null);
- //Contract.Requires(node.Length >= 2);
-
- VCExpr child1 = node[0];
- Contract.Assert(child1 != null);
- VCExpr child2 = node[1];
- Contract.Assert(child2 != null);
- b2i.Write(B2I.Kind.BvConcat);
- if (b2i.Context.AllTypes) {
- b2i.Indent(2);
- b2i.Write(child1.Type);
- b2i.Write(child2.Type);
- b2i.Write(node.Type);
- b2i.Unindent();
- }
- b2i.Write(child1);
- b2i.Write(child2);
- return true;
- }
-
- public bool VisitIfThenElseOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node != null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.IfThenElse, node);
- }
-
- public bool VisitCustomOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node != null);
- //Contract.Requires(b2i != null);
- VCExprCustomOp op = (VCExprCustomOp)node.Op;
-
- Contract.Assert(op.Arity == node.Length);
- b2i.Write(B2I.Kind.Function, op.Name + " " + node.Length);
- if (b2i.Context.AllTypes) {
- b2i.Indent(2);
-
- // pick the types from the actual arguments
- foreach (VCExpr arg in node) {
- Contract.Assert(arg != null);
- b2i.Write(arg.Type);
- }
- b2i.Unindent();
- }
- if (b2i.Context.AllTypes) {
- b2i.Indent(2);
- b2i.Write(op.Type);
- b2i.Unindent();
- }
- WriteArguments(b2i, node);
- return true;
- }
-
- public bool VisitHeapSuccessionOp(VCExprNAry node, B2I b2i) {
- Contract.Requires(node != null);
- Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.HeapSucc, node);
- }
-
- public bool VisitAddOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node != null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.Add, node);
- }
- public bool VisitSubOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.Sub, node);
- }
- public bool VisitMulOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.Mul, node);
- }
- public bool VisitDivOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.Div, node);
- }
- public bool VisitModOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.Mod, node);
- }
- public bool VisitLtOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.Lt, node);
- }
- public bool VisitLeOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.Le, node);
- }
- public bool VisitGtOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.Gt, node);
- }
- public bool VisitGeOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.Ge, node);
- }
-
- public bool VisitSubtypeOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.Subtype, node);
- }
- public bool VisitSubtype3Op(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- return Write(b2i, B2I.Kind.Subtype3, node);
- }
-
- public bool VisitBoogieFunctionOp(VCExprNAry node, B2I b2i) {
- //Contract.Requires(node!=null);
- //Contract.Requires(b2i != null);
- Function f = cce.NonNull((VCExprBoogieFunctionOp)node.Op).Func;
-
- Contract.Assert(f.InParams.Length == node.Length);
- b2i.Write(B2I.Kind.Function, f.Name + " " + node.Length);
- if (b2i.Context.AllTypes) {
- b2i.Indent(2);
-
- foreach (Variable v in f.InParams) {
- Contract.Assert(v != null);
- b2i.Write(v.TypedIdent.Type);
- }
- b2i.Unindent();
- }
- Contract.Assert(f.OutParams.Length == 1);
- Contract.Assert(f.OutParams[0] != null);
- if (b2i.Context.AllTypes) {
- b2i.Indent(2);
- b2i.Write(cce.NonNull((Variable)f.OutParams[0]).TypedIdent.Type);
- b2i.Unindent();
- }
- WriteArguments(b2i, node);
- return true;
- }
-
-
-
- }
-} \ No newline at end of file
diff --git a/Source/Provers/Isabelle/cce.cs b/Source/Provers/Isabelle/cce.cs
deleted file mode 100644
index ef594484..00000000
--- a/Source/Provers/Isabelle/cce.cs
+++ /dev/null
@@ -1,193 +0,0 @@
-using System;
-using SA=System.Attribute;
-using System.Collections.Generic;
-using System.Diagnostics.Contracts;
-using System.Text;
-//using Microsoft.Boogie;
-
-/// <summary>
-/// A class containing static methods to extend the functionality of Code Contracts
-/// </summary>
-
-public static class cce {
- //[Pure]
- //public static bool NonNullElements<T>(Microsoft.Dafny.Graph<T> collection) {
- // return collection != null && cce.NonNullElements(collection.TopologicallySortedComponents());
- //}
- [Pure]
- public static T NonNull<T>(T t) {
- Contract.Assert(t != null);
- return t;
- }
- [Pure]
- public static bool NonNullElements<T>(IEnumerable<T> collection) {
- return collection != null && Contract.ForAll(collection, c => c != null);
- }
- [Pure]
- public static bool NonNullElements<TKey, TValue>(IDictionary<TKey, TValue> collection) {
- return collection != null && Contract.ForAll(collection, pair => NonNullElements(pair));
- }
- //[Pure]
- //public static bool NonNullElements(VariableSeq collection) {
- // return collection != null && Contract.ForAll(0, collection.Length, i => collection[i] != null);
- //}
- /// <summary>
- /// For possibly-null lists of non-null elements
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="collection"></param>
- /// <param name="nullability">If true, the collection is treated as an IEnumerable&lt;T!&gt;?, rather than an IEnumerable&lt;T!&gt;!</param>
- /// <returns></returns>
- [Pure]
- public static bool NonNullElements<T>(IEnumerable<T> collection, bool nullability) {
- return (nullability && collection == null) || cce.NonNullElements(collection);
- //Should be the same as:
- /*if(nullability&&collection==null)
- * return true;
- * return cce.NonNullElements(collection)
- */
-
- }
- [Pure]
- public static bool NonNullElements<TKey, TValue>(KeyValuePair<TKey, TValue> kvp) {
- return kvp.Key != null && kvp.Value != null;
- }
- [Pure]
- public static bool NonNullElements<T>(IEnumerator<T> iEnumerator) {
- return iEnumerator != null;
- }
- //[Pure]
- //public static bool NonNullElements<T>(Graphing.Graph<T> graph) {
- // return cce.NonNullElements(graph.TopologicalSort());
- //}
- [Pure]
- public static void BeginExpose(object o) {
- }
- [Pure]
- public static void EndExpose() {
- }
- [Pure]
- public static bool IsPeerConsistent(object o) {
- return true;
- }
- [Pure]
- public static bool IsConsistent(object o) {
- return true;
- }
- [Pure]
- public static bool IsExposable(object o) {
- return true;
- }
- [Pure]
- public static bool IsExposed(object o) {
- return true;
- }
- [Pure]
- public static bool IsNew(object o) {
- return true;
- }
- public static class Owner {
- [Pure]
- public static bool Same(object o, object p) {
- return true;
- }
- [Pure]
- public static void AssignSame(object o, object p) {
- }
- [Pure]
- public static object ElementProxy(object o) {
- return o;
- }
- [Pure]
- public static bool None(object o) {
- return true;
- }
- [Pure]
- public static bool Different(object o, object p) {
- return true;
- }
- [Pure]
- public static bool New(object o) {
- return true;
- }
- }
- [Pure]
- public static void LoopInvariant(bool p) {
- Contract.Assert(p);
- }
- public class UnreachableException : Exception {
- public UnreachableException() {
- }
- }
- //[Pure]
- //public static bool IsValid(Microsoft.Dafny.Expression expression) {
- // return true;
- //}
- //public static List<T> toList<T>(PureCollections.Sequence s) {
- // List<T> toRet = new List<T>();
- // foreach (T t in s.elems)
- // if(t!=null)
- // toRet.Add(t);
- // return toRet;
- //}
-
- //internal static bool NonNullElements(Set set) {
- // return set != null && Contract.ForAll(0,set.Count, i => set[i] != null);
- //}
-}
-
-public class PeerAttribute : SA {
-}
-public class RepAttribute : SA {
-}
-public class CapturedAttribute : SA {
-}
-public class NotDelayedAttribute : SA {
-}
-public class NoDefaultContractAttribute : SA {
-}
-public class VerifyAttribute : SA {
- public VerifyAttribute(bool b) {
-
- }
-}
-public class StrictReadonlyAttribute : SA {
-}
-public class AdditiveAttribute : SA {
-}
-public class ReadsAttribute : SA {
- public enum Reads {
- Nothing,
- Everything,
- };
- public ReadsAttribute(object o) {
- }
-}
-public class GlobalAccessAttribute : SA {
- public GlobalAccessAttribute(bool b) {
- }
-}
-public class EscapesAttribute : SA {
- public EscapesAttribute(bool b, bool b_2) {
- }
-}
-public class NeedsContractsAttribute : SA {
- public NeedsContractsAttribute() {
- }
- public NeedsContractsAttribute(bool ret, bool parameters) {
- }
- public NeedsContractsAttribute(bool ret, int[] parameters) {
- }
-}
-public class ImmutableAttribute : SA {
-}
-public class InsideAttribute : SA {
-}
-public class SpecPublicAttribute : SA {
-}
-public class ElementsPeerAttribute : SA {
-}
-public class ResultNotNewlyAllocatedAttribute : SA {
-}
-public class OnceAttribute : SA {
-} \ No newline at end of file
diff --git a/Source/Provers/SMTLib/SMTLib.csproj b/Source/Provers/SMTLib/SMTLib.csproj
index 3dc042a6..c2d68fc8 100644
--- a/Source/Provers/SMTLib/SMTLib.csproj
+++ b/Source/Provers/SMTLib/SMTLib.csproj
@@ -159,10 +159,6 @@
<Compile Include="Z3.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\..\AIFramework\AIFramework.csproj">
- <Project>{39B0658D-C955-41C5-9A43-48C97A1EF5FD}</Project>
- <Name>AIFramework</Name>
- </ProjectReference>
<ProjectReference Include="..\..\Basetypes\Basetypes.csproj">
<Project>{43DFAD18-3E35-4558-9BE2-CAFF6B5BA8A0}</Project>
<Name>Basetypes</Name>
diff --git a/Source/Provers/SMTLib/SMTLibLineariser.cs b/Source/Provers/SMTLib/SMTLibLineariser.cs
index 6a2cbb6a..cf125c76 100644
--- a/Source/Provers/SMTLib/SMTLibLineariser.cs
+++ b/Source/Provers/SMTLib/SMTLibLineariser.cs
@@ -115,7 +115,7 @@ namespace Microsoft.Boogie.SMTLib
}
sb.Append(']');
TypeToStringHelper(m.Result, sb);
- } else if (t.IsBool || t.IsInt || t.IsBv) {
+ } else if (t.IsBool || t.IsInt || t.IsReal || t.IsBv) {
sb.Append(TypeToString(t));
} else {
System.IO.StringWriter buffer = new System.IO.StringWriter();
@@ -137,6 +137,8 @@ namespace Microsoft.Boogie.SMTLib
return "Bool";
else if (t.IsInt)
return "Int";
+ else if (t.IsReal)
+ return "Real";
else if (t.IsBv) {
return "(_ BitVec " + t.BvBits + ")";
} else {
@@ -181,7 +183,16 @@ namespace Microsoft.Boogie.SMTLib
wr.Write("(- 0 {0})", lit.Abs);
else
wr.Write(lit);
- } else {
+ }
+ else if (node is VCExprRealLit) {
+ BigDec lit = ((VCExprRealLit)node).Val;
+ if (lit.IsNegative)
+ // In SMT2 "-42" is an identifier (SMT2, Sect. 3.2 "Symbols")
+ wr.Write("(- 0.0 {0})", lit.Abs.ToDecimalString(20));
+ else
+ wr.Write(lit.ToDecimalString(20));
+ }
+ else {
Contract.Assert(false);
throw new cce.UnreachableException();
}
@@ -609,13 +620,23 @@ namespace Microsoft.Boogie.SMTLib
public bool VisitDivOp(VCExprNAry node, LineariserOptions options)
{
- WriteApplication("int_div", node, options);
+ WriteApplication("div", node, options);
return true;
}
public bool VisitModOp(VCExprNAry node, LineariserOptions options)
{
- WriteApplication("int_mod", node, options);
+ WriteApplication("mod", node, options);
+ return true;
+ }
+
+ public bool VisitRealDivOp(VCExprNAry node, LineariserOptions options) {
+ WriteApplication("/", node, options);
+ return true;
+ }
+
+ public bool VisitPowOp(VCExprNAry node, LineariserOptions options) {
+ WriteApplication("real_pow", node, options);
return true;
}
@@ -655,6 +676,16 @@ namespace Microsoft.Boogie.SMTLib
return true;
}
+ public bool VisitToIntOp(VCExprNAry node, LineariserOptions options) {
+ WriteApplication("to_int", node, options);
+ return true;
+ }
+
+ public bool VisitToRealOp(VCExprNAry node, LineariserOptions options) {
+ WriteApplication("to_real", node, options);
+ return true;
+ }
+
private string ExtractDatatype(Function func) {
if (func is DatatypeSelector) {
DatatypeSelector selector = (DatatypeSelector) func;
diff --git a/Source/Provers/SMTLib/SMTLibNamer.cs b/Source/Provers/SMTLib/SMTLibNamer.cs
index 5629c0d6..101b07a0 100644
--- a/Source/Provers/SMTLib/SMTLibNamer.cs
+++ b/Source/Provers/SMTLib/SMTLibNamer.cs
@@ -22,8 +22,8 @@ namespace Microsoft.Boogie.SMTLib
// Core theory:
"and", "or", "not", "iff", "true", "false", "xor", "distinct", "ite", "=", "Bool",
"=>", // implies (sic!)
- // Integers
- "Int", "*", "/", "-", "+", "<", "<=", ">", ">=",
+ // Integers and reals
+ "Int", "Real", "*", "/", "-", "+", "<", "<=", ">", ">=", "div", "mod",
// Bitvectors
"extract", "concat",
"bvnot", "bvneg", "bvand", "bvor", "bvadd", "bvmul", "bvudiv", "bvurem", "bvshl", "bvlshr", "bvult",
@@ -48,7 +48,7 @@ namespace Microsoft.Boogie.SMTLib
"lblneg", "lblpos", "lbl-lit",
"if", "&&", "||", "equals", "equiv", "bool",
// Boogie-defined
- "int_mod", "int_div", "UOrdering2", "UOrdering3",
+ "real_pow", "UOrdering2", "UOrdering3",
};
static HashSet<string> reservedSmtWords;
diff --git a/Source/Provers/SMTLib/TypeDeclCollector.cs b/Source/Provers/SMTLib/TypeDeclCollector.cs
index a4bdee51..bff949ea 100644
--- a/Source/Provers/SMTLib/TypeDeclCollector.cs
+++ b/Source/Provers/SMTLib/TypeDeclCollector.cs
@@ -255,7 +255,7 @@ void ObjectInvariant()
return;
}
- if (type.IsBool || type.IsInt || type.IsBv)
+ if (type.IsBool || type.IsInt || type.IsReal || type.IsBv)
return;
CtorType ctorType = type as CtorType;
diff --git a/Source/Provers/Z3api/ContextLayer.cs b/Source/Provers/Z3api/ContextLayer.cs
index df40df3d..ad0c2239 100644
--- a/Source/Provers/Z3api/ContextLayer.cs
+++ b/Source/Provers/Z3api/ContextLayer.cs
@@ -139,8 +139,12 @@ namespace Microsoft.Boogie.Z3 {
{
case TermKind.Numeral:
var numstr = arg.GetNumeralString();
- var bignum = Basetypes.BigNum.FromString(numstr);
- res = gen.Integer(bignum);
+ if (arg.GetSort().GetSortKind() == SortKind.Int) {
+ res = gen.Integer(Basetypes.BigNum.FromString(numstr));
+ }
+ else {
+ res = gen.Real(Basetypes.BigDec.FromString(numstr));
+ }
break;
case TermKind.App:
var args = arg.GetAppArgs();
@@ -151,8 +155,14 @@ namespace Microsoft.Boogie.Z3 {
switch (arg.GetAppDecl().GetKind())
{
case DeclKind.Add:
- if (vcargs.Length == 0)
- res = gen.Integer(Basetypes.BigNum.FromInt(0));
+ if (vcargs.Length == 0) {
+ if (arg.GetSort().GetSortKind() == SortKind.Int) {
+ res = gen.Integer(Basetypes.BigNum.ZERO);
+ }
+ else {
+ res = gen.Real(Basetypes.BigDec.ZERO);
+ }
+ }
else
{
res = vcargs[0];
@@ -167,7 +177,7 @@ namespace Microsoft.Boogie.Z3 {
break;
case DeclKind.Div:
Debug.Assert(vcargs.Length == 2);
- res = gen.Function(VCExpressionGenerator.DivOp, vcargs[0], vcargs[1]);
+ res = gen.Function(VCExpressionGenerator.RealDivOp, vcargs[0], vcargs[1]);
break;
case DeclKind.Eq:
Debug.Assert(vcargs.Length == 2);
@@ -243,8 +253,22 @@ namespace Microsoft.Boogie.Z3 {
break;
case DeclKind.Uminus:
Debug.Assert(vcargs.Length == 1);
- var bigzero = Basetypes.BigNum.FromInt(0);
- res = gen.Function(VCExpressionGenerator.SubOp, gen.Integer(bigzero), vcargs[0]);
+ var argzero = null;
+ if (vcargs[0].Type.IsInt) {
+ argzero = gen.Integer(Basetypes.BigNum.ZERO);
+ }
+ else {
+ argzero = gen.Real(Basetypes.BigDec.ZERO);
+ }
+ res = gen.Function(VCExpressionGenerator.SubOp, argzero, vcargs[0]);
+ break;
+ case DeclKind.ToInt:
+ Debug.Assert(vcargs.Length == 1);
+ res = gen.Function(VCExpressionGenerator.ToIntOp, vcargs[0]);
+ break;
+ case DeclKind.ToReal:
+ Debug.Assert(vcargs.Length == 1);
+ res = gen.Function(VCExpressionGenerator.ToRealOp, vcargs[0]);
break;
case DeclKind.Uninterpreted:
var name = arg.GetAppDecl().GetDeclName();
diff --git a/Source/Provers/Z3api/TypeAdapter.cs b/Source/Provers/Z3api/TypeAdapter.cs
index e1c6de0b..879211f7 100644
--- a/Source/Provers/Z3api/TypeAdapter.cs
+++ b/Source/Provers/Z3api/TypeAdapter.cs
@@ -51,7 +51,8 @@ namespace Microsoft.Boogie.Z3
public bool Equals(BasicType x, BasicType y)
{
return (x.IsBool == y.IsBool) &&
- (x.IsInt == y.IsInt);
+ (x.IsInt == y.IsInt) &&
+ (x.IsReal == y.IsReal);
}
public int GetHashCode(BasicType basicType)
@@ -60,6 +61,8 @@ namespace Microsoft.Boogie.Z3
return 1;
else if (basicType.IsInt)
return 2;
+ else if (basicType.IsReal)
+ return 3;
else
throw new Exception("Basic Type " + basicType.ToString() + " is unkwown");
}
@@ -175,6 +178,10 @@ namespace Microsoft.Boogie.Z3
{
typeAst = z3.MkIntSort();
}
+ else if (basicType.IsReal)
+ {
+ typeAst = z3.MkRealSort();
+ }
else
throw new Exception("Unknown Basic Type " + basicType.ToString());
return typeAst;
diff --git a/Source/Provers/Z3api/VCExprVisitor.cs b/Source/Provers/Z3api/VCExprVisitor.cs
index 0605a854..e56a7950 100644
--- a/Source/Provers/Z3api/VCExprVisitor.cs
+++ b/Source/Provers/Z3api/VCExprVisitor.cs
@@ -15,6 +15,8 @@ using Microsoft.Z3;
namespace Microsoft.Boogie.Z3
{
+ using System.Numerics.BigInteger;
+
public class Z3apiExprLineariser : IVCExprVisitor<Term, LineariserOptions>
{
private Z3apiOpLineariser opLineariser = null;
@@ -110,7 +112,7 @@ namespace Microsoft.Boogie.Z3
return z3.MkSub(unwrapChildren);
}
- if (op == VCExpressionGenerator.DivOp) {
+ if (op == VCExpressionGenerator.DivOp || op == VCExpressionGenerator.RealDivOp) {
return z3.MkDiv(unwrapChildren[0], unwrapChildren[1]);
}
@@ -126,6 +128,14 @@ namespace Microsoft.Boogie.Z3
return z3.MkIte(unwrapChildren[0], unwrapChildren[1], unwrapChildren[2]);
}
+ if (op == VCExpressionGenerator.ToIntOp) {
+ return z3.MkToInt(unwrapChildren[0]);
+ }
+
+ if (op == VCExpressionGenerator.ToRealOp) {
+ return z3.MkToReal(unwrapChildren[0]);
+ }
+
throw new Exception("unhandled boogie operator");
}
@@ -139,11 +149,25 @@ namespace Microsoft.Boogie.Z3
else if (node == VCExpressionGenerator.False)
return cm.z3.MkFalse();
else if (node is VCExprIntLit)
- return cm.z3.MkNumeral(((VCExprIntLit)node).Val.ToInt, cm.z3.MkIntSort());
- else
- {
- Contract.Assert(false);
- throw new cce.UnreachableException();
+ return cm.z3.MkNumeral(((VCExprIntLit)node).Val.ToInt, cm.z3.MkIntSort());
+ else if (node is VCExprRealLit) {
+ string m = ((VCExprRealLit)node).Val.Mantissa.ToString();
+ BigInteger e = ((VCExprRealLit)node).Val.Exponent;
+ string f = BigInteger.Pow(10, e.Abs);
+
+ if (e == 0) {
+ return cm.z3.MkNumeral(m, cm.z3.MkRealSort());
+ }
+ else if (((VCExprRealLit)node).Val.Exponent > 0) {
+ return cm.z3.MkMul(cm.z3.MkNumeral(m, cm.z3.MkRealSort()), cm.z3.MkNumeral(f, cm.z3.MkRealSort()));
+ }
+ else {
+ return cm.z3.MkDiv(cm.z3.MkNumeral(m, cm.z3.MkRealSort()), cm.z3.MkNumeral(f, cm.z3.MkRealSort()));
+ }
+ }
+ else {
+ Contract.Assert(false);
+ throw new cce.UnreachableException();
}
}
@@ -548,6 +572,18 @@ namespace Microsoft.Boogie.Z3
return WriteApplication(node.Op, node, options);
}
+ public Term VisitRealDivOp(VCExprNAry node, LineariserOptions options) {
+ Contract.Requires(options != null);
+ Contract.Requires(node != null);
+ return WriteApplication(node.Op, node, options);
+ }
+
+ public Term VisitPowOp(VCExprNAry node, LineariserOptions options) {
+ Contract.Requires(options != null);
+ Contract.Requires(node != null);
+ return WriteApplication(node.Op, node, options);
+ }
+
public Term VisitLtOp(VCExprNAry node, LineariserOptions options)
{
Contract.Requires(options != null);
@@ -590,6 +626,18 @@ namespace Microsoft.Boogie.Z3
return WriteApplication(node.Op, node, options);
}
+ public Term VisitToIntOp(VCExprNAry node, LineariserOptions options) {
+ Contract.Requires(options != null);
+ Contract.Requires(node != null);
+ return WriteApplication(node.Op, node, options);
+ }
+
+ public Term VisitToRealOp(VCExprNAry node, LineariserOptions options) {
+ Contract.Requires(options != null);
+ Contract.Requires(node != null);
+ return WriteApplication(node.Op, node, options);
+ }
+
public Term VisitBoogieFunctionOp(VCExprNAry node, LineariserOptions options)
{
Contract.Requires(options != null);
diff --git a/Source/Provers/Z3api/Z3api.csproj b/Source/Provers/Z3api/Z3api.csproj
index f9511dbd..bf123823 100644
--- a/Source/Provers/Z3api/Z3api.csproj
+++ b/Source/Provers/Z3api/Z3api.csproj
@@ -129,10 +129,6 @@
<Reference Include="System.XML" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\..\AIFramework\AIFramework.csproj">
- <Project>{39B0658D-C955-41C5-9A43-48C97A1EF5FD}</Project>
- <Name>AIFramework</Name>
- </ProjectReference>
<ProjectReference Include="..\..\Basetypes\Basetypes.csproj">
<Project>{43DFAD18-3E35-4558-9BE2-CAFF6B5BA8A0}</Project>
<Name>Basetypes</Name>
diff --git a/Source/VCExpr/BigLiteralAbstracter.cs b/Source/VCExpr/BigLiteralAbstracter.cs
index 7eb93541..879ab6d6 100644
--- a/Source/VCExpr/BigLiteralAbstracter.cs
+++ b/Source/VCExpr/BigLiteralAbstracter.cs
@@ -120,7 +120,7 @@ namespace Microsoft.Boogie.VCExprAST {
Contract.Ensures(Contract.Result<VCExpr>() != null);
if (lit.IsNegative)
- return Gen.Function(VCExpressionGenerator.SubOp,
+ return Gen.Function(VCExpressionGenerator.SubIOp,
Gen.Integer(BigNum.ZERO), RepresentPos(lit.Neg));
else
return RepresentPos(lit);
@@ -145,7 +145,7 @@ namespace Microsoft.Boogie.VCExprAST {
BigNum dist = lit - Literals[index - 1].Key;
if (dist < resDistance) {
resDistance = dist;
- res = Gen.Function(VCExpressionGenerator.AddOp,
+ res = Gen.Function(VCExpressionGenerator.AddIOp,
Literals[index - 1].Value, Gen.Integer(dist));
}
}
@@ -154,7 +154,7 @@ namespace Microsoft.Boogie.VCExprAST {
BigNum dist = Literals[index].Key - lit;
if (dist < resDistance) {
resDistance = dist;
- res = Gen.Function(VCExpressionGenerator.SubOp,
+ res = Gen.Function(VCExpressionGenerator.SubIOp,
Literals[index].Value, Gen.Integer(dist));
}
}
@@ -198,7 +198,7 @@ namespace Microsoft.Boogie.VCExprAST {
Contract.Requires(bExpr != null);
BigNum dist = bValue - aValue;
- VCExpr distExpr = Gen.Function(VCExpressionGenerator.SubOp, bExpr, aExpr);
+ VCExpr distExpr = Gen.Function(VCExpressionGenerator.SubIOp, bExpr, aExpr);
if (dist <= ConstantDistanceTPO)
// constants that are sufficiently close to each other are put
// into a precise relationship
diff --git a/Source/VCExpr/Boogie2VCExpr.cs b/Source/VCExpr/Boogie2VCExpr.cs
index 4e9c5c10..3035c9de 100644
--- a/Source/VCExpr/Boogie2VCExpr.cs
+++ b/Source/VCExpr/Boogie2VCExpr.cs
@@ -328,6 +328,8 @@ namespace Microsoft.Boogie.VCExprAST {
}
} else if (node.Val is BigNum) {
return Gen.Integer(node.asBigNum);
+ } else if (node.Val is BigDec) {
+ return Gen.Real(node.asBigDec);
} else if (node.Val is BvConst) {
return Gen.Bitvector((BvConst)node.Val);
} else {
@@ -339,15 +341,6 @@ namespace Microsoft.Boogie.VCExprAST {
///////////////////////////////////////////////////////////////////////////////////
- public override AIVariableExpr VisitAIVariableExpr(AIVariableExpr node) {
- //Contract.Requires(node != null);
- Contract.Ensures(Contract.Result<AIVariableExpr>() != null);
- Contract.Assert(false);
- throw new cce.UnreachableException();
- }
-
- ///////////////////////////////////////////////////////////////////////////////////
-
public override Expr VisitIdentifierExpr(IdentifierExpr node) {
//Contract.Requires(node != null);
Contract.Ensures(Contract.Result<Expr>() != null);
@@ -970,8 +963,20 @@ namespace Microsoft.Boogie.VCExprAST {
public VCExpr Visit(UnaryOperator unaryOperator) {
//Contract.Requires(unaryOperator != null);
Contract.Ensures(Contract.Result<VCExpr>() != null);
- Contract.Assert(unaryOperator.Op == UnaryOperator.Opcode.Not && this.args.Count == 1);
- return Gen.Not(this.args);
+ Contract.Assert(unaryOperator.Op == UnaryOperator.Opcode.Neg || unaryOperator.Op == UnaryOperator.Opcode.Not);
+ Contract.Assert(this.args.Count == 1);
+ if (unaryOperator.Op == UnaryOperator.Opcode.Neg) {
+ VCExpr e = cce.NonNull(this.args[0]);
+ if (cce.NonNull(e.Type).IsInt) {
+ return Gen.Function(VCExpressionGenerator.SubIOp, Gen.Integer(BigNum.ZERO), e);
+ }
+ else {
+ return Gen.Function(VCExpressionGenerator.SubROp, Gen.Real(BigDec.ZERO), e);
+ }
+ }
+ else {
+ return Gen.Not(this.args);
+ }
}
public VCExpr Visit(BinaryOperator binaryOperator) {
@@ -1005,6 +1010,21 @@ namespace Microsoft.Boogie.VCExprAST {
return this.args[0];
}
+ public VCExpr Visit(ArithmeticCoercion arithCoercion) {
+ //Contract.Requires(arithCoercion != null);
+ Contract.Ensures(Contract.Result<VCExpr>() != null);
+ Contract.Assert(this.args.Count == 1);
+ switch (arithCoercion.Coercion) {
+ case ArithmeticCoercion.CoercionType.ToInt:
+ return Gen.Function(VCExpressionGenerator.ToIntOp, this.args);
+ case ArithmeticCoercion.CoercionType.ToReal:
+ return Gen.Function(VCExpressionGenerator.ToRealOp, this.args);
+ default:
+ Contract.Assert(false);
+ return null;
+ }
+ }
+
public VCExpr Visit(IfThenElse ite) {
//Contract.Requires(ite != null);
Contract.Ensures(Contract.Result<VCExpr>() != null);
@@ -1021,15 +1041,42 @@ namespace Microsoft.Boogie.VCExprAST {
switch (app.Op) {
case BinaryOperator.Opcode.Add:
- return Gen.Function(VCExpressionGenerator.AddOp, args);
+ if (cce.NonNull(cce.NonNull(args[0]).Type).IsInt) {
+ return Gen.Function(VCExpressionGenerator.AddIOp, args);
+ }
+ else {
+ return Gen.Function(VCExpressionGenerator.AddROp, args);
+ }
case BinaryOperator.Opcode.Sub:
- return Gen.Function(VCExpressionGenerator.SubOp, args);
+ if (cce.NonNull(cce.NonNull(args[0]).Type).IsInt) {
+ return Gen.Function(VCExpressionGenerator.SubIOp, args);
+ }
+ else {
+ return Gen.Function(VCExpressionGenerator.SubROp, args);
+ }
case BinaryOperator.Opcode.Mul:
- return Gen.Function(VCExpressionGenerator.MulOp, args);
+ if (cce.NonNull(cce.NonNull(args[0]).Type).IsInt) {
+ return Gen.Function(VCExpressionGenerator.MulIOp, args);
+ }
+ else {
+ return Gen.Function(VCExpressionGenerator.MulROp, args);
+ }
case BinaryOperator.Opcode.Div:
- return Gen.Function(VCExpressionGenerator.DivOp, args);
+ return Gen.Function(VCExpressionGenerator.DivIOp, args);
case BinaryOperator.Opcode.Mod:
return Gen.Function(VCExpressionGenerator.ModOp, args);
+ case BinaryOperator.Opcode.RealDiv:
+ VCExpr arg0 = cce.NonNull(args[0]);
+ VCExpr arg1 = cce.NonNull(args[1]);
+ if (cce.NonNull(arg0.Type).IsInt) {
+ arg0 = Gen.Function(VCExpressionGenerator.ToRealOp, arg0);
+ }
+ if (cce.NonNull(arg1.Type).IsInt) {
+ arg1 = Gen.Function(VCExpressionGenerator.ToRealOp, arg1);
+ }
+ return Gen.Function(VCExpressionGenerator.DivROp, arg0, arg1);
+ case BinaryOperator.Opcode.Pow:
+ return Gen.Function(VCExpressionGenerator.PowOp, args);
case BinaryOperator.Opcode.Eq:
case BinaryOperator.Opcode.Iff:
// we don't distinguish between equality and equivalence at this point
diff --git a/Source/VCExpr/SimplifyLikeLineariser.cs b/Source/VCExpr/SimplifyLikeLineariser.cs
index 848fafcb..02e3adda 100644
--- a/Source/VCExpr/SimplifyLikeLineariser.cs
+++ b/Source/VCExpr/SimplifyLikeLineariser.cs
@@ -376,6 +376,13 @@ namespace Microsoft.Boogie.VCExprAST {
internal const string intMulName = "*";
internal const string intDivName = "/";
internal const string intModName = "%";
+ internal const string realAddName = "realAdd";
+ internal const string realSubName = "realSub";
+ internal const string realMulName = "realMul";
+ internal const string realDivName = "realDiv";
+ internal const string realPowName = "realPow";
+ internal const string toIntName = "toIntCoercion";
+ internal const string toRealName = "toRealCoercion";
internal void AssertAsTerm(string x, LineariserOptions options) {
Contract.Requires(options != null);
@@ -928,10 +935,16 @@ namespace Microsoft.Boogie.VCExprAST {
public bool VisitAddOp(VCExprNAry node, LineariserOptions options) {
//Contract.Requires(options != null);
//Contract.Requires(node != null);
- if (CommandLineOptions.Clo.ReflectAdd) {
- WriteTermApplication(intAddNameReflect, node, options);
- } else {
- WriteTermApplication(intAddName, node, options);
+ if (node.Type.IsInt) {
+ if (CommandLineOptions.Clo.ReflectAdd) {
+ WriteTermApplication(intAddNameReflect, node, options);
+ }
+ else {
+ WriteTermApplication(intAddName, node, options);
+ }
+ }
+ else {
+ WriteTermApplication(realAddName, node, options);
}
return true;
}
@@ -939,14 +952,24 @@ namespace Microsoft.Boogie.VCExprAST {
public bool VisitSubOp(VCExprNAry node, LineariserOptions options) {
//Contract.Requires(options != null);
//Contract.Requires(node != null);
- WriteTermApplication(intSubName, node, options);
+ if (node.Type.IsInt) {
+ WriteTermApplication(intSubName, node, options);
+ }
+ else {
+ WriteTermApplication(realSubName, node, options);
+ }
return true;
}
public bool VisitMulOp(VCExprNAry node, LineariserOptions options) {
//Contract.Requires(options != null);
//Contract.Requires(node != null);
- WriteTermApplication(intMulName, node, options);
+ if (node.Type.IsInt) {
+ WriteTermApplication(intMulName, node, options);
+ }
+ else {
+ WriteTermApplication(realMulName, node, options);
+ }
return true;
}
@@ -964,6 +987,20 @@ namespace Microsoft.Boogie.VCExprAST {
return true;
}
+ public bool VisitRealDivOp(VCExprNAry node, LineariserOptions options) {
+ //Contract.Requires(options != null);
+ //Contract.Requires(node != null);
+ WriteTermApplication(realDivName, node, options);
+ return true;
+ }
+
+ public bool VisitPowOp(VCExprNAry node, LineariserOptions options) {
+ //Contract.Requires(options != null);
+ //Contract.Requires(node != null);
+ WriteTermApplication(realPowName, node, options);
+ return true;
+ }
+
public bool VisitLtOp(VCExprNAry node, LineariserOptions options) {
//Contract.Requires(options != null);
//Contract.Requires(node != null);
@@ -1006,6 +1043,20 @@ namespace Microsoft.Boogie.VCExprAST {
return true;
}
+ public bool VisitToIntOp(VCExprNAry node, LineariserOptions options) {
+ //Contract.Requires(options != null);
+ //Contract.Requires(node != null);
+ WriteApplication(toIntName, node, options);
+ return true;
+ }
+
+ public bool VisitToRealOp(VCExprNAry node, LineariserOptions options) {
+ //Contract.Requires(options != null);
+ //Contract.Requires(node != null);
+ WriteApplication(toRealName, node, options);
+ return true;
+ }
+
public bool VisitBoogieFunctionOp(VCExprNAry node, LineariserOptions options) {
//Contract.Requires(options != null);
//Contract.Requires(node != null);
diff --git a/Source/VCExpr/TypeErasure.cs b/Source/VCExpr/TypeErasure.cs
index fb91d326..9d366c9f 100644
--- a/Source/VCExpr/TypeErasure.cs
+++ b/Source/VCExpr/TypeErasure.cs
@@ -524,6 +524,7 @@ namespace Microsoft.Boogie.TypeErasure {
public virtual void Setup() {
GetBasicTypeRepr(Type.Int);
+ GetBasicTypeRepr(Type.Real);
GetBasicTypeRepr(Type.Bool);
}
@@ -625,6 +626,7 @@ namespace Microsoft.Boogie.TypeErasure {
base.Setup();
GetTypeCasts(Type.Int);
+ GetTypeCasts(Type.Real);
GetTypeCasts(Type.Bool);
}
@@ -730,7 +732,7 @@ namespace Microsoft.Boogie.TypeErasure {
////////////////////////////////////////////////////////////////////////////
// the only types that we allow in "untyped" expressions are U,
- // Type.Int, and Type.Bool
+ // Type.Int, Type.Real, and Type.Bool
public override Type TypeAfterErasure(Type type) {
//Contract.Requires(type != null);
@@ -746,7 +748,7 @@ namespace Microsoft.Boogie.TypeErasure {
[Pure]
public override bool UnchangedType(Type type) {
//Contract.Requires(type != null);
- return type.IsInt || type.IsBool || type.IsBv || (type.IsMap && CommandLineOptions.Clo.MonomorphicArrays);
+ return type.IsInt || type.IsReal || type.IsBool || type.IsBv || (type.IsMap && CommandLineOptions.Clo.MonomorphicArrays);
}
public VCExpr Cast(VCExpr expr, Type toType) {
@@ -1143,7 +1145,7 @@ namespace Microsoft.Boogie.TypeErasure {
Contract.Requires(bindings != null);
Contract.Requires(node != null);
Contract.Ensures(Contract.Result<VCExpr>() != null);
- Contract.Assume(node.Type == Type.Bool || node.Type == Type.Int);
+ Contract.Assume(node.Type == Type.Bool || node.Type == Type.Int || node.Type == Type.Real);
return node;
}
@@ -1360,7 +1362,7 @@ namespace Microsoft.Boogie.TypeErasure {
}
// Cast the arguments of the node to their old type if necessary and possible; otherwise use
- // their new type (int, bool, or U)
+ // their new type (int, real, bool, or U)
private VCExpr CastArgumentsToOldType(VCExprNAry node, VariableBindings bindings, int newPolarity) {
Contract.Requires(bindings != null);
Contract.Requires(node != null);
@@ -1448,19 +1450,19 @@ namespace Microsoft.Boogie.TypeErasure {
Contract.Requires((bindings != null));
Contract.Requires((node != null));
Contract.Ensures(Contract.Result<VCExpr>() != null);
- return CastArguments(node, Type.Int, bindings, 0);
+ return CastArguments(node, node.Type, bindings, 0);
}
public override VCExpr VisitSubOp(VCExprNAry node, VariableBindings bindings) {
Contract.Requires((bindings != null));
Contract.Requires((node != null));
Contract.Ensures(Contract.Result<VCExpr>() != null);
- return CastArguments(node, Type.Int, bindings, 0);
+ return CastArguments(node, node.Type, bindings, 0);
}
public override VCExpr VisitMulOp(VCExprNAry node, VariableBindings bindings) {
Contract.Requires((bindings != null));
Contract.Requires((node != null));
Contract.Ensures(Contract.Result<VCExpr>() != null);
- return CastArguments(node, Type.Int, bindings, 0);
+ return CastArguments(node, node.Type, bindings, 0);
}
public override VCExpr VisitDivOp(VCExprNAry node, VariableBindings bindings) {
Contract.Requires((bindings != null));
@@ -1474,29 +1476,41 @@ namespace Microsoft.Boogie.TypeErasure {
Contract.Ensures(Contract.Result<VCExpr>() != null);
return CastArguments(node, Type.Int, bindings, 0);
}
+ public override VCExpr VisitRealDivOp(VCExprNAry node, VariableBindings bindings) {
+ Contract.Requires((bindings != null));
+ Contract.Requires((node != null));
+ Contract.Ensures(Contract.Result<VCExpr>() != null);
+ return CastArguments(node, Type.Real, bindings, 0);
+ }
+ public override VCExpr VisitPowOp(VCExprNAry node, VariableBindings bindings) {
+ Contract.Requires((bindings != null));
+ Contract.Requires((node != null));
+ Contract.Ensures(Contract.Result<VCExpr>() != null);
+ return CastArguments(node, Type.Real, bindings, 0);
+ }
public override VCExpr VisitLtOp(VCExprNAry node, VariableBindings bindings) {
Contract.Requires((bindings != null));
Contract.Requires((node != null));
Contract.Ensures(Contract.Result<VCExpr>() != null);
- return CastArguments(node, Type.Int, bindings, 0);
+ return CastArgumentsToOldType(node, bindings, 0);
}
public override VCExpr VisitLeOp(VCExprNAry node, VariableBindings bindings) {
Contract.Requires((bindings != null));
Contract.Requires((node != null));
Contract.Ensures(Contract.Result<VCExpr>() != null);
- return CastArguments(node, Type.Int, bindings, 0);
+ return CastArgumentsToOldType(node, bindings, 0);
}
public override VCExpr VisitGtOp(VCExprNAry node, VariableBindings bindings) {
Contract.Requires((bindings != null));
Contract.Requires((node != null));
Contract.Ensures(Contract.Result<VCExpr>() != null);
- return CastArguments(node, Type.Int, bindings, 0);
+ return CastArgumentsToOldType(node, bindings, 0);
}
public override VCExpr VisitGeOp(VCExprNAry node, VariableBindings bindings) {
Contract.Requires((bindings != null));
Contract.Requires((node != null));
Contract.Ensures(Contract.Result<VCExpr>() != null);
- return CastArguments(node, Type.Int, bindings, 0);
+ return CastArgumentsToOldType(node, bindings, 0);
}
public override VCExpr VisitSubtypeOp(VCExprNAry node, VariableBindings bindings) {
Contract.Requires((bindings != null));
@@ -1504,6 +1518,18 @@ namespace Microsoft.Boogie.TypeErasure {
Contract.Ensures(Contract.Result<VCExpr>() != null);
return CastArguments(node, AxBuilder.U, bindings, 0);
}
+ public override VCExpr VisitToIntOp(VCExprNAry node, VariableBindings bindings) {
+ Contract.Requires((bindings != null));
+ Contract.Requires((node != null));
+ Contract.Ensures(Contract.Result<VCExpr>() != null);
+ return CastArgumentsToOldType(node, bindings, 0);
+ }
+ public override VCExpr VisitToRealOp(VCExprNAry node, VariableBindings bindings) {
+ Contract.Requires((bindings != null));
+ Contract.Requires((node != null));
+ Contract.Ensures(Contract.Result<VCExpr>() != null);
+ return CastArgumentsToOldType(node, bindings, 0);
+ }
public override VCExpr VisitBvOp(VCExprNAry node, VariableBindings bindings) {
Contract.Requires((bindings != null));
Contract.Requires((node != null));
diff --git a/Source/VCExpr/VCExpr.csproj b/Source/VCExpr/VCExpr.csproj
index 18455b6e..bd426125 100644
--- a/Source/VCExpr/VCExpr.csproj
+++ b/Source/VCExpr/VCExpr.csproj
@@ -162,10 +162,6 @@
<Compile Include="VCExprASTVisitors.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\AIFramework\AIFramework.csproj">
- <Project>{39B0658D-C955-41C5-9A43-48C97A1EF5FD}</Project>
- <Name>AIFramework</Name>
- </ProjectReference>
<ProjectReference Include="..\Basetypes\Basetypes.csproj">
<Project>{43DFAD18-3E35-4558-9BE2-CAFF6B5BA8A0}</Project>
<Name>Basetypes</Name>
diff --git a/Source/VCExpr/VCExprAST.cs b/Source/VCExpr/VCExprAST.cs
index 38541881..fcfd0041 100644
--- a/Source/VCExpr/VCExprAST.cs
+++ b/Source/VCExpr/VCExprAST.cs
@@ -49,6 +49,12 @@ namespace Microsoft.Boogie {
return new VCExprIntLit(x);
}
+ public VCExpr/*!*/ Real(BigDec x) {
+ Contract.Ensures(Contract.Result<VCExpr>() != null);
+
+ return new VCExprRealLit(x);
+ }
+
public VCExpr/*!*/ Function(VCExprOp/*!*/ op,
List<VCExpr/*!*/>/*!*/ arguments,
List<Type/*!*/>/*!*/ typeArguments) {
@@ -199,7 +205,8 @@ namespace Microsoft.Boogie {
Contract.Requires(e1 != null);
Contract.Ensures(Contract.Result<VCExpr>() != null);
- return Function(AddOp, e0, e1);
+ VCExprOp op = cce.NonNull(cce.NonNull(e0).Type).IsInt ? AddIOp : AddROp;
+ return Function(op, e0, e1);
}
public VCExpr/*!*/ Or(VCExpr/*!*/ e0, VCExpr/*!*/ e1) {
Contract.Requires(e0 != null);
@@ -308,11 +315,16 @@ namespace Microsoft.Boogie {
////////////////////////////////////////////////////////////////////////////////
// Further operators
- public static readonly VCExprOp AddOp = new VCExprNAryOp(2, Type.Int);
- public static readonly VCExprOp SubOp = new VCExprNAryOp(2, Type.Int);
- public static readonly VCExprOp MulOp = new VCExprNAryOp(2, Type.Int);
- public static readonly VCExprOp DivOp = new VCExprNAryOp(2, Type.Int);
+ public static readonly VCExprOp AddIOp = new VCExprNAryOp(2, Type.Int);
+ public static readonly VCExprOp AddROp = new VCExprNAryOp(2, Type.Real);
+ public static readonly VCExprOp SubIOp = new VCExprNAryOp(2, Type.Int);
+ public static readonly VCExprOp SubROp = new VCExprNAryOp(2, Type.Real);
+ public static readonly VCExprOp MulIOp = new VCExprNAryOp(2, Type.Int);
+ public static readonly VCExprOp MulROp = new VCExprNAryOp(2, Type.Real);
+ public static readonly VCExprOp DivIOp = new VCExprNAryOp(2, Type.Int);
+ public static readonly VCExprOp DivROp = new VCExprNAryOp(2, Type.Real);
public static readonly VCExprOp ModOp = new VCExprNAryOp(2, Type.Int);
+ public static readonly VCExprOp PowOp = new VCExprNAryOp(2, Type.Real);
public static readonly VCExprOp LtOp = new VCExprNAryOp(2, Type.Bool);
public static readonly VCExprOp LeOp = new VCExprNAryOp(2, Type.Bool);
public static readonly VCExprOp GtOp = new VCExprNAryOp(2, Type.Bool);
@@ -322,6 +334,8 @@ namespace Microsoft.Boogie {
// the type of the compared terms
public static readonly VCExprOp Subtype3Op = new VCExprNAryOp(3, Type.Bool);
public static readonly VCExprOp IfThenElseOp = new VCExprIfThenElseOp();
+ public static readonly VCExprOp ToIntOp = new VCExprNAryOp(1, Type.Int);
+ public static readonly VCExprOp ToRealOp = new VCExprNAryOp(1, Type.Real);
public static readonly VCExprOp TickleBoolOp = new VCExprCustomOp("tickleBool", 1, Type.Bool);
@@ -376,13 +390,17 @@ namespace Microsoft.Boogie {
MulOp,
DivOp,
ModOp,
+ RealDivOp,
+ PowOp,
LtOp,
LeOp,
GtOp,
GeOp,
SubtypeOp,
Subtype3Op,
- BvConcatOp
+ BvConcatOp,
+ ToIntOp,
+ ToRealOp
};
internal static Dictionary<VCExprOp/*!*/, SingletonOp>/*!*/ SingletonOpDict;
[ContractInvariantMethod]
@@ -399,17 +417,24 @@ namespace Microsoft.Boogie {
SingletonOpDict.Add(AndOp, SingletonOp.AndOp);
SingletonOpDict.Add(OrOp, SingletonOp.OrOp);
SingletonOpDict.Add(ImpliesOp, SingletonOp.ImpliesOp);
- SingletonOpDict.Add(AddOp, SingletonOp.AddOp);
- SingletonOpDict.Add(SubOp, SingletonOp.SubOp);
- SingletonOpDict.Add(MulOp, SingletonOp.MulOp);
- SingletonOpDict.Add(DivOp, SingletonOp.DivOp);
+ SingletonOpDict.Add(AddIOp, SingletonOp.AddOp);
+ SingletonOpDict.Add(AddROp, SingletonOp.AddOp);
+ SingletonOpDict.Add(SubIOp, SingletonOp.SubOp);
+ SingletonOpDict.Add(SubROp, SingletonOp.SubOp);
+ SingletonOpDict.Add(MulIOp, SingletonOp.MulOp);
+ SingletonOpDict.Add(MulROp, SingletonOp.MulOp);
+ SingletonOpDict.Add(DivIOp, SingletonOp.DivOp);
+ SingletonOpDict.Add(DivROp, SingletonOp.RealDivOp);
SingletonOpDict.Add(ModOp, SingletonOp.ModOp);
+ SingletonOpDict.Add(PowOp, SingletonOp.PowOp);
SingletonOpDict.Add(LtOp, SingletonOp.LtOp);
SingletonOpDict.Add(LeOp, SingletonOp.LeOp);
SingletonOpDict.Add(GtOp, SingletonOp.GtOp);
SingletonOpDict.Add(GeOp, SingletonOp.GeOp);
SingletonOpDict.Add(SubtypeOp, SingletonOp.SubtypeOp);
SingletonOpDict.Add(Subtype3Op, SingletonOp.Subtype3Op);
+ SingletonOpDict.Add(ToIntOp, SingletonOp.ToIntOp);
+ SingletonOpDict.Add(ToRealOp, SingletonOp.ToRealOp);
}
////////////////////////////////////////////////////////////////////////////////
@@ -810,6 +835,27 @@ namespace Microsoft.Boogie.VCExprAST {
}
}
+ public class VCExprRealLit : VCExprLiteral {
+ public readonly BigDec Val;
+ internal VCExprRealLit(BigDec val)
+ : base(Type.Real) {
+ this.Val = val;
+ }
+ [Pure]
+ [Reads(ReadsAttribute.Reads.Nothing)]
+ public override bool Equals(object that) {
+ if (Object.ReferenceEquals(this, that))
+ return true;
+ if (that is VCExprRealLit)
+ return Val == ((VCExprRealLit)that).Val;
+ return false;
+ }
+ [Pure]
+ public override int GetHashCode() {
+ return Val.GetHashCode() * 72321;
+ }
+ }
+
/////////////////////////////////////////////////////////////////////////////////
// Operator expressions with fixed arity
[ContractClassFor(typeof(VCExprNAry))]
@@ -1218,6 +1264,10 @@ namespace Microsoft.Boogie.VCExprAST {
return visitor.VisitDivOp(expr, arg);
case VCExpressionGenerator.SingletonOp.ModOp:
return visitor.VisitModOp(expr, arg);
+ case VCExpressionGenerator.SingletonOp.RealDivOp:
+ return visitor.VisitRealDivOp(expr, arg);
+ case VCExpressionGenerator.SingletonOp.PowOp:
+ return visitor.VisitPowOp(expr, arg);
case VCExpressionGenerator.SingletonOp.LtOp:
return visitor.VisitLtOp(expr, arg);
case VCExpressionGenerator.SingletonOp.LeOp:
@@ -1232,6 +1282,10 @@ namespace Microsoft.Boogie.VCExprAST {
return visitor.VisitSubtype3Op(expr, arg);
case VCExpressionGenerator.SingletonOp.BvConcatOp:
return visitor.VisitBvConcatOp(expr, arg);
+ case VCExpressionGenerator.SingletonOp.ToIntOp:
+ return visitor.VisitToIntOp(expr, arg);
+ case VCExpressionGenerator.SingletonOp.ToRealOp:
+ return visitor.VisitToRealOp(expr, arg);
default:
Contract.Assert(false);
throw new cce.UnreachableException();
diff --git a/Source/VCExpr/VCExprASTPrinter.cs b/Source/VCExpr/VCExprASTPrinter.cs
index adb3b27e..00e6fb9c 100644
--- a/Source/VCExpr/VCExprASTPrinter.cs
+++ b/Source/VCExpr/VCExprASTPrinter.cs
@@ -290,12 +290,22 @@ namespace Microsoft.Boogie.VCExprAST {
public bool VisitDivOp(VCExprNAry node, TextWriter wr) {
//Contract.Requires(wr != null);
//Contract.Requires(node != null);
- return PrintNAry("/", node, wr);
+ return PrintNAry("div", node, wr);
}
public bool VisitModOp(VCExprNAry node, TextWriter wr) {
//Contract.Requires(wr != null);
//Contract.Requires(node != null);
- return PrintNAry("%", node, wr);
+ return PrintNAry("mod", node, wr);
+ }
+ public bool VisitRealDivOp(VCExprNAry node, TextWriter wr) {
+ //Contract.Requires(wr != null);
+ //Contract.Requires(node != null);
+ return PrintNAry("/", node, wr);
+ }
+ public bool VisitPowOp(VCExprNAry node, TextWriter wr) {
+ //Contract.Requires(wr != null);
+ //Contract.Requires(node != null);
+ return PrintNAry("**", node, wr);
}
public bool VisitLtOp(VCExprNAry node, TextWriter wr) {
//Contract.Requires(wr != null);
@@ -327,6 +337,16 @@ namespace Microsoft.Boogie.VCExprAST {
//Contract.Requires(node != null);
return PrintNAry("<::", node, wr);
}
+ public bool VisitToIntOp(VCExprNAry node, TextWriter wr) {
+ //Contract.Requires(wr != null);
+ //Contract.Requires(node != null);
+ return PrintNAry("int", node, wr);
+ }
+ public bool VisitToRealOp(VCExprNAry node, TextWriter wr) {
+ //Contract.Requires(wr != null);
+ //Contract.Requires(node != null);
+ return PrintNAry("real", node, wr);
+ }
public bool VisitBoogieFunctionOp(VCExprNAry node, TextWriter wr) {
//Contract.Requires(wr != null);
//Contract.Requires(node != null);
diff --git a/Source/VCExpr/VCExprASTVisitors.cs b/Source/VCExpr/VCExprASTVisitors.cs
index 1a29bbeb..1dd1cac9 100644
--- a/Source/VCExpr/VCExprASTVisitors.cs
+++ b/Source/VCExpr/VCExprASTVisitors.cs
@@ -75,12 +75,16 @@ namespace Microsoft.Boogie.VCExprAST {
Result VisitMulOp(VCExprNAry node, Arg arg);
Result VisitDivOp(VCExprNAry node, Arg arg);
Result VisitModOp(VCExprNAry node, Arg arg);
+ Result VisitRealDivOp(VCExprNAry node, Arg arg);
+ Result VisitPowOp(VCExprNAry node, Arg arg);
Result VisitLtOp(VCExprNAry node, Arg arg);
Result VisitLeOp(VCExprNAry node, Arg arg);
Result VisitGtOp(VCExprNAry node, Arg arg);
Result VisitGeOp(VCExprNAry node, Arg arg);
Result VisitSubtypeOp(VCExprNAry node, Arg arg);
Result VisitSubtype3Op(VCExprNAry node, Arg arg);
+ Result VisitToIntOp(VCExprNAry node, Arg arg);
+ Result VisitToRealOp(VCExprNAry node, Arg arg);
Result VisitBoogieFunctionOp(VCExprNAry node, Arg arg);
Result VisitIfThenElseOp(VCExprNAry node, Arg arg);
Result VisitCustomOp(VCExprNAry node, Arg arg);
@@ -179,6 +183,16 @@ namespace Microsoft.Boogie.VCExprAST {
throw new NotImplementedException();
}
+ public Result VisitRealDivOp(VCExprNAry node, Arg arg) {
+ Contract.Requires(node != null);
+ throw new NotImplementedException();
+ }
+
+ public Result VisitPowOp(VCExprNAry node, Arg arg) {
+ Contract.Requires(node != null);
+ throw new NotImplementedException();
+ }
+
public Result VisitLtOp(VCExprNAry node, Arg arg) {
Contract.Requires(node != null);
throw new NotImplementedException();
@@ -209,6 +223,16 @@ namespace Microsoft.Boogie.VCExprAST {
throw new NotImplementedException();
}
+ public Result VisitToIntOp(VCExprNAry node, Arg arg) {
+ Contract.Requires(node != null);
+ throw new NotImplementedException();
+ }
+
+ public Result VisitToRealOp(VCExprNAry node, Arg arg) {
+ Contract.Requires(node != null);
+ throw new NotImplementedException();
+ }
+
public Result VisitBoogieFunctionOp(VCExprNAry node, Arg arg) {
Contract.Requires(node != null);
throw new NotImplementedException();
@@ -1427,6 +1451,14 @@ namespace Microsoft.Boogie.VCExprAST {
//Contract.Requires(node != null);
return StandardResult(node, arg);
}
+ public virtual Result VisitRealDivOp(VCExprNAry node, Arg arg) {
+ //Contract.Requires(node != null);
+ return StandardResult(node, arg);
+ }
+ public virtual Result VisitPowOp(VCExprNAry node, Arg arg) {
+ //Contract.Requires(node != null);
+ return StandardResult(node, arg);
+ }
public virtual Result VisitLtOp(VCExprNAry node, Arg arg) {
//Contract.Requires(node != null);
return StandardResult(node, arg);
@@ -1451,6 +1483,14 @@ namespace Microsoft.Boogie.VCExprAST {
//Contract.Requires(node != null);
return StandardResult(node, arg);
}
+ public virtual Result VisitToIntOp(VCExprNAry node, Arg arg) {
+ //Contract.Requires(node != null);
+ return StandardResult(node, arg);
+ }
+ public virtual Result VisitToRealOp(VCExprNAry node, Arg arg) {
+ //Contract.Requires(node != null);
+ return StandardResult(node, arg);
+ }
public virtual Result VisitBoogieFunctionOp(VCExprNAry node, Arg arg) {
//Contract.Requires(node != null);
return StandardResult(node, arg);
diff --git a/Source/VCGeneration/ConditionGeneration.cs b/Source/VCGeneration/ConditionGeneration.cs
index 9837626d..ca0c0e59 100644
--- a/Source/VCGeneration/ConditionGeneration.cs
+++ b/Source/VCGeneration/ConditionGeneration.cs
@@ -11,7 +11,6 @@ using System.Threading;
using System.IO;
using Microsoft.Boogie;
using Graphing;
-using AI = Microsoft.AbstractInterpretationFramework;
using System.Diagnostics.Contracts;
using Microsoft.Basetypes;
using Microsoft.Boogie.VCExprAST;
diff --git a/Source/VCGeneration/DoomCheck.cs b/Source/VCGeneration/DoomCheck.cs
index 8571caee..d7e297cd 100644
--- a/Source/VCGeneration/DoomCheck.cs
+++ b/Source/VCGeneration/DoomCheck.cs
@@ -12,7 +12,6 @@ using System.Threading;
using System.IO;
using Microsoft.Boogie;
using Graphing;
-using AI = Microsoft.AbstractInterpretationFramework;
using System.Diagnostics.Contracts;
using Microsoft.Basetypes;
using Microsoft.Boogie.VCExprAST;
diff --git a/Source/VCGeneration/DoomErrorHandler.cs b/Source/VCGeneration/DoomErrorHandler.cs
index b0821240..5f00a3cf 100644
--- a/Source/VCGeneration/DoomErrorHandler.cs
+++ b/Source/VCGeneration/DoomErrorHandler.cs
@@ -6,7 +6,6 @@ using System.Threading;
using System.IO;
using Microsoft.Boogie;
using Graphing;
-using AI = Microsoft.AbstractInterpretationFramework;
using System.Diagnostics.Contracts;
using Microsoft.Basetypes;
using Microsoft.Boogie.VCExprAST;
diff --git a/Source/VCGeneration/DoomedLoopUnrolling.cs b/Source/VCGeneration/DoomedLoopUnrolling.cs
index 9d58d227..5469a1db 100644
--- a/Source/VCGeneration/DoomedLoopUnrolling.cs
+++ b/Source/VCGeneration/DoomedLoopUnrolling.cs
@@ -6,7 +6,6 @@ using System.Threading;
using System.IO;
using Microsoft.Boogie;
using Graphing;
-using AI = Microsoft.AbstractInterpretationFramework;
using System.Diagnostics.Contracts;
using Microsoft.Basetypes;
using Microsoft.Boogie.VCExprAST;
diff --git a/Source/VCGeneration/DoomedStrategy.cs b/Source/VCGeneration/DoomedStrategy.cs
index 18de31c7..c08662b1 100644
--- a/Source/VCGeneration/DoomedStrategy.cs
+++ b/Source/VCGeneration/DoomedStrategy.cs
@@ -11,7 +11,6 @@ using System.Threading;
using System.IO;
using Microsoft.Boogie;
using Graphing;
-using AI = Microsoft.AbstractInterpretationFramework;
using System.Diagnostics.Contracts;
using Microsoft.Basetypes;
using Microsoft.Boogie.VCExprAST;
diff --git a/Source/VCGeneration/HasseDiagram.cs b/Source/VCGeneration/HasseDiagram.cs
index db777336..d5fdfb66 100644
--- a/Source/VCGeneration/HasseDiagram.cs
+++ b/Source/VCGeneration/HasseDiagram.cs
@@ -11,7 +11,6 @@ using System.Threading;
using System.IO;
using Microsoft.Boogie;
using Graphing;
-using AI = Microsoft.AbstractInterpretationFramework;
using System.Diagnostics.Contracts;
using Microsoft.Basetypes;
using Microsoft.Boogie.VCExprAST;
diff --git a/Source/VCGeneration/StratifiedVC.cs b/Source/VCGeneration/StratifiedVC.cs
index a2ad1bd3..5c6a5f68 100644
--- a/Source/VCGeneration/StratifiedVC.cs
+++ b/Source/VCGeneration/StratifiedVC.cs
@@ -8,7 +8,6 @@ using System.Text;
using System.IO;
using Microsoft.Boogie;
using Graphing;
-using AI = Microsoft.AbstractInterpretationFramework;
using System.Diagnostics.Contracts;
using Microsoft.Basetypes;
using Microsoft.Boogie.VCExprAST;
diff --git a/Source/VCGeneration/VC.cs b/Source/VCGeneration/VC.cs
index e7f5999a..6efae58c 100644
--- a/Source/VCGeneration/VC.cs
+++ b/Source/VCGeneration/VC.cs
@@ -12,7 +12,6 @@ using System.Threading;
using System.IO;
using Microsoft.Boogie;
using Graphing;
-using AI = Microsoft.AbstractInterpretationFramework;
using System.Diagnostics.Contracts;
using Microsoft.Basetypes;
using Microsoft.Boogie.VCExprAST;
diff --git a/Source/VCGeneration/VCDoomed.cs b/Source/VCGeneration/VCDoomed.cs
index 15c6e2aa..962f9f26 100644
--- a/Source/VCGeneration/VCDoomed.cs
+++ b/Source/VCGeneration/VCDoomed.cs
@@ -11,7 +11,6 @@ using System.Threading;
using System.IO;
using Microsoft.Boogie;
using Graphing;
-using AI = Microsoft.AbstractInterpretationFramework;
using System.Diagnostics.Contracts;
using Microsoft.Basetypes;
using Microsoft.Boogie.VCExprAST;
diff --git a/Source/VCGeneration/VCGeneration.csproj b/Source/VCGeneration/VCGeneration.csproj
index fe7ddc70..98958c66 100644
--- a/Source/VCGeneration/VCGeneration.csproj
+++ b/Source/VCGeneration/VCGeneration.csproj
@@ -1,228 +1,224 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.21022</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{E1F10180-C7B9-4147-B51F-FA1B701966DC}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>VCGeneration</RootNamespace>
- <AssemblyName>VCGeneration</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <CodeContractsAssemblyMode>1</CodeContractsAssemblyMode>
- <SignAssembly>true</SignAssembly>
- <AssemblyOriginatorKeyFile>..\InterimKey.snk</AssemblyOriginatorKeyFile>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>3.5</OldToolsVersion>
- <UpgradeBackupLocation />
- <PublishUrl>publish\</PublishUrl>
- <Install>true</Install>
- <InstallFrom>Disk</InstallFrom>
- <UpdateEnabled>false</UpdateEnabled>
- <UpdateMode>Foreground</UpdateMode>
- <UpdateInterval>7</UpdateInterval>
- <UpdateIntervalUnits>Days</UpdateIntervalUnits>
- <UpdatePeriodically>false</UpdatePeriodically>
- <UpdateRequired>false</UpdateRequired>
- <MapFileExtensions>true</MapFileExtensions>
- <ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
- <UseApplicationTrust>false</UseApplicationTrust>
- <BootstrapperEnabled>true</BootstrapperEnabled>
- <TargetFrameworkProfile>Client</TargetFrameworkProfile>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeContractsEnableRuntimeChecking>False</CodeContractsEnableRuntimeChecking>
- <CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
- <CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
- <CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
- <CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
- <CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
- <CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
- <CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
- <CodeContractsPointerObligations>False</CodeContractsPointerObligations>
- <CodeContractsContainerAnalysis>False</CodeContractsContainerAnalysis>
- <CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
- <CodeContractsRunInBackground>True</CodeContractsRunInBackground>
- <CodeContractsShowSquigglies>False</CodeContractsShowSquigglies>
- <CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
- <CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
- <CodeContractsCustomRewriterAssembly>
- </CodeContractsCustomRewriterAssembly>
- <CodeContractsCustomRewriterClass>
- </CodeContractsCustomRewriterClass>
- <CodeContractsLibPaths>
- </CodeContractsLibPaths>
- <CodeContractsExtraRewriteOptions>
- </CodeContractsExtraRewriteOptions>
- <CodeContractsExtraAnalysisOptions>
- </CodeContractsExtraAnalysisOptions>
- <CodeContractsBaseLineFile>
- </CodeContractsBaseLineFile>
- <CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
- <CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'z3apidebug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\z3apidebug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DebugType>full</DebugType>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <CodeAnalysisRuleAssemblies>
- </CodeAnalysisRuleAssemblies>
- <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
- <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>Migrated rules for VCGeneration.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Checked|AnyCPU'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\Checked\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DebugType>full</DebugType>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <CodeAnalysisLogFile>bin\Debug\VCGeneration.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
- <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
- <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
- <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
- <CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
- <CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
- <CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
- <CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
- <CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
- <CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
- <CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
- <CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
- <CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
- <CodeContractsEnumObligations>False</CodeContractsEnumObligations>
- <CodeContractsPointerObligations>False</CodeContractsPointerObligations>
- <CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
- <CodeContractsRunInBackground>True</CodeContractsRunInBackground>
- <CodeContractsShowSquigglies>False</CodeContractsShowSquigglies>
- <CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
- <CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
- <CodeContractsCustomRewriterAssembly />
- <CodeContractsCustomRewriterClass />
- <CodeContractsLibPaths />
- <CodeContractsExtraRewriteOptions />
- <CodeContractsExtraAnalysisOptions />
- <CodeContractsBaseLineFile />
- <CodeContractsCacheAnalysisResults>False</CodeContractsCacheAnalysisResults>
- <CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
- <CodeContractsReferenceAssembly>Build</CodeContractsReferenceAssembly>
- <CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="BlockPredicator.cs" />
- <Compile Include="Check.cs" />
- <Compile Include="ConditionGeneration.cs" />
- <Compile Include="Context.cs" />
- <Compile Include="DoomCheck.cs" />
- <Compile Include="DoomedLoopUnrolling.cs" />
- <Compile Include="DoomedStrategy.cs" />
- <Compile Include="DoomErrorHandler.cs" />
- <Compile Include="GraphAlgorithms.cs" />
- <Compile Include="HasseDiagram.cs" />
- <Compile Include="OrderingAxioms.cs" />
- <Compile Include="SmartBlockPredicator.cs" />
- <Compile Include="StratifiedVC.cs" />
- <Compile Include="UniformityAnalyser.cs" />
- <Compile Include="VC.cs" />
- <Compile Include="VCDoomed.cs" />
- <Compile Include="..\version.cs" />
- <Compile Include="Wlp.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\AIFramework\AIFramework.csproj">
- <Project>{39B0658D-C955-41C5-9A43-48C97A1EF5FD}</Project>
- <Name>AIFramework</Name>
- </ProjectReference>
- <ProjectReference Include="..\Basetypes\Basetypes.csproj">
- <Project>{43DFAD18-3E35-4558-9BE2-CAFF6B5BA8A0}</Project>
- <Name>Basetypes</Name>
- </ProjectReference>
- <ProjectReference Include="..\CodeContractsExtender\CodeContractsExtender.csproj">
- <Project>{ACCC0156-0921-43ED-8F67-AD8BDC8CDE31}</Project>
- <Name>CodeContractsExtender</Name>
- </ProjectReference>
- <ProjectReference Include="..\Core\Core.csproj">
- <Project>{B230A69C-C466-4065-B9C1-84D80E76D802}</Project>
- <Name>Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\Graph\Graph.csproj">
- <Project>{69A2B0B8-BCAC-4101-AE7A-556FCC58C06E}</Project>
- <Name>Graph</Name>
- </ProjectReference>
- <ProjectReference Include="..\Model\Model.csproj">
- <Project>{ACEF88D5-DADD-46DA-BAE1-2144D63F4C83}</Project>
- <Name>Model</Name>
- </ProjectReference>
- <ProjectReference Include="..\ParserHelper\ParserHelper.csproj">
- <Project>{FCD3AC7F-9DFD-46C8-AB1E-09F0B0F16DC5}</Project>
- <Name>ParserHelper</Name>
- </ProjectReference>
- <ProjectReference Include="..\VCExpr\VCExpr.csproj">
- <Project>{56FFDBCA-7D14-43B8-A6CA-22A20E417EE1}</Project>
- <Name>VCExpr</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Folder Include="Properties\" />
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
- <Visible>False</Visible>
- <ProductName>Windows Installer 3.1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{E1F10180-C7B9-4147-B51F-FA1B701966DC}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>VCGeneration</RootNamespace>
+ <AssemblyName>VCGeneration</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <CodeContractsAssemblyMode>1</CodeContractsAssemblyMode>
+ <SignAssembly>true</SignAssembly>
+ <AssemblyOriginatorKeyFile>..\InterimKey.snk</AssemblyOriginatorKeyFile>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeContractsEnableRuntimeChecking>False</CodeContractsEnableRuntimeChecking>
+ <CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
+ <CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
+ <CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
+ <CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
+ <CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
+ <CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
+ <CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
+ <CodeContractsPointerObligations>False</CodeContractsPointerObligations>
+ <CodeContractsContainerAnalysis>False</CodeContractsContainerAnalysis>
+ <CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
+ <CodeContractsRunInBackground>True</CodeContractsRunInBackground>
+ <CodeContractsShowSquigglies>False</CodeContractsShowSquigglies>
+ <CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
+ <CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
+ <CodeContractsCustomRewriterAssembly>
+ </CodeContractsCustomRewriterAssembly>
+ <CodeContractsCustomRewriterClass>
+ </CodeContractsCustomRewriterClass>
+ <CodeContractsLibPaths>
+ </CodeContractsLibPaths>
+ <CodeContractsExtraRewriteOptions>
+ </CodeContractsExtraRewriteOptions>
+ <CodeContractsExtraAnalysisOptions>
+ </CodeContractsExtraAnalysisOptions>
+ <CodeContractsBaseLineFile>
+ </CodeContractsBaseLineFile>
+ <CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
+ <CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'z3apidebug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\z3apidebug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <CodeAnalysisRuleAssemblies>
+ </CodeAnalysisRuleAssemblies>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>Migrated rules for VCGeneration.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Checked|AnyCPU'">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Checked\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <CodeAnalysisLogFile>bin\Debug\VCGeneration.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+ <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+ <CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
+ <CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
+ <CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
+ <CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
+ <CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
+ <CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
+ <CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
+ <CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
+ <CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
+ <CodeContractsEnumObligations>False</CodeContractsEnumObligations>
+ <CodeContractsPointerObligations>False</CodeContractsPointerObligations>
+ <CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
+ <CodeContractsRunInBackground>True</CodeContractsRunInBackground>
+ <CodeContractsShowSquigglies>False</CodeContractsShowSquigglies>
+ <CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
+ <CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
+ <CodeContractsCustomRewriterAssembly />
+ <CodeContractsCustomRewriterClass />
+ <CodeContractsLibPaths />
+ <CodeContractsExtraRewriteOptions />
+ <CodeContractsExtraAnalysisOptions />
+ <CodeContractsBaseLineFile />
+ <CodeContractsCacheAnalysisResults>False</CodeContractsCacheAnalysisResults>
+ <CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
+ <CodeContractsReferenceAssembly>Build</CodeContractsReferenceAssembly>
+ <CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="BlockPredicator.cs" />
+ <Compile Include="Check.cs" />
+ <Compile Include="ConditionGeneration.cs" />
+ <Compile Include="Context.cs" />
+ <Compile Include="DoomCheck.cs" />
+ <Compile Include="DoomedLoopUnrolling.cs" />
+ <Compile Include="DoomedStrategy.cs" />
+ <Compile Include="DoomErrorHandler.cs" />
+ <Compile Include="GraphAlgorithms.cs" />
+ <Compile Include="HasseDiagram.cs" />
+ <Compile Include="OrderingAxioms.cs" />
+ <Compile Include="SmartBlockPredicator.cs" />
+ <Compile Include="StratifiedVC.cs" />
+ <Compile Include="UniformityAnalyser.cs" />
+ <Compile Include="VC.cs" />
+ <Compile Include="VCDoomed.cs" />
+ <Compile Include="..\version.cs" />
+ <Compile Include="Wlp.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Basetypes\Basetypes.csproj">
+ <Project>{43DFAD18-3E35-4558-9BE2-CAFF6B5BA8A0}</Project>
+ <Name>Basetypes</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\CodeContractsExtender\CodeContractsExtender.csproj">
+ <Project>{ACCC0156-0921-43ED-8F67-AD8BDC8CDE31}</Project>
+ <Name>CodeContractsExtender</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Core\Core.csproj">
+ <Project>{B230A69C-C466-4065-B9C1-84D80E76D802}</Project>
+ <Name>Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Graph\Graph.csproj">
+ <Project>{69A2B0B8-BCAC-4101-AE7A-556FCC58C06E}</Project>
+ <Name>Graph</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Model\Model.csproj">
+ <Project>{ACEF88D5-DADD-46DA-BAE1-2144D63F4C83}</Project>
+ <Name>Model</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\ParserHelper\ParserHelper.csproj">
+ <Project>{FCD3AC7F-9DFD-46C8-AB1E-09F0B0F16DC5}</Project>
+ <Name>ParserHelper</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\VCExpr\VCExpr.csproj">
+ <Project>{56FFDBCA-7D14-43B8-A6CA-22A20E417EE1}</Project>
+ <Name>VCExpr</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Properties\" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
- -->
+ -->
</Project> \ No newline at end of file
diff --git a/Test/aitest0/Answer b/Test/aitest0/Answer
index 73a9509c..fe848aab 100644
--- a/Test/aitest0/Answer
+++ b/Test/aitest0/Answer
@@ -23,29 +23,29 @@ implementation Join(b: bool)
x := 3;
y := 4;
z := x + y;
- assume {:inferred} x == 3 && y == 4 && z == 7;
- goto Then, Else;
+ assume {:inferred} GlobalFlag && x == 3 && y == 4 && z == 7;
+ goto Then, Else;
Then:
- assume {:inferred} x == 3 && y == 4 && z == 7;
+ assume {:inferred} GlobalFlag && x == 3 && y == 4 && z == 7;
assume b <==> true;
x := x + 1;
- assume {:inferred} x == 4 && y == 4 && z == 7;
+ assume {:inferred} GlobalFlag && x == 4 && y == 4 && z == 7 && b;
goto join;
Else:
- assume {:inferred} x == 3 && y == 4 && z == 7;
+ assume {:inferred} GlobalFlag && x == 3 && y == 4 && z == 7;
assume b <==> false;
y := 4;
- assume {:inferred} x == 3 && y == 4 && z == 7;
+ assume {:inferred} GlobalFlag && x == 3 && y == 4 && z == 7 && !b;
goto join;
join:
- assume {:inferred} y == 4 && z == 7;
+ assume {:inferred} GlobalFlag && 3 <= x && x < 5 && y == 4 && z == 7;
assert y == 4;
assert z == 7;
assert GlobalFlag <==> true;
- assume {:inferred} y == 4 && z == 7;
+ assume {:inferred} GlobalFlag && 3 <= x && x < 5 && y == 4 && z == 7;
return;
}
@@ -68,20 +68,20 @@ implementation Loop()
goto test;
test: // cut point
- assume {:inferred} c == 0;
- assume {:inferred} c == 0;
+ assume {:inferred} c == 0 && 0 <= i && i < 11;
+ assume {:inferred} c == 0 && 0 <= i && i < 11;
goto Then, Else;
Then:
- assume {:inferred} c == 0;
+ assume {:inferred} c == 0 && 0 <= i && i < 11;
assume i < 10;
i := i + 1;
- assume {:inferred} c == 0;
+ assume {:inferred} c == 0 && 1 <= i && i < 11;
goto test;
Else:
- assume {:inferred} c == 0;
- assume {:inferred} c == 0;
+ assume {:inferred} c == 0 && 0 <= i && i < 11;
+ assume {:inferred} c == 0 && 0 <= i && i < 11;
return;
}
diff --git a/Test/aitest0/runtest.bat b/Test/aitest0/runtest.bat
index 1cb7a60c..b6ab77f0 100644
--- a/Test/aitest0/runtest.bat
+++ b/Test/aitest0/runtest.bat
@@ -3,5 +3,5 @@ setlocal
set BGEXE=..\..\Binaries\Boogie.exe
-%BGEXE% %* -infer:c -instrumentInfer:e -printInstrumented -noVerify constants.bpl
+%BGEXE% %* -infer:j -instrumentInfer:e -printInstrumented -noVerify constants.bpl
%BGEXE% %* -infer:j Intervals.bpl
diff --git a/Test/aitest1/Answer b/Test/aitest1/Answer
index 718e7171..bfe185e7 100644
--- a/Test/aitest1/Answer
+++ b/Test/aitest1/Answer
@@ -14,21 +14,21 @@ implementation SimpleLoop()
goto test;
test: // cut point
- assume {:inferred} 0 <= i;
- assume {:inferred} 0 <= i;
+ assume {:inferred} 0 <= i && i < 11;
+ assume {:inferred} 0 <= i && i < 11;
goto Then, Else;
Then:
- assume {:inferred} 0 <= i;
+ assume {:inferred} 0 <= i && i < 11;
assume i < 10;
i := i + 1;
- assume {:inferred} i <= 10 && 1 <= i;
+ assume {:inferred} 1 <= i && i < 11;
goto test;
Else:
- assume {:inferred} 0 <= i;
+ assume {:inferred} 0 <= i && i < 11;
assume !(i < 10);
- assume {:inferred} 10 <= i;
+ assume {:inferred} 0 <= i && i < 11;
return;
}
@@ -57,13 +57,13 @@ implementation VariableBoundLoop(n: int)
assume {:inferred} 0 <= i;
assume i < n;
i := i + 1;
- assume {:inferred} i <= n && 1 <= i;
+ assume {:inferred} 1 <= i && 1 <= n;
goto test;
Else:
assume {:inferred} 0 <= i;
assume !(i < n);
- assume {:inferred} n <= i && 0 <= i;
+ assume {:inferred} 0 <= i;
return;
}
@@ -104,7 +104,7 @@ implementation FooToo()
i := 3 * (i + 1);
i := 1 + 3 * i;
i := (i + 1) * 3;
- assume {:inferred} 1 / 3 * i == 155;
+ assume {:inferred} i == 465;
return;
}
@@ -125,7 +125,7 @@ implementation FooTooStepByStep()
i := 3 * (i + 1);
i := 1 + 3 * i;
i := (i + 1) * 3;
- assume {:inferred} 1 / 3 * i == 155;
+ assume {:inferred} i == 465;
return;
}
@@ -212,7 +212,7 @@ implementation p()
start:
assume {:inferred} true;
assume x < y;
- assume {:inferred} x + 1 <= y;
+ assume {:inferred} true;
return;
}
@@ -235,18 +235,18 @@ implementation p()
A:
assume {:inferred} true;
assume x < y;
- assume {:inferred} x + 1 <= y;
+ assume {:inferred} true;
goto B, C;
B:
- assume {:inferred} x + 1 <= y;
+ assume {:inferred} true;
x := x * x;
assume {:inferred} true;
return;
C:
- assume {:inferred} x + 1 <= y;
- assume {:inferred} x + 1 <= y;
+ assume {:inferred} true;
+ assume {:inferred} true;
return;
}
@@ -268,26 +268,26 @@ implementation p()
A:
assume {:inferred} true;
- assume 0 - 1 <= x;
+ assume -1 <= x;
assume {:inferred} -1 <= x;
goto B, E;
B:
assume {:inferred} -1 <= x;
assume x < y;
- assume {:inferred} x + 1 <= y && -1 <= x;
+ assume {:inferred} -1 <= x && 0 <= y;
goto C, E;
C:
- assume {:inferred} x + 1 <= y && -1 <= x;
+ assume {:inferred} -1 <= x && 0 <= y;
x := x * x;
- assume {:inferred} 0 <= y;
+ assume {:inferred} x < 2 && 0 <= y;
goto D, E;
D:
- assume {:inferred} 0 <= y;
+ assume {:inferred} x < 2 && 0 <= y;
x := y;
- assume {:inferred} x == y && 0 <= y;
+ assume {:inferred} 0 <= x && 0 <= y;
return;
E:
@@ -333,8 +333,8 @@ implementation p()
goto D;
D:
- assume {:inferred} 9 <= x && x <= 10;
- assume {:inferred} 9 <= x && x <= 10;
+ assume {:inferred} 9 <= x && x < 11;
+ assume {:inferred} 9 <= x && x < 11;
return;
}
@@ -363,13 +363,13 @@ implementation p()
B:
assume {:inferred} true;
assume x <= 0;
- assume {:inferred} x <= 0;
+ assume {:inferred} x < 1;
goto D;
C:
assume {:inferred} true;
assume y <= 0;
- assume {:inferred} y <= 0;
+ assume {:inferred} y < 1;
goto D;
D:
@@ -402,7 +402,7 @@ implementation foo()
i := i + 1;
i := i + 1;
j := j + 1;
- assume {:inferred} i == j + 4 && j == 1 && n == 0;
+ assume {:inferred} i == 5 && j == 1 && n == 0;
return;
}
@@ -425,20 +425,20 @@ implementation foo()
assume n >= 4;
i := 0;
j := i + 1;
- assume {:inferred} j == i + 1 && i == 0 && 4 <= n;
+ assume {:inferred} i == 0 && j == 1 && 4 <= n;
goto exit, loop0;
loop0: // cut point
- assume {:inferred} 4 <= n && 0 <= i && j == i + 1;
+ assume {:inferred} 0 <= i && 1 <= j && 4 <= n;
assume j <= n;
i := i + 1;
j := j + 1;
- assume {:inferred} j <= n + 1 && j == i + 1 && 1 <= i && 4 <= n;
+ assume {:inferred} 1 <= i && 2 <= j && 4 <= n;
goto loop0, exit;
exit:
- assume {:inferred} j <= n + 1 && 4 <= n && 0 <= i && j == i + 1;
- assume {:inferred} j <= n + 1 && 4 <= n && 0 <= i && j == i + 1;
+ assume {:inferred} 0 <= i && 1 <= j && 4 <= n;
+ assume {:inferred} 0 <= i && 1 <= j && 4 <= n;
return;
}
@@ -446,5 +446,10 @@ implementation foo()
Boogie program verifier finished with 0 verified, 0 errors
-------------------- Bound.bpl --------------------
+Bound.bpl(24,3): Error BP5001: This assertion might not hold.
+Execution trace:
+ Bound.bpl(8,1): start
+ Bound.bpl(14,1): LoopHead
+ Bound.bpl(22,1): AfterLoop
-Boogie program verifier finished with 1 verified, 0 errors
+Boogie program verifier finished with 0 verified, 1 error
diff --git a/Test/aitest1/runtest.bat b/Test/aitest1/runtest.bat
index 3b2c382c..6e8a7bb1 100644
--- a/Test/aitest1/runtest.bat
+++ b/Test/aitest1/runtest.bat
@@ -7,11 +7,11 @@ for %%f in (ineq.bpl Linear0.bpl Linear1.bpl Linear2.bpl
Linear3.bpl Linear4.bpl Linear5.bpl Linear6.bpl
Linear7.bpl Linear8.bpl Linear9.bpl) do (
echo -------------------- %%f --------------------
- %BGEXE% %* -infer:p -instrumentInfer:e -printInstrumented -noVerify %%f
+ %BGEXE% %* -infer:j -instrumentInfer:e -printInstrumented -noVerify %%f
)
for %%f in (Bound.bpl) do (
echo -------------------- %%f --------------------
- %BGEXE% %* -infer:p %%f
+ %BGEXE% %* -infer:j %%f
)
diff --git a/Test/aitest9/runtest.bat b/Test/aitest9/runtest.bat
index bafa6961..e66f7e2b 100644
--- a/Test/aitest9/runtest.bat
+++ b/Test/aitest9/runtest.bat
@@ -7,5 +7,5 @@ set BPLEXE=%BOOGIEDIR%\Boogie.exe
for %%f in (VarMapFixPoint.bpl TestIntervals.bpl) do (
echo.
echo -------------------- %%f --------------------
- %BPLEXE% %* %%f /infer:i
+ %BPLEXE% %* %%f /infer:j
)
diff --git a/Test/dafny0/Answer b/Test/dafny0/Answer
index b7d48d7e..2cd923f9 100644
--- a/Test/dafny0/Answer
+++ b/Test/dafny0/Answer
@@ -332,10 +332,10 @@ Execution trace:
Definedness.dfy(86,5): Error: possible violation of function precondition
Execution trace:
(0,0): anon0
-Definedness.dfy(86,10): Error: assignment may update an object not in the enclosing context's modifies clause
+Definedness.dfy(86,10): Error: target object may be null
Execution trace:
(0,0): anon0
-Definedness.dfy(86,10): Error: target object may be null
+Definedness.dfy(86,10): Error: assignment may update an object not in the enclosing context's modifies clause
Execution trace:
(0,0): anon0
Definedness.dfy(87,10): Error: possible violation of function precondition
@@ -857,19 +857,19 @@ Execution trace:
Dafny program verifier finished with 32 verified, 11 errors
-------------------- ControlStructures.dfy --------------------
-ControlStructures.dfy(5,3): Error: missing case in case statement: Blue
+ControlStructures.dfy(5,3): Error: missing case in case statement: Purple
Execution trace:
(0,0): anon0
(0,0): anon6_Else
(0,0): anon7_Else
- (0,0): anon8_Else
- (0,0): anon9_Then
-ControlStructures.dfy(5,3): Error: missing case in case statement: Purple
+ (0,0): anon8_Then
+ControlStructures.dfy(5,3): Error: missing case in case statement: Blue
Execution trace:
(0,0): anon0
(0,0): anon6_Else
(0,0): anon7_Else
- (0,0): anon8_Then
+ (0,0): anon8_Else
+ (0,0): anon9_Then
ControlStructures.dfy(14,3): Error: missing case in case statement: Purple
Execution trace:
(0,0): anon0
@@ -1305,7 +1305,7 @@ CoPredicates.dfy(30,22): Related location: Related location
Execution trace:
(0,0): anon0
-Dafny program verifier finished with 14 verified, 1 error
+Dafny program verifier finished with 12 verified, 1 error
-------------------- TypeAntecedents.dfy --------------------
TypeAntecedents.dfy(32,13): Error: assertion violation
diff --git a/Test/dafny0/CoPredicates.dfy b/Test/dafny0/CoPredicates.dfy
index 67dff91b..c5651c90 100644
--- a/Test/dafny0/CoPredicates.dfy
+++ b/Test/dafny0/CoPredicates.dfy
@@ -51,8 +51,9 @@ function U2(n: int): Stream<int>
UpwardBy2(n)
}
-ghost method Lemma2(n: int)
- ensures Even(UpwardBy2(2*n)); // this is true, but Dafny can't prove it
-{
- assert Even(U2(2*n)); // ... thanks to this lemma
-}
+// Postponed:
+//ghost method Lemma2(n: int)
+// ensures Even(UpwardBy2(2*n)); // this is true, and Dafny can prove it
+//{
+// assert Even(U2(2*n)); // ... thanks to this lemma
+//}
diff --git a/Test/dafny2/COST-verif-comp-2011-4-FloydCycleDetect.dfy b/Test/dafny2/COST-verif-comp-2011-4-FloydCycleDetect.dfy
index 774008b8..3f68ee5d 100644
--- a/Test/dafny2/COST-verif-comp-2011-4-FloydCycleDetect.dfy
+++ b/Test/dafny2/COST-verif-comp-2011-4-FloydCycleDetect.dfy
@@ -205,6 +205,7 @@ class Node {
invariant forall k,l :: 0 <= k < l < steps ==> Nexxxt(k, S) != Nexxxt(l, S);
decreases S - Visited;
{
+assume 2<2; // TEMPORARY HACK
p, steps, Visited := p.next, steps + 1, Visited + {p};
}
if (p == null) {
@@ -218,6 +219,7 @@ class Node {
invariant forall k :: 0 <= k < A ==> Nexxxt(k, S) != p;
decreases steps - A;
{
+assume 2<2; // TEMPORARY HACK
A := A + 1;
}
B := steps - A;
@@ -226,6 +228,13 @@ class Node {
}
}
+/** TEMPORARY
+ ghost method AnalyzeList_Aux(S: set<Node>, steps: int, p: Node) returns (A: int)
+ ensures 0 <= A < steps;
+ ensures forall k :: 0 <= k < A ==> Nexxxt(k, S) != p;
+ ensures Nexxxt(A, S) == p;
+**/
+
ghost method CrucialLemma(a: int, b: int, S: set<Node>)
requires IsClosed(S);
requires 0 <= a && 1 <= b;
diff --git a/Test/inline/Answer b/Test/inline/Answer
index 655143fa..eddeb64f 100644
--- a/Test/inline/Answer
+++ b/Test/inline/Answer
@@ -566,7 +566,7 @@ implementation {:inline 1} find(A: [int]int, size: int, x: int) returns (ret: in
var b: bool;
anon0:
- ret := 0 - 1;
+ ret := -1;
b := false;
found := b;
i := 0;
@@ -659,7 +659,7 @@ implementation main(x: int)
goto inline$find$0$anon0;
inline$find$0$anon0:
- inline$find$0$ret := 0 - 1;
+ inline$find$0$ret := -1;
inline$find$0$b := false;
inline$find$0$found := inline$find$0$b;
inline$find$0$i := 0;
@@ -756,7 +756,7 @@ implementation {:inline 1} find(A: [int]int, size: int, x: int) returns (ret: in
var inline$check$0$ret: bool;
anon0:
- ret := 0 - 1;
+ ret := -1;
b := false;
found := b;
i := 0;
diff --git a/Test/livevars/bla1.bpl b/Test/livevars/bla1.bpl
index 2854e5df..12ccc44a 100644
--- a/Test/livevars/bla1.bpl
+++ b/Test/livevars/bla1.bpl
@@ -471,7 +471,7 @@ function {:inline true} INT_NEQ(x:int, y:int) returns (bool) {x != y}
function {:inline true} INT_ADD(x:int, y:int) returns (int) {x + y}
function {:inline true} INT_SUB(x:int, y:int) returns (int) {x - y}
function {:inline true} INT_MULT(x:int, y:int) returns (int) {x * y}
-function {:inline true} INT_DIV(x:int, y:int) returns (int) {x / y}
+function {:inline true} INT_DIV(x:int, y:int) returns (int) {x div y}
function {:inline true} INT_LT(x:int, y:int) returns (bool) {x < y}
function {:inline true} INT_ULT(x:int, y:int) returns (bool) {x < y}
function {:inline true} INT_LEQ(x:int, y:int) returns (bool) {x <= y}
diff --git a/Test/livevars/daytona_bug2_ioctl_example_1.bpl b/Test/livevars/daytona_bug2_ioctl_example_1.bpl
index 1decba12..ae8ff08c 100644
--- a/Test/livevars/daytona_bug2_ioctl_example_1.bpl
+++ b/Test/livevars/daytona_bug2_ioctl_example_1.bpl
@@ -510,7 +510,7 @@ function {:inline true} INT_NEQ(x:int, y:int) returns (bool) {x != y}
function {:inline true} INT_ADD(x:int, y:int) returns (int) {x + y}
function {:inline true} INT_SUB(x:int, y:int) returns (int) {x - y}
function {:inline true} INT_MULT(x:int, y:int) returns (int) {x * y}
-function {:inline true} INT_DIV(x:int, y:int) returns (int) {x / y}
+function {:inline true} INT_DIV(x:int, y:int) returns (int) {x div y}
function {:inline true} INT_LT(x:int, y:int) returns (bool) {x < y}
function {:inline true} INT_ULT(x:int, y:int) returns (bool) {x < y}
function {:inline true} INT_LEQ(x:int, y:int) returns (bool) {x <= y}
diff --git a/Test/livevars/daytona_bug2_ioctl_example_2.bpl b/Test/livevars/daytona_bug2_ioctl_example_2.bpl
index 0b49364b..44e51827 100644
--- a/Test/livevars/daytona_bug2_ioctl_example_2.bpl
+++ b/Test/livevars/daytona_bug2_ioctl_example_2.bpl
@@ -521,7 +521,7 @@ function {:inline true} INT_NEQ(x:int, y:int) returns (bool) {x != y}
function {:inline true} INT_ADD(x:int, y:int) returns (int) {x + y}
function {:inline true} INT_SUB(x:int, y:int) returns (int) {x - y}
function {:inline true} INT_MULT(x:int, y:int) returns (int) {x * y}
-function {:inline true} INT_DIV(x:int, y:int) returns (int) {x / y}
+function {:inline true} INT_DIV(x:int, y:int) returns (int) {x div y}
function {:inline true} INT_LT(x:int, y:int) returns (bool) {x < y}
function {:inline true} INT_ULT(x:int, y:int) returns (bool) {x < y}
function {:inline true} INT_LEQ(x:int, y:int) returns (bool) {x <= y}
diff --git a/Test/livevars/stack_overflow.bpl b/Test/livevars/stack_overflow.bpl
index 242acd65..fae3e863 100644
--- a/Test/livevars/stack_overflow.bpl
+++ b/Test/livevars/stack_overflow.bpl
@@ -831,7 +831,7 @@ function {:inline true} INT_NEQ(x:int, y:int) returns (bool) {x != y}
function {:inline true} INT_ADD(x:int, y:int) returns (int) {x + y}
function {:inline true} INT_SUB(x:int, y:int) returns (int) {x - y}
function {:inline true} INT_MULT(x:int, y:int) returns (int) {x * y}
-function {:inline true} INT_DIV(x:int, y:int) returns (int) {x / y}
+function {:inline true} INT_DIV(x:int, y:int) returns (int) {x div y}
function {:inline true} INT_LT(x:int, y:int) returns (bool) {x < y}
function {:inline true} INT_ULT(x:int, y:int) returns (bool) {x < y}
function {:inline true} INT_LEQ(x:int, y:int) returns (bool) {x <= y}
diff --git a/Test/prover/Answer b/Test/prover/Answer
index 1ca6407c..688e6e6a 100644
--- a/Test/prover/Answer
+++ b/Test/prover/Answer
@@ -4,7 +4,7 @@
z3mutl.bpl(20,5): Error BP5001: This assertion might not hold.
Execution trace:
z3mutl.bpl(5,1): start
- z3mutl.bpl(14,1): L3
+ z3mutl.bpl(8,1): L1
z3mutl.bpl(20,1): L5
z3mutl.bpl(20,5): Error BP5001: This assertion might not hold.
Execution trace:
@@ -14,7 +14,7 @@ Execution trace:
z3mutl.bpl(20,5): Error BP5001: This assertion might not hold.
Execution trace:
z3mutl.bpl(5,1): start
- z3mutl.bpl(8,1): L1
+ z3mutl.bpl(14,1): L3
z3mutl.bpl(20,1): L5
Boogie program verifier finished with 0 verified, 3 errors
@@ -24,19 +24,19 @@ EQ_v2.Eval__v4.Eval_out.bpl(2101,5): Error BP5003: A postcondition might not hol
EQ_v2.Eval__v4.Eval_out.bpl(1715,3): Related location: This is the postcondition that might not hold.
Execution trace:
EQ_v2.Eval__v4.Eval_out.bpl(1786,3): AA_INSTR_EQ_BODY
- EQ_v2.Eval__v4.Eval_out.bpl(1862,3): inline$v2.Eval$0$label_11_case_2#2
+ EQ_v2.Eval__v4.Eval_out.bpl(1875,3): inline$v2.Eval$0$label_11_case_1#2
EQ_v2.Eval__v4.Eval_out.bpl(1894,3): inline$v2.Eval$0$label_12#2
- EQ_v2.Eval__v4.Eval_out.bpl(1989,3): inline$v4.Eval$0$label_11_case_2#2
- EQ_v2.Eval__v4.Eval_out.bpl(2011,3): inline$v4.Eval$0$label_14_true#2
+ EQ_v2.Eval__v4.Eval_out.bpl(2032,3): inline$v4.Eval$0$label_11_case_1#2
+ EQ_v2.Eval__v4.Eval_out.bpl(2054,3): inline$v4.Eval$0$label_13_true#2
EQ_v2.Eval__v4.Eval_out.bpl(2081,3): inline$v4.Eval$0$label_12#2
EQ_v2.Eval__v4.Eval_out.bpl(2101,5): Error BP5003: A postcondition might not hold on this return path.
EQ_v2.Eval__v4.Eval_out.bpl(1715,3): Related location: This is the postcondition that might not hold.
Execution trace:
EQ_v2.Eval__v4.Eval_out.bpl(1786,3): AA_INSTR_EQ_BODY
- EQ_v2.Eval__v4.Eval_out.bpl(1875,3): inline$v2.Eval$0$label_11_case_1#2
+ EQ_v2.Eval__v4.Eval_out.bpl(1862,3): inline$v2.Eval$0$label_11_case_2#2
EQ_v2.Eval__v4.Eval_out.bpl(1894,3): inline$v2.Eval$0$label_12#2
- EQ_v2.Eval__v4.Eval_out.bpl(2032,3): inline$v4.Eval$0$label_11_case_1#2
- EQ_v2.Eval__v4.Eval_out.bpl(2054,3): inline$v4.Eval$0$label_13_true#2
+ EQ_v2.Eval__v4.Eval_out.bpl(1989,3): inline$v4.Eval$0$label_11_case_2#2
+ EQ_v2.Eval__v4.Eval_out.bpl(2011,3): inline$v4.Eval$0$label_14_true#2
EQ_v2.Eval__v4.Eval_out.bpl(2081,3): inline$v4.Eval$0$label_12#2
EQ_v2.Eval__v4.Eval_out.bpl(2152,5): Error BP5003: A postcondition might not hold on this return path.
EQ_v2.Eval__v4.Eval_out.bpl(2120,3): Related location: This is the postcondition that might not hold.
diff --git a/Test/prover/EQ_v2.Eval__v4.Eval_out.bpl b/Test/prover/EQ_v2.Eval__v4.Eval_out.bpl
index e4da94f4..e53e00b4 100644
--- a/Test/prover/EQ_v2.Eval__v4.Eval_out.bpl
+++ b/Test/prover/EQ_v2.Eval__v4.Eval_out.bpl
@@ -382,7 +382,7 @@ axiom (forall x: int, y: int :: { v4.INT_SUB(x, y): int } v4.INT_SUB(x, y): int
axiom (forall x: int, y: int :: { v4.INT_MULT(x, y): int } v4.INT_MULT(x, y): int == x * y);
-axiom (forall x: int, y: int :: { v4.INT_DIV(x, y): int } v4.INT_DIV(x, y): int == x / y);
+axiom (forall x: int, y: int :: { v4.INT_DIV(x, y): int } v4.INT_DIV(x, y): int == x div y);
axiom (forall x: int, y: int :: { v4.INT_LT(x, y): bool } v4.INT_LT(x, y): bool <==> x < y);
@@ -1173,7 +1173,7 @@ axiom (forall x: int, y: int :: { v4.INT_SUB(x, y): int } v4.INT_SUB(x, y): int
axiom (forall x: int, y: int :: { v4.INT_MULT(x, y): int } v4.INT_MULT(x, y): int == x * y);
-axiom (forall x: int, y: int :: { v4.INT_DIV(x, y): int } v4.INT_DIV(x, y): int == x / y);
+axiom (forall x: int, y: int :: { v4.INT_DIV(x, y): int } v4.INT_DIV(x, y): int == x div y);
axiom (forall x: int, y: int :: { v4.INT_LT(x, y): bool } v4.INT_LT(x, y): bool <==> x < y);
diff --git a/Test/test0/Answer b/Test/test0/Answer
index 51a139b7..0eda9e2e 100644
--- a/Test/test0/Answer
+++ b/Test/test0/Answer
@@ -34,6 +34,12 @@ const y: int;
const z: int;
+const r: real;
+
+const s: real;
+
+const t: real;
+
const P: bool;
const Q: bool;
@@ -48,10 +54,44 @@ axiom x * y * z == x * y * z;
axiom x * y * z * x == x * y * z;
+axiom x div y div z == x div (y div z);
+
+axiom x div y div (z div x) == x div y div z;
+
+axiom x + y mod z == y mod z + x;
+
+axiom (x + y) mod z == x mod z + y mod z;
+
axiom x / y / z == x / (y / z);
axiom x / y / (z / x) == x / y / z;
+axiom x / s / z == x / (s / z);
+
+axiom x / s / (z / x) == x / s / z;
+
+axiom r / s / t == r / (s / t);
+
+axiom r / s / (t / r) == r / s / t;
+
+axiom r * s / t == r * s / t;
+
+axiom r / s * t == r / s * t;
+
+axiom (r * s) ** t == r ** t * s ** t;
+
+axiom r ** (s + t) == r ** s * r ** t;
+
+axiom int(real(x)) == x;
+
+axiom r >= 0e0 ==> real(int(r)) <= r;
+
+axiom int(0e0 - 2e-2) == 0;
+
+axiom int(0e0 - 35e0) == -35;
+
+axiom int(27e-1) == 2;
+
axiom x - y - z == x - (y - z);
axiom x - y - (z - x) == x - y - z;
diff --git a/Test/test0/BadLabels1.bpl b/Test/test0/BadLabels1.bpl
index 28fb47b8..c040ce26 100644
--- a/Test/test0/BadLabels1.bpl
+++ b/Test/test0/BadLabels1.bpl
@@ -28,7 +28,7 @@ procedure P1(y: int)
{
K:
goto A;
- if (y % 2 == 0) {
+ if (y mod 2 == 0) {
goto L;
M:
}
diff --git a/Test/test0/ModifiedBag.bpl b/Test/test0/ModifiedBag.bpl
index cb69aa5f..5fffc20a 100644
--- a/Test/test0/ModifiedBag.bpl
+++ b/Test/test0/ModifiedBag.bpl
@@ -1,5 +1,5 @@
// ----------- BEGIN PRELUDE
-type real;
+
type elements;
diff --git a/Test/test0/PrettyPrint.bpl b/Test/test0/PrettyPrint.bpl
index a1f941d8..7e4a9ce7 100644
--- a/Test/test0/PrettyPrint.bpl
+++ b/Test/test0/PrettyPrint.bpl
@@ -1,6 +1,9 @@
const x: int;
const y: int;
const z: int;
+const r: real;
+const s: real;
+const t: real;
const P: bool;
const Q: bool;
const R: bool;
@@ -11,8 +14,30 @@ axiom (x * y) + z == (x + y) * z;
axiom x * y * z == (x * (y * z));
axiom (x * y) * (z * x) == (x * y) * z;
+axiom x div y div z == (x div (y div z));
+axiom (x div y) div (z div x) == (x div y) div z;
+
+axiom x + y mod z == ((y mod z) + x);
+axiom (x + y) mod z == (x mod z) + (y mod z);
+
axiom x / y / z == (x / (y / z));
axiom (x / y) / (z / x) == (x / y) / z;
+axiom x / s / z == (x / (s / z));
+axiom (x / s) / (z / x) == (x / s) / z;
+axiom r / s / t == (r / (s / t));
+axiom (r / s) / (t / r) == (r / s) / t;
+
+axiom ((r * s) / t) == r * s / t;
+axiom ((r / s) * t) == (r / s) * t;
+
+axiom (r * s) ** t == (r ** t) * (s ** t);
+axiom r ** (s + t) == r ** s * r ** t;
+
+axiom int(real(x)) == x;
+axiom r >= 0.0 ==> real(int(r)) <= r;
+axiom int(0e-3 - 0.02) == 0;
+axiom int(0e2 - 3.5e1) == -35;
+axiom int(27e-1) == 2;
axiom x - y - z == (x - (y - z));
axiom (x - y) - (z - x) == (x - y) - z;
diff --git a/Test/test0/Prog0.bpl b/Test/test0/Prog0.bpl
index ac87476f..79a4d2ab 100644
--- a/Test/test0/Prog0.bpl
+++ b/Test/test0/Prog0.bpl
@@ -1,5 +1,5 @@
// BoogiePL Examples
-type real;
+
type elements;
var x:int; var y:real; var z:ref; // Variables
diff --git a/Test/test1/Answer b/Test/test1/Answer
index a8b73b53..94bf2d9a 100644
--- a/Test/test1/Answer
+++ b/Test/test1/Answer
@@ -145,3 +145,22 @@ Lambda.bpl(12,8): Error: the type variable T does not occur in types of the lamb
Lambda.bpl(12,2): Error: mismatched types in assignment command (cannot assign <T>[int]int to [int]int)
Lambda.bpl(18,27): Error: invalid argument types (bool and int) to binary operator +
5 type checking errors detected in Lambda.bpl
+IntReal.bpl(5,8): Error: invalid argument types (int and real) to binary operator >=
+IntReal.bpl(6,8): Error: invalid argument types (int and real) to binary operator <=
+IntReal.bpl(7,8): Error: invalid argument types (int and real) to binary operator <
+IntReal.bpl(8,8): Error: invalid argument types (int and real) to binary operator >
+IntReal.bpl(10,9): Error: invalid argument types (int and real) to binary operator ==
+IntReal.bpl(11,8): Error: invalid argument types (int and real) to binary operator +
+IntReal.bpl(12,8): Error: invalid argument types (int and real) to binary operator -
+IntReal.bpl(13,8): Error: invalid argument types (int and real) to binary operator *
+IntReal.bpl(14,8): Error: invalid argument types (int and real) to binary operator div
+IntReal.bpl(15,8): Error: invalid argument types (int and real) to binary operator mod
+IntReal.bpl(17,12): Error: invalid argument types (real and int) to binary operator ==
+IntReal.bpl(23,8): Error: invalid argument types (int and real) to binary operator **
+IntReal.bpl(27,14): Error: invalid argument types (real and int) to binary operator ==
+IntReal.bpl(29,13): Error: invalid argument types (int and real) to binary operator ==
+IntReal.bpl(32,6): Error: argument type int does not match expected type real
+IntReal.bpl(33,6): Error: argument type real does not match expected type int
+IntReal.bpl(45,8): Error: invalid argument types (real and int) to binary operator div
+IntReal.bpl(46,8): Error: invalid argument types (real and int) to binary operator mod
+18 type checking errors detected in IntReal.bpl \ No newline at end of file
diff --git a/Test/test1/IntReal.bpl b/Test/test1/IntReal.bpl
new file mode 100644
index 00000000..976fc864
--- /dev/null
+++ b/Test/test1/IntReal.bpl
@@ -0,0 +1,48 @@
+const i: int;
+const r: real;
+
+axiom i == 0;
+axiom i >= 0.0; // type error
+axiom i <= 0.0e0; // type error
+axiom i < 0.0e-0; // type error
+axiom i > 0.0e20; // type error
+
+axiom -i == r; // type error
+axiom i + r == 0.0; // type error
+axiom i - r == 0.0; // type error
+axiom i * r == 0.0; // type error
+axiom i div r == 0; // type error
+axiom i mod r == 0; // type error
+
+axiom i / i == 0; // type error
+axiom i / i == 0.0;
+axiom i / r == 0.0;
+axiom r / i == 0.0;
+axiom r / r == 0.0;
+
+axiom i ** r == 0.0; // type error
+axiom r ** r == 0.0;
+
+axiom real(i) == 0.0;
+axiom real(i) == i; // type error
+axiom int(r) == 0;
+axiom int(r) == r; // type error
+axiom int(real(i)) == i;
+axiom real(int(r)) == r;
+axiom int(int(r)) == i; // type error
+axiom real(real(i)) == r; // type error
+
+axiom i == 0;
+axiom real(i) >= 0.0;
+axiom real(i) <= 0.0e0;
+axiom r < 0.0e-0;
+axiom r > 0.0e20;
+
+axiom -r == real(i);
+axiom real(i) + r == 0.0;
+axiom r - real(0) == 0.0;
+axiom r * r == 0.0;
+axiom r div 0 == 0; // type error
+axiom r mod 0 == 0; // type error
+
+axiom r ** r == 0.0;
diff --git a/Test/test1/runtest.bat b/Test/test1/runtest.bat
index 979c36e4..149e6dc9 100644
--- a/Test/test1/runtest.bat
+++ b/Test/test1/runtest.bat
@@ -19,3 +19,4 @@ rem set BGEXE=mono ..\..\Binaries\Boogie.exe
%BGEXE% %* /noVerify FunBody.bpl
%BGEXE% %* /noVerify IfThenElse0.bpl
%BGEXE% %* /noVerify Lambda.bpl
+%BGEXE% %* /noVerify IntReal.bpl
diff --git a/Test/test15/Answer b/Test/test15/Answer
index 3361b320..915f63e8 100644
--- a/Test/test15/Answer
+++ b/Test/test15/Answer
@@ -1,22 +1,24 @@
-------------------- NullInModel --------------------
*** MODEL
-%lbl%@46 -> false
-%lbl%+23 -> true
-%lbl%+36 -> true
-boolType -> T@T!val!1
+%lbl%@45 -> false
+%lbl%+24 -> true
+%lbl%+35 -> true
+boolType -> T@T!val!2
intType -> T@T!val!0
null -> T@U!val!0
-refType -> T@T!val!2
+realType -> T@T!val!1
+refType -> T@T!val!3
s -> T@U!val!0
type -> {
- T@U!val!0 -> T@T!val!2
- else -> T@T!val!2
+ T@U!val!0 -> T@T!val!3
+ else -> T@T!val!3
}
Ctor -> {
T@T!val!0 -> 0
T@T!val!1 -> 1
T@T!val!2 -> 2
+ T@T!val!3 -> 3
else -> 0
}
tickleBool -> {
@@ -33,15 +35,17 @@ Boogie program verifier finished with 0 verified, 1 error
-------------------- IntInModel --------------------
*** MODEL
-%lbl%@38 -> false
-%lbl%+22 -> true
-%lbl%+28 -> true
-boolType -> T@T!val!1
+%lbl%@37 -> false
+%lbl%+23 -> true
+%lbl%+27 -> true
+boolType -> T@T!val!2
i -> 0
intType -> T@T!val!0
+realType -> T@T!val!1
Ctor -> {
T@T!val!0 -> 0
T@T!val!1 -> 1
+ T@T!val!2 -> 2
else -> 0
}
tickleBool -> {
@@ -58,27 +62,29 @@ Boogie program verifier finished with 0 verified, 1 error
-------------------- ModelTest --------------------
*** MODEL
-%lbl%@181 -> false
-%lbl%+118 -> true
-%lbl%+63 -> true
-boolType -> T@T!val!1
+%lbl%@145 -> false
+%lbl%+64 -> true
+%lbl%+82 -> true
+boolType -> T@T!val!2
i@0 -> 1
intType -> T@T!val!0
j@0 -> 2
j@1 -> 3
j@2 -> 4
r -> T@U!val!1
-refType -> T@T!val!2
+realType -> T@T!val!1
+refType -> T@T!val!3
s -> T@U!val!0
type -> {
- T@U!val!0 -> T@T!val!2
- T@U!val!1 -> T@T!val!2
- else -> T@T!val!2
+ T@U!val!0 -> T@T!val!3
+ T@U!val!1 -> T@T!val!3
+ else -> T@T!val!3
}
Ctor -> {
T@T!val!0 -> 0
T@T!val!1 -> 1
T@T!val!2 -> 2
+ T@T!val!3 -> 3
else -> 0
}
tickleBool -> {
@@ -114,37 +120,38 @@ Execution trace:
CaptureState.bpl(16,5): anon4_Then
CaptureState.bpl(24,5): anon3
*** MODEL
-%lbl%@335 -> false
-%lbl%+111 -> true
-%lbl%+113 -> true
-%lbl%+117 -> true
-%lbl%+190 -> true
+%lbl%@291 -> false
+%lbl%+112 -> true
+%lbl%+114 -> true
+%lbl%+118 -> true
+%lbl%+146 -> true
@MV_state_const -> 6
-boolType -> T@T!val!1
+boolType -> T@T!val!2
F -> T@U!val!2
-FieldNameType -> T@T!val!3
+FieldNameType -> T@T!val!4
Heap -> T@U!val!0
intType -> T@T!val!0
m -> **m
-m@0 -> -2
-m@2 -> -1
-m@3 -> -1
+m@0 -> -451
+m@2 -> -450
+m@3 -> -450
r -> **r
-r@0 -> -2
-RefType -> T@T!val!2
+r@0 -> -900
+realType -> T@T!val!1
+RefType -> T@T!val!3
this -> T@U!val!1
-x@@4 -> 797
+x@@5 -> 0
y@@1 -> **y@@1
int_2_U -> {
- -2 -> -2
- else -> -2
+ -451 -> -451
+ else -> -451
}
type -> {
- T@U!val!0 -> T@T!val!4
- T@U!val!1 -> T@T!val!2
- T@U!val!2 -> T@T!val!3
- -2 -> T@T!val!0
- else -> T@T!val!4
+ T@U!val!0 -> T@T!val!5
+ T@U!val!1 -> T@T!val!3
+ T@U!val!2 -> T@T!val!4
+ -451 -> T@T!val!0
+ else -> T@T!val!5
}
@MV_state -> {
6 0 -> true
@@ -156,26 +163,27 @@ type -> {
Ctor -> {
T@T!val!0 -> 0
T@T!val!1 -> 1
- T@T!val!2 -> 3
+ T@T!val!2 -> 2
T@T!val!3 -> 4
- T@T!val!4 -> 2
+ T@T!val!4 -> 5
+ T@T!val!5 -> 3
else -> 0
}
[3] -> {
- T@U!val!0 T@U!val!1 T@U!val!2 -> -2
- else -> -2
+ T@U!val!0 T@U!val!1 T@U!val!2 -> -451
+ else -> -451
}
U_2_int -> {
- -2 -> -2
- else -> -2
+ -451 -> -451
+ else -> -451
}
MapType0TypeInv1 -> {
- T@T!val!4 -> T@T!val!3
- else -> T@T!val!3
+ T@T!val!5 -> T@T!val!4
+ else -> T@T!val!4
}
MapType0TypeInv0 -> {
- T@T!val!4 -> T@T!val!2
- else -> T@T!val!2
+ T@T!val!5 -> T@T!val!3
+ else -> T@T!val!3
}
tickleBool -> {
true -> true
@@ -183,17 +191,17 @@ tickleBool -> {
else -> true
}
MapType0Type -> {
- T@T!val!2 T@T!val!3 T@T!val!0 -> T@T!val!4
- else -> T@T!val!4
+ T@T!val!3 T@T!val!4 T@T!val!0 -> T@T!val!5
+ else -> T@T!val!5
}
MapType0TypeInv2 -> {
- T@T!val!4 -> T@T!val!0
+ T@T!val!5 -> T@T!val!0
else -> T@T!val!0
}
*** STATE <initial>
Heap -> T@U!val!0
this -> T@U!val!1
- x -> 797
+ x -> 0
y -> **y@@1
r -> **r
m -> **m
@@ -201,13 +209,13 @@ MapType0TypeInv2 -> {
*** STATE top
*** END_STATE
*** STATE then
- m -> -2
+ m -> -451
*** END_STATE
*** STATE postUpdate0
- m -> -1
+ m -> -450
*** END_STATE
*** STATE end
- r -> -2
+ r -> -900
m -> 7
*** END_STATE
*** END_MODEL
diff --git a/Test/test2/strings-no-where.bpl b/Test/test2/strings-no-where.bpl
index ff723db2..6aee18ea 100644
--- a/Test/test2/strings-no-where.bpl
+++ b/Test/test2/strings-no-where.bpl
@@ -1,4 +1,4 @@
-type real;
+
type elements;
@@ -330,23 +330,23 @@ function #shl(int, int) returns (int);
function #shr(int, int) returns (int);
-axiom (forall x: int, y: int :: { x % y } { x / y } x % y == x - x / y * y);
+axiom (forall x: int, y: int :: { x mod y } { x div y } x mod y == x - x div y * y);
-axiom (forall x: int, y: int :: { x % y } 0 <= x && 0 < y ==> 0 <= x % y && x % y < y);
+axiom (forall x: int, y: int :: { x mod y } 0 <= x && 0 < y ==> 0 <= x mod y && x mod y < y);
-axiom (forall x: int, y: int :: { x % y } 0 <= x && y < 0 ==> 0 <= x % y && x % y < 0 - y);
+axiom (forall x: int, y: int :: { x mod y } 0 <= x && y < 0 ==> 0 <= x mod y && x mod y < 0 - y);
-axiom (forall x: int, y: int :: { x % y } x <= 0 && 0 < y ==> 0 - y < x % y && x % y <= 0);
+axiom (forall x: int, y: int :: { x mod y } x <= 0 && 0 < y ==> 0 - y < x mod y && x mod y <= 0);
-axiom (forall x: int, y: int :: { x % y } x <= 0 && y < 0 ==> y < x % y && x % y <= 0);
+axiom (forall x: int, y: int :: { x mod y } x <= 0 && y < 0 ==> y < x mod y && x mod y <= 0);
-axiom (forall x: int, y: int :: { (x + y) % y } 0 <= x && 0 <= y ==> (x + y) % y == x % y);
+axiom (forall x: int, y: int :: { (x + y) mod y } 0 <= x && 0 <= y ==> (x + y) mod y == x mod y);
-axiom (forall x: int, y: int :: { (y + x) % y } 0 <= x && 0 <= y ==> (y + x) % y == x % y);
+axiom (forall x: int, y: int :: { (y + x) mod y } 0 <= x && 0 <= y ==> (y + x) mod y == x mod y);
-axiom (forall x: int, y: int :: { (x - y) % y } 0 <= x - y && 0 <= y ==> (x - y) % y == x % y);
+axiom (forall x: int, y: int :: { (x - y) mod y } 0 <= x - y && 0 <= y ==> (x - y) mod y == x mod y);
-axiom (forall a: int, b: int, d: int :: { a % d,b % d } 2 <= d && a % d == b % d && a < b ==> a + d <= b);
+axiom (forall a: int, b: int, d: int :: { a mod d,b mod d } 2 <= d && a mod d == b mod d && a < b ==> a + d <= b);
axiom (forall i: int :: { #shl(i, 0) } #shl(i, 0) == i);
@@ -354,7 +354,7 @@ axiom (forall i: int, j: int :: 0 <= j ==> #shl(i, j + 1) == #shl(i, j) * 2);
axiom (forall i: int :: { #shr(i, 0) } #shr(i, 0) == i);
-axiom (forall i: int, j: int :: 0 <= j ==> #shr(i, j + 1) == #shr(i, j) / 2);
+axiom (forall i: int, j: int :: 0 <= j ==> #shr(i, j + 1) == #shr(i, j) div 2);
const unique $UnknownRef: ref;
diff --git a/Test/test2/strings-where.bpl b/Test/test2/strings-where.bpl
index da529b84..f196899f 100644
--- a/Test/test2/strings-where.bpl
+++ b/Test/test2/strings-where.bpl
@@ -1,4 +1,4 @@
-type real;
+
type elements;
@@ -330,23 +330,23 @@ function #shl(int, int) returns (int);
function #shr(int, int) returns (int);
-axiom (forall x: int, y: int :: { x % y } { x / y } x % y == x - x / y * y);
+axiom (forall x: int, y: int :: { x mod y } { x div y } x mod y == x - x div y * y);
-axiom (forall x: int, y: int :: { x % y } 0 <= x && 0 < y ==> 0 <= x % y && x % y < y);
+axiom (forall x: int, y: int :: { x mod y } 0 <= x && 0 < y ==> 0 <= x mod y && x mod y < y);
-axiom (forall x: int, y: int :: { x % y } 0 <= x && y < 0 ==> 0 <= x % y && x % y < 0 - y);
+axiom (forall x: int, y: int :: { x mod y } 0 <= x && y < 0 ==> 0 <= x mod y && x mod y < 0 - y);
-axiom (forall x: int, y: int :: { x % y } x <= 0 && 0 < y ==> 0 - y < x % y && x % y <= 0);
+axiom (forall x: int, y: int :: { x mod y } x <= 0 && 0 < y ==> 0 - y < x mod y && x mod y <= 0);
-axiom (forall x: int, y: int :: { x % y } x <= 0 && y < 0 ==> y < x % y && x % y <= 0);
+axiom (forall x: int, y: int :: { x mod y } x <= 0 && y < 0 ==> y < x mod y && x mod y <= 0);
-axiom (forall x: int, y: int :: { (x + y) % y } 0 <= x && 0 <= y ==> (x + y) % y == x % y);
+axiom (forall x: int, y: int :: { (x + y) mod y } 0 <= x && 0 <= y ==> (x + y) mod y == x mod y);
-axiom (forall x: int, y: int :: { (y + x) % y } 0 <= x && 0 <= y ==> (y + x) % y == x % y);
+axiom (forall x: int, y: int :: { (y + x) mod y } 0 <= x && 0 <= y ==> (y + x) mod y == x mod y);
-axiom (forall x: int, y: int :: { (x - y) % y } 0 <= x - y && 0 <= y ==> (x - y) % y == x % y);
+axiom (forall x: int, y: int :: { (x - y) mod y } 0 <= x - y && 0 <= y ==> (x - y) mod y == x mod y);
-axiom (forall a: int, b: int, d: int :: { a % d,b % d } 2 <= d && a % d == b % d && a < b ==> a + d <= b);
+axiom (forall a: int, b: int, d: int :: { a mod d,b mod d } 2 <= d && a mod d == b mod d && a < b ==> a + d <= b);
axiom (forall i: int :: { #shl(i, 0) } #shl(i, 0) == i);
@@ -354,7 +354,7 @@ axiom (forall i: int, j: int :: 0 <= j ==> #shl(i, j + 1) == #shl(i, j) * 2);
axiom (forall i: int :: { #shr(i, 0) } #shr(i, 0) == i);
-axiom (forall i: int, j: int :: 0 <= j ==> #shr(i, j + 1) == #shr(i, j) / 2);
+axiom (forall i: int, j: int :: 0 <= j ==> #shr(i, j + 1) == #shr(i, j) div 2);
const unique $UnknownRef: ref;
diff --git a/Test/test20/Answer b/Test/test20/Answer
index efa5bced..fa33507e 100644
--- a/Test/test20/Answer
+++ b/Test/test20/Answer
@@ -118,7 +118,7 @@ axiom (forall x: int :: intSet0[x] == (x == 0 || x == 2 || x == 3));
const intSet1: Set int;
-axiom (forall x: int :: intSet1[x] == (x == 0 - 5 || x == 3));
+axiom (forall x: int :: intSet1[x] == (x == -5 || x == 3));
procedure P();
@@ -126,7 +126,7 @@ procedure P();
implementation P()
{
- assert (forall x: int :: union(intSet0, intSet1)[x] == (x == 0 - 5 || x == 0 || x == 2 || x == 3));
+ assert (forall x: int :: union(intSet0, intSet1)[x] == (x == -5 || x == 0 || x == 2 || x == 3));
}
@@ -143,7 +143,7 @@ axiom (forall x: int :: intSet0[x] <==> x == 0 || x == 2 || x == 3);
const intSet1: Set int;
-axiom (forall x: int :: intSet1[x] <==> x == 0 - 5 || x == 3);
+axiom (forall x: int :: intSet1[x] <==> x == -5 || x == 3);
procedure P();
@@ -151,7 +151,7 @@ procedure P();
implementation P()
{
- assert (forall x: int :: union(intSet0, intSet1)[x] <==> x == 0 - 5 || x == 0 || x == 2 || x == 3);
+ assert (forall x: int :: union(intSet0, intSet1)[x] <==> x == -5 || x == 0 || x == 2 || x == 3);
}
diff --git a/Test/test20/Prog0.bpl b/Test/test20/Prog0.bpl
index ea71b8a8..8fc7b7c7 100644
--- a/Test/test20/Prog0.bpl
+++ b/Test/test20/Prog0.bpl
@@ -1,5 +1,5 @@
// Let's test some Boogie 2 features ...
-type real;
+
type elements;
type Field a;
diff --git a/Test/test20/Prog1.bpl b/Test/test20/Prog1.bpl
index 1d75805c..0e9413c1 100644
--- a/Test/test20/Prog1.bpl
+++ b/Test/test20/Prog1.bpl
@@ -1,5 +1,5 @@
// Let's test some Boogie 2 features ...
-type real;
+
type elements;
type Field a;
diff --git a/Test/test21/Answer b/Test/test21/Answer
index 914e56a1..28aa4e8b 100644
--- a/Test/test21/Answer
+++ b/Test/test21/Answer
@@ -278,6 +278,9 @@ Execution trace:
LargeLiterals0.bpl(7,5): anon0
Boogie program verifier finished with 0 verified, 1 error
+--------------------- File Real.bpl ----------------------------
+
+Boogie program verifier finished with 1 verified, 0 errors
--------------------- File NameClash.bpl ----------------------------
Boogie program verifier finished with 1 verified, 0 errors
@@ -549,6 +552,9 @@ Execution trace:
LargeLiterals0.bpl(7,5): anon0
Boogie program verifier finished with 0 verified, 1 error
+--------------------- File Real.bpl ----------------------------
+
+Boogie program verifier finished with 1 verified, 0 errors
--------------------- File NameClash.bpl ----------------------------
Boogie program verifier finished with 1 verified, 0 errors
@@ -826,6 +832,9 @@ Execution trace:
LargeLiterals0.bpl(7,5): anon0
Boogie program verifier finished with 0 verified, 1 error
+--------------------- File Real.bpl ----------------------------
+
+Boogie program verifier finished with 1 verified, 0 errors
--------------------- File NameClash.bpl ----------------------------
Boogie program verifier finished with 1 verified, 0 errors
diff --git a/Test/test21/Real.bpl b/Test/test21/Real.bpl
new file mode 100644
index 00000000..3dcf3ea3
--- /dev/null
+++ b/Test/test21/Real.bpl
@@ -0,0 +1,17 @@
+axiom (forall r: real :: r == 0.0 || r / r == 1.0);
+
+procedure P(a: real, b: real) returns () {
+ assume a >= b && a != 0.0 && a >= 1.3579;
+
+ assert 2e0 * (a + 3.0) - 0.5 >= b;
+ assert 2e0 * (a + 3.0) - 0.5 > b;
+ assert b <= 2e0 * (a + 3.0) - 0.5;
+ assert b < 2e0 * (a + 3.0) - 0.5;
+
+ assert 1/2 <= 0.65;
+ assert a > 100e-2 ==> 1 / a <= a;
+ assert a / 2 != a || a == 0.00;
+ assert a != 0.0 ==> a / a == 1.0;
+
+ assert int(a) >= 0 ==> real(3) * a > a;
+} \ No newline at end of file
diff --git a/Test/test21/runtest.bat b/Test/test21/runtest.bat
index d994a4da..bfdcc570 100644
--- a/Test/test21/runtest.bat
+++ b/Test/test21/runtest.bat
@@ -4,6 +4,7 @@ setlocal
set BGEXE=..\..\Binaries\Boogie.exe
rem set BGEXE=mono ..\..\Binaries\Boogie.exe
+
for %%m in (
n p a
) do (
@@ -16,7 +17,8 @@ for %%f in (DisjointDomains.bpl DisjointDomains2.bpl FunAxioms.bpl
Keywords.bpl Casts.bpl BooleanQuantification.bpl EmptyList.bpl Boxing.bpl
MapOutputTypeParams.bpl ParallelAssignment.bpl BooleanQuantification2.bpl
Flattening.bpl Orderings.bpl Orderings2.bpl Orderings3.bpl Orderings4.bpl
- EmptySetBug.bpl Coercions2.bpl MapAxiomsConsistency.bpl LargeLiterals0.bpl) do (
+ EmptySetBug.bpl Coercions2.bpl MapAxiomsConsistency.bpl LargeLiterals0.bpl
+ Real.bpl) do (
echo --------------------- File %%f ----------------------------
%BGEXE% %* /typeEncoding:%%m /logPrefix:0%%m %%f
)
diff --git a/Util/Emacs/boogie-mode.el b/Util/Emacs/boogie-mode.el
index 5b60dcab..86721a74 100644
--- a/Util/Emacs/boogie-mode.el
+++ b/Util/Emacs/boogie-mode.el
@@ -36,7 +36,7 @@
)) . font-lock-builtin-face)
`(,(boogie-regexp-opt '(
"assert" "assume" "break" "call" "then" "else" "havoc" "if" "goto" "return" "while"
- "old" "forall" "exists" "lambda" "cast"
+ "old" "forall" "exists" "lambda" "cast" "div" "mod"
"false" "true")) . font-lock-keyword-face)
`(,(boogie-regexp-opt '("bool" "int"
"bv0" "bv1" "bv2" "bv3" "bv4" "bv5" "bv6" "bv7" "bv8" "bv9"
diff --git a/Util/VS2010/Boogie/BoogieLanguageService/Grammar.cs b/Util/VS2010/Boogie/BoogieLanguageService/Grammar.cs
index 02d14b93..4e38f654 100644
--- a/Util/VS2010/Boogie/BoogieLanguageService/Grammar.cs
+++ b/Util/VS2010/Boogie/BoogieLanguageService/Grammar.cs
@@ -23,13 +23,14 @@ namespace Demo
"bv30", "bv31", "bv32",
"bv64",
"call", "complete", "const",
+ "div",
"else", "ensures", "exists", "extends",
"false", "forall", "free", "function",
"goto",
"havoc",
"if", "implementation", "int", "invariant",
"lambda",
- "modifies",
+ "mod", "modifies",
"old",
"procedure",
"requires",
@@ -181,7 +182,7 @@ namespace Demo
identList.Rule = MakePlusRule(identList, comma, ident);
NewStmt.Rule = "new" + QualifiedName + GenericsPostfix.Q() + LParen + expressionList.Q() + RParen;
NewArrStmt.Rule = "new" + QualifiedName + GenericsPostfix.Q() + LBracket + expressionList.Q() + RBracket;
- BinOp.Rule = ToTerm("+") | "-" | "*" | "/" | "%" | "^" | "&" | "|"
+ BinOp.Rule = ToTerm("+") | "-" | "*" | "div" | "mod" | "^" | "&" | "|"
| "&&" | "||" | "==" | "!=" | greater | less
| ">=" | "<=" | "is"
| "=" | "+=" | "-="
@@ -376,7 +377,7 @@ namespace Demo
#region 5. Operators precedence
RegisterOperators(1, "<==>");
RegisterOperators(2, "+", "-");
- RegisterOperators(3, "*", "/", "%", "!!");
+ RegisterOperators(3, "*", "div", "mod", "!!");
RegisterOperators(4, Associativity.Right, "^");
RegisterOperators(5, "||");
RegisterOperators(6, "&&");
diff --git a/Util/VS2010/DafnyExtension/DafnyExtension.sln b/Util/VS2010/DafnyExtension/DafnyExtension.sln
index e7391254..fd450cc8 100644
--- a/Util/VS2010/DafnyExtension/DafnyExtension.sln
+++ b/Util/VS2010/DafnyExtension/DafnyExtension.sln
@@ -1,6 +1,6 @@

-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DafnyExtension", "DafnyExtension\DafnyExtension.csproj", "{6E9A5E14-0763-471C-A129-80A879D9E7BA}"
EndProject
Global
diff --git a/Util/VS2010/DafnyExtension/DafnyExtension/DafnyExtension.csproj b/Util/VS2010/DafnyExtension/DafnyExtension/DafnyExtension.csproj
index 66370dec..2580c396 100644
--- a/Util/VS2010/DafnyExtension/DafnyExtension/DafnyExtension.csproj
+++ b/Util/VS2010/DafnyExtension/DafnyExtension/DafnyExtension.csproj
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -14,6 +15,12 @@
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<GeneratePkgDefFile>false</GeneratePkgDefFile>
+ <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <OldToolsVersion>4.0</OldToolsVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -158,8 +165,13 @@
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
+ <PropertyGroup>
+ <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
+ <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+ </PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets" />
+ <Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets" Condition="false" />
<PropertyGroup>
<PostBuildEvent>cd</PostBuildEvent>
<PostBuildEvent>
diff --git a/Util/VS2010/DafnyExtension/DafnyExtension/source.extension.vsixmanifest b/Util/VS2010/DafnyExtension/DafnyExtension/source.extension.vsixmanifest
index d822fbfc..ef5c1cf5 100644
--- a/Util/VS2010/DafnyExtension/DafnyExtension/source.extension.vsixmanifest
+++ b/Util/VS2010/DafnyExtension/DafnyExtension/source.extension.vsixmanifest
@@ -10,6 +10,9 @@
<VisualStudio Version="10.0">
<Edition>Pro</Edition>
</VisualStudio>
+ <VisualStudio Version="11.0">
+ <Edition>Pro</Edition>
+ </VisualStudio>
</SupportedProducts>
<SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.0" />
</Identifier>
diff --git a/Util/latex/boogie.sty b/Util/latex/boogie.sty
index 45eb050d..43336262 100644
--- a/Util/latex/boogie.sty
+++ b/Util/latex/boogie.sty
@@ -34,7 +34,7 @@
procedure,implementation,
requires,modifies,ensures,free,
% expressions
- false,true,null,old,then,
+ false,true,null,old,then,div,mod,
% statements
assert,assume,havoc,call,if,else,while,invariant,break,return,goto,
},
diff --git a/Util/vim/syntax/boogie.vim b/Util/vim/syntax/boogie.vim
index 667a2b8c..673f967e 100644
--- a/Util/vim/syntax/boogie.vim
+++ b/Util/vim/syntax/boogie.vim
@@ -15,7 +15,7 @@ set cpo&vim
" type
syn keyword bplType bool int
" repeat / condition / label
-syn keyword bplExpr forall exists cast returns lambda
+syn keyword bplExpr forall exists cast returns lambda div mod
syn keyword bplStmt goto return while call else if assert assume havoc then
syn keyword bplDecl axiom function procedure type requires ensures modifies unique const var free implementation invariant
" user labels
diff --git a/_admin/Boogie/aste/summary.log b/_admin/Boogie/aste/summary.log
index 65d20cc8..ab4525c0 100644
--- a/_admin/Boogie/aste/summary.log
+++ b/_admin/Boogie/aste/summary.log
@@ -1,45 +1,40 @@
-# Aste started: 2012-08-22 07:00:02
+# Aste started: 2012-09-28 10:27:56
# Host id: Boogiebox
# Configuration: boogie.cfg
# Task: aste.tasks.boogie.FullBuild
-# [2012-08-22 07:01:12] SpecSharp revision: 5f64084327c6
-# [2012-08-22 07:01:12] SscBoogie revision: 5f64084327c6
-# [2012-08-22 07:02:05] Boogie revision: 693e9d4632c3
-[2012-08-22 07:03:35] C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com SpecSharp.sln /Project "Checkin Tests" /Build
+# [2012-09-28 10:29:01] SpecSharp revision: 6649fff01012
+# [2012-09-28 10:29:01] SscBoogie revision: 6649fff01012
+# [2012-09-28 10:29:53] Boogie revision: cf9601ebcaee
+[2012-09-28 10:31:01] C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com SpecSharp.sln /Project "Checkin Tests" /Build
1>corflags : warning CF011: The specified file is strong name signed. Using /Force will invalidate the signature of this image and will require the assembly to be resigned.
warning CF011: The specified file is strong name signed. Using /Force will invalidate the signature of this image and will require the assembly to be resigned.
-[2012-08-22 07:05:01] C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com Boogie.sln /Rebuild Checked
+[2012-09-28 10:32:13] C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com Boogie.sln /Rebuild Checked
- D:\Temp\aste\Boogie\Source\Core\AbsyType.cs(823,16): warning CS0659: 'Microsoft.Boogie.BasicType' overrides Object.Equals(object o) but does not override Object.GetHashCode()
- D:\Temp\aste\Boogie\Source\Core\AbsyType.cs(2802,16): warning CS0659: 'Microsoft.Boogie.CtorType' overrides Object.Equals(object o) but does not override Object.GetHashCode()
+ D:\Temp\aste\Boogie\Source\Core\AbsyType.cs(828,16): warning CS0659: 'Microsoft.Boogie.BasicType' overrides Object.Equals(object o) but does not override Object.GetHashCode()
+ D:\Temp\aste\Boogie\Source\Core\AbsyType.cs(2825,16): warning CS0659: 'Microsoft.Boogie.CtorType' overrides Object.Equals(object o) but does not override Object.GetHashCode()
D:\Temp\aste\Boogie\Source\Core\OOLongUtil.cs(109,7): warning CS0162: Unreachable code detected
- D:\Temp\aste\Boogie\Source\Core\Absy.cs(770,7): warning CC1036: Detected call to method 'Graphing.Graph`1<Microsoft.Boogie.Block>.TopologicalSort' without [Pure] in contracts of method 'Microsoft.Boogie.Program.GraphFromImpl(Microsoft.Boogie.Implementation)'.
- EXEC : warning CC1079: Type Microsoft.Boogie.Variable implements Microsoft.AbstractInterpretationFramework.IVariable.get_Name by inheriting Microsoft.Boogie.NamedDeclaration.get_Name causing the interface contract to not be checked at runtime. Consider adding a wrapper method.
+ D:\Temp\aste\Boogie\Source\Core\Absy.cs(747,7): warning CC1036: Detected call to method 'Graphing.Graph`1<Microsoft.Boogie.Block>.TopologicalSort' without [Pure] in contracts of method 'Microsoft.Boogie.Program.GraphFromImpl(Microsoft.Boogie.Implementation)'.
D:\Temp\aste\Boogie\Source\Core\Parser.cs(128,3): warning CC1032: Method 'Microsoft.Boogie.Parser+BvBounds.Resolve(Microsoft.Boogie.ResolutionContext)' overrides 'Microsoft.Boogie.Absy.Resolve(Microsoft.Boogie.ResolutionContext)', thus cannot add Requires.
D:\Temp\aste\Boogie\Source\Core\Parser.cs(133,5): warning CC1032: Method 'Microsoft.Boogie.Parser+BvBounds.Emit(Microsoft.Boogie.TokenTextWriter,System.Int32,System.Boolean)' overrides 'Microsoft.Boogie.Expr.Emit(Microsoft.Boogie.TokenTextWriter,System.Int32,System.Boolean)', thus cannot add Requires.
D:\Temp\aste\Boogie\Source\Core\Parser.cs(136,74): warning CC1032: Method 'Microsoft.Boogie.Parser+BvBounds.ComputeFreeVariables(Microsoft.Boogie.GSet`1<System.Object>)' overrides 'Microsoft.Boogie.Expr.ComputeFreeVariables(Microsoft.Boogie.GSet`1<System.Object>)', thus cannot add Requires.
- D:\Temp\aste\Boogie\Source\AbsInt\ExprFactories.cs(247,7): warning CS0162: Unreachable code detected
- D:\Temp\aste\Boogie\Source\AbsInt\ExprFactories.cs(266,7): warning CS0162: Unreachable code detected
D:\Temp\aste\Boogie\Source\AbsInt\IntervalDomain.cs(49,9): warning CC1036: Detected call to method 'Microsoft.Boogie.AbstractInterpretation.NativeIntervallDomain+Node.StrictlyBefore(Microsoft.Boogie.Variable,Microsoft.Boogie.Variable)' without [Pure] in contracts of method 'Microsoft.Boogie.AbstractInterpretation.NativeIntervallDomain+Node.#ctor(Microsoft.Boogie.Variable,System.Nullable`1<System.Numerics.BigInteger>,System.Nullable`1<System.Numerics.BigInteger>,Microsoft.Boogie.AbstractInterpretation.NativeIntervallDomain+Node)'.
- D:\Temp\aste\Boogie\Source\VCGeneration\VC.cs(1400,11): warning CS0162: Unreachable code detected
- D:\Temp\aste\Boogie\Source\VCGeneration\VC.cs(1558,11): warning CS0162: Unreachable code detected
+ D:\Temp\aste\Boogie\Source\VCGeneration\VC.cs(1399,11): warning CS0162: Unreachable code detected
+ D:\Temp\aste\Boogie\Source\VCGeneration\VC.cs(1557,11): warning CS0162: Unreachable code detected
EXEC : warning CC1032: Method 'Microsoft.Boogie.Houdini.InlineRequiresVisitor.VisitCmdSeq(Microsoft.Boogie.CmdSeq)' overrides 'Microsoft.Boogie.StandardVisitor.VisitCmdSeq(Microsoft.Boogie.CmdSeq)', thus cannot add Requires.
EXEC : warning CC1032: Method 'Microsoft.Boogie.Houdini.FreeRequiresVisitor.VisitAssertRequiresCmd(Microsoft.Boogie.AssertRequiresCmd)' overrides 'Microsoft.Boogie.StandardVisitor.VisitAssertRequiresCmd(Microsoft.Boogie.AssertRequiresCmd)', thus cannot add Requires.
warning CS0659: 'Microsoft.Boogie.BasicType' overrides Object.Equals(object o) but does not override Object.GetHashCode()
warning CS0659: 'Microsoft.Boogie.CtorType' overrides Object.Equals(object o) but does not override Object.GetHashCode()
warning CS0162: Unreachable code detected
warning CC1036: Detected call to method 'Graphing.Graph`1<Microsoft.Boogie.Block>.TopologicalSort' without [Pure] in contracts of method 'Microsoft.Boogie.Program.GraphFromImpl(Microsoft.Boogie.Implementation)'.
- warning CC1079: Type Microsoft.Boogie.Variable implements Microsoft.AbstractInterpretationFramework.IVariable.get_Name by inheriting Microsoft.Boogie.NamedDeclaration.get_Name causing the interface contract to not be checked at runtime. Consider adding a wrapper method.
warning CC1032: Method 'Microsoft.Boogie.Parser+BvBounds.Resolve(Microsoft.Boogie.ResolutionContext)' overrides 'Microsoft.Boogie.Absy.Resolve(Microsoft.Boogie.ResolutionContext)', thus cannot add Requires.
warning CC1032: Method 'Microsoft.Boogie.Parser+BvBounds.Emit(Microsoft.Boogie.TokenTextWriter,System.Int32,System.Boolean)' overrides 'Microsoft.Boogie.Expr.Emit(Microsoft.Boogie.TokenTextWriter,System.Int32,System.Boolean)', thus cannot add Requires.
warning CC1032: Method 'Microsoft.Boogie.Parser+BvBounds.ComputeFreeVariables(Microsoft.Boogie.GSet`1<System.Object>)' overrides 'Microsoft.Boogie.Expr.ComputeFreeVariables(Microsoft.Boogie.GSet`1<System.Object>)', thus cannot add Requires.
- warning CS0162: Unreachable code detected
- warning CS0162: Unreachable code detected
warning CC1036: Detected call to method 'Microsoft.Boogie.AbstractInterpretation.NativeIntervallDomain+Node.StrictlyBefore(Microsoft.Boogie.Variable,Microsoft.Boogie.Variable)' without [Pure] in contracts of method 'Microsoft.Boogie.AbstractInterpretation.NativeIntervallDomain+Node.#ctor(Microsoft.Boogie.Variable,System.Nullable`1<System.Numerics.BigInteger>,System.Nullable`1<System.Numerics.BigInteger>,Microsoft.Boogie.AbstractInterpretation.NativeIntervallDomain+Node)'.
warning CS0162: Unreachable code detected
warning CS0162: Unreachable code detected
warning CC1032: Method 'Microsoft.Boogie.Houdini.InlineRequiresVisitor.VisitCmdSeq(Microsoft.Boogie.CmdSeq)' overrides 'Microsoft.Boogie.StandardVisitor.VisitCmdSeq(Microsoft.Boogie.CmdSeq)', thus cannot add Requires.
warning CC1032: Method 'Microsoft.Boogie.Houdini.FreeRequiresVisitor.VisitAssertRequiresCmd(Microsoft.Boogie.AssertRequiresCmd)' overrides 'Microsoft.Boogie.StandardVisitor.VisitAssertRequiresCmd(Microsoft.Boogie.AssertRequiresCmd)', thus cannot add Requires.
-[2012-08-22 07:59:27] 0 out of 33 test(s) in D:\Temp\aste\Boogie\Test\alltests.txt failed
-# [2012-08-22 08:00:38] Released nightly of Boogie
+[2012-09-28 11:34:35] 2 out of 33 test(s) in D:\Temp\aste\Boogie\Test\alltests.txt failed
+['prover', 'dafny0']
+# [2012-09-28 11:35:15] Released nightly of Boogie