// Numbas version: finer_feedback_settings
{"showQuestionGroupNames": false, "timing": {"timeout": {"message": "", "action": "none"}, "timedwarning": {"message": "", "action": "none"}, "allowPause": true}, "percentPass": 0, "feedback": {"showtotalmark": true, "showanswerstate": true, "feedbackmessages": [], "intro": "", "allowrevealanswer": true, "advicethreshold": 0, "showactualmark": true, "enterreviewmodeimmediately": true, "showexpectedanswerswhen": "inreview", "showpartfeedbackmessageswhen": "always", "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showadvicewhen": "never"}, "metadata": {"description": "
Short Video Lectures, followed by questions and video solutions
", "licence": "All rights reserved"}, "name": "Statements and Truth Tables", "navigation": {"preventleave": false, "reverse": true, "showresultspage": "oncompletion", "allowregen": false, "browse": true, "onleave": {"message": "You must answer each part of the question
", "action": "none"}, "showfrontpage": false}, "question_groups": [{"pickQuestions": 1, "pickingStrategy": "all-ordered", "name": "Group", "questions": [{"name": "Statements ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Johnny Yi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2810/"}], "variablesTest": {"condition": "", "maxRuns": 100}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "Asks to determine whether or not 6 statements are propositions or not i.e. we can determine a truth value or not.
"}, "statement": "
\n\n\nWhich of the following are statements?
", "preamble": {"css": "", "js": ""}, "ungrouped_variables": ["all", "select", "marking_matrix"], "tags": [], "functions": {}, "variables": {"all": {"description": "", "name": "all", "group": "Ungrouped variables", "templateType": "anything", "definition": "[\n ['Lions and tigers.','This is not a proposition as there is no truth value we can determine.',0],\n ['Lions and tigers are animals.','This is a true proposition, at least in the standard interpretation of the words.',1],\n ['The smallest positive whole number is 2.','This is a proposition and false, as the smallest positive whole number is $1$.',1],\n ['Call me Johnny.','Not a proposition as we cannot ascertain a truth value.',0],\n ['Either $x>3$ or $x<0$.','Not a proposition: its truth depends on the value of $x$.',0],\n ['They like fishcakes.','Not a proposition. Its truth depends on who \"They\" are.',0],\n ['In the beginning.','Not a proposition: is neither true nor false.',0],\n ['ANU is a much better place to get your degree.','Not a proposition. It depends on what \"better\" refers to.',0],\n ['To be or not to be.','Not a proposition: is neither true nor false.',0],\n ['Canberra football club is at its peak.','Not a proposition. It depends on when it is said, and what \"peak\" means.',0],\n ['Canberra and the ACT are two different names for the same place.', 'A proposition. Is this true though?',1],\n ['If $3x^2-2=0$ then $x=\\\\sqrt{2/3}$ or $x=-\\\\sqrt{2/3}$','A proposition. It does not depend what $x$ is. It is true.',1]\n ]"}, "select": {"description": "", "name": "select", "group": "Ungrouped variables", "templateType": "anything", "definition": "shuffle(list(0..length(all)-1))[0..6]"}, "marking_matrix": {"description": "", "name": "marking_matrix", "group": "Ungrouped variables", "templateType": "anything", "definition": "map([all[x][2],(all[x][2])*(-1)+1],x,select)"}}, "advice": "For the above we have:
\n1. {all[select[0]][0]}
\n{all[select[0]][1]}
\n2. {all[select[1]][0]}
\n{all[select[1]][1]}
\n3. {all[select[2]][0]}
\n{all[select[2]][1]}
\n4. {all[select[3]][0]}
\n{all[select[3]][1]}
\n5. {all[select[4]][0]}
\n{all[select[4]][1]}
\n6. {all[select[5]][0]}
\n{all[select[5]][1]}
", "parts": [{"showCellAnswerState": true, "warningType": "none", "layout": {"expression": "", "type": "all"}, "unitTests": [], "displayType": "radiogroup", "variableReplacements": [], "matrix": "marking_matrix", "extendBaseMarkingAlgorithm": true, "minMarks": 0, "type": "m_n_x", "maxMarks": 0, "marks": 0, "variableReplacementStrategy": "originalfirst", "shuffleAnswers": false, "scripts": {}, "minAnswers": 0, "shuffleChoices": false, "showFeedbackIcon": true, "showCorrectAnswer": true, "choices": ["{all[select[0]][0]}", "{all[select[1]][0]}", "{all[select[2]][0]}", "{all[select[3]][0]}", "{all[select[4]][0]}", "{all[select[5]][0]}"], "answers": ["Statement", "Not a Statement"], "maxAnswers": 0, "customMarkingAlgorithm": ""}], "rulesets": {}, "variable_groups": [], "type": "question"}, {"name": "Simple Truth Table involving implication (p->-q)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Johnny Yi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2810/"}], "rulesets": {}, "ungrouped_variables": [], "functions": {"convch": {"language": "jme", "definition": "switch(ch=\"\\\\neg p\",\"not p[t]\",ch=\"\\\\neg q\",\"not q[t]\",ch=\"p\",\"p[t]\",\"q[t]\")", "type": "string", "parameters": [["ch", "string"]]}, "evaluate": {"language": "javascript", "definition": "return scope.evaluate(expr);", "type": "number", "parameters": [["expr", "string"], ["dependencies", "list"]]}, "conv": {"language": "jme", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "type": "string", "parameters": [["op", "string"]]}, "bool_to_label": {"language": "jme", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "type": "number", "parameters": [["l", "list"]]}}, "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "variables": {"q": {"description": "", "group": "Truth values", "name": "q", "templateType": "anything", "definition": "[true,false,true,false]"}, "a": {"description": "", "group": "First Bracket", "name": "a", "templateType": "anything", "definition": "latex(latex_symbol_list[s[0]])"}, "op": {"description": "", "group": "First Bracket", "name": "op", "templateType": "anything", "definition": "latex(random(\"\\\\to\"))"}, "pre_ev1": {"description": "", "group": "First Bracket", "name": "pre_ev1", "templateType": "anything", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)"}, "p": {"description": "", "group": "Truth values", "name": "p", "templateType": "anything", "definition": "[true,true,false,false]"}, "ev1": {"description": "", "group": "First Bracket", "name": "ev1", "templateType": "anything", "definition": "bool_to_label(pre_ev1)"}, "logic_symbol_list": {"description": "", "group": "Lists of symbols", "name": "logic_symbol_list", "templateType": "anything", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]"}, "s": {"description": "", "group": "Lists of symbols", "name": "s", "templateType": "anything", "definition": "[0,1,2,3]"}, "b": {"description": "", "group": "First Bracket", "name": "b", "templateType": "anything", "definition": "latex(\"\\\\neg q\")"}, "latex_symbol_list": {"description": "", "group": "Lists of symbols", "name": "latex_symbol_list", "templateType": "anything", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]"}, "disp": {"description": "", "group": "Truth values", "name": "disp", "templateType": "anything", "definition": "bool_to_label(p)"}, "disq": {"description": "", "group": "Truth values", "name": "disq", "templateType": "anything", "definition": "bool_to_label(q)"}}, "statement": "\n\n\n\n\n\n\n\n\n\n\n\n\n\nIn the following question you are asked to construct a truth table for:
\n\\[\\var{a} \\var{op} \\var{b}.\\]
\n\nEnter T if true, else enter F.
\n\n\n\n\n\n\n\n\n\n\n", "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": []}, {"name": "Truth values", "variables": ["q", "p", "disp", "disq"]}], "parts": [{"unitTests": [], "marks": 0, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "prompt": "Complete the following truth table:
\n\n\n$p$ | $q$ | $\\var{a} \\var{op} \\var{b}$ |
\n\n$\\var{disp[0]}$ | \n$\\var{disq[0]}$ | \n[[0]] | \n
\n\n$\\var{disp[1]}$ | \n$\\var{disq[1]}$ | \n[[1]] | \n
\n\n$\\var{disp[2]}$ | \n$\\var{disq[2]}$ | \n[[2]] | \n
\n\n$\\var{disp[3]}$ | \n$\\var{disq[3]}$ | \n[[3]] | \n
\n\n
", "sortAnswers": false, "extendBaseMarkingAlgorithm": true, "type": "gapfill", "scripts": {}, "gaps": [{"answer": "{ev1[0]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev1[0]}"}, {"answer": "{ev1[1]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev1[1]}"}, {"answer": "{ev1[2]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev1[2]}"}, {"answer": "{ev1[3]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev1[3]}"}], "showFeedbackIcon": true, "customMarkingAlgorithm": ""}], "preamble": {"js": "", "css": ""}, "advice": "Here is the truth table.
\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
", "variablesTest": {"maxRuns": "150", "condition": ""}, "type": "question"}, {"name": "Truth Table 2 (radomisation cancelled)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Johnny Yi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2810/"}], "rulesets": {}, "functions": {"conv": {"parameters": [["op", "string"]], "language": "jme", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "type": "string"}, "evaluate": {"parameters": [["expr", "string"], ["dependencies", "list"]], "language": "javascript", "definition": "return scope.evaluate(expr);", "type": "number"}, "convch": {"parameters": [["ch", "string"]], "language": "jme", "definition": "switch(ch=\"\\\\neg p\",\"not p[t]\",ch=\"\\\\neg q\",\"not q[t]\",ch=\"p\",\"p[t]\",\"q[t]\")", "type": "string"}, "bool_to_label": {"parameters": [["l", "list"]], "language": "jme", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "type": "number"}}, "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
", "variables": {"ev1": {"description": "", "definition": "bool_to_label(pre_ev1)", "group": "First Bracket", "name": "ev1", "templateType": "anything"}, "a": {"description": "", "definition": "latex(latex_symbol_list[s[0]])", "group": "First Bracket", "name": "a", "templateType": "anything"}, "q": {"description": "", "definition": "[true,false,true,false]", "group": "Truth values", "name": "q", "templateType": "anything"}, "pre_ev1": {"description": "", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)", "group": "First Bracket", "name": "pre_ev1", "templateType": "anything"}, "b1": {"description": "", "definition": "latex(latex_symbol_list[s[3]])", "group": "Second Bracket", "name": "b1", "templateType": "anything"}, "op1": {"description": "", "definition": "latex(random(\"\\\\lor\"))", "group": "Ungrouped variables", "name": "op1", "templateType": "anything"}, "ev2": {"description": "", "definition": "bool_to_label(pre_ev2)", "group": "Second Bracket", "name": "ev2", "templateType": "anything"}, "latex_symbol_list": {"description": "", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "group": "Lists of symbols", "name": "latex_symbol_list", "templateType": "anything"}, "p": {"description": "", "definition": "[true,true,false,false]", "group": "Truth values", "name": "p", "templateType": "anything"}, "a1": {"description": "", "definition": "latex(latex_symbol_list[s[2]])", "group": "Second Bracket", "name": "a1", "templateType": "anything"}, "disp": {"description": "", "definition": "bool_to_label(p)", "group": "Truth values", "name": "disp", "templateType": "anything"}, "logic_symbol_list": {"description": "", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "group": "Lists of symbols", "name": "logic_symbol_list", "templateType": "anything"}, "op": {"description": "", "definition": "latex(random(\"\\\\land\"))", "group": "First Bracket", "name": "op", "templateType": "anything"}, "s": {"description": "", "definition": "[1,2,0,1]", "group": "Lists of symbols", "name": "s", "templateType": "anything"}, "b": {"description": "", "definition": "latex(latex_symbol_list[s[1]])", "group": "First Bracket", "name": "b", "templateType": "anything"}, "disq": {"description": "", "definition": "bool_to_label(q)", "group": "Truth values", "name": "disq", "templateType": "anything"}, "op2": {"description": "", "definition": "latex(random(\"\\\\lor\"))", "group": "Second Bracket", "name": "op2", "templateType": "anything"}, "t_value": {"description": "", "definition": "bool_to_label(map(evaluate(pre_ev1[t]+\" \"+conv(op1)+\" \"+pre_ev2[t],[]),t,0..3))", "group": "Ungrouped variables", "name": "t_value", "templateType": "anything"}, "pre_ev2": {"description": "", "definition": "map(evaluate(convch(a1)+\" \"+conv(op2)+\" \"+convch(b1),[p[t],q[t]]),t,0..3)", "group": "Second Bracket", "name": "pre_ev2", "templateType": "anything"}}, "statement": "\n\n\n\n\nIn 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", "tags": [], "ungrouped_variables": ["op1", "t_value"], "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"}], "parts": [{"showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": 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})$ |
\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
", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "gapfill", "unitTests": [], "variableReplacements": [], "marks": 0, "gaps": [{"showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "answer": "{ev1[0]}", "scripts": {}, "type": "patternmatch", "unitTests": [], "matchMode": "regex", "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev1[0]}"}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "answer": "{ev1[1]}", "scripts": {}, "type": "patternmatch", "unitTests": [], "matchMode": "regex", "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev1[1]}"}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "answer": "{ev1[2]}", "scripts": {}, "type": "patternmatch", "unitTests": [], "matchMode": "regex", "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev1[2]}"}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "answer": "{ev1[3]}", "scripts": {}, "type": "patternmatch", "unitTests": [], "matchMode": "regex", "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev1[3]}"}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "answer": "{ev2[0]}", "scripts": {}, "type": "patternmatch", "unitTests": [], "matchMode": "regex", "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev2[0]}"}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "answer": "{ev2[1]}", "scripts": {}, "type": "patternmatch", "unitTests": [], "matchMode": "regex", "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev2[1]}"}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "answer": "{ev2[2]}", "scripts": {}, "type": "patternmatch", "unitTests": [], "matchMode": "regex", "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev2[2]}"}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "answer": "{ev2[3]}", "scripts": {}, "type": "patternmatch", "unitTests": [], "matchMode": "regex", "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{ev2[3]}"}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "answer": "{t_value[0]}", "scripts": {}, "type": "patternmatch", "unitTests": [], "matchMode": "regex", "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{t_value[0]}"}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "answer": "{t_value[1]}", "scripts": {}, "type": "patternmatch", "unitTests": [], "matchMode": "regex", "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{t_value[1]}"}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "answer": "{t_value[2]}", "scripts": {}, "type": "patternmatch", "unitTests": [], "matchMode": "regex", "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{t_value[2]}"}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "answer": "{t_value[3]}", "scripts": {}, "type": "patternmatch", "unitTests": [], "matchMode": "regex", "variableReplacements": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "displayAnswer": "{t_value[3]}"}], "sortAnswers": false}], "preamble": {"css": "", "js": ""}, "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"}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": ""}, "type": "question"}, {"name": "Truth Table 3 (radominsation cancelled)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Johnny Yi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2810/"}], "rulesets": {}, "ungrouped_variables": ["pre_final_value", "op4", "final_value"], "functions": {"convch": {"language": "jme", "definition": "switch(ch=\"\\\\neg p\",\"not bool_p[t]\",ch=\"\\\\neg q\",\"not bool_q[t]\",ch=\"p\",\"bool_p[t]\",\"bool_q[t]\")", "type": "string", "parameters": [["ch", "string"]]}, "evaluate": {"language": "javascript", "definition": "return scope.evaluate(expr);", "type": "number", "parameters": [["expr", "string"], ["dependencies", "list"]]}, "conv": {"language": "jme", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "type": "string", "parameters": [["op", "string"]]}, "bool_to_label": {"language": "jme", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "type": "number", "parameters": [["l", "list"]]}}, "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}))\\var{op4}\\var{a2}.\\]
\n\nEnter T if true, else enter F.
", "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "variables": {"op2": {"templateType": "anything", "definition": "latex(random(\"\\\\land\"))", "name": "op2", "description": "", "group": "Second Bracket"}, "pre_final_value": {"templateType": "anything", "definition": "map(evaluate(pre_t_value[t]+\" \"+conv(op4)+\" \"+pre_ev3[t],[]),t,0..3)", "name": "pre_final_value", "description": "", "group": "Ungrouped variables"}, "p": {"templateType": "anything", "definition": "bool_to_label([true,true,false,false])", "name": "p", "description": "", "group": "Truth values"}, "pre_ev2": {"templateType": "anything", "definition": "map(evaluate(convch(a1)+\" \"+conv(op2)+\" \"+convch(b1),[bool_p[t],bool_q[t]]),t,0..3)", "name": "pre_ev2", "description": "", "group": "Second Bracket"}, "final_value": {"templateType": "anything", "definition": "bool_to_label(pre_final_value)", "name": "final_value", "description": "", "group": "Ungrouped variables"}, "logic_symbol_list": {"templateType": "anything", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "name": "logic_symbol_list", "description": "", "group": "Lists of symbols"}, "b": {"templateType": "anything", "definition": "latex(latex_symbol_list[s[1]])", "name": "b", "description": "", "group": "First Bracket"}, "a1": {"templateType": "anything", "definition": "latex(latex_symbol_list[s[2]])", "name": "a1", "description": "", "group": "Second Bracket"}, "op1": {"templateType": "anything", "definition": "latex(random(\"\\\\to\"))", "name": "op1", "description": "", "group": "First and Second Brackets"}, "op4": {"templateType": "anything", "definition": "latex(random(\"\\\\lor\"))", "name": "op4", "description": "", "group": "Ungrouped variables"}, "ev3": {"templateType": "anything", "definition": "bool_to_label(pre_ev3)", "name": "ev3", "description": "", "group": "Last "}, "bool_p": {"templateType": "anything", "definition": "[true,true,false,false]", "name": "bool_p", "description": "", "group": "Truth values"}, "a2": {"templateType": "anything", "definition": "latex(random(\"\\\\neg p\"))", "name": "a2", "description": "", "group": "Last "}, "ev2": {"templateType": "anything", "definition": "bool_to_label(pre_ev2)", "name": "ev2", "description": "", "group": "Second Bracket"}, "q": {"templateType": "anything", "definition": "bool_to_label([true,false,true,false])", "name": "q", "description": "", "group": "Truth values"}, "a": {"templateType": "anything", "definition": "latex(latex_symbol_list[s[0]])", "name": "a", "description": "", "group": "First Bracket"}, "op": {"templateType": "anything", "definition": "latex(random(\"\\\\lor\"))", "name": "op", "description": "", "group": "First Bracket"}, "pre_ev1": {"templateType": "anything", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[bool_p[t],bool_q[t]]),t,0..3)", "name": "pre_ev1", "description": "", "group": "First Bracket"}, "ev1": {"templateType": "anything", "definition": "bool_to_label(pre_ev1)", "name": "ev1", "description": "", "group": "First Bracket"}, "t_value": {"templateType": "anything", "definition": "bool_to_label(pre_t_value)", "name": "t_value", "description": "", "group": "First and Second Brackets"}, "s": {"templateType": "anything", "definition": "[0,1,2,3,0,1]", "name": "s", "description": "", "group": "Lists of symbols"}, "b1": {"templateType": "anything", "definition": "latex(latex_symbol_list[s[3]])", "name": "b1", "description": "", "group": "Second Bracket"}, "bool_q": {"templateType": "anything", "definition": "[true,false,true,false]", "name": "bool_q", "description": "", "group": "Truth values"}, "pre_ev3": {"templateType": "anything", "definition": "map(evaluate(convch(a2),[bool_p[t],bool_q[t]]),t,0..3)", "name": "pre_ev3", "description": "", "group": "Last "}, "pre_t_value": {"templateType": "anything", "definition": "map(evaluate(pre_ev1[t]+\" \"+conv(op1)+\" \"+pre_ev2[t],[]),t,0..3)", "name": "pre_t_value", "description": "", "group": "First and Second Brackets"}, "latex_symbol_list": {"templateType": "anything", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "name": "latex_symbol_list", "description": "", "group": "Lists of symbols"}}, "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", "bool_p", "bool_q"]}, {"name": "Last ", "variables": ["a2", "pre_ev3", "ev3"]}, {"name": "First and Second Brackets", "variables": ["op1", "pre_t_value", "t_value"]}], "parts": [{"unitTests": [], "marks": 0, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "prompt": "Complete the following truth table:
\n\n\n\n$p$ | \n$q$ | \n$\\var{a} \\var{op} \\var{b}$ | \n$\\var{a1} \\var{op2} \\var{b1}$ | \n$(\\var{a} \\var{op} \\var{b}) \\var{op1} (\\var{a1} \\var{op2} \\var{b1})$ | \n$\\var{a2} $ | \n$((\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}\\var{a2} $ | \n
\n\n$\\var{p[0]}$ | \n$\\var{q[0]}$ | \n[[0]] | \n[[4]] | \n[[8]] | \n[[12]] | \n[[16]] | \n
\n\n$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n[[1]] | \n[[5]] | \n[[9]] | \n[[13]] | \n[[17]] | \n
\n\n$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n[[2]] | \n[[6]] | \n[[10]] | \n[[14]] | \n[[18]] | \n
\n\n$\\var{p[3]}$ | \n$\\var{q[3]}$ | \n[[3]] | \n[[7]] | \n[[11]] | \n[[15]] | \n[[19]] | \n
\n\n
", "sortAnswers": false, "extendBaseMarkingAlgorithm": true, "type": "gapfill", "scripts": {}, "gaps": [{"answer": "{ev1[0]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev1[0]}"}, {"answer": "{ev1[1]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev1[1]}"}, {"answer": "{ev1[2]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev1[2]}"}, {"answer": "{ev1[3]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev1[3]}"}, {"answer": "{ev2[0]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev2[0]}"}, {"answer": "{ev2[1]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev2[1]}"}, {"answer": "{ev2[2]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev2[2]}"}, {"answer": "{ev2[3]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev2[3]}"}, {"answer": "{t_value[0]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{t_value[0]}"}, {"answer": "{t_value[1]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{t_value[1]}"}, {"answer": "{t_value[2]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{t_value[2]}"}, {"answer": "{t_value[3]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{t_value[3]}"}, {"answer": "{ev3[0]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev3[0]}"}, {"answer": "{ev3[1]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev3[1]}"}, {"answer": "{ev3[2]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev3[2]}"}, {"answer": "{ev3[3]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{ev3[3]}"}, {"answer": "{final_value[0]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{final_value[0]}"}, {"answer": "{final_value[1]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{final_value[1]}"}, {"answer": "{final_value[2]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{final_value[2]}"}, {"answer": "{final_value[3]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{final_value[3]}"}], "showFeedbackIcon": true, "customMarkingAlgorithm": ""}], "variablesTest": {"condition": "a1 <>b1 and\nif(a='p' or a='\\\\neg p',b=random('q','\\\\neg q'),b=random('p','\\\\neg p'))\n", "maxRuns": "20000"}, "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{p[0]}$ | \n$\\var{q[0]}$ | \n\n$\\var{ev1[0]}$ | \n
\n\n$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n\n$\\var{ev1[1]}$ | \n
\n\n$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n\n$\\var{ev1[2]}$ | \n
\n\n$\\var{p[3]}$ | \n$\\var{q[3]}$ | \n\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{p[0]}$ | \n$\\var{q[0]}$ | \n$\\var{ev2[0]}$ | \n
\n\n$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n$\\var{ev2[1]}$ | \n
\n\n$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n$\\var{ev2[2]}$ | \n
\n\n$\\var{p[3]}$ | \n$\\var{q[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{p[0]}$ | \n$\\var{q[0]}$ | \n$\\var{ev1[0]}$ | \n$\\var{ev2[0]}$ | \n$\\var{t_value[0]}$ | \n
\n\n$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n$\\var{ev1[1]}$ | \n$\\var{ev2[1]}$ | \n$\\var{t_value[1]}$ | \n
\n\n$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n$\\var{ev1[2]}$ | \n$\\var{ev2[2]}$ | \n$\\var{t_value[2]}$ | \n
\n\n$\\var{p[3]}$ | \n$\\var{q[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}$:
\n\n\n$p$ | $q$ | $\\var{a2}$ |
\n\n$\\var{p[0]}$ | \n$\\var{q[0]}$ | \n$\\var{ev3[0]}$ | \n
\n\n$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n$\\var{ev3[1]}$ | \n
\n\n$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n$\\var{ev3[2]}$ | \n
\n\n$\\var{p[3]}$ | \n$\\var{q[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{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}\\var{a2} $ |
\n\n$\\var{p[0]}$ | \n$\\var{q[0]}$ | \n$\\var{t_value[0]}$ | \n$\\var{ev3[0]}$ | \n$\\var{final_value[0]}$ | \n
\n\n$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n$\\var{t_value[1]}$ | \n$\\var{ev3[1]}$ | \n$\\var{final_value[1]}$ | \n
\n\n$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n$\\var{t_value[2]}$ | \n$\\var{ev3[2]}$ | \n$\\var{final_value[2]}$ | \n
\n\n$\\var{p[3]}$ | \n$\\var{q[3]}$ | \n$\\var{t_value[3]}$ | \n$\\var{ev3[3]}$ | \n$\\var{final_value[3]}$ | \n
\n\n
", "preamble": {"js": "", "css": ""}, "type": "question"}, {"name": "Truth Table 4 (Randomisation Cancelled)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Johnny Yi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2810/"}], "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"}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": ""}, "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\nEnter T if true, else enter F.
\n\n\n\n\n\n\n\n\n\n\n", "preamble": {"css": "", "js": ""}, "rulesets": {}, "tags": [], "functions": {"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"}, "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"}}, "variables": {"op1": {"description": "", "name": "op1", "group": "First and Second Brackets", "templateType": "anything", "definition": "latex(random(\"\\\\to\"))"}, "ev1": {"description": "", "name": "ev1", "group": "First Bracket", "templateType": "anything", "definition": "bool_to_label(pre_ev1)"}, "q": {"description": "", "name": "q", "group": "Truth values", "templateType": "anything", "definition": "[true,false,true,false]"}, "t_value": {"description": "", "name": "t_value", "group": "First and Second Brackets", "templateType": "anything", "definition": "bool_to_label(pre_t_value)"}, "a1": {"description": "", "name": "a1", "group": "Second Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[2]])"}, "pre_ev3": {"description": "", "name": "pre_ev3", "group": "Third Bracket", "templateType": "anything", "definition": "map(evaluate(convch(a2)+\" \"+conv(op3)+\" \"+convch(b2),[p[t],q[t]]),t,0..3)"}, "op3": {"description": "", "name": "op3", "group": "Third Bracket", "templateType": "anything", "definition": "latex(random(\"\\\\land\"))"}, "op": {"description": "", "name": "op", "group": "First Bracket", "templateType": "anything", "definition": "latex(random(\"\\\\land\"))"}, "p": {"description": "", "name": "p", "group": "Truth values", "templateType": "anything", "definition": "[true,true,false,false]"}, "pre_t_value": {"description": "", "name": "pre_t_value", "group": "First and Second Brackets", "templateType": "anything", "definition": "map(evaluate(pre_ev1[t]+\" \"+conv(op1)+\" \"+pre_ev2[t],[]),t,0..3)"}, "disq": {"description": "", "name": "disq", "group": "Truth values", "templateType": "anything", "definition": "bool_to_label(q)"}, "b2": {"description": "", "name": "b2", "group": "Third Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[5]])"}, "logic_symbol_list": {"description": "", "name": "logic_symbol_list", "group": "Lists of symbols", "templateType": "anything", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]"}, "b": {"description": "", "name": "b", "group": "First Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[1]])"}, "pre_ev1": {"description": "", "name": "pre_ev1", "group": "First Bracket", "templateType": "anything", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)"}, "pre_ev2": {"description": "", "name": "pre_ev2", "group": "Second Bracket", "templateType": "anything", "definition": "map(evaluate(convch(a1)+\" \"+conv(op2)+\" \"+convch(b1),[p[t],q[t]]),t,0..3)"}, "ev3": {"description": "", "name": "ev3", "group": "Third Bracket", "templateType": "anything", "definition": "bool_to_label(pre_ev3)"}, "latex_symbol_list": {"description": "", "name": "latex_symbol_list", "group": "Lists of symbols", "templateType": "anything", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]"}, "disp": {"description": "", "name": "disp", "group": "Truth values", "templateType": "anything", "definition": "bool_to_label(p)"}, "op4": {"description": "", "name": "op4", "group": "Ungrouped variables", "templateType": "anything", "definition": "latex(random(\"\\\\to\"))"}, "final_value": {"description": "", "name": "final_value", "group": "Ungrouped variables", "templateType": "anything", "definition": "bool_to_label(map(evaluate(pre_t_value[t]+\" \"+conv(op4)+\" \"+pre_ev3[t],[]),t,0..3))"}, "a2": {"description": "", "name": "a2", "group": "Third Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[4]])"}, "op2": {"description": "", "name": "op2", "group": "Second Bracket", "templateType": "anything", "definition": "latex(random(\"\\\\lor\"))"}, "a": {"description": "", "name": "a", "group": "First Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[0]])"}, "b1": {"description": "", "name": "b1", "group": "Second Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[3]])"}, "ev2": {"description": "", "name": "ev2", "group": "Second Bracket", "templateType": "anything", "definition": "bool_to_label(pre_ev2)"}, "s": {"description": "", "name": "s", "group": "Lists of symbols", "templateType": "anything", "definition": "[3,2,2,1,3,0]"}}, "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
", "parts": [{"scripts": {}, "variableReplacementStrategy": "originalfirst", "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
", "marks": 0, "unitTests": [], "sortAnswers": false, "variableReplacements": [], "customMarkingAlgorithm": "", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "gaps": [{"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{ev1[0]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{ev1[0]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{ev1[1]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{ev1[1]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{ev1[2]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{ev1[2]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{ev1[3]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{ev1[3]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{ev2[0]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{ev2[0]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{ev2[1]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{ev2[1]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{ev2[2]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{ev2[2]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{ev2[3]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{ev2[3]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{t_value[0]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{t_value[0]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{t_value[1]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{t_value[1]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{t_value[2]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{t_value[2]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{t_value[3]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{t_value[3]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{ev3[0]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{ev3[0]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{ev3[1]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{ev3[1]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{ev3[2]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{ev3[2]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{ev3[3]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{ev3[3]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{final_value[0]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{final_value[0]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{final_value[1]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{final_value[1]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{final_value[2]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{final_value[2]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}, {"variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "displayAnswer": "{final_value[3]}", "customMarkingAlgorithm": "", "scripts": {}, "variableReplacements": [], "answer": "{final_value[3]}", "matchMode": "regex", "showFeedbackIcon": true, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch"}], "type": "gapfill"}], "ungrouped_variables": ["final_value", "op4"], "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"]}], "type": "question"}, {"name": "Truth Table 5 (randomisation cancelled)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Johnny Yi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2810/"}], "rulesets": {}, "ungrouped_variables": ["pre_final_value", "op4", "logic_values", "final_value"], "functions": {"cart": {"language": "jme", "definition": "if(n=2,[[true,true],[true,false],[false,true],[false,false]],map([true]+cart(n-1)[x],x,0..2^(n-1)-1)+map([false]+cart(n-1)[x],x,0..2^(n-1)-1))", "type": "number", "parameters": [["n", "number"]]}, "convch": {"language": "jme", "definition": "switch(ch=\"\\\\neg p\",\"not bool_p[t]\",ch=\"\\\\neg q\",\"not bool_q[t]\",ch=\"p\",\"bool_p[t]\",ch=\"q\",\"bool_q[t]\",ch=\"r\",\"bool_r[t]\",\"not bool_r[t]\")", "type": "string", "parameters": [["ch", "string"]]}, "evaluate": {"language": "javascript", "definition": "return scope.evaluate(expr);", "type": "number", "parameters": [["expr", "string"], ["dependencies", "list"]]}, "conv": {"language": "jme", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "type": "string", "parameters": [["op", "string"]]}, "bool_to_label": {"language": "jme", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "type": "number", "parameters": [["l", "list"]]}, "list_to_boolean": {"language": "jme", "definition": "map(if(l[x]<>0,true,false),x,0..length(l)-1)", "type": "list", "parameters": [["l", "list"]]}}, "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "variables": {"op2": {"templateType": "anything", "definition": "latex(random(\"\\\\land\"))", "name": "op2", "description": "", "group": "Second Bracket"}, "d2": {"templateType": "anything", "definition": "switch(a2=\"\\\\neg p\",p,a2=\"\\\\neg q\",q,r)", "name": "d2", "description": "", "group": "Last "}, "pre_final_value": {"templateType": "anything", "definition": "map(evaluate(pre_t_value[t]+\" \"+conv(op4)+\" \"+pre_ev3[t],[]),t,0..7)", "name": "pre_final_value", "description": "", "group": "Ungrouped variables"}, "p": {"templateType": "anything", "definition": "bool_to_label(list_to_boolean(list(logic_values[0])))", "name": "p", "description": "", "group": "Truth values"}, "pre_ev2": {"templateType": "anything", "definition": "map(evaluate(convch(a1)+\" \"+conv(op2)+\" \"+convch(b1),[bool_p[t],bool_q[t],bool_r[t]]),t,0..7)", "name": "pre_ev2", "description": "", "group": "Second Bracket"}, "final_value": {"templateType": "anything", "definition": "bool_to_label(pre_final_value)", "name": "final_value", "description": "", "group": "Ungrouped variables"}, "logic_symbol_list": {"templateType": "anything", "definition": "[\"p\",\"q\",\"not p\",\"not q\",\"r\",\"not r\"]", "name": "logic_symbol_list", "description": "", "group": "Lists of symbols"}, "c2": {"templateType": "anything", "definition": "latex(switch(a2=\"\\\\neg p\",\"p\",a2=\"\\\\neg q\",\"q\",\"r\"))", "name": "c2", "description": "", "group": "Last "}, "a2": {"templateType": "anything", "definition": "latex(random(\"\\\\neg q\"))", "name": "a2", "description": "", "group": "Last "}, "b": {"templateType": "anything", "definition": "latex(latex_symbol_list[s[1]])", "name": "b", "description": "", "group": "First Bracket"}, "a1": {"templateType": "anything", "definition": "latex(latex_symbol_list[s[2]])", "name": "a1", "description": "", "group": "Second Bracket"}, "t_value": {"templateType": "anything", "definition": "bool_to_label(pre_t_value)", "name": "t_value", "description": "", "group": "First and Second Brackets"}, "op1": {"templateType": "anything", "definition": "latex(random(\"\\\\to\"))", "name": "op1", "description": "", "group": "First and Second Brackets"}, "op4": {"templateType": "anything", "definition": "latex(random(\"\\\\to\"))", "name": "op4", "description": "", "group": "Ungrouped variables"}, "bool_p": {"templateType": "anything", "definition": "list_to_boolean(list(logic_values[0]))", "name": "bool_p", "description": "", "group": "Truth values"}, "logic_values": {"templateType": "anything", "definition": "transpose(matrix(cart(3)))", "name": "logic_values", "description": "", "group": "Ungrouped variables"}, "ev2": {"templateType": "anything", "definition": "bool_to_label(pre_ev2)", "name": "ev2", "description": "", "group": "Second Bracket"}, "q": {"templateType": "anything", "definition": "bool_to_label(list_to_boolean(list(logic_values[1])))", "name": "q", "description": "", "group": "Truth values"}, "a": {"templateType": "anything", "definition": "latex(latex_symbol_list[s[0]])", "name": "a", "description": "", "group": "First Bracket"}, "op": {"templateType": "anything", "definition": "latex(random(\"\\\\lor\"))", "name": "op", "description": "", "group": "First Bracket"}, "pre_ev1": {"templateType": "anything", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[bool_p[t],bool_q[t],bool_r[t]]),t,0..7)", "name": "pre_ev1", "description": "", "group": "First Bracket"}, "ev1": {"templateType": "anything", "definition": "bool_to_label(pre_ev1)", "name": "ev1", "description": "", "group": "First Bracket"}, "r": {"templateType": "anything", "definition": "bool_to_label(list_to_boolean(list(logic_values[2])))", "name": "r", "description": "", "group": "Truth values"}, "s": {"templateType": "anything", "definition": "[2,3,5,1,4,1]", "name": "s", "description": "", "group": "Lists of symbols"}, "b1": {"templateType": "anything", "definition": "latex(latex_symbol_list[s[3]])", "name": "b1", "description": "", "group": "Second Bracket"}, "bool_q": {"templateType": "anything", "definition": "list_to_boolean(list(logic_values[1]))", "name": "bool_q", "description": "", "group": "Truth values"}, "ev3": {"templateType": "anything", "definition": "bool_to_label(pre_ev3)", "name": "ev3", "description": "", "group": "Last "}, "pre_ev3": {"templateType": "anything", "definition": "map(evaluate(convch(a2),[bool_p[t],bool_q[t],bool_r[t]]),t,0..7)", "name": "pre_ev3", "description": "", "group": "Last "}, "pre_t_value": {"templateType": "anything", "definition": "map(evaluate(pre_ev1[t]+\" \"+conv(op1)+\" \"+pre_ev2[t],[]),t,0..7)", "name": "pre_t_value", "description": "", "group": "First and Second Brackets"}, "latex_symbol_list": {"templateType": "anything", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\",\"r\",\"\\\\neg r\"]", "name": "latex_symbol_list", "description": "", "group": "Lists of symbols"}, "bool_r": {"templateType": "anything", "definition": "list_to_boolean(list(logic_values[2]))", "name": "bool_r", "description": "", "group": "Truth values"}}, "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", "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", "r", "bool_p", "bool_q", "bool_r"]}, {"name": "Last ", "variables": ["a2", "pre_ev3", "c2", "d2", "ev3"]}, {"name": "First and Second Brackets", "variables": ["op1", "pre_t_value", "t_value"]}], "parts": [{"unitTests": [], "marks": 0, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "prompt": "Complete the following truth table:
\n\n\n$p$ | $q$ | $r$ | $((\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}\\var{a2} $ |
\n\n$\\var{p[0]}$ | \n$\\var{q[0]}$ | \n$\\var{r[0]}$ | \n[[0]] | \n
\n\n$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n$\\var{r[1]}$ | \n[[1]] | \n
\n\n$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n$\\var{r[2]}$ | \n[[2]] | \n
\n\n$\\var{p[3]}$ | \n$\\var{q[3]}$ | \n$\\var{r[3]}$ | \n[[3]] | \n
\n\n$\\var{p[4]}$ | \n$\\var{q[4]}$ | \n$\\var{r[4]}$ | \n[[4]] | \n
\n\n$\\var{p[5]}$ | \n$\\var{q[5]}$ | \n$\\var{r[5]}$ | \n[[5]] | \n
\n\n$\\var{p[6]}$ | \n$\\var{q[6]}$ | \n$\\var{r[6]}$ | \n[[6]] | \n
\n\n$\\var{p[7]}$ | \n$\\var{q[7]}$ | \n$\\var{r[7]}$ | \n[[7]] | \n
\n\n
", "sortAnswers": false, "extendBaseMarkingAlgorithm": true, "type": "gapfill", "scripts": {}, "gaps": [{"answer": "{final_value[0]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{final_value[0]}"}, {"answer": "{final_value[1]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{final_value[1]}"}, {"answer": "{final_value[2]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{final_value[2]}"}, {"answer": "{final_value[3]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{final_value[3]}"}, {"answer": "{final_value[4]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{final_value[4]}"}, {"answer": "{final_value[5]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{final_value[5]}"}, {"answer": "{final_value[6]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{final_value[6]}"}, {"answer": "{final_value[7]}", "unitTests": [], "marks": 1, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "matchMode": "regex", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "displayAnswer": "{final_value[7]}"}], "showFeedbackIcon": true, "customMarkingAlgorithm": ""}], "variablesTest": {"condition": "a1 <>b1 and\nif(a='p' or a='\\\\neg p',b=random('q','\\\\neg q'),b=random('p','\\\\neg p'))\n", "maxRuns": "150"}, "advice": "First we find the truth table for $\\var{a} \\var{op} \\var{b}$:
\n\n\n $p$ | $q$ | $r$ | $\\var{a} \\var{op} \\var{b}$ |
\n\n$\\var{p[0]}$ | \n$\\var{q[0]}$ | \n$\\var{r[0]}$ | \n$\\var{ev1[0]}$ | \n
\n\n$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n$\\var{r[1]}$ | \n$\\var{ev1[1]}$ | \n
\n\n$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n$\\var{r[2]}$ | \n$\\var{ev1[2]}$ | \n
\n\n$\\var{p[3]}$ | \n$\\var{q[3]}$ | \n$\\var{r[3]}$ | \n$\\var{ev1[3]}$ | \n
\n\n$\\var{p[4]}$ | \n$\\var{q[4]}$ | \n$\\var{r[4]}$ | \n$\\var{ev1[4]}$ | \n
\n\n$\\var{p[5]}$ | \n$\\var{q[5]}$ | \n$\\var{r[5]}$ | \n$\\var{ev1[5]}$ | \n
\n\n$\\var{p[6]}$ | \n$\\var{q[6]}$ | \n$\\var{r[6]}$ | \n$\\var{ev1[6]}$ | \n
\n\n$\\var{p[7]}$ | \n$\\var{q[7]}$ | \n$\\var{r[7]}$ | \n$\\var{ev1[7]}$ | \n
\n\n
\nThen the truth table for $\\var{a1} \\var{op2} \\var{b1}$:
\n\n\n $p$ | $q$ | $r$ | $\\var{a1} \\var{op2} \\var{b1}$ |
\n\n$\\var{p[0]}$ | \n$\\var{q[0]}$ | \n$\\var{r[0]}$ | \n$\\var{ev2[0]}$ | \n
\n\n$\\var{p[1]}$ | \n$\\var{q[1]}$ | \n$\\var{r[1]}$ | \n$\\var{ev2[1]}$ | \n
\n\n$\\var{p[2]}$ | \n$\\var{q[2]}$ | \n$\\var{r[2]}$ | \n$\\var{ev2[2]}$ | \n
\n\n$\\var{p[3]}$ | \n$\\var{q[3]}$ | \n$\\var{r[3]}$ | \n$\\var{ev2[3]}$ | \n
\n\n$\\var{p[4]}$ | \n$\\var{q[4]}$ | \n$\\var{r[4]}$ | \n$\\var{ev2[4]}$ | \n
\n\n$\\var{p[5]}$ | \n$\\var{q[5]}$ | \n$\\var{r[5]}$ | \n$\\var{ev2[5]}$ | \n
\n\n$\\var{p[6]}$ | \n$\\var{q[6]}$ | \n$\\var{r[6]}$ | \n$\\var{ev2[6]}$ | \n
\n\n$\\var{p[7]}$ | \n$\\var{q[7]}$ | \n$\\var{r[7]}$ | \n$\\var{ev2[7]}$ | \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$ | $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})$ |
\n\n$\\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
\n\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
\n\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
\n\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
\n\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
\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
\n\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
\n \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
\n\n
\nNext we find the truth table for $\\var{a2}$:
\n\n\n $\\var{c2}$ | $\\var{a2}$ |
\n\n$\\var{d2[0]}$ | \n$\\var{ev3[0]}$ | \n
\n\n$\\var{d2[1]}$ | \n\n$\\var{ev3[1]}$ | \n
\n\n$\\var{d2[2]}$ | \n\n$\\var{ev3[2]}$ | \n
\n\n$\\var{d2[3]}$ | \n\n$\\var{ev3[3]}$ | \n
\n\n$\\var{d2[4]}$ | \n\n$\\var{ev3[4]}$ | \n
\n\n$\\var{d2[5]}$ | \n\n$\\var{ev3[5]}$ | \n
\n\n$\\var{d2[6]}$ | \n\n$\\var{ev3[6]}$ | \n
\n\n$\\var{d2[7]}$ | \n\n$\\var{ev3[7]}$ | \n
\n\n
\nPutting this all together to obtain the truth table we want:
\n\n\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} $ |
\n\n$\\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
\n\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
\n\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
\n\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
\n\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
\n\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
\n\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
\n\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
\n\n
", "preamble": {"js": "", "css": ""}, "type": "question"}]}], "duration": 54000, "showstudentname": true, "type": "exam", "contributors": [{"name": "Marie Nicholson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1799/"}, {"name": "Johnny Yi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2810/"}], "extensions": [], "custom_part_types": [], "resources": []}