MCPcopy Create free account
hub / github.com/Z3Prover/z3 / ModelConverterTest

Method ModelConverterTest

examples/dotnet/Program.cs:300–327  ·  view source on GitHub ↗
(Context ctx)

Source from the content-addressed store, hash-verified

298 }
299
300 static void ModelConverterTest(Context ctx)
301 {
302 Console.WriteLine("ModelConverterTest");
303
304 ArithExpr xr = (ArithExpr)ctx.MkConst(ctx.MkSymbol("x"), ctx.MkRealSort());
305 ArithExpr yr = (ArithExpr)ctx.MkConst(ctx.MkSymbol("y"), ctx.MkRealSort());
306 Goal g4 = ctx.MkGoal(true);
307 g4.Assert(ctx.MkGt(xr, ctx.MkReal(10, 1)));
308 g4.Assert(ctx.MkEq(yr, ctx.MkAdd(xr, ctx.MkReal(1, 1))));
309 g4.Assert(ctx.MkGt(yr, ctx.MkReal(1, 1)));
310
311 ApplyResult ar = ApplyTactic(ctx, ctx.MkTactic("simplify"), g4);
312 if (ar.NumSubgoals == 1 && (ar.Subgoals[0].IsDecidedSat || ar.Subgoals[0].IsDecidedUnsat))
313 throw new TestFailedException();
314
315 ar = ApplyTactic(ctx, ctx.AndThen(ctx.MkTactic("simplify"), ctx.MkTactic("solve-eqs")), g4);
316 if (ar.NumSubgoals == 1 && (ar.Subgoals[0].IsDecidedSat || ar.Subgoals[0].IsDecidedUnsat))
317 throw new TestFailedException();
318
319 Solver s = ctx.MkSolver();
320 foreach (BoolExpr e in ar.Subgoals[0].Formulas)
321 s.Assert(e);
322 Status q = s.Check();
323 Console.WriteLine("Solver says: " + q);
324 Console.WriteLine("Model: \n" + s.Model);
325 if (q != Status.SATISFIABLE)
326 throw new TestFailedException();
327 }
328
329 /// <summary>
330 /// A simple array example.

Callers

nothing calls this directly

Calls 13

MkSymbolMethod · 0.80
MkSolverMethod · 0.80
AndThenMethod · 0.65
MkConstMethod · 0.45
MkRealSortMethod · 0.45
MkGoalMethod · 0.45
AssertMethod · 0.45
MkGtMethod · 0.45
MkRealMethod · 0.45
MkEqMethod · 0.45
MkAddMethod · 0.45
MkTacticMethod · 0.45

Tested by

no test coverage detected