From c0fd45452572f797a63e82ed26e02f8f4bb2becf Mon Sep 17 00:00:00 2001 From: jpaulterry <75586093+jpaulterry@users.noreply.github.com> Date: Wed, 3 Jun 2026 16:45:40 -0500 Subject: [PATCH] Add files via upload Added a folder for a discrete math course along with several problems organized by sections. --- .../ch1s1_propositions/ifthen1.pg | 77 +++++++++++ .../ch1s1_propositions/ifthen2.pg | 77 +++++++++++ .../DiscreteMath/ch1s1_propositions/prop1.pg | 85 ++++++++++++ .../ch1s2_statements/truthtable1.pg | 65 +++++++++ .../ch1s2_statements/truthtable2.pg | 65 +++++++++ .../ch1s2_statements/truthtable3.pg | 69 ++++++++++ .../ch1s2_statements/truthtable4.pg | 69 ++++++++++ .../ch1s2_statements/truthtable5.pg | 69 ++++++++++ .../ch1s2_statements/truthtable6.pg | 69 ++++++++++ .../ch1s2_statements/truthtable7.pg | 69 ++++++++++ .../ch1s2_statements/truthtable8.pg | 77 +++++++++++ .../ch1s3_quantifiers/quantifiers1.pg | 77 +++++++++++ .../ch1s3_quantifiers/quantifiers2.pg | 65 +++++++++ .../ch1s3_quantifiers/quantifiers3.pg | 64 +++++++++ .../ch1s4_rulesofinference/roi1.pg | 92 +++++++++++++ .../ch1s4_rulesofinference/roi2.pg | 95 ++++++++++++++ .../ch1s4_rulesofinference/roi3.pg | 102 +++++++++++++++ .../ch1s4_rulesofinference/roi4.pg | 108 +++++++++++++++ .../ch1s4_rulesofinference/roi5.pg | 92 +++++++++++++ .../ch1s4_rulesofinference/roi6.pg | 116 +++++++++++++++++ .../DiscreteMath/ch1s5_proofs/proof1.pg | 100 ++++++++++++++ .../LaTech/DiscreteMath/ch2s1_sets/set1.pg | 76 +++++++++++ .../LaTech/DiscreteMath/ch2s1_sets/set2.pg | 76 +++++++++++ .../LaTech/DiscreteMath/ch2s1_sets/set3.pg | 100 ++++++++++++++ .../DiscreteMath/ch2s1_sets/setsize1.pg | 74 +++++++++++ .../DiscreteMath/ch2s1_sets/setsize2.pg | 69 ++++++++++ .../ch2s2_setoperations/setops1.pg | 119 +++++++++++++++++ .../ch2s2_setoperations/setops2.pg | 123 ++++++++++++++++++ .../ch2s2_setoperations/setops3.pg | 101 ++++++++++++++ .../ch2s2_setoperations/setops4.pg | 112 ++++++++++++++++ .../ch2s2_setoperations/setops5.pg | 109 ++++++++++++++++ .../DiscreteMath/ch2s3_functions/fun1.pg | 73 +++++++++++ .../DiscreteMath/ch2s3_functions/fun2.pg | 72 ++++++++++ .../DiscreteMath/ch2s3_functions/fun3.pg | 72 ++++++++++ .../ch3s4_recurrencerelations/recrel1.pg | 105 +++++++++++++++ .../ch3s4_recurrencerelations/recrel2.pg | 104 +++++++++++++++ .../ch3s4_recurrencerelations/recrel3.pg | 86 ++++++++++++ .../ch3s4_recurrencerelations/recrel4.pg | 86 ++++++++++++ .../ch4As1_matrices/boolmatrix1.pg | 88 +++++++++++++ .../ch4As1_matrices/boolmatrix2.pg | 74 +++++++++++ .../ch4As3_relations/boolmatrixrep1.pg | 83 ++++++++++++ .../ch4As3_relations/boolmatrixrep2.pg | 73 +++++++++++ .../ch4As3_relations/boolmatrixrep3.pg | 70 ++++++++++ .../strings_language1.pg | 43 ++++++ .../strings_language2.pg | 44 +++++++ .../strings_language3.pg | 44 +++++++ .../strings_language4.pg | 49 +++++++ .../LaTech/DiscreteMath/ch4Cs2_dfa/dfa1.pg | 66 ++++++++++ .../LaTech/DiscreteMath/ch4Cs2_dfa/dfa2.pg | 61 +++++++++ .../LaTech/DiscreteMath/ch4Cs2_dfa/dfa3.pg | 66 ++++++++++ .../LaTech/DiscreteMath/ch4Cs3_nfa/nfa1.pg | 73 +++++++++++ 51 files changed, 4093 insertions(+) create mode 100644 Contrib/LaTech/DiscreteMath/ch1s1_propositions/ifthen1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s1_propositions/ifthen2.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s1_propositions/prop1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable2.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable3.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable4.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable5.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable6.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable7.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable8.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s3_quantifiers/quantifiers1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s3_quantifiers/quantifiers2.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s3_quantifiers/quantifiers3.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi2.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi3.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi4.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi5.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi6.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch1s5_proofs/proof1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch2s1_sets/set1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch2s1_sets/set2.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch2s1_sets/set3.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch2s1_sets/setsize1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch2s1_sets/setsize2.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops2.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops3.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops4.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops5.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch2s3_functions/fun1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch2s3_functions/fun2.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch2s3_functions/fun3.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel2.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel3.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel4.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch4As1_matrices/boolmatrix1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch4As1_matrices/boolmatrix2.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch4As3_relations/boolmatrixrep1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch4As3_relations/boolmatrixrep2.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch4As3_relations/boolmatrixrep3.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language2.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language3.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language4.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch4Cs2_dfa/dfa1.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch4Cs2_dfa/dfa2.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch4Cs2_dfa/dfa3.pg create mode 100644 Contrib/LaTech/DiscreteMath/ch4Cs3_nfa/nfa1.pg diff --git a/Contrib/LaTech/DiscreteMath/ch1s1_propositions/ifthen1.pg b/Contrib/LaTech/DiscreteMath/ch1s1_propositions/ifthen1.pg new file mode 100644 index 0000000000..db4b99438a --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s1_propositions/ifthen1.pg @@ -0,0 +1,77 @@ +## DESCRIPTION +## Gives the if-then statement "If you strike me down, then I become more powerful." +## and asks for its propositional variations from a popup menu of statements. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Propositional Logic) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','propositional logic','converse','contrapositive') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Create an array of possible statement variations +$a = ["You don't strike me down or I become more powerful.", + "You strike me down and I don't become more powerful.", + "If I don't become more powerful, then you don't strike me down.", + "If I become more powerful, then you strike me down.", + "I become more powerful if you strike me down.", + "You strike me down if I become more powerful.", + "I don't become more powerful and you don't strike me down.", + "You strike me down and I become more powerful."]; + +## Create the popup menus with the correct answers +$pop1 = PopUp(["Choose...",$a], 1); +$pop2 = PopUp(["Choose...",$a], 2); +$pop3 = PopUp(["Choose...",$a], 3); +$pop4 = PopUp(["Choose...",$a], 4); +$pop5 = PopUp(["Choose...",$a], 5); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Consider the following statement: + +*"If you strike me down, then I become more powerful."* + +Choose the equivalent statement that uses the words "and" or "or": [_]{$pop1} + +Choose the negation of the statement: [_]{$pop2} + +Choose the contrapositive of the statement: [_]{$pop3} + +Choose the converse of the statement: [_]{$pop4} + +Choose the equivalent statement that uses the words "if" or "then": [_]{$pop5} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +Choose the equivalent statement that uses the words "and" or "or": [$pop1] + +Choose the negation of the statement: [$pop2] + +Choose the contrapositive of the statement: [$pop3] + +Choose the converse of the statement: [$pop4] + +Choose the equivalent statement that uses the words "if" or "then": [$pop5] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s1_propositions/ifthen2.pg b/Contrib/LaTech/DiscreteMath/ch1s1_propositions/ifthen2.pg new file mode 100644 index 0000000000..f28eb992a6 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s1_propositions/ifthen2.pg @@ -0,0 +1,77 @@ +## DESCRIPTION +## Gives the if-then statement "If it bleeds, then we can kill it." +## and asks for its propositional variations from a popup menu of statements. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Propositional Logic) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','propositional logic','converse','contrapositive') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Create an array of possible statement variations +$a = ["We can kill it or it doesn't bleed.", + "We can't kill it and it bleeds.", + "If we can't kill it, then it doesn't bleed.", + "If we can kill it, then it bleeds.", + "We can kill it if it bleeds.", + "It bleeds if we can kill it.", + "It doesn't bleed and we can't kill it.", + "It bleeds and we can kill it."]; + +## Create the popup menus with the correct answers +$pop1 = PopUp(["Choose...",$a], 1); +$pop2 = PopUp(["Choose...",$a], 2); +$pop3 = PopUp(["Choose...",$a], 3); +$pop4 = PopUp(["Choose...",$a], 4); +$pop5 = PopUp(["Choose...",$a], 5); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Consider the following statement: + +*"If it bleeds, then we can kill it."* + +Choose the equivalent statement that uses the words "and" or "or": [_]{$pop1} + +Choose the negation of the statement: [_]{$pop2} + +Choose the contrapositive of the statement: [_]{$pop3} + +Choose the converse of the statement: [_]{$pop4} + +Choose the equivalent statement that uses the words "if" or "then": [_]{$pop5} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +Choose the equivalent statement that uses the words "and" or "or": [$pop1] + +Choose the negation of the statement: [$pop2] + +Choose the contrapositive of the statement: [$pop3] + +Choose the converse of the statement: [$pop4] + +Choose the equivalent statement that uses the words "if" or "then": [$pop5] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s1_propositions/prop1.pg b/Contrib/LaTech/DiscreteMath/ch1s1_propositions/prop1.pg new file mode 100644 index 0000000000..da3337bf2c --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s1_propositions/prop1.pg @@ -0,0 +1,85 @@ +## DESCRIPTION +## Generates statements with logical connectives and asks whether they are true or false. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Propositional Logic) +## Date(06/03/2026) +## Institution(Louisiana Tech) +## Author(Jason Terry) +## Level(2) +## KEYWORDS('discrete math','logic','propositional logic','and','or','implication','negation','true','false') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create random parameters for a false statement +$a = random(-5,-1,1); +$b = random(1,5,1); + +## Create random parameters for a true statement +$n = random(2,5,1); +$nf = fact($n); + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Determine the truth value of the following statements. *To discourage random guessing, you must answer all problems correctly to receive credit.* + +[_]{$popTrue}: "If Earth's sun is blue, then the atomic number of gold is 69." + +[_]{$popTrue} :"It is not the case that: (Your math instructor's name is Obi-Wan Kenobi OR Earth's sun is blue)." + +[_]{$popFalse} :"It is not the case that: (Your math instructor's name is Obi-Wan Kenobi if and only if Earth's sun is blue)." + +[_]{$popTrue} :[`` ([$b]<[$a]) \vee ([$n]! = [$nf]) ``] + +[_]{$popFalse} :[`` ([$b]<[$a]) \wedge ([$n]! = [$nf]) ``] + +[_]{$popFalse} :[`` ([$n]! = [$nf]) \Rightarrow ([$b]<[$a]) ``] + +[_]{$popTrue} :[`` ([$b]<[$a]) \Rightarrow ([$n]! = [$nf]) ``] + +[_]{$popFalse} :[`` \neg (\neg (\pi = 3.14)) ``] + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[$popTrue]: "If Earth's sun is blue, then the atomic number of gold is 69." + +[$popTrue] :"It is not the case that: (Your math instructor's name is Obi-Wan Kenobi OR Earth's sun is blue)." + +[$popFalse] :"It is not the case that: (Your math instructor's name is Obi-Wan Kenobi if and only if Earth's sun is blue)." + +[$popTrue] :[`` ([$b]<[$a]) \vee ([$n]! = [$nf]) ``] + +[$popFalse] :[`` ([$b]<[$a]) \wedge ([$n]! = [$nf]) ``] + +[$popFalse] :[`` ([$n]! = [$nf]) \Rightarrow ([$b]<[$a]) ``] + +[$popTrue] :[`` ([$b]<[$a]) \Rightarrow ([$n]! = [$nf]) ``] + +[$popFalse] :[`` \neg (\neg (\pi = 3.14)) ``] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable1.pg b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable1.pg new file mode 100644 index 0000000000..ca52ae451a --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable1.pg @@ -0,0 +1,65 @@ +## DESCRIPTION +## Generates a truth table to complete for the statement [P and T]. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Equivalent Statements) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','truth table') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"niceTables.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Complete the following truth table. + +[@ +DataTable([ +["\\(P\\)","\\( P \\wedge T\\)"], +["\\(T\\)",PGML('[____]{$popTrue}')], +["\\(F\\)",PGML('[____]{$popFalse}')] +], +midrules => 1, align => '| c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solution: + +[@ +DataTable([ +["\\(P\\)","\\( P \\wedge T\\)"], +["\\(T\\)",PGML('[$popTrue]')], +["\\(F\\)",PGML('[$popFalse]')] +], +midrules => 1, align => '| c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable2.pg b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable2.pg new file mode 100644 index 0000000000..b5a759d575 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable2.pg @@ -0,0 +1,65 @@ +## DESCRIPTION +## Generates a truth table to complete for the statement [P or F]. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Equivalent Statements) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','truth table') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"niceTables.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Complete the following truth table. + +[@ +DataTable([ +["\\(P\\)","\\( P \\vee F\\)"], +["\\(T\\)",PGML('[____]{$popTrue}')], +["\\(F\\)",PGML('[____]{$popFalse}')] +], +midrules => 1, align => '| c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solution: + +[@ +DataTable([ +["\\(P\\)","\\( P \\vee F\\)"], +["\\(T\\)",PGML('[$popTrue]')], +["\\(F\\)",PGML('[$popFalse]')] +], +midrules => 1, align => '| c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable3.pg b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable3.pg new file mode 100644 index 0000000000..2c8a0e9bea --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable3.pg @@ -0,0 +1,69 @@ +## DESCRIPTION +## Generates a truth table to complete for the statements [P implies Q] and [not(P) or Q]. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Equivalent Statements) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','truth table') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"niceTables.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Complete the following truth table. + +[@ +DataTable([ +["\\(P\\)", "\\(Q\\)", "\\( P \\Rightarrow Q\\)", "\\( (\\neg P) \\vee Q\\)"], +["\\(T\\)", "\\(T\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}')], +["\\(T\\)", "\\(F\\)", PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}')], +["\\(F\\)", "\\(T\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}')], +["\\(F\\)", "\\(F\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}')], +], +midrules => 1, align => '| c | c | c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solution: + +[@ +DataTable([ +["\\(P\\)", "\\(Q\\)", "\\( P \\Rightarrow Q\\)", "\\( (\\neg P) \\vee Q\\)"], +["\\(T\\)", "\\(T\\)", PGML('[$popTrue]'), PGML('[$popTrue]')], +["\\(T\\)", "\\(F\\)", PGML('[$popFalse]'), PGML('[$popFalse]')], +["\\(F\\)", "\\(T\\)", PGML('[$popTrue]'), PGML('[$popTrue]')], +["\\(F\\)", "\\(F\\)", PGML('[$popTrue]'), PGML('[$popTrue]')], +], +midrules => 1, align => '| c | c | c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable4.pg b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable4.pg new file mode 100644 index 0000000000..53217b390f --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable4.pg @@ -0,0 +1,69 @@ +## DESCRIPTION +## Generates a truth table to complete for the statements [not(P and Q)] and [not(P) or not(Q)]. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Equivalent Statements) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','truth table') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"niceTables.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Complete the following truth table. + +[@ +DataTable([ +["\\(P\\)", "\\(Q\\)", "\\( P \\wedge Q\\)", "\\(\\neg (P \\wedge Q) \\)", "\\( \\neg P \\)", "\\( \\neg Q \\)","\\( (\\neg P) \\vee (\\neg Q)\\)"], +["\\(T\\)", "\\(T\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}')], +["\\(T\\)", "\\(F\\)", PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}')], +["\\(F\\)", "\\(T\\)", PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}')], +["\\(F\\)", "\\(F\\)", PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}')], +], +midrules => 1, align => '| c | c | c | c | c | c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solution: + +[@ +DataTable([ +["\\(P\\)", "\\(Q\\)", "\\( P \\wedge Q\\)", "\\(\\neg (P \\wedge Q) \\)", "\\( \\neg P \\)", "\\( \\neg Q \\)","\\( (\\neg P) \\vee (\\neg Q)\\)"], +["\\(T\\)", "\\(T\\)", PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popFalse]'), PGML('[$popFalse]'), PGML('[$popFalse]')], +["\\(T\\)", "\\(F\\)", PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popTrue]')], +["\\(F\\)", "\\(T\\)", PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popTrue]')], +["\\(F\\)", "\\(F\\)", PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]')], +], +midrules => 1, align => '| c | c | c | c | c | c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable5.pg b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable5.pg new file mode 100644 index 0000000000..c82779b04d --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable5.pg @@ -0,0 +1,69 @@ +## DESCRIPTION +## Generates a truth table to complete for the statements [not(P or Q)] and [not(P) and not(Q)]. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Equivalent Statements) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','truth table') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"niceTables.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Complete the following truth table. + +[@ +DataTable([ +["\\(P\\)", "\\(Q\\)", "\\( P \\vee Q\\)", "\\(\\neg (P \\vee Q) \\)", "\\( \\neg P \\)", "\\( \\neg Q \\)","\\( (\\neg P) \\wedge (\\neg Q)\\)"], +["\\(T\\)", "\\(T\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}')], +["\\(T\\)", "\\(F\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}')], +["\\(F\\)", "\\(T\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}')], +["\\(F\\)", "\\(F\\)", PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}')], +], +midrules => 1, align => '| c | c | c | c | c | c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solution: + +[@ +DataTable([ +["\\(P\\)", "\\(Q\\)", "\\( P \\vee Q\\)", "\\(\\neg (P \\vee Q) \\)", "\\( \\neg P \\)", "\\( \\neg Q \\)","\\( (\\neg P) \\wedge (\\neg Q)\\)"], +["\\(T\\)", "\\(T\\)", PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popFalse]'), PGML('[$popFalse]'), PGML('[$popFalse]')], +["\\(T\\)", "\\(F\\)", PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popFalse]')], +["\\(F\\)", "\\(T\\)", PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popFalse]')], +["\\(F\\)", "\\(F\\)", PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]')], +], +midrules => 1, align => '| c | c | c | c | c | c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable6.pg b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable6.pg new file mode 100644 index 0000000000..bd3a98108c --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable6.pg @@ -0,0 +1,69 @@ +## DESCRIPTION +## Generates a truth table to complete for the statements [P implies Q] and [not(Q) implies not(P)]. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Equivalent Statements) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','truth table') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"niceTables.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Complete the following truth table. + +[@ +DataTable([ +["\\(P\\)", "\\(Q\\)", "\\( P \\Rightarrow Q\\)", "\\( \\neg Q \\)", "\\( \\neg P \\)", "\\( (\\neg Q) \\Rightarrow (\\neg P) \\)"], +["\\(T\\)", "\\(T\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}')], +["\\(T\\)", "\\(F\\)", PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}')], +["\\(F\\)", "\\(T\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}')], +["\\(F\\)", "\\(F\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}')], +], +midrules => 1, align => '| c | c | c | c | c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solution: + +[@ +DataTable([ +["\\(P\\)", "\\(Q\\)", "\\( P \\Rightarrow Q\\)", "\\( \\neg Q \\)", "\\( \\neg P \\)", "\\( (\\neg Q) \\Rightarrow (\\neg P) \\)"], +["\\(T\\)", "\\(T\\)", PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popFalse]'), PGML('[$popTrue]')], +["\\(T\\)", "\\(F\\)", PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popFalse]')], +["\\(F\\)", "\\(T\\)", PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popTrue]')], +["\\(F\\)", "\\(F\\)", PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]')], +], +midrules => 1, align => '| c | c | c | c | c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable7.pg b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable7.pg new file mode 100644 index 0000000000..23767520e0 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable7.pg @@ -0,0 +1,69 @@ +## DESCRIPTION +## Generates a truth table to complete for the statements [P iff Q] and [(P implies Q) and (Q implies P)]. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Equivalent Statements) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','truth table') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"niceTables.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Complete the following truth table. + +[@ +DataTable([ +["\\(P\\)", "\\(Q\\)", "\\( P \\Leftrightarrow Q\\)", "\\( P \\Rightarrow Q \\)", "\\( Q \\Rightarrow P \\)", "\\( (P \\Rightarrow Q) \\wedge (Q \\Rightarrow P)\\)"], +["\\(T\\)", "\\(T\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}')], +["\\(T\\)", "\\(F\\)", PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}')], +["\\(F\\)", "\\(T\\)", PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}')], +["\\(F\\)", "\\(F\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}')], +], +midrules => 1, align => '| c | c | c | c | c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solution: + +[@ +DataTable([ +["\\(P\\)", "\\(Q\\)", "\\( P \\Leftrightarrow Q\\)", "\\( P \\Rightarrow Q \\)", "\\( Q \\Rightarrow P \\)", "\\( (P \\Rightarrow Q) \\wedge (Q \\Rightarrow P)\\)"], +["\\(T\\)", "\\(T\\)", PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]')], +["\\(T\\)", "\\(F\\)", PGML('[$popFalse]'), PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popFalse]')], +["\\(F\\)", "\\(T\\)", PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popFalse]')], +["\\(F\\)", "\\(F\\)", PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]')], +], +midrules => 1, align => '| c | c | c | c | c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable8.pg b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable8.pg new file mode 100644 index 0000000000..bcc6e450e1 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s2_statements/truthtable8.pg @@ -0,0 +1,77 @@ +## DESCRIPTION +## Generates a truth table to complete for the statements [(P implies R) and (Q implies R)] and [(P or Q) implies R]. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Equivalent Statements) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','truth table') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"niceTables.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Complete the following truth table. + +[@ +DataTable([ +["\\(P\\)", "\\(Q\\)", "\\(R\\)", "\\( P \\Rightarrow R \\)", "\\( Q \\Rightarrow R \\)", "\\( (P \\Rightarrow R) \\wedge (Q \\Rightarrow R) \\)","\\( P \\vee Q \\)", "\\( (P \\vee Q) \\Rightarrow R \\)"], +["\\(T\\)", "\\(T\\)", "\\(T\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}')], +["\\(T\\)", "\\(T\\)", "\\(F\\)", PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}')], +["\\(T\\)", "\\(F\\)", "\\(T\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}')], +["\\(T\\)", "\\(F\\)", "\\(F\\)", PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}')], +["\\(F\\)", "\\(T\\)", "\\(T\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}')], +["\\(F\\)", "\\(T\\)", "\\(F\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}')], +["\\(F\\)", "\\(F\\)", "\\(T\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}')], +["\\(F\\)", "\\(F\\)", "\\(F\\)", PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popTrue}'), PGML('[____]{$popFalse}'), PGML('[____]{$popTrue}')] +], +midrules => 1, align => '| c | c | c | c | c | c | c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solution: + +[@ +DataTable([ +["\\(P\\)", "\\(Q\\)", "\\(R\\)", "\\( P \\Rightarrow R \\)", "\\( Q \\Rightarrow R \\)", "\\( (P \\Rightarrow R) \\wedge (Q \\Rightarrow R) \\)","\\( P \\vee Q \\)", "\\( (P \\vee Q) \\Rightarrow R \\)"], +["\\(T\\)", "\\(T\\)", "\\(T\\)", PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]')], +["\\(T\\)", "\\(T\\)", "\\(F\\)", PGML('[$popFalse]'), PGML('[$popFalse]'), PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popFalse]')], +["\\(T\\)", "\\(F\\)", "\\(T\\)", PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]')], +["\\(T\\)", "\\(F\\)", "\\(F\\)", PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popFalse]')], +["\\(F\\)", "\\(T\\)", "\\(T\\)", PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]')], +["\\(F\\)", "\\(T\\)", "\\(F\\)", PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popFalse]'), PGML('[$popTrue]'), PGML('[$popFalse]')], +["\\(F\\)", "\\(F\\)", "\\(T\\)", PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popTrue]')], +["\\(F\\)", "\\(F\\)", "\\(F\\)", PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popTrue]'), PGML('[$popFalse]'), PGML('[$popTrue]')] +], +midrules => 1, align => '| c | c | c | c | c | c | c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s3_quantifiers/quantifiers1.pg b/Contrib/LaTech/DiscreteMath/ch1s3_quantifiers/quantifiers1.pg new file mode 100644 index 0000000000..24e62d451f --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s3_quantifiers/quantifiers1.pg @@ -0,0 +1,77 @@ +## DESCRIPTION +## Gives the open statement C(x,y): "Student x has taken math course y" +## and asks for its quantified variations from a popup menu of statements. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Quantifiers) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','quantifiers','open statements') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Create an array of possible statement variations +$a = ["There is a student that has taken a math course.", + "No student has ever taken a math course.", + "There is a student that has taken discrete math.", + "Every student has taken discrete math.", + "No student has taken discrete math.", + "There is a student that has not taken discrete math.", + "There is a student that has taken every math course.", + "Every student has taken every math course."]; + +## Create the popup menus with the correct answers +$pop1 = PopUp(["Choose...",$a], 1); +$pop2 = PopUp(["Choose...",$a], 2); +$pop3 = PopUp(["Choose...",$a], 3); +$pop4 = PopUp(["Choose...",$a], 4); +$pop5 = PopUp(["Choose...",$a], 5); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Consider the open statement *C(x,y): "Student x has taken math course y,"* where the domain for [``x``] is all students at your school and the domain for [``y``] is all math courses at your school. + +Match the following statements containing quantifiers to their corresponding English statements. + +[`` \exists x \exists y \hspace{1em} C(x,y) ``]: [_]{$pop1} + +[`` \forall x \forall y \hspace{1em} \neg C(x,y) ``]: [_]{$pop2} + +[`` \exists x \hspace{1em} C(x, \text{discrete math}) ``]: [_]{$pop3} + +[`` \forall x \hspace{1em} C(x, \text{discrete math}) ``]: [_]{$pop4} + +[`` \neg \exists x \hspace{1em} C(x, \text{discrete math}) ``]: [_]{$pop5} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` \exists x \exists y \hspace{1em} C(x,y) ``]: [$pop1] + +[`` \forall x \forall y \hspace{1em} \neg C(x,y) ``]: [$pop2] + +[`` \exists x \hspace{1em} C(x, \text{discrete math}) ``]: [$pop3] + +[`` \forall x \hspace{1em} C(x, \text{discrete math}) ``]: [$pop4] + +[`` \neg \exists x \hspace{1em} C(x, \text{discrete math}) ``]: [$pop5] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s3_quantifiers/quantifiers2.pg b/Contrib/LaTech/DiscreteMath/ch1s3_quantifiers/quantifiers2.pg new file mode 100644 index 0000000000..27aefb3781 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s3_quantifiers/quantifiers2.pg @@ -0,0 +1,65 @@ +## DESCRIPTION +## Gives various open statements with quantifiers and asks whether they are true or false. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Quantifiers) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','quantifiers','open statements') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Suppose the domain for all variables is all real numbers. Determine the truth value of the following statements. + +[_]{$popFalse} :[`` \forall x \exists y \hspace{1em} xy < 0 ``] + +[_]{$popTrue} :[`` \forall x \exists y \hspace{1em} xy \leq 0 ``] + +[_]{$popFalse} :[`` \exists x \forall y \hspace{1em} xy < 0 ``] + +[_]{$popTrue} :[`` \exists x \exists y \hspace{1em} xy < 0 ``] + +[_]{$popFalse} :[`` \forall x \forall y \hspace{1em} xy \leq 0 ``] + +END_PGML + +BEGIN_PGML_SOLUTION +The truth value of the statements are: + +[`` \forall x \exists y \hspace{1em} xy < 0 \equiv [$popFalse] ``] because the inquality will fail for [`` x = 0 ``]. + +[`` \forall x \exists y \hspace{1em} xy \leq 0 \equiv [$popTrue] ``] because for any [`` x ``] we can let [`` y = 0 ``] and the inquality will succeed. + +[`` \exists x \forall y \hspace{1em} xy < 0 \equiv [$popFalse] ``] because the inquality will fail for [`` y = 0 ``]. + +[`` \exists x \exists y \hspace{1em} xy < 0 \equiv [$popTrue] ``] because the inequality will succeed for [`` x=-1 ``] and [`` y = 1 ``]. + +[`` \forall x \forall y \hspace{1em} xy \leq 0 \equiv [$popFalse] ``] because the inequality will fail for [`` x=1 ``] and [`` y = 1 ``]. + +END_PGML_SOLUTION + + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s3_quantifiers/quantifiers3.pg b/Contrib/LaTech/DiscreteMath/ch1s3_quantifiers/quantifiers3.pg new file mode 100644 index 0000000000..5d8a81ff17 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s3_quantifiers/quantifiers3.pg @@ -0,0 +1,64 @@ +## DESCRIPTION +## Gives various open statements with quantifiers and asks whether they are true or false. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Quantifiers) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','quantifiers','open statements') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Suppose the domain for all variables is all real numbers. Determine the truth value of the following statements. + +[_]{$popTrue} :[`` \exists x \exists y \hspace{1em} x + y = 0 ``] + +[_]{$popTrue} :[`` \forall x \exists y \hspace{1em} x + y = 0 ``] + +[_]{$popFalse} :[`` \exists x \forall y \hspace{1em} x + y = 0 ``] + +[_]{$popFalse} :[`` \forall x \forall y \exists z \hspace{1em} \dfrac{x}{y} = z ``] + +[_]{$popTrue} :[`` \forall x \forall y \hspace{1em} (x \geq 0 \wedge y \geq 0) \Rightarrow xy \geq 0 ``] + +END_PGML + +BEGIN_PGML_SOLUTION +The truth value of the statements are: + +[`` \exists x \exists y \hspace{1em} x + y = 0 \equiv [$popTrue] ``] because, for example, [`` -2 + 2 = 0 ``]. + +[`` \forall x \exists y \hspace{1em} x + y = 0 \equiv [$popTrue] ``] because for any [`` x ``] we can let [`` y = -x ``]. + +[`` \exists x \forall y \hspace{1em} x + y = 0 \equiv [$popFalse] ``] because there does not exist a single value that can be added to all values to obtain 0. + +[`` \forall x \forall y \exists z \hspace{1em} \dfrac{x}{y} = z \equiv [$popFalse] ``] because the equation fails when [`` y = 0 ``]. + +[`` \forall x \forall y \hspace{1em} (x \geq 0 \wedge y \geq 0) \Rightarrow xy \geq 0 \equiv [$popTrue] ``] because it is always true that the product of two nonnegative numbers will be nonnegative. + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi1.pg b/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi1.pg new file mode 100644 index 0000000000..8e212191a0 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi1.pg @@ -0,0 +1,92 @@ +## DESCRIPTION +## Gives a proof as a list of statements and reasons and asks to choose the correct reasons +## for each step of the proof from a popup menu of options. +## Premises: not(P) and R, not(P) implies Q +## Conclusion: Q +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Rules of Inference) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','propositional logic','rules of inference','argument','proof') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"niceTables.pl", +"PGML.pl" +); + +## Create an array of possible reasons +$a = ["Premise", + "Step 1", + "Step 2", + "Step 3", + "Step 4", + "Steps 1 and 2", + "Steps 1 and 3", + "Steps 1 and 4", + "Steps 2 and 3", + "Steps 2 and 4", + "Steps 3 and 4"]; + +## Create the popup menus with the correct answers +$popPremise = PopUp(["Choose...",$a], 1); +$popStep1 = PopUp(["Choose...",$a], 2); +$popStep23 = PopUp(["Choose...",$a], 9); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Consider the following premises and conclusion. + +*Premises:* +- [`` \neg P \wedge R ``] +- [`` \neg P \Rightarrow Q ``] + +*Conclusion:* +- [`` Q ``] + +Below is a list of statements and reasons that prove the conclusion. Use the dropdown menus to choose the correct reason for each step of the proof. + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","\\( \\neg P \\wedge R \\)", PGML('[_]{$popPremise}')], +["2","\\( \\neg P \\)", PGML('[_]{$popStep1}')], +["3","\\( \\neg P \\Rightarrow Q \\)", PGML('[_]{$popPremise}')], +["4","\\( Q \\)", PGML('[_]{$popStep23}')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","\\( \\neg P \\wedge R \\)", PGML('[$popPremise]')], +["2","\\( \\neg P \\)", PGML('[$popStep1]')], +["3","\\( \\neg P \\Rightarrow Q \\)", PGML('[$popPremise]')], +["4","\\( Q \\)", PGML('[$popStep23]')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi2.pg b/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi2.pg new file mode 100644 index 0000000000..ac548d6ee3 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi2.pg @@ -0,0 +1,95 @@ +## DESCRIPTION +## Gives a proof as a list of statements and reasons and asks to choose the correct reasons +## for each step of the proof from a popup menu of options. +## Premises: not(R), Q implies R, P implies Q +## Conclusion: not(P) +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Rules of Inference) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','propositional logic','rules of inference','argument','proof') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"niceTables.pl", +"PGML.pl" +); + +## Create an array of possible reasons +$a = ["Premise", + "Step 1", + "Step 2", + "Step 3", + "Step 4", + "Steps 1 and 2", + "Steps 1 and 3", + "Steps 1 and 4", + "Steps 2 and 3", + "Steps 2 and 4", + "Steps 3 and 4"]; + +## Create the popup menus with the correct answers +$popPremise = PopUp(["Choose...",$a], 1); +$popStep12 = PopUp(["Choose...",$a], 6); +$popStep34 = PopUp(["Choose...",$a], 11); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Consider the following premises and conclusion. + +*Premises:* +- [`` \neg R ``] +- [`` Q \Rightarrow R ``] +- [`` P \Rightarrow Q ``] + +*Conclusion:* +- [`` \neg P ``] + +Below is a list of statements and reasons that prove the conclusion. Use the dropdown menus to choose the correct reason for each step of the proof. + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","\\( Q \\Rightarrow R \\)", PGML('[_]{$popPremise}')], +["2","\\( \\neg R \\)", PGML('[_]{$popPremise}')], +["3","\\( \\neg Q \\)", PGML('[_]{$popStep12}')], +["4","\\( P \\Rightarrow Q \\)", PGML('[_]{$popPremise}')], +["5","\\( \\neg P \\)", PGML('[_]{$popStep34}')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","\\( Q \\Rightarrow R \\)", PGML('[$popPremise]')], +["2","\\( \\neg R \\)", PGML('[$popPremise]')], +["3","\\( \\neg Q \\)", PGML('[$popStep12]')], +["4","\\( P \\Rightarrow Q \\)", PGML('[$popPremise]')], +["5","\\( \\neg P \\)", PGML('[$popStep34]')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi3.pg b/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi3.pg new file mode 100644 index 0000000000..622f7932d1 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi3.pg @@ -0,0 +1,102 @@ +## DESCRIPTION +## Gives a proof as a list of statements and reasons and asks to choose the correct reasons +## for each step of the proof from a popup menu of options. +## Premises: P implies Q, not(P) implies R, R implies S +## Conclusion: not(Q) implies S +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Rules of Inference) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','propositional logic','rules of inference','argument','proof') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"niceTables.pl", +"PGML.pl" +); + +## Create an array of possible reasons +$a = ["Premise", + "Step 1", + "Step 2", + "Step 3", + "Step 4", + "Step 5", + "Steps 2 and 3", + "Steps 2 and 4", + "Steps 2 and 5", + "Steps 3 and 4", + "Steps 3 and 5", + "Steps 3 and 6", + "Steps 4 and 5", + "Steps 4 and 6", + "Steps 5 and 6"]; + +## Create the popup menus with the correct answers +$popPremise = PopUp(["Choose...",$a], 1); +$popStep1 = PopUp(["Choose...",$a], 2); +$popStep23 = PopUp(["Choose...",$a], 7); +$popStep45 = PopUp(["Choose...",$a], 13); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Consider the following premises and conclusion. + +*Premises:* +- [`` P \Rightarrow Q ``] +- [`` \neg P \Rightarrow R ``] +- [`` R \Rightarrow S ``] + +*Conclusion:* +- [`` \neg Q \Rightarrow S ``] + +Below is a list of statements and reasons that prove the conclusion. Use the dropdown menus to choose the correct reason for each step of the proof. + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","\\( P \\Rightarrow Q \\)", PGML('[_]{$popPremise}')], +["2","\\( \\neg Q \\Rightarrow \\neg P \\)", PGML('[_]{$popStep1}')], +["3","\\( \\neg P \\Rightarrow R \\)", PGML('[_]{$popPremise}')], +["4","\\( \\neg Q \\Rightarrow R \\)", PGML('[_]{$popStep23}')], +["5","\\( R \\Rightarrow S \\)", PGML('[_]{$popPremise}')], +["6","\\( \\neg Q \\Rightarrow S \\)", PGML('[_]{$popStep45}')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","\\( P \\Rightarrow Q \\)", PGML('[$popPremise]')], +["2","\\( \\neg Q \\Rightarrow \\neg P \\)", PGML('[$popStep1]')], +["3","\\( \\neg P \\Rightarrow R \\)", PGML('[$popPremise]')], +["4","\\( \\neg Q \\Rightarrow R \\)", PGML('[$popStep23]')], +["5","\\( R \\Rightarrow S \\)", PGML('[$popPremise]')], +["6","\\( \\neg Q \\Rightarrow S \\)", PGML('[$popStep45]')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi4.pg b/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi4.pg new file mode 100644 index 0000000000..6e26815e70 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi4.pg @@ -0,0 +1,108 @@ +## DESCRIPTION +## Gives a proof as a list of statements and reasons and asks to choose the correct reasons +## for each step of the proof from a popup menu of options. +## Premises: not(P) and Q, R implies P, not(R) implies S, S implies T +## Conclusion: T +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Rules of Inference) +## Date(06/23/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','propositional logic','rules of inference','argument','proof') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"niceTables.pl", +"PGML.pl" +); + +## Create an array of possible reasons +$a = ["Premise", + "Step 1", + "Step 2", + "Step 3", + "Step 4", + "Step 5", + "Steps 2 and 3", + "Steps 2 and 4", + "Steps 2 and 5", + "Steps 3 and 4", + "Steps 3 and 5", + "Steps 4 and 5", + "Steps 4 and 6", + "Steps 4 and 7", + "Steps 6 and 7"]; + +## Create the popup menus with the correct answers +$popPremise = PopUp(["Choose...",$a], 1); +$popStep1 = PopUp(["Choose...",$a], 2); +$popStep23 = PopUp(["Choose...",$a], 7); +$popStep45 = PopUp(["Choose...",$a], 12); +$popStep67 = PopUp(["Choose...",$a], 15); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Consider the following premises and conclusion. + +*Premises:* +- [`` \neg P \wedge Q ``] +- [`` R \Rightarrow P ``] +- [`` \neg R \Rightarrow S ``] +- [`` S \Rightarrow T ``] + +*Conclusion:* +- [`` T ``] + +Below is a list of statements and reasons that prove the conclusion. Use the dropdown menus to choose the correct reason for each step of the proof. + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","\\( \\neg P \\wedge Q \\)", PGML('[_]{$popPremise}')], +["2","\\( \\neg P \\)", PGML('[_]{$popStep1}')], +["3","\\( R \\Rightarrow P \\)", PGML('[_]{$popPremise}')], +["4","\\( \\neg R \\)", PGML('[_]{$popStep23}')], +["5","\\( \\neg R \\Rightarrow S \\)", PGML('[_]{$popPremise}')], +["6","\\( S \\)", PGML('[_]{$popStep45}')], +["7","\\( S \\Rightarrow T \\)", PGML('[_]{$popPremise}')], +["8","\\( T \\)", PGML('[_]{$popStep67}')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","\\( \\neg P \\wedge Q \\)", PGML('[$popPremise]')], +["2","\\( \\neg P \\)", PGML('[$popStep1]')], +["3","\\( R \\Rightarrow P \\)", PGML('[$popPremise]')], +["4","\\( \\neg R \\)", PGML('[$popStep23]')], +["5","\\( \\neg R \\Rightarrow S \\)", PGML('[$popPremise]')], +["6","\\( S \\)", PGML('[$popStep45]')], +["7","\\( S \\Rightarrow T \\)", PGML('[$popPremise]')], +["8","\\( T \\)", PGML('[$popStep67]')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi5.pg b/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi5.pg new file mode 100644 index 0000000000..9d4b37d28f --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi5.pg @@ -0,0 +1,92 @@ +## DESCRIPTION +## Gives a proof as a list of statements and reasons and asks to choose the correct reasons +## for each step of the proof from a popup menu of options. +## Premises: Forall x [P(x) implies Q(x)], P(a) +## Conclusion: Q(a) +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Rules of Inference) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','propositional logic','rules of inference','argument','proof','quantifiers') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"niceTables.pl", +"PGML.pl" +); + +## Create an array of possible reasons +$a = ["Premise", + "Step 1", + "Step 2", + "Step 3", + "Step 4", + "Steps 1 and 2", + "Steps 1 and 3", + "Steps 1 and 4", + "Steps 2 and 3", + "Steps 2 and 4", + "Steps 3 and 4"]; + +## Create the popup menus with the correct answers +$popPremise = PopUp(["Choose...",$a], 1); +$popStep1 = PopUp(["Choose...",$a], 2); +$popStep23 = PopUp(["Choose...",$a], 9); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Consider the following premises and conclusion. + +*Premises:* +- [`` \forall x \hspace{1em} [P(x) \Rightarrow Q(x)] ``] +- [`` P(a) ``] + +*Conclusion:* +- [`` Q(a) ``] + +Below is a list of statements and reasons that prove the conclusion. Use the dropdown menus to choose the correct reason for each step of the proof. + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","\\( \\forall x \\hspace{1em} [P(x) \\Rightarrow Q(x)] \\)", PGML('[_]{$popPremise}')], +["2","\\( P(a) \\Rightarrow Q(a) \\)", PGML('[_]{$popStep1}')], +["3","\\( P(a) \\)", PGML('[_]{$popPremise}')], +["4","\\( Q(a) \\)", PGML('[_]{$popStep23}')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","\\( \\forall x \\hspace{1em} [P(x) \\Rightarrow Q(x)] \\)", PGML('[$popPremise]')], +["2","\\( P(a) \\Rightarrow Q(a) \\)", PGML('[$popStep1]')], +["3","\\( P(a) \\)", PGML('[$popPremise]')], +["4","\\( Q(a) \\)", PGML('[$popStep23]')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi6.pg b/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi6.pg new file mode 100644 index 0000000000..70e8674e6a --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s4_rulesofinference/roi6.pg @@ -0,0 +1,116 @@ +## DESCRIPTION +## Gives a proof as a list of statements and reasons and asks to choose the correct reasons +## for each step of the proof from a popup menu of options. +## Premises: Forall x [P(x) or Q(x)], Forall x [R(x) implies not(Q(x))], Exists x [not(P(x))] +## Conclusion: Exists x [not(R(x))] +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Rules of Inference) +## Date(06/23/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','propositional logic','rules of inference','argument','proof','quantifiers') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"niceTables.pl", +"PGML.pl" +); + +## Create an array of possible reasons +$a = ["Premise", + "Step 1", + "Step 2", + "Step 3", + "Step 6", + "Step 7", + "Step 8", + "Step 9", + "Steps 2 and 3", + "Steps 2 and 4", + "Steps 2 and 5", + "Steps 3 and 4", + "Steps 3 and 5", + "Steps 5 and 6", + "Steps 5 and 7", + "Steps 5 and 8", + "Steps 8 and 9"]; + +## Create the popup menus with the correct answers +$popPremise = PopUp(["Choose...",$a], 1); +$popStep1 = PopUp(["Choose...",$a], 2); +$popStep3 = PopUp(["Choose...",$a], 4); +$popStep6 = PopUp(["Choose...",$a], 5); +$popStep7 = PopUp(["Choose...",$a], 6); +$popStep9 = PopUp(["Choose...",$a], 8); +$popStep24 = PopUp(["Choose...",$a], 10); +$popStep58 = PopUp(["Choose...",$a], 16); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Consider the following premises and conclusion. + +*Premises:* +- [`` \forall x \hspace{1em} [P(x) \vee Q(x)] ``] +- [`` \forall x \hspace{1em} [R(x) \Rightarrow \neg Q(x)] ``] +- [`` \exists x \hspace{1em} \neg P(x) ``] + +*Conclusion:* +- [`` \exists x \hspace{1em} \neg R(x) ``] + +Below is a list of statements and reasons that prove the conclusion. Use the dropdown menus to choose the correct reason for each step of the proof. + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","\\( \\exists x \\hspace{1em} \\neg P(x) \\)", PGML('[_]{$popPremise}')], +["2","\\( \\neg P(a) \\)", PGML('[_]{$popStep1}')], +["3","\\( \\forall x \\hspace{1em} [P(x) \\vee Q(x)] \\)", PGML('[_]{$popPremise}')], +["4","\\( P(a) \\vee Q(a) \\)", PGML('[_]{$popStep3}')], +["5","\\( Q(a) \\)", PGML('[_]{$popStep24}')], +["6","\\( \\forall x \\hspace{1em} [R(x) \\Rightarrow \\neg Q(x)] \\)", PGML('[_]{$popPremise}')], +["7","\\( R(a) \\Rightarrow \\neg Q(a) \\)", PGML('[_]{$popStep6}')], +["8","\\( Q(a) \\Rightarrow \\neg R(a) \\)", PGML('[_]{$popStep7}')], +["9","\\( \\neg R(a) \\)", PGML('[_]{$popStep58}')], +["10","\\( \\exists x \\hspace{1em} \\neg R(x) \\)", PGML('[_]{$popStep9}')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","\\( \\exists x \\hspace{1em} \\neg P(x) \\)", PGML('[$popPremise]')], +["2","\\( \\neg P(a) \\)", PGML('[$popStep1]')], +["3","\\( \\forall x \\hspace{1em} [P(x) \\vee Q(x)] \\)", PGML('[$popPremise]')], +["4","\\( P(a) \\vee Q(a) \\)", PGML('[$popStep3]')], +["5","\\( Q(a) \\)", PGML('[$popStep24]')], +["6","\\( \\forall x \\hspace{1em} [R(x) \\Rightarrow \\neg Q(x)] \\)", PGML('[$popPremise]')], +["7","\\( R(a) \\Rightarrow \\neg Q(a) \\)", PGML('[$popStep6]')], +["8","\\( Q(a) \\Rightarrow \\neg R(a) \\)", PGML('[$popStep7]')], +["9","\\( \\neg R(a) \\)", PGML('[$popStep58]')], +["10","\\( \\exists x \\hspace{1em} \\neg R(x) \\)", PGML('[$popStep9]')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch1s5_proofs/proof1.pg b/Contrib/LaTech/DiscreteMath/ch1s5_proofs/proof1.pg new file mode 100644 index 0000000000..369d86bc0e --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch1s5_proofs/proof1.pg @@ -0,0 +1,100 @@ +## DESCRIPTION +## Gives a proof as a list of statements and reasons and asks to choose the correct reasons +## for each step of the proof from a popup menu of options. +## Problem: An integer n cannot be both even and odd simultaneously +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Logic) +## DBsection(Proofs) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','logic','argument','proof','parity') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"niceTables.pl", +"PGML.pl" +); + +## Create an array of possible reasons +$a = ["Begin a proof by contradiction", + "Step 1", + "Step 2", + "Step 3", + "Step 4", + "Step 5", + "Step 6", + "Steps 2 and 3", + "Steps 2 and 4", + "Steps 2 and 5", + "Steps 3 and 4", + "Steps 3 and 5", + "Steps 3 and 6", + "Steps 4 and 5", + "Steps 4 and 6", + "Steps 5 and 6"]; + +## Create the popup menus with the correct answers +$popPremise = PopUp(["Choose...",$a], 1); +$popStep1 = PopUp(["Choose...",$a], 2); +$popStep23 = PopUp(["Choose...",$a], 8); +$popStep4 = PopUp(["Choose...",$a], 5); +$popStep5 = PopUp(["Choose...",$a], 6); +$popStep6 = PopUp(["Choose...",$a], 7); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Consider the following statement to be proved. + +*An integer [` n `] cannot be both even and odd simultaneously.* + +Below is a list of statements and reasons that prove it. Use the dropdown menus to choose the correct reason for each step of the proof. + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","An integer \\( n \\) can be both even and odd.", PGML('[_]{$popPremise}')], +["2","There exists integer \\( k \\) such that \\( n = 2k \\).", PGML('[_]{$popStep1}')], +["3","There exists integer \\( j \\) such that \\( n = 2j + 1 \\).", PGML('[_]{$popStep1}')], +["4","\\( 2k = 2j + 1 \\)", PGML('[_]{$popStep23}')], +["5","\\( 2k - 2j = 1 \\)", PGML('[_]{$popStep4}')], +["6","\\( 2(k-j) = 1 \\)", PGML('[_]{$popStep5}')], +["7","Contradiction because 2 times an integer cannot equal 1.", PGML('[_]{$popStep6}')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[@ +DataTable([ +["Step","Statement","Reason"], +["1","An integer \\( n \\) can be both even and odd.", PGML('[$popPremise]')], +["2","There exists integer \\( k \\) such that \\( n = 2k \\).", PGML('[$popStep1]')], +["3","There exists integer \\( j \\) such that \\( n = 2j + 1 \\).", PGML('[$popStep1]')], +["4","\\( 2k = 2j + 1 \\)", PGML('[$popStep23]')], +["5","\\( 2k - 2j = 1 \\)", PGML('[$popStep4]')], +["6","\\( 2(k-j) = 1 \\)", PGML('[$popStep5]')], +["7","Contradiction because 2 times an integer cannot equal 1.", PGML('[$popStep6]')] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch2s1_sets/set1.pg b/Contrib/LaTech/DiscreteMath/ch2s1_sets/set1.pg new file mode 100644 index 0000000000..b74a8c471a --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch2s1_sets/set1.pg @@ -0,0 +1,76 @@ +## DESCRIPTION +## Gives various statements about empty and singleton sets and asks whether they are true or false. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sets and Functions) +## DBsection(Sets) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','sets','subset','element','empty set','singleton') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Determine the truth value of the following statements. + +[_]{$popFalse} : [`` 0 \in \emptyset ``] + +[_]{$popFalse} : [`` \emptyset \in \{0\} ``] + +[_]{$popTrue} : [`` \emptyset \subseteq \{0\} ``] + +[_]{$popFalse} : [`` \{0\} \in \{0\} ``] + +[_]{$popTrue} : [`` \{0\} \subseteq \{0\} ``] + +[_]{$popTrue} : [`` \{\emptyset\} \subseteq \{\emptyset\} ``] + +[_]{$popTrue} : [`` x \in \{x\} ``] + +[_]{$popTrue} : [`` \{x\} \subseteq \{x,\{x\}\} ``] + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[$popFalse] : [`` 0 \in \emptyset ``] + +[$popFalse] : [`` \emptyset \in \{0\} ``] + +[$popTrue] : [`` \emptyset \subseteq \{0\} ``] + +[$popFalse] : [`` \{0\} \in \{0\} ``] + +[$popTrue] : [`` \{0\} \subseteq \{0\} ``] + +[$popTrue] : [`` \{\emptyset\} \subseteq \{\emptyset\} ``] + +[$popTrue] : [`` x \in \{x\} ``] + +[$popTrue] : [`` \{x\} \subseteq \{x,\{x\}\} ``] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch2s1_sets/set2.pg b/Contrib/LaTech/DiscreteMath/ch2s1_sets/set2.pg new file mode 100644 index 0000000000..d66d6f0658 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch2s1_sets/set2.pg @@ -0,0 +1,76 @@ +## DESCRIPTION +## Gives various statements about empty and singleton sets and asks whether they are true or false. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sets and Functions) +## DBsection(Sets) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','sets','subset','element','empty set','singleton') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Determine the truth value of the following statements. + +[_]{$popTrue} : [`` \{x\} \in \{\{x\}\} ``] + +[_]{$popTrue} : [`` \emptyset \subseteq \emptyset ``] + +[_]{$popFalse} : [`` \emptyset \in \{x\} ``] + +[_]{$popTrue} : [`` \emptyset \in \{\emptyset,\{x\}\} ``] + +[_]{$popTrue} : [`` 0 \notin \emptyset ``] + +[_]{$popTrue} : [`` \emptyset \notin \emptyset ``] + +[_]{$popFalse} : [`` \{x\} \subseteq \emptyset ``] + +[_]{$popFalse} : [`` \emptyset \notin \{\emptyset\} ``] + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[$popTrue] : [`` \{x\} \in \{\{x\}\} ``] + +[$popTrue] : [`` \emptyset \subseteq \emptyset ``] + +[$popFalse] : [`` \emptyset \in \{x\} ``] + +[$popTrue] : [`` \emptyset \in \{\emptyset,\{x\}\} ``] + +[$popTrue] : [`` 0 \notin \emptyset ``] + +[$popTrue] : [`` \emptyset \notin \emptyset ``] + +[$popFalse] : [`` \{x\} \subseteq \emptyset ``] + +[$popFalse] : [`` \emptyset \notin \{\emptyset\} ``] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch2s1_sets/set3.pg b/Contrib/LaTech/DiscreteMath/ch2s1_sets/set3.pg new file mode 100644 index 0000000000..d6de17ec44 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch2s1_sets/set3.pg @@ -0,0 +1,100 @@ +## DESCRIPTION +## Gives various statements about commonly used sets and asks whether they are true or false. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sets and Functions) +## DBsection(Sets) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','sets','subset','element','common sets','cross product') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserPopUp.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Do not reveal partial solutions for True/False questions. +$showPartialCorrectAnswers = 0; + +## Create the popup menus with the correct answers +$popTrue = PopUp(["Choose...","T","F"], 1); +$popFalse = PopUp(["Choose...","T","F"], 2); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Recall the following commonly used sets. + +[`` \mathbb{N} ``] : The set of natural numbers (which does not include 0). + +[`` \mathbb{Z} ``] : The set of integers + +[`` \mathbb{Q} ``] : The set of rational numbers + +[`` \mathbb{P} ``] : The set of prime numbers + +[`` \mathbb{R} ``] : The set of real numbers + +[`` P_{n} ``] : The set of polynomials of degree [` n `] or less + +[`` C(I) ``] : The set of continuous functions on the interval [` I `] + +Determine the truth value of the following statements. + +[_]{$popTrue} : [`` x + 1 \in P_{2} ``] + +[_]{$popFalse} : [`` x^{2} \in P_{1} ``] + +[_]{$popFalse} : [`` \dfrac{1}{x} \in C[-1,1] ``] + +[_]{$popTrue} : [`` \dfrac{1}{x} \in C[1,2] ``] + +[_]{$popTrue} : [`` \cos{(x)} \in C(\mathbb{R}) ``] + +[_]{$popFalse} : [`` \mathbb{R}^{2} \subseteq \mathbb{R}^{3} ``] + +[_]{$popFalse} : [`` (\pi,-1) \in \mathbb{R} \times \mathbb{N} ``] + +[_]{$popTrue} : [`` (\cos{(x)},\sin{(x)}) \in [C(\mathbb{R})]^{2} ``] + +[_]{$popTrue} : [`` (-1,\pi,1) \in \mathbb{Z} \times \mathbb{R} \times \mathbb{N} ``] + +[_]{$popTrue} : [`` \mathbb{Q} \times \mathbb{R} \subseteq \mathbb{R}^{2} ``] + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[$popTrue] : [`` x + 1 \in P_{2} ``] + +[$popFalse] : [`` x^{2} \in P_{1} ``] + +[$popFalse] : [`` \dfrac{1}{x} \in C[-1,1] ``] + +[$popTrue] : [`` \dfrac{1}{x} \in C[1,2] ``] + +[$popTrue] : [`` \cos{(x)} \in C(\mathbb{R}) ``] + +[$popFalse] : [`` \mathbb{R}^{2} \subseteq \mathbb{R}^{3} ``] + +[$popFalse] : [`` (\pi,-1) \in \mathbb{R} \times \mathbb{N} ``] + +[$popTrue] : [`` (\cos{(x)},\sin{(x)}) \in [C(\mathbb{R})]^{2} ``] + +[$popTrue] : [`` (-1,\pi,1) \in \mathbb{Z} \times \mathbb{R} \times \mathbb{N} ``] + +[$popTrue] : [`` \mathbb{Q} \times \mathbb{R} \subseteq \mathbb{R}^{2} ``] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch2s1_sets/setsize1.pg b/Contrib/LaTech/DiscreteMath/ch2s1_sets/setsize1.pg new file mode 100644 index 0000000000..a1a9861df4 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch2s1_sets/setsize1.pg @@ -0,0 +1,74 @@ +## DESCRIPTION +## Gives various sets and asks whether for their size/cardinality. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sets and Functions) +## DBsection(Sets) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','sets','size','cardinality') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Create parameters and solutions to predetermined problems +$n1 = random(15,29,2); +$size1 = ($n1+1)/2; + +$n2 = random(17,24,1); +$size2 = 0; + +$n3 = random(1,10,1); +$size3 = 2; + +$n4 = random(6,10,1); +$m = 2**$n4; +$size4 = $n4 + 1; + +$n5 = random(1,5,1); +$p = random(9,15,1); +$size5 = $p - $n5 - 1; + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Compute the size of the following sets. + +[`` |\{1,3,5,\cdots,[$n1]\}| ``] = [____]{$size1} + +[`` |\{x \in \mathbb{Z} : x^{2} = [$n2]\}| ``] = [____]{$size2} + +[`` |\{x \in \mathbb{R} : x^{2} = [$n3]\}| ``] = [____]{$size3} + +[`` |\{1,2,4,8,\cdots,[$m]\}| ``] = [____]{$size4} + +[`` |\{x \in \mathbb{Z} : [$n5] < x < [$p]\}| ``] = [____]{$size5} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` |\{1,3,5,\cdots,[$n1]\}| ``] = [$size1] + +[`` |\{x \in \mathbb{Z} : x^{2} = [$n2]\}| ``] = [$size2] + +[`` |\{x \in \mathbb{R} : x^{2} = [$n3]\}| ``] = [$size3] + +[`` |\{1,2,4,8,\cdots,[$m]\}| ``] = [$size4] + +[`` |\{x \in \mathbb{Z} : [$n5] < x < [$p]\}| ``] = [$size5] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch2s1_sets/setsize2.pg b/Contrib/LaTech/DiscreteMath/ch2s1_sets/setsize2.pg new file mode 100644 index 0000000000..60fd378ce0 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch2s1_sets/setsize2.pg @@ -0,0 +1,69 @@ +## DESCRIPTION +## Generates various sets and asks for their size/cardinality. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sets and Functions) +## DBsection(Sets) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## Level(2) +## KEYWORDS('discrete math','sets','size','cardinality') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Create parameters and solutions to predetermined problems +$j = random(8,20,2); +$ans1 = $j/2; + +$k = random(4,10,1); +$ans2 = 2*$k - 1; + +$i = random(7,12,1); +@primes = (2,3,5,7,11,13,17,19,23,29,31,37); +$p = $primes[$i-1]; + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Compute the size of the following sets. (In this context, [` \mathbb{N} `] is the set of natural numbers, [` \mathbb{Z} `] is the set of integers, + [` \mathbb{P} `] is the set of prime numbers, and 0 is not considered a natural number.) + +[`` |\{ \emptyset \}| ``] = [____]{1} + +[`` |\{ \emptyset, \{\emptyset\}, \{\emptyset, \{\emptyset\}\} \}| ``] = [____]{3} + +[`` |\{n \in \mathbb{N} : n \text{ is even } \wedge (n \leq [$j]) \}| ``] = [____]{$ans1} + +[`` |\{x \in \mathbb{Z} : |x| < [$k]\}| ``] = [____]{$ans2} + +[`` |\{n \in \mathbb{P} : n \leq [$p]\}| ``] = [____]{$i} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` |\{ \emptyset \}| ``] = 1 + +[`` |\{ \emptyset, \{\emptyset\}, \{\emptyset, \{\emptyset\}\} \}| ``] = 3 + +[`` |\{n \in \mathbb{N} : n \text{ is even } \wedge (n \leq [$j]) \}| ``] = [$ans1] + +[`` |\{x \in \mathbb{Z} : |x| < [$k]\}| ``] = [$ans2] + +[`` |\{n \in \mathbb{P} : n \leq [$p]\}| ``] = [$i] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops1.pg b/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops1.pg new file mode 100644 index 0000000000..8898129334 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops1.pg @@ -0,0 +1,119 @@ +## DESCRIPTION +## Gives various sets and asks to compute different set operations. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sets and Functions) +## DBsection(Set Operations) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## Static(1) +## Level(2) +## KEYWORDS('discrete math','sets','operations','union','intersect','difference') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"MathObjects.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Set the context for sets and intervals +Context("Interval"); + +## Initialize given sets +$A = Interval("(0,infinity)"); +$B = Set(2,4,8,16,32); +$C = Set(2,4,6,8,10,12,14); +$D = Interval("(-3,9)"); +$E = Interval("(-infinity,1]"); + +## Create solutions to predetermined problems +$BcupC = Union($B,$C); +$BcapC = $B->intersect($C); +$BmC = $B - $C; +$CmB = $C - $B; +$DcupE = Union($D,$E); +$DcapE = $D->intersect($E); +$BcapE = $B->intersect($E); +$AcupE = Union($A,$E); +$AmD = $A - $D; +$AcapofDcupE = $A->intersect($DcupE); + +## Do not allow students to "cheat" using the difference operator by removing it from the context +Context()->operators->undefine("-"); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML + +Consider the following sets. + +[`` A = [$A]``] + +[`` B = [$B]``] + +[`` C = [$C]``] + +[`` D = [$D]``] + +[`` E = [$E]``] + +Write the following sets using either as an explicit list or interval notation. *Remember to use curly braces, parentheses, or brackets properly!* + +Note: For the symbol [` \infty `], you may type the word _inf_. For an empty set, you may type [` \{\} `]. + +[`` B \cup C ``] = [____________________]{$BcupC} + +[`` B \cap C ``] = [____________________]{$BcapC} + +[`` B - C ``] = [____________________]{$BmC} + +[`` C - B ``] = [____________________]{$CmB} + +[`` D \cup E ``] = [____________________]{$DcupE} + +[`` D \cap E ``] = [____________________]{$DcapE} + +[`` B \cap E ``] = [____________________]{$BcapE} + +[`` A \cup E ``] = [____________________]{$AcupE} + +[`` A - D ``] = [____________________]{$AmD} + +[`` A \cap (D \cup E) ``] = [____________________]{$AcapofDcupE} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` B \cup C ``] = [$BcupC] + +[`` B \cap C ``] = [$BcapC] + +[`` B - C ``] = [$BmC] + +[`` C - B ``] = [$CmB] + +[`` D \cup E ``] = [$DcupE] + +[`` D \cap E ``] = [$DcapE] + +[`` B \cap E ``] = [$BcapE] + +[`` A \cup E ``] = [$AcupE] + +[`` A - D ``] = [$AmD] + +[`` A \cap (D \cup E) ``] = [$AcapofDcupE] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops2.pg b/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops2.pg new file mode 100644 index 0000000000..0b316fb0f5 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops2.pg @@ -0,0 +1,123 @@ +## DESCRIPTION +## Gives various interval sets and asks to compute different set operations. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sets and Functions) +## DBsection(Set Operations) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## Level(2) +## KEYWORDS('discrete math','sets','interval','operations','union','intersect','difference') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"MathObjects.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Set the context for sets and intervals +Context("Interval"); + +## Generate random distinct numbers for interval endpoints. +$n1 = random(-6,-3,1); +$n2 = random(-2,2,1); +$n3 = random(3,6,1); + +## Initialize given sets +$A = Interval("(-infinity,$n1]"); +$B = Interval("($n1,$n2]"); +$C = Interval("[$n2,$n3]"); +$D = Interval("[$n1,$n3)"); +$E = Interval("($n3,infinity)"); + +## Create solutions to predetermined problems +$BcupC = Union($B,$C); +$BcapC = $B->intersect($C); +$BmC = $B - $C; +$CmB = $C - $B; +$DcupE = Union($D,$E); +$DcapE = $D->intersect($E); +$BcapE = $B->intersect($E); +$AcupE = Union($A,$E); +$AmD = $A - $D; +$AcapofDcupE = $A->intersect($DcupE); + +## Do not allow students to "cheat" using the difference operator by removing it from the context +Context()->operators->undefine("-"); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML + +Consider the following sets. + +[`` A = [$A]``] + +[`` B = [$B]``] + +[`` C = [$C]``] + +[`` D = [$D]``] + +[`` E = [$E]``] + +Write the following sets using either as an explicit list or interval notation. *Remember to use curly braces, parentheses, or brackets properly!* + +Note: For the symbol [` \infty `], you may type the word _inf_. For an empty set, you may type [` \{\} `]. For the union operation, you may type the character _U_. + +[`` B \cup C ``] = [____________________]{$BcupC} + +[`` B \cap C ``] = [____________________]{$BcapC} + +[`` B - C ``] = [____________________]{$BmC} + +[`` C - B ``] = [____________________]{$CmB} + +[`` D \cup E ``] = [____________________]{$DcupE} + +[`` D \cap E ``] = [____________________]{$DcapE} + +[`` B \cap E ``] = [____________________]{$BcapE} + +[`` A \cup E ``] = [____________________]{$AcupE} + +[`` A - D ``] = [____________________]{$AmD} + +[`` A \cap (D \cup E) ``] = [____________________]{$AcapofDcupE} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` B \cup C ``] = [$BcupC] + +[`` B \cap C ``] = [$BcapC] + +[`` B - C ``] = [$BmC] + +[`` C - B ``] = [$CmB] + +[`` D \cup E ``] = [$DcupE] + +[`` D \cap E ``] = [$DcapE] + +[`` B \cap E ``] = [$BcapE] + +[`` A \cup E ``] = [$AcupE] + +[`` A - D ``] = [$AmD] + +[`` A \cap (D \cup E) ``] = [$AcapofDcupE] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops3.pg b/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops3.pg new file mode 100644 index 0000000000..a073157d0b --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops3.pg @@ -0,0 +1,101 @@ +## DESCRIPTION +## Generates various sets and asks to compute their power sets and product sets. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sets and Functions) +## DBsection(Set Operations) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## Level(2) +## KEYWORDS('discrete math','sets','power set','operations','cross','product') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"MathObjects.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Set the context for sets and intervals +Context("Interval"); + +## Generate random distinct numbers for set elements. +$n1 = random(-6,-4,1); +$n2 = random(-1,1,1); +$n3 = random(2,3,1); +$n4 = random(7,9,1); + +## Initialize given sets +$A = Set($n1,$n2); +$B = Set($n1,$n2,$n3); +$C = Set($n1,$n2,$n3,$n4); + +## Create solutions to predetermined problems +$s1 = Set($n1); +$s2 = Set($n2); +$s3 = Set($n3); +$s12 = Set($n1,$n2); +$s13 = Set($n1,$n3); +$s23 = Set($n2,$n3); +$s123 = Set($n1,$n2,$n3); +$se = Set("{}"); + +$powA = List($s1,$s2,$s12,$se); +$powB = List($s1,$s2,$s3,$s12,$s13,$s23,$s123,$se); +$powEmpty = List($se); +Context("Point"); +$AcrossC = List(Point($n1,$n1),Point($n1,$n2),Point($n1,$n3),Point($n1,$n4),Point($n2,$n1),Point($n2,$n2),Point($n2,$n3),Point($n2,$n4)); +$CcrossA = List(Point($n1,$n1),Point($n1,$n2),Point($n2,$n1),Point($n2,$n2),Point($n3,$n1),Point($n3,$n2),Point($n4,$n1),Point($n4,$n2)); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML + +Consider the following sets. + +[`` A = [$A]``] + +[`` B = [$B]``] + +[`` C = [$C]``] + +Write the following sets using an explicit list. + +Note: *The outermost curly braces are written for you!* You must use the remaining curly braces inside properly. For an empty set, you may type [` \{\} `]. + +[`` P(A) = \Bigg\{ ``] [____________________]{$powA} [`` \Bigg\} ``] + +[`` P(B) = \Bigg\{ ``] [____________________]{$powB} [`` \Bigg\} ``] + +[`` P(\emptyset) = \Bigg\{ ``] [____________________]{$powEmpty} [`` \Bigg\} ``] + +[`` A \times C = \Bigg\{ ``] [____________________]{$AcrossC} [`` \Bigg\} ``] + +[`` C \times A = \Bigg\{ ``] [____________________]{$CcrossA} [`` \Bigg\} ``] + + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` P(A) = \Bigg\{ ``] [$powA] [`` \Bigg\} ``] + +[`` P(B) = \Bigg\{ ``] [$powB] [`` \Bigg\} ``] + +[`` P(\emptyset) = \Bigg\{ ``] [$powEmpty] [`` \Bigg\} ``] + +[`` A \times C = \Bigg\{ ``] [$AcrossC] [`` \Bigg\} ``] + +[`` C \times A = \Bigg\{ ``] [$CcrossA] [`` \Bigg\} ``] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops4.pg b/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops4.pg new file mode 100644 index 0000000000..21a570646e --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops4.pg @@ -0,0 +1,112 @@ +## DESCRIPTION +## Gives the set (-inf,i] and asks to compute big unions, big intersections, +## and complements of this set from multiple choice options. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sets and Functions) +## DBsection(Set Operations) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','sets','operations','union','intersection','complement','interval') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserRadioButtons.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Create an array of possible answers +$a = ["\( (-\infty,\infty) \)", + "\( \emptyset \) (Empty Set)", + "\( (-\infty,n] \)", + "\( (-\infty,1] \)", + "\( (1,\infty) \)", + "\( (n,\infty) \)", + "\( [n,\infty) \)", + "\( (-\infty,n) \)", + "\( (-\infty,1) \)"]; + +## Create the radio buttons with the correct answers +$radio1 = RadioButtons([$a,"None of the other choices."], 0); +$radio2 = RadioButtons([$a,"None of the other choices."], 1); +$radio3 = RadioButtons([$a,"None of the other choices."], 2); +$radio4 = RadioButtons([$a,"None of the other choices."], 3); +$radio5 = RadioButtons([$a,"None of the other choices."], 4); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Choose the correct set that corresponds to the operation given below. (The universal set is all real numbers.) + +[`` \bigcup_{i=1}^{n}{(-\infty,i]} ``] + +[_]{$radio3} + +--- + +[`` \bigcup_{i=1}^{\infty}{(-\infty,i]} ``] + +[_]{$radio1} + +--- + +[`` \overline{\bigcup_{i=1}^{\infty}{(-\infty,i]}} ``] + +[_]{$radio2} + +--- + +[`` \bigcap_{i=1}^{n}{(-\infty,i]} ``] + +[_]{$radio4} + +--- + +[`` \overline{\bigcap_{i=1}^{n}{(-\infty,i]}} ``] + +[_]{$radio5} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` \bigcup_{i=1}^{\infty}{(-\infty,i]} ``] + +[$radio1] + +--- + +[`` \overline{\bigcup_{i=1}^{\infty}{(-\infty,i]}} ``] + +[$radio2] + +--- + +[`` \bigcup_{i=1}^{n}{(-\infty,i]} ``] + +[$radio3] + +--- + +[`` \bigcap_{i=1}^{n}{(-\infty,i]} ``] + +[$radio4] + +--- + +[`` \overline{\bigcap_{i=1}^{n}{(-\infty,i]}} ``] + +[$radio5] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops5.pg b/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops5.pg new file mode 100644 index 0000000000..9b65181c1a --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch2s2_setoperations/setops5.pg @@ -0,0 +1,109 @@ +## DESCRIPTION +## Gives the set [-i,i] and asks to compute big unions, big intersections, +## and complements of this set from multiple choice options. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sets and Functions) +## DBsection(Set Operations) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','sets','operations','union','intersection','complement','interval') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"parserRadioButtons.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Create an array of possible answers +$a = ["\( (-\infty,\infty) \)", + "\( \emptyset \) (Empty Set)", + "\( [-n,n] \)", + "\( [-1,1] \)", + "\( (-1,1) \)", + "\( (-n,n) \)", + "\( \{0\} \)"]; + +## Create the radio buttons with the correct answers +$radio1 = RadioButtons([$a,"None of the other choices."], 0); +$radio2 = RadioButtons([$a,"None of the other choices."], 1); +$radio3 = RadioButtons([$a,"None of the other choices."], 2); +$radio4 = RadioButtons([$a,"None of the other choices."], 3); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML +Choose the correct set that corresponds to the operation given below. (The universal set is all real numbers.) + +[`` \bigcup_{i=1}^{n}{[-i,i]} ``] + +[_]{$radio3} + +--- + +[`` \bigcup_{i=1}^{\infty}{[-i,i]} ``] + +[_]{$radio1} + +--- + +[`` \overline{\bigcup_{i=1}^{\infty}{[-i,i]}} ``] + +[_]{$radio2} + +--- + +[`` \bigcap_{i=1}^{n}{[-i,i]} ``] + +[_]{$radio4} + +--- + +[`` \bigcap_{i=1}^{\infty}{[-i,i]} ``] + +[_]{$radio4} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` \bigcup_{i=1}^{\infty}{[-i,i]} ``] + +[$radio1] + +--- + +[`` \overline{\bigcup_{i=1}^{\infty}{[-i,i]}} ``] + +[$radio2] + +--- + +[`` \bigcup_{i=1}^{n}{[-i,i]} ``] + +[$radio3] + +--- + +[`` \bigcap_{i=1}^{n}{[-i,i]} ``] + +[$radio4] + +--- + +[`` \bigcap_{i=1}^{\infty}{[-i,i]} ``] + +[$radio4] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch2s3_functions/fun1.pg b/Contrib/LaTech/DiscreteMath/ch2s3_functions/fun1.pg new file mode 100644 index 0000000000..7b334dd701 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch2s3_functions/fun1.pg @@ -0,0 +1,73 @@ +## DESCRIPTION +## Asks for various images and inverse images under the floor function. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sets and Functions) +## DBsection(Functions) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','sets','functions','image','inverse','floor') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"MathObjects.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Set the context for sets and intervals +Context("Interval"); + +## Create solutions to predetermined problems +$ans1 = Set(0,1); +$ans2 = Set(0); +$ans3 = Set("{}"); +$ans4 = Interval("[0,1)"); +$ans5 = Interval("[-1,1)"); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML + +Consider the function [`` g:\mathbb{R} \to \mathbb{R}``] given by [`` g(x)=\text{floor}(x) ``]. (Recall that the ceiling function rounds a number up to the nearest integer and that [`` \mathbb{R} ``] represents the set of all real numbers.) + +Compute the following images and inverse images. *Remember to use curly braces, parentheses, or brackets properly!* + +Note: For an empty set, you may type [` \{\} `]. + +[`` g([0,1]) ``] = [____________________]{$ans1} + +[`` g(\{x : 0 < x < 1\}) ``] = [____________________]{$ans2} + +[`` g^{-1}(\{y : 0 < y < 1\}) ``] = [____________________]{$ans3} + +[`` g^{-1}(\{0\}) ``] = [____________________]{$ans4} + +[`` g^{-1}(\{-1,0\}) ``] = [____________________]{$ans5} + + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` g([0,1]) ``] = [$ans1] + +[`` g(\{x : 0 < x < 1\}) ``] = [$ans2] + +[`` g^{-1}(\{y : 0 < y < 1\}) ``] = [$ans3] + +[`` g^{-1}(\{0\}) ``] = [$ans4] + +[`` g^{-1}(\{-1,0\}) ``] = [$ans5] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch2s3_functions/fun2.pg b/Contrib/LaTech/DiscreteMath/ch2s3_functions/fun2.pg new file mode 100644 index 0000000000..e4bc62dbe1 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch2s3_functions/fun2.pg @@ -0,0 +1,72 @@ +## DESCRIPTION +## Asks for various images and inverse images under the ceiling function. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sets and Functions) +## DBsection(Functions) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','sets','functions','image','inverse','ceiling') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"MathObjects.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Set the context for sets and intervals +Context("Interval"); + +## Create solutions to predetermined problems +$ans1 = Set(0,1); +$ans2 = Set(1); +$ans3 = Set("{}"); +$ans4 = Interval("(-1,0]"); +$ans5 = Interval("(-1,1]"); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML + +Consider the function [`` g:\mathbb{R} \to \mathbb{R}``] given by [`` g(x)=\text{ceil}(x) ``]. (Recall that the ceiling function rounds a number up to the nearest integer and that [`` \mathbb{R} ``] represents the set of all real numbers.) + +Compute the following images and inverse images. *Remember to use curly braces, parentheses, or brackets properly!* + +Note: For an empty set, you may type [` \{\} `]. + +[`` g([0,1]) ``] = [____________________]{$ans1} + +[`` g(\{x : 0 < x < 1\}) ``] = [____________________]{$ans2} + +[`` g^{-1}(\{y : 0 < y < 1\}) ``] = [____________________]{$ans3} + +[`` g^{-1}(\{0\}) ``] = [____________________]{$ans4} + +[`` g^{-1}(\{0,1\}) ``] = [____________________]{$ans5} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` g([0,1]) ``] = [$ans1] + +[`` g(\{x : 0 < x < 1\}) ``] = [$ans2] + +[`` g^{-1}(\{y : 0 < y < 1\}) ``] = [$ans3] + +[`` g^{-1}(\{0\}) ``] = [$ans4] + +[`` g^{-1}(\{0,1\}) ``] = [$ans5] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch2s3_functions/fun3.pg b/Contrib/LaTech/DiscreteMath/ch2s3_functions/fun3.pg new file mode 100644 index 0000000000..0be0e0f45f --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch2s3_functions/fun3.pg @@ -0,0 +1,72 @@ +## DESCRIPTION +## Asks for various images and inverse images under the square function. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sets and Functions) +## DBsection(Functions) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','sets','functions','image','inverse','square') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"MathObjects.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Set the context for sets and intervals +Context("Interval"); + +## Create solutions to predetermined problems +$ans1 = Interval("[0,4)"); +$ans2 = Interval("[0,infinity)"); +$ans3 = Set(-1,1); +$ans4 = Interval("(-1,1)"); +$ans5 = Interval("(-infinity,-2]U[2,infinity)"); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML + +Consider the function [`` f:\mathbb{R} \to \mathbb{R}``] given by [`` f(x) = x^{2} ``]. (Recall that [`` \mathbb{R} ``] represents the set of all real numbers.) + +Compute the following images and inverse images. *Remember to use curly braces, parentheses, or brackets properly!* + +Note: For the symbol [` \infty `], you may type the word _infinity_. For an empty set, you may type [` \{\} `]. For the union operation, you may type the character _U_. + +[`` f((-2,2)) ``] = [____________________]{$ans1} + +[`` f(\mathbb{R}) ``] = [____________________]{$ans2} + +[`` f^{-1}(\{1\}) ``] = [____________________]{$ans3} + +[`` f^{-1}(\{y : 0 \leq y < 1\}) ``] = [____________________]{$ans4} + +[`` f^{-1}(\{y : y \geq 4\}) ``] = [____________________]{$ans5} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` f((-2,2)) ``] = [$ans1] + +[`` f(\mathbb{R}) ``] = [$ans2] + +[`` f^{-1}(\{1\}) ``] = [$ans3] + +[`` f^{-1}(\{y : 0 \leq y < 1\}) ``] = [$ans4] + +[`` f^{-1}(\{y : y \geq 4\}) ``] = [$ans5] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel1.pg b/Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel1.pg new file mode 100644 index 0000000000..1367904a61 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel1.pg @@ -0,0 +1,105 @@ +## DESCRIPTION +## Generates a 2nd degree constant coefficient homogeneous recurrence relation. +## The characteristic equation will have two distinct nonzero real roots. +## A multianswer parser will check both homogeneous solutions in any order entered. +## The problem has the form: a_n = p*a_(n-1) + q*a_(n-2), a_0 = c, a_1 = d +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sequences) +## DBsection(Recurrence Relations) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## Level(3) +## KEYWORDS('discrete math','recurrence relation','2nd degree','homogeneous','constant coefficient','distinct roots') + +DOCUMENT(); + +## Load libraries +loadMacros("PGstandard.pl", + "MathObjects.pl", + "parserMultiAnswer.pl", + "PGML.pl", + "PGcourse.pl", + "contextFraction.pl"); + +## Set the context: no decimal input, absolute tolerance, variable "n", and integer test points for answer checker +Context("Fraction-NoDecimals"); +Context()->flags->set( tolerance => 0.01, tolType => "absolute"); +Context()->variables->are(n=>["Real",limits=>[0,15],resolution=>1]); + +## Randomly generate two distinct nonzero roots of the characteristic equation +$r1 = non_zero_random(-6,6,1); +do {$r2 = non_zero_random(-6,6,1);} until ($r2 != $r1); + +## Randomly generate initial conditions +$c = random(-4,4,1); +$d = random(-4,4,1); + +## Compute the coefficients of the problem based on roots +$p = $r1 + $r2; +$q = -$r1*$r2; + +## Compute the particular solution constants based on initial conditions +$c1 = Compute("($c*$r2 - $d)/($r2 - $r1)"); +$c2 = Compute("($d - $c*$r1)/($r2 - $r1)"); + +## Construct the solution of the recurrence relation +$n = Formula("n"); +$y1 = ($r1**$n)->reduce; +$y2 = ($r2**$n)->reduce; +$y = ($c1*$y1 + $c2*$y2)->reduce; + +## Construct the answer parser for the general solution +$ans = MultiAnswer($y1, $y2)->with( + singleResult => 1, + checker => sub { + my ( $correct, $student, $self ) = @_; + my ( $f1stu, $f2stu ) = @{$student}; + my ( $f1, $f2 ) = @{$correct}; + if ( + ($f1 == $f1stu && $f2 == $f2stu ) || + ($f1 == $f2stu && $f2 == $f1stu ) + ) { + return 1; + } else { + return 0; + } + } +); + + +## Display problem +TEXT(beginproblem()); + +BEGIN_PGML +For the recurrence relation: + + [`` a_{n} = [$p]a_{n-1} + [$q]a_{n-2} ``], + +The general solution has the form: + + [`` a_{n} = c_{1} ``] [____________________]{$ans} [`` + c_{2} ``] [____________________]{$ans} + +*Note: The arbitrary constants are placed for you, so your answer functions should have no other constants included (except 1). Both functions must be correct to receive credit.* + +Given the initial conditions [`` a_{0} = [$c] ``] and [`` a_{1} = [$d] ``], solve for [`` c_{1} ``] and [`` c_{2} ``]. The final solution is: + + [`` a_{n} = ``] [________________________________________]{$y} + +END_PGML + +BEGIN_PGML_SOLUTION + +The general solution is: + + [`` a_{n} = c_{1} \cdot [$y1] + c_{2} \cdot [$y2] ``] + +Given the initial conditions [`` a_{0} = [$c] ``] and [`` a_{1} = [$d] ``], the final solution is: + + [`` a_{n} = [$y] ``] + +END_PGML_SOLUTION + +ENDDOCUMENT(); \ No newline at end of file diff --git a/Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel2.pg b/Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel2.pg new file mode 100644 index 0000000000..3543247f91 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel2.pg @@ -0,0 +1,104 @@ +## DESCRIPTION +## Generates a 2nd degree constant coefficient homogeneous recurrence relation. +## The characteristic equation will have one repeated nonzero real root. +## A multianswer parser will check both homogeneous solutions in any order entered. +## The problem has the form: a_n = p*a_(n-1) + q*a_(n-2), a_0 = c, a_1 = d +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sequences) +## DBsection(Recurrence Relations) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## Level(3) +## KEYWORDS('discrete math','recurrence relation','2nd degree','homogeneous','constant coefficient','distinct roots') + +DOCUMENT(); + +## Load libraries +loadMacros("PGstandard.pl", + "MathObjects.pl", + "parserMultiAnswer.pl", + "PGML.pl", + "PGcourse.pl", + "contextFraction.pl"); + +## Set the context: no decimal input, absolute tolerance, variable "n", and integer test points for answer checker +Context("Fraction-NoDecimals"); +Context()->flags->set( tolerance => 0.01, tolType => "absolute"); +Context()->variables->are(n=>["Real",limits=>[0,15],resolution=>1]); + +## Randomly generate a nonzero root of the characteristic equation +$r = non_zero_random(-6,6,1); + +## Randomly generate initial conditions +$c = random(-4,4,1); +$d = random(-4,4,1); + +## Compute the coefficients of the problem based on root +$p = 2*$r; +$q = -$r**2; + +## Compute the particular solution constants based on initial conditions +$c1 = $c; +$c2 = Compute("($d - $c*$r)/$r"); + +## Construct the solution of the recurrence relation +$n = Formula("n"); +$y1 = ($r**$n)->reduce; +$y2 = $n*($r**$n)->reduce; +$y = ($c1*$y1 + $c2*$y2)->reduce; + +## Construct the answer parser for the general solution +$ans = MultiAnswer($y1, $y2)->with( + singleResult => 1, + checker => sub { + my ( $correct, $student, $self ) = @_; + my ( $f1stu, $f2stu ) = @{$student}; + my ( $f1, $f2 ) = @{$correct}; + if ( + ($f1 == $f1stu && $f2 == $f2stu ) || + ($f1 == $f2stu && $f2 == $f1stu ) + ) { + return 1; + } else { + return 0; + } + } +); + + +## Display problem +TEXT(beginproblem()); + +BEGIN_PGML +For the recurrence relation: + + [`` a_{n} = [$p]a_{n-1} + [$q]a_{n-2} ``], + +The general solution has the form: + + [`` a_{n} = c_{1} ``] [____________________]{$ans} [`` + c_{2} ``] [____________________]{$ans} + +*Note: The arbitrary constants are placed for you, so your answer functions should have no other constants included (except 1). Both functions must be correct to receive credit.* + +Given the initial conditions [`` a_{0} = [$c] ``] and [`` a_{1} = [$d] ``], solve for [`` c_{1} ``] and [`` c_{2} ``]. The final solution is: + + [`` a_{n} = ``] [________________________________________]{$y} + +END_PGML + +BEGIN_PGML_SOLUTION + +The general solution is: + + [`` a_{n} = c_{1} \cdot [$y1] + c_{2} \cdot [$y2] ``] + +Given the initial conditions [`` a_{0} = [$c] ``] and [`` a_{1} = [$d] ``], the final solution is: + + [`` a_{n} = [$y] ``] + +END_PGML_SOLUTION + +ENDDOCUMENT(); \ No newline at end of file diff --git a/Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel3.pg b/Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel3.pg new file mode 100644 index 0000000000..745e407206 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel3.pg @@ -0,0 +1,86 @@ +## DESCRIPTION +## Generates a 1st degree constant coefficient nonhomogeneous recurrence relation. +## The nonhomogeneous function will be linear. +## The problem has the form: a_n = r*a_(n-1) + pn + q, a_0 = c +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sequences) +## DBsection(Recurrence Relations) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## Level(3) +## KEYWORDS('discrete math','recurrence relation','1st degree','nonhomogeneous','constant coefficient') + +DOCUMENT(); + +## Load libraries +loadMacros("PGstandard.pl", + "MathObjects.pl", + "PGML.pl", + "PGcourse.pl", + "contextFraction.pl"); + +## Set the context: no decimal input, absolute tolerance, variable "n", and integer test points for answer checker +Context("Fraction-NoDecimals"); +Context()->flags->set( tolerance => 0.01, tolType => "absolute"); +Context()->variables->are(n=>["Real",limits=>[0,15],resolution=>1]); + +## Randomly generate a root of the characteristic equation +do {$r = non_zero_random(-6,6,1);} until ($r != 1); + +## Randomly generate initial condition +$c = random(-4,4,1); + +## Randomly generate the coefficients of the specific solution +$A = non_zero_random(-4,4,1); +$B = non_zero_random(-4,4,1); + +## Compute the coefficients of the nonrecursive function based on the specific solution +$p = $A*(1 - $r); +$q = $B*(1 - $r) + $r*$A; + +## Compute the particular solution constant based on the initial conditions +$c1 = $c - $B; + +## Construct the solution of the recurrence relation +$n = Formula("n"); +$y1 = ($r**$n)->reduce; +$s = ($A*$n + $B)->reduce; +$y = ($c1*$y1 + $s)->reduce; + +## Display problem +TEXT(beginproblem()); + +BEGIN_PGML +For the recurrence relation: + + [`` a_{n} = [$r]a_{n-1} + [$p]n + [$q] ``], + +The general solution has the form: + + [`` a_{n} = c_{1} ``] [____________________]{$y1} [`` + ``] [____________________]{$s} + +*Note: The first blank should have the exponential (homogeneous) function. The second blank should have the specific solution.* + +Given the initial condition [`` a_{0} = [$c] ``] and solving for [`` c_{1} ``], the final solution is: + + [`` a_{n} = ``] [________________________________________]{$y} + +END_PGML + +BEGIN_PGML_SOLUTION + +The general solution is: + + [`` a_{n} = c_{1} \cdot [$y1] + [$s] ``] + +Given the initial condition [`` a_{0} = [$c] ``] and solving for [`` c_{1} ``], the final solution is: + + [`` a_{n} = [$y] ``] + +END_PGML_SOLUTION + + +ENDDOCUMENT(); \ No newline at end of file diff --git a/Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel4.pg b/Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel4.pg new file mode 100644 index 0000000000..f52e020f72 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch3s4_recurrencerelations/recrel4.pg @@ -0,0 +1,86 @@ +## DESCRIPTION +## Generates a 1st degree constant coefficient nonhomogeneous recurrence relation. +## The nonhomogeneous function will be exponential. +## The problem has the form: a_n = r*a_(n-1) + k(p^n), a_0 = c +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Sequences) +## DBsection(Recurrence Relations) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## Level(3) +## KEYWORDS('discrete math','recurrence relation','1st degree','nonhomogeneous','constant coefficient') + +DOCUMENT(); + +## Load libraries +loadMacros("PGstandard.pl", + "MathObjects.pl", + "PGML.pl", + "PGcourse.pl", + "contextFraction.pl"); + +## Set the context: no decimal input, absolute tolerance, variable "n", and integer test points for answer checker +Context("Fraction-NoDecimals"); +Context()->flags->set( tolerance => 0.01, tolType => "absolute"); +Context()->variables->are(n=>["Real",limits=>[0,15],resolution=>1]); + +## Randomly generate a root of the characteristic equation +do {$r = non_zero_random(-6,6,1);} until ($r != 1); + +## Randomly generate the base of the nonrecursive exponential function +do {$p = non_zero_random(-6,6,1);} until ($p != $r && $p != 1); + +## Randomly generate an initial condition +$c = random(-4,4,1); + +## Randomly generate the coefficient of the nonrecursive function +$k = non_zero_random(-4,4,1); + +## Compute the coefficient of the specific solution +$A = Compute("($k*$p)/($p-$r)"); + +## Compute the particular solution constant based on the initial conditions +$c1 = $c - $A; + +## Construct the solution of the recurrence relation +$n = Formula("n"); +$y1 = ($r**$n)->reduce; +$s = ($A*($p**$n))->reduce; +$y = ($c1*$y1 + $s)->reduce; + +## Display problem +TEXT(beginproblem()); + +BEGIN_PGML +For the recurrence relation: + + [`` a_{n} = [$r]a_{n-1} + [$k]([$p])^{n} ``], + +The general solution has the form: + + [`` a_{n} = c_{1} ``] [____________________]{$y1} [`` + ``] [____________________]{$s} + +*Note: The first blank should have the exponential (homogeneous) function. The second blank should have the specific solution.* + +Given the initial condition [`` a_{0} = [$c] ``] and solving for [`` c_{1} ``], the final solution is: + + [`` a_{n} = ``] [________________________________________]{$y} + +END_PGML + +BEGIN_PGML_SOLUTION + +The general solution is: + + [`` a_{n} = c_{1} \cdot [$y1] + [$s] ``] + +Given the initial condition [`` a_{0} = [$c] ``] and solving for [`` c_{1} ``], the final solution is: + + [`` a_{n} = [$y] ``] + +END_PGML_SOLUTION + +ENDDOCUMENT(); \ No newline at end of file diff --git a/Contrib/LaTech/DiscreteMath/ch4As1_matrices/boolmatrix1.pg b/Contrib/LaTech/DiscreteMath/ch4As1_matrices/boolmatrix1.pg new file mode 100644 index 0000000000..65799a4827 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch4As1_matrices/boolmatrix1.pg @@ -0,0 +1,88 @@ +## DESCRIPTION +## Generates two random 3x3 zero-one matrices and ask to compute their meet and join. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Discete Structures) +## DBsection(Matrices) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','matrix','boolean','meet','join','zero-one') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"MathObjects.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Set the context for matrices +Context("Matrix"); + +## Create random 3x3 boolean matrices +$A = Matrix([ +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)] +]); + +$B = Matrix([ +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)] +]); + +## Create their meet and join +for my $i (1..3) { + for my $j (1..3) { + $temp1[$i][$j] = $A->element($i,$j)*$B->element($i,$j); + $temp2[$i][$j] = min($A->element($i,$j)+$B->element($i,$j), 1); + } +} + +$meet = Matrix([ +[$temp1[1][1],$temp1[1][2],$temp1[1][3]], +[$temp1[2][1],$temp1[2][2],$temp1[2][3]], +[$temp1[3][1],$temp1[3][2],$temp1[3][3]] +]); + +$join = Matrix([ +[$temp2[1][1],$temp2[1][2],$temp2[1][3]], +[$temp2[2][1],$temp2[2][2],$temp2[2][3]], +[$temp2[3][1],$temp2[3][2],$temp2[3][3]] +]); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML + +For the matrices [` A = [$A] `] and [` B = [$B] `], their meet is: + +[`` A \wedge B ``] = [___]*{$meet} + +And their join is: + +[`` A \vee B ``] = [___]*{$join} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +For the matrices [` A = [$A] `] and [` B = [$B] `], their meet is: + +[`` A \wedge B = [$meet] ``] + +And their join is: + +[`` A \vee B = [$join] ``] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch4As1_matrices/boolmatrix2.pg b/Contrib/LaTech/DiscreteMath/ch4As1_matrices/boolmatrix2.pg new file mode 100644 index 0000000000..38a18913d6 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch4As1_matrices/boolmatrix2.pg @@ -0,0 +1,74 @@ +## DESCRIPTION +## Generates two random 3x3 zero-one matrices and asks to compute their boolean product. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Discete Structures) +## DBsection(Matrices) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','matrix','boolean product') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"MathObjects.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Set the context for matrices +Context("Matrix"); + +## Create random 3x3 boolean matrices +$A = Matrix([ +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)] +]); + +$B = Matrix([ +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)] +]); + +## Create their boolean product +for my $i (1..3) { + for my $j (1..3) { + $temp[$i][$j] = min(($A->row($i)*$B->column($j))->element(1,1), 1); + } +} + +$prod = Matrix([ +[$temp[1][1],$temp[1][2],$temp[1][3]], +[$temp[2][1],$temp[2][2],$temp[2][3]], +[$temp[3][1],$temp[3][2],$temp[3][3]] +]); + + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML + +For the matrices [` A = [$A] `] and [` B = [$B] `], their boolean product is: + +[`` A \odot B ``] = [___]*{$prod} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +For the matrices [` A = [$A] `] and [` B = [$B] `], their boolean product is: + +[`` A \odot B = [$prod] ``] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch4As3_relations/boolmatrixrep1.pg b/Contrib/LaTech/DiscreteMath/ch4As3_relations/boolmatrixrep1.pg new file mode 100644 index 0000000000..749d8b6f25 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch4As3_relations/boolmatrixrep1.pg @@ -0,0 +1,83 @@ +## DESCRIPTION +## Generates two random 3x3 zero-one matrices representing relations and asks to compute the +## matrix representation of the union and intersection of the relations. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Discete Structures) +## DBsection(Matrices) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','matrix','boolean','meet','join','relation','union','intersection') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"MathObjects.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Set the context for matrices +Context("Matrix"); + +## Create random 3x3 boolean matrices +$A = Matrix([ +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)] +]); + +$B = Matrix([ +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)] +]); + +## Create their meet and join +for my $i (1..3) { + for my $j (1..3) { + $temp1[$i][$j] = $A->element($i,$j)*$B->element($i,$j); + $temp2[$i][$j] = min($A->element($i,$j)+$B->element($i,$j), 1); + } +} + +$meet = Matrix([ +[$temp1[1][1],$temp1[1][2],$temp1[1][3]], +[$temp1[2][1],$temp1[2][2],$temp1[2][3]], +[$temp1[3][1],$temp1[3][2],$temp1[3][3]] +]); + +$join = Matrix([ +[$temp2[1][1],$temp2[1][2],$temp2[1][3]], +[$temp2[2][1],$temp2[2][2],$temp2[2][3]], +[$temp2[3][1],$temp2[3][2],$temp2[3][3]] +]); + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML + +Suppose the matrix representation for relations [` R `] and [` S `] are [` M_{R} = [$A] `] and [` M_{S} = [$B] `]. Compute the matrix represenation for [` M_{R \cap S} `] and [` M_{R \cup S} `]. + +[`` M_{R \cap S} ``] = [___]*{$meet} + +[`` M_{R \cup S} ``] = [___]*{$join} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` M_{R \cap S} = [$meet] ``] + +[`` M_{R \cup S} = [$join] ``] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch4As3_relations/boolmatrixrep2.pg b/Contrib/LaTech/DiscreteMath/ch4As3_relations/boolmatrixrep2.pg new file mode 100644 index 0000000000..095bb92965 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch4As3_relations/boolmatrixrep2.pg @@ -0,0 +1,73 @@ +## DESCRIPTION +## Generates two random 3x3 zero-one matrices representing relations and asks to compute the +## matrix representation of the composition of the relations. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Discete Structures) +## DBsection(Matrices) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','matrix','boolean product','relation','composition') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"MathObjects.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Set the context for matrices +Context("Matrix"); + +## Create random 3x3 boolean matrices +$A = Matrix([ +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)] +]); + +$B = Matrix([ +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)] +]); + +## Create their boolean product +for my $i (1..3) { + for my $j (1..3) { + $temp[$i][$j] = min(($A->row($i)*$B->column($j))->element(1,1), 1); + } +} + +$prod = Matrix([ +[$temp[1][1],$temp[1][2],$temp[1][3]], +[$temp[2][1],$temp[2][2],$temp[2][3]], +[$temp[3][1],$temp[3][2],$temp[3][3]] +]); + + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML + +Suppose the matrix representation for relations [` R `] and [` S `] are [` M_{R} = [$A] `] and [` M_{S} = [$B] `]. Compute the matrix represenation for [` M_{S \circ R} `]. + +[`` M_{S \circ R} ``] = [___]*{$prod} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` M_{S \circ R} = [$prod] ``] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch4As3_relations/boolmatrixrep3.pg b/Contrib/LaTech/DiscreteMath/ch4As3_relations/boolmatrixrep3.pg new file mode 100644 index 0000000000..ebeecc82f8 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch4As3_relations/boolmatrixrep3.pg @@ -0,0 +1,70 @@ +## DESCRIPTION +## Generates a random 3x3 zero-one matrix representing a relation and asks to compute the +## matrix representation of the inverse and complement of the relation. +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Discete Structures) +## DBsection(Matrices) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Jason Terry) +## KEYWORDS('discrete math','matrix','boolean','inverse','complement','relation') + + +DOCUMENT(); + +## Load libraries +loadMacros( +"PGstandard.pl", +"MathObjects.pl", +"PGcourse.pl", +"PGML.pl" +); + +## Set the context for matrices +Context("Matrix"); + +## Create a random 3x3 boolean matrix +$A = Matrix([ +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)], +[random(0,1,1),random(0,1,1),random(0,1,1)] +]); + + +## Create the matrices representing the inverse and complement relation +$inverse = $A->transpose; + +$ones = Matrix([ +[1,1,1], +[1,1,1], +[1,1,1] +]); + +$comp = $ones - $A; + + +## Display question +TEXT(beginproblem()); + +BEGIN_PGML + +Suppose the matrix representation for relation [` R `] is [` M_{R} = [$A] `]. Compute the matrix represenation for the inverse relation [` M_{R^{-1}} `] and the complement relation [` M_{\overline{R}} `]. + +[`` M_{R^{-1}} ``] = [___]*{$inverse} + +[`` M_{\overline{R}} ``] = [___]*{$comp} + +END_PGML + +BEGIN_PGML_SOLUTION +Solutions: + +[`` M_{R^{-1}} = [$inverse] ``] + +[`` M_{\overline{R}} = [$comp] ``] + +END_PGML_SOLUTION + +ENDDOCUMENT(); diff --git a/Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language1.pg b/Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language1.pg new file mode 100644 index 0000000000..ed1461442f --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language1.pg @@ -0,0 +1,43 @@ +## DESCRIPTION +## Strings and Languages: Even Length Strings +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Computation Theory) +## DBsection(Strings and Languages) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Grok3) +## KEYWORDS('computation', 'strings', 'languages') + +DOCUMENT(); + +loadMacros( + "PGstandard.pl", + "MathObjects.pl", + "PGML.pl", + "parserPopUp.pl", +); + +TEXT(beginproblem()); + +# Generate a random binary string +$alphabet = "01"; +$length = random(4, 8, 1); +$string = ""; +for ($i = 0; $i < $length; $i++) { + $string .= substr($alphabet, random(0, 1, 1), 1); +} +# Language: strings of even length +$answer = ($length % 2 == 0) ? "Yes" : "No"; +$popup = PopUp(['Choose...','Yes', 'No'], $answer); + +BEGIN_PGML +Consider the language [`` L ``] over the alphabet [`` \{0, 1\} ``] that consists of all strings of even length. Determine if the following string belongs to [`` L ``]: + +String: [$string] + +Does the string belong to the language? [________]{$popup} +END_PGML + +ENDDOCUMENT(); \ No newline at end of file diff --git a/Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language2.pg b/Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language2.pg new file mode 100644 index 0000000000..175d7de965 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language2.pg @@ -0,0 +1,44 @@ +## DESCRIPTION +## Strings and Languages: Starts with 0 +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Computation Theory) +## DBsection(Strings and Languages) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Grok3) +## KEYWORDS('computation', 'strings', 'languages') + +DOCUMENT(); + +loadMacros( + "PGstandard.pl", + "MathObjects.pl", + "PGML.pl", + "parserPopUp.pl", +); + +TEXT(beginproblem()); + +# Generate a random binary string +$alphabet = "01"; +$length = random(3, 7, 1); +$start = random(0, 1, 1); +$string = $start; +for ($i = 1; $i < $length; $i++) { + $string .= substr($alphabet, random(0, 1, 1), 1); +} +# Language: strings starting with 0 +$answer = ($start eq "0") ? "Yes" : "No"; +$popup = PopUp(['Choose...','Yes', 'No'], $answer); + +BEGIN_PGML +Consider the language [`` L ``] over the alphabet [`` \{0, 1\} ``] that consists of all strings starting with 0. Determine if the following string belongs to [`` L ``]: + +String: [$string] + +Does the string belong to the language? [________]{$popup} +END_PGML + +ENDDOCUMENT(); \ No newline at end of file diff --git a/Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language3.pg b/Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language3.pg new file mode 100644 index 0000000000..c1381f343a --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language3.pg @@ -0,0 +1,44 @@ +## DESCRIPTION +## Strings and Languages: Number of 1's Divisible by 3 +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Computation Theory) +## DBsection(Strings and Languages) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Grok3) +## KEYWORDS('computation', 'strings', 'languages') + +DOCUMENT(); + +loadMacros( + "PGstandard.pl", + "MathObjects.pl", + "PGML.pl", + "parserPopUp.pl", +); + +TEXT(beginproblem()); + +# Generate a random binary string +$alphabet = "01"; +$length = random(5, 10, 1); +$string = ""; +for ($i = 0; $i < $length; $i++) { + $string .= substr($alphabet, random(0, 1, 1), 1); +} +# Language: strings where the number of 1's is divisible by 3 +$one_count = () = $string =~ /1/g; +$answer = ($one_count % 3 == 0) ? "Yes" : "No"; +$popup = PopUp(['Choose...','Yes', 'No'], $answer); + +BEGIN_PGML +Consider the language [`` L ``] over the alphabet [`` \{0, 1\} ``] that consists of all strings where the number of 1's is divisible by 3. Determine if the following string belongs to [`` L ``]: + +String: [$string] + +Does the string belong to the language? [________]{$popup} +END_PGML + +ENDDOCUMENT(); \ No newline at end of file diff --git a/Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language4.pg b/Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language4.pg new file mode 100644 index 0000000000..5c904366cf --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch4Cs1_stringslanguages/strings_language4.pg @@ -0,0 +1,49 @@ +## DESCRIPTION +## Strings and Languages: Concatenating languages +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Computation Theory) +## DBsection(Strings and Languages) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Grok3) +## KEYWORDS('computation', 'strings', 'languages','concatenation') + +DOCUMENT(); + +loadMacros( + "PGstandard.pl", + "PGML.pl", + "parserMultiAnswer.pl" +); + +TEXT(beginproblem()); + +# Enable set context with string elements +Context()->strings->add("ab" => {}, "abb" => {}, "abbb" => {}); + +Context()->lists->set( + separator => ',', + start => '{', + end => '}', + list_type => 'set', +); + +# The correct set of strings +$answer = List("ab", "abb", "abbb"); + + +BEGIN_PGML +Let [`` L_{1} = \{a,ab\} ``] and [`` L_{2} = \{b,bb\} ``]. + +Give all the strings in the concatenation [`` L_{1}L_{2} ``]. Write your answer in the set below as an explicit list: + +[`` L_{1}L_{2} = \{ ``] [_________________________]{$answer} [`` \} ``] +END_PGML + +BEGIN_PGML_SOLUTION +Distinct results: [`` ab,abb,abbb ``] +END_PGML_SOLUTION + +ENDDOCUMENT(); \ No newline at end of file diff --git a/Contrib/LaTech/DiscreteMath/ch4Cs2_dfa/dfa1.pg b/Contrib/LaTech/DiscreteMath/ch4Cs2_dfa/dfa1.pg new file mode 100644 index 0000000000..c222a4015e --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch4Cs2_dfa/dfa1.pg @@ -0,0 +1,66 @@ +## DESCRIPTION +## DFA: Ends with 01 +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Computation Theory) +## DBsection(DFA) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Grok3) +## KEYWORDS('computation', 'strings', 'languages','dfa','automata') + +DOCUMENT(); + +loadMacros( + "PGstandard.pl", + "MathObjects.pl", + "niceTables.pl", + "PGML.pl", + "parserPopUp.pl", +); + +TEXT(beginproblem()); + +# Generate a random binary string +$alphabet = "01"; +$length = random(4, 8, 1); +$string = ""; +for ($i = 0; $i < $length; $i++) { + $string .= substr($alphabet, random(0, 1, 1), 1); +} +# DFA states: q0 (initial), q1 (seen 0), q2 (seen 01, accepting) +$current_state = "q0"; +foreach my $char (split //, $string) { + if ($current_state eq "q0") { + $current_state = ($char eq "0") ? "q1" : "q0"; + } elsif ($current_state eq "q1") { + $current_state = ($char eq "1") ? "q2" : "q1"; + } elsif ($current_state eq "q2") { + $current_state = ($char eq "0") ? "q1" : "q0"; + } +} +$answer = ($current_state eq "q2") ? "Accept" : "Reject"; +$popup = PopUp(['Choose...','Accept', 'Reject'], $answer); + +BEGIN_PGML +Consider a DFA over the alphabet \{0, 1\} that has states [` q_0 `], [` q_1 `], and [` q_2 `]. The transition table is: + +[@ +DataTable([ +["\\(\\delta \\)","\\( 0\\)","\\( 1\\)"], +["\\(>q_0\\)","\\(q_1\\)","\\(q_0\\)"], +["\\(q_1\\)","\\(q_1\\)","\\(q_2\\)"], +["\\(*q_2\\)","\\(q_1\\)","\\(q_0\\)"] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +Given the input string [$string], what is the outcome? + +[________]{$popup} +END_PGML + + +ENDDOCUMENT(); \ No newline at end of file diff --git a/Contrib/LaTech/DiscreteMath/ch4Cs2_dfa/dfa2.pg b/Contrib/LaTech/DiscreteMath/ch4Cs2_dfa/dfa2.pg new file mode 100644 index 0000000000..85a8243160 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch4Cs2_dfa/dfa2.pg @@ -0,0 +1,61 @@ +## DESCRIPTION +## DFA: Even Number of 0's +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Computation Theory) +## DBsection(DFA) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Grok3) +## KEYWORDS('computation', 'strings', 'languages','dfa','automata') + +DOCUMENT(); + +loadMacros( + "PGstandard.pl", + "MathObjects.pl", + "niceTables.pl", + "PGML.pl", + "parserPopUp.pl", +); + +TEXT(beginproblem()); + +# Generate a random binary string +$alphabet = "01"; +$length = random(4, 8, 1); +$string = ""; +for ($i = 0; $i < $length; $i++) { + $string .= substr($alphabet, random(0, 1, 1), 1); +} +# DFA states: q0 (even 0's, accepting), q1 (odd 0's) +$current_state = "q0"; +foreach my $char (split //, $string) { + if ($char eq "0") { + $current_state = ($current_state eq "q0") ? "q1" : "q0"; + } +} +$answer = ($current_state eq "q0") ? "Accept" : "Reject"; +$popup = PopUp(['Choose...','Accept', 'Reject'], $answer); + +BEGIN_PGML +Consider a DFA over the alphabet \{0, 1\} that has states [` q_0 `], [` q_1 `]. The transition table is: + +[@ +DataTable([ +["\\(\\delta \\)","\\( 0\\)","\\( 1\\)"], +["\\(>*q_0\\)","\\(q_1\\)","\\(q_0\\)"], +["\\(q_1\\)","\\(q_0\\)","\\(q_1\\)"] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +Given the input string [$string], what is the outcome? + +[________]{$popup} +END_PGML + + +ENDDOCUMENT(); \ No newline at end of file diff --git a/Contrib/LaTech/DiscreteMath/ch4Cs2_dfa/dfa3.pg b/Contrib/LaTech/DiscreteMath/ch4Cs2_dfa/dfa3.pg new file mode 100644 index 0000000000..15d3cbf8ad --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch4Cs2_dfa/dfa3.pg @@ -0,0 +1,66 @@ +## DESCRIPTION +## DFA: Final State Identification +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Computation Theory) +## DBsection(DFA) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Grok3) +## KEYWORDS('computation', 'strings', 'languages','dfa','automata') + +DOCUMENT(); + +loadMacros( + "PGstandard.pl", + "MathObjects.pl", + "niceTables.pl", + "PGML.pl", + "parserPopUp.pl", +); + +TEXT(beginproblem()); + +# Generate a random binary string +$alphabet = "01"; +$length = random(3, 7, 1); +$string = ""; +for ($i = 0; $i < $length; $i++) { + $string .= substr($alphabet, random(0, 1, 1), 1); +} +# DFA states: q0 (initial), q1, q2 (accepting) +$current_state = "q0"; +foreach my $char (split //, $string) { + if ($current_state eq "q0") { + $current_state = ($char eq "0") ? "q1" : "q2"; + } elsif ($current_state eq "q1") { + $current_state = ($char eq "0") ? "q2" : "q0"; + } elsif ($current_state eq "q2") { + $current_state = ($char eq "0") ? "q0" : "q1"; + } +} +$answer = $current_state; +$popup = PopUp(['Choose...','q0', 'q1', 'q2'], $answer); + +BEGIN_PGML +Consider a DFA over the alphabet \{0, 1\} with states [` q_0 `], [` q_1 `], and [` q_2 `]. The transition table is: + +[@ +DataTable([ +["\\(\\delta \\)","\\( 0\\)","\\( 1\\)"], +["\\(>q_0\\)","\\(q_1\\)","\\(q_2\\)"], +["\\(q_1\\)","\\(q_2\\)","\\(q_0\\)"], +["\\(*q_2\\)","\\(q_0\\)","\\(q_1\\)"] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +Given the input string [$string], what is the final state? + +[________]{$popup} +END_PGML + + +ENDDOCUMENT(); \ No newline at end of file diff --git a/Contrib/LaTech/DiscreteMath/ch4Cs3_nfa/nfa1.pg b/Contrib/LaTech/DiscreteMath/ch4Cs3_nfa/nfa1.pg new file mode 100644 index 0000000000..353c0f35f1 --- /dev/null +++ b/Contrib/LaTech/DiscreteMath/ch4Cs3_nfa/nfa1.pg @@ -0,0 +1,73 @@ +## DESCRIPTION +## NFA: Contains 00 +## ENDDESCRIPTION + +## DBsubject(Discrete Math) +## DBchapter(Computation Theory) +## DBsection(DFA) +## Date(06/03/2026) +## Institution(Louisiana Tech University) +## Author(Grok3) +## KEYWORDS('computation', 'strings', 'languages','nfa','automata') + +DOCUMENT(); + +loadMacros( + "PGstandard.pl", + "MathObjects.pl", + "niceTables.pl", + "PGML.pl", + "parserPopUp.pl", +); + +TEXT(beginproblem()); + +# Generate a random binary string +$alphabet = "01"; +$length = random(4, 8, 1); +$string = ""; +for ($i = 0; $i < $length; $i++) { + $string .= substr($alphabet, random(0, 1, 1), 1); +} +# NFA states: q0 (initial), q1 (seen 0), q2 (seen 00, accepting) +@states = ("q0"); +$new_states = []; +foreach my $char (split //, $string) { + $new_states = []; + foreach my $state (@states) { + if ($state eq "q0") { + push @$new_states, "q0"; + push @$new_states, "q1" if $char eq "0"; + } elsif ($state eq "q1") { + push @$new_states, "q2" if $char eq "0"; + } elsif ($state eq "q2") { + push @$new_states, "q2"; + } + } + @states = @$new_states; +} +%seen = (); +@states = grep { !$seen{$_}++ } @states; +$answer = (grep { $_ eq "q2" } @states) ? "Accept" : "Reject"; +$popup = PopUp(['Choose...','Accept', 'Reject'], $answer); + +BEGIN_PGML +Consider an NFA over the alphabet \{0, 1\}. The NFA has states [` q_0 `], [` q_1 `], [` q_2 `]. The transition table is: + +[@ +DataTable([ +["\\(\\delta \\)","\\( 0\\)","\\( 1\\)"], +["\\(>q_0\\)","\\(\\{q_0,q_1\\}\\)","\\(\\{q_0\\}\\)"], +["\\(q_1\\)","\\(\\{q_2\\}\\)","\\(\\emptyset \\)"], +["\\(*q_2\\)","\\(\\{q_2\\} \\)","\\(\\{q_2\\}\\)"] +], +midrules => 1, align => '| c | c | c |' +); +@]*** + +Given the input string [$string], what is the outcome? + +[________]{$popup} +END_PGML + +ENDDOCUMENT(); \ No newline at end of file