public static SequentFormula Apply(SequentFormula first, SequentFormula second) { if (first.Consequent == null || second.Consequent == null) { return(null); } if (Implication.GetInstance().Equals(first.Consequent.TopConnective) == false) { return(null); } if (first.Consequent.GetOperand(0).Equals(second.Consequent) == false) { return(null); } var newAntecedents = new HashSet <Formula>(); foreach (var antecedent in first) { newAntecedents.Add(antecedent); } foreach (var antecedent in second) { newAntecedents.Add(antecedent); } var newConsequent = second.Consequent; return(new SequentFormula(newAntecedents, newConsequent)); }
private static Symbol SpecialSymbol(string str, ref int index) { ++index; if (index >= str.Length) { throw new ArgumentException( $"a tag was expected, but there is no tag before the symbol \\ with the number {index - 1}"); } var tag = GetTag(str, ref index); if (tag.Length == 0) { throw new ArgumentException( $"a tag was expected, but there is no tag before the symbol \\ with the number {index - 1}"); } return(tag switch { "lnot" => Negation.GetInstance(), "lor" => Disjunction.GetInstance(), "land" => Conjunction.GetInstance(), "to" => Implication.GetInstance(), "forall" => UniversalQuantifier.GetInstance(), "exists" => ExistentialQuantifier.GetInstance(), "over" => Division.GetInstance(), "func" => GetFunction(str, ref index), // \func{name arity} "pr" => GetPredicate(str, ref index), // \pr{name arity} _ => throw new ArgumentException($"unknown tag {tag} before the symbol with the number {index}") });