Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public TableauxHolder(string Proposition)
        {
            Connective proposition = PropositionReader.ReadPropositionString(Proposition);

            infixString = proposition.GetInfix();

            ConnectiveNot notPorposition = new ConnectiveNot();

            notPorposition.setLeftConnective(proposition);

            TableauxSetElement tse = new TableauxSetElement(notPorposition);

            this.startTableaux = new TableauxSet(new List <TableauxSetElement>()
            {
                tse
            });
            isNormalProposition = notPorposition.IsNormalProposition();
            if (!notPorposition.AreLocalArgumentsMatching(new List <char>(), new List <char>()))
            {
                throw new Exception("Local Arguments are mismatching or there are quantifiers with the same Local Argument");
            }
            calculateFreeArguments(notPorposition);
            Console.WriteLine("Succesfully parsed proposition: " + Proposition);
            Console.WriteLine("Creating tableaux nodes...   (In-Progress Feedback: " + TableauxSet.provideFeedback + ")");
            this.startTableaux.CreateNextSets(new List <char>(), availableArguments, true); //Can be (!isNormalProposition) OR (true)
            this.startTableaux.CalculateIsTautology();
            Console.WriteLine("Succesfully created all teableaux nodes");
        }
Exemplo n.º 3
0
 public ConnectiveHolder(string proposition)
 {
     if (proposition != null)
     {
         Connective con = PropositionReader.ReadPropositionString(proposition);
         if (con != null)
         {
             startConnective = con;
         }
         else
         {
             throw new NullReferenceException();
         }
     }
     else
     {
         throw new NullReferenceException();
     }
 }