// Numbas version: exam_results_page_options {"feedback": {"showactualmark": true, "advicethreshold": 0, "showanswerstate": true, "allowrevealanswer": true, "feedbackmessages": [], "intro": "", "showtotalmark": true}, "percentPass": 0, "timing": {"timedwarning": {"message": "", "action": "none"}, "allowPause": true, "timeout": {"message": "", "action": "none"}}, "showstudentname": true, "duration": 0, "name": "Blathnaid's copy of Propositions and Truth Tables", "showQuestionGroupNames": false, "question_groups": [{"pickQuestions": 1, "pickingStrategy": "all-ordered", "name": "Group", "questions": [{"name": "Marie's copy of Andrew's copy of Propositions (v2)", "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": "Marie Nicholson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1799/"}], "tags": [], "metadata": {"description": "

Asks to determine whether or not 6 statements are propositions or not i.e. we can determine a truth value or not.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

Which of the following are propositions?

", "advice": "

For the above we have:

\n

1.  {all[select[0]][0]}

\n

{all[select[0]][1]}

\n

2.  {all[select[1]][0]}

\n

{all[select[1]][1]}

\n

3.  {all[select[2]][0]}

\n

{all[select[2]][1]}

\n

4.  {all[select[3]][0]}

\n

{all[select[3]][1]}

\n

5.  {all[select[4]][0]}

\n

{all[select[4]][1]}

\n

6.  {all[select[5]][0]}

\n

{all[select[5]][1]}

", "rulesets": {}, "variables": {"all": {"name": "all", "group": "Ungrouped variables", "definition": "[\n['Every real number is an even integer.','This is a proposition. It is false as there are real numbers which are not even integers, e.g. $1$.',1],\n ['Every even integer is a real number.','A proposition and true.',1],\n ['If $x$ and $y$ are real numbers and $5x=5y$, then $x=y$.','A true proposition as we can cancel off the 5s.',1],\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 ['Some sets are finite.','A true proposition as, for example, the set $\\\\\\{1 \\\\\\}$ is finite.',1],\n ['The derivative of any polynomial of degree $5$ is a polynomial of degree $6$.','This is a false proposition (as the derivative is of degree $4$).',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 ['$\\\\cos(x)=-1$.','This is not a proposition: its truth depends on the value of $x$.',0],\n ['If $n$ is a real number and $n$ is not zero then $n/n=1$.','This a proposition: it is true.',1],\n ['The integer $x$ is a multiple of $7$.','Not a proposition. Its truth depends on the value of $x$.',0],\n ['If the integer $x$ is a multiple of $7$, then it is divisible by $7$.','A true proposition.',1],\n ['Either the integer $x$ is a multiple of $7$, or it is not.','A proposition and true.',1],\n ['Call me Ishmael.','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 ['Newcastle University 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 ['Sunderland football club is at its peak.','Not a proposition. It depends on when it is said, and what \"peak\" means.',0],\n ['Newcastle United finished above Sunderland in the 2014-2015 Season.','A proposition. It is true, according to the records.',1],\n ['England and the UK are two different names for the same place.', 'A proposition. People from England may say it is true. They are wrong.',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 ['Numbers $x$, $y$ and $z$ have the property that $x+y=z$.','Not a proposition, as its truth depends on the values of $x$, $y$ and $z$.',0],\n ['Numbers $x$, $y$ and $z$ have the property that $x+y>z$ or $x+y \\\\le z$.', 'A proposition. One or other of the conditions holds.',1] \n ]", "description": "", "templateType": "anything"}, "marking_matrix": {"name": "marking_matrix", "group": "Ungrouped variables", "definition": "map([all[x][2],(all[x][2])*(-1)+1],x,select)", "description": "", "templateType": "anything"}, "select": {"name": "select", "group": "Ungrouped variables", "definition": "shuffle(list(0..length(all)-1))[0..6]", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["all", "select", "marking_matrix"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "m_n_x", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": false, "shuffleAnswers": false, "displayType": "radiogroup", "warningType": "none", "showCellAnswerState": true, "markingMethod": "sum ticked cells", "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]}"], "matrix": "marking_matrix", "layout": {"type": "all", "expression": ""}, "answers": ["Proposition", "Not a proposition"]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Truth tables 0 (v2)", "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/"}], "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": [], "name": "Second Bracket"}, {"variables": ["q", "p", "disp", "disq"], "name": "Truth values"}], "variables": {"disp": {"group": "Truth values", "templateType": "anything", "definition": "bool_to_label(p)", "description": "", "name": "disp"}, "q": {"group": "Truth values", "templateType": "anything", "definition": "[true,false,true,false]", "description": "", "name": "q"}, "disq": {"group": "Truth values", "templateType": "anything", "definition": "bool_to_label(q)", "description": "", "name": "disq"}, "b": {"group": "First Bracket", "templateType": "anything", "definition": "latex(switch(a=\"p\",\"\\\\neg q\",a=\"q\",\"\\\\neg p\",a=\"\\\\neg p\",random(\"q\",\"\\\\neg q\"),random(\"p\",\"\\\\neg p\")))", "description": "", "name": "b"}, "op": {"group": "First Bracket", "templateType": "anything", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op"}, "latex_symbol_list": {"group": "Lists of symbols", "templateType": "anything", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "description": "", "name": "latex_symbol_list"}, "s": {"group": "Lists of symbols", "templateType": "anything", "definition": "repeat(random(0..3),4)", "description": "", "name": "s"}, "ev1": {"group": "First Bracket", "templateType": "anything", "definition": "bool_to_label(pre_ev1)", "description": "", "name": "ev1"}, "a": {"group": "First Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[0]])", "description": "", "name": "a"}, "p": {"group": "Truth values", "templateType": "anything", "definition": "[true,true,false,false]", "description": "", "name": "p"}, "logic_symbol_list": {"group": "Lists of symbols", "templateType": "anything", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "description": "", "name": "logic_symbol_list"}, "pre_ev1": {"group": "First Bracket", "templateType": "anything", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)", "description": "", "name": "pre_ev1"}}, "ungrouped_variables": [], "rulesets": {}, "functions": {"convch": {"type": "string", "language": "jme", "definition": "switch(ch=\"\\\\neg p\",\"not p[t]\",ch=\"\\\\neg q\",\"not q[t]\",ch=\"p\",\"p[t]\",\"q[t]\")", "parameters": [["ch", "string"]]}, "evaluate": {"type": "number", "language": "javascript", "definition": "return scope.evaluate(expr);", "parameters": [["expr", "string"], ["dependencies", "list"]]}, "conv": {"type": "string", "language": "jme", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "parameters": [["op", "string"]]}, "bool_to_label": {"type": "number", "language": "jme", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "parameters": [["l", "list"]]}}, "showQuestionGroupNames": false, "parts": [{"showCorrectAnswer": true, "scripts": {}, "gaps": [{"answer": "{ev1[0]}", "displayAnswer": "{ev1[0]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev1[1]}", "displayAnswer": "{ev1[1]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev1[2]}", "displayAnswer": "{ev1[2]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev1[3]}", "displayAnswer": "{ev1[3]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "prompt": "

Complete the following truth table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a} \\var{op} \\var{b}$
$\\var{disp[0]}$$\\var{disq[0]}$[[0]]
$\\var{disp[1]}$$\\var{disq[1]}$[[1]]
$\\var{disp[2]}$$\\var{disq[2]}$[[2]]
$\\var{disp[3]}$$\\var{disq[3]}$[[3]]
", "variableReplacements": [], "marks": 0}], "statement": "

In the following question you are asked to construct a truth table for:

\n

\\[\\var{a} \\var{op} \\var{b}.\\]

\n

\n

Enter T if true, else enter F.

\n

\n

\n

\n

\n

\n

\n

\n

\n

\n

\n

", "tags": [], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "", "licence": "Creative Commons Attribution 4.0 International", "description": "

Create a truth table for a logical expression of the form $a \\operatorname{op} b$ where $a, \\;b$ can be the Boolean variables $p,\\;q,\\;\\neg p,\\;\\neg q$ and $\\operatorname{op}$ one of $\\lor,\\;\\land,\\;\\to$.

\n

For example $\\neg q \\to \\neg p$.

"}, "variablesTest": {"condition": "", "maxRuns": "150"}, "advice": "

Here is the truth table.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a} \\var{op} \\var{b}$
$\\var{disp[0]}$$\\var{disq[0]}$$\\var{ev1[0]}$
$\\var{disp[1]}$$\\var{disq[1]}$$\\var{ev1[1]}$
$\\var{disp[2]}$$\\var{disq[2]}$$\\var{ev1[2]}$
$\\var{disp[3]}$$\\var{disq[3]}$$\\var{ev1[3]}$
"}, {"name": "Truth tables 1(v2)", "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/"}], "variable_groups": [{"variables": ["logic_symbol_list", "latex_symbol_list", "s"], "name": "Lists of symbols"}, {"variables": ["a", "b", "op", "pre_ev1", "ev1"], "name": "First Bracket"}, {"variables": ["a1", "b1", "op2", "pre_ev2", "ev2"], "name": "Second Bracket"}, {"variables": ["p", "q", "disp", "disq"], "name": "Truth values"}], "variables": {"disp": {"templateType": "anything", "group": "Truth values", "definition": "bool_to_label(p)", "description": "", "name": "disp"}, "q": {"templateType": "anything", "group": "Truth values", "definition": "[true,false,true,false]", "description": "", "name": "q"}, "p": {"templateType": "anything", "group": "Truth values", "definition": "[true,true,false,false]", "description": "", "name": "p"}, "b": {"templateType": "anything", "group": "First Bracket", "definition": "latex(latex_symbol_list[s[1]])", "description": "", "name": "b"}, "op": {"templateType": "anything", "group": "First Bracket", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op"}, "latex_symbol_list": {"templateType": "anything", "group": "Lists of symbols", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "description": "", "name": "latex_symbol_list"}, "b1": {"templateType": "anything", "group": "Second Bracket", "definition": "latex(latex_symbol_list[s[3]])", "description": "", "name": "b1"}, "a1": {"templateType": "anything", "group": "Second Bracket", "definition": "latex(latex_symbol_list[s[2]])", "description": "", "name": "a1"}, "op2": {"templateType": "anything", "group": "Second Bracket", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op2"}, "op1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op1"}, "disq": {"templateType": "anything", "group": "Truth values", "definition": "bool_to_label(q)", "description": "", "name": "disq"}, "pre_ev2": {"templateType": "anything", "group": "Second Bracket", "definition": "map(evaluate(convch(a1)+\" \"+conv(op2)+\" \"+convch(b1),[p[t],q[t]]),t,0..3)", "description": "", "name": "pre_ev2"}, "s": {"templateType": "anything", "group": "Lists of symbols", "definition": "repeat(random(0..3),4)", "description": "", "name": "s"}, "ev1": {"templateType": "anything", "group": "First Bracket", "definition": "bool_to_label(pre_ev1)", "description": "", "name": "ev1"}, "a": {"templateType": "anything", "group": "First Bracket", "definition": "latex(latex_symbol_list[s[0]])", "description": "", "name": "a"}, "t_value": {"templateType": "anything", "group": "Ungrouped variables", "definition": "bool_to_label(map(evaluate(pre_ev1[t]+\" \"+conv(op1)+\" \"+pre_ev2[t],[]),t,0..3))", "description": "", "name": "t_value"}, "pre_ev1": {"templateType": "anything", "group": "First Bracket", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)", "description": "", "name": "pre_ev1"}, "logic_symbol_list": {"templateType": "anything", "group": "Lists of symbols", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "description": "", "name": "logic_symbol_list"}, "ev2": {"templateType": "anything", "group": "Second Bracket", "definition": "bool_to_label(pre_ev2)", "description": "", "name": "ev2"}}, "ungrouped_variables": ["op1", "t_value"], "rulesets": {}, "showQuestionGroupNames": false, "functions": {"convch": {"type": "string", "language": "jme", "definition": "switch(ch=\"\\\\neg p\",\"not p[t]\",ch=\"\\\\neg q\",\"not q[t]\",ch=\"p\",\"p[t]\",\"q[t]\")", "parameters": [["ch", "string"]]}, "evaluate": {"type": "number", "language": "javascript", "definition": "return scope.evaluate(expr);", "parameters": [["expr", "string"], ["dependencies", "list"]]}, "conv": {"type": "string", "language": "jme", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "parameters": [["op", "string"]]}, "bool_to_label": {"type": "number", "language": "jme", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "parameters": [["l", "list"]]}}, "parts": [{"showCorrectAnswer": true, "scripts": {}, "gaps": [{"answer": "{ev1[0]}", "displayAnswer": "{ev1[0]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev1[1]}", "displayAnswer": "{ev1[1]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev1[2]}", "displayAnswer": "{ev1[2]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev1[3]}", "displayAnswer": "{ev1[3]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev2[0]}", "displayAnswer": "{ev2[0]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev2[1]}", "displayAnswer": "{ev2[1]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev2[2]}", "displayAnswer": "{ev2[2]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev2[3]}", "displayAnswer": "{ev2[3]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{t_value[0]}", "displayAnswer": "{t_value[0]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{t_value[1]}", "displayAnswer": "{t_value[1]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{t_value[2]}", "displayAnswer": "{t_value[2]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{t_value[3]}", "displayAnswer": "{t_value[3]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "prompt": "

Complete the following truth table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a} \\var{op} \\var{b}$$\\var{a1} \\var{op2} \\var{b1}$$(\\var{a} \\var{op} \\var{b}) \\var{op1} (\\var{a1} \\var{op2} \\var{b1})$
$\\var{disp[0]}$$\\var{disq[0]}$[[0]][[4]][[8]]
$\\var{disp[1]}$$\\var{disq[1]}$[[1]][[5]][[9]]
$\\var{disp[2]}$$\\var{disq[2]}$[[2]][[6]][[10]]
$\\var{disp[3]}$$\\var{disq[3]}$[[3]][[7]][[11]]
", "variableReplacements": [], "marks": 0}], "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"}, "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

\n

Enter T if true, else enter F.

\n

\n

\n

\n

\n

\n

\n

\n

\n

\n

\n

", "tags": [], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "", "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)$ 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$.

\n

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

"}, "advice": "

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

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

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

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a1} \\var{op2} \\var{b1}$
$\\var{disp[0]}$$\\var{disq[0]}$$\\var{ev2[0]}$
$\\var{disp[1]}$$\\var{disq[1]}$$\\var{ev2[1]}$
$\\var{disp[2]}$$\\var{disq[2]}$$\\var{ev2[2]}$
$\\var{disp[3]}$$\\var{disq[3]}$$\\var{ev2[3]}$
\n

Putting these together to find $(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$:

\n

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$\\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{ev1[0]}$$\\var{ev2[0]}$$\\var{t_value[0]}$
$\\var{ev1[1]}$$\\var{ev2[1]}$$\\var{t_value[1]}$
$\\var{ev1[2]}$$\\var{ev2[2]}$$\\var{t_value[2]}$
$\\var{ev1[3]}$$\\var{ev2[3]}$$\\var{t_value[3]}$
"}, {"name": "Truth tables 2 (v2) -", "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/"}], "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"}, "variables": {"a": {"templateType": "anything", "group": "First Bracket", "definition": "latex(latex_symbol_list[s[0]])", "description": "", "name": "a"}, "op": {"templateType": "anything", "group": "First Bracket", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op"}, "op4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op4"}, "a1": {"templateType": "anything", "group": "Second Bracket", "definition": "latex(latex_symbol_list[s[2]])", "description": "", "name": "a1"}, "op2": {"templateType": "anything", "group": "Second Bracket", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op2"}, "op1": {"templateType": "anything", "group": "First and Second Brackets", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op1"}, "ev1": {"templateType": "anything", "group": "First Bracket", "definition": "bool_to_label(pre_ev1)", "description": "", "name": "ev1"}, "b": {"templateType": "anything", "group": "First Bracket", "definition": "latex(latex_symbol_list[s[1]])", "description": "", "name": "b"}, "ev3": {"templateType": "anything", "group": "Last ", "definition": "bool_to_label(pre_ev3)", "description": "", "name": "ev3"}, "p": {"templateType": "anything", "group": "Truth values", "definition": "bool_to_label([true,true,false,false])", "description": "", "name": "p"}, "a2": {"templateType": "anything", "group": "Last ", "definition": "latex(random(\"\\\\neg p\",\"\\\\neg q\"))", "description": "", "name": "a2"}, "bool_p": {"templateType": "anything", "group": "Truth values", "definition": "[true,true,false,false]", "description": "", "name": "bool_p"}, "logic_symbol_list": {"templateType": "anything", "group": "Lists of symbols", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "description": "", "name": "logic_symbol_list"}, "pre_ev1": {"templateType": "anything", "group": "First Bracket", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[bool_p[t],bool_q[t]]),t,0..3)", "description": "", "name": "pre_ev1"}, "q": {"templateType": "anything", "group": "Truth values", "definition": "bool_to_label([true,false,true,false])", "description": "", "name": "q"}, "latex_symbol_list": {"templateType": "anything", "group": "Lists of symbols", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "description": "", "name": "latex_symbol_list"}, "pre_ev3": {"templateType": "anything", "group": "Last ", "definition": "map(evaluate(convch(a2),[bool_p[t],bool_q[t]]),t,0..3)", "description": "", "name": "pre_ev3"}, "ev2": {"templateType": "anything", "group": "Second Bracket", "definition": "bool_to_label(pre_ev2)", "description": "", "name": "ev2"}, "b1": {"templateType": "anything", "group": "Second Bracket", "definition": "latex(latex_symbol_list[s[3]])", "description": "", "name": "b1"}, "pre_ev2": {"templateType": "anything", "group": "Second Bracket", "definition": "map(evaluate(convch(a1)+\" \"+conv(op2)+\" \"+convch(b1),[bool_p[t],bool_q[t]]),t,0..3)", "description": "", "name": "pre_ev2"}, "pre_final_value": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(evaluate(pre_t_value[t]+\" \"+conv(op4)+\" \"+pre_ev3[t],[]),t,0..3)", "description": "", "name": "pre_final_value"}, "final_value": {"templateType": "anything", "group": "Ungrouped variables", "definition": "bool_to_label(pre_final_value)", "description": "", "name": "final_value"}, "s": {"templateType": "anything", "group": "Lists of symbols", "definition": "repeat(random(0..3),6)", "description": "", "name": "s"}, "bool_q": {"templateType": "anything", "group": "Truth values", "definition": "[true,false,true,false]", "description": "", "name": "bool_q"}, "t_value": {"templateType": "anything", "group": "First and Second Brackets", "definition": "bool_to_label(pre_t_value)", "description": "", "name": "t_value"}, "pre_t_value": {"templateType": "anything", "group": "First and Second Brackets", "definition": "map(evaluate(pre_ev1[t]+\" \"+conv(op1)+\" \"+pre_ev2[t],[]),t,0..3)", "description": "", "name": "pre_t_value"}}, "ungrouped_variables": ["pre_final_value", "op4", "final_value"], "preamble": {"css": "", "js": ""}, "functions": {"evaluate": {"type": "number", "language": "javascript", "definition": "return scope.evaluate(expr);", "parameters": [["expr", "string"], ["dependencies", "list"]]}, "convch": {"type": "string", "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]\")", "parameters": [["ch", "string"]]}, "conv": {"type": "string", "language": "jme", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "parameters": [["op", "string"]]}, "bool_to_label": {"type": "number", "language": "jme", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "parameters": [["l", "list"]]}}, "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", "bool_p", "bool_q"], "name": "Truth values"}, {"variables": ["a2", "pre_ev3", "ev3"], "name": "Last "}, {"variables": ["op1", "pre_t_value", "t_value"], "name": "First and Second Brackets"}], "parts": [{"customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "prompt": "

Complete the following truth table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a} \\var{op} \\var{b}$$\\var{a1} \\var{op2} \\var{b1}$$(\\var{a} \\var{op} \\var{b}) \\var{op1} (\\var{a1} \\var{op2} \\var{b1})$$\\var{a2} $$((\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}\\var{a2} $
$\\var{p[0]}$$\\var{q[0]}$[[0]][[4]][[8]][[12]][[16]]
$\\var{p[1]}$$\\var{q[1]}$[[1]][[5]][[9]][[13]][[17]]
$\\var{p[2]}$$\\var{q[2]}$[[2]][[6]][[10]][[14]][[18]]
$\\var{p[3]}$$\\var{q[3]}$[[3]][[7]][[11]][[15]][[19]]
", "unitTests": [], "sortAnswers": false, "scripts": {}, "gaps": [{"answer": "{ev1[0]}", "displayAnswer": "{ev1[0]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{ev1[1]}", "displayAnswer": "{ev1[1]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{ev1[2]}", "displayAnswer": "{ev1[2]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{ev1[3]}", "displayAnswer": "{ev1[3]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{ev2[0]}", "displayAnswer": "{ev2[0]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{ev2[1]}", "displayAnswer": "{ev2[1]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{ev2[2]}", "displayAnswer": "{ev2[2]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{ev2[3]}", "displayAnswer": "{ev2[3]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{t_value[0]}", "displayAnswer": "{t_value[0]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{t_value[1]}", "displayAnswer": "{t_value[1]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{t_value[2]}", "displayAnswer": "{t_value[2]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{t_value[3]}", "displayAnswer": "{t_value[3]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{ev3[0]}", "displayAnswer": "{ev3[0]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{ev3[1]}", "displayAnswer": "{ev3[1]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{ev3[2]}", "displayAnswer": "{ev3[2]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{ev3[3]}", "displayAnswer": "{ev3[3]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{final_value[0]}", "displayAnswer": "{final_value[0]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{final_value[1]}", "displayAnswer": "{final_value[1]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{final_value[2]}", "displayAnswer": "{final_value[2]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{final_value[3]}", "displayAnswer": "{final_value[3]}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "showFeedbackIcon": true}], "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

\n

Enter T if true, else enter F.

", "tags": [], "rulesets": {}, "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 $ where each of $a, \\;b,\\;c,\\;d,\\;e$ can be one the Boolean variables $p,\\;q,\\;\\neg p,\\;\\neg q$ and each of $\\operatorname{op1},\\;\\operatorname{op2},\\;\\operatorname{op3},\\;\\operatorname{op4}$ one of $\\lor,\\;\\land,\\;\\to$.

\n

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

"}, "type": "question", "advice": "

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

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

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

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a1} \\var{op2} \\var{b1}$
$\\var{p[0]}$$\\var{q[0]}$$\\var{ev2[0]}$
$\\var{p[1]}$$\\var{q[1]}$$\\var{ev2[1]}$
$\\var{p[2]}$$\\var{q[2]}$$\\var{ev2[2]}$
$\\var{p[3]}$$\\var{q[3]}$$\\var{ev2[3]}$
\n

Putting these together to find $(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$:

\n

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a} \\var{op} \\var{b}$$\\var{a1} \\var{op2} \\var{b1}$$(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$
$\\var{p[0]}$$\\var{q[0]}$$\\var{ev1[0]}$$\\var{ev2[0]}$$\\var{t_value[0]}$
$\\var{p[1]}$$\\var{q[1]}$$\\var{ev1[1]}$$\\var{ev2[1]}$$\\var{t_value[1]}$
$\\var{p[2]}$$\\var{q[2]}$$\\var{ev1[2]}$$\\var{ev2[2]}$$\\var{t_value[2]}$
$\\var{p[3]}$$\\var{q[3]}$$\\var{ev1[3]}$$\\var{ev2[3]}$$\\var{t_value[3]}$
\n

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

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

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

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$$\\var{a2}$$((\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}\\var{a2} $
$\\var{p[0]}$$\\var{q[0]}$$\\var{t_value[0]}$$\\var{ev3[0]}$$\\var{final_value[0]}$
$\\var{p[1]}$$\\var{q[1]}$$\\var{t_value[1]}$$\\var{ev3[1]}$$\\var{final_value[1]}$
$\\var{p[2]}$$\\var{q[2]}$$\\var{t_value[2]}$$\\var{ev3[2]}$$\\var{final_value[2]}$
$\\var{p[3]}$$\\var{q[3]}$$\\var{t_value[3]}$$\\var{ev3[3]}$$\\var{final_value[3]}$
"}, {"name": "Truth tables 3 (v2)-", "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/"}], "variable_groups": [{"variables": ["logic_symbol_list", "latex_symbol_list", "s"], "name": "Lists of symbols"}, {"variables": ["a", "b", "op", "pre_ev1", "ev1"], "name": "First Bracket"}, {"variables": ["a1", "b1", "op2", "pre_ev2", "ev2"], "name": "Second Bracket"}, {"variables": ["p", "q", "disp", "disq"], "name": "Truth values"}, {"variables": ["a2", "b2", "op3", "pre_ev3", "ev3"], "name": "Third Bracket"}, {"variables": ["op1", "pre_t_value", "t_value"], "name": "First and Second Brackets"}], "variables": {"disp": {"templateType": "anything", "group": "Truth values", "definition": "bool_to_label(p)", "description": "", "name": "disp"}, "disq": {"templateType": "anything", "group": "Truth values", "definition": "bool_to_label(q)", "description": "", "name": "disq"}, "a": {"templateType": "anything", "group": "First Bracket", "definition": "latex(latex_symbol_list[s[0]])", "description": "", "name": "a"}, "op": {"templateType": "anything", "group": "First Bracket", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op"}, "op4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op4"}, "a1": {"templateType": "anything", "group": "Second Bracket", "definition": "latex(latex_symbol_list[s[2]])", "description": "", "name": "a1"}, "op2": {"templateType": "anything", "group": "Second Bracket", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op2"}, "op1": {"templateType": "anything", "group": "First and Second Brackets", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op1"}, "ev1": {"templateType": "anything", "group": "First Bracket", "definition": "bool_to_label(pre_ev1)", "description": "", "name": "ev1"}, "b": {"templateType": "anything", "group": "First Bracket", "definition": "latex(latex_symbol_list[s[1]])", "description": "", "name": "b"}, "ev3": {"templateType": "anything", "group": "Third Bracket", "definition": "bool_to_label(pre_ev3)", "description": "", "name": "ev3"}, "p": {"templateType": "anything", "group": "Truth values", "definition": "[true,true,false,false]", "description": "", "name": "p"}, "a2": {"templateType": "anything", "group": "Third Bracket", "definition": "latex(latex_symbol_list[s[4]])", "description": "", "name": "a2"}, "logic_symbol_list": {"templateType": "anything", "group": "Lists of symbols", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "description": "", "name": "logic_symbol_list"}, "pre_t_value": {"templateType": "anything", "group": "First and Second Brackets", "definition": "map(evaluate(pre_ev1[t]+\" \"+conv(op1)+\" \"+pre_ev2[t],[]),t,0..3)", "description": "", "name": "pre_t_value"}, "q": {"templateType": "anything", "group": "Truth values", "definition": "[true,false,true,false]", "description": "", "name": "q"}, "latex_symbol_list": {"templateType": "anything", "group": "Lists of symbols", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "description": "", "name": "latex_symbol_list"}, "pre_ev3": {"templateType": "anything", "group": "Third Bracket", "definition": "map(evaluate(convch(a2)+\" \"+conv(op3)+\" \"+convch(b2),[p[t],q[t]]),t,0..3)", "description": "", "name": "pre_ev3"}, "op3": {"templateType": "anything", "group": "Third Bracket", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op3"}, "ev2": {"templateType": "anything", "group": "Second Bracket", "definition": "bool_to_label(pre_ev2)", "description": "", "name": "ev2"}, "b1": {"templateType": "anything", "group": "Second Bracket", "definition": "latex(latex_symbol_list[s[3]])", "description": "", "name": "b1"}, "b2": {"templateType": "anything", "group": "Third Bracket", "definition": "latex(latex_symbol_list[s[5]])", "description": "", "name": "b2"}, "pre_ev2": {"templateType": "anything", "group": "Second Bracket", "definition": "map(evaluate(convch(a1)+\" \"+conv(op2)+\" \"+convch(b1),[p[t],q[t]]),t,0..3)", "description": "", "name": "pre_ev2"}, "final_value": {"templateType": "anything", "group": "Ungrouped variables", "definition": "bool_to_label(map(evaluate(pre_t_value[t]+\" \"+conv(op4)+\" \"+pre_ev3[t],[]),t,0..3))", "description": "", "name": "final_value"}, "s": {"templateType": "anything", "group": "Lists of symbols", "definition": "repeat(random(0..3),6)", "description": "", "name": "s"}, "t_value": {"templateType": "anything", "group": "First and Second Brackets", "definition": "bool_to_label(pre_t_value)", "description": "", "name": "t_value"}, "pre_ev1": {"templateType": "anything", "group": "First Bracket", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)", "description": "", "name": "pre_ev1"}}, "ungrouped_variables": ["final_value", "op4"], "rulesets": {}, "functions": {"evaluate": {"type": "number", "language": "javascript", "definition": "return scope.evaluate(expr);", "parameters": [["expr", "string"], ["dependencies", "list"]]}, "convch": {"type": "string", "language": "jme", "definition": "switch(ch=\"\\\\neg p\",\"not p[t]\",ch=\"\\\\neg q\",\"not q[t]\",ch=\"p\",\"p[t]\",\"q[t]\")", "parameters": [["ch", "string"]]}, "conv": {"type": "string", "language": "jme", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "parameters": [["op", "string"]]}, "bool_to_label": {"type": "number", "language": "jme", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "parameters": [["l", "list"]]}}, "showQuestionGroupNames": false, "parts": [{"variableReplacementStrategy": "originalfirst", "scripts": {}, "gaps": [{"answer": "{ev1[0]}", "displayAnswer": "{ev1[0]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev1[1]}", "displayAnswer": "{ev1[1]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev1[2]}", "displayAnswer": "{ev1[2]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev1[3]}", "displayAnswer": "{ev1[3]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev2[0]}", "displayAnswer": "{ev2[0]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev2[1]}", "displayAnswer": "{ev2[1]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev2[2]}", "displayAnswer": "{ev2[2]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev2[3]}", "displayAnswer": "{ev2[3]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{t_value[0]}", "displayAnswer": "{t_value[0]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{t_value[1]}", "displayAnswer": "{t_value[1]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{t_value[2]}", "displayAnswer": "{t_value[2]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{t_value[3]}", "displayAnswer": "{t_value[3]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev3[0]}", "displayAnswer": "{ev3[0]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev3[1]}", "displayAnswer": "{ev3[1]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev3[2]}", "displayAnswer": "{ev3[2]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{ev3[3]}", "displayAnswer": "{ev3[3]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{final_value[0]}", "displayAnswer": "{final_value[0]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{final_value[1]}", "displayAnswer": "{final_value[1]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{final_value[2]}", "displayAnswer": "{final_value[2]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"answer": "{final_value[3]}", "displayAnswer": "{final_value[3]}", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "

Complete the following truth table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a} \\var{op} \\var{b}$$\\var{a1} \\var{op2} \\var{b1}$$(\\var{a} \\var{op} \\var{b}) \\var{op1} (\\var{a1} \\var{op2} \\var{b1})$$\\var{a2} \\var{op3} \\var{b2}$$((\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}(\\var{a2} \\var{op3} \\var{b2})$
$\\var{disp[0]}$$\\var{disq[0]}$[[0]][[4]][[8]][[12]][[16]]
$\\var{disp[1]}$$\\var{disq[1]}$[[1]][[5]][[9]][[13]][[17]]
$\\var{disp[2]}$$\\var{disq[2]}$[[2]][[6]][[10]][[14]][[18]]
$\\var{disp[3]}$$\\var{disq[3]}$[[3]][[7]][[11]][[15]][[19]]
", "variableReplacements": [], "marks": 0}], "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"}, "statement": "

In the following question you are asked to construct a truth table for:

\n

\\[((\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}(\\var{a2} \\var{op3} \\var{b2}).\\]

\n

\n

Enter T if true, else enter F.

\n

\n

\n

\n

\n

\n

\n

\n

\n

\n

\n

", "tags": [], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "", "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$.

\n

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

"}, "advice": "

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

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

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

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a1} \\var{op2} \\var{b1}$
$\\var{disp[0]}$$\\var{disq[0]}$$\\var{ev2[0]}$
$\\var{disp[1]}$$\\var{disq[1]}$$\\var{ev2[1]}$
$\\var{disp[2]}$$\\var{disq[2]}$$\\var{ev2[2]}$
$\\var{disp[3]}$$\\var{disq[3]}$$\\var{ev2[3]}$
\n

Putting these together to find $(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$:

\n

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a} \\var{op} \\var{b}$$\\var{a1} \\var{op2} \\var{b1}$$(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$
$\\var{disp[0]}$$\\var{disq[0]}$$\\var{ev1[0]}$$\\var{ev2[0]}$$\\var{t_value[0]}$
$\\var{disp[1]}$$\\var{disq[1]}$$\\var{ev1[1]}$$\\var{ev2[1]}$$\\var{t_value[1]}$
$\\var{disp[2]}$$\\var{disq[2]}$$\\var{ev1[2]}$$\\var{ev2[2]}$$\\var{t_value[2]}$
$\\var{disp[3]}$$\\var{disq[3]}$$\\var{ev1[3]}$$\\var{ev2[3]}$$\\var{t_value[3]}$
\n

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

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

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

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$$\\var{a2} \\var{op3} \\var{b2}$$((\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}(\\var{a2} \\var{op3} \\var{b2})$
$\\var{disp[0]}$$\\var{disq[0]}$$\\var{t_value[0]}$$\\var{ev3[0]}$$\\var{final_value[0]}$
$\\var{disp[1]}$$\\var{disq[1]}$$\\var{t_value[1]}$$\\var{ev3[1]}$$\\var{final_value[1]}$
$\\var{disp[2]}$$\\var{disq[2]}$$\\var{t_value[2]}$$\\var{ev3[2]}$$\\var{final_value[2]}$
$\\var{disp[3]}$$\\var{disq[3]}$$\\var{t_value[3]}$$\\var{ev3[3]}$$\\var{final_value[3]}$
"}, {"name": "Truth tables 4 (v2)", "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/"}], "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", "r", "bool_p", "bool_q", "bool_r"], "name": "Truth values"}, {"variables": ["a2", "pre_ev3", "c2", "d2", "ev3"], "name": "Last "}, {"variables": ["op1", "pre_t_value", "t_value"], "name": "First and Second Brackets"}], "variables": {"a": {"group": "First Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[0]])", "description": "", "name": "a"}, "op": {"group": "First Bracket", "templateType": "anything", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op"}, "op4": {"group": "Ungrouped variables", "templateType": "anything", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op4"}, "a1": {"group": "Second Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[2]])", "description": "", "name": "a1"}, "op2": {"group": "Second Bracket", "templateType": "anything", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op2"}, "c2": {"group": "Last ", "templateType": "anything", "definition": "latex(switch(a2=\"\\\\neg p\",\"p\",a2=\"\\\\neg q\",\"q\",\"r\"))", "description": "", "name": "c2"}, "d2": {"group": "Last ", "templateType": "anything", "definition": "switch(a2=\"\\\\neg p\",p,a2=\"\\\\neg q\",q,r)", "description": "", "name": "d2"}, "logic_values": {"group": "Ungrouped variables", "templateType": "anything", "definition": "transpose(bool_matrix(cart(3)))", "description": "", "name": "logic_values"}, "ev1": {"group": "First Bracket", "templateType": "anything", "definition": "bool_to_label(pre_ev1)", "description": "", "name": "ev1"}, "b": {"group": "First Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[1]])", "description": "", "name": "b"}, "ev3": {"group": "Last ", "templateType": "anything", "definition": "bool_to_label(pre_ev3)", "description": "", "name": "ev3"}, "p": {"group": "Truth values", "templateType": "anything", "definition": "bool_to_label(list_to_boolean(list(logic_values[0])))", "description": "", "name": "p"}, "a2": {"group": "Last ", "templateType": "anything", "definition": "latex(random(\"\\\\neg p\",\"\\\\neg q\",\"\\\\neg r\"))", "description": "", "name": "a2"}, "bool_p": {"group": "Truth values", "templateType": "anything", "definition": "list_to_boolean(list(logic_values[0]))", "description": "", "name": "bool_p"}, "final_value": {"group": "Ungrouped variables", "templateType": "anything", "definition": "bool_to_label(pre_final_value)", "description": "", "name": "final_value"}, "pre_ev1": {"group": "First Bracket", "templateType": "anything", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[bool_p[t],bool_q[t],bool_r[t]]),t,0..7)", "description": "", "name": "pre_ev1"}, "q": {"group": "Truth values", "templateType": "anything", "definition": "bool_to_label(list_to_boolean(list(logic_values[1])))", "description": "", "name": "q"}, "latex_symbol_list": {"group": "Lists of symbols", "templateType": "anything", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\",\"r\",\"\\\\neg r\"]", "description": "", "name": "latex_symbol_list"}, "pre_ev3": {"group": "Last ", "templateType": "anything", "definition": "map(evaluate(convch(a2),[bool_p[t],bool_q[t],bool_r[t]]),t,0..7)", "description": "", "name": "pre_ev3"}, "ev2": {"group": "Second Bracket", "templateType": "anything", "definition": "bool_to_label(pre_ev2)", "description": "", "name": "ev2"}, "bool_r": {"group": "Truth values", "templateType": "anything", "definition": "list_to_boolean(list(logic_values[2]))", "description": "", "name": "bool_r"}, "b1": {"group": "Second Bracket", "templateType": "anything", "definition": "latex(latex_symbol_list[s[3]])", "description": "", "name": "b1"}, "t_value": {"group": "First and Second Brackets", "templateType": "anything", "definition": "bool_to_label(pre_t_value)", "description": "", "name": "t_value"}, "r": {"group": "Truth values", "templateType": "anything", "definition": "bool_to_label(list_to_boolean(list(logic_values[2])))", "description": "", "name": "r"}, "pre_ev2": {"group": "Second Bracket", "templateType": "anything", "definition": "map(evaluate(convch(a1)+\" \"+conv(op2)+\" \"+convch(b1),[bool_p[t],bool_q[t],bool_r[t]]),t,0..7)", "description": "", "name": "pre_ev2"}, "pre_final_value": {"group": "Ungrouped variables", "templateType": "anything", "definition": "map(evaluate(pre_t_value[t]+\" \"+conv(op4)+\" \"+pre_ev3[t],[]),t,0..7)", "description": "", "name": "pre_final_value"}, "logic_symbol_list": {"group": "Lists of symbols", "templateType": "anything", "definition": "[\"p\",\"q\",\"not p\",\"not q\",\"r\",\"not r\"]", "description": "", "name": "logic_symbol_list"}, "s": {"group": "Lists of symbols", "templateType": "anything", "definition": "repeat(random(0..5),6)", "description": "", "name": "s"}, "bool_q": {"group": "Truth values", "templateType": "anything", "definition": "list_to_boolean(list(logic_values[1]))", "description": "", "name": "bool_q"}, "op1": {"group": "First and Second Brackets", "templateType": "anything", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "description": "", "name": "op1"}, "pre_t_value": {"group": "First and Second Brackets", "templateType": "anything", "definition": "map(evaluate(pre_ev1[t]+\" \"+conv(op1)+\" \"+pre_ev2[t],[]),t,0..7)", "description": "", "name": "pre_t_value"}}, "ungrouped_variables": ["pre_final_value", "op4", "logic_values", "final_value"], "functions": {"conv": {"type": "string", "language": "jme", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "parameters": [["op", "string"]]}, "cart": {"type": "list", "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))", "parameters": [["n", "number"]]}, "evaluate": {"type": "number", "language": "javascript", "definition": "return scope.evaluate(expr);", "parameters": [["expr", "string"], ["dependencies", "list"]]}, "bool_matrix": {"type": "matrix", "language": "jme", "definition": "matrix(map(map(if(c,1,0),c,row),row,m))", "parameters": [["m", "list"]]}, "convch": {"type": "string", "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]\")", "parameters": [["ch", "string"]]}, "bool_to_label": {"type": "number", "language": "jme", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "parameters": [["l", "list"]]}, "list_to_boolean": {"type": "list", "language": "jme", "definition": "map(if(l[x]<>0,true,false),x,0..length(l)-1)", "parameters": [["l", "list"]]}}, "parts": [{"prompt": "

Complete the following truth table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$r$$((\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1}))\\var{op4}\\var{a2} $
$\\var{p[0]}$$\\var{q[0]}$$\\var{r[0]}$[[0]]
$\\var{p[1]}$$\\var{q[1]}$$\\var{r[1]}$[[1]]
$\\var{p[2]}$$\\var{q[2]}$$\\var{r[2]}$[[2]]
$\\var{p[3]}$$\\var{q[3]}$$\\var{r[3]}$[[3]]
$\\var{p[4]}$$\\var{q[4]}$$\\var{r[4]}$[[4]]
$\\var{p[5]}$$\\var{q[5]}$$\\var{r[5]}$[[5]]
$\\var{p[6]}$$\\var{q[6]}$$\\var{r[6]}$[[6]]
$\\var{p[7]}$$\\var{q[7]}$$\\var{r[7]}$[[7]]
", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "useCustomName": false, "customName": "", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"answer": "{final_value[0]}", "displayAnswer": "{final_value[0]}", "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "useCustomName": false, "customName": "", "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{final_value[1]}", "displayAnswer": "{final_value[1]}", "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "useCustomName": false, "customName": "", "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{final_value[2]}", "displayAnswer": "{final_value[2]}", "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "useCustomName": false, "customName": "", "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{final_value[3]}", "displayAnswer": "{final_value[3]}", "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "useCustomName": false, "customName": "", "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{final_value[4]}", "displayAnswer": "{final_value[4]}", "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "useCustomName": false, "customName": "", "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{final_value[5]}", "displayAnswer": "{final_value[5]}", "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "useCustomName": false, "customName": "", "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{final_value[6]}", "displayAnswer": "{final_value[6]}", "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "useCustomName": false, "customName": "", "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"answer": "{final_value[7]}", "displayAnswer": "{final_value[7]}", "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "useCustomName": false, "customName": "", "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "patternmatch", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}], "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"}, "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

\n

Enter T if true, else enter F.

\n

\n

\n

\n

\n

\n

\n

\n

\n

\n

\n

", "tags": [], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "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 $ where each of $a, \\;b,\\;c,\\;d,\\;e$ can be one the Boolean variables $p,\\;q,\\;r,\\;\\neg p,\\;\\neg q,\\;\\neg r$ and each of $\\operatorname{op1},\\;\\operatorname{op2},\\;\\operatorname{op3},\\;\\operatorname{op4}$ one of $\\lor,\\;\\land,\\;\\to$.

\n

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

"}, "advice": "

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

\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$r$$\\var{a} \\var{op} \\var{b}$
$\\var{p[0]}$$\\var{q[0]}$$\\var{r[0]}$$\\var{ev1[0]}$
$\\var{p[1]}$$\\var{q[1]}$$\\var{r[1]}$$\\var{ev1[1]}$
$\\var{p[2]}$$\\var{q[2]}$$\\var{r[2]}$$\\var{ev1[2]}$
$\\var{p[3]}$$\\var{q[3]}$$\\var{r[3]}$$\\var{ev1[3]}$
$\\var{p[4]}$$\\var{q[4]}$$\\var{r[4]}$$\\var{ev1[4]}$
$\\var{p[5]}$$\\var{q[5]}$$\\var{r[5]}$$\\var{ev1[5]}$
$\\var{p[6]}$$\\var{q[6]}$$\\var{r[6]}$$\\var{ev1[6]}$
$\\var{p[7]}$$\\var{q[7]}$$\\var{r[7]}$$\\var{ev1[7]}$
\n

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

\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n
$p$$q$$r$$\\var{a1} \\var{op2} \\var{b1}$
$\\var{p[0]}$$\\var{q[0]}$$\\var{r[0]}$$\\var{ev2[0]}$
$\\var{p[1]}$$\\var{q[1]}$$\\var{r[1]}$$\\var{ev2[1]}$
$\\var{p[2]}$$\\var{q[2]}$$\\var{r[2]}$$\\var{ev2[2]}$
$\\var{p[3]}$$\\var{q[3]}$$\\var{r[3]}$$\\var{ev2[3]}$
$\\var{p[4]}$$\\var{q[4]}$$\\var{r[4]}$$\\var{ev2[4]}$
$\\var{p[5]}$$\\var{q[5]}$$\\var{r[5]}$$\\var{ev2[5]}$
$\\var{p[6]}$$\\var{q[6]}$$\\var{r[6]}$$\\var{ev2[6]}$
$\\var{p[7]}$$\\var{q[7]}$$\\var{r[7]}$$\\var{ev2[7]}$
\n

Putting these together to find $(\\var{a} \\var{op} \\var{b})\\var{op1}(\\var{a1} \\var{op2} \\var{b1})$:

\n

\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n
$p$$q$$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})$
$\\var{p[0]}$$\\var{q[0]}$$\\var{r[0]}$$\\var{ev1[0]}$$\\var{ev2[0]}$$\\var{t_value[0]}$
$\\var{p[1]}$$\\var{q[1]}$$\\var{r[1]}$$\\var{ev1[1]}$$\\var{ev2[1]}$$\\var{t_value[1]}$
$\\var{p[2]}$$\\var{q[2]}$$\\var{r[2]}$$\\var{ev1[2]}$$\\var{ev2[2]}$$\\var{t_value[2]}$
$\\var{p[3]}$$\\var{q[3]}$$\\var{r[3]}$$\\var{ev1[3]}$$\\var{ev2[3]}$$\\var{t_value[3]}$
$\\var{p[4]}$$\\var{q[4]}$$\\var{r[4]}$$\\var{ev1[4]}$$\\var{ev2[4]}$$\\var{t_value[4]}$
$\\var{p[5]}$$\\var{q[5]}$$\\var{r[5]}$$\\var{ev1[5]}$$\\var{ev2[5]}$$\\var{t_value[5]}$
$\\var{p[6]}$$\\var{q[6]}$$\\var{r[6]}$$\\var{ev1[6]}$$\\var{ev2[6]}$$\\var{t_value[6]}$
$\\var{p[7]}$$\\var{q[7]}$$\\var{r[7]}$$\\var{ev1[7]}$$\\var{ev2[7]}$$\\var{t_value[7]}$
\n

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

\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$\\var{c2}$$\\var{a2}$
$\\var{d2[0]}$$\\var{ev3[0]}$
$\\var{d2[1]}$$\\var{ev3[1]}$
$\\var{d2[2]}$$\\var{ev3[2]}$
$\\var{d2[3]}$$\\var{ev3[3]}$
$\\var{d2[4]}$$\\var{ev3[4]}$
$\\var{d2[5]}$$\\var{ev3[5]}$
$\\var{d2[6]}$$\\var{ev3[6]}$
$\\var{d2[7]}$$\\var{ev3[7]}$
\n

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

\n\n\n \n\n\n\n \n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n \n\n\n\n\n\n
$p$$q$$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} $
$\\var{p[0]}$$\\var{q[0]}$$\\var{r[0]}$$\\var{t_value[0]}$$\\var{ev3[0]}$$\\var{final_value[0]}$
$\\var{p[1]}$$\\var{q[1]}$$\\var{r[1]}$$\\var{t_value[1]}$$\\var{ev3[1]}$$\\var{final_value[1]}$
$\\var{p[2]}$$\\var{q[2]}$$\\var{r[2]}$$\\var{t_value[2]}$$\\var{ev3[2]}$$\\var{final_value[2]}$
$\\var{p[3]}$$\\var{q[3]}$$\\var{r[3]}$$\\var{t_value[3]}$$\\var{ev3[3]}$$\\var{final_value[3]}$
$\\var{p[4]}$$\\var{q[4]}$$\\var{r[4]}$$\\var{t_value[4]}$$\\var{ev3[4]}$$\\var{final_value[4]}$
$\\var{p[5]}$$\\var{q[5]}$$\\var{r[5]}$$\\var{t_value[5]}$$\\var{ev3[5]}$$\\var{final_value[5]}$
$\\var{p[6]}$$\\var{q[6]}$$\\var{r[6]}$$\\var{t_value[6]}$$\\var{ev3[6]}$$\\var{final_value[6]}$
$\\var{p[7]}$$\\var{q[7]}$$\\var{r[7]}$$\\var{t_value[7]}$$\\var{ev3[7]}$$\\var{final_value[7]}$
"}]}], "navigation": {"preventleave": false, "showresultspage": "oncompletion", "showfrontpage": false, "allowregen": false, "onleave": {"message": "

You must answer each part of the question

", "action": "none"}, "reverse": true, "browse": true}, "type": "exam", "metadata": {"description": "

One question on determining whether statements are propositions.

\n

Four questions about truth tables for various logical expressions.

", "licence": "Creative Commons Attribution 4.0 International"}, "contributors": [{"name": "Blathnaid Sheridan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/447/"}, {"name": "Marie Nicholson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1799/"}], "extensions": [], "custom_part_types": [], "resources": []}