Draggable Proof

A Simple draggable proof.

Complete Code

Download file: DraggableProof.pg

POD for Macro Files

PG problem file

Explanation

DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'draggableProof.pl', 'PGcourse.pl');

Preamble

This problem uses the draggableProof.pl macro to display “buckets” that the student can drag statements to and from.

$proof = DraggableProof(
    # These are the correct statements of the proof in the correct order.
    [
        'Assume \(\sqrt{2} = \frac{a}{b}\) where \(a,b\) are integers, with \(\text{gcd}(a,b) = 1\)',
        '\(2 = \frac{a^2}{b^2}\)',
        '\(a^2 = 2b^2\)',
        'if \(a^2\) is even, then \(a\) must be even',
        'Let \(a = 2k\) for \(k\) some integer',
        'We can then write \(2 = \frac{4k^2}{b^2}\) or \(b^2 = 2k^2\)',
        'Therefore \(b^2\) is even, so \(b\) is also even',
        'If \(a\) and \(b\) are both even, then the initial assumption that \(\text{gcd}(a,b) = 1\) is contradicted.',
        '\(\sqrt{2}\) is therefore not rational.'
    ],
    # These are extra statements that are not needed.
    [
        'Then \(a\) is odd',
        '\(b^2\) cannot be rational.',
        'therefore \(a = 2b\)'
    ]
);

Setup

The DraggableProof function takes an arrayref of correct statements, followed (optionally) by extra statements. See the Draggable Proof POD for more options.

BEGIN_PGML
Prove that [`\sqrt{2}`] is irrational.

[_]{$proof}
END_PGML

Statement

The line [_]{$proof} prints the statement and options in the proof and sets up the answer rule.

BEGIN_PGML_SOLUTION
Solution explanation goes here.
END_PGML_SOLUTION

ENDDOCUMENT();

Solution

A solution should be provided here.