/// <summary> /// Returns a SMT-LIB v2.0-compliant string that corresponds to the sort of an array of /// bitvectors with bitvector indices, having the input dimensions. /// </summary> /// /// <param name="dimensions">Dimensions of an array of bitvectors with /// bitvector indices.</param> /// <param name="path">Path that contains the input array /// whose dimensions are provided.</param> /// <returns>SMT-LIB v2.0-compliant string that corresponds to the sort of an array of /// bitvectors with bitvector indices, having the input dimensions.</returns> private static string MakeArraySort(List <uint> dimensions, Path path) { string result = "(Array"; if (!path.ProjectConfig.MODEL_AS_NESTED_ARRAYS) { long sumDomainDims = dimensions.GetRange(0, dimensions.Count - 1).Sum(dim => dim); result += " " + SmtHelper.MakeBvSort(sumDomainDims) + " "; result += SmtHelper.MakeBvSort(dimensions[dimensions.Count - 1]) + ")"; return(result); } if (dimensions.Count == 1) { return(SmtHelper.MakeBvSort(dimensions[0])); } result += " " + SmtHelper.MakeBvSort(dimensions[0]) + " "; result += SmtHelper.MakeArraySort(dimensions.GetRange(1, dimensions.Count - 1), path); result = result.TrimEnd() + ")"; return(result); }
/// <summary> /// Returns a SMT-LIB v2.0-compliant string that declares the input array variable name /// as an array of bitvectors with bitvector indices. /// </summary> /// /// <param name="name">Array variable name.</param> /// <param name="dimensions">Dimensions of the array with the input name.</param> /// <param name="path">Path that contains the array with the input name.</param> /// <returns>SMT-LIB v2.0-compliant string that declares the input array variable name /// as an array of bitvectors with bitvector indices.</returns> private static string MakeArrayVarBv(string name, List <uint> dimensions, Path path) { return("(declare-fun " + name + " () " + SmtHelper.MakeArraySort(dimensions, path) + ")"); }