예제 #1
0
        private static string CheckconclusionByConvertingResult(string result, string conclusion)
        {
            RESULTTYPE1 = SyllogismRules.GetTypeByProposition(result);
            string tempresult;

            switch (RESULTTYPE1)
            {
            case "A":
                tempresult = AType.ConvertProposition(result) == conclusion.ToUpper() ? VALIDCONCLUSION : INVALIDCONCLUSION;
                if (tempresult == INVALIDCONCLUSION)
                {
                    tempresult = AType.ImplicateProposition(result) == conclusion.ToUpper()
                            ? VALIDCONCLUSION
                            : INVALIDCONCLUSION;
                }
                result = tempresult;
                break;

            case "E":
                tempresult = EType.ConvertStatement(result) == conclusion.ToUpper() ? VALIDCONCLUSION : INVALIDCONCLUSION;
                if (tempresult == INVALIDCONCLUSION)
                {
                    tempresult = EType.ImplicateStatement(result) == conclusion.ToUpper() ? VALIDCONCLUSION : INVALIDCONCLUSION;
                }
                result = tempresult;
                break;

            case "I":
                tempresult = IType.ConvertStatement(result) == conclusion.ToUpper() ? VALIDCONCLUSION : INVALIDCONCLUSION;
                if (tempresult == INVALIDCONCLUSION)
                {
                    tempresult = IType.ImplicateStatement(result) == conclusion.ToUpper()
                            ? VALIDCONCLUSION
                            : INVALIDCONCLUSION;
                }
                result = tempresult;
                break;

            case "O":
                tempresult = OType.ConvertStatement(result) == conclusion.ToUpper() ? VALIDCONCLUSION : INVALIDCONCLUSION;
                if (tempresult == INVALIDCONCLUSION)
                {
                    tempresult = OType.ImplicateStatement(result) == conclusion.ToUpper()
                            ? VALIDCONCLUSION
                            : INVALIDCONCLUSION;
                }
                result = tempresult;
                break;
            }
            return(result);
        }
예제 #2
0
        public static bool IsComplementaryPair(string c1, string c2)
        {
            Type1             = SyllogismRules.GetTypeByProposition(c1);
            Type2             = SyllogismRules.GetTypeByProposition(c2);
            Conlusion1Subject = SyllogismRules.GetStatementByType(Type1);


            if (Type1 == "A" && Type2 == "O")
            {
                //return
                if (CheckAOPair(c1, c2))
                {
                    return(true);
                }
                c1 = AType.ConvertProposition(c1);
                if (CheckIOPair(c1, c2))
                {
                    return(true);
                }
            }
            if (Type1 == "I" && Type2 == "O")
            {
                //return
                if (CheckIOPair(c1, c2))
                {
                    return(true);
                }
                c1 = IType.ConvertStatement(c1);
                if (CheckIOPair(c1, c2))
                {
                    return(true);
                }
            }
            if (Type1 == "I" && Type2 == "E")
            {
                if (CheckIEPair(c1, c2))
                {
                    return(true);
                }
                c1 = IType.ConvertStatement(c1);
                if (CheckIEPair(c1, c2))
                {
                    return(true);
                }
                c1 = IType.ConvertStatement(c1);
                c2 = EType.ConvertStatement(c2);
                return(CheckIEPair(c1, c2));
            }
            return(false);
        }
예제 #3
0
 public static string GetConvertedProposition(string statement)
 {
     if (AType.IsTrue(statement))
     {
         return(AType.ConvertProposition(statement).ToUpper());
     }
     if (EType.IsTrue(statement))
     {
         return(EType.ConvertStatement(statement).ToUpper());
     }
     if (IType.IsTrue(statement))
     {
         return(IType.ConvertStatement(statement).ToUpper());
     }
     if (OType.IsTrue(statement))
     {
         return(OType.ConvertStatement(statement).ToUpper());
     } //TODo:- Add Hidden & Exclusive  Proportion
     return(INVALIDTYPE);
 }
예제 #4
0
        public static bool AlignStatementsByIEARule(string s1, string s1Type, string s2, string s2Type)
        {
            STATEMENT1 = s1;
            STATEMENT2 = s2;
            TYPE1      = s1Type;
            TYPE2      = s2Type;
            var temp = string.Empty;

            if (TYPE1 == "A" && TYPE2 == "A")
            {
                STATEMENT1 = AType.ConvertProposition(STATEMENT1);
                if (IsAligned(AType.GetPredicateByProposition(STATEMENT1), AType.GetSubjectByProposition(STATEMENT2)))//Recheck after convertion
                {
                    return(true);
                }
                temp       = STATEMENT1;
                STATEMENT1 = STATEMENT2;
                STATEMENT2 = temp;
                //return true;
            }
            if (TYPE1 == "A" && TYPE2 == "E")
            {
                STATEMENT2 = EType.ConvertStatement(STATEMENT2);
                if (IsAligned(AType.GetPredicateByProposition(STATEMENT1), EType.GetSubjectByStatement(STATEMENT2)))//Recheck after convertion
                {
                    return(true);
                }
                temp       = STATEMENT1;
                STATEMENT1 = STATEMENT2;
                STATEMENT2 = temp;
                //return true;
            }
            if (TYPE1 == "E" && TYPE2 == "A")
            {
                STATEMENT1 = EType.ConvertStatement(STATEMENT1);
                if (IsAligned(EType.GetPredicateByStatement(STATEMENT1), AType.GetSubjectByProposition(STATEMENT2)))//Recheck after convertion
                {
                    return(true);
                }
                temp       = STATEMENT1;
                STATEMENT1 = STATEMENT2;
                STATEMENT2 = temp;
                //return true;
            }
            if (TYPE1 == "E" && TYPE2 == "I")
            {
                STATEMENT2 = IType.ConvertStatement(STATEMENT2);
                if (IsAligned(EType.GetPredicateByStatement(STATEMENT1), IType.GetSubjectByStatement(STATEMENT2)))//Recheck after convertion
                {
                    return(true);
                }
                temp       = STATEMENT1;
                STATEMENT1 = STATEMENT2;
                STATEMENT2 = temp;
                //return true;
            }
            if (TYPE1 == "I" && TYPE2 == "A")
            {
                STATEMENT1 = IType.ConvertStatement(STATEMENT1);
                if (IsAligned(IType.GetPredicateByStatement(STATEMENT1), AType.GetSubjectByProposition(STATEMENT2)))//Recheck after convertion
                {
                    return(true);
                }
                temp       = STATEMENT1;
                STATEMENT1 = STATEMENT2;
                STATEMENT2 = temp;
                //return true;
            }
            if (TYPE1 == "I" && TYPE2 == "E")
            {
                STATEMENT1 = IType.ConvertStatement(STATEMENT1);
                if (IsAligned(IType.GetPredicateByStatement(STATEMENT1), EType.GetSubjectByStatement(STATEMENT2)))//Recheck after convertion
                {
                    return(true);
                }
                temp       = STATEMENT1;
                STATEMENT1 = STATEMENT2;
                STATEMENT2 = temp;
                // return true;
            }
            return(false);
        }
예제 #5
0
        public static string CheckConclusionByStatements(string conclusion, string statement1, string statement2, string result)
        {
            TYPE1      = SyllogismRules.GetTypeByProposition(statement1);
            TYPE2      = SyllogismRules.GetTypeByProposition(statement2);
            STATEMENT1 = statement1;
            STATEMENT2 = statement2;

            if (TYPE1 == "A" && TYPE2 == "A")
            {
                //if (result.ToUpper() == conclusion.ToUpper())
                //{
                //    result = VALIDCONCLUSION;
                //}

                //else
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (AType.ConvertProposition(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (AType.ConvertProposition(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "A" && TYPE2 == "E")
            {
                //if (result.ToUpper() == conclusion.ToUpper())
                //{
                //    result = VALIDCONCLUSION;
                //}

                //else
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (AType.ConvertProposition(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (EType.ConvertStatement(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "E" && TYPE2 == "A")
            {
                //if (result.ToUpper() == conclusion.ToUpper())
                //{
                //    result = VALIDCONCLUSION;
                //}

                //else
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (EType.ConvertStatement(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (AType.ConvertProposition(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "E" && TYPE2 == "I")
            {
                //if (result.ToUpper() == conclusion.ToUpper())
                //{
                //    result = VALIDCONCLUSION;
                //}

                //else
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (EType.ConvertStatement(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (IType.ConvertStatement(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "I" && TYPE2 == "A")
            {
                //if (result.ToUpper() == conclusion.ToUpper())
                //{
                //    result = VALIDCONCLUSION;
                //}

                //else
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (IType.ConvertStatement(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (AType.ConvertProposition(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "I" && TYPE2 == "E")
            {
                //if (result.ToUpper() == conclusion.ToUpper())
                //{
                //    result = VALIDCONCLUSION;
                //}

                //else

                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (IType.ConvertStatement(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (EType.ConvertStatement(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "I" && TYPE2 == "I")
            {
                //if (result.ToUpper() == conclusion.ToUpper())
                //{
                //    result = VALIDCONCLUSION;
                //}

                //else

                if (IType.ConvertStatement(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (IType.ConvertStatement(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "A" && TYPE2 == "I")
            {
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                //TODO convert result and check

                else if (AType.ConvertProposition(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (IType.ConvertStatement(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "A" && TYPE2 == "O")
            {
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }

                else if (AType.ConvertProposition(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (OType.ConvertStatement(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "E" && TYPE2 == "E")
            {
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }

                else if (EType.ConvertStatement(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (EType.ConvertStatement(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "E" && TYPE2 == "O")
            {
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }

                else if (EType.ConvertStatement(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (OType.ConvertStatement(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "I" && TYPE2 == "O")//may exist complemetarypair
            {
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }

                else if (IType.ConvertStatement(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (OType.ConvertStatement(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }

                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "O" && TYPE2 == "A")
            {
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }

                else if (OType.ConvertStatement(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (AType.ConvertProposition(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "O" && TYPE2 == "E")
            {
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }

                else if (OType.ConvertStatement(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (EType.ConvertStatement(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "O" && TYPE2 == "I")
            {
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }

                else if (OType.ConvertStatement(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (IType.ConvertStatement(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }
            else if (TYPE1 == "O" && TYPE2 == "O")
            {
                if (result.ToUpper() == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }

                else if (OType.ConvertStatement(statement1) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else if (OType.ConvertStatement(statement2) == conclusion.ToUpper())
                {
                    result = VALIDCONCLUSION;
                }
                else
                {
                    result = CheckconclusionByConvertingResult(result, conclusion);
                }
            }

            else
            {
                return(NODEFINITECONCLUSION.Replace("<<TYPE1>>", TYPE1)
                       .Replace("<<TYPE2>>", TYPE2));
            }
            return(result);
        }