@@ -147,6 +147,7 @@ import io.ksmt.decl.KRegexIntersectionDecl
147147import io.ksmt.decl.KRegexKleeneClosureDecl
148148import io.ksmt.decl.KRegexKleeneCrossDecl
149149import io.ksmt.decl.KRegexDifferenceDecl
150+ import io.ksmt.decl.KRegexComplementDecl
150151import io.ksmt.decl.KIteDecl
151152import io.ksmt.decl.KNotDecl
152153import io.ksmt.decl.KOrDecl
@@ -308,6 +309,7 @@ import io.ksmt.expr.KRegexIntersectionExpr
308309import io.ksmt.expr.KRegexKleeneClosureExpr
309310import io.ksmt.expr.KRegexKleeneCrossExpr
310311import io.ksmt.expr.KRegexDifferenceExpr
312+ import io.ksmt.expr.KRegexComplementExpr
311313import io.ksmt.expr.KIteExpr
312314import io.ksmt.expr.KLeArithExpr
313315import io.ksmt.expr.KLtArithExpr
@@ -2213,6 +2215,22 @@ open class KContext(
22132215 KRegexDifferenceExpr (this , arg0, arg1)
22142216 }
22152217
2218+ private val regexComplementExprCache = mkAstInterner<KRegexComplementExpr >()
2219+
2220+ /* *
2221+ * Create regular expression's complement.
2222+ * */
2223+ open fun mkRegexComplement (arg : KExpr <KRegexSort >): KExpr <KRegexSort > =
2224+ mkSimplified(arg, KContext ::mkRegexComplementNoSimplify, ::mkRegexComplementNoSimplify) // Add simplified version
2225+
2226+ /* *
2227+ * Create regular expression's complement.
2228+ * */
2229+ open fun mkRegexComplementNoSimplify (arg : KExpr <KRegexSort >): KRegexComplementExpr = regexComplementExprCache.createIfContextActive {
2230+ ensureContextMatch(arg)
2231+ KRegexComplementExpr (this , arg)
2232+ }
2233+
22162234 // bitvectors
22172235 private val bv1Cache = mkAstInterner<KBitVec1Value >()
22182236 private val bv8Cache = mkAstInterner<KBitVec8Value >()
@@ -4850,6 +4868,8 @@ open class KContext(
48504868
48514869 fun mkRegexDifferenceDecl (): KRegexDifferenceDecl = KRegexDifferenceDecl (this )
48524870
4871+ fun mkRegexComplementDecl (): KRegexComplementDecl = KRegexComplementDecl (this )
4872+
48534873 // Bit vectors
48544874 fun mkBvDecl (value : Boolean ): KDecl <KBv1Sort > =
48554875 KBitVec1ValueDecl (this , value)
0 commit comments