예제 #1
0
        public static SequentFormula Apply(Formula additionalFormula, SequentFormula first)
        {
            if (first.Consequent != null)
            {
                return(null);
            }
            if (additionalFormula == null)
            {
                return(null);
            }
            if (Negation.GetInstance().Equals(additionalFormula.TopConnective) == false)
            {
                return(null);
            }
            if (first.ContainsAntecedent(additionalFormula) == false)
            {
                return(null);
            }

            var newAntecedents = new HashSet <Formula>();

            foreach (var antecedent in first)
            {
                newAntecedents.Add(antecedent);
            }

            var newConsequent = additionalFormula.GetOperand(0);

            return(new SequentFormula(newAntecedents, newConsequent));
        }
예제 #2
0
        public static SequentFormula Apply(Formula additionalFormula, SequentFormula first)
        {
            if (first.Consequent != null)
            {
                return(null);
            }
            if (additionalFormula == null)
            {
                return(null);
            }
            if (first.ContainsAntecedent(additionalFormula) == false)
            {
                return(null);
            }

            var newAntecedents = new HashSet <Formula>();

            foreach (var antecedent in first)
            {
                newAntecedents.Add(antecedent);
            }

            var subs = new Dictionary <PropositionalVariable, Formula> {
                { A, additionalFormula }
            };
            var newConsequent = NegationTerm.SubstituteInFormula(subs);

            return(new SequentFormula(newAntecedents, newConsequent));
        }
예제 #3
0
        public static bool Equals(SequentFormula first, SequentFormula second)
        {
            if (first == null && second == null)
            {
                return(true);
            }

            if (first == null || second == null)
            {
                return(false);
            }

            if (first.GetHashCode() != second.GetHashCode())
            {
                return(false);
            }

            if (Equals(first.Consequent, second.Consequent) == false)
            {
                return(false);
            }

            if (first._antecedents.Count != second._antecedents.Count)
            {
                return(false);
            }

            foreach (var f in first)
            {
                if (second.ContainsAntecedent(f) == false)
                {
                    return(false);
                }
            }

            return(true);
        }