public static SequentFormula Apply(SequentFormula first, SequentFormula second) { if (first.Consequent == null || second.Consequent == null) { return(null); } if (Negation.GetInstance().Equals(second.Consequent.TopConnective)) { return(null); } if (first.Consequent.Equals(second.Consequent.GetOperand(0)) == false) { return(null); } var newAntecedents = new HashSet <Formula>(); foreach (var antecedent in first) { newAntecedents.Add(antecedent); } foreach (var antecedent in second) { newAntecedents.Add(antecedent); } return(new SequentFormula(newAntecedents, null)); }
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)); }
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}") });