// Numbas version: finer_feedback_settings
{"name": "Luis'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$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$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$\\var{ev1[0]}$ | \n$\\var{ev2[0]}$ | \n$\\var{t_value[0]}$ | \n
\n\n$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n$\\var{ev1[1]}$ | \n$\\var{ev2[1]}$ | \n$\\var{t_value[1]}$ | \n
\n\n$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n$\\var{ev1[2]}$ | \n$\\var{ev2[2]}$ | \n$\\var{t_value[2]}$ | \n
\n\n$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n$\\var{ev1[3]}$ | \n$\\var{ev2[3]}$ | \n$\\var{t_value[3]}$ | \n
\n\n
\nNext we find the truth table for $\\var{a2} \\var{op3} \\var{b2}$:
\n\n\n$p$ | $q$ | $\\var{a2} \\var{op3} \\var{b2}$ |
\n\n$\\var{disp[0]}$ | \n$\\var{disq[0]}$ | \n$\\var{ev3[0]}$ | \n
\n\n$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n$\\var{ev3[1]}$ | \n
\n\n$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n$\\var{ev3[2]}$ | \n
\n\n$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n$\\var{ev3[3]}$ | \n
\n\n
\nPutting this all together to obtain the truth table we want:
\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})$ |
\n\n$\\var{disp[0]}$ | \n$\\var{disq[0]}$ | \n$\\var{t_value[0]}$ | \n$\\var{ev3[0]}$ | \n$\\var{final_value[0]}$ | \n
\n\n$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n$\\var{t_value[1]}$ | \n$\\var{ev3[1]}$ | \n$\\var{final_value[1]}$ | \n
\n\n$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n$\\var{t_value[2]}$ | \n$\\var{ev3[2]}$ | \n$\\var{final_value[2]}$ | \n
\n\n$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n$\\var{t_value[3]}$ | \n$\\var{ev3[3]}$ | \n$\\var{final_value[3]}$ | \n
\n\n
", "ungrouped_variables": ["final_value", "op4"], "statement": "En la siguiente pregunta se le pide que construya una tabla de verdad para:
\n\\ [((\\ var {a} \\ var {op} \\ var {b}) \\ var {op1} (\\ var {a1} \\ var {op2} \\ var {b1})) \\ var {op4} (\\ var {a2} \\ var {op3} \\ var {b2}). \\]
\n\nIngrese T si es verdadero, de lo contrario ingrese F.
\n\n\n\n\n\n\n\n\n\n\n", "variablesTest": {"maxRuns": "150", "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"}, "tags": [], "extensions": [], "metadata": {"licence": "Creative Commons Attribution 4.0 International", "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)$
"}, "parts": [{"type": "gapfill", "showFeedbackIcon": true, "customMarkingAlgorithm": "", "showCorrectAnswer": true, "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})$ | $\\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})$ |
\n\n$\\var{disp[0]}$ | \n$\\var{disq[0]}$ | \n[[0]] | \n[[4]] | \n[[8]] | \n[[12]] | \n[[16]] | \n
\n\n$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n[[1]] | \n[[5]] | \n[[9]] | \n[[13]] | \n[[17]] | \n
\n\n$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n[[2]] | \n[[6]] | \n[[10]] | \n[[14]] | \n[[18]] | \n
\n\n$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n[[3]] | \n[[7]] | \n[[11]] | \n[[15]] | \n[[19]] | \n
\n\n
", "gaps": [{"answer": "{ev1[0]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev1[0]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{ev1[1]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev1[1]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{ev1[2]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev1[2]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{ev1[3]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev1[3]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{ev2[0]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev2[0]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{ev2[1]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev2[1]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{ev2[2]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev2[2]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{ev2[3]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev2[3]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{t_value[0]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{t_value[0]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{t_value[1]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{t_value[1]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{t_value[2]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{t_value[2]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{t_value[3]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{t_value[3]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{ev3[0]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev3[0]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{ev3[1]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev3[1]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{ev3[2]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev3[2]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{ev3[3]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev3[3]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{final_value[0]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{final_value[0]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{final_value[1]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{final_value[1]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{final_value[2]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{final_value[2]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}, {"answer": "{final_value[3]}", "type": "patternmatch", "showFeedbackIcon": true, "matchMode": "regex", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{final_value[3]}", "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}], "variableReplacements": [], "sortAnswers": false, "marks": 0, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "unitTests": [], "scripts": {}}], "rulesets": {}, "variable_groups": [{"name": "Lists of symbols", "variables": ["logic_symbol_list", "latex_symbol_list", "s"]}, {"name": "First Bracket", "variables": ["a", "b", "op", "pre_ev1", "ev1"]}, {"name": "Second Bracket", "variables": ["a1", "b1", "op2", "pre_ev2", "ev2"]}, {"name": "Truth values", "variables": ["p", "q", "disp", "disq"]}, {"name": "Third Bracket", "variables": ["a2", "b2", "op3", "pre_ev3", "ev3"]}, {"name": "First and Second Brackets", "variables": ["op1", "pre_t_value", "t_value"]}], "variables": {"op3": {"name": "op3", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "templateType": "anything", "description": "", "group": "Third Bracket"}, "pre_ev2": {"name": "pre_ev2", "definition": "map(evaluate(convch(a1)+\" \"+conv(op2)+\" \"+convch(b1),[p[t],q[t]]),t,0..3)", "templateType": "anything", "description": "", "group": "Second Bracket"}, "pre_ev1": {"name": "pre_ev1", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)", "templateType": "anything", "description": "", "group": "First Bracket"}, "q": {"name": "q", "definition": "[true,false,true,false]", "templateType": "anything", "description": "", "group": "Truth values"}, "pre_ev3": {"name": "pre_ev3", "definition": "map(evaluate(convch(a2)+\" \"+conv(op3)+\" \"+convch(b2),[p[t],q[t]]),t,0..3)", "templateType": "anything", "description": "", "group": "Third Bracket"}, "a2": {"name": "a2", "definition": "latex(latex_symbol_list[s[4]])", "templateType": "anything", "description": "", "group": "Third Bracket"}, "a": {"name": "a", "definition": "latex(latex_symbol_list[s[0]])", "templateType": "anything", "description": "", "group": "First Bracket"}, "pre_t_value": {"name": "pre_t_value", "definition": "map(evaluate(pre_ev1[t]+\" \"+conv(op1)+\" \"+pre_ev2[t],[]),t,0..3)", "templateType": "anything", "description": "", "group": "First and Second Brackets"}, "disq": {"name": "disq", "definition": "bool_to_label(q)", "templateType": "anything", "description": "", "group": "Truth values"}, "disp": {"name": "disp", "definition": "bool_to_label(p)", "templateType": "anything", "description": "", "group": "Truth values"}, "t_value": {"name": "t_value", "definition": "bool_to_label(pre_t_value)", "templateType": "anything", "description": "", "group": "First and Second Brackets"}, "latex_symbol_list": {"name": "latex_symbol_list", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "templateType": "anything", "description": "", "group": "Lists of symbols"}, "b2": {"name": "b2", "definition": "latex(latex_symbol_list[s[5]])", "templateType": "anything", "description": "", "group": "Third Bracket"}, "op2": {"name": "op2", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "templateType": "anything", "description": "", "group": "Second Bracket"}, "ev3": {"name": "ev3", "definition": "bool_to_label(pre_ev3)", "templateType": "anything", "description": "", "group": "Third Bracket"}, "ev1": {"name": "ev1", "definition": "bool_to_label(pre_ev1)", "templateType": "anything", "description": "", "group": "First Bracket"}, "a1": {"name": "a1", "definition": "latex(latex_symbol_list[s[2]])", "templateType": "anything", "description": "", "group": "Second Bracket"}, "op4": {"name": "op4", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "b": {"name": "b", "definition": "latex(latex_symbol_list[s[1]])", "templateType": "anything", "description": "", "group": "First Bracket"}, "final_value": {"name": "final_value", "definition": "bool_to_label(map(evaluate(pre_t_value[t]+\" \"+conv(op4)+\" \"+pre_ev3[t],[]),t,0..3))", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "b1": {"name": "b1", "definition": "latex(latex_symbol_list[s[3]])", "templateType": "anything", "description": "", "group": "Second Bracket"}, "op": {"name": "op", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "templateType": "anything", "description": "", "group": "First Bracket"}, "op1": {"name": "op1", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "templateType": "anything", "description": "", "group": "First and Second Brackets"}, "p": {"name": "p", "definition": "[true,true,false,false]", "templateType": "anything", "description": "", "group": "Truth values"}, "ev2": {"name": "ev2", "definition": "bool_to_label(pre_ev2)", "templateType": "anything", "description": "", "group": "Second Bracket"}, "logic_symbol_list": {"name": "logic_symbol_list", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "templateType": "anything", "description": "", "group": "Lists of symbols"}, "s": {"name": "s", "definition": "repeat(random(0..3),6)", "templateType": "anything", "description": "", "group": "Lists of symbols"}}, "name": "Luis's copy of Truth tables 3 (v2)-", "functions": {"bool_to_label": {"parameters": [["l", "list"]], "type": "number", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "language": "jme"}, "conv": {"parameters": [["op", "string"]], "type": "string", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "language": "jme"}, "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"}, "evaluate": {"parameters": [["expr", "string"], ["dependencies", "list"]], "type": "number", "definition": "return scope.evaluate(expr);", "language": "javascript"}}, "preamble": {"js": "", "css": ""}, "type": "question", "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/"}]}