示例#1
0
        public void AddValueAssumption(string variableID, VariableDataTypes dataType, object value)
        {
            //Variables
            Z3Variable variable = _variables[variableID];
            Term variableTerm = variable.Term;

            //Exception handling
            if (_valueAssumptions.ContainsKey(variableID))
                throw new Exception("An assumption already exists for the given variable!");
            if (variable.DataType != dataType)
                throw new Exception("Variable is of a different data type than " + dataType.ToString() + "!");

            //Create, register and assert the assumption
            Z3ValueAssumption assumption = CreateValueAssumption(variableTerm, dataType, value);
            AssertValueAssumption(assumption);
            _valueAssumptions.Add(variableID, assumption);
        }
示例#2
0
        public void AddOrModifyValueAssumption(string variableID, VariableDataTypes dataType, object value)
        {
            //Variables
            Z3Variable variable = _variables[variableID];
            Term variableTerm = variable.Term;

            //Exceptions
            if (variable.DataType != dataType)
                throw new Exception("Variable is of a different data type than " + dataType.ToString() + "!");

            //Remove assumption, if it already exists
            if (_valueAssumptions.ContainsKey(variableID))
            {
                RemoveValueAssumption(variableID);
            }

            //Add the new assumption
            AddValueAssumption(variableID, dataType, value);
        }