private static bool CheckIEPair(string c1, string c2) { if (IType.GetSubjectByStatement(c1) == EType.GetSubjectByStatement(c2) && IType.GetPredicateByStatement(c1) == EType.GetPredicateByStatement(c2)) { return(true); } return(false); }
public static string GetSubjectByProposition(string proposition) { if (AType.IsTrue(proposition)) { return(AType.GetSubjectByProposition(proposition)); } if (EType.IsTrue(proposition)) { return(EType.GetSubjectByStatement(proposition)); } if (IType.IsTrue(proposition)) { return(IType.GetSubjectByStatement(proposition)); } if (OType.IsTrue(proposition)) { return(OType.GetSubjectByStatement(proposition)); } return(INVALIDTYPE); }
public static string AddStatements(string statement1, string statement2) { TYPE1 = SyllogismRules.GetTypeByProposition(statement1); TYPE2 = SyllogismRules.GetTypeByProposition(statement2); STATEMENT1 = statement1; STATEMENT2 = statement2; if (TYPE1 == "A" && TYPE2 == "A") { if (CheckStatementsCanBeAligned(AType.GetSubjectByProposition(STATEMENT1), AType.GetPredicateByProposition(STATEMENT1), AType.GetSubjectByProposition(STATEMENT2), AType.GetPredicateByProposition(STATEMENT2))) { if (IsAligned(AType.GetPredicateByProposition(STATEMENT1), AType.GetSubjectByProposition(STATEMENT2))) { //return "A"; return(AType.GetPropositionBySubjectAndPredicate(AType.GetSubjectByProposition(STATEMENT1), AType.GetPredicateByProposition(STATEMENT2))); } if (ReArrangingOrder(STATEMENT1, STATEMENT2)) { if (IsAligned(AType.GetPredicateByProposition(STATEMENT1), AType.GetSubjectByProposition(STATEMENT2))) { //return "A"; return(AddStatementsAfterAlign(STATEMENT1, STATEMENT2)); } ReArrangingOrder(STATEMENT1, STATEMENT2); return(AlignStatementsByIEARule(STATEMENT1, AType.GetPropositionType(), STATEMENT2, AType.GetPropositionType()) ? AddStatementsAfterAlign(STATEMENT1, STATEMENT2) : CANNOTTALIGN); } } else { return(CANNOTTALIGN); } } else if (TYPE1 == "A" && TYPE2 == "E") { if (CheckStatementsCanBeAligned(AType.GetSubjectByProposition(STATEMENT1), AType.GetPredicateByProposition(STATEMENT1), EType.GetSubjectByStatement(STATEMENT2), EType.GetPredicateByStatement(STATEMENT2))) { if (IsAligned(AType.GetPredicateByProposition(STATEMENT1), EType.GetSubjectByStatement(STATEMENT2))) { //return "E"; return(EType.GetPropositionBySubjectAndPredicate(AType.GetSubjectByProposition(STATEMENT1), EType.GetPredicateByStatement(STATEMENT2))); } else if (ReArrangingOrder(STATEMENT1, STATEMENT2)) { if (IsAligned(AType.GetPredicateByProposition(STATEMENT1), EType.GetSubjectByStatement(STATEMENT2))) { //return "E"; return(AddStatementsAfterAlign(STATEMENT1, STATEMENT2)); } ReArrangingOrder(STATEMENT1, STATEMENT2); return(AlignStatementsByIEARule(STATEMENT1, AType.GetPropositionType(), STATEMENT2, EType.GetPropositionType()) ? AddStatementsAfterAlign(STATEMENT1, STATEMENT2) : CANNOTTALIGN); } } else { return(CANNOTTALIGN); } } else if (TYPE1 == "E" && TYPE2 == "A") { if (CheckStatementsCanBeAligned(EType.GetSubjectByStatement(STATEMENT1), EType.GetPredicateByStatement(STATEMENT1), AType.GetSubjectByProposition(STATEMENT2), AType.GetPredicateByProposition(STATEMENT2))) { if (IsAligned(EType.GetPredicateByStatement(STATEMENT1), AType.GetSubjectByProposition(STATEMENT2))) { //return "O*"; return(OType.GetStatementBySubjectAndPredicate(AType.GetPredicateByProposition(STATEMENT2), EType.GetSubjectByStatement(STATEMENT1))); } if (ReArrangingOrder(STATEMENT1, STATEMENT2)) { if (IsAligned(EType.GetPredicateByStatement(STATEMENT1), AType.GetSubjectByProposition(STATEMENT2))) { //return "O*"; return(AddStatementsAfterAlign(STATEMENT1, STATEMENT2)); } ReArrangingOrder(STATEMENT1, STATEMENT2); return(AlignStatementsByIEARule(STATEMENT1, EType.GetPropositionType(), STATEMENT2, AType.GetPropositionType()) ? AddStatementsAfterAlign(STATEMENT2, STATEMENT1) : CANNOTTALIGN); } } else { return(CANNOTTALIGN); } } else if (TYPE1 == "E" && TYPE2 == "I") { if (CheckStatementsCanBeAligned(EType.GetSubjectByStatement(STATEMENT1), EType.GetPredicateByStatement(STATEMENT1), IType.GetSubjectByStatement(STATEMENT2), IType.GetPredicateByStatement(STATEMENT2))) { if (IsAligned(EType.GetPredicateByStatement(STATEMENT1), IType.GetSubjectByStatement(STATEMENT2))) { //return "O*"; return(OType.GetStatementBySubjectAndPredicate(IType.GetPredicateByStatement(STATEMENT2), EType.GetSubjectByStatement(STATEMENT1))); } if (ReArrangingOrder(STATEMENT1, STATEMENT2)) { if (IsAligned(EType.GetPredicateByStatement(STATEMENT1), IType.GetSubjectByStatement(STATEMENT2))) { //return "O*"; return(AddStatementsAfterAlign(STATEMENT1, STATEMENT2)); } ReArrangingOrder(STATEMENT1, STATEMENT2); return(AlignStatementsByIEARule(STATEMENT1, EType.GetPropositionType(), STATEMENT2, IType.GetPropositionType()) ? AddStatementsAfterAlign(STATEMENT2, STATEMENT1) : CANNOTTALIGN); } } else { return(CANNOTTALIGN); } } else if (TYPE1 == "I" && TYPE2 == "A") { if (CheckStatementsCanBeAligned(IType.GetSubjectByStatement(STATEMENT1), IType.GetPredicateByStatement(STATEMENT1), AType.GetSubjectByProposition(STATEMENT2), AType.GetPredicateByProposition(STATEMENT2))) { if (IsAligned(IType.GetPredicateByStatement(STATEMENT1), AType.GetSubjectByProposition(STATEMENT2))) { // return "I"; return(IType.GetStatementBySubjectAndPredicate(IType.GetSubjectByStatement(STATEMENT1), AType.GetPredicateByProposition(STATEMENT2))); } if (ReArrangingOrder(STATEMENT1, STATEMENT2)) { if (IsAligned(IType.GetPredicateByStatement(STATEMENT1), AType.GetSubjectByProposition(STATEMENT2))) { // return "I"; return(AddStatementsAfterAlign(STATEMENT1, STATEMENT2)); } ReArrangingOrder(STATEMENT1, STATEMENT2); return(AlignStatementsByIEARule(STATEMENT1, IType.GetPropositionType(), STATEMENT2, AType.GetPropositionType()) ? AddStatementsAfterAlign(STATEMENT1, STATEMENT2) : CANNOTTALIGN); } } else { return(CANNOTTALIGN); } } else if (TYPE1 == "I" && TYPE2 == "E") { if (CheckStatementsCanBeAligned(IType.GetSubjectByStatement(STATEMENT1), IType.GetPredicateByStatement(STATEMENT1), EType.GetSubjectByStatement(statement2), EType.GetPredicateByStatement(statement2))) { if (IsAligned(IType.GetPredicateByStatement(STATEMENT1), EType.GetSubjectByStatement(statement2))) { // return "O"; return(OType.GetStatementBySubjectAndPredicate(IType.GetSubjectByStatement(STATEMENT1), EType.GetPredicateByStatement(statement2))); } if (ReArrangingOrder(STATEMENT1, STATEMENT2)) { if (IsAligned(IType.GetPredicateByStatement(STATEMENT1), EType.GetSubjectByStatement(statement2))) { //return "O"; return(AddStatementsAfterAlign(STATEMENT1, STATEMENT2)); } ReArrangingOrder(STATEMENT1, STATEMENT2); return(AlignStatementsByIEARule(STATEMENT1, IType.GetPropositionType(), STATEMENT2, EType.GetPropositionType()) ? AddStatementsAfterAlign(STATEMENT1, STATEMENT2) : CANNOTTALIGN); } } } else if (TYPE1 == "A" && TYPE2 == "I") { if (CheckStatementsCanBeAligned(AType.GetSubjectByProposition(STATEMENT1), AType.GetPredicateByProposition(STATEMENT1), IType.GetSubjectByStatement(STATEMENT2), IType.GetPredicateByStatement(STATEMENT2))) { if (IsAligned(AType.GetPredicateByProposition(STATEMENT1), IType.GetSubjectByStatement(STATEMENT2))) { //return "A"; //return AType.GetStatementBySubjectAndPredicate(AType.GetSubjectByStatement(STATEMENT1), AType.GetPredicateByStatement(STATEMENT2)); } else if (ReArrangingOrder(STATEMENT1, STATEMENT2)) { return(AddStatementsAfterAlign(STATEMENT1, STATEMENT2)); } } else { return(CANNOTTALIGN); } } return(NODEFINITECONCLUSION.Replace("<<TYPE1>>", TYPE1) .Replace("<<TYPE2>>", TYPE2)); }
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); }