示例#1
0
 public VariableMapLattice(IPropExprFactory /*!*/ propExprFactory, IValueExprFactory /*!*/ valueExprFactory, MicroLattice /*!*/ microLattice, /*maybe null*/ IComparer variableComparer)
     : base(valueExprFactory)
 {
     Contract.Requires(microLattice != null);
     Contract.Requires(valueExprFactory != null);
     Contract.Requires(propExprFactory != null);
     this.propExprFactory  = propExprFactory;
     this.microLattice     = microLattice;
     this.variableComparer = variableComparer;
     // base(valueExprFactory);
 }
示例#2
0
 public Elt /*!*/ Remove(IVariable /*!*/ var, MicroLattice microLattice)
 {
     Contract.Requires(var != null);
     Contract.Ensures(Contract.Result <Elt>() != null);
     if (this.IsBottom)
     {
         return(this);
     }
     Contract.Assume(this.constraints != null);
     return(new Elt(this.constraints.Remove(var)));
 }
示例#3
0
            /// <summary>
            /// Add a new entry in the functional map: var --> value.
            /// If the variable is already there, throws an exception
            /// </summary>
            public Elt /*!*/ Add(IVariable /*!*/ var, Element /*!*/ value, MicroLattice /*!*/ microLattice)
            {
                Contract.Requires(microLattice != null);
                Contract.Requires(value != null);
                Contract.Requires(var != null);
                Contract.Requires((!this.IsBottom));
                Contract.Ensures(Contract.Result <Elt>() != null);
                Contract.Assume(this.constraints != null);
                Contract.Assert(!this.constraints.Contains(var));

                if (microLattice.IsBottom(value))
                {
                    return(Bottom);
                }
                if (microLattice.IsTop(value))
                {
                    return(this.Remove(var, microLattice));
                }

                return(new Elt(this.constraints.Add(var, value)));
            }
示例#4
0
            /// <summary>
            /// Set the value of the variable in the functional map
            /// If the variable is not already there, throws an exception
            /// </summary>
            public Elt /*!*/ Set(IVariable /*!*/ var, Element /*!*/ value, MicroLattice /*!*/ microLattice)
            {
                Contract.Requires(microLattice != null);
                Contract.Requires(value != null);
                Contract.Requires(var != null);
                Contract.Ensures(Contract.Result <Elt>() != null);
                if (microLattice.IsBottom(value))
                {
                    return(Bottom);
                }
                if (microLattice.IsTop(value))
                {
                    return(this.Remove(var, microLattice));
                }

                Contract.Assume(this.constraints != null);
                Contract.Assert(this.constraints.Contains(var));

                // this.constraints[var] = value;
                IFunctionalMap newMap = this.constraints.Set(var, value);

                return(new Elt(newMap));
            }
 public VariableMapLattice(IPropExprFactory/*!*/ propExprFactory, IValueExprFactory/*!*/ valueExprFactory, MicroLattice/*!*/ microLattice, /*maybe null*/IComparer variableComparer)
   : base(valueExprFactory) {
   Contract.Requires(microLattice != null);
   Contract.Requires(valueExprFactory != null);
   Contract.Requires(propExprFactory != null);
   this.propExprFactory = propExprFactory;
   this.microLattice = microLattice;
   this.variableComparer = variableComparer;
   // base(valueExprFactory);
 }
 public Elt/*!*/ Rename(IVariable/*!*/ oldName, IVariable/*!*/ newName, MicroLattice/*!*/ microLattice) {
   Contract.Requires(microLattice != null);
   Contract.Requires(newName != null);
   Contract.Requires(oldName != null);
   Contract.Requires((!this.IsBottom));
   Contract.Ensures(Contract.Result<Elt>() != null);
   Element value = this[oldName];
   if (value == null) {
     return this;
   } // 'oldName' isn't in the map, so neither will be 'newName'
   Contract.Assume(this.constraints != null);
   IFunctionalMap newMap = this.constraints.Remove(oldName);
   newMap = newMap.Add(newName, value);
   return new Elt(newMap);
 }
 public Elt/*!*/ Remove(IVariable/*!*/ var, MicroLattice microLattice) {
   Contract.Requires(var != null);
   Contract.Ensures(Contract.Result<Elt>() != null);
   if (this.IsBottom) {
     return this;
   }
   Contract.Assume(this.constraints != null);
   return new Elt(this.constraints.Remove(var));
 }
      /// <summary>
      /// Set the value of the variable in the functional map
      /// If the variable is not already there, throws an exception
      /// </summary>
      public Elt/*!*/ Set(IVariable/*!*/ var, Element/*!*/ value, MicroLattice/*!*/ microLattice) {
        Contract.Requires(microLattice != null);
        Contract.Requires(value != null);
        Contract.Requires(var != null);
        Contract.Ensures(Contract.Result<Elt>() != null);
        if (microLattice.IsBottom(value)) {
          return Bottom;
        }
        if (microLattice.IsTop(value)) {
          return this.Remove(var, microLattice);
        }

        Contract.Assume(this.constraints != null);
        Contract.Assert(this.constraints.Contains(var));

        // this.constraints[var] = value;
        IFunctionalMap newMap = this.constraints.Set(var, value);

        return new Elt(newMap);
      }
      /// <summary>
      /// Add a new entry in the functional map: var --> value.
      /// If the variable is already there, throws an exception
      /// </summary>
      public Elt/*!*/ Add(IVariable/*!*/ var, Element/*!*/ value, MicroLattice/*!*/ microLattice) {
        Contract.Requires(microLattice != null);
        Contract.Requires(value != null);
        Contract.Requires(var != null);
        Contract.Requires((!this.IsBottom));
        Contract.Ensures(Contract.Result<Elt>() != null);
        Contract.Assume(this.constraints != null);
        Contract.Assert(!this.constraints.Contains(var));

        if (microLattice.IsBottom(value)) {
          return Bottom;
        }
        if (microLattice.IsTop(value)) {
          return this.Remove(var, microLattice);
        }

        return new Elt(this.constraints.Add(var, value));
      }
示例#10
0
            public Elt /*!*/ Rename(IVariable /*!*/ oldName, IVariable /*!*/ newName, MicroLattice /*!*/ microLattice)
            {
                Contract.Requires(microLattice != null);
                Contract.Requires(newName != null);
                Contract.Requires(oldName != null);
                Contract.Requires((!this.IsBottom));
                Contract.Ensures(Contract.Result <Elt>() != null);
                Element value = this[oldName];

                if (value == null)
                {
                    return(this);
                } // 'oldName' isn't in the map, so neither will be 'newName'
                Contract.Assume(this.constraints != null);
                IFunctionalMap newMap = this.constraints.Remove(oldName);

                newMap = newMap.Add(newName, value);
                return(new Elt(newMap));
            }