Esempio n. 1
0
        /**
         * Move ~ inwards.
         *
         * @param sentence
         *            a propositional logic sentence that has had it biconditionals
         *            and implications removed.
         * @return an equivalent Sentence to the input with all negations moved
         *         inwards.
         * @throws IllegalArgumentException
         *             if a biconditional or implication is encountered in the
         *             input.
         */
        public static Sentence moveNotsInward(Sentence sentence)
        {
            Sentence result = null;

            MoveNotInwards moveNotsIn = new MoveNotInwards();

            result = sentence.accept(moveNotsIn, null);

            return(result);
        }
Esempio n. 2
0
        /**
         * Returns the specified sentence in its logically equivalent negation
         * normal form.
         *
         * @param s
         *            a propositional logic sentence
         *
         * @return the input sentence converted to it logically equivalent
         *         negation normal form.
         */
        public static Sentence convert(Sentence s)
        {
            Sentence result = null;

            Sentence biconditionalsRemoved = BiconditionalElimination.eliminate(s);
            Sentence implicationsRemoved   = ImplicationElimination.eliminate(biconditionalsRemoved);
            Sentence notsMovedIn           = MoveNotInwards.moveNotsInward(implicationsRemoved);

            result = notsMovedIn;

            return(result);
        }