Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A possible bug in Java api concat Kleene Star and Re expressions #6644

Closed
Mingyu821 opened this issue Mar 23, 2023 · 3 comments
Closed

A possible bug in Java api concat Kleene Star and Re expressions #6644

Mingyu821 opened this issue Mar 23, 2023 · 3 comments

Comments

@Mingyu821
Copy link

Mingyu821 commented Mar 23, 2023

In Java api
ctx.mkToRe(ctx.mkString("abcd")); is used to make re expressions, of which class is ReExpr<CharSort>
ctx.mkFullRe(ctx.mkReSort(ctx.mkCharSort())); is used to make a Kleene Star, of which class is ReExpr<ReSort<CharSort>>

So, this is incompatible, how to use Kleene star in re expressions?

For example, re expression like "abc*d", where "*" represents zero or more repetitions of arbitrary string values.
ctx.mkConcat(ctx.mkToRe(ctx.mkString("abc")), ctx.mkFullRe(ctx.mkReSort(ctx.mkCharSort())), ctx.mkToRe(ctx.mkString("d")); will not make sense.

@Mingyu821 Mingyu821 changed the title Java api concat Kleene Star and Re expressions A possible bug in Java api concat Kleene Star and Re expressions Mar 24, 2023
@NikolajBjorner
Copy link
Contributor

ctx.mkFullRe(ctx.mkCharSort()) does not work?

@Mingyu821
Copy link
Author

ctx.mkFullRe(ctx.mkCharSort()) does not work?

Yes, it will throw an 'java.lang.ClassCastException' Exception.

The errorCode is com.microsoft.z3.Expr cannot be cast to com.microsoft.z3.ReExpr.

@Mingyu821
Copy link
Author

Mingyu821 commented Mar 28, 2023

Thanks for fixing this.
However, I cannot appoint class of ctx.mkToRe(ctx.mkString("")) to Expr<ReSort<SeqSort<CharSort>>>. It will result in an error in ctx.mkConcat.
So, now I cannot appoint these class explicitly. And ctx.mkOption api is not compatible when I want to use this api to perform "?" in Re expressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants