예제 #1
0
        public override Connective Copy()
        {
            QuantifierExists qe = new QuantifierExists();

            qe.SetArgument(base.argument);
            qe.setLeftConnective(con1.Copy());
            return(qe);
        }
예제 #2
0
        public override bool IsTheSameAs(Connective con)
        {
            if (con is QuantifierExists)
            {
                QuantifierExists c = (QuantifierExists)con;

                if (con1.IsTheSameAs(c.Con1))
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #3
0
        //USING USED VARIABLE NEEDED
        public List <Connective> ApplyGammaTableauxRules(List <char> usedArguments)
        {
            List <Connective> results = new List <Connective>();

            if (usedArguments.Count > 0)
            {
                if (element.IsNormalProposition())
                {
                    return(results);
                }

                if (element is QuantifierForAll)
                {
                    QuantifierForAll qfa = (QuantifierForAll)element;

                    char             qfaArgument = qfa.Argument;
                    QuantifierForAll qfaCopy;

                    foreach (char c in usedArguments) //try changing arguments
                    {
                        qfaCopy = (QuantifierForAll)qfa.Copy();
                        if (qfaCopy.Con1.ChangeLocalArgument(qfaArgument, c))
                        {
                            results.Add(qfaCopy.Con1);
                        }
                    }
                    if (results.Count > 0) //succesfully changed arguments
                    {
                        results.Add(qfa);
                    }
                }
                else if (element is ConnectiveNot)
                {
                    ConnectiveNot cn = (ConnectiveNot)element;

                    if (cn.Con1 is QuantifierExists)
                    {
                        QuantifierExists qe = (QuantifierExists)cn.Con1;

                        char             qeArgument = qe.Argument;
                        QuantifierExists qeCopy;

                        foreach (char c in usedArguments) //try changing arguments
                        {
                            qeCopy = (QuantifierExists)qe.Copy();
                            if (qeCopy.Con1.ChangeLocalArgument(qeArgument, c))
                            {
                                ConnectiveNot newNot = new ConnectiveNot();
                                newNot.setLeftConnective(qeCopy.Con1);
                                results.Add(newNot);
                            }
                        }
                        if (results.Count > 0) //succesfully changed arguments
                        {
                            results.Add(cn.Copy());
                        }
                    }
                }
            }
            return(results);
        }
예제 #4
0
        //CREATING A NEW VARIABLE NEEDED
        public List <Connective> ApplyDeltaTableauxRules(List <char> usedArguments, List <char> availableArguments)
        {
            List <Connective> results = new List <Connective>();

            if (element.IsNormalProposition())
            {
                return(results);
            }

            if (element is QuantifierExists)
            {
                QuantifierExists qe     = (QuantifierExists)element;
                QuantifierExists qeCopy = (QuantifierExists)element.Copy();

                char qeArgument = qe.Argument;
                if (availableArguments.Count > 0)
                {
                    if (qeCopy.ChangeLocalArgument(qeArgument, availableArguments[0]))
                    {
                        usedArguments.Add(availableArguments[0]);
                        availableArguments.RemoveAt(0);

                        Connective newElement = qeCopy.Con1;
                        results.Add(newElement);
                    }
                }
                else
                {
                    throw new Exception("Not enough available arguments");
                }
            }
            else if (element is ConnectiveNot)
            {
                ConnectiveNot cn = (ConnectiveNot)element;

                if (cn.Con1 is QuantifierForAll)
                {
                    QuantifierForAll qfa     = (QuantifierForAll)cn.Con1;
                    QuantifierForAll qfaCopy = (QuantifierForAll)cn.Con1.Copy();

                    char qfaArgument = qfa.Argument;
                    if (availableArguments.Count > 0)
                    {
                        if (qfaCopy.ChangeLocalArgument(qfaArgument, availableArguments[0]))
                        {
                            usedArguments.Add(availableArguments[0]);
                            availableArguments.RemoveAt(0);

                            ConnectiveNot newNot = new ConnectiveNot();
                            newNot.setLeftConnective(qfaCopy.Con1);
                            Connective newElement = newNot;
                            results.Add(newElement.Copy());
                        }
                    }
                    else
                    {
                        throw new Exception("Not enough available arguments");
                    }
                }
            }
            return(results);
        }