private bool createAllConHoldersAndTruthtables(string proposition) { try { //CREATING PROPOSITION Connective con = PropositionReader.ReadPropositionString(proposition); if (con.IsNormalProposition()) { conHolder = new ConnectiveHolder(con); table = new Truthtable(conHolder); printDisjunctive(); conHolderDisjunctive = new ConnectiveHolder(tbDisjunctiveParse.Text); tableDisjunctive = new Truthtable(conHolderDisjunctive); conHolderDisjunctiveSimple = new ConnectiveHolder(tbDisjunctiveSimpleParse.Text); tableDisjunctiveSimple = new Truthtable(conHolderDisjunctiveSimple); conHolderNand = conHolder.GetNandHolder(); tableNand = new Truthtable(conHolderNand); conHolderNandSimple = conHolderDisjunctiveSimple.GetNandHolder(); tableNandSimple = new Truthtable(conHolderNandSimple); tbInfix.Text = conHolder.GetInfixString(); tbNand.Text = conHolderNand.GetParseString(); tbNandSimple.Text = conHolderNandSimple.GetParseString(); showTableauxTree = false; //DRAWING AND PRINTING TABLE INFORMATION printVisualTruthtables(table); printTablesInformation(); } else { if (!con.AreLocalArgumentsMatching(new List <char>(), new List <char>())) { throw new Exception("Local Arguments are mismatching or there are quantifiers with the same Local Argument"); } conHolder = new ConnectiveHolder(con); tbInfix.Text = conHolder.GetInfixString(); showTableauxTree = false; } Console.WriteLine("Succesfully parsed proposition: " + proposition); } catch (NullReferenceException) { MessageBox.Show("Parsing failed: please make sure that you wrote a proposition"); Console.WriteLine("Failed to parse proposition: " + proposition); return(false); } catch (Exception ex) { MessageBox.Show("Parsing failed: " + ex.Message); Console.WriteLine("Failed to parse proposition: " + proposition); return(false); } return(true); }
public override bool IsNormalProposition() { return(con1.IsNormalProposition()); }
//CREATING A NEW VARIABLE NEEDED public List <Connective> ApplyDeltaTableauxRules(List <char> usedArguments, List <char> availableArguments) { List <Connective> results = new List <Connective>(); if (element.IsNormalProposition()) { return(results); } if (element is QuantifierExists) { QuantifierExists qe = (QuantifierExists)element; QuantifierExists qeCopy = (QuantifierExists)element.Copy(); char qeArgument = qe.Argument; if (availableArguments.Count > 0) { if (qeCopy.ChangeLocalArgument(qeArgument, availableArguments[0])) { usedArguments.Add(availableArguments[0]); availableArguments.RemoveAt(0); Connective newElement = qeCopy.Con1; results.Add(newElement); } } else { throw new Exception("Not enough available arguments"); } } else if (element is ConnectiveNot) { ConnectiveNot cn = (ConnectiveNot)element; if (cn.Con1 is QuantifierForAll) { QuantifierForAll qfa = (QuantifierForAll)cn.Con1; QuantifierForAll qfaCopy = (QuantifierForAll)cn.Con1.Copy(); char qfaArgument = qfa.Argument; if (availableArguments.Count > 0) { if (qfaCopy.ChangeLocalArgument(qfaArgument, availableArguments[0])) { usedArguments.Add(availableArguments[0]); availableArguments.RemoveAt(0); ConnectiveNot newNot = new ConnectiveNot(); newNot.setLeftConnective(qfaCopy.Con1); Connective newElement = newNot; results.Add(newElement.Copy()); } } else { throw new Exception("Not enough available arguments"); } } } return(results); }