Examples of Equality


Examples of eas.users.lukas.tnt.arithmetic.Equality

   
    @SuppressWarnings(value = { "all" })
    public static void main(String[] args) throws CloneNotSupportedException {
        Variable a = new Variable(0), b = new Variable(1), c = new Variable(2);
        Variable d = new Variable(3), e = new Variable(4), f = new Variable(5);
        Statement s1 = new Negation(new Exists(new Exists(new Exists(new Equality(new Multiplication(new Multiplication(a, a), a), new Addition(new Multiplication(new Multiplication(new Addition(b, new Number(1)), new Addition(b, new Number(1))), new Addition(b, new Number(1))), new Multiplication(new Multiplication(new Addition(c, new Number(1)), new Addition(c, new Number(1))), new Addition(c, new Number(1))))), c), b), a));
        Statement s2 = s1.clone();
        s1 = new Disjunction(new Conjunction(s1.clone(), s1.clone()), s1.clone());
        Statement s3 = s2.clone();
        renameVarConsistently(s3, a.clone(), d.clone());
        renameVarConsistently(s3, b.clone(), e.clone());
View Full Code Here

Examples of jmathexpr.relation.Equality

        RealNumber r0d1 = R.create(0.1);
        RealNumber div = R.create(1.0/10);
        Subtraction diff = new Subtraction(r0d1, div);
       
        RealNumber zero = R.create(0.0);
        Equality zeroTest = new Equality(diff, zero);
       
        evaluated = zeroTest.evaluate();
        System.out.printf("%s : %s%n", zeroTest, evaluated);
        assertEquals(evaluated, TruthValue.True);
       
        Division division = new Division(R.create(10.0), R.create(2.0));
        System.out.printf("Division domain: %s%n", division.domain());
View Full Code Here

Examples of jmathexpr.relation.Equality

       
        evaluated = naturalExpr.evaluate();
        System.out.printf("%s = %s%n", naturalExpr, evaluated);       
        assertEquals(evaluated, N.create(42));
       
        Expression equality = new Equality(naturalExpr, N.create(42));
        evaluated = equality.evaluate();
        System.out.printf("%s : %s%n", equality, evaluated);
        assertEquals(evaluated, TruthValue.True);
               
        Expression elementOf = new ElementOf(naturalExpr, N);
        evaluated = elementOf.evaluate();
View Full Code Here

Examples of jmathexpr.relation.Equality

         */
        private class AdditionC extends SubRule {

            @Override
            public boolean matches(Expression expr) {
                return new Equality(new Addition(ax, b), c).matches(expr);
            }
View Full Code Here

Examples of jmathexpr.relation.Equality

            @Override
            public Expression apply() {
                ANumber term = (ANumber) b.hit();
               
                return new Equality(Sum.subtract(((Equality) target).lhs(), term),
                        Sum.subtract(((Equality) target).rhs(), term));
            }
View Full Code Here

Examples of jmathexpr.relation.Equality

         */
        private class SubtractionC extends SubRule {

            @Override
            public boolean matches(Expression expr) {
                return new Equality(new Subtraction(ax, b), c).matches(expr);
            }
View Full Code Here

Examples of jmathexpr.relation.Equality

            @Override
            public Expression apply() {
                Expression term = b.hit();
               
                return new Equality(Sum.add(((Equality) target).lhs(), term),
                        Sum.add(((Equality) target).rhs(), term));
            }
View Full Code Here

Examples of jmathexpr.relation.Equality

         */
        private class SubtractionX extends SubRule {

            @Override
            public boolean matches(Expression expr) {
                return new Equality(new Subtraction(b, ax), c).matches(expr);
            }
View Full Code Here

Examples of jmathexpr.relation.Equality

            @Override
            public Expression apply() {
                Expression var = ax.hit();
               
                return new Equality(Sum.add(((Equality) target).lhs(), var),
                        Sum.add(((Equality) target).rhs(), var));
            }
View Full Code Here

Examples of jmathexpr.relation.Equality

        public boolean matches(Expression expr) {
            target = expr;
           
            Expression ax = new Multiplication(a, x);

            boolean matches = new Equality(ax, b).matches(expr) || new Equality(b, ax).matches(expr);
           
            // Don't match the case x = b (a = 1)
            matches = matches && !a.hit().equals(Naturals.one());

            return matches;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.