internal CA(CABuilder cab, int initialState, Expr initialCondition, int nrOfCounters, IEnumerable <Move <Expr> > moves, Dictionary <int, Expr> finalConditions) { this.cab = cab; this.k = nrOfCounters; this.p0 = initialCondition; this.Pred = finalConditions; this.aut = Automaton <Expr> .Create(cab.z3p, initialState, finalConditions.Keys, moves); Validate(); }
static void Test2() { var cab = new CABuilder(); var a = cab.InputGuard('a'); int q = 0; int r = 1; int s = 2; var zero = cab.z3p.MkInt(0); var k = cab.z3p.MkConst("k", cab.z3p.IntSort); var c = cab.Ctr(1); var c_ = cab.Ctr_(1); //q -- T --> q var q_q = cab.MkTransition(q, q, cab.z3p.True); //q -- x=a,c0:=0 --> r var q_r = cab.MkTransition(q, r, cab.z3p.MkAnd(cab.z3p.True, a, cab.z3p.MkAnd(cab.z3p.MkEq(c_, cab.z3p.MkInt(0))))); //r -- T --> s var r_s = cab.MkTransition(r, s, cab.z3p.True); //s -- c0 := c0+1 --> r var s_r = cab.MkTransition(s, r, cab.z3p.MkEq(c_, cab.Incr(c))); //r -- c0 := c0+1 --> r var r_r = cab.MkTransition(r, r, cab.z3p.MkEq(c_, cab.Incr(c))); //r is final with condition c==k var r_final = new KeyValuePair <int, Expr>(r, cab.z3p.MkEq(c, k)); var moves = new Move <Expr>[] { q_q, q_r, r_s, s_r, r_r }; Expr x_guard; Expr c_guard; Expr[] updates; cab.SplitCase(q_r.Label, out x_guard, out c_guard, out updates); var A = cab.MkCA(0, 0, 1, cab.z3p.True, moves, new KeyValuePair <int, Expr>[] { r_final }); A.ShowGraph();; }