diff --git a/Source/Provers/SMTLib/SMTLibLineariser.cs b/Source/Provers/SMTLib/SMTLibLineariser.cs index 0b87b5918..e6f66d82e 100644 --- a/Source/Provers/SMTLib/SMTLibLineariser.cs +++ b/Source/Provers/SMTLib/SMTLibLineariser.cs @@ -230,7 +230,7 @@ public string TypeToString(Type t) } else { - return SmtLibNameUtils.QuoteId("T@" + s); + return SMTLibNameUtils.QuoteId("T@" + s); } } } @@ -465,7 +465,7 @@ public bool Visit(VCExprQuantifier node, LineariserOptions options) wr.Write("\n"); if (info.qid != null && LibOptions.EmitDebugInformation) { - wr.Write(" :qid {0}\n", SmtLibNameUtils.QuoteId(info.qid)); + wr.Write(" :qid {0}\n", SMTLibNameUtils.QuoteId(info.qid)); } if (weight != 1) @@ -775,8 +775,7 @@ public bool VisitFieldAccessOp(VCExprNAry node, LineariserOptions options) var op = (VCExprFieldAccessOp)node.Op; var constructor = op.DatatypeTypeCtorDecl.Constructors[op.ConstructorIndex]; Variable v = constructor.InParams[op.FieldIndex]; - var name = v.Name + "#" + constructor.Name; - name = ExprLineariser.Namer.GetQuotedName(v, name); + var name = ExprLineariser.Namer.GetQuotedName(v, v.Name); WriteApplication(name, node, options); return true; } @@ -785,8 +784,8 @@ public bool VisitIsConstructorOp(VCExprNAry node, LineariserOptions options) { var op = (VCExprIsConstructorOp)node.Op; var constructor = op.DatatypeTypeCtorDecl.Constructors[op.ConstructorIndex]; - var name = "is-" + constructor.Name; - name = ExprLineariser.Namer.GetQuotedName(name, name); + var constructorName = ExprLineariser.Namer.GetName(constructor, constructor.Name); + var name = SMTLibNameUtils.AddQuotes($"is-{constructorName}"); WriteApplication(name, node, options); return true; } diff --git a/Source/Provers/SMTLib/SMTLibProcessTheoremProver.cs b/Source/Provers/SMTLib/SMTLibProcessTheoremProver.cs index 16c5cf28e..a9595dd1e 100644 --- a/Source/Provers/SMTLib/SMTLibProcessTheoremProver.cs +++ b/Source/Provers/SMTLib/SMTLibProcessTheoremProver.cs @@ -453,7 +453,7 @@ protected void SendVCOptions() protected void SendVCId(string descriptiveName) { if (this.libOptions.EmitDebugInformation) { - SendThisVC("(set-info :boogie-vc-id " + SmtLibNameUtils.QuoteId(descriptiveName) + ")"); + SendThisVC("(set-info :boogie-vc-id " + SMTLibNameUtils.QuoteId(descriptiveName) + ")"); } } diff --git a/Source/Provers/SMTLib/SmtLibNameUtils.cs b/Source/Provers/SMTLib/SmtLibNameUtils.cs index 30304dc6c..cbfbcd3c4 100644 --- a/Source/Provers/SMTLib/SmtLibNameUtils.cs +++ b/Source/Provers/SMTLib/SmtLibNameUtils.cs @@ -3,7 +3,7 @@ namespace Microsoft.Boogie.SMTLib { - public static class SmtLibNameUtils + public static class SMTLibNameUtils { public static string QuoteId(string s) @@ -70,7 +70,7 @@ public static string QuoteId(string s) static HashSet reservedSmtWords; static bool[] validIdChar; - static SmtLibNameUtils() + static SMTLibNameUtils() { reservedSmtWords = new HashSet(); foreach (var w in reservedSmtWordsList) @@ -112,7 +112,7 @@ static string FilterReserved(string s) } - static string AddQuotes(string s) + public static string AddQuotes(string s) { var allGood = true;