// Numbas version: exam_results_page_options {"name": "Relations: Partial Ordering and Hasse Diagram", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [["question-resources/hasse.png", "/srv/numbas/media/question-resources/hasse.png"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"statement": "

Another important relation is called a partial order. We say that a relation $\\leq$ is a partial order when it has the three characteristic qualities:

\n
\n
• $a\\leq a$ always
• \n
• if $a\\leq b$ and $b \\leq a$ then $b=a$
• \n
• if $a \\leq b$ and $b \\leq c$ then $a \\leq c$.
• \n
\n

Typically, we take a set together with partial ordering such as \"less than or equal to\" $\\leq$, \"subset\" $\\subseteq$ or \"divides\" $|$. Together, the partial ordering and set are called a partially ordered set or poset.

\n

Instead of an arrow diagram, we use a Hasse Diagram to visualise a poset. This communicates the relation between elements of the set with as few edges as possible.

\n

Consider the set

\n

$A = \\left\\{ \\left\\{1\\right\\} ,\\left\\{2 \\right\\} ,\\left\\{3 \\right\\},\\left\\{1,2 \\right\\} ,\\left\\{ 3,4\\right\\},\\left\\{1,2,4 \\right\\},\\left\\{1,3,4 \\right\\},\\left\\{1,2,4,5 \\right\\},\\left\\{ 1,2,3,5 \\right\\} \\right\\}$

\n

together with the partial ordering $\\subseteq$.

See the steps section above for a general description for how to design Hasse diagrams.

\n

A good rule of thumb is to work from the bottom up. Join all 1-element sets to those 2-element sets that contain them as a subset. Then do the same for 2-element sets to 3-element sets, and 3-element sets to 4-element sets.

\n

Next check if any of the 1-element sets are contained in any of the 3-element sets that they are not already connected to by a path of edges. If they are, join these vertices. Do the same for 2-element sets contained in 4-element sets.

\n

Finally, check if any of the 1-element sets are contained in any of the 4-element sets that they are not already connected to by a path of edges.

", "functions": {"createNetwork": {"definition": "// This function creates the board and sets it up, then returns an\n// HTML div tag containing the board.\n \n// The line is described by the equation \n// y = a*x + b\n\n// This function takes as its parameters the coefficients a and b,\n// and the coordinates (x2,y2) of a point on the line.\n\n// First, make the JSXGraph board.\n// The function provided by the JSXGraph extension wraps the board up in \n// a div tag so that it's easier to embed in the page.\nvar div = Numbas.extensions.jsxgraph.makeBoard('300px','400px',\n{boundingBox: [0,4.5,1,0.5],\n axis: false,\n showNavigation: false,\n grid: false\n});\n\n//console.log(\"Extensions\")\n//console.log(Numbas.extensions);\n\n// div.board is the object created by JSXGraph, which you use to \n// manipulate elements\n\nvar redColor='#ff0000';\nvar blueColor='#0000ff';\nvar grayColor='#9b9b9b';\n\nvar PointStyle={face:'o', size:4, fixed:false,label:{fontSize:20}};\nvar LineStyle={fixed:true,straightFirst:false,straightLast:false,strokeWidth:2,dash:0,strokeColor:blueColor};\n\n\nquestion.parts[0].trueEdges=new Set([\"{1,2,4,5}gt{1,2,4}\", \"{1,2,3,5}gt{1,2}\", \"{1,2,3,5}gt{3}\", \"{1,3,4}gt{3,4}\", \"{1,3,4}gt{1}\", \"{1,2,4}gt{1,2}\", \"{1,2}gt{1}\", \"{1,2}gt{2}\", \"{3,4}gt{3}\"]);\n\nquestion.parts[0].allEdges = new Set([\"{1,2,4,5}gt{1,2,4}\", \"{1,2,4,5}gt{1,2}\", \"{1,2,4,5}gt{1}\", \"{1,2,4,5}gt{2}\", \"{1,2,3,5}gt{1,2}\", \"{1,2,3,5}gt{1}\", \"{1,2,3,5}gt{2}\", \"{1,2,3,5}gt{3}\", \"{1,3,4}gt{3,4}\", \"{1,3,4}gt{1}\", \"{1,3,4}gt{3}\", \"{1,2,4}gt{1,2}\", \"{1,2,4}gt{1}\", \"{1,2,4}gt{2}\", \"{1,2}gt{1}\", \"{1,2}gt{2}\", \"{3,4}gt{3}\"]);\n\nquestion.parts[0].removableEdges = new Set([\"{1,2,4,5}gt{1,2}\", \"{1,2,4,5}gt{1}\", \"{1,2,4,5}gt{2}\", \"{1,2,4,5}gt{1}\", \"{1,2,4,5}gt{2}\", \"{1,2,3,5}gt{1}\", \"{1,2,3,5}gt{2}\", \"{1,3,4}gt{3}\", \"{1,2,4}gt{1}\", \"{1,2,4}gt{2}\"]);\n\nquestion.parts[0].constructedEdges=new Set();\n\nvar lineDict={};\n\nvar point0selected=false\nvar point0\n\n\nfunction changePointStyle(){\n //console.log(this);\n if(this.selected==true){\n this.selected=false;\n this.setAttribute({fillColor:redColor,strokeColor:redColor});\n \n point0selected=false\n \n } else {\n this.selected=true ;\n this.setAttribute({fillColor:blueColor,strokeColor:blueColor});\n \n if(point0selected==false){\n point0selected=true\n point0=this\n } else {\n if(point0.Y()>this.Y()){\n lineName=point0.name+\"gt\"+this.name;\n } else if (point0.Y()b", "maxRuns": 100}, "tags": [], "metadata": {"licence": "None specified", "description": ""}, "ungrouped_variables": ["a", "b"], "variable_groups": [], "variables": {"b": {"templateType": "randrange", "group": "Ungrouped variables", "description": "", "name": "b", "definition": "random(0.1 .. 1#0.1)"}, "a": {"templateType": "randrange", "group": "Ungrouped variables", "description": "", "name": "a", "definition": "random(0.1 .. 1#0.1)"}}, "extensions": ["jsxgraph"], "preamble": {"js": "", "css": ""}, "parts": [{"steps": [{"prompt": "
\n
• If $A \\subsetneq B$ and there is no $C$ such that $A \\subsetneq C \\subsetneq B$, draw a line between $A$ and $B$, with $A$ positioned lower than $B$.
• \n
• Do not draw any lines that can be deduced by the transitive property.
• \n
• Do not draw any loops to indicate the reflexive property.
• \n
\n

For example, the poset $(\\left\\{1,2,3,4,5,6\\right\\},|)$ is a poset. Its corresponding Hasse diagram is

\n

", "useCustomName": false, "extendBaseMarkingAlgorithm": true, "scripts": {}, "customMarkingAlgorithm": "", "marks": 0, "customName": "", "showFeedbackIcon": true, "type": "information", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "unitTests": []}], "stepsPenalty": 0, "prompt": "

Make a Hasse Diagram for this poset. Click on two verticies to make or destroy the edge between them.

\n

{createNetwork()}