Esempio n. 1
0
        public StateNode(int i, DafnyModel parent, Model.CapturedState s)
            : base(s, parent)
        {
            dm    = parent;
            state = s;
            index = i;

            skolems = new List <VariableNode>(SkolemVars());
            SetupVars();
        }
Esempio n. 2
0
 public ILanguageSpecificModel GetLanguageSpecificModel(Model m, ViewOptions opts)
 {
   var dm = new DafnyModel(m, opts);
   foreach (var s in m.States) {
     var sn = new StateNode(dm.states.Count, dm, s);
     dm.states.Add(sn);
   }
   dm.FinishStates();
   return dm;
 }
Esempio n. 3
0
        public ILanguageSpecificModel GetLanguageSpecificModel(Model m, ViewOptions opts)
        {
            var dm = new DafnyModel(m, opts);

            foreach (var s in m.States)
            {
                var sn = new StateNode(dm.states.Count, dm, s);
                dm.states.Add(sn);
            }
            dm.FinishStates();
            return(dm);
        }
Esempio n. 4
0
            public FieldName(Model.Element elt, DafnyModel dm)
            {
                Field    = elt;
                NameArgs = new Model.Element[Dims];
                var tpl = dm.f_dim.AppWithArg(0, elt);

                if (tpl != null)
                {
                    Dims     = tpl.Result.AsInt();
                    NameArgs = new Model.Element[Dims];
                    for (int i = Dims; 0 <= --i;)
                    {
                        if (i == 0)
                        {
                            tpl         = dm.f_index_field.AppWithResult(elt);
                            NameArgs[i] = tpl.Args[0];
                        }
                        else
                        {
                            tpl         = dm.f_multi_index_field.AppWithResult(elt);
                            NameArgs[i] = tpl.Args[1];
                            elt         = tpl.Args[0];
                        }
                    }
                }
                // now for the name
                if (Dims == 0)
                {
                    NameFormat = Field.ToString();
                    foreach (var n in Field.Names)
                    {
                        NameFormat = n.Func.Name;
                        int dot = NameFormat.LastIndexOf('.');
                        if (0 <= dot)
                        {
                            NameFormat = NameFormat.Substring(dot + 1);
                        }
                        break;
                    }
                }
                else
                {
                    NameFormat = "[";
                    string sep = "";
                    for (int i = 0; i < Dims; i++)
                    {
                        NameFormat += sep + "%" + i;
                        sep         = ",";
                    }
                    NameFormat += "]";
                }
            }
Esempio n. 5
0
    public StateNode(int i, DafnyModel parent, Model.CapturedState s)
       : base(s, parent)
    {
      dm = parent;
      state = s;
      index = i;

      skolems = new List<VariableNode>(SkolemVars());
      SetupVars();
    }
Esempio n. 6
0
 public FieldName(Model.Element elt, DafnyModel dm) {
   Field = elt;
   NameArgs = new Model.Element[Dims];
   var tpl = dm.f_dim.AppWithArg(0, elt);
   if (tpl != null) {
     Dims = tpl.Result.AsInt();
     NameArgs = new Model.Element[Dims];
     for (int i = Dims; 0 <= --i; ) {
       if (i == 0) {
         tpl = dm.f_index_field.AppWithResult(elt);
         NameArgs[i] = tpl.Args[0];
       } else {
         tpl = dm.f_multi_index_field.AppWithResult(elt);
         NameArgs[i] = tpl.Args[1];
         elt = tpl.Args[0];
       }
     }
   }
   // now for the name
   if (Dims == 0) {
     NameFormat = Field.ToString();
     foreach (var n in Field.Names) {
       NameFormat = n.Func.Name;
       int dot = NameFormat.LastIndexOf('.');
       if (0 <= dot)
         NameFormat = NameFormat.Substring(dot + 1);
       break;
     }
   } else {
     NameFormat = "[";
     string sep = "";
     for (int i = 0; i < Dims; i++) {
       NameFormat += sep + "%" + i;
       sep = ",";
     }
     NameFormat += "]";
   }
 }