From 63c4b7642cd4566a39906b2d73c47b4ebe9f7c1c Mon Sep 17 00:00:00 2001 From: Valentin Wüstholz Date: Mon, 7 Mar 2016 18:25:13 -0600 Subject: Add support for weights on soft assumes. --- Source/Provers/SMTLib/SMTLibLineariser.cs | 2 +- Source/Provers/SMTLib/TypeDeclCollector.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Provers') diff --git a/Source/Provers/SMTLib/SMTLibLineariser.cs b/Source/Provers/SMTLib/SMTLibLineariser.cs index 6df44c2f..06554fcb 100644 --- a/Source/Provers/SMTLib/SMTLibLineariser.cs +++ b/Source/Provers/SMTLib/SMTLibLineariser.cs @@ -281,7 +281,7 @@ namespace Microsoft.Boogie.SMTLib Linearise(node[1], options); return true; } - if (node.Op.Equals(VCExpressionGenerator.SoftOp)) + if (node.Op is VCExprSoftOp) { Linearise(node[1], options); return true; diff --git a/Source/Provers/SMTLib/TypeDeclCollector.cs b/Source/Provers/SMTLib/TypeDeclCollector.cs index 72540c9c..d911ce58 100644 --- a/Source/Provers/SMTLib/TypeDeclCollector.cs +++ b/Source/Provers/SMTLib/TypeDeclCollector.cs @@ -210,10 +210,10 @@ void ObjectInvariant() if (node.Op is VCExprStoreOp) RegisterStore(node); else if (node.Op is VCExprSelectOp) RegisterSelect(node); - else if (node.Op.Equals(VCExpressionGenerator.SoftOp)) { + else if (node.Op is VCExprSoftOp) { var exprVar = node[0] as VCExprVar; AddDeclaration(string.Format("(declare-fun {0} () Bool)", exprVar.Name)); - AddDeclaration(string.Format("(assert-soft {0} :weight 1)", exprVar.Name)); + AddDeclaration(string.Format("(assert-soft {0} :weight {1})", exprVar.Name, ((VCExprSoftOp)node.Op).Weight)); } else if (node.Op.Equals(VCExpressionGenerator.NamedAssumeOp)) { var exprVar = node[0] as VCExprVar; AddDeclaration(string.Format("(declare-fun {0} () Bool)", exprVar.Name)); -- cgit v1.2.3