コード例 #1
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");
        }
コード例 #2
0
ファイル: TableauxSet.cs プロジェクト: BasJoosten98/Logic-app
        private bool addNewSet(List <Connective> Connectives, TableauxSetElement SourceElement)
        {
            //copy elements except SourceElement
            List <TableauxSetElement> tempElements = new List <TableauxSetElement>();

            foreach (TableauxSetElement tse in elements)
            {
                if (tse != SourceElement)
                {
                    tempElements.Add(tse);
                }
            }

            //add new Elements created from SourceElement if such an element does not exist yet
            bool addedAtLeastOne = false;

            foreach (Connective con in Connectives)
            {
                bool sameFound = false;
                foreach (TableauxSetElement tse in tempElements)
                {
                    if (tse.Element.IsTheSameAs(con))
                    {
                        sameFound = true;
                        break;
                    }
                }
                if (!sameFound)
                {
                    TableauxSetElement newElement = new TableauxSetElement(con);
                    tempElements.Add(newElement);
                    addedAtLeastOne = true;
                }
            }

            //add set
            if (addedAtLeastOne || SourceElement != null) //added one or removed one
            {
                TableauxSet newSet = new TableauxSet(tempElements);
                sets.Add(newSet);
            }
            return(addedAtLeastOne || SourceElement != null);
        }