@@ -291,7 +291,6 @@ import org.ksmt.expr.KUnaryMinusArithExpr
291291import org.ksmt.expr.KUniversalQuantifier
292292import org.ksmt.expr.KXorExpr
293293import org.ksmt.expr.rewrite.simplify.simplifyAnd
294- import org.ksmt.expr.rewrite.simplify.simplifyAndNoFlat
295294import org.ksmt.expr.rewrite.simplify.simplifyArithAdd
296295import org.ksmt.expr.rewrite.simplify.simplifyArithDiv
297296import org.ksmt.expr.rewrite.simplify.simplifyArithGe
@@ -392,7 +391,6 @@ import org.ksmt.expr.rewrite.simplify.simplifyIntToReal
392391import org.ksmt.expr.rewrite.simplify.simplifyIte
393392import org.ksmt.expr.rewrite.simplify.simplifyNot
394393import org.ksmt.expr.rewrite.simplify.simplifyOr
395- import org.ksmt.expr.rewrite.simplify.simplifyOrNoFlat
396394import org.ksmt.expr.rewrite.simplify.simplifyRealIsInt
397395import org.ksmt.expr.rewrite.simplify.simplifyRealToFpExpr
398396import org.ksmt.expr.rewrite.simplify.simplifyRealToInt
@@ -666,17 +664,56 @@ open class KContext(
666664 private val andNaryCache = mkAstInterner<KAndNaryExpr >()
667665 private val andBinaryCache = mkAstInterner<KAndBinaryExpr >()
668666
669- open fun mkAnd (args : List <KExpr <KBoolSort >>): KExpr <KBoolSort > =
670- mkSimplified(args, KContext ::simplifyAnd, ::mkAndNoSimplify)
667+ /* *
668+ * Create boolean AND expression.
669+ *
670+ * @param flat flat nested AND expressions
671+ * @param order reorder arguments to ensure that (and a b) == (and b a)
672+ * */
673+ @JvmOverloads
674+ open fun mkAnd (
675+ args : List <KExpr <KBoolSort >>,
676+ flat : Boolean = true,
677+ order : Boolean = true
678+ ): KExpr <KBoolSort > = mkSimplified(
679+ args,
680+ simplifier = { exprArgs -> simplifyAnd(exprArgs, flat, order) },
681+ createNoSimplify = ::mkAndNoSimplify
682+ )
671683
684+ @Deprecated(
685+ " NoFlat builders are deprecated" ,
686+ replaceWith = ReplaceWith (" mkAnd(args, flat = false)" ),
687+ level = DeprecationLevel .ERROR
688+ )
672689 open fun mkAndNoFlat (args : List <KExpr <KBoolSort >>): KExpr <KBoolSort > =
673- mkSimplified (args, KContext ::simplifyAndNoFlat, ::mkAndNoSimplify )
690+ mkAnd (args, flat = false )
674691
675- open fun mkAnd (lhs : KExpr <KBoolSort >, rhs : KExpr <KBoolSort >): KExpr <KBoolSort > =
676- mkSimplified(lhs, rhs, KContext ::simplifyAnd, ::mkAndNoSimplify)
692+ /* *
693+ * Create boolean binary AND expression.
694+ *
695+ * @param flat flat nested AND expressions
696+ * @param order reorder arguments to ensure that (and a b) == (and b a)
697+ * */
698+ @JvmOverloads
699+ open fun mkAnd (
700+ lhs : KExpr <KBoolSort >,
701+ rhs : KExpr <KBoolSort >,
702+ flat : Boolean = true,
703+ order : Boolean = true
704+ ): KExpr <KBoolSort > = mkSimplified(
705+ lhs, rhs,
706+ simplifier = { a, b -> simplifyAnd(a, b, flat, order) },
707+ createNoSimplify = ::mkAndNoSimplify
708+ )
677709
710+ @Deprecated(
711+ " NoFlat builders are deprecated" ,
712+ replaceWith = ReplaceWith (" mkAnd(lhs, rhs, flat = false)" ),
713+ level = DeprecationLevel .ERROR
714+ )
678715 open fun mkAndNoFlat (lhs : KExpr <KBoolSort >, rhs : KExpr <KBoolSort >): KExpr <KBoolSort > =
679- mkSimplified (lhs, rhs, KContext ::simplifyAndNoFlat, ::mkAndNoSimplify )
716+ mkAnd (lhs, rhs, flat = false )
680717
681718 open fun mkAndNoSimplify (args : List <KExpr <KBoolSort >>): KAndExpr =
682719 if (args.size == 2 ) {
@@ -697,17 +734,56 @@ open class KContext(
697734 private val orNaryCache = mkAstInterner<KOrNaryExpr >()
698735 private val orBinaryCache = mkAstInterner<KOrBinaryExpr >()
699736
700- open fun mkOr (args : List <KExpr <KBoolSort >>): KExpr <KBoolSort > =
701- mkSimplified(args, KContext ::simplifyOr, ::mkOrNoSimplify)
737+ /* *
738+ * Create boolean OR expression.
739+ *
740+ * @param flat flat nested OR expressions
741+ * @param order reorder arguments to ensure that (or a b) == (or b a)
742+ * */
743+ @JvmOverloads
744+ open fun mkOr (
745+ args : List <KExpr <KBoolSort >>,
746+ flat : Boolean = true,
747+ order : Boolean = true
748+ ): KExpr <KBoolSort > = mkSimplified(
749+ args,
750+ simplifier = { exprArgs -> simplifyOr(exprArgs, flat, order) },
751+ createNoSimplify = ::mkOrNoSimplify
752+ )
702753
754+ @Deprecated(
755+ " NoFlat builders are deprecated" ,
756+ replaceWith = ReplaceWith (" mkOr(args, flat = false)" ),
757+ level = DeprecationLevel .ERROR
758+ )
703759 open fun mkOrNoFlat (args : List <KExpr <KBoolSort >>): KExpr <KBoolSort > =
704- mkSimplified (args, KContext ::simplifyOrNoFlat, ::mkOrNoSimplify )
760+ mkOr (args, flat = false )
705761
706- open fun mkOr (lhs : KExpr <KBoolSort >, rhs : KExpr <KBoolSort >): KExpr <KBoolSort > =
707- mkSimplified(lhs, rhs, KContext ::simplifyOr, ::mkOrNoSimplify)
762+ /* *
763+ * Create boolean binary OR expression.
764+ *
765+ * @param flat flat nested OR expressions
766+ * @param order reorder arguments to ensure that (or a b) == (or b a)
767+ * */
768+ @JvmOverloads
769+ open fun mkOr (
770+ lhs : KExpr <KBoolSort >,
771+ rhs : KExpr <KBoolSort >,
772+ flat : Boolean = true,
773+ order : Boolean = true
774+ ): KExpr <KBoolSort > = mkSimplified(
775+ lhs, rhs,
776+ simplifier = { a, b -> simplifyOr(a, b, flat, order) },
777+ createNoSimplify = ::mkOrNoSimplify
778+ )
708779
780+ @Deprecated(
781+ " NoFlat builders are deprecated" ,
782+ replaceWith = ReplaceWith (" mkOr(lhs, rhs, flat = false)" ),
783+ level = DeprecationLevel .ERROR
784+ )
709785 open fun mkOrNoFlat (lhs : KExpr <KBoolSort >, rhs : KExpr <KBoolSort >): KExpr <KBoolSort > =
710- mkSimplified (lhs, rhs, KContext ::simplifyOrNoFlat, ::mkOrNoSimplify )
786+ mkOr (lhs, rhs, flat = false )
711787
712788 open fun mkOrNoSimplify (args : List <KExpr <KBoolSort >>): KOrExpr =
713789 if (args.size == 2 ) {
@@ -767,8 +843,21 @@ open class KContext(
767843
768844 private val eqCache = mkAstInterner<KEqExpr <out KSort >>()
769845
770- open fun <T : KSort > mkEq (lhs : KExpr <T >, rhs : KExpr <T >): KExpr <KBoolSort > =
771- mkSimplified(lhs, rhs, KContext ::simplifyEq, ::mkEqNoSimplify)
846+ /* *
847+ * Create EQ expression.
848+ *
849+ * @param order reorder arguments to ensure that (= a b) == (= b a)
850+ * */
851+ @JvmOverloads
852+ open fun <T : KSort > mkEq (
853+ lhs : KExpr <T >,
854+ rhs : KExpr <T >,
855+ order : Boolean = true
856+ ): KExpr <KBoolSort > = mkSimplified(
857+ lhs, rhs,
858+ simplifier = { l, r -> simplifyEq(l, r, order) },
859+ createNoSimplify = ::mkEqNoSimplify
860+ )
772861
773862 open fun <T : KSort > mkEqNoSimplify (lhs : KExpr <T >, rhs : KExpr <T >): KEqExpr <T > =
774863 eqCache.createIfContextActive {
@@ -778,8 +867,20 @@ open class KContext(
778867
779868 private val distinctCache = mkAstInterner<KDistinctExpr <out KSort >>()
780869
781- open fun <T : KSort > mkDistinct (args : List <KExpr <T >>): KExpr <KBoolSort > =
782- mkSimplified(args, KContext ::simplifyDistinct, ::mkDistinctNoSimplify)
870+ /* *
871+ * Create DISTINCT expression.
872+ *
873+ * @param order reorder arguments to ensure that (distinct a b) == (distinct b a)
874+ * */
875+ @JvmOverloads
876+ open fun <T : KSort > mkDistinct (
877+ args : List <KExpr <T >>,
878+ order : Boolean = true
879+ ): KExpr <KBoolSort > = mkSimplified(
880+ args,
881+ simplifier = { exprArgs -> simplifyDistinct(exprArgs, order) },
882+ createNoSimplify = ::mkDistinctNoSimplify
883+ )
783884
784885 open fun <T : KSort > mkDistinctNoSimplify (args : List <KExpr <T >>): KDistinctExpr <T > =
785886 distinctCache.createIfContextActive {
0 commit comments