Ejemplo n.º 1
0
        private void BtnSemanticTableaux_Click(object sender, EventArgs e)
        {
            try
            {
                string userInput = TbFormulaInput.Text.Trim();
                if (userInput.Length < 4)
                {
                    throw new Exception("Format of input is not correct");
                }
                else
                {
                    _graphImages.Clear();
                    userInput = $"~({userInput})";
                    var binaryTree = ParsingModule.Parse(userInput);
                    _tableauxRoot = new TableauxNode(binaryTree.Root as CompositeComponent);
                    _tableauxRoot.IsClosed();

                    _graphImages.Add(0, GenerateGraphVizBinaryGraph(binaryTree.Root.GraphVizFormula, "Normal"));
                    _graphImages.Add(1, GenerateGraphVizBinaryGraph(_tableauxRoot.GraphVizFormula(), "Tableaux"));
                    BtnSemanticTableaux.BackColor = _tableauxRoot.LeafIsClosed == true ? Color.ForestGreen : Color.Tomato;
                    _imageIndex                    = 0;
                    BtnImageNext.Enabled           = true;
                    Btn_Image_Open.Enabled         = true;
                    Tb_InfixFormula_Normal.Enabled = true;
                    PbBinaryGraph.ImageLocation    = _graphImages[0];
                    _formulaGenerator.Calculate(binaryTree.Root);
                    Tb_InfixFormula_Normal.Text = binaryTree.Root.InFixFormula;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($@"{ex.Message}");
            }
        }
Ejemplo n.º 2
0
        public void SemanticTableauxPredicate_OnNonTatologiesFormula_RootNotBeingClosed(string prefixInput)
        {
            //Arrange
            var binaryTreeNormal = ParsingModule.Parse($"~({prefixInput.Trim()})");
            var tableauxRoot     = new TableauxNode(binaryTreeNormal.Root as CompositeComponent);

            //Act
            tableauxRoot.IsClosed();

            //Assert
            Assert.Equal(false, tableauxRoot.LeafIsClosed);
        }