@@ -133,6 +133,8 @@ import io.ksmt.decl.KStringLiteralDecl
133
133
import io.ksmt.decl.KStringConcatDecl
134
134
import io.ksmt.decl.KStringLenDecl
135
135
import io.ksmt.decl.KStringToRegexDecl
136
+ import io.ksmt.decl.KSuffixOfDecl
137
+ import io.ksmt.decl.KPrefixOfDecl
136
138
import io.ksmt.decl.KRegexLiteralDecl
137
139
import io.ksmt.decl.KRegexConcatDecl
138
140
import io.ksmt.decl.KRegexUnionDecl
@@ -287,6 +289,8 @@ import io.ksmt.expr.KStringLiteralExpr
287
289
import io.ksmt.expr.KStringConcatExpr
288
290
import io.ksmt.expr.KStringLenExpr
289
291
import io.ksmt.expr.KStringToRegexExpr
292
+ import io.ksmt.expr.KSuffixOfExpr
293
+ import io.ksmt.expr.KPrefixOfExpr
290
294
import io.ksmt.expr.KRegexLiteralExpr
291
295
import io.ksmt.expr.KRegexConcatExpr
292
296
import io.ksmt.expr.KRegexUnionExpr
@@ -1971,6 +1975,41 @@ open class KContext(
1971
1975
KStringToRegexExpr (this , arg)
1972
1976
}
1973
1977
1978
+ private val suffixOfExprCache = mkAstInterner<KSuffixOfExpr >()
1979
+
1980
+ /* *
1981
+ * Check if first string is a suffix of second.
1982
+ * */
1983
+ open fun mkSuffixOf (arg0 : KExpr <KStringSort >, arg1 : KExpr <KStringSort >): KExpr <KBoolSort > =
1984
+ mkSimplified(arg0, arg1, KContext ::mkSuffixOfNoSimplify, ::mkSuffixOfNoSimplify) // Add simplified version
1985
+
1986
+ /* *
1987
+ * Check if first string is a suffix of second.
1988
+ * */
1989
+ open fun mkSuffixOfNoSimplify (arg0 : KExpr <KStringSort >, arg1 : KExpr <KStringSort >): KSuffixOfExpr =
1990
+ suffixOfExprCache.createIfContextActive {
1991
+ ensureContextMatch(arg0, arg1)
1992
+ KSuffixOfExpr (this , arg0, arg1)
1993
+ }
1994
+
1995
+ private val prefixOfExprCache = mkAstInterner<KPrefixOfExpr >()
1996
+
1997
+ /* *
1998
+ * Check if first string is a prefix of second.
1999
+ * */
2000
+ open fun mkPrefixOf (arg0 : KExpr <KStringSort >, arg1 : KExpr <KStringSort >): KExpr <KBoolSort > =
2001
+ mkSimplified(arg0, arg1, KContext ::mkPrefixOfNoSimplify, ::mkPrefixOfNoSimplify) // Add simplified version
2002
+
2003
+ /* *
2004
+ * Check if first string is a prefix of second.
2005
+ * */
2006
+ open fun mkPrefixOfNoSimplify (arg0 : KExpr <KStringSort >, arg1 : KExpr <KStringSort >): KPrefixOfExpr =
2007
+ prefixOfExprCache.createIfContextActive {
2008
+ ensureContextMatch(arg0, arg1)
2009
+ KPrefixOfExpr (this , arg0, arg1)
2010
+ }
2011
+
2012
+
1974
2013
private val regexLiteralCache = mkAstInterner<KRegexLiteralExpr >()
1975
2014
1976
2015
/* *
@@ -4688,6 +4727,10 @@ open class KContext(
4688
4727
4689
4728
fun mkStringToRegexDecl (): KStringToRegexDecl = KStringToRegexDecl (this )
4690
4729
4730
+ fun mkSuffixOfDecl (): KSuffixOfDecl = KSuffixOfDecl (this )
4731
+
4732
+ fun mkPrefixOfDecl (): KPrefixOfDecl = KPrefixOfDecl (this )
4733
+
4691
4734
// regex
4692
4735
fun mkRegexLiteralDecl (value : String ): KRegexLiteralDecl = KRegexLiteralDecl (this , value)
4693
4736
0 commit comments