Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.58 KB | None | 0 0
  1. void firstSituation(int numOfVar, expression* expr) {
  2.     switch (numOfVar) {
  3.         case 1:
  4.             if (truthTable[0]){ //общедоказуемо
  5.                 vector <string> G;
  6.                 deductor(G, "!A", doc, docs[0]); // возможно, нужно поменять местами
  7.                 deductor(G, "A", doc, docs[1]);
  8.                 addEightAxiom(doc, new variable((string &) "A"), expr);
  9.                 printAnswer({}, expr, doc);
  10.             } else {
  11.                 printAnswer({"A"}, expr, docs[1]);
  12.             }
  13.             break;
  14.         case 2:
  15.             if (truthTable[2]) {
  16.                 vector <string> G = {"B"};
  17.                 vector <expression* >tmp;
  18.                 deductor(G, "!A", tmp, docs[2]);
  19.                 deductor(G, "A", tmp, docs[3]);
  20.                 addEightAxiom(tmp, new variable((string &) "A"), expr);
  21.                 if (truthTable[1]) {
  22.                     vector <expression*> tmp2;
  23.                     deductor(G, "!A", tmp2, docs[0]);
  24.                     deductor(G, "A", tmp2, docs[1]);
  25.                     addEightAxiom(tmp2, new variable((string &) "A"), expr);
  26.                     G.clear();
  27.                     deductor(G, "!B", doc, tmp2);
  28.                     deductor(G, "B", doc, tmp);
  29.                     addEightAxiom(doc, new variable((string &) "B"), expr);
  30.                     printAnswer({}, expr, doc);
  31.                     return;
  32.                 }
  33.                 printAnswer({"B"}, expr, tmp);
  34.             } else if (truthTable[1]) {
  35.                 vector <string> G = {"A"};
  36.                 deductor(G, "!B", doc, docs[1]);
  37.                 deductor(G, "B", doc, docs[3]);
  38.                 addEightAxiom(doc, new variable((string &) "B"), expr);
  39.                 printAnswer({"A"}, expr, doc);
  40.                 return;
  41.             } else {
  42.                 printAnswer({"A", "B", "C"}, expr, docs[3]);
  43.             }
  44.             break;
  45.         case 3:
  46.             if (truthTable[6]) {
  47.                 vector <string> G = {"B", "C"};
  48.                 vector <expression* >tmp;
  49.                 deductor(G, "!A", tmp, docs[6]);
  50.                 deductor(G, "A", tmp, docs[7]);
  51.                 addEightAxiom(tmp, new variable((string &) "A"), expr);
  52.                 if (truthTable[5]) {
  53.                     vector <expression*> tmp2;
  54.                     deductor(G, "!A", tmp2, docs[4]);
  55.                     deductor(G, "A", tmp2, docs[5]);
  56.                     addEightAxiom(tmp2, new variable((string &) "A"), expr);
  57.                     G = {"C"};
  58.                     vector <expression*> tmp3;
  59.                     deductor(G, "!B", tmp3, tmp2);
  60.                     deductor(G, "B", tmp3, tmp);
  61.                     addEightAxiom(tmp3, new variable((string &) "B"), expr);
  62.                     if (truthTable[3]) {
  63.                         G = {"B", "C"};
  64.                         vector <expression*> tmp4;
  65.                         deductor(G, "!A", tmp4, docs[2]);
  66.                         deductor(G, "A", tmp4, docs[3]);
  67.                         addEightAxiom(tmp4, new variable((string &) "A"), expr);
  68.                         vector <expression*> tmp5;
  69.                         deductor(G, "!A", tmp5, docs[0]);
  70.                         deductor(G, "A", tmp5, docs[1]);
  71.                         addEightAxiom(tmp5, new variable((string &) "A"), expr);
  72.                         vector <expression *> tmp6;
  73.                         G = {"C"};
  74.                         deductor(G, "!B", tmp6, tmp4);
  75.                         deductor(G, "B", tmp6, tmp5);
  76.                         addEightAxiom(tmp6, new variable((string &) "B"), expr);
  77.                         G.clear();
  78.                         vector<expression*> nmp7;
  79.                         deductor(G, "!C", doc, tmp6);
  80.                         deductor(G, "C", doc, tmp3);
  81.                         addEightAxiom(doc, new variable((string &) "C"), expr);
  82.                         printAnswer({}, expr, doc);
  83.                         return;
  84.                     }
  85.                     printAnswer(G, expr, tmp3);
  86.                     return;
  87.                 }
  88.                 printAnswer(G, expr, tmp);
  89.                 return;
  90.             }
  91.             if (truthTable[5]) {
  92.                 vector <string> G = {"A", "C"};
  93.                 vector <expression*> tmp;
  94.                 deductor(G, "!B", tmp, docs[5]);
  95.                 deductor(G, "B", tmp, docs[7]);
  96.                 addEightAxiom(tmp, new variable((string &) "B"), expr);
  97.                 if (truthTable[3]) {
  98.                     G = {"A", "C"};
  99.                     vector <expression*> tmp2;
  100.                     deductor(G, "!B", tmp2, docs[2]);
  101.                     deductor(G, "B", tmp2, docs[4]);
  102.                     addEightAxiom(tmp2, new variable((string &) "B"), expr);
  103.                     G = {"A"};
  104.                     deductor(G, "!C", doc, tmp2);
  105.                     deductor(G, "C", doc, tmp);
  106.                     addEightAxiom(doc, new variable((string &) "B"), expr);
  107.                     printAnswer(G, expr, doc);
  108.                     return;
  109.                 }
  110.                 printAnswer(G, expr, tmp);
  111.                 return;
  112.             }
  113.             if (truthTable[3]){
  114.                 vector <string> G = {"A", "B"};
  115.                 deductor(G, "!C", doc, docs[3]);
  116.                 deductor(G, "C", doc, docs[7]);
  117.                 addEightAxiom(doc, new variable((string &) "C"), expr);
  118.                 printAnswer(G, expr, doc);
  119.                 return;
  120.             }
  121.             printAnswer({"A", "B", "C"}, expr, docs[7]);
  122.             break;
  123.         default:
  124.             break;
  125.     }
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement