// Numbas version: finer_feedback_settings {"name": "Louise's copy of Marie's copy of Truth tables 3 (v2)-", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"advice": "

First we find the truth table for $\\var{a} \\var{op} \\var{b}$:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a} \\var{op} \\var{b}$
$\\var{disp[0]}$$\\var{disq[0]}$$\\var{ev1[0]}$
$\\var{disp[1]}$$\\var{disq[1]}$$\\var{ev1[1]}$
$\\var{disp[2]}$$\\var{disq[2]}$$\\var{ev1[2]}$
$\\var{disp[3]}$$\\var{disq[3]}$$\\var{ev1[3]}$
\n

Then the truth table for $\\var{a1} \\var{op2} \\var{b1}$:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a1} \\var{op2} \\var{b1}$
$\\var{disp[0]}$$\\var{disq[0]}$$\\var{ev2[0]}$
$\\var{disp[1]}$$\\var{disq[1]}$$\\var{ev2[1]}$
$\\var{disp[2]}$$\\var{disq[2]}$$\\var{ev2[2]}$
$\\var{disp[3]}$$\\var{disq[3]}$$\\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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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]}$$\\var{disq[0]}$$\\var{ev1[0]}$$\\var{ev2[0]}$$\\var{t_value[0]}$
$\\var{disp[1]}$$\\var{disq[1]}$$\\var{ev1[1]}$$\\var{ev2[1]}$$\\var{t_value[1]}$
$\\var{disp[2]}$$\\var{disq[2]}$$\\var{ev1[2]}$$\\var{ev2[2]}$$\\var{t_value[2]}$
$\\var{disp[3]}$$\\var{disq[3]}$$\\var{ev1[3]}$$\\var{ev2[3]}$$\\var{t_value[3]}$
\n

Next we find the truth table for $\\var{a2} \\var{op3} \\var{b2}$:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a2} \\var{op3} \\var{b2}$
$\\var{disp[0]}$$\\var{disq[0]}$$\\var{ev3[0]}$
$\\var{disp[1]}$$\\var{disq[1]}$$\\var{ev3[1]}$
$\\var{disp[2]}$$\\var{disq[2]}$$\\var{ev3[2]}$
$\\var{disp[3]}$$\\var{disq[3]}$$\\var{ev3[3]}$
\n

Putting this all together to obtain the truth table we want:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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]}$$\\var{disq[0]}$$\\var{t_value[0]}$$\\var{ev3[0]}$$\\var{final_value[0]}$
$\\var{disp[1]}$$\\var{disq[1]}$$\\var{t_value[1]}$$\\var{ev3[1]}$$\\var{final_value[1]}$
$\\var{disp[2]}$$\\var{disq[2]}$$\\var{t_value[2]}$$\\var{ev3[2]}$$\\var{final_value[2]}$
$\\var{disp[3]}$$\\var{disq[3]}$$\\var{t_value[3]}$$\\var{ev3[3]}$$\\var{final_value[3]}$
", "showQuestionGroupNames": false, "question_groups": [{"questions": [], "pickQuestions": 0, "pickingStrategy": "all-ordered", "name": ""}], "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"}, "name": "Louise's copy of Marie's copy of Truth tables 3 (v2)-", "tags": [], "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$.

\n

For example: $((q \\lor \\neg p) \\to (p \\land \\neg q)) \\to (p \\lor q)$

", "notes": "", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "variables": {"final_value": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "bool_to_label(map(evaluate(pre_t_value[t]+\" \"+conv(op4)+\" \"+pre_ev3[t],[]),t,0..3))", "name": "final_value"}, "a1": {"description": "", "group": "Second Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[2]])", "name": "a1"}, "op1": {"description": "", "group": "First and Second Brackets", "templateType": "anything", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "name": "op1"}, "a2": {"description": "", "group": "Third Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[4]])", "name": "a2"}, "ev2": {"description": "", "group": "Second Bracket", "templateType": "anything", "definition": "bool_to_label(pre_ev2)", "name": "ev2"}, "b1": {"description": "", "group": "Second Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[3]])", "name": "b1"}, "ev1": {"description": "", "group": "First Bracket", "templateType": "anything", "definition": "bool_to_label(pre_ev1)", "name": "ev1"}, "latex_symbol_list": {"description": "", "group": "Lists of symbols", "templateType": "anything", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "name": "latex_symbol_list"}, "pre_ev3": {"description": "", "group": "Third Bracket", "templateType": "anything", "definition": "map(evaluate(convch(a2)+\" \"+conv(op3)+\" \"+convch(b2),[p[t],q[t]]),t,0..3)", "name": "pre_ev3"}, "b2": {"description": "", "group": "Third Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[5]])", "name": "b2"}, "pre_t_value": {"description": "", "group": "First and Second Brackets", "templateType": "anything", "definition": "map(evaluate(pre_ev1[t]+\" \"+conv(op1)+\" \"+pre_ev2[t],[]),t,0..3)", "name": "pre_t_value"}, "pre_ev2": {"description": "", "group": "Second Bracket", "templateType": "anything", "definition": "map(evaluate(convch(a1)+\" \"+conv(op2)+\" \"+convch(b1),[p[t],q[t]]),t,0..3)", "name": "pre_ev2"}, "p": {"description": "", "group": "Truth values", "templateType": "anything", "definition": "[true,true,false,false]", "name": "p"}, "s": {"description": "", "group": "Lists of symbols", "templateType": "anything", "definition": "repeat(random(0..3),6)", "name": "s"}, "op3": {"description": "", "group": "Third Bracket", "templateType": "anything", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "name": "op3"}, "a": {"description": "", "group": "First Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[0]])", "name": "a"}, "ev3": {"description": "", "group": "Third Bracket", "templateType": "anything", "definition": "bool_to_label(pre_ev3)", "name": "ev3"}, "t_value": {"description": "", "group": "First and Second Brackets", "templateType": "anything", "definition": "bool_to_label(pre_t_value)", "name": "t_value"}, "disp": {"description": "", "group": "Truth values", "templateType": "anything", "definition": "bool_to_label(p)", "name": "disp"}, "disq": {"description": "", "group": "Truth values", "templateType": "anything", "definition": "bool_to_label(q)", "name": "disq"}, "b": {"description": "", "group": "First Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[1]])", "name": "b"}, "op": {"description": "", "group": "First Bracket", "templateType": "anything", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "name": "op"}, "pre_ev1": {"description": "", "group": "First Bracket", "templateType": "anything", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)", "name": "pre_ev1"}, "q": {"description": "", "group": "Truth values", "templateType": "anything", "definition": "[true,false,true,false]", "name": "q"}, "op2": {"description": "", "group": "Second Bracket", "templateType": "anything", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "name": "op2"}, "op4": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "name": "op4"}, "logic_symbol_list": {"description": "", "group": "Lists of symbols", "templateType": "anything", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "name": "logic_symbol_list"}}, "parts": [{"variableReplacementStrategy": "originalfirst", "gaps": [{"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{ev1[0]}", "answer": "{ev1[0]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{ev1[1]}", "answer": "{ev1[1]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{ev1[2]}", "answer": "{ev1[2]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{ev1[3]}", "answer": "{ev1[3]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{ev2[0]}", "answer": "{ev2[0]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{ev2[1]}", "answer": "{ev2[1]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{ev2[2]}", "answer": "{ev2[2]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{ev2[3]}", "answer": "{ev2[3]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{t_value[0]}", "answer": "{t_value[0]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{t_value[1]}", "answer": "{t_value[1]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{t_value[2]}", "answer": "{t_value[2]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{t_value[3]}", "answer": "{t_value[3]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{ev3[0]}", "answer": "{ev3[0]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{ev3[1]}", "answer": "{ev3[1]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{ev3[2]}", "answer": "{ev3[2]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{ev3[3]}", "answer": "{ev3[3]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{final_value[0]}", "answer": "{final_value[0]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{final_value[1]}", "answer": "{final_value[1]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{final_value[2]}", "answer": "{final_value[2]}", "variableReplacements": [], "marks": 1}, {"variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "type": "patternmatch", "displayAnswer": "{final_value[3]}", "answer": "{final_value[3]}", "variableReplacements": [], "marks": 1}], "scripts": {}, "type": "gapfill", "marks": 0, "showCorrectAnswer": true, "variableReplacements": [], "prompt": "

Complete the following truth table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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{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]}$$\\var{disq[0]}$[[0]][[4]][[8]][[12]][[16]]
$\\var{disp[1]}$$\\var{disq[1]}$[[1]][[5]][[9]][[13]][[17]]
$\\var{disp[2]}$$\\var{disq[2]}$[[2]][[6]][[10]][[14]][[18]]
$\\var{disp[3]}$$\\var{disq[3]}$[[3]][[7]][[11]][[15]][[19]]
"}], "rulesets": {}, "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"}], "functions": {"convch": {"parameters": [["ch", "string"]], "type": "string", "definition": "switch(ch=\"\\\\neg p\",\"not p[t]\",ch=\"\\\\neg q\",\"not q[t]\",ch=\"p\",\"p[t]\",\"q[t]\")", "language": "jme"}, "conv": {"parameters": [["op", "string"]], "type": "string", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "language": "jme"}, "bool_to_label": {"parameters": [["l", "list"]], "type": "number", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "language": "jme"}, "evaluate": {"parameters": [["expr", "string"], ["dependencies", "list"]], "type": "number", "definition": "return scope.evaluate(expr);", "language": "javascript"}}, "preamble": {"css": "", "js": ""}, "ungrouped_variables": ["final_value", "op4"], "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} \\var{op3} \\var{b2}).\\]

\n

\n

Enter T if true, else enter F.

\n

\n

\n

\n

\n

\n

\n

\n

\n

\n

\n

", "contributors": [{"name": "Louise Lynch", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2197/"}]}]}], "contributors": [{"name": "Louise Lynch", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2197/"}]}