// Numbas version: finer_feedback_settings
{"name": "Truth table v2", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {}, "extensions": [], "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"]}], "ungrouped_variables": ["op1", "t_value"], "parts": [{"prompt": "
Complete the following truth table:
\n\n\n\n$p$ | \n$q$ | \n$p \\to q$ | \n$\\neg p \\to \\neg q$ | \n$(p \\to q) \\wedge (\\neg p \\to \\neg q)$ | \n
\n\nT | \nT | \n[[0]] | \n[[4]] | \n[[8]] | \n
\n\nT | \nF | \n[[1]] | \n[[5]] | \n[[9]] | \n
\n\nF | \nT | \n[[2]] | \n[[6]] | \n[[10]] | \n
\n\nF | \nF | \n[[3]] | \n[[7]] | \n[[11]] | \n
\n\n
\n", "variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "gapfill", "showCorrectAnswer": true, "gaps": [{"variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": false, "matchMode": "regex", "displayAnswer": "{ev1[0]}", "marks": 1, "answer": "T"}, {"variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": false, "matchMode": "regex", "displayAnswer": "{ev1[1]}", "marks": 1, "answer": "F"}, {"variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": false, "matchMode": "regex", "displayAnswer": "{ev1[2]}", "marks": 1, "answer": "T"}, {"variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": false, "matchMode": "regex", "displayAnswer": "{ev1[3]}", "marks": 1, "answer": "T"}, {"variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": false, "matchMode": "regex", "displayAnswer": "{ev2[0]}", "marks": 1, "answer": "T"}, {"variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": false, "matchMode": "regex", "displayAnswer": "{ev2[1]}", "marks": 1, "answer": "T"}, {"variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": false, "matchMode": "regex", "displayAnswer": "{ev2[2]}", "marks": 1, "answer": "F"}, {"variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": false, "matchMode": "regex", "displayAnswer": "{ev2[3]}", "marks": 1, "answer": "T"}, {"variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": false, "matchMode": "regex", "displayAnswer": "{t_value[0]}", "marks": 1, "answer": "T"}, {"variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": false, "matchMode": "regex", "displayAnswer": "{t_value[1]}", "marks": 1, "answer": "F"}, {"variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": false, "matchMode": "regex", "displayAnswer": "{t_value[2]}", "marks": 1, "answer": "F"}, {"variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "patternmatch", "showCorrectAnswer": false, "matchMode": "regex", "displayAnswer": "{t_value[3]}", "marks": 1, "answer": "T"}], "marks": 0}], "functions": {"evaluate": {"type": "number", "definition": "return scope.evaluate(expr);", "parameters": [["expr", "string"], ["dependencies", "list"]], "language": "javascript"}, "bool_to_label": {"type": "number", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "parameters": [["l", "list"]], "language": "jme"}, "conv": {"type": "string", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "parameters": [["op", "string"]], "language": "jme"}, "convch": {"type": "string", "definition": "switch(ch=\"\\\\neg p\",\"not p[t]\",ch=\"\\\\neg q\",\"not q[t]\",ch=\"p\",\"p[t]\",\"q[t]\")", "parameters": [["ch", "string"]], "language": "jme"}}, "preamble": {"css": "", "js": ""}, "variables": {"t_value": {"definition": "bool_to_label(map(evaluate(pre_ev1[t]+\" \"+conv(op1)+\" \"+pre_ev2[t],[]),t,0..3))", "name": "t_value", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "ev1": {"definition": "bool_to_label(pre_ev1)", "name": "ev1", "description": "", "group": "First Bracket", "templateType": "anything"}, "p": {"definition": "[true,true,false,false]", "name": "p", "description": "", "group": "Truth values", "templateType": "anything"}, "disq": {"definition": "bool_to_label(q)", "name": "disq", "description": "", "group": "Truth values", "templateType": "anything"}, "pre_ev1": {"definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)", "name": "pre_ev1", "description": "", "group": "First Bracket", "templateType": "anything"}, "a": {"definition": "latex(latex_symbol_list[s[0]])", "name": "a", "description": "", "group": "First Bracket", "templateType": "anything"}, "b1": {"definition": "latex(latex_symbol_list[s[3]])", "name": "b1", "description": "", "group": "Second Bracket", "templateType": "anything"}, "op1": {"definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "name": "op1", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "logic_symbol_list": {"definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "name": "logic_symbol_list", "description": "", "group": "Lists of symbols", "templateType": "anything"}, "b": {"definition": "latex(latex_symbol_list[s[1]])", "name": "b", "description": "", "group": "First Bracket", "templateType": "anything"}, "a1": {"definition": "latex(latex_symbol_list[s[2]])", "name": "a1", "description": "", "group": "Second Bracket", "templateType": "anything"}, "latex_symbol_list": {"definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "name": "latex_symbol_list", "description": "", "group": "Lists of symbols", "templateType": "anything"}, "pre_ev2": {"definition": "map(evaluate(convch(a1)+\" \"+conv(op2)+\" \"+convch(b1),[p[t],q[t]]),t,0..3)", "name": "pre_ev2", "description": "", "group": "Second Bracket", "templateType": "anything"}, "op": {"definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "name": "op", "description": "", "group": "First Bracket", "templateType": "anything"}, "op2": {"definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "name": "op2", "description": "", "group": "Second Bracket", "templateType": "anything"}, "s": {"definition": "repeat(random(0..3),4)", "name": "s", "description": "", "group": "Lists of symbols", "templateType": "anything"}, "ev2": {"definition": "bool_to_label(pre_ev2)", "name": "ev2", "description": "", "group": "Second Bracket", "templateType": "anything"}, "disp": {"definition": "bool_to_label(p)", "name": "disp", "description": "", "group": "Truth values", "templateType": "anything"}, "q": {"definition": "[true,false,true,false]", "name": "q", "description": "", "group": "Truth values", "templateType": "anything"}}, "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"}, "tags": [], "name": "Truth table v2", "advice": "\n\n\n | | |
\n\n | \n | \n | \n
\n\n | \n | \n | \n
\n\n | \n | \n | \n
\n\n | \n | \n | \n
\n\n
", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "Removed the variability.
"}, "statement": "In the following question you are asked to construct a truth table for:
\n\\[((p \\to q) \\wedge (\\neg p \\to \\neg q).\\]
\n\nEnter T if true, else enter F.
\n\n\n\n\n\n\n\n\n\n\n", "type": "question", "contributors": [{"name": "Peter Chapman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/210/"}]}]}], "contributors": [{"name": "Peter Chapman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/210/"}]}