示例#1
0
        // Convert the formula to Conjunctive Normal Form.
        private void buttonFNC_Click(object sender, EventArgs e)
        {
            string expr = textBoxInput.Text;    // expression input.

            tabControl1.SelectedIndex = 1;

            // Creates a new analyzer for the expression.
            Analyzer asl = new Analyzer(expr);

            // Tokenization phase.
            if (!Tokenize(asl))
            {
                return;
            }
            // Parsing phase.
            AST            ast = CNF.Convert(asl.Parse());
            string         fnc = ASTFormat.Format(ast, ASTFormat.FormatType.PLAIN);
            CNFProposition cnf = new CNFProposition(ast);
            //IEnumerable<CnfOr> orClauses = CNF.Separate(ast, true);

            // Add this formula to the FNC list.
            RichTextTool rtt = new RichTextTool(ref richTextBoxCNF);

            rtt.AppendText(expr + " - ");
            richTextBoxCNF.SelectionBackColor = Color.Aquamarine;
            rtt.ToggleBold();
            rtt.AppendText(fnc);
            richTextBoxCNF.SelectionBackColor = Color.White;
            rtt.ToggleBold(); rtt.AppendText(" - "); rtt.ToggleBold();
            richTextBoxCNF.SelectionBackColor = Color.LawnGreen;
            rtt.AppendText(cnf.ToString());
            rtt.Eol();

            // Add the tree to the image.

            /*
             * if (m_treeFiller == null) m_treeFiller = new TreeFiller(pictureBoxTree);
             * m_treeFiller.Draw(ast);
             */
        }
示例#2
0
        /// <summary>
        /// Report the proof state.
        /// </summary>
        /// <param name="message">Message from the proof.</param>
        public void Report(string message)
        {
            RichTextTool rtt = new RichTextTool(ref richTextBoxResolution);

            rtt.AppendText(message);
        }