@@ -109,6 +109,54 @@ inline fun KContext.simplifyStringBasicPrefixOfExpr(
109109 cont(arg0, arg1)
110110 }
111111
112+ /*
113+ * String comparison expression simplifications
114+ * */
115+
116+ /* * Simplifies string "less than" comparison expressions
117+ * (str_lt strConst1 strConst2) ==> boolConst */
118+ inline fun KContext.simplifyStringBasicLtExpr (
119+ arg0 : KExpr <KStringSort >,
120+ arg1 : KExpr <KStringSort >,
121+ cont : (KExpr <KStringSort >, KExpr <KStringSort >) -> KExpr <KBoolSort >
122+ ): KExpr <KBoolSort > =
123+ tryEvalStringLiteralOperation(arg0, arg1, { a0, a1 -> StringUtils .stringLt(a0, a1) }) {
124+ cont(arg0, arg1)
125+ }
126+
127+ /* * Simplifies string "less than or equal" comparison expressions
128+ * (str_le strConst1 strConst2) ==> boolConst */
129+ inline fun KContext.simplifyStringBasicLeExpr (
130+ arg0 : KExpr <KStringSort >,
131+ arg1 : KExpr <KStringSort >,
132+ cont : (KExpr <KStringSort >, KExpr <KStringSort >) -> KExpr <KBoolSort >
133+ ): KExpr <KBoolSort > =
134+ tryEvalStringLiteralOperation(arg0, arg1, { a0, a1 -> StringUtils .stringLe(a0, a1) }) {
135+ cont(arg0, arg1)
136+ }
137+
138+ /* * Simplifies string "greater than" comparison expressions
139+ * (str_gt strConst1 strConst2) ==> boolConst */
140+ inline fun KContext.simplifyStringBasicGtExpr (
141+ arg0 : KExpr <KStringSort >,
142+ arg1 : KExpr <KStringSort >,
143+ cont : (KExpr <KStringSort >, KExpr <KStringSort >) -> KExpr <KBoolSort >
144+ ): KExpr <KBoolSort > =
145+ tryEvalStringLiteralOperation(arg0, arg1, { a0, a1 -> StringUtils .stringGt(a0, a1) }) {
146+ cont(arg0, arg1)
147+ }
148+
149+ /* * Simplifies string "greater than or equal" comparison expressions
150+ * (str_ge strConst1 strConst2) ==> boolConst */
151+ inline fun KContext.simplifyStringBasicGeExpr (
152+ arg0 : KExpr <KStringSort >,
153+ arg1 : KExpr <KStringSort >,
154+ cont : (KExpr <KStringSort >, KExpr <KStringSort >) -> KExpr <KBoolSort >
155+ ): KExpr <KBoolSort > =
156+ tryEvalStringLiteralOperation(arg0, arg1, { a0, a1 -> StringUtils .stringGe(a0, a1) }) {
157+ cont(arg0, arg1)
158+ }
159+
112160inline fun <K : KSort > tryEvalStringLiteralOperation (
113161 arg : KExpr <KStringSort >,
114162 operation : (KStringLiteralExpr ) -> KInterpretedValue <K >,
0 commit comments