Skip to content

Commit

Permalink
more rearranges
Browse files Browse the repository at this point in the history
  • Loading branch information
hayden-MB committed Feb 5, 2025
1 parent 064cb79 commit c4cd943
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@
<text>Proof odd-iff-square-odd</text>
</name>
<questiontext format="html">
<text><![CDATA[<p>Drag items from the available list on the right to the answer list on the left to construct a correct proof of the following theorem. </p>
<p><strong>Theorem.</strong> {@thm@}</p>
[[parsons input="ans1" log="true"]]
{# parsons_encode(proof_steps) #}
[[/parsons ]]
<text><![CDATA[<p>Drag items from the available list on the right to the answer list on the left to construct a correct proof of the following theorem. </p>
<p><strong>Theorem.</strong> {@thm@}</p>
[[parsons input="ans1" log="true"]]
{# parsons_encode(proof_steps) #}
[[/parsons ]]
<p>[[input:ans1]] [[validation:ans1]]</p>]]></text>
</questiontext>
<generalfeedback format="html">
<text><![CDATA[[[comment]]
This parsons' input will automatically feedback a model solution (the "teacher's answer") unless the input option 'hideanswer' is used or the PRT is on quiet respectively.
Below are examples of how to format the worked solutions using the proof_display functions.
[[/comment]]
[[if test='len1=2' ]]
Notice this proof has sub-proofs, which can occur in any order. Therefore, we have multiple correct versions of this proof. For example:
<table><tr>
<td><div class="proof">{@proof_display_para(tal[1], proof_steps)@}
<td><div class="proof">{@proof_display_para(tal[2], proof_steps)@}
</tr></table>
Can you see the differences between these proofs?
[[/if]]
[[if test='len1>2' ]]
{@proof_display_para(tal[1], proof_steps)@}
[[/if]]
[[if test='len1<2' ]]
{@proof_display_para(tal[1], proof_steps)@}
<text><![CDATA[[[comment]]
This parsons' input will automatically feedback a model solution (the "teacher's answer") unless the input option 'hideanswer' is used or the PRT is on quiet respectively.
Below are examples of how to format the worked solutions using the proof_display functions.
[[/comment]]
[[if test='len1=2' ]]
Notice this proof has sub-proofs, which can occur in any order. Therefore, we have multiple correct versions of this proof. For example:
<table><tr>
<td><div class="proof">{@proof_display_para(tal[1], proof_steps)@}
<td><div class="proof">{@proof_display_para(tal[2], proof_steps)@}
</tr></table>
Can you see the differences between these proofs?
[[/if]]
[[if test='len1>2' ]]
{@proof_display_para(tal[1], proof_steps)@}
[[/if]]
[[if test='len1<2' ]]
{@proof_display_para(tal[1], proof_steps)@}
[[/if]]]]></text>
</generalfeedback>
<defaultgrade>1</defaultgrade>
Expand All @@ -43,60 +43,60 @@ Can you see the differences between these proofs?
<text>2025012100</text>
</stackversion>
<questionvariables>
<text><![CDATA[stack_include_contrib("prooflib.mac");
/* STACK is distributed with a number of pre-written proofs. See
https://github.com/maths/moodle-qtype_stack/tree/master/stack/maxima/contrib/proofsamples
The proof below is copied from
stack_include_contrib("proofsamples/odd-squaredodd.mac");
We've copied it to make sure there are alternative proofs for iff.
*/
/****************************************************************/
thm:"\\(n\\) is odd if and only if \\(n^2\\) is odd.";
/****************************************************************/
proof_steps: [
["assodd", "Assume that \\(n\\) is odd.",
"This is the hypothesis in the first half of an if any only if proof"],
["defn_odd", "Then there exists an \\(m\\in\\mathbb{Z}\\) such that \\(n=2m+1\\)."],
["alg_odd", "\\( n^2 = (2m+1)^2 = 2(2m^2+2m)+1.\\)"],
["def_M_odd", "Define \\(M=2m^2+2m\\in\\mathbb{Z}\\) then \\(n^2=2M+1\\).",
"Notice we have satisfied the algebraic definition that \\(n^2\\) is an odd number."],
["conc_odd", "Hence \\(n^2\\) is odd.",
"This is the conclusion in the first half of an if any only if proof"],
["contrapos", "We reformulate \"\\(n^2\\) is odd \\(\\Rightarrow \\) \\(n\\) is odd \" as the contrapositive.",
"This reformulation enables us to start with \\(n\\) and not start with \\(n^2\\) which is simpler."],
["assnotodd", "Assume that \\(n\\) is not odd.",
"This is the reformulated hypothesis in the second half of an if any only if proof"],
["even", "Then \\(n\\) is even, and so there exists an \\(m\\in\\mathbb{Z}\\) such that \\(n=2m\\)."],
["alg_even", "\\( n^2 = (2m)^2 = 2(2m^2).\\)"],
["def_M_even", "Define \\(M=2m^2\\in\\mathbb{Z}\\) then \\(n^2=2M\\)."],
["conc_even", "Hence \\(n^2\\) is even.",
"This is the conclusion in the second half of an if any only if proof"
]
];
/****************************************************************/
/* This is how the teacher defines their answer, as nested proofs. */
proof1:proof("assodd","defn_odd","alg_odd","def_M_odd","conc_odd");
proof2:proof("contrapos","assnotodd","even","alg_even","def_M_even","conc_even");
proof_ans:proof_iff(proof1,proof2);
/* The variable "proof_steps", etc., are defined in the above file. Permute the steps randomly. */
proof_steps: random_permutation(proof_steps);
/* Generate the alternative proofs. */
tal: proof_alternatives(proof_ans);
len1: length(tal)
/* Below is one "wrong" answer generated by sorting the correct answer keys. */
wa1:apply(proof,sort(args(proof_flatten(tal[1]))));
/* Create a set of flattened proofs. */
<text><![CDATA[stack_include_contrib("prooflib.mac");
/* STACK is distributed with a number of pre-written proofs. See
https://github.com/maths/moodle-qtype_stack/tree/master/stack/maxima/contrib/proofsamples
The proof below is copied from
stack_include_contrib("proofsamples/odd-squaredodd.mac");
We've copied it to make sure there are alternative proofs for iff.
*/
/****************************************************************/
thm:"\\(n\\) is odd if and only if \\(n^2\\) is odd.";
/****************************************************************/
proof_steps: [
["assodd", "Assume that \\(n\\) is odd.",
"This is the hypothesis in the first half of an if any only if proof"],
["defn_odd", "Then there exists an \\(m\\in\\mathbb{Z}\\) such that \\(n=2m+1\\)."],
["alg_odd", "\\( n^2 = (2m+1)^2 = 2(2m^2+2m)+1.\\)"],
["def_M_odd", "Define \\(M=2m^2+2m\\in\\mathbb{Z}\\) then \\(n^2=2M+1\\).",
"Notice we have satisfied the algebraic definition that \\(n^2\\) is an odd number."],
["conc_odd", "Hence \\(n^2\\) is odd.",
"This is the conclusion in the first half of an if any only if proof"],
["contrapos", "We reformulate \"\\(n^2\\) is odd \\(\\Rightarrow \\) \\(n\\) is odd \" as the contrapositive.",
"This reformulation enables us to start with \\(n\\) and not start with \\(n^2\\) which is simpler."],
["assnotodd", "Assume that \\(n\\) is not odd.",
"This is the reformulated hypothesis in the second half of an if any only if proof"],
["even", "Then \\(n\\) is even, and so there exists an \\(m\\in\\mathbb{Z}\\) such that \\(n=2m\\)."],
["alg_even", "\\( n^2 = (2m)^2 = 2(2m^2).\\)"],
["def_M_even", "Define \\(M=2m^2\\in\\mathbb{Z}\\) then \\(n^2=2M\\)."],
["conc_even", "Hence \\(n^2\\) is even.",
"This is the conclusion in the second half of an if any only if proof"
]
];
/****************************************************************/
/* This is how the teacher defines their answer, as nested proofs. */
proof1:proof("assodd","defn_odd","alg_odd","def_M_odd","conc_odd");
proof2:proof("contrapos","assnotodd","even","alg_even","def_M_even","conc_even");
proof_ans:proof_iff(proof1,proof2);
/* The variable "proof_steps", etc., are defined in the above file. Permute the steps randomly. */
proof_steps: random_permutation(proof_steps);
/* Generate the alternative proofs. */
tal: proof_alternatives(proof_ans);
len1: length(tal)
/* Below is one "wrong" answer generated by sorting the correct answer keys. */
wa1:apply(proof,sort(args(proof_flatten(tal[1]))));
/* Create a set of flattened proofs. */
tas: setify(map(proof_flatten, tal));]]></text>
</questionvariables>
<specificfeedback format="html">
Expand All @@ -106,9 +106,9 @@ tas: setify(map(proof_flatten, tal));]]></text>
<text>{@ map(first, proof_steps) @}</text>
</questionnote>
<questiondescription format="html">
<text><![CDATA[This question was adapted from the template for importing proofs from the STACK contrib directory. See
https://github.com/maths/moodle-qtype_stack/tree/master/stack/maxima/contrib/proofsamples
<text><![CDATA[This question was adapted from the template for importing proofs from the STACK contrib directory. See
https://github.com/maths/moodle-qtype_stack/tree/master/stack/maxima/contrib/proofsamples
It has been modified to show how to give partial credit in proofs. In particular, this question is able to spot when only half of the "if and only if" proof is given.]]></text>
</questiondescription>
<questionsimplify>1</questionsimplify>
Expand Down Expand Up @@ -156,12 +156,12 @@ It has been modified to show how to give partial credit in proofs. In particula
<autosimplify>1</autosimplify>
<feedbackstyle>1</feedbackstyle>
<feedbackvariables>
<text>sa: parsons_decode(ans1);
[pd, saa]:proof_assessment(sa, proof_alternatives(proof_ans));

/* How close are they to proving just one part of the iff? */
[pd1, saa1]:proof_assessment(sa, proof_alternatives(proof1));
[pd2, saa2]:proof_assessment(sa, proof_alternatives(proof2));
<text>sa: parsons_decode(ans1);
[pd, saa]:proof_assessment(sa, proof_alternatives(proof_ans));

/* How close are they to proving just one part of the iff? */
[pd1, saa1]:proof_assessment(sa, proof_alternatives(proof1));
[pd2, saa2]:proof_assessment(sa, proof_alternatives(proof2));
</text>
</feedbackvariables>
<node>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<quiz>
<question type="category">
<category>
<text>top/stacklibrary/Templates/Parsons-Proof</text>
</category>
<info format="moodle_auto_format">
<text>Templates parsons proofs </text>
</info>
<idnumber/>
</question>
</quiz>
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<text>Parsons proofs 1- Minimal</text>
</name>
<questiontext format="moodle_auto_format">
<text><![CDATA[<p>Show that \(\log_2(3)\) is irrational. </p>
[[parsons input="ans1"]]
{# parsons_encode(proof_steps) #}
[[/parsons ]]
<text><![CDATA[<p>Show that \(\log_2(3)\) is irrational. </p>
[[parsons input="ans1"]]
{# parsons_encode(proof_steps) #}
[[/parsons ]]
<p>[[input:ans1]] [[validation:ans1]]</p>]]></text>
</questiontext>
<generalfeedback format="moodle_auto_format">
Expand All @@ -23,21 +23,21 @@
<text>2024092500</text>
</stackversion>
<questionvariables>
<text><![CDATA[stack_include("contribl://prooflib.mac");
proof_steps: [
["assume", "Assume, for a contradiction, that \\(\\log_2(3)\\) is rational."],
["defn_rat", "Then \\(\\log_2(3) = \\frac{p}{q}>0\\) where "],
["defn_rat2", "\\(p\\) and \\(q\\neq 0\\) are positive integers."],
["defn_log", "Using the definition of logarithm:"],
["defn_log2", "\\[ 3 = 2^{\\frac{p}{q}}\\]"],
["alg", "\\[ 3^q = 2^p\\]"],
["alg_int", "The left hand side is always odd and the right hand side is always even."],
["contra", "This is a contradiction."],
["conc", "Hence \\(\\log_2(3)\\) is irrational."]
];
proof_steps: random_permutation(proof_steps);
<text><![CDATA[stack_include("contribl://prooflib.mac");
proof_steps: [
["assume", "Assume, for a contradiction, that \\(\\log_2(3)\\) is rational."],
["defn_rat", "Then \\(\\log_2(3) = \\frac{p}{q}>0\\) where "],
["defn_rat2", "\\(p\\) and \\(q\\neq 0\\) are positive integers."],
["defn_log", "Using the definition of logarithm:"],
["defn_log2", "\\[ 3 = 2^{\\frac{p}{q}}\\]"],
["alg", "\\[ 3^q = 2^p\\]"],
["alg_int", "The left hand side is always odd and the right hand side is always even."],
["contra", "This is a contradiction."],
["conc", "Hence \\(\\log_2(3)\\) is irrational."]
];
proof_steps: random_permutation(proof_steps);
ta: proof("assume", "defn_rat", "defn_rat2", "defn_log", "defn_log2", "alg", "alg_int", "contra", "conc");]]></text>
</questionvariables>
<specificfeedback format="html">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
<text>parsons proof 2-Interchangable order</text>
</name>
<questiontext format="moodle_auto_format">
<text><![CDATA[<p>Let \(n\in\mathbb{N}\). Show that \(n\) is odd if and only if \(n^2\) is odd. </p>
[[parsons input="ans1"]]
{# parsons_encode(proof_steps) #}
[[/parsons ]]
<text><![CDATA[<p>Let \(n\in\mathbb{N}\). Show that \(n\) is odd if and only if \(n^2\) is odd. </p>
[[parsons input="ans1"]]
{# parsons_encode(proof_steps) #}
[[/parsons ]]
<p>[[input:ans1]] [[validation:ans1]]</p>]]></text>
</questiontext>
<generalfeedback format="moodle_auto_format">
<text><![CDATA[This is the proof, written with some structure
{@proof_display(tal[2], proof_steps)@}
Notice this proof has two sub-proofs, which can occur in any order. Therefore we have two correct versions of this proof.
<table><tr>
<td><div class="proof">{@proof_display_para(tal[1], proof_steps)@}</div></td>
<td><div class="proof">{@proof_display_para(tal[2], proof_steps)@}</div></td>
</tr></table>
<text><![CDATA[This is the proof, written with some structure
{@proof_display(tal[2], proof_steps)@}
Notice this proof has two sub-proofs, which can occur in any order. Therefore we have two correct versions of this proof.
<table><tr>
<td><div class="proof">{@proof_display_para(tal[1], proof_steps)@}</div></td>
<td><div class="proof">{@proof_display_para(tal[2], proof_steps)@}</div></td>
</tr></table>
Can you see the differences between these proofs?]]></text>
</generalfeedback>
<defaultgrade>1</defaultgrade>
Expand All @@ -30,32 +30,32 @@ Can you see the differences between these proofs?]]></text>
<text>2024092500</text>
</stackversion>
<questionvariables>
<text><![CDATA[stack_include("contribl://prooflib.mac");
ta: proof_iff(proof("assodd","defn_odd","alg_odd","def_M_odd","conc_odd"), proof("contrapos","assnotodd","even","alg_even","def_M_even","conc_even"));
proof_steps: [
["assodd", "Assume that \\(n\\) is odd."],
["defn_odd", "Then there exists an \\(m\\in\\mathbb{Z}\\) such that \\(n=2m+1\\)."],
["alg_odd", "\\[ n^2 = (2m+1)^2 = 2(2m^2+2m)+1.\\]"],
["def_M_odd", "Define \\(M=2m^2+2m\\in\\mathbb{Z}\\) then \\(n^2=2M+1\\)."],
["conc_odd", "Hence \\(n^2\\) is odd."],
["contrapos", "We reformulate \"\\(n^2\\) is odd \\(\\Rightarrow \\) \\(n\\) is odd \" as the contrapositive."],
["assnotodd", "Assume that \\(n\\) is not odd."],
["even", "Then \\(n\\) is even, and so there exists an \\(m\\in\\mathbb{Z}\\) such that \\(n=2m\\)."],
["alg_even", "\\[ n^2 = (2m)^2 = 2(2m^2).\\]"],
["def_M_even", "Define \\(M=2m^2\\in\\mathbb{Z}\\) then \\(n^2=2M\\)."],
["conc_even", "Hence \\(n^2\\) is even."]
];
/* Permute the steps randomly. */
proof_steps: random_permutation(proof_steps);
/* Generate the alternative proofs. */
tal: proof_alternatives(ta);
/* Create a set of flattened proofs. */
<text><![CDATA[stack_include("contribl://prooflib.mac");
ta: proof_iff(proof("assodd","defn_odd","alg_odd","def_M_odd","conc_odd"), proof("contrapos","assnotodd","even","alg_even","def_M_even","conc_even"));
proof_steps: [
["assodd", "Assume that \\(n\\) is odd."],
["defn_odd", "Then there exists an \\(m\\in\\mathbb{Z}\\) such that \\(n=2m+1\\)."],
["alg_odd", "\\[ n^2 = (2m+1)^2 = 2(2m^2+2m)+1.\\]"],
["def_M_odd", "Define \\(M=2m^2+2m\\in\\mathbb{Z}\\) then \\(n^2=2M+1\\)."],
["conc_odd", "Hence \\(n^2\\) is odd."],
["contrapos", "We reformulate \"\\(n^2\\) is odd \\(\\Rightarrow \\) \\(n\\) is odd \" as the contrapositive."],
["assnotodd", "Assume that \\(n\\) is not odd."],
["even", "Then \\(n\\) is even, and so there exists an \\(m\\in\\mathbb{Z}\\) such that \\(n=2m\\)."],
["alg_even", "\\[ n^2 = (2m)^2 = 2(2m^2).\\]"],
["def_M_even", "Define \\(M=2m^2\\in\\mathbb{Z}\\) then \\(n^2=2M\\)."],
["conc_even", "Hence \\(n^2\\) is even."]
];
/* Permute the steps randomly. */
proof_steps: random_permutation(proof_steps);
/* Generate the alternative proofs. */
tal: proof_alternatives(ta);
/* Create a set of flattened proofs. */
tas: setify(map(proof_flatten, tal));]]></text>
</questionvariables>
<specificfeedback format="html">
Expand Down Expand Up @@ -112,7 +112,7 @@ tas: setify(map(proof_flatten, tal));]]></text>
<autosimplify>1</autosimplify>
<feedbackstyle>1</feedbackstyle>
<feedbackvariables>
<text>sa: parsons_decode(ans1);
<text>sa: parsons_decode(ans1);
check: elementp(sa,tas);</text>
</feedbackvariables>
<node>
Expand Down

0 comments on commit c4cd943

Please sign in to comment.