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); }
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); }
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 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); }