[Maxima] Logic algebra
macrakis at alum.mit.edu
Fri Apr 11 13:05:01 CDT 2008
> [Logicexprp] accepts any atom. Of course, it shouldn't be so; I think there should
> be a feature which marks symbols as "logic":
Maxima's general philosophy about the types of arguments is that any
argument is allowed unless it can be proven to be disallowed. Thus,
Maxima allows x.y without declaration of x and y as non-scalar. %pi
is known to be a scalar, so Maxima can simplify %pi . x to %pi * x.
%pi is also known to be a real number, therefore not a logical value,
so (%pi and x) should be an error (it is not currently). Similarly,
without additional information, arbitrary functions are allowed in
expressions e.g. (f(x) and g(x)). Excluding them removes much of the
power of Maxima.
> > x NAND x etc. doesn't simplify to NOT x etc.
> It's a bad idea since it may be undesirable to introduce the logical NOT
> function. By default, package should apply only simplification rules which
> are not affect basis.
Yes, that is one reasonable philosophy. But there is in general no
way of knowing which basis the user prefers. Maxima's normal mode of
operation for algebraic expressions is to normalize to its standard
operators (e.g. -x/y is expressed as (-1)*x*y^(-1), not as -(x/y) or
I see your point that if you've converted to a certain basis, you
don't want Maxima to simplify to some other basis, but I don't see how
Maxima will know which basis is appropriate.
And of course input expressions may be expressed using more than a
minimal set of operators.
I am not sure what the best thing to do here is. The most consistent
with algebraic expressions would be to convert to the boolean basis
*except* where subnodes need to be duplicated: e.g. x NAND y => NOT (x
AND y) is OK, but x XOR y => (x AND NOT y) OR (NOT x AND y) is only
done with an explicit Expand function.
Perhaps there should be a global flag: logical_basis, which is a list
of operators which the simplifier may introduce during simplification;
the default would be AND, OR, NOT. Then we would have a function
to_logical_basis(..., [optional basis]) which would convert to that
logical basis. I'd think that no matter what, you'd want the
simplifier to be allowed to introduce logical constants, e.g. with
logical_basis = (NOT, AND), x AND NOT x could still simplify to false.
More information about the Maxima