Пример #1
0
        private void btnReadNAND_Click(object sender, EventArgs e)
        {
            string proposition = myTree.DisplayOnlyNAND();

            myTree.InsertTree(proposition);
            TruthTable myTruthTable = new TruthTable(myTree.GetRoot());

            lbDisjunctiveNormalForm.Items.Clear();
            //display
            tbOutputInfix.Text = myTree.DisplayInOrder();
            tbTruthTable.Text  = myTruthTable.GetTableInString();
            tbHashCode.Text    = myTruthTable.GetTruthTableHashCode();
            lbDisjunctiveNormalForm.Items.Add(myTruthTable.DisjunctiveNormalForm());
            tbSimplified.Text            = myTruthTable.MinimizeTruthTable();
            tbSimplifiedDisjunction.Text = myTruthTable.SimplifiedTableDisjunctiveForm();
        }
Пример #2
0
        private void btnReadDisjunction_Click(object sender, EventArgs e)
        {
            //convert infix to prefix
            TruthTable myTruthTable = new TruthTable(myTree.GetRoot());
            string     prefixForm   = myTree.InfixToPrefix(myTruthTable.DisjunctiveNormalForm());

            //create tree
            myTree.InsertTree(prefixForm);
            lbDisjunctiveNormalForm.Items.Clear();
            lbNAND.Items.Clear();
            //display
            tbOutputInfix.Text = myTree.DisplayInOrder();
            myTruthTable       = new TruthTable(myTree.GetRoot());
            tbTruthTable.Text  = myTruthTable.GetTableInString();
            tbHashCode.Text    = myTruthTable.GetTruthTableHashCode();
            lbDisjunctiveNormalForm.Items.Add(myTruthTable.DisjunctiveNormalForm());
            lbNAND.Items.Add(myTree.DisplayOnlyNAND());
        }
Пример #3
0
        private void btnRead_Click(object sender, EventArgs e)
        {
            //clear lb
            lbBoundVar.Items.Clear();
            lbUnboundVar.Items.Clear();
            //enable button
            btnDraw.Enabled          = true;
            btnDrawProofTree.Enabled = true;
            //create binary tree
            string proposition = tbInput.Text;

            //create normal tree
            myTree.InsertTree(proposition);
            //check input
            if (FunctionHelper.EvaluateFormula(proposition))
            {
                tbOutputInfix.Text = myTree.DisplayInOrder();
                foreach (var v in myTree.GetBoundVar())
                {
                    lbBoundVar.Items.Add(v);
                }
                foreach (var v in myTree.GetUnboundVar())
                {
                    lbUnboundVar.Items.Add(v);
                }
            }
            else
            {
                btnReadDisjunction.Enabled = true;
                btnReadNAND.Enabled        = true;
                TruthTable myTruthTable = new TruthTable(myTree.GetRoot());
                lbNAND.Items.Clear();
                lbDisjunctiveNormalForm.Items.Clear();
                //display
                tbOutputInfix.Text = myTree.DisplayInOrder();
                tbTruthTable.Text  = myTruthTable.GetTableInString();
                tbHashCode.Text    = myTruthTable.GetTruthTableHashCode();
                lbDisjunctiveNormalForm.Items.Add(myTruthTable.DisjunctiveNormalForm());
                tbSimplified.Text            = myTruthTable.MinimizeTruthTable();
                tbSimplifiedDisjunction.Text = myTruthTable.SimplifiedTableDisjunctiveForm();
                lbNAND.Items.Add(myTree.DisplayOnlyNAND());
            }
        }