3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 00:55:31 +00:00
This commit is contained in:
Nikolaj Bjorner 2023-03-27 09:00:38 -07:00
parent 8a3a3dc91b
commit b4ad747e0b
2 changed files with 29 additions and 7 deletions

View file

@ -2259,6 +2259,24 @@ class JavaExample
System.out.println(e1.equals(e3));
}
public void stringExample() {
System.out.println("String example");
Context ctx = new Context();
var a = ctx.mkToRe(ctx.mkString("abcd"));
var b = ctx.mkFullRe(ctx.mkReSort(ctx.mkStringSort()));
System.out.println(a);
System.out.println(b);
System.out.println(a.getSort());
System.out.println(b.getSort());
var c = ctx.mkConcat(ctx.mkToRe(ctx.mkString("abc")),
ctx.mkFullRe(ctx.mkReSort(ctx.mkStringSort())),
ctx.mkEmptyRe(ctx.mkReSort(ctx.mkStringSort())),
ctx.mkAllcharRe(ctx.mkReSort(ctx.mkStringSort())),
ctx.mkToRe(ctx.mkString("d")));
System.out.println(c);
}
public static void main(String[] args)
{
JavaExample p = new JavaExample();
@ -2274,12 +2292,15 @@ class JavaExample
System.out.print("Z3 Full Version String: ");
System.out.println(Version.getFullVersion());
p.stringExample();
p.simpleExample();
{ // These examples need model generation turned on.
HashMap<String, String> cfg = new HashMap<String, String>();
cfg.put("model", "true");
Context ctx = new Context(cfg);
p.optimizeExample(ctx);
p.basicTests(ctx);