// Numbas version: finer_feedback_settings {"name": "Luis's copy of Truth tables 4 (v2)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"statement": "
In the following question you are asked to construct a truth table for:
\n\\[((\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}\\var{a2}.\\]
\n\nEnter T if true, else enter F.
\n\n\n\n\n\n\n\n\n\n\n", "variablesTest": {"maxRuns": "150", "condition": "a1 <>b1 and\nif(a='p' or a='\\\\neg p',b=random('q','\\\\neg q'),b=random('p','\\\\neg p'))\n"}, "tags": [], "metadata": {"notes": "", "description": "Create a truth table for a logical expression of the form $((a \\operatorname{op1} b) \\operatorname{op2}(c \\operatorname{op3} d))\\operatorname{op4}e $ where each of $a, \\;b,\\;c,\\;d,\\;e$ can be one the Boolean variables $p,\\;q,\\;r,\\;\\neg p,\\;\\neg q,\\;\\neg r$ and each of $\\operatorname{op1},\\;\\operatorname{op2},\\;\\operatorname{op3},\\;\\operatorname{op4}$ one of $\\lor,\\;\\land,\\;\\to$.
\nFor example: $((q \\lor \\neg r) \\to (p \\land \\neg q)) \\land \\neg r$
", "licence": "Creative Commons Attribution 4.0 International"}, "parts": [{"variableReplacements": [], "gaps": [{"variableReplacements": [], "answer": "{final_value[0]}", "marks": 1, "type": "patternmatch", "showCorrectAnswer": true, "scripts": {}, "displayAnswer": "{final_value[0]}", "variableReplacementStrategy": "originalfirst"}, {"variableReplacements": [], "answer": "{final_value[1]}", "marks": 1, "type": "patternmatch", "showCorrectAnswer": true, "scripts": {}, "displayAnswer": "{final_value[1]}", "variableReplacementStrategy": "originalfirst"}, {"variableReplacements": [], "answer": "{final_value[2]}", "marks": 1, "type": "patternmatch", "showCorrectAnswer": true, "scripts": {}, "displayAnswer": "{final_value[2]}", "variableReplacementStrategy": "originalfirst"}, {"variableReplacements": [], "answer": "{final_value[3]}", "marks": 1, "type": "patternmatch", "showCorrectAnswer": true, "scripts": {}, "displayAnswer": "{final_value[3]}", "variableReplacementStrategy": "originalfirst"}, {"variableReplacements": [], "answer": "{final_value[4]}", "marks": 1, "type": "patternmatch", "showCorrectAnswer": true, "scripts": {}, "displayAnswer": "{final_value[4]}", "variableReplacementStrategy": "originalfirst"}, {"variableReplacements": [], "answer": "{final_value[5]}", "marks": 1, "type": "patternmatch", "showCorrectAnswer": true, "scripts": {}, "displayAnswer": "{final_value[5]}", "variableReplacementStrategy": "originalfirst"}, {"variableReplacements": [], "answer": "{final_value[6]}", "marks": 1, "type": "patternmatch", "showCorrectAnswer": true, "scripts": {}, "displayAnswer": "{final_value[6]}", "variableReplacementStrategy": "originalfirst"}, {"variableReplacements": [], "answer": "{final_value[7]}", "marks": 1, "type": "patternmatch", "showCorrectAnswer": true, "scripts": {}, "displayAnswer": "{final_value[7]}", "variableReplacementStrategy": "originalfirst"}], "marks": 0, "type": "gapfill", "showCorrectAnswer": true, "scripts": {}, "prompt": "Complete the following truth table:
\n$p$ | $q$ | $r$ | $((\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}\\var{a2} $ |
---|---|---|---|
$\\var{p[0]}$ | \n$\\var{q[0]}$ | \n$\\var{r[0]}$ | \n[[0]] | \n
$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n$\\var{r[1]}$ | \n[[1]] | \n
$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n$\\var{r[2]}$ | \n[[2]] | \n
$\\var{p[3]}$ | \n$\\var{q[3]}$ | \n$\\var{r[3]}$ | \n[[3]] | \n
$\\var{p[4]}$ | \n$\\var{q[4]}$ | \n$\\var{r[4]}$ | \n[[4]] | \n
$\\var{p[5]}$ | \n$\\var{q[5]}$ | \n$\\var{r[5]}$ | \n[[5]] | \n
$\\var{p[6]}$ | \n$\\var{q[6]}$ | \n$\\var{r[6]}$ | \n[[6]] | \n
$\\var{p[7]}$ | \n$\\var{q[7]}$ | \n$\\var{r[7]}$ | \n[[7]] | \n
First we find the truth table for $\\var{a} \\var{op} \\var{b}$:
\n$p$ | $q$ | $r$ | $\\var{a} \\var{op} \\var{b}$ |
---|---|---|---|
$\\var{p[0]}$ | \n$\\var{q[0]}$ | \n$\\var{r[0]}$ | \n$\\var{ev1[0]}$ | \n
$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n$\\var{r[1]}$ | \n$\\var{ev1[1]}$ | \n
$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n$\\var{r[2]}$ | \n$\\var{ev1[2]}$ | \n
$\\var{p[3]}$ | \n$\\var{q[3]}$ | \n$\\var{r[3]}$ | \n$\\var{ev1[3]}$ | \n
$\\var{p[4]}$ | \n$\\var{q[4]}$ | \n$\\var{r[4]}$ | \n$\\var{ev1[4]}$ | \n
$\\var{p[5]}$ | \n$\\var{q[5]}$ | \n$\\var{r[5]}$ | \n$\\var{ev1[5]}$ | \n
$\\var{p[6]}$ | \n$\\var{q[6]}$ | \n$\\var{r[6]}$ | \n$\\var{ev1[6]}$ | \n
$\\var{p[7]}$ | \n$\\var{q[7]}$ | \n$\\var{r[7]}$ | \n$\\var{ev1[7]}$ | \n
Then the truth table for $\\var{a1} \\var{op2} \\var{b1}$:
\n$p$ | $q$ | $r$ | $\\var{a1} \\var{op2} \\var{b1}$ |
---|---|---|---|
$\\var{p[0]}$ | \n$\\var{q[0]}$ | \n$\\var{r[0]}$ | \n$\\var{ev2[0]}$ | \n
$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n$\\var{r[1]}$ | \n$\\var{ev2[1]}$ | \n
$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n$\\var{r[2]}$ | \n$\\var{ev2[2]}$ | \n
$\\var{p[3]}$ | \n$\\var{q[3]}$ | \n$\\var{r[3]}$ | \n$\\var{ev2[3]}$ | \n
$\\var{p[4]}$ | \n$\\var{q[4]}$ | \n$\\var{r[4]}$ | \n$\\var{ev2[4]}$ | \n
$\\var{p[5]}$ | \n$\\var{q[5]}$ | \n$\\var{r[5]}$ | \n$\\var{ev2[5]}$ | \n
$\\var{p[6]}$ | \n$\\var{q[6]}$ | \n$\\var{r[6]}$ | \n$\\var{ev2[6]}$ | \n
$\\var{p[7]}$ | \n$\\var{q[7]}$ | \n$\\var{r[7]}$ | \n$\\var{ev2[7]}$ | \n
Putting these together to find $(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$:
\n\n$p$ | $q$ | $r$ | $\\var{a} \\var{op} \\var{b}$ | $\\var{a1} \\var{op2} \\var{b1}$ | $(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$ |
---|---|---|---|---|---|
$\\var{p[0]}$ | \n$\\var{q[0]}$ | \n$\\var{r[0]}$ | \n$\\var{ev1[0]}$ | \n$\\var{ev2[0]}$ | \n$\\var{t_value[0]}$ | \n
$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n$\\var{r[1]}$ | \n$\\var{ev1[1]}$ | \n$\\var{ev2[1]}$ | \n$\\var{t_value[1]}$ | \n
$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n$\\var{r[2]}$ | \n$\\var{ev1[2]}$ | \n$\\var{ev2[2]}$ | \n$\\var{t_value[2]}$ | \n
$\\var{p[3]}$ | \n$\\var{q[3]}$ | \n$\\var{r[3]}$ | \n$\\var{ev1[3]}$ | \n$\\var{ev2[3]}$ | \n$\\var{t_value[3]}$ | \n
$\\var{p[4]}$ | \n$\\var{q[4]}$ | \n$\\var{r[4]}$ | \n$\\var{ev1[4]}$ | \n$\\var{ev2[4]}$ | \n$\\var{t_value[4]}$ | \n
$\\var{p[5]}$ | \n$\\var{q[5]}$ | \n$\\var{r[5]}$ | \n$\\var{ev1[5]}$ | \n$\\var{ev2[5]}$ | \n$\\var{t_value[5]}$ | \n
$\\var{p[6]}$ | \n$\\var{q[6]}$ | \n$\\var{r[6]}$ | \n$\\var{ev1[6]}$ | \n$\\var{ev2[6]}$ | \n$\\var{t_value[6]}$ | \n
$\\var{p[7]}$ | \n$\\var{q[7]}$ | \n$\\var{r[7]}$ | \n$\\var{ev1[7]}$ | \n$\\var{ev2[7]}$ | \n$\\var{t_value[7]}$ | \n
Next we find the truth table for $\\var{a2}$:
\n$\\var{c2}$ | $\\var{a2}$ |
---|---|
$\\var{d2[0]}$ | \n$\\var{ev3[0]}$ | \n
$\\var{d2[1]}$ | \n\n$\\var{ev3[1]}$ | \n
$\\var{d2[2]}$ | \n\n$\\var{ev3[2]}$ | \n
$\\var{d2[3]}$ | \n\n$\\var{ev3[3]}$ | \n
$\\var{d2[4]}$ | \n\n$\\var{ev3[4]}$ | \n
$\\var{d2[5]}$ | \n\n$\\var{ev3[5]}$ | \n
$\\var{d2[6]}$ | \n\n$\\var{ev3[6]}$ | \n
$\\var{d2[7]}$ | \n\n$\\var{ev3[7]}$ | \n
Putting this all together to obtain the truth table we want:
\n$p$ | $q$ | $r$ | $(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$ | $\\var{a2}$ | $((\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}\\var{a2} $ |
---|---|---|---|---|---|
$\\var{p[0]}$ | \n$\\var{q[0]}$ | \n$\\var{r[0]}$ | \n$\\var{t_value[0]}$ | \n$\\var{ev3[0]}$ | \n$\\var{final_value[0]}$ | \n
$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n$\\var{r[1]}$ | \n$\\var{t_value[1]}$ | \n$\\var{ev3[1]}$ | \n$\\var{final_value[1]}$ | \n
$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n$\\var{r[2]}$ | \n$\\var{t_value[2]}$ | \n$\\var{ev3[2]}$ | \n$\\var{final_value[2]}$ | \n
$\\var{p[3]}$ | \n$\\var{q[3]}$ | \n$\\var{r[3]}$ | \n$\\var{t_value[3]}$ | \n$\\var{ev3[3]}$ | \n$\\var{final_value[3]}$ | \n
$\\var{p[4]}$ | \n$\\var{q[4]}$ | \n$\\var{r[4]}$ | \n$\\var{t_value[4]}$ | \n$\\var{ev3[4]}$ | \n$\\var{final_value[4]}$ | \n
$\\var{p[5]}$ | \n$\\var{q[5]}$ | \n$\\var{r[5]}$ | \n$\\var{t_value[5]}$ | \n$\\var{ev3[5]}$ | \n$\\var{final_value[5]}$ | \n
$\\var{p[6]}$ | \n$\\var{q[6]}$ | \n$\\var{r[6]}$ | \n$\\var{t_value[6]}$ | \n$\\var{ev3[6]}$ | \n$\\var{final_value[6]}$ | \n
$\\var{p[7]}$ | \n$\\var{q[7]}$ | \n$\\var{r[7]}$ | \n$\\var{t_value[7]}$ | \n$\\var{ev3[7]}$ | \n$\\var{final_value[7]}$ | \n