%mathpiper,def="LogicTest"

/* LogicTest compares the truth tables of two expressions. */
LocalSymbols(TrueFalse)
[
  MacroRulebase(TrueFalse,{var,expr});
  10 # TrueFalse(var_IsAtom,_expr) <-- `{(@expr) Where (@var)==False,(@expr) Where (@var)==True};
  20 # TrueFalse({},_expr) <-- `(@expr);
  30 # TrueFalse(var_IsList,_expr) <--
  `[
    Local(t,h);
    Bind(h,First(@var));
    Bind(t,Rest(@var));
    TrueFalse(h,TrueFalse(t,@expr));
  ];

  Macro(LogicTest,{vars,expr1,expr2}) Verify(TrueFalse((@vars),(@expr1)), TrueFalse((@vars),(@expr2)));
];

%/mathpiper





%mathpiper_docs,name="LogicTest",categories="Programmer Functions;Testing"
*CMD LogicTest --- verifying equivalence of two expressions
*STD
*CALL
	LogicTest(variables,expr1,expr2)

*PARMS

{variables} -- list of variables

{exprN} -- Some boolean expression

*DESC

The command {LogicTest} can be used to verify that an
expression is <I>equivalent</I> to  a correct answer after evaluation.
It returns {True} or {False}.


*E.G.

In> LogicTest({A,B,C},Not((Not A) And (Not B)),A Or B)
Result: True
In> LogicTest({A,B,C},Not((Not A) And (Not B)),A Or C)
	******************
	CommandLine: 1

	$TrueFalse4({A,B,C},Not(Not A And Not B))
	 evaluates to
	{{{False,False},{True,True}},{{True,True},{True,True}}}
	 which differs from
	{{{False,True},{False,True}},{{True,True},{True,True}}}
	******************
Result: False

*SEE Simplify, CanProve, KnownFailure, Verify, TestMathPiper, LogicVerify

%/mathpiper_docs