// Numbas version: finer_feedback_settings {"name": "Truth tables 3 ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variablesTest": {"condition": "a1 <>b1 and a2<>b2 and\nif(a='p' or a='\\\\neg p',b=random('q','\\\\neg q'),b=random('p','\\\\neg p'))\n", "maxRuns": "150"}, "tags": [], "variables": {"ev3": {"description": "", "templateType": "anything", "group": "Third Bracket", "definition": "bool_to_label(pre_ev3)", "name": "ev3"}, "ev2": {"description": "", "templateType": "anything", "group": "Second Bracket", "definition": "bool_to_label(pre_ev2)", "name": "ev2"}, "a2": {"description": "", "templateType": "anything", "group": "Third Bracket", "definition": "latex(latex_symbol_list[s[4]])", "name": "a2"}, "disq": {"description": "", "templateType": "anything", "group": "Truth values", "definition": "bool_to_label(q)", "name": "disq"}, "pre_ev2": {"description": "", "templateType": "anything", "group": "Second Bracket", "definition": "map(evaluate(convch(a1)+\" \"+conv(op2)+\" \"+convch(b1),[p[t],q[t]]),t,0..3)", "name": "pre_ev2"}, "op2": {"description": "", "templateType": "anything", "group": "Second Bracket", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "name": "op2"}, "disp": {"description": "", "templateType": "anything", "group": "Truth values", "definition": "bool_to_label(p)", "name": "disp"}, "op": {"description": "", "templateType": "anything", "group": "First Bracket", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "name": "op"}, "a1": {"description": "", "templateType": "anything", "group": "Second Bracket", "definition": "latex(latex_symbol_list[s[2]])", "name": "a1"}, "op1": {"description": "", "templateType": "anything", "group": "First and Second Brackets", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "name": "op1"}, "b2": {"description": "", "templateType": "anything", "group": "Third Bracket", "definition": "latex(latex_symbol_list[s[5]])", "name": "b2"}, "p": {"description": "", "templateType": "anything", "group": "Truth values", "definition": "[true,true,false,false]", "name": "p"}, "pre_t_value": {"description": "", "templateType": "anything", "group": "First and Second Brackets", "definition": "map(evaluate(pre_ev1[t]+\" \"+conv(op1)+\" \"+pre_ev2[t],[]),t,0..3)", "name": "pre_t_value"}, "op4": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "name": "op4"}, "latex_symbol_list": {"description": "", "templateType": "anything", "group": "Lists of symbols", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "name": "latex_symbol_list"}, "op3": {"description": "", "templateType": "anything", "group": "Third Bracket", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "name": "op3"}, "pre_ev1": {"description": "", "templateType": "anything", "group": "First Bracket", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)", "name": "pre_ev1"}, "b": {"description": "", "templateType": "anything", "group": "First Bracket", "definition": "latex(latex_symbol_list[s[1]])", "name": "b"}, "pre_ev3": {"description": "", "templateType": "anything", "group": "Third Bracket", "definition": "map(evaluate(convch(a2)+\" \"+conv(op3)+\" \"+convch(b2),[p[t],q[t]]),t,0..3)", "name": "pre_ev3"}, "logic_symbol_list": {"description": "", "templateType": "anything", "group": "Lists of symbols", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "name": "logic_symbol_list"}, "t_value": {"description": "", "templateType": "anything", "group": "First and Second Brackets", "definition": "bool_to_label(pre_t_value)", "name": "t_value"}, "s": {"description": "", "templateType": "anything", "group": "Lists of symbols", "definition": "repeat(random(0..3),6)", "name": "s"}, "ev1": {"description": "", "templateType": "anything", "group": "First Bracket", "definition": "bool_to_label(pre_ev1)", "name": "ev1"}, "final_value": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "bool_to_label(map(evaluate(pre_t_value[t]+\" \"+conv(op4)+\" \"+pre_ev3[t],[]),t,0..3))", "name": "final_value"}, "a": {"description": "", "templateType": "anything", "group": "First Bracket", "definition": "latex(latex_symbol_list[s[0]])", "name": "a"}, "b1": {"description": "", "templateType": "anything", "group": "Second Bracket", "definition": "latex(latex_symbol_list[s[3]])", "name": "b1"}, "q": {"description": "", "templateType": "anything", "group": "Truth values", "definition": "[true,false,true,false]", "name": "q"}}, "name": "Truth tables 3 ", "advice": "
First we find the truth table for $\\var{a} \\var{op} \\var{b}$:
\n$p$ | $q$ | $\\var{a} \\var{op} \\var{b}$ |
---|---|---|
$\\var{disp[0]}$ | \n$\\var{disq[0]}$ | \n$\\var{ev1[0]}$ | \n
$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n$\\var{ev1[1]}$ | \n
$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n$\\var{ev1[2]}$ | \n
$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n$\\var{ev1[3]}$ | \n
Then the truth table for $\\var{a1} \\var{op2} \\var{b1}$:
\n$p$ | $q$ | $\\var{a1} \\var{op2} \\var{b1}$ |
---|---|---|
$\\var{disp[0]}$ | \n$\\var{disq[0]}$ | \n$\\var{ev2[0]}$ | \n
$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n$\\var{ev2[1]}$ | \n
$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n$\\var{ev2[2]}$ | \n
$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n$\\var{ev2[3]}$ | \n
Putting these together to find $(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$:
\n\n$p$ | $q$ | $\\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{disp[0]}$ | \n$\\var{disq[0]}$ | \n$\\var{ev1[0]}$ | \n$\\var{ev2[0]}$ | \n$\\var{t_value[0]}$ | \n
$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n$\\var{ev1[1]}$ | \n$\\var{ev2[1]}$ | \n$\\var{t_value[1]}$ | \n
$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n$\\var{ev1[2]}$ | \n$\\var{ev2[2]}$ | \n$\\var{t_value[2]}$ | \n
$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n$\\var{ev1[3]}$ | \n$\\var{ev2[3]}$ | \n$\\var{t_value[3]}$ | \n
Next we find the truth table for $\\var{a2} \\var{op3} \\var{b2}$:
\n$p$ | $q$ | $\\var{a2} \\var{op3} \\var{b2}$ |
---|---|---|
$\\var{disp[0]}$ | \n$\\var{disq[0]}$ | \n$\\var{ev3[0]}$ | \n
$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n$\\var{ev3[1]}$ | \n
$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n$\\var{ev3[2]}$ | \n
$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n$\\var{ev3[3]}$ | \n
Putting this all together to obtain the truth table we want:
\n$p$ | $q$ | $(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$ | $\\var{a2} \\var{op3} \\var{b2}$ | $((\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}(\\var{a2} \\var{op3} \\var{b2})$ |
---|---|---|---|---|
$\\var{disp[0]}$ | \n$\\var{disq[0]}$ | \n$\\var{t_value[0]}$ | \n$\\var{ev3[0]}$ | \n$\\var{final_value[0]}$ | \n
$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n$\\var{t_value[1]}$ | \n$\\var{ev3[1]}$ | \n$\\var{final_value[1]}$ | \n
$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n$\\var{t_value[2]}$ | \n$\\var{ev3[2]}$ | \n$\\var{final_value[2]}$ | \n
$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n$\\var{t_value[3]}$ | \n$\\var{ev3[3]}$ | \n$\\var{final_value[3]}$ | \n
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} \\var{op3} \\var{b2}).\\]
\n\nEnter T if true, else enter F.
\n\n\n\n\n\n\n\n\n\n\n", "variable_groups": [{"variables": ["logic_symbol_list", "latex_symbol_list", "s"], "name": "Lists of symbols"}, {"variables": ["a", "b", "op", "pre_ev1", "ev1"], "name": "First Bracket"}, {"variables": ["a1", "b1", "op2", "pre_ev2", "ev2"], "name": "Second Bracket"}, {"variables": ["p", "q", "disp", "disq"], "name": "Truth values"}, {"variables": ["a2", "b2", "op3", "pre_ev3", "ev3"], "name": "Third Bracket"}, {"variables": ["op1", "pre_t_value", "t_value"], "name": "First and Second Brackets"}], "metadata": {"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 \\operatorname{op5} f) $ where each of $a, \\;b,\\;c,\\;d,\\;e,\\;f$ can be one the Boolean variables $p,\\;q,\\;\\neg p,\\;\\neg q$ and each of $\\operatorname{op1},\\;\\operatorname{op2},\\;\\operatorname{op3},\\;\\operatorname{op4},\\;\\operatorname{op5}$ one of $\\lor,\\;\\land,\\;\\to$.
\nFor example: $((q \\lor \\neg p) \\to (p \\land \\neg q)) \\to (p \\lor q)$
", "licence": "Creative Commons Attribution 4.0 International"}, "parts": [{"showCorrectAnswer": true, "marks": 0, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "gaps": [{"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{ev1[0]}", "showFeedbackIcon": true, "answer": "{ev1[0]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{ev1[1]}", "showFeedbackIcon": true, "answer": "{ev1[1]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{ev1[2]}", "showFeedbackIcon": true, "answer": "{ev1[2]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{ev1[3]}", "showFeedbackIcon": true, "answer": "{ev1[3]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{ev2[0]}", "showFeedbackIcon": true, "answer": "{ev2[0]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{ev2[1]}", "showFeedbackIcon": true, "answer": "{ev2[1]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{ev2[2]}", "showFeedbackIcon": true, "answer": "{ev2[2]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{ev2[3]}", "showFeedbackIcon": true, "answer": "{ev2[3]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{t_value[0]}", "showFeedbackIcon": true, "answer": "{t_value[0]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{t_value[1]}", "showFeedbackIcon": true, "answer": "{t_value[1]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{t_value[2]}", "showFeedbackIcon": true, "answer": "{t_value[2]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{t_value[3]}", "showFeedbackIcon": true, "answer": "{t_value[3]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{ev3[0]}", "showFeedbackIcon": true, "answer": "{ev3[0]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{ev3[1]}", "showFeedbackIcon": true, "answer": "{ev3[1]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{ev3[2]}", "showFeedbackIcon": true, "answer": "{ev3[2]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{ev3[3]}", "showFeedbackIcon": true, "answer": "{ev3[3]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{final_value[0]}", "showFeedbackIcon": true, "answer": "{final_value[0]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{final_value[1]}", "showFeedbackIcon": true, "answer": "{final_value[1]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{final_value[2]}", "showFeedbackIcon": true, "answer": "{final_value[2]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "marks": 1, "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "matchMode": "regex", "displayAnswer": "{final_value[3]}", "showFeedbackIcon": true, "answer": "{final_value[3]}", "variableReplacementStrategy": "originalfirst", "unitTests": []}], "type": "gapfill", "unitTests": [], "sortAnswers": false, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "prompt": "Complete the following truth table:
\n$p$ | $q$ | $\\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{a2} \\var{op3} \\var{b2}$ | $((\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}(\\var{a2} \\var{op3} \\var{b2})$ |
---|---|---|---|---|---|---|
$\\var{disp[0]}$ | \n$\\var{disq[0]}$ | \n[[0]] | \n[[4]] | \n[[8]] | \n[[12]] | \n[[16]] | \n
$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n[[1]] | \n[[5]] | \n[[9]] | \n[[13]] | \n[[17]] | \n
$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n[[2]] | \n[[6]] | \n[[10]] | \n[[14]] | \n[[18]] | \n
$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n[[3]] | \n[[7]] | \n[[11]] | \n[[15]] | \n[[19]] | \n