예제 #1
0
 public static void PrintSymbolicTrace(SymbolicTrace st)
 {
     foreach (SymbolicBlock b in st)
     {
         b.Emit(new TokenTextWriter(Console.Out, true));
     }
 }
예제 #2
0
        //traverse down a trace (List<Block>). At each program point:
        // -Write the new SymbolicStore at each AssignCmd.
        // -Write the guard condition for each AssumeCmd.
        //the latter will be overwritten by an ExecUp
        public static SymbolicTrace ExecDown(List <Block> bs, List <Variable> args)
        {
            SymbolicStore
                curStore = new SymbolicStore(),
                nextStore;

            ////initialize args with symbolic values
            List <Variable> symbolicConstants = new List <Variable>();

            for (int i = 0; i < args.Count; i++)
            {
                var v = args[i];
                symbolicConstants.Add(B.Factory.MakeConstant(v.Name, v.TypedIdent.Type));
                curStore.Add(new StoreLhs(v), Expr.Ident(symbolicConstants[i]));
            }

            var newTrace = new SymbolicTrace();

            foreach (Block b in bs)
            {
                var tmp = ExecBlockDown(b, curStore, out nextStore);
                newTrace.Add(ExecBlockDown(b, curStore, out nextStore));
                curStore = nextStore;
            }
            return(newTrace);
        }
예제 #3
0
        public static Constraint ExecUp(SymbolicTrace trace)
        {
            var curCons = Constraint.True;

            for (int i = trace.Count - 1; i >= 0; i--)
            {
                curCons = ExecBlockUp(trace[i], curCons);
            }
            return(curCons);
        }