Пример #1
0
        static void Test1()
        {
            var cab  = new CABuilder_ST();
            var a    = cab.InputGuard("[aA]");
            int q    = 0;
            int r    = 1;
            int s    = 2;
            var zero = cab.z3p.MkInt(0);
            //var _22 = cab.z3p.MkInt(22);
            var k  = cab.z3p.MkConst("k", cab.z3p.IntSort);
            var c  = cab.Counter(0);
            var c1 = cab.Incr(c);
            //q -- T --> q
            var q_q = cab.MkTransition(q, q);
            //q -- x=a,c0:=0 --> r
            var q_r = cab.MkTransition(q, r, a, cab.MkUpdate(zero));
            //r -- T --> s
            var r_s = cab.MkTransition(r, s);
            //s -- c0 := c0+1 --> r
            var s_r = cab.MkTransition(s, r, cab.z3p.True, cab.MkUpdate(c1));
            //r -- c0 := c0+1 --> r
            var r_r = cab.MkTransition(r, r, cab.z3p.True, cab.MkUpdate(c1));
            //r is final with condition c==k
            var r_final = cab.MkFinalizer(r, cab.z3p.MkEq(c, k));

            var moves = new Move <Rule <Expr> >[] { q_q, q_r, r_s, s_r, r_r, r_final };


            var A = cab.MkCntAut(0, new Expr[] { cab.z3p.MkInt(0) }, moves, "A");

            A.ShowGraph();

            //var AxA = cab.Intersect(A, A);
            //AxA.ShowGraph();
        }
Пример #2
0
 internal CA_ST(CABuilder_ST cab, int initialState, Expr[] initalCounterValues,
                IEnumerable <Move <Rule <Expr> > > movesandfinals, string name = "CA")
 {
     this.cab          = cab;
     this.nrOfCounters = initalCounterValues.Length;
     this.st           = ST <FuncDecl, Expr, Sort> .Create(cab.z3p, name,
                                                           (initalCounterValues.Length > 0 ?
                                                            cab.z3p.MkList(initalCounterValues) :
                                                            cab.z3p.GetNil(cab.z3p.MkListSort(cab.z3p.IntSort))),
                                                           cab.z3p.CharSort,
                                                           cab.z3p.CharSort,
                                                           cab.z3p.MkListSort(cab.z3p.IntSort),
                                                           initialState,
                                                           movesandfinals);
 }
Пример #3
0
 internal CA_ST(CABuilder_ST cab, int nrOfCounters, ST <FuncDecl, Expr, Sort> st)
 {
     this.cab          = cab;
     this.nrOfCounters = nrOfCounters;
     this.st           = st;
 }