Example #1
0
        public void Test4()
        {
            ObjectVariableTerm x = new ObjectVariable('x');

            IndividualConstantTerm <RationalNumber> half =
                (IndividualConstant <RationalNumber>)(new RationalNumber(1, 2));

            IndividualConstantTerm <RationalNumber>
            one = (IndividualConstant <RationalNumber>)(new RationalNumber(1, 1));

            var pr1 = new PredicateFormula(Predicates.More, x, half);
            var pr2 = new PredicateFormula(Predicates.Less, x, one);

            var f1 = new PropositionalConnectiveFormula(Conjunction.GetInstance(), pr1, pr2);
            var f2 = new QuantifierFormula(ExistentialQuantifier.GetInstance(), x, f1);


            IndividualConstantTerm <int> two = new IndividualConstant <int>(2);
            var xSqr = new FunctionTerm(Functions.Pow, x, two);

            var pr3 = new PredicateFormula(Predicates.MoreZero, xSqr);
            var pr4 = new PredicateFormula(Predicates.EqualZero, x);

            var f3 = new PropositionalConnectiveFormula(Disjunction.GetInstance(), pr3, pr4);

            var f      = new PropositionalConnectiveFormula(Conjunction.GetInstance(), f2, f3);
            var actual = SimpleTarskiAlgorithm.QuantifiersElimination(f);

            Formula expected  = f3;
            Formula expected1 = new PropositionalConnectiveFormula(Disjunction.GetInstance(), pr4, pr3);

            Assert.IsTrue(expected.Equals(actual) || expected1.Equals(actual));
        }
Example #2
0
        private static void CheckOrder(Symbol left, Symbol right)
        {
            var err = left switch
            {
                Comma _ => (right is Comma),
                ArithmeticBinaryFunction _ => (right is ArithmeticBinaryFunction),
                ArithmeticPredicate _ => (right is ArithmeticPredicate),
                ObjectVariable _ => (right is ObjectVariable),
                IndividualConstant <BigInteger> _ => (right is IndividualConstant <BigInteger>),
                Quantifier _ => (right is Quantifier),
                BinaryPropositionalConnective _ => (right is BinaryPropositionalConnective),
                _ => false
            };

            if (err)
            {
                throw new ArgumentException($"symbols {left} and {right} cannot be placed side by side");
            }
        }
 public IndividualConstantTerm(IndividualConstant <T> individualConstant)
 {
     IndividualConstant = individualConstant;
 }