Skip to content

Commit

Permalink
Fix to issue #1360: enable logic_simplify(), and add it to ATAlgEquiv.
Browse files Browse the repository at this point in the history
  • Loading branch information
sangwinc committed Jan 16, 2025
1 parent d224f5c commit eb775f1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
11 changes: 6 additions & 5 deletions stack/maxima/assessment.mac
Original file line number Diff line number Diff line change
Expand Up @@ -1299,13 +1299,14 @@ logical_normal(ex):=block(
/* Change the noun logical operators into associative indenpotent ones. */
ex:abs_replace_eq(ex),
ex:boolean_form(ex),
ex:subst("%and", "nounand", ex),
ex:subst("%or", "nounor", ex),
/* %not is not an infix operator... */
ex:subst(%not, "not", ex),
ex:subst(%not, "nounnot", ex),
ex:subst("and", "nounand", ex),
ex:subst("or", "nounor", ex),
ex:subst("not", "nounnot", ex),
ex:if not ev(numberp(ex), simp) then logic_simplify(ex) else ex,
ex:subst("%and", "and", ex),
ex:subst("%or", "or", ex),
/* %not is not an infix operator... */
ex:subst(%not, "not", ex),
ex:de_morgan(ex),
ex:trigsimp(ex),
ex:exponentialize(ex),
Expand Down
1 change: 1 addition & 0 deletions stack/maxima/stackmaxima.mac
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ load("functs");
/* Load the logic package, but remove the "eq" infix operator which conflicts with too many existing things. */
/* We've edited the logic package which over writes the eq operator as xnor. */
load("stack_logic.lisp");
load("Ksimplifier.lisp");

/* We don't want to allow people to put boxes round things. */
box(ex) := ex;
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/answertestfixtures.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ class stack_answertest_test_data {
['AlgEquiv', '', 'not(A) and B', 'A implies B', 0, '', ''],
['AlgEquiv', '', '(not A and B) or (not B and A)', 'A xor B', 1, 'ATLogic_True.', ''],
['AlgEquiv', '', '(A and B) or (not A and not B)', 'A xnor B', 1, 'ATLogic_True.', ''],
['AlgEquiv', '', '((not A) and (not B)) or ((not A) and B)', 'not A', 1, 'ATLogic_True.', ''],
// We can't apply this simplification to sets, as it breaks sets of inequalities.
['AlgEquiv', '', '{not(A) or B,A and B}', '{A implies B,A and B}', 0, 'ATSet_wrongentries.', ''],
['AlgEquiv', '', '{A implies B,A and B}', '{not(A) and B,A and B}', 0, 'ATSet_wrongentries.', ''],
Expand Down

0 comments on commit eb775f1

Please sign in to comment.