// Numbas version: finer_feedback_settings
{"name": "Luis's copy of Truth tables 1(v2)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"ungrouped_variables": ["op1", "t_value"], "metadata": {"notes": "", "description": "
Create a truth table for a logical expression of the form $(a \\operatorname{op1} b) \\operatorname{op2}(c \\operatorname{op3} d)$ where $a, \\;b,\\;c,\\;d$ can be the Boolean variables $p,\\;q,\\;\\neg p,\\;\\neg q$ and each of $\\operatorname{op1},\\;\\operatorname{op2},\\;\\operatorname{op3}$ one of $\\lor,\\;\\land,\\;\\to$.
\nFor example: $(p \\lor \\neg q) \\land(q \\to \\neg p)$.
", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "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"}], "preamble": {"css": "", "js": ""}, "advice": "First we find the truth table for $\\var{a} \\var{op} \\var{b}$:
\n\n\n$p$ | $q$ | $\\var{a} \\var{op} \\var{b}$ |
\n\n$\\var{disp[0]}$ | \n$\\var{disq[0]}$ | \n$\\var{ev1[0]}$ | \n
\n\n$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n$\\var{ev1[1]}$ | \n
\n\n$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n$\\var{ev1[2]}$ | \n
\n\n$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n$\\var{ev1[3]}$ | \n
\n\n
\nThen the truth table for $\\var{a1} \\var{op2} \\var{b1}$:
\n\n\n$p$ | $q$ | $\\var{a1} \\var{op2} \\var{b1}$ |
\n\n$\\var{disp[0]}$ | \n$\\var{disq[0]}$ | \n$\\var{ev2[0]}$ | \n
\n\n$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n$\\var{ev2[1]}$ | \n
\n\n$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n$\\var{ev2[2]}$ | \n
\n\n$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n$\\var{ev2[3]}$ | \n
\n\n
\nPutting these together to find $(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$:
\n\n\n\n$\\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})$ |
\n\n$\\var{ev1[0]}$ | \n$\\var{ev2[0]}$ | \n$\\var{t_value[0]}$ | \n
\n\n$\\var{ev1[1]}$ | \n$\\var{ev2[1]}$ | \n$\\var{t_value[1]}$ | \n
\n\n$\\var{ev1[2]}$ | \n$\\var{ev2[2]}$ | \n$\\var{t_value[2]}$ | \n
\n\n$\\var{ev1[3]}$ | \n$\\var{ev2[3]}$ | \n$\\var{t_value[3]}$ | \n
\n\n
", "parts": [{"scripts": {}, "showCorrectAnswer": true, "type": "gapfill", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "gaps": [{"scripts": {}, "displayAnswer": "{ev1[0]}", "showCorrectAnswer": true, "answer": "{ev1[0]}", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "type": "patternmatch", "marks": 1}, {"scripts": {}, "displayAnswer": "{ev1[1]}", "showCorrectAnswer": true, "answer": "{ev1[1]}", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "type": "patternmatch", "marks": 1}, {"scripts": {}, "displayAnswer": "{ev1[2]}", "showCorrectAnswer": true, "answer": "{ev1[2]}", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "type": "patternmatch", "marks": 1}, {"scripts": {}, "displayAnswer": "{ev1[3]}", "showCorrectAnswer": true, "answer": "{ev1[3]}", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "type": "patternmatch", "marks": 1}, {"scripts": {}, "displayAnswer": "{ev2[0]}", "showCorrectAnswer": true, "answer": "{ev2[0]}", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "type": "patternmatch", "marks": 1}, {"scripts": {}, "displayAnswer": "{ev2[1]}", "showCorrectAnswer": true, "answer": "{ev2[1]}", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "type": "patternmatch", "marks": 1}, {"scripts": {}, "displayAnswer": "{ev2[2]}", "showCorrectAnswer": true, "answer": "{ev2[2]}", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "type": "patternmatch", "marks": 1}, {"scripts": {}, "displayAnswer": "{ev2[3]}", "showCorrectAnswer": true, "answer": "{ev2[3]}", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "type": "patternmatch", "marks": 1}, {"scripts": {}, "displayAnswer": "{t_value[0]}", "showCorrectAnswer": true, "answer": "{t_value[0]}", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "type": "patternmatch", "marks": 1}, {"scripts": {}, "displayAnswer": "{t_value[1]}", "showCorrectAnswer": true, "answer": "{t_value[1]}", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "type": "patternmatch", "marks": 1}, {"scripts": {}, "displayAnswer": "{t_value[2]}", "showCorrectAnswer": true, "answer": "{t_value[2]}", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "type": "patternmatch", "marks": 1}, {"scripts": {}, "displayAnswer": "{t_value[3]}", "showCorrectAnswer": true, "answer": "{t_value[3]}", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "type": "patternmatch", "marks": 1}], "marks": 0, "prompt": "Complete the following truth table:
\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})$ |
\n\n$\\var{disp[0]}$ | \n$\\var{disq[0]}$ | \n[[0]] | \n[[4]] | \n[[8]] | \n
\n\n$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n[[1]] | \n[[5]] | \n[[9]] | \n
\n\n$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n[[2]] | \n[[6]] | \n[[10]] | \n
\n\n$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n[[3]] | \n[[7]] | \n[[11]] | \n
\n\n
"}], "functions": {"evaluate": {"language": "javascript", "type": "number", "definition": "return scope.evaluate(expr);", "parameters": [["expr", "string"], ["dependencies", "list"]]}, "conv": {"language": "jme", "type": "string", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "parameters": [["op", "string"]]}, "bool_to_label": {"language": "jme", "type": "number", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "parameters": [["l", "list"]]}, "convch": {"language": "jme", "type": "string", "definition": "switch(ch=\"\\\\neg p\",\"not p[t]\",ch=\"\\\\neg q\",\"not q[t]\",ch=\"p\",\"p[t]\",\"q[t]\")", "parameters": [["ch", "string"]]}}, "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"}, "question_groups": [{"questions": [], "pickingStrategy": "all-ordered", "pickQuestions": 0, "name": ""}], "rulesets": {}, "variables": {"disp": {"description": "", "group": "Truth values", "name": "disp", "definition": "bool_to_label(p)", "templateType": "anything"}, "b1": {"description": "", "group": "Second Bracket", "name": "b1", "definition": "latex(latex_symbol_list[s[3]])", "templateType": "anything"}, "s": {"description": "", "group": "Lists of symbols", "name": "s", "definition": "repeat(random(0..3),4)", "templateType": "anything"}, "ev1": {"description": "", "group": "First Bracket", "name": "ev1", "definition": "bool_to_label(pre_ev1)", "templateType": "anything"}, "b": {"description": "", "group": "First Bracket", "name": "b", "definition": "latex(latex_symbol_list[s[1]])", "templateType": "anything"}, "pre_ev1": {"description": "", "group": "First Bracket", "name": "pre_ev1", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)", "templateType": "anything"}, "ev2": {"description": "", "group": "Second Bracket", "name": "ev2", "definition": "bool_to_label(pre_ev2)", "templateType": "anything"}, "op": {"description": "", "group": "First Bracket", "name": "op", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "templateType": "anything"}, "logic_symbol_list": {"description": "", "group": "Lists of symbols", "name": "logic_symbol_list", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "templateType": "anything"}, "q": {"description": "", "group": "Truth values", "name": "q", "definition": "[true,false,true,false]", "templateType": "anything"}, "op2": {"description": "", "group": "Second Bracket", "name": "op2", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "templateType": "anything"}, "op1": {"description": "", "group": "Ungrouped variables", "name": "op1", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "templateType": "anything"}, "latex_symbol_list": {"description": "", "group": "Lists of symbols", "name": "latex_symbol_list", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "templateType": "anything"}, "pre_ev2": {"description": "", "group": "Second Bracket", "name": "pre_ev2", "definition": "map(evaluate(convch(a1)+\" \"+conv(op2)+\" \"+convch(b1),[p[t],q[t]]),t,0..3)", "templateType": "anything"}, "disq": {"description": "", "group": "Truth values", "name": "disq", "definition": "bool_to_label(q)", "templateType": "anything"}, "p": {"description": "", "group": "Truth values", "name": "p", "definition": "[true,true,false,false]", "templateType": "anything"}, "a": {"description": "", "group": "First Bracket", "name": "a", "definition": "latex(latex_symbol_list[s[0]])", "templateType": "anything"}, "t_value": {"description": "", "group": "Ungrouped variables", "name": "t_value", "definition": "bool_to_label(map(evaluate(pre_ev1[t]+\" \"+conv(op1)+\" \"+pre_ev2[t],[]),t,0..3))", "templateType": "anything"}, "a1": {"description": "", "group": "Second Bracket", "name": "a1", "definition": "latex(latex_symbol_list[s[2]])", "templateType": "anything"}}, "tags": [], "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}).\\]
\n\nEnter T if true, else enter F.
\n\n\n\n\n\n\n\n\n\n\n", "name": "Luis's copy of Truth tables 1(v2)", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Luis Hernandez", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2870/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Luis Hernandez", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2870/"}]}